From 7bd72274780ccaeae8bbae6e761341079df21ecb Mon Sep 17 00:00:00 2001 From: Kaalleen <36401965+kaalleen@users.noreply.github.com> Date: Fri, 11 Jul 2025 22:12:01 +0200 Subject: Do not redefine underscore (#3865) * do not redefine underscore * Disallow any redefinitions going forward --------- Co-authored-by: CapellanCitizen <> --- lib/commands.py | 4 ++-- lib/extensions/break_apart.py | 6 +++--- lib/gui/preferences.py | 2 +- lib/stitches/running_stitch.py | 4 ++-- mypy.ini | 3 --- 5 files changed, 8 insertions(+), 11 deletions(-) diff --git a/lib/commands.py b/lib/commands.py index 37081f11..051c4b64 100644 --- a/lib/commands.py +++ b/lib/commands.py @@ -146,8 +146,8 @@ class Command(BaseCommand): pos = (float(self.use.get("x", 0)), float(self.use.get("y", 0))) transform = get_node_transform(self.use) - pos = inkex.Transform(transform).apply_to_point(pos) - self.target_point = pos + target = inkex.Transform(transform).apply_to_point(pos) + self.target_point = target def __repr__(self): return "Command('%s', %s)" % (self.command, self.target_point) diff --git a/lib/extensions/break_apart.py b/lib/extensions/break_apart.py index 3508bb28..21806251 100644 --- a/lib/extensions/break_apart.py +++ b/lib/extensions/break_apart.py @@ -55,9 +55,9 @@ class BreakApart(InkstitchExtension): polygons = self.break_apart_paths(paths) if self.options.method == 1: polygons = self.combine_overlapping_polygons(polygons) - polygons = self.recombine_polygons(polygons) - if polygons: - self.polygons_to_nodes(polygons, element) + recombined_polygons = self.recombine_polygons(polygons) + if recombined_polygons: + self.polygons_to_nodes(recombined_polygons, element) def break_apart_paths(self, paths: List[List[Union[List[float], Tuple[float, float]]]]) -> List[Polygon]: polygons = [] diff --git a/lib/gui/preferences.py b/lib/gui/preferences.py index b95bb7c8..1eaac5f5 100644 --- a/lib/gui/preferences.py +++ b/lib/gui/preferences.py @@ -205,7 +205,7 @@ class PreferencesFrame(wx.Frame): metadata = self.extension.get_inkstitch_metadata() metadata['min_stitch_len_mm'] = self.minimum_stitch_length.GetValue() metadata['collapse_len_mm'] = self.minimum_jump_stitch_length.GetValue() - _, metadata['rotate_on_export'] = self.rotate_on_export_choices[self.rotate_on_export.GetCurrentSelection()] + metadata['rotate_on_export'] = self.rotate_on_export_choices[self.rotate_on_export.GetCurrentSelection()][1] global_settings['default_min_stitch_len_mm'] = self.default_minimum_stitch_length.GetValue() global_settings['default_collapse_len_mm'] = self.default_minimum_jump_stitch_length.GetValue() diff --git a/lib/stitches/running_stitch.py b/lib/stitches/running_stitch.py index 0b7a672d..8b8add7e 100644 --- a/lib/stitches/running_stitch.py +++ b/lib/stitches/running_stitch.py @@ -216,8 +216,8 @@ def stitch_curve_evenly(points: typing.Sequence[Point], stitch_length: float, to if len(points) < 2: return [] distLeft = [0] * len(points) - for i in reversed(range(0, len(points) - 1)): - distLeft[i] = distLeft[i + 1] + points[i].distance(points[i+1]) + for j in reversed(range(0, len(points) - 1)): + distLeft[j] = distLeft[j + 1] + points[j].distance(points[j+1]) i: typing.Optional[int] = 1 last = points[0] diff --git a/mypy.ini b/mypy.ini index 49e23d32..709e554e 100644 --- a/mypy.ini +++ b/mypy.ini @@ -1,9 +1,6 @@ [mypy] files = lib/**/*.py,tests/**/*.py -# Some of our code "reuses" variable names in different blocks. Mypy doesn't like that by default. -allow_redefinition = True - # We use class properties, which mypy considers an error, probably because it's going to be deprecated. # Ignore that for now. disable_error_code = misc -- cgit v1.2.3