Return the xattrs as a list of (attr, value) pairs, or an empty list if extended attributes aren't supported.
(self, *, follow_symlinks=True)
| 745 | |
| 746 | if hasattr(os, 'listxattr'): |
| 747 | def _xattrs(self, *, follow_symlinks=True): |
| 748 | """Return the xattrs as a list of (attr, value) pairs, or an empty |
| 749 | list if extended attributes aren't supported.""" |
| 750 | try: |
| 751 | return [ |
| 752 | (attr, os.getxattr(self._path, attr, follow_symlinks=follow_symlinks)) |
| 753 | for attr in os.listxattr(self._path, follow_symlinks=follow_symlinks)] |
| 754 | except OSError as err: |
| 755 | if err.errno not in (EPERM, ENOTSUP, ENODATA, EINVAL, EACCES): |
| 756 | raise |
| 757 | return [] |
| 758 | |
| 759 | |
| 760 | def _copy_info(info, target, follow_symlinks=True): |
no test coverage detected