Skip to content

Commit

Permalink
remove _internal parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
nulano committed Dec 31, 2023
1 parent ee62201 commit b5a81dd
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/PIL/IptcImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,18 @@ def __getattr__(name: str) -> bytes:
# Helpers


def _i(c: bytes) -> int:
return i32((b"\0\0\0\0" + c)[-4:])


def _i8(c: int | bytes) -> int:
return c if isinstance(c, int) else c[0]


def i(c: bytes, *, _internal: bool = False) -> int:
def i(c: bytes) -> int:
""".. deprecated:: 10.2.0"""
if not _internal:
deprecate("IptcImagePlugin.i", 12)
return i32((b"\0\0\0\0" + c)[-4:])
deprecate("IptcImagePlugin.i", 12)
return _i(c)


def dump(c: Sequence[int | bytes]) -> None:
Expand All @@ -69,7 +72,7 @@ class IptcImageFile(ImageFile.ImageFile):
format_description = "IPTC/NAA"

def getint(self, key: tuple[int, int]) -> int:
return i(self.info[key], _internal=True)
return _i(self.info[key])

Check warning on line 75 in src/PIL/IptcImagePlugin.py

View check run for this annotation

Codecov / codecov/patch

src/PIL/IptcImagePlugin.py#L75

Added line #L75 was not covered by tests

def field(self) -> tuple[tuple[int, int] | None, int]:
#
Expand All @@ -93,7 +96,7 @@ def field(self) -> tuple[tuple[int, int] | None, int]:
elif size == 128:
size = 0
elif size > 128:
size = i(self.fp.read(size - 128), _internal=True)
size = _i(self.fp.read(size - 128))

Check warning on line 99 in src/PIL/IptcImagePlugin.py

View check run for this annotation

Codecov / codecov/patch

src/PIL/IptcImagePlugin.py#L99

Added line #L99 was not covered by tests
else:
size = i16(s, 3)

Expand Down

0 comments on commit b5a81dd

Please sign in to comment.