Skip to content

Commit f6b2249

Browse files
committed
Delete _device_id()
1 parent 86b671f commit f6b2249

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

Lib/pathlib/_os.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -379,17 +379,13 @@ def ensure_different_files(source, target):
379379
try:
380380
source_file_id = source.info._file_id
381381
target_file_id = target.info._file_id
382-
source_device_id = source.info._device_id
383-
target_device_id = target.info._device_id
384382
except AttributeError:
385383
if source != target:
386384
return
387385
else:
388386
try:
389387
if source_file_id() != target_file_id():
390388
return
391-
if source_device_id() != target_device_id():
392-
return
393389
except (OSError, ValueError):
394390
return
395391
err = OSError(EINVAL, "Source and target are the same file")
@@ -447,12 +443,9 @@ def _posix_permissions(self, *, follow_symlinks=True):
447443
return S_IMODE(self._stat(follow_symlinks=follow_symlinks).st_mode)
448444

449445
def _file_id(self, *, follow_symlinks=True):
450-
"""Returns the identifier of the file (unique for a device ID)."""
451-
return self._stat(follow_symlinks=follow_symlinks).st_ino
452-
453-
def _device_id(self, *, follow_symlinks=True):
454-
"""Returns the identifier of the device on which the file resides."""
455-
return self._stat(follow_symlinks=follow_symlinks).st_dev
446+
"""Returns the identifier of the file."""
447+
st = self._stat(follow_symlinks=follow_symlinks)
448+
return st.st_dev, st.st_ino
456449

457450
def _access_time_ns(self, *, follow_symlinks=True):
458451
"""Return the access time in nanoseconds."""

0 commit comments

Comments
 (0)