- some PEP8 fixes

This commit is contained in:
Marius Stanciu
2023-01-16 13:28:50 +02:00
parent 6c5a468418
commit a1b6f78d78
2 changed files with 35 additions and 24 deletions

View File

@@ -10,6 +10,7 @@ CHANGELOG for FlatCAM Evo beta
16.01.2023 16.01.2023
- fixed a decoding error in the Excellon parser - fixed a decoding error in the Excellon parser
- some PEP8 fixes
15.01.2023 15.01.2023

View File

@@ -82,7 +82,7 @@ class Excellon(Geometry):
self.source_file = '' self.source_file = ''
# it serve to flag if a start routing or a stop routing was encountered # it serves to flag if a start routing or a stop routing was encountered
# if a stop is encounter and this flag is still 0 (so there is no stop for a previous start) issue error # if a stop is encounter and this flag is still 0 (so there is no stop for a previous start) issue error
self.routing_flag = 1 self.routing_flag = 1
@@ -361,8 +361,8 @@ class Excellon(Geometry):
self.excellon_format_upper_in = match.group(1) self.excellon_format_upper_in = match.group(1)
self.excellon_format_lower_in = match.group(2) self.excellon_format_lower_in = match.group(2)
self.app.log.warning("Excellon format preset found in comments: %s:%s" % aef_msg = "Excellon format preset found in comments: %s:%s" % (match.group(1), match.group(2))
(match.group(1), match.group(2))) self.app.log.warning(aef_msg)
continue continue
else: else:
self.app.log.warning("Line ignored, it's a comment: %s" % eline) self.app.log.warning("Line ignored, it's a comment: %s" % eline)
@@ -897,11 +897,13 @@ class Excellon(Geometry):
self.app.log.warning("UNITS found inline - Value after conversion: %s" % self.units) self.app.log.warning("UNITS found inline - Value after conversion: %s" % self.units)
if self.units == 'MM': if self.units == 'MM':
self.app.log.warning("Excellon format preset is: %s:%s" % b_msg = "Excellon format preset is: %s:%s" % \
(str(self.excellon_format_upper_mm), str(self.excellon_format_lower_mm))) (str(self.excellon_format_upper_mm), str(self.excellon_format_lower_mm))
self.app.log.warning(b_msg)
else: else:
self.app.log.warning("Excellon format preset is: %s:%s" % a_msg = "Excellon format preset is: %s:%s" % \
(str(self.excellon_format_upper_in), str(self.excellon_format_lower_in))) (str(self.excellon_format_upper_in), str(self.excellon_format_lower_in))
self.app.log.warning(a_msg)
self.app.log.warning("Type of ZEROS found inline, in header: %s" % self.zeros) self.app.log.warning("Type of ZEROS found inline, in header: %s" % self.zeros)
continue continue
@@ -909,21 +911,25 @@ class Excellon(Geometry):
if "INCH" in eline: if "INCH" in eline:
line_units = "IN" line_units = "IN"
# Modified for issue #80 # Modified for issue #80
self.app.log.warning("Type of UNITS found inline, in header, before conversion: %s" % line_units) f_msg = "Type of UNITS found inline, in header, before conversion: %s" % line_units
self.app.log.warning(f_msg)
self.convert_units(line_units) self.convert_units(line_units)
self.app.log.warning("Type of UNITS found inline, in header, after conversion: %s" % self.units) self.app.log.warning("Type of UNITS found inline, in header, after conversion: %s" % self.units)
self.app.log.warning("Excellon format preset is: %s:%s" % ff_msg = "Excellon format preset is: %s:%s" % \
(str(self.excellon_format_upper_in), str(self.excellon_format_lower_in))) (str(self.excellon_format_upper_in), str(self.excellon_format_lower_in))
self.app.log.warning(ff_msg)
self.excellon_units_found = "IN" self.excellon_units_found = "IN"
continue continue
elif "METRIC" in eline: elif "METRIC" in eline:
line_units = "MM" line_units = "MM"
# Modified for issue #80 # Modified for issue #80
self.app.log.warning("Type of UNITS found inline, in header, before conversion: %s" % line_units) f_msg = "Type of UNITS found inline, in header, before conversion: %s" % line_units
self.app.log.warning(f_msg)
self.convert_units(line_units) self.convert_units(line_units)
self.app.log.warning("Type of UNITS found inline, in header, after conversion: %s" % self.units) self.app.log.warning("Type of UNITS found inline, in header, after conversion: %s" % self.units)
self.app.log.warning("Excellon format preset is: %s:%s" % ff_msg = "Excellon format preset is: %s:%s" % \
(str(self.excellon_format_upper_mm), str(self.excellon_format_lower_mm))) (str(self.excellon_format_upper_mm), str(self.excellon_format_lower_mm))
self.app.log.warning(ff_msg)
self.excellon_units_found = "MM" self.excellon_units_found = "MM"
continue continue
@@ -953,16 +959,19 @@ class Excellon(Geometry):
self.excellon_format_lower_in = lower self.excellon_format_lower_in = lower
# Modified for issue #80 # Modified for issue #80
self.app.log.warning("Type of UNITS found outside header, inline before conversion: %s" % self.units) c_msg = "Type of UNITS found outside header, inline before conversion: %s" % self.units
self.app.log.warning(c_msg)
self.convert_units(self.units) self.convert_units(self.units)
self.app.log.warning("Type of UNITS found outside header, inline after conversion: %s" % self.units) self.app.log.warning("Type of UNITS found outside header, inline after conversion: %s" % self.units)
if self.units == 'MM': if self.units == 'MM':
self.app.log.warning("Excellon format preset is: %s:%s" % cc_msg = "Excellon format preset is: %s:%s" % \
(str(self.excellon_format_upper_mm), str(self.excellon_format_lower_mm))) (str(self.excellon_format_upper_mm), str(self.excellon_format_lower_mm))
self.app.log.warning(cc_msg)
else: else:
self.app.log.warning("Excellon format preset is: %s:%s" % cc_msg = "Excellon format preset is: %s:%s" % \
(str(self.excellon_format_upper_in), str(self.excellon_format_lower_in))) (str(self.excellon_format_upper_in), str(self.excellon_format_lower_in))
self.app.log.warning(cc_msg)
self.app.log.warning("Type of ZEROS found outside header, inline: %s" % self.zeros) self.app.log.warning("Type of ZEROS found outside header, inline: %s" % self.zeros)
continue continue
@@ -1096,8 +1105,9 @@ class Excellon(Geometry):
self.solid_geometry.append(poly) self.solid_geometry.append(poly)
except Exception as e: except Exception as e:
self.app.log.error("appParsers.ParseExcellon.Excellon.create_geometry() -> " err_msg = "appParsers.ParseExcellon.Excellon.create_geometry() -> " \
"Excellon geometry creation failed due of ERROR: %s" % str(e)) "Excellon geometry creation failed due of ERROR: %s" % str(e)
self.app.log.error(err_msg)
return "fail" return "fail"
def bounds(self, flatten=None): def bounds(self, flatten=None):