Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix new pylint alarms #1173

Merged
merged 1 commit into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading