@@ -112,21 +112,34 @@ def should_extract(location, kinds, ignore_pattern=()):
112
112
Return True if this location should be extracted based on the provided kinds
113
113
"""
114
114
location = os .path .abspath (os .path .expanduser (location ))
115
- ignore_pattern = {extension : 'User ignore: Supplied by --ignore' for extension in ignore_pattern }
115
+ ignore_pattern = {extension : 'User ignore: Supplied by --ignore'
116
+ for extension in ignore_pattern }
116
117
should_ignore = is_ignored (location , ignore_pattern )
117
118
extractor = get_extractor (location , kinds = kinds )
118
119
119
120
if TRACE_DEEP :
120
- logger .debug (f' should_extract: extractor: { extractor } , should_ignore: { should_ignore } ' )
121
+ logger .debug (
122
+ f' should_extract: extractor: { extractor } , '
123
+ f'should_ignore: { should_ignore } '
124
+ )
121
125
122
126
if extractor and not should_ignore :
123
127
return True
124
128
125
129
126
130
def get_extractor (location , kinds = all_kinds ):
127
131
"""
128
- Return an extraction callable that can extract the file at location or
129
- an None if no extract function is found.
132
+ Return an extraction callable that can extract the file at ``location`` or
133
+ None if no extraction callable function is found.
134
+ Limit the search for an extractor to the ``kinds`` list of archive kinds.
135
+ See extractcode.all_kinds for details.
136
+
137
+ An extraction callable should accept these arguments:
138
+ - location of the file to extract
139
+ - target_dir where to extract
140
+ It should extract files from the `location` in the `target_dir` directory.
141
+ It must return a list of warning messages if any or an empty list.
142
+ It must raise Exceptions on errors.
130
143
"""
131
144
assert location
132
145
location = os .path .abspath (os .path .expanduser (location ))
0 commit comments