MCPcopy
hub / github.com/cool-RR/PySnooper / samefile

Method samefile

tests/mini_toolbox/pathlib.py:1258–1274  ·  view source on GitHub ↗

Return whether other_path is the same or not as this file (as returned by os.path.samefile()).

(self, other_path)

Source from the content-addressed store, hash-verified

1256 return cls(cls()._flavour.gethomedir(None))
1257
1258 def samefile(self, other_path):
1259 """Return whether other_path is the same or not as this file
1260 (as returned by os.path.samefile()).
1261 """
1262 if hasattr(os.path, "samestat"):
1263 st = self.stat()
1264 try:
1265 other_st = other_path.stat()
1266 except AttributeError:
1267 other_st = os.stat(other_path)
1268 return os.path.samestat(st, other_st)
1269 else:
1270 filename1 = pycompat.text_type(self)
1271 filename2 = pycompat.text_type(other_path)
1272 st1 = _win32_get_unique_path_id(filename1)
1273 st2 = _win32_get_unique_path_id(filename2)
1274 return st1 == st2
1275
1276 def iterdir(self):
1277 """Iterate over the files in this directory. Does not yield any

Callers

nothing calls this directly

Calls 2

statMethod · 0.95

Tested by

no test coverage detected