koro 1.0.4__tar.gz → 1.0.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {koro-1.0.4 → koro-1.0.6}/PKG-INFO +1 -1
- {koro-1.0.4 → koro-1.0.6}/setup.cfg +1 -1
- {koro-1.0.4 → koro-1.0.6}/src/koro/file/zip.py +1 -1
- {koro-1.0.4 → koro-1.0.6}/src/koro/item/group.py +9 -6
- {koro-1.0.4 → koro-1.0.6}/src/koro.egg-info/PKG-INFO +1 -1
- {koro-1.0.4 → koro-1.0.6}/src/koro.egg-info/SOURCES.txt +0 -1
- koro-1.0.4/src/koro/item/__init__.py +0 -0
- {koro-1.0.4 → koro-1.0.6}/LICENSE +0 -0
- {koro-1.0.4 → koro-1.0.6}/pyproject.toml +0 -0
- {koro-1.0.4 → koro-1.0.6}/src/koro/__init__.py +0 -0
- {koro-1.0.4 → koro-1.0.6}/src/koro/file/__init__.py +0 -0
- {koro-1.0.4 → koro-1.0.6}/src/koro/file/dir.py +0 -0
- {koro-1.0.4 → koro-1.0.6}/src/koro/file/lvl.py +0 -0
- {koro-1.0.4 → koro-1.0.6}/src/koro/item/level.py +0 -0
- {koro-1.0.4 → koro-1.0.6}/src/koro/item/save.py +0 -0
- {koro-1.0.4 → koro-1.0.6}/src/koro.egg-info/dependency_links.txt +0 -0
- {koro-1.0.4 → koro-1.0.6}/src/koro.egg-info/top_level.txt +0 -0
@@ -95,7 +95,7 @@ class ZipLevel(Level):
|
|
95
95
|
|
96
96
|
def write(self, new_content: bytes, /) -> None:
|
97
97
|
contents: Final[dict[ZipInfo, bytes]] = {}
|
98
|
-
with ZipFile(self.path) as a:
|
98
|
+
with ZipFile(self.path, "r+") as a:
|
99
99
|
for info in filterfalse(
|
100
100
|
lambda info: info.filename == self.fn, a.infolist()
|
101
101
|
):
|
@@ -1,6 +1,5 @@
|
|
1
1
|
from abc import ABC
|
2
2
|
from collections.abc import Iterable, Sequence
|
3
|
-
from itertools import filterfalse
|
4
3
|
from typing import Final, Generic, Optional, TypeVar
|
5
4
|
|
6
5
|
from .level import Level, LevelNotFoundError
|
@@ -16,7 +15,7 @@ class Group(ABC, Generic[_L], Sequence[_L]):
|
|
16
15
|
__slots__ = ()
|
17
16
|
|
18
17
|
def fill_mask(self) -> Sequence[bool]:
|
19
|
-
"""Return which level IDs within this
|
18
|
+
"""Return which level IDs within this Group exist."""
|
20
19
|
return [bool(l) for l in self]
|
21
20
|
|
22
21
|
def __len__(self) -> int:
|
@@ -36,7 +35,11 @@ class Group(ABC, Generic[_L], Sequence[_L]):
|
|
36
35
|
|
37
36
|
def write(self, new_content: Iterable[Optional[bytes]], /) -> None:
|
38
37
|
"""Replace the contents of this Group with the specified new content. None values will empty the slot they correspond to."""
|
39
|
-
for src, dest in
|
40
|
-
|
41
|
-
|
42
|
-
|
38
|
+
for src, dest in zip(new_content, self, strict=True):
|
39
|
+
if src is None:
|
40
|
+
try:
|
41
|
+
dest.delete()
|
42
|
+
except LevelNotFoundError:
|
43
|
+
pass
|
44
|
+
else:
|
45
|
+
dest.write(src)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|