Some super() use clean-up.

Now using Python3 style everywhere.
Added some missing calls to allow more cases of use.
This commit is contained in:
Salvador E. Tropea 2020-07-05 19:11:52 -03:00
parent 45ecb1d02a
commit 1c4c94cfa2
20 changed files with 28 additions and 25 deletions

View File

@ -38,7 +38,7 @@ def config_error(msg):
class CfgYamlReader(object):
def __init__(self):
super(CfgYamlReader, self).__init__()
super().__init__()
def _check_version(self, v):
if not isinstance(v, dict):

View File

@ -1,6 +1,9 @@
from pcbnew import (PCB_PLOT_PARAMS)
from .error import KiPlotConfigurationError
from kiplot.macros import macros, document, output_class # noqa: F401
from . import log
logger = log.get_logger(__name__)
class DrillMarks(object):
@ -19,6 +22,7 @@ class DrillMarks(object):
}
def __init__(self):
super().__init__()
with document:
self._drill_marks = 'full'
""" what to use to indicate the drill places, can be none, small or full (for real scale) """ # pragma: no cover

View File

@ -17,6 +17,7 @@ class Optionable(object):
_num_range_re = compile(r"\[number=.*\] \[(-?\d+),(-?\d+)\]")
def __init__(self, name, description):
super().__init__()
self._name = name
self._description = description
self._unkown_is_error = True

View File

@ -11,7 +11,7 @@ logger = log.get_logger(__name__)
class DrillMap(Optionable):
def __init__(self, name, description):
super(DrillMap, self).__init__(name, description)
super().__init__(name, description)
with document:
self.type = 'pdf'
""" [hpgl,ps,gerber,dxf,svg,pdf] format for a graphical drill map """
@ -19,7 +19,7 @@ class DrillMap(Optionable):
class DrillReport(Optionable):
def __init__(self, name, description):
super(DrillReport, self).__init__(name, description)
super().__init__(name, description)
with document:
self.filename = ''
""" name of the drill report. Not generated unless a name is specified """
@ -27,7 +27,7 @@ class DrillReport(Optionable):
class AnyDrill(BaseOutput):
def __init__(self, name, type, description):
super(AnyDrill, self).__init__(name, type, description)
super().__init__(name, type, description)
# Options
with document:
self.use_aux_axis_as_origin = False

View File

@ -12,7 +12,7 @@ logger = log.get_logger(__name__)
class AnyLayer(BaseOutput):
""" Base class for: DXF, Gerber, HPGL, PDF, PS and SVG """
def __init__(self, name, type, description):
super(AnyLayer, self).__init__(name, type, description)
super().__init__(name, type, description)
# We need layers, so we define it
self._layers = None
# Options

View File

@ -8,7 +8,7 @@ class BaseOutput(Optionable):
_registered = {}
def __init__(self, name, type, description):
super(BaseOutput, self).__init__(name, description)
super().__init__(name, description)
self._type = type
self._sch_related = False
self._unkown_is_error = False
@ -16,7 +16,7 @@ class BaseOutput(Optionable):
def config(self, outdir, options, layers):
self._outdir = outdir
self._layers = layers
super(BaseOutput, self).config(options)
super().config(options)
@staticmethod
def attr2longopt(attr):

View File

@ -10,7 +10,7 @@ class Excellon(AnyDrill):
You can create a map file for documentation purposes.
This output is what you get from the 'File/Fabrication output/Drill Files' menu in pcbnew. """
def __init__(self, name, type, description):
super(Excellon, self).__init__(name, type, description)
super().__init__(name, type, description)
with document:
self.metric_units = True
""" use metric units instead of inches """

View File

@ -10,7 +10,7 @@ class Gerb_Drill(AnyDrill):
You can create a map file for documentation purposes.
This output is what you get from the 'File/Fabrication output/Drill Files' menu in pcbnew. """
def __init__(self, name, type, description):
super(Gerb_Drill, self).__init__(name, type, description)
super().__init__(name, type, description)
def _configure_writer(self, board, offset):
drill_writer = GERBER_WRITER(board)

View File

@ -10,7 +10,7 @@ class Gerber(AnyLayer):
This is the main fabrication format for the PCB.
This output is what you get from the File/Plot menu in pcbnew. """
def __init__(self, name, type, description):
super(Gerber, self).__init__(name, type, description)
super().__init__(name, type, description)
self._plot_format = PLOT_FORMAT_GERBER
# Options
with document:

View File

@ -11,8 +11,7 @@ class HPGL(AnyLayer, DrillMarks):
Exports the PCB for plotters and laser printers.
This output is what you get from the File/Plot menu in pcbnew. """
def __init__(self, name, type, description):
AnyLayer.__init__(self, name, type, description)
DrillMarks.__init__(self)
super().__init__(name, type, description)
self._plot_format = PLOT_FORMAT_HPGL
# Options
with document:

