Skip to content

Commit 772b1ed

Browse files
committed
Reorder arguments and add named kwargs
Signed-off-by: Ravi <jravi248@gmail.com>
1 parent f666bea commit 772b1ed

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/extractcode/extract.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
ExtractEvent = namedtuple('ExtractEvent', 'source target done warnings errors')
9898

9999

100-
def extract(location, ignored_extensions=(), kinds=extractcode.default_kinds, recurse=False, replace_originals=False):
100+
def extract(location, kinds=extractcode.default_kinds, recurse=False, replace_originals=False, ignored_extensions=()):
101101
"""
102102
Walk and extract any archives found at `location` (either a file or
103103
directory). Extract only archives of a kind listed in the `kinds` kind tuple.
@@ -123,7 +123,7 @@ def extract(location, ignored_extensions=(), kinds=extractcode.default_kinds, re
123123
if recurse and a nested archive is found, it is extracted to full depth
124124
first before resuming the file system walk.
125125
"""
126-
events = list(extract_files(location, ignored_extensions, kinds, recurse))
126+
events = list(extract_files(location=location, kinds=kinds, recurse=recurse, ignored_extensions=ignored_extensions))
127127
if replace_originals:
128128
for xevent in reversed(events):
129129
if xevent.done:
@@ -136,7 +136,7 @@ def extract(location, ignored_extensions=(), kinds=extractcode.default_kinds, re
136136
fileutils.delete(target)
137137
return events
138138

139-
def extract_files(location, ignored_extensions=(), kinds=extractcode.default_kinds, recurse=False):
139+
def extract_files(location, kinds=extractcode.default_kinds, recurse=False, ignored_extensions=()):
140140
ignored = partial(ignore.is_ignored, ignores=ignore.default_ignores, unignores={})
141141
if TRACE:
142142
logger.debug('extract:start: %(location)r recurse: %(recurse)r\n' % locals())
@@ -176,7 +176,7 @@ def extract_files(location, ignored_extensions=(), kinds=extractcode.default_kin
176176
if recurse:
177177
if TRACE:
178178
logger.debug('extract:walk: recursing on target: %(target)r' % locals())
179-
for xevent in extract(target, ignored_extensions, kinds, recurse):
179+
for xevent in extract(location=target, kinds=kinds, recurse=recurse, ignored_extensions=ignored_extensions):
180180
if TRACE:
181181
logger.debug('extract:walk:recurse:extraction event: %(xevent)r' % locals())
182182
yield xevent

0 commit comments

Comments
 (0)