MCPcopy Index your code
hub / github.com/python/cpython / _copyxattr

Function _copyxattr

Lib/shutil.py:382–404  ·  view source on GitHub ↗

Copy extended filesystem attributes from `src` to `dst`. Overwrite existing attributes. If `follow_symlinks` is false, symlinks won't be followed.

(src, dst, *, follow_symlinks=True)

Source from the content-addressed store, hash-verified

380
381if hasattr(os, 'listxattr'):
382 def _copyxattr(src, dst, *, follow_symlinks=True):
383 """Copy extended filesystem attributes from `src` to `dst`.
384
385 Overwrite existing attributes.
386
387 If `follow_symlinks` is false, symlinks won't be followed.
388
389 """
390
391 try:
392 names = os.listxattr(src, follow_symlinks=follow_symlinks)
393 except OSError as e:
394 if e.errno not in (errno.ENOTSUP, errno.ENODATA, errno.EINVAL):
395 raise
396 return
397 for name in names:
398 try:
399 value = os.getxattr(src, name, follow_symlinks=follow_symlinks)
400 os.setxattr(dst, name, value, follow_symlinks=follow_symlinks)
401 except OSError as e:
402 if e.errno not in (errno.EPERM, errno.ENOTSUP, errno.ENODATA,
403 errno.EINVAL, errno.EACCES):
404 raise
405else:
406 def _copyxattr(*args, **kwargs):
407 pass

Callers 1

copystatFunction · 0.85

Calls 3

listxattrMethod · 0.80
getxattrMethod · 0.80
setxattrMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…