Skip to content

Commit

Permalink
DEP: Remove paeth_predictor
Browse files Browse the repository at this point in the history
This function is unused.
  • Loading branch information
j-t-1 authored Jul 25, 2024
1 parent 2fefed8 commit 413f3d0
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 27 deletions.
9 changes: 0 additions & 9 deletions pypdf/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,15 +390,6 @@ def ord_(b: Union[int, str, bytes]) -> Union[int, bytes]:
WHITESPACES_AS_REGEXP = b"[" + WHITESPACES_AS_BYTES + b"]"


def paeth_predictor(left: int, up: int, up_left: int) -> int:
p = left + up - up_left
dist_left = abs(p - left)
dist_up = abs(p - up)
dist_up_left = abs(p - up_left)

return min((left, dist_left), (up, dist_up), (up_left, dist_up_left), key=lambda x: x[1])[0]


def deprecate(msg: str, stacklevel: int = 3) -> None:
warnings.warn(msg, DeprecationWarning, stacklevel=stacklevel)

Expand Down
18 changes: 0 additions & 18 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,24 +132,6 @@ def test_deprecate_no_replacement():
assert warn[0].message.args[0] == error_msg


@pytest.mark.parametrize(
("left", "up", "upleft", "expected"),
[
(0, 0, 0, 0),
(1, 0, 0, 1),
(0, 1, 0, 1),
(0, 0, 1, 0),
(1, 2, 3, 1),
(2, 1, 3, 1),
(1, 3, 2, 2),
(3, 1, 2, 2),
(3, 2, 1, 3),
],
)
def test_paeth_predictor(left, up, upleft, expected):
assert pypdf._utils.paeth_predictor(left, up, upleft) == expected


@pytest.mark.parametrize(
("dat", "pos", "to_read", "expected", "expected_pos"),
[
Expand Down

0 comments on commit 413f3d0

Please sign in to comment.