Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
tmdvs committed Oct 11, 2024
1 parent 36ed043 commit aadd4c5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
10 changes: 8 additions & 2 deletions src/converter/positioning.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,18 @@ def inv(self):
[
safe_div(self[1][1], (self[0][0] * self[1][1] - self[0][1] * self[1][0])),
safe_div(self[0][1], (self[0][1] * self[1][0] - self[0][0] * self[1][1])),
safe_div((self[0][2] * self[1][1] - self[0][1] * self[1][2]), (self[0][1] * self[1][0] - self[0][0] * self[1][1])),
safe_div(
(self[0][2] * self[1][1] - self[0][1] * self[1][2]),
(self[0][1] * self[1][0] - self[0][0] * self[1][1]),
),
],
[
safe_div(self[1][0], (self[0][1] * self[1][0] - self[0][0] * self[1][1])),
safe_div(self[0][0], (self[0][0] * self[1][1] - self[0][1] * self[1][0])),
safe_div((self[0][2] * self[1][0] - self[0][0] * self[1][2]), (self[0][0] * self[1][1] - self[0][1] * self[1][0])),
safe_div(
(self[0][2] * self[1][0] - self[0][0] * self[1][2]),
(self[0][0] * self[1][1] - self[0][1] * self[1][0]),
),
],
[0, 0, 1],
]
Expand Down
5 changes: 3 additions & 2 deletions src/converter/style.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,9 @@ def convert_gradient(fig_node: dict, fig_fill: dict) -> Gradient:
except:
x_scale = 1

ellipse_ratio = safe_div(scaled_distance(point_from, point_ellipse, x_scale), scaled_distance(
point_from, point_to, x_scale)
ellipse_ratio = safe_div(

Check failure on line 261 in src/converter/style.py

View workflow job for this annotation

GitHub Actions / mypy

Call to untyped function "safe_div" in typed context [no-untyped-call]
scaled_distance(point_from, point_ellipse, x_scale),
scaled_distance(point_from, point_to, x_scale),
)

return Gradient.Radial(
Expand Down
4 changes: 3 additions & 1 deletion src/converter/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@

issued_warnings: Dict[tuple[int, int], list[str]] = {}

def safe_div(x,y):

def safe_div(x, y):
if y == 0:
return 0
return x / y


def gen_object_id(fig_id: Sequence[int], suffix: bytes = b"") -> str:
# Generate UUIDs by hashing the fig GUID with a salt
salted_id = config.salt + struct.pack("<" + "I" * len(fig_id), *fig_id) + suffix
Expand Down

0 comments on commit aadd4c5

Please sign in to comment.