Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
lambda fs, old_path, new_path: FakeFilesystem.rename(
fs, old_path, new_path, force_replace=True))
if hasattr(os, "lchmod"):
lchmod = _wrap_strfunc(lambda fs, path, mode: FakeFilesystem.chmod(
fs, path, mode, follow_symlinks=False))
else:
def lchmod(self, pathobj, mode):
"""Raises not implemented for Windows systems."""
raise NotImplementedError("lchmod() not available on this system")
mkdir = _wrap_strfunc(FakeFilesystem.makedir)
unlink = _wrap_strfunc(FakeFilesystem.remove)
rmdir = _wrap_strfunc(FakeFilesystem.rmdir)
rename = _wrap_binary_strfunc(FakeFilesystem.rename)
replace = _wrap_binary_strfunc(lambda fs, old_path, new_path:
FakeFilesystem.rename(
fs, old_path, new_path, force_replace=True))
symlink = _wrap_binary_strfunc_reverse(
lambda fs, file_path, link_target, target_is_directory:
FakeFilesystem.create_symlink(fs, file_path, link_target,
create_missing_dirs=False))
utime = _wrap_strfunc(FakeFilesystem.utime)
_fake_accessor = _FakeAccessor()
class _FakeFlavour(pathlib._Flavour):
replace = _wrap_binary_strfunc(lambda fs, old_path, new_path:
FakeFilesystem.rename(
fs, old_path, new_path, force_replace=True))
if hasattr(os, "lchmod"):
lchmod = _wrap_strfunc(lambda fs, path, mode: FakeFilesystem.chmod(
fs, path, mode, follow_symlinks=False))
else:
def lchmod(self, pathobj, mode):
"""Raises not implemented for Windows systems."""
raise NotImplementedError("lchmod() not available on this system")
mkdir = _wrap_strfunc(FakeFilesystem.makedir)
unlink = _wrap_strfunc(FakeFilesystem.remove)
rmdir = _wrap_strfunc(FakeFilesystem.rmdir)
rename = _wrap_binary_strfunc(FakeFilesystem.rename)
replace = _wrap_binary_strfunc(
lambda fs, old_path, new_path: FakeFilesystem.rename(
fs, old_path, new_path, force_replace=True))
symlink = _wrap_binary_strfunc_reverse(
lambda fs, file_path, link_target, target_is_directory:
FakeFilesystem.create_symlink(fs, file_path, link_target,
create_missing_dirs=False))
utime = _wrap_strfunc(FakeFilesystem.utime)
_fake_accessor = _FakeAccessor()
flavour = pathlib._Flavour if pathlib else object