We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2b1cb8f commit 1c869fbCopy full SHA for 1c869fb
1 file changed
python_tiny_projects/remove_duplicates/remove_duplicates.py
@@ -4,14 +4,15 @@
4
import ipyplot
5
import numpy as np
6
from PIL import Image
7
+from tqdm import tqdm
8
9
10
path = './data_test'
11
12
file_list = os.walk(path)
13
14
file_hashes = dict()
-for root,folders,files in file_list:
15
+for root,folders,files in tqdm(file_list):
16
for file in files:
17
path = Path(os.path.join(root,file))
18
fhash = hashlib.md5(open(path,'rb').read()).hexdigest()
@@ -24,7 +25,7 @@
24
25
duplicate_file_paths = [x[1] for x in file_hashes.items() if len(x[1])>1]
26
27
get_len = lambda x: len(x.stem)
-for duplicates in duplicate_file_paths:
28
+for duplicates in tqdm(duplicate_file_paths):
29
keep_index = np.argmin(list(map(get_len, duplicates)))
30
for i, duplicate in enumerate(duplicates):
31
if keep_index != i:
0 commit comments