MCPcopy Create free account
hub / github.com/numpy/numpy / get_members

Function get_members

tools/openblas_support.py:219–233  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

217 target_path = os.path.abspath(target_path)
218
219 def get_members():
220 for member in tarfileobj.getmembers():
221 if archive_path:
222 norm_path = os.path.normpath(member.name)
223 if norm_path.startswith(archive_path + os.path.sep):
224 member.name = norm_path[len(archive_path)+1:]
225 else:
226 continue
227
228 dst_path = os.path.abspath(os.path.join(target_path, member.name))
229 if os.path.commonpath([target_path, dst_path]) != target_path:
230 # Path not under target_path, probably contains ../
231 continue
232
233 yield member
234
235 tarfileobj.extractall(target_path, members=get_members())
236

Callers 1

extract_tarfile_toFunction · 0.85

Calls 3

startswithMethod · 0.80
abspathMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected