MCPcopy Index your code
hub / github.com/RustPython/RustPython / _find_link_target

Method _find_link_target

Lib/tarfile.py:2942–2959  ·  view source on GitHub ↗

Find the target member of a symlink or hardlink member in the archive.

(self, tarinfo)

Source from the content-addressed store, hash-verified

2940 raise OSError("bad operation for mode %r" % self.mode)
2941
2942 def _find_link_target(self, tarinfo):
2943 """Find the target member of a symlink or hardlink member in the
2944 archive.
2945 """
2946 if tarinfo.issym():
2947 # Always search the entire archive.
2948 linkname = "/".join(filter(None, (os.path.dirname(tarinfo.name), tarinfo.linkname)))
2949 limit = None
2950 else:
2951 # Search the archive before the link, because a hard link is
2952 # just a reference to an already archived file.
2953 linkname = tarinfo.linkname
2954 limit = tarinfo
2955
2956 member = self._getmember(linkname, tarinfo=limit, normalize=True)
2957 if member is None:
2958 raise KeyError("linkname %r not found" % linkname)
2959 return member
2960
2961 def __iter__(self):
2962 """Provide an iterator object.

Callers 2

extractfileMethod · 0.95
makelink_with_filterMethod · 0.95

Calls 4

_getmemberMethod · 0.95
filterFunction · 0.85
issymMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected