MCPcopy Create free account
hub / github.com/catboost/catboost / should_fallback_to_copy

Function should_fallback_to_copy

library/python/fs/__init__.py:233–245  ·  view source on GitHub ↗
(exc)

Source from the content-addressed store, hash-verified

231@errorfix_win
232def hardlink_or_copy(src, lnk, copy_function=copy2):
233 def should_fallback_to_copy(exc):
234 if WindowsError is not None and isinstance(exc, WindowsError) and exc.winerror == 1142: # too many hardlinks
235 return True
236 # cross-device hardlink or too many hardlinks, or some known WSL error
237 if isinstance(exc, OSError) and exc.errno in (
238 errno.EXDEV,
239 errno.EMLINK,
240 errno.EINVAL,
241 errno.EACCES,
242 errno.EPERM,
243 ):
244 return True
245 return False
246
247 try:
248 hardlink(src, lnk)

Callers 1

hardlink_or_copyFunction · 0.85

Calls 1

isinstanceFunction · 0.85

Tested by

no test coverage detected