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

Function _samefile

Lib/shutil.py:259–275  ·  view source on GitHub ↗
(src, dst)

Source from the content-addressed store, hash-verified

257 fdst_write(buf)
258
259def _samefile(src, dst):
260 # Macintosh, Unix.
261 if isinstance(src, os.DirEntry) and hasattr(os.path, 'samestat'):
262 try:
263 return os.path.samestat(src.stat(), os.stat(dst))
264 except OSError:
265 return False
266
267 if hasattr(os.path, 'samefile'):
268 try:
269 return os.path.samefile(src, dst)
270 except OSError:
271 return False
272
273 # All other platforms: check for same pathname.
274 return (os.path.normcase(os.path.abspath(src)) ==
275 os.path.normcase(os.path.abspath(dst)))
276
277def _stat(fn):
278 return fn.stat() if isinstance(fn, os.DirEntry) else os.stat(fn)

Callers 2

copyfileFunction · 0.85
moveFunction · 0.85

Calls 4

samefileMethod · 0.80
normcaseMethod · 0.80
statMethod · 0.45
abspathMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…