Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove some code that's now unused.
  • Loading branch information
barneygale committed Jun 24, 2024
commit 8129c4670f33b94933cb2e44e7f01418aef5dd35
9 changes: 3 additions & 6 deletions Lib/pathlib/_os.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,15 +160,14 @@ def copyfileobj(source_f, target_f):


def get_file_metadata(path, follow_symlinks):
if isinstance(path, os.DirEntry):
st = path.stat(follow_symlinks=follow_symlinks)
else:
st = os.stat(path, follow_symlinks=follow_symlinks)
st = os.stat(path, follow_symlinks=follow_symlinks)
result = {
'mode': stat.S_IMODE(st.st_mode),
'atime_ns': st.st_atime_ns,
'mtime_ns': st.st_mtime_ns,
}
if hasattr(st, 'st_flags'):
result['flags'] = st.st_flags
if hasattr(os, 'listxattr'):
try:
result['xattrs'] = [
Expand All @@ -177,8 +176,6 @@ def get_file_metadata(path, follow_symlinks):
except OSError as err:
if err.errno not in (EPERM, ENOTSUP, ENODATA, EINVAL, EACCES):
raise
if hasattr(st, 'st_flags'):
result['flags'] = st.st_flags
return result


Expand Down