Change locking boundaries for shared dict. Add a unit test.
[python_utils.git] / file_utils.py
index 22210e4444afcb5223fbfcf70dcfe839baa15edd..cd37f3069c70efd5c0f835e3362adbdf18d52e24 100644 (file)
@@ -33,15 +33,18 @@ def remove_hash_comments(x):
     return re.sub(r'#.*$', '', x)
 
 
-def read_file_to_list(
-    filename: str, *, skip_blank_lines=False, line_transformations=[]
+def slurp_file(
+    filename: str,
+    *,
+    skip_blank_lines=False,
+    line_transformers=[],
 ):
     ret = []
     if not file_is_readable(filename):
         raise Exception(f'{filename} can\'t be read.')
     with open(filename) as rf:
         for line in rf:
-            for transformation in line_transformations:
+            for transformation in line_transformers:
                 line = transformation(line)
             if skip_blank_lines and line == '':
                 continue