-from typing import List, Optional, TextIO
+from typing import Callable, List, Literal, Optional, TextIO
):
ret = []
if not file_is_readable(filename):
raise Exception(f'{filename} can\'t be read.')
with open(filename) as rf:
for line in rf:
):
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_transformers:
- line = transformation(line)
+ if line_transformers is not None:
+ for transformation in line_transformers:
+ line = transformation(line)
"""A helper that writes a file to a temporary location and then moves
it atomically to its ultimate destination on close.
"""A helper that writes a file to a temporary location and then moves
it atomically to its ultimate destination on close.
- def __exit__(self, exc_type, exc_val, exc_tb) -> Optional[bool]:
+ def __exit__(self, exc_type, exc_val, exc_tb) -> Literal[False]: