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

Method list

Lib/tarfile.py:2248–2289  ·  view source on GitHub ↗

Print a table of contents to sys.stdout. If 'verbose' is False, only the names of the members are printed. If it is True, an 'ls -l'-like output is produced. 'members' is optional and must be a subset of the list returned by getmembers().

(self, verbose=True, *, members=None)

Source from the content-addressed store, hash-verified

2246 return tarinfo
2247
2248 def list(self, verbose=True, *, members=None):
2249 """Print a table of contents to sys.stdout. If 'verbose' is False, only
2250 the names of the members are printed. If it is True, an 'ls -l'-like
2251 output is produced. 'members' is optional and must be a subset of the
2252 list returned by getmembers().
2253 """
2254 # Convert tarinfo type to stat type.
2255 type2mode = {REGTYPE: stat.S_IFREG, SYMTYPE: stat.S_IFLNK,
2256 FIFOTYPE: stat.S_IFIFO, CHRTYPE: stat.S_IFCHR,
2257 DIRTYPE: stat.S_IFDIR, BLKTYPE: stat.S_IFBLK}
2258 self._check()
2259
2260 if members is None:
2261 members = self
2262 for tarinfo in members:
2263 if verbose:
2264 if tarinfo.mode is None:
2265 _safe_print("??????????")
2266 else:
2267 modetype = type2mode.get(tarinfo.type, 0)
2268 _safe_print(stat.filemode(modetype | tarinfo.mode))
2269 _safe_print("%s/%s" % (tarinfo.uname or tarinfo.uid,
2270 tarinfo.gname or tarinfo.gid))
2271 if tarinfo.ischr() or tarinfo.isblk():
2272 _safe_print("%10s" %
2273 ("%d,%d" % (tarinfo.devmajor, tarinfo.devminor)))
2274 else:
2275 _safe_print("%10d" % tarinfo.size)
2276 if tarinfo.mtime is None:
2277 _safe_print("????-??-?? ??:??:??")
2278 else:
2279 _safe_print("%d-%02d-%02d %02d:%02d:%02d" \
2280 % time.localtime(tarinfo.mtime)[:6])
2281
2282 _safe_print(tarinfo.name + ("/" if tarinfo.isdir() else ""))
2283
2284 if verbose:
2285 if tarinfo.issym():
2286 _safe_print("-> " + tarinfo.linkname)
2287 if tarinfo.islnk():
2288 _safe_print("link to " + tarinfo.linkname)
2289 print()
2290
2291 def add(self, name, arcname=None, recursive=True, *, filter=None):
2292 """Add the file 'name' to the archive. 'name' may be any type of file

Callers 1

mainFunction · 0.45

Calls 9

_checkMethod · 0.95
_safe_printFunction · 0.85
ischrMethod · 0.80
isblkMethod · 0.80
issymMethod · 0.80
islnkMethod · 0.80
printFunction · 0.50
getMethod · 0.45
isdirMethod · 0.45

Tested by

no test coverage detected