We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 373085b commit b317b19Copy full SHA for b317b19
unblob/file_utils.py
@@ -29,9 +29,10 @@ def from_bytes(cls, content: bytes):
29
return m
30
31
@classmethod
32
- def from_path(cls, path: Path):
33
- with path.open("rb") as base_file:
34
- return cls(base_file.fileno(), 0, access=mmap.ACCESS_READ)
+ def from_path(cls, path: Path, access=mmap.ACCESS_READ):
+ mode = "r+b" if access == mmap.ACCESS_WRITE else "rb"
+ with path.open(mode) as base_file:
35
+ return cls(base_file.fileno(), 0, access=access)
36
37
def seek(self, pos: int, whence: int = os.SEEK_SET) -> int:
38
try:
0 commit comments