Skip to content

Commit

Permalink
fix new pylint alarms (#1173)
Browse files Browse the repository at this point in the history
  • Loading branch information
andersonhc authored May 17, 2024
1 parent 8bbd23c commit 2b866d8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion fpdf/image_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,10 @@ def get_img_info(filename, img=None, image_filter="AUTO", dims=None):
elif img.mode == "CMYK":
dpn, bpc, colspace = 4, 8, "DeviceCMYK"
jpeg_inverted = True
if img.mode == "L":
elif img.mode == "L":
dpn, bpc, colspace = 1, 8, "DeviceGray"
else:
raise ValueError(f"Unsupported image mode: {img.mode}")
img_raw_data.seek(0)
info.update(
{
Expand Down
2 changes: 2 additions & 0 deletions fpdf/text_region.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ def render(self, col_left, col_width, max_height):
"ImageParagraph.build_line() must be called before render()."
)
is_svg = isinstance(self.info, VectorImageInfo)

# pylint: disable=possibly-used-before-assignment
if self.height:
h = self.height
else:
Expand Down
3 changes: 2 additions & 1 deletion test/text_shaping/test_bidirectional.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,14 @@ def test_bidi_character():
string = ""
for char in test_data[0].split(" "):
string += chr(int(char, 16))
assert test_data[1] in ("0", "1", "2")
if test_data[1] == "0":
base_direction = TextDirection.LTR
elif test_data[1] == "1":
base_direction = TextDirection.RTL
elif test_data[1] == "2":
base_direction = None # auto
else:
raise ValueError(f"Invalid base direction {test_data[1]}")

if not base_direction:
# test the auto detect direction algorithm
Expand Down

0 comments on commit 2b866d8

Please sign in to comment.