Commit 74a24f0f authored by thomwolf's avatar thomwolf
Browse files

clean up file_utils

parent ab49fafc
...@@ -258,21 +258,3 @@ def get_from_cache(url, cache_dir=None): ...@@ -258,21 +258,3 @@ def get_from_cache(url, cache_dir=None):
logger.info("removing temp file %s", temp_file.name) logger.info("removing temp file %s", temp_file.name)
return cache_path return cache_path
def read_set_from_file(filename):
'''
Extract a de-duped collection (set) of text from a file.
Expected file format is one item per line.
'''
collection = set()
with open(filename, 'r', encoding='utf-8') as file_:
for line in file_:
collection.add(line.rstrip())
return collection
def get_file_extension(path, dot=True, lower=True):
ext = os.path.splitext(path)[1]
ext = ext if dot else ext[1:]
return ext.lower() if lower else ext
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment