clean up file_utils
This commit is contained in:
@@ -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
|
|
||||||
|
|||||||
Reference in New Issue
Block a user