View File

@ -17,7 +17,7 @@ class IBoM(BaseOutput): # noqa: F821
For more information: https://github.com/INTI-CMNB/InteractiveHtmlBom
This output is what you get from the InteractiveHtmlBom plug-in (pcbnew). """
def __init__(self, name, type, description):
super(IBoM, self).__init__(name, type, description)
super().__init__(name, type, description)
self._sch_related = True
# Options
with document:

View File

@ -17,7 +17,7 @@ class KiBoM(BaseOutput): # noqa: F821
For more information: https://github.com/INTI-CMNB/KiBoM
This output is what you get from the 'Tools/Generate Bill of Materials' menu in eeschema. """
def __init__(self, name, type, description):
super(KiBoM, self).__init__(name, type, description)
super().__init__(name, type, description)
self._sch_related = True
# Options
with document:

View File

@ -2,6 +2,9 @@ from pcbnew import (PLOT_FORMAT_PDF, FromMM, ToMM)
from kiplot.out_any_layer import AnyLayer
from kiplot.drill_marks import DrillMarks
from kiplot.macros import macros, document, output_class # noqa: F401
from . import log
logger = log.get_logger(__name__)
@output_class
@ -11,8 +14,7 @@ class PDF(AnyLayer, DrillMarks):
Note that this output isn't the best for documating your project.
This output is what you get from the File/Plot menu in pcbnew. """
def __init__(self, name, type, description):
AnyLayer.__init__(self, name, type, description)
DrillMarks.__init__(self)
super().__init__(name, type, description)
self._plot_format = PLOT_FORMAT_PDF
# Options
with document:

View File

@ -18,7 +18,7 @@ class PDF_Pcb_Print(BaseOutput): # noqa: F821
This is the main format to document your PCB.
This output is what you get from the 'File/Print' menu in pcbnew. """
def __init__(self, name, type, description):
super(PDF_Pcb_Print, self).__init__(name, type, description)
super().__init__(name, type, description)
# We need layers, so we define it
self._layers = None
# Options

View File

@ -16,7 +16,7 @@ class PDF_Sch_Print(BaseOutput): # noqa: F821
This is the main format to document your schematic.
This output is what you get from the 'File/Print' menu in eeschema. """
def __init__(self, name, type, description):
super(PDF_Sch_Print, self).__init__(name, type, description)
super().__init__(name, type, description)
self._sch_related = True
# Options
with document:

View File

@ -11,7 +11,7 @@ class Position(BaseOutput): # noqa: F821
Generates the file with position information for the PCB components, used by the pick and place machine.
This output is what you get from the 'File/Fabrication output/Footprint poistion (.pos) file' menu in pcbnew. """
def __init__(self, name, type, description):
super(Position, self).__init__(name, type, description)
super().__init__(name, type, description)
# Options
with document:
self.format = 'ASCII'

View File

@ -11,8 +11,7 @@ class PS(AnyLayer, DrillMarks):
Exports the PCB to a format suitable for printing.
This output is what you get from the File/Plot menu in pcbnew. """
def __init__(self, name, type, description):
AnyLayer.__init__(self, name, type, description)
DrillMarks.__init__(self)
super().__init__(name, type, description)
self._plot_format = PLOT_FORMAT_POST
# Options
with document:

View File

@ -17,7 +17,7 @@ class STEP(BaseOutput): # noqa: F821
This is the most common 3D format for exchange purposes.
This output is what you get from the 'File/Export/STEP' menu in pcbnew. """
def __init__(self, name, type, description):
super(STEP, self).__init__(name, type, description)
super().__init__(name, type, description)
# Options
with document:
self.metric_units = True

View File

@ -11,8 +11,7 @@ class SVG(AnyLayer, DrillMarks):
Unlike bitmaps SVG drawings can be scaled without losing resolution.
This output is what you get from the File/Plot menu in pcbnew. """
def __init__(self, name, type, description):
AnyLayer.__init__(self, name, type, description)
DrillMarks.__init__(self)
super().__init__(name, type, description)
self._plot_format = PLOT_FORMAT_SVG
# Options
with document:

View File

@ -9,7 +9,6 @@ outputs:
options:
exclude_edge_layer: false
exclude_pads_from_silkscreen: false
use_aux_axis_as_origin: false
plot_sheet_reference: false
plot_footprint_refs: true
plot_footprint_values: true