Skip to content

Commit

Permalink
MAINT: Remove unused paeth_predictor (#2773)
Browse files Browse the repository at this point in the history
  • Loading branch information
j-t-1 authored Aug 5, 2024
1 parent 582557e commit 38f3925
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 32 deletions.
14 changes: 0 additions & 14 deletions pypdf/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,20 +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)

if dist_left <= dist_up and dist_left <= dist_up_left:
return left
elif dist_up <= dist_up_left:
return up
else:
return up_left


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 38f3925

Please sign in to comment.