Skip to content

Commit

Permalink
STY: Simplify paeth_predictor
Browse files Browse the repository at this point in the history
  • Loading branch information
j-t-1 authored Jul 24, 2024
1 parent 1d9d3bc commit 2fefed8
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions pypdf/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,12 +396,7 @@ def paeth_predictor(left: int, up: int, up_left: int) -> int:
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
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:
Expand Down

0 comments on commit 2fefed8

Please sign in to comment.