97
97
ExtractEvent = namedtuple ('ExtractEvent' , 'source target done warnings errors' )
98
98
99
99
100
- def extract (location , kinds = extractcode .default_kinds , recurse = False , replace_originals = False , ignore_pattern = ()):
100
+ def extract (
101
+ location ,
102
+ kinds = extractcode .default_kinds ,
103
+ recurse = False ,
104
+ replace_originals = False ,
105
+ ignore_pattern = (),
106
+ ):
101
107
"""
102
108
Walk and extract any archives found at `location` (either a file or
103
109
directory). Extract only archives of a kind listed in the `kinds` kind tuple.
@@ -143,7 +149,12 @@ def extract(location, kinds=extractcode.default_kinds, recurse=False, replace_or
143
149
fileutils .delete (target )
144
150
145
151
146
- def extract_files (location , kinds = extractcode .default_kinds , recurse = False , ignore_pattern = ()):
152
+ def extract_files (
153
+ location ,
154
+ kinds = extractcode .default_kinds ,
155
+ recurse = False ,
156
+ ignore_pattern = (),
157
+ ):
147
158
"""
148
159
Extract the files found at `location`.
149
160
@@ -170,6 +181,7 @@ def extract_files(location, kinds=extractcode.default_kinds, recurse=False, igno
170
181
dirs .remove (d )
171
182
if TRACE :
172
183
logger .debug ('extract:walk: not recurse: removed dirs:' + repr (drs .symmetric_difference (set (dirs ))))
184
+
173
185
for f in files :
174
186
loc = join (top , f )
175
187
if not recurse and extractcode .is_extraction_path (loc ):
@@ -195,13 +207,23 @@ def extract_files(location, kinds=extractcode.default_kinds, recurse=False, igno
195
207
if recurse :
196
208
if TRACE :
197
209
logger .debug ('extract:walk: recursing on target: %(target)r' % locals ())
198
- for xevent in extract (location = target , kinds = kinds , recurse = recurse , ignore_pattern = ignore_pattern ):
210
+ for xevent in extract (
211
+ location = target ,
212
+ kinds = kinds ,
213
+ recurse = recurse ,
214
+ ignore_pattern = ignore_pattern ,
215
+ ):
199
216
if TRACE :
200
217
logger .debug ('extract:walk:recurse:extraction event: %(xevent)r' % locals ())
201
218
yield xevent
202
219
203
220
204
- def extract_file (location , target , kinds = extractcode .default_kinds , verbose = False ):
221
+ def extract_file (
222
+ location ,
223
+ target ,
224
+ kinds = extractcode .default_kinds ,
225
+ verbose = False ,
226
+ ):
205
227
"""
206
228
Extract a single archive at `location` in the `target` directory if it is
207
229
of a kind supported in the `kinds` kind tuple.
@@ -211,7 +233,7 @@ def extract_file(location, target, kinds=extractcode.default_kinds, verbose=Fals
211
233
extractor = archive .get_extractor (location , kinds )
212
234
if TRACE :
213
235
emodule = getattr (extractor , '__module__' , '' )
214
- ename = getattr (extractor , '__name__' , '' )
236
+ ename = getattr (extractor , '__name__' , '' )
215
237
logger .debug (
216
238
'extract_file: extractor: for: {location} with kinds: {kinds}: {emodule}.{ename}'
217
239
.format (** locals ()))
0 commit comments