summary refs log tree commit diff stats
diff options
context:
space:
mode:
authortoonn <toonn@toonn.io>2019-12-28 18:16:50 +0100
committertoonn <toonn@toonn.io>2019-12-28 18:47:24 +0100
commit99870addf7e23cd8bb34463c43dfc7ccd38b9545 (patch)
tree285c66ba07bef4782550323439a7180582050089
parent5581c896a97ee7740dd1b142a053fc24681c1f72 (diff)
downloadranger-99870addf7e23cd8bb34463c43dfc7ccd38b9545.tar.gz
Fix hash_chunks generator
-rw-r--r--ranger/core/filter_stack.py12
-rw-r--r--ranger/ext/hash.py3
2 files changed, 9 insertions, 6 deletions
diff --git a/ranger/core/filter_stack.py b/ranger/core/filter_stack.py
index ca8810e8..59495437 100644
--- a/ranger/core/filter_stack.py
+++ b/ranger/core/filter_stack.py
@@ -9,8 +9,7 @@ import re
 import mimetypes
 # pylint: disable=invalid-name
 try:
-    from itertools import izip_longest
-    zip_longest = izip_longest
+    from itertools import izip_longest as zip_longest
 except ImportError:
     from itertools import zip_longest
 # pylint: enable=invalid-name
@@ -77,9 +76,12 @@ class MimeFilter(BaseFilter):
 
 @stack_filter("hash")
 class HashFilter(BaseFilter, FileManagerAware):
-    def __init__(self, filepath):
-        self.filepath = filepath if filepath else self.fm.thisfile.path
-        if not self.filepath:
+    def __init__(self, filepath = None):
+        if filepath is None:
+            self.filepath = self.fm.thisfile.path
+        else:
+            self.filepath = filepath
+        if self.filepath is None:
             self.fm.notify("Error: No file selected for hashing!", bad=True)
         # TODO: Lazily generated list would be more efficient, a generator
         #       isn't enough because this object is reused for every fsobject
diff --git a/ranger/ext/hash.py b/ranger/ext/hash.py
index 20059dbf..1ed21a71 100644
--- a/ranger/ext/hash.py
+++ b/ranger/ext/hash.py
@@ -17,7 +17,8 @@ def hash_chunks(filepath, h=None):
         h.update(filepath)
         yield h.hexdigest()
         for fp in listdir(filepath):
-            hash_chunks(fp, h=h)
+            for fp_chunk in  hash_chunks(fp, h=h):
+                yield fp_chunk
     elif getsize(filepath) == 0:
         yield h.hexdigest()
     else:
c@akkartik.com> 2018-12-29 15:27:18 -0800 4890 - new html renderings' href='/akkartik/mu/commit/html/subx/034compute_segment_address.cc.html?h=hlt&id=ac07e589b3e912c704c2011d543f18b16712ff15'>ac07e589 ^
ce2c1efc ^

ac07e589 ^
ce2c1efc ^
608a7fa8 ^















ce2c1efc ^
608a7fa8 ^















91624dba ^
608a7fa8 ^
52daf072 ^







91624dba ^
c504ca56 ^
52daf072 ^



d3a9db3a ^
52daf072 ^











c504ca56 ^
d3a9db3a ^
52daf072 ^

91624dba ^
52daf072 ^
d3a9db3a ^
c504ca56 ^

52daf072 ^


695f9bf8 ^
d3a9db3a ^
52daf072 ^

d3a9db3a ^
52daf072 ^




d3a9db3a ^
c504ca56 ^
52daf072 ^



91624dba ^
52daf072 ^
d3a9db3a ^
c504ca56 ^
52daf072 ^



d3a9db3a ^
52daf072 ^
d3a9db3a ^
52daf072 ^














d3a9db3a ^
52daf072 ^



608a7fa8 ^



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148