Skip to content

Commit 409f015

Browse files
committed
Minor bug fixes
1 parent 47e7734 commit 409f015

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

difPy/dif.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,13 @@ def _validate_files(self, directory):
140140
def _filter_extensions(self, directory_files):
141141
# Function that filters by files with a specific filetype
142142
valid_extensions = np.array(['apng', 'bw', 'cdf', 'cur', 'dcx', 'dds', 'dib', 'emf', 'eps', 'fli', 'flc', 'fpx', 'ftex', 'fits', 'gd', 'gd2', 'gif', 'gbr', 'icb', 'icns', 'iim', 'ico', 'im', 'imt', 'j2k', 'jfif', 'jfi', 'jif', 'jp2', 'jpe', 'jpeg', 'jpg', 'jpm', 'jpf', 'jpx', 'jpeg', 'mic', 'mpo', 'msp', 'nc', 'pbm', 'pcd', 'pcx', 'pgm', 'png', 'ppm', 'psd', 'pixar', 'ras', 'rgb', 'rgba', 'sgi', 'spi', 'spider', 'sun', 'tga', 'tif', 'tiff', 'vda', 'vst', 'wal', 'webp', 'xbm', 'xpm'])
143-
extensions = [file.split(".")[1].lower() for file in directory_files]
143+
extensions = list()
144+
for file in directory_files:
145+
try:
146+
ext = file.split(".")[-1].lower()
147+
extensions.append(ext)
148+
except:
149+
extensions.append("_")
144150
keep_files = directory_files[np.isin(extensions, valid_extensions)]
145151
skip_files = directory_files[np.logical_not(np.isin(extensions, valid_extensions))]
146152
return keep_files, skip_files
@@ -455,7 +461,7 @@ def delete(self, silent_del=False):
455461
if not silent_del:
456462
usr = input('Are you sure you want to delete all lower quality matched images? \n! This cannot be undone. (y/n)')
457463
if str(usr).lower() == 'y':
458-
for file in self.lower_quality:
464+
for file in self.lower_quality['lower_quality']:
459465
try:
460466
os.remove(file)
461467
deleted_files += 1
@@ -465,7 +471,7 @@ def delete(self, silent_del=False):
465471
print('Deletion canceled.')
466472
return
467473
else:
468-
for file in self.lower_quality:
474+
for file in self.lower_quality['lower_quality']:
469475
try:
470476
os.remove(file)
471477
deleted_files += 1

difPy/version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '4.0.0'
1+
__version__ = '4.0.1'

0 commit comments

Comments
 (0)