From b8142cc08e983a790d7d49a754954e2585bd5470 Mon Sep 17 00:00:00 2001 From: jaseg Date: Fri, 21 Jan 2022 22:05:23 +0100 Subject: Fix test failures --- gerbonara/gerber/__init__.py | 4 +++- gerbonara/gerber/excellon.py | 4 ++-- gerbonara/gerber/layers.py | 2 +- gerbonara/gerber/rs274x.py | 4 ++-- 4 files changed, 8 insertions(+), 6 deletions(-) (limited to 'gerbonara') diff --git a/gerbonara/gerber/__init__.py b/gerbonara/gerber/__init__.py index 9c8453c..0305e27 100644 --- a/gerbonara/gerber/__init__.py +++ b/gerbonara/gerber/__init__.py @@ -22,4 +22,6 @@ gerbonara provides utilities for working with Gerber (RS-274X) and Excellon files in python. """ -from .layers import load_layer, load_layer_data +from .rs274x import GerberFile +from .excellon import ExcellonFile +from .layers import LayerStack diff --git a/gerbonara/gerber/excellon.py b/gerbonara/gerber/excellon.py index dc2ea86..6cc5e69 100755 --- a/gerbonara/gerber/excellon.py +++ b/gerbonara/gerber/excellon.py @@ -65,7 +65,7 @@ def parse_allegro_ncparam(data, settings=None): # want to parse, but sometimes due to user error it doesn't end up in the gerber package. In this case, we want to # still be able to extract the same information from the human-readable ncdrill.log. - if settings is None + if settings is None: self.settings = FileSettings(number_format=(None, None)) lz_supp, tz_supp = False, False @@ -172,7 +172,7 @@ class ExcellonFile(CamFile): return kls.from_string(filename.read_text(), settings=settings, filename=filename, plated=plated) @classmethod - def from_string(kls, data, settings=None, filename=filename, plated=None): + def from_string(kls, data, settings=None, filename=None, plated=None): parser = ExcellonParser(settings) parser._do_parse(data) return kls(objects=parser.objects, comments=parser.comments, import_settings=settings, diff --git a/gerbonara/gerber/layers.py b/gerbonara/gerber/layers.py index bb72ff0..d428722 100644 --- a/gerbonara/gerber/layers.py +++ b/gerbonara/gerber/layers.py @@ -222,7 +222,7 @@ class LayerStack: def __init__(self, graphic_layers, drill_layers, board_name=None): self.graphic_layers = graphic_layers - self.-drill_layers = drill_layers + self.drill_layers = drill_layers self.board_name = board_name def merge_drill_layers(self): diff --git a/gerbonara/gerber/rs274x.py b/gerbonara/gerber/rs274x.py index a1cd207..80605a5 100644 --- a/gerbonara/gerber/rs274x.py +++ b/gerbonara/gerber/rs274x.py @@ -141,7 +141,7 @@ class GerberFile(CamFile): # dedup apertures new_apertures = {} replace_apertures = {} - mock_settings = self.import_settings + mock_settings = FileSettings() for ap in self.apertures + other.apertures: gbr = ap.to_gerber(mock_settings) if gbr not in new_apertures: @@ -825,7 +825,7 @@ class GerberParser: self.layer_hints.append('bottom silk') elif 'ETCH' in cmt: _1, _2, name = cmt.partition('/') - name = re.sub('\W+', '_', name) + name = re.sub(r'\W+', '_', name) self.layer_hints.append(f'{name} copper') else: -- cgit