fix: Removed some unused variables

This commit is contained in:
Sayantan Santra 2024-02-29 10:00:08 -06:00
parent 1b2807ddd2
commit f4f23cb527
Signed by: SinTan1729
GPG key ID: EB3E68BFBA25C85F

View file

@ -36,14 +36,14 @@ def ensure_directory_exists(path, expand_user=True, file=False):
if not os.path.exists(directory) and directory: if not os.path.exists(directory) and directory:
try: try:
os.makedirs(directory) os.makedirs(directory)
except OSError as e: except OSError:
# A parallel process created the directory after the existence check. # A parallel process created the directory after the existence check.
pass pass
return path return path
def valid_filename(directory, filename=None, ascii=False): def valid_filename(directory, filename=None):
""" Return a valid "new" filename in a directory, given a filename/directory=path to test. """ Return a valid "new" filename in a directory, given a filename/directory=path to test.
Deal with duplicate filenames. Deal with duplicate filenames.
@ -61,11 +61,6 @@ def valid_filename(directory, filename=None, ascii=False):
filename = os.path.basename(directory) filename = os.path.basename(directory)
directory = os.path.dirname(directory) directory = os.path.dirname(directory)
# if ascii:
# filename = unidecode(unicode(filename))
# filename = ' '.join(filename.splitlines()).strip()
# filename = filename.decode('ascii', 'ignore')
# Allow for directories. # Allow for directories.
items = set(os.listdir(directory)) items = set(os.listdir(directory))
if filename in items: if filename in items: