Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
except AttributeError:
accessor = object
class _FakeAccessor(accessor):
"""Accessor which forwards some of the functions to FakeFilesystem methods.
"""
stat = _wrap_strfunc(FakeFilesystem.stat)
lstat = _wrap_strfunc(
lambda fs, path: FakeFilesystem.stat(fs, path, follow_symlinks=False))
listdir = _wrap_strfunc(FakeFilesystem.listdir)
chmod = _wrap_strfunc(FakeFilesystem.chmod)
if use_scandir:
scandir = _wrap_strfunc(fake_scandir.scandir)
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)
lchmod = _wrap_strfunc(lambda fs, path, mode: FakeFilesystem.chmod(
fs, path, mode, follow_symlinks=False))
else:
return strfunc(pathobj2.filesystem, str(pathobj2), str(pathobj1), *args)
return staticmethod(_wrapped)
class _FakeAccessor(pathlib._Accessor): # pylint: disable=protected-access
"""Accessor which forwards some of the functions to FakeFilesystem methods."""
stat = _wrap_strfunc(FakeFilesystem.stat)
lstat = _wrap_strfunc(lambda fs, path: FakeFilesystem.stat(fs, path,
follow_symlinks=False))
listdir = _wrap_strfunc(FakeFilesystem.listdir)
chmod = _wrap_strfunc(FakeFilesystem.chmod)
if sys.version_info >= (3, 6):
scandir = _wrap_strfunc(fake_scandir.scandir)
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)
lchmod = _wrap_strfunc(lambda fs, path, mode: FakeFilesystem.chmod(
fs, path, mode, follow_symlinks=False))
else: