Skip to content
Snippets Groups Projects
Commit a8d9f0300113 authored by Matt Harbison's avatar Matt Harbison
Browse files

vfs: disable mutating functions on readonlyvfs

Here's 14 functions by my count, that aren't gated by the mode check in
`__call__()`.  Not sure how to gate these for real- copy/paste is a pain, and
I have no idea if the `*args, **kwargs` pattern is compatible with protocols.
But the first test is to see if anything blows up.
parent ee7e106b372b
No related tags found
1 merge request!959Draft: vfs: disable mutating functions on readonlyvfs
......@@ -743,6 +743,65 @@
def join(self, path: Optional[bytes], *insidef: bytes) -> bytes:
return self.vfs.join(path, *insidef)
#####
def chmod(self, path: bytes, mode: int) -> None:
raise NotImplementedError("readonly vfs")
def makedir(self, path: Optional[bytes] = None, notindexed=True) -> None:
raise NotImplementedError("readonly vfs")
def makedirs(
self, path: Optional[bytes] = None, mode: Optional[int] = None
) -> None:
raise NotImplementedError("readonly vfs")
def makelock(self, info: bytes, path: bytes) -> None:
raise NotImplementedError("readonly vfs")
def mkdir(self, path: Optional[bytes] = None) -> None:
raise NotImplementedError("readonly vfs")
def mkstemp(
self,
suffix: bytes = b'',
prefix: bytes = b'tmp',
dir: Optional[bytes] = None,
) -> Tuple[int, bytes]:
raise NotImplementedError("readonly vfs")
def rename(self, src: bytes, dst: bytes, checkambig: bool = False) -> None:
raise NotImplementedError("readonly vfs")
def removedirs(self, path: Optional[bytes] = None) -> None:
raise NotImplementedError("readonly vfs")
def rmdir(self, path: Optional[bytes] = None) -> None:
raise NotImplementedError("readonly vfs")
def rmtree(
self,
path: Optional[bytes] = None,
ignore_errors: bool = False,
forcibly: bool = False,
) -> None:
raise NotImplementedError("readonly vfs")
def setflags(self, path: bytes, l: bool, x: bool) -> None:
raise NotImplementedError("readonly vfs")
def unlink(self, path: Optional[bytes] = None) -> None:
raise NotImplementedError("readonly vfs")
def tryunlink(self, path: Optional[bytes] = None) -> bool:
raise NotImplementedError("readonly vfs")
def unlinkpath(
self,
path: Optional[bytes] = None,
ignoremissing: bool = False,
rmdir: bool = True,
) -> None:
raise NotImplementedError("readonly vfs")
class closewrapbase(abc.ABC):
"""Base class of wrapper, which hooks closing
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment