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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: koro
3
- Version: 1.0.4
3
+ Version: 1.0.6
4
4
  Summary: Tools for manipulating levels made in Marble Saga: Kororinpa
5
5
  Home-page: https://github.com/DigitalDetective47/koro
6
6
  Author: DigitalDetective47
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = koro
3
- version = 1.0.4
3
+ version = 1.0.6
4
4
  author = DigitalDetective47
5
5
  author_email = ninji2701@gmail.com
6
6
  description = Tools for manipulating levels made in Marble Saga: Kororinpa
@@ -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 set exist."""
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 filterfalse(
40
- lambda x: x[0] is None, zip(new_content, self, strict=True)
41
- ):
42
- dest.write(src)
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)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: koro
3
- Version: 1.0.4
3
+ Version: 1.0.6
4
4
  Summary: Tools for manipulating levels made in Marble Saga: Kororinpa
5
5
  Home-page: https://github.com/DigitalDetective47/koro
6
6
  Author: DigitalDetective47
@@ -10,7 +10,6 @@ src/koro/file/__init__.py
10
10
  src/koro/file/dir.py
11
11
  src/koro/file/lvl.py
12
12
  src/koro/file/zip.py
13
- src/koro/item/__init__.py
14
13
  src/koro/item/group.py
15
14
  src/koro/item/level.py
16
15
  src/koro/item/save.py
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