clean up file_utils

This commit is contained in:
thomwolf
2019-07-15 13:49:01 +02:00
parent ab49fafc04
commit 74a24f0fe9

View File

@@ -258,21 +258,3 @@ def get_from_cache(url, cache_dir=None):
logger.info("removing temp file %s", temp_file.name)
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