From a991fc0b29c07790725ddc82e99dfae093ccd6da Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Wed, 18 Sep 2024 10:59:32 -0300 Subject: [PATCH] [DOCs][Fixed] pcbdraw.remap is a string_dict (not a regular dict) --- docs/samples/generic_plot.kibot.yaml | 4 ++-- .../configuration/outputs/PcbDrawOptions.rst | 4 ++-- .../configuration/outputs/PcbDrawRemap.rst | 7 ------- kibot/out_pcbdraw.py | 15 ++++----------- tests/GUI/outputs | 4 ++-- tests/GUI/stats | 18 ++++++++++-------- 6 files changed, 20 insertions(+), 32 deletions(-) delete mode 100644 docs/source/configuration/outputs/PcbDrawRemap.rst diff --git a/docs/samples/generic_plot.kibot.yaml b/docs/samples/generic_plot.kibot.yaml index b9571320..33d1b092 100644 --- a/docs/samples/generic_plot.kibot.yaml +++ b/docs/samples/generic_plot.kibot.yaml @@ -2845,9 +2845,9 @@ outputs: # [string|list(string)='_null'] Name of the filter to transform fields before applying other filters. # A short-cut to use for simple cases where a variant is an overkill pre_transform: '_null' - # [dict|string='None'] (DEPRECATED) Replacements for PCB references using specified components (lib:component). + # [string_dict|string='None'] (DEPRECATED) Replacements for PCB references using specified components (lib:component). # Use `remap_components` instead - remap: + remap: 'None' # [list(dict)=[]] Replacements for PCB references using specified components. # Replaces `remap` with type check remap_components: diff --git a/docs/source/configuration/outputs/PcbDrawOptions.rst b/docs/source/configuration/outputs/PcbDrawOptions.rst index a8ebc18d..38c74f2e 100644 --- a/docs/source/configuration/outputs/PcbDrawOptions.rst +++ b/docs/source/configuration/outputs/PcbDrawOptions.rst @@ -39,8 +39,9 @@ PcbDrawOptions parameters - ``pre_transform`` :index:`: ` [:ref:`string ` | :ref:`list(string) `] (default: ``'_null'``) Name of the filter to transform fields before applying other filters. A short-cut to use for simple cases where a variant is an overkill. -- ``remap`` :index:`: ` [:ref:`PcbDrawRemap parameters `] [:ref:`dict ` | :ref:`string `] (default: ``'None'``) (DEPRECATED) Replacements for PCB references using specified components (lib:component). +- ``remap`` :index:`: ` [:ref:`string_dict ` | :ref:`string `] (default: ``'None'``) (DEPRECATED) Replacements for PCB references using specified components (lib:component). Use `remap_components` instead. + - ``remap_components`` :index:`: ` [:ref:`PcbDrawRemapComponents parameters `] [:ref:`list(dict) `] (default: ``[]``) Replacements for PCB references using specified components. Replaces `remap` with type check. - ``resistor_flip`` :index:`: ` [:ref:`string ` | :ref:`list(string) `] (default: ``''``) [:ref:`comma separated `] List of resistors to flip its bands. @@ -66,7 +67,6 @@ PcbDrawOptions parameters .. toctree:: :caption: Used dicts - PcbDrawRemap PcbDrawRemapComponents PcbDrawResistorRemap PcbDrawStyle diff --git a/docs/source/configuration/outputs/PcbDrawRemap.rst b/docs/source/configuration/outputs/PcbDrawRemap.rst deleted file mode 100644 index 83f39fe0..00000000 --- a/docs/source/configuration/outputs/PcbDrawRemap.rst +++ /dev/null @@ -1,7 +0,0 @@ -.. _PcbDrawRemap: - - -PcbDrawRemap parameters -~~~~~~~~~~~~~~~~~~~~~~~ - - diff --git a/kibot/out_pcbdraw.py b/kibot/out_pcbdraw.py index 5c8b112b..71a6960a 100644 --- a/kibot/out_pcbdraw.py +++ b/kibot/out_pcbdraw.py @@ -113,13 +113,6 @@ def to_dict(self): return {k.replace('_', '-'): v for k, v in self.get_attrs_gen()} -class PcbDrawRemap(Optionable): - """ This class accepts a free form dict. - No validation is done. """ - def config(self, parent): - pass - - class PcbDrawResistorRemap(Optionable): """ Reference -> New value """ def __init__(self): @@ -188,9 +181,9 @@ def __init__(self): """ [list(string)] List of libraries """ self.placeholder = False """ Show placeholder for missing components """ - self.remap = PcbDrawRemap - """ [dict|string='None'] (DEPRECATED) Replacements for PCB references using specified components (lib:component). - Use `remap_components` instead """ + self.remap = Optionable + """ [string_dict|string='None'] (DEPRECATED) Replacements for PCB references using specified components + (lib:component). Use `remap_components` instead """ self.remap_components = PcbDrawRemapComponents """ [list(dict)=[]] Replacements for PCB references using specified components. Replaces `remap` with type check """ @@ -280,7 +273,7 @@ def config(self, parent): self.show_components = self.solve_kf_filters(self.show_components) # Resistors Remap self._remap = {} - if isinstance(self.remap, PcbDrawRemap): + if isinstance(self.remap, Optionable): for ref, v in self.remap._tree.items(): if not isinstance(v, str): raise KiPlotConfigurationError("Wrong PcbDraw remap, must be `ref: lib:component` ({}: {})".format(ref, v)) diff --git a/tests/GUI/outputs b/tests/GUI/outputs index c7797644..cc75feca 100644 --- a/tests/GUI/outputs +++ b/tests/GUI/outputs @@ -8953,10 +8953,10 @@ [ "remap", [ - "DataTypeDict", + "DataTypeStringDict", "DataTypeString" ], - [] + null ], [ "remap_components", diff --git a/tests/GUI/stats b/tests/GUI/stats index 445a8c19..97985936 100644 --- a/tests/GUI/stats +++ b/tests/GUI/stats @@ -142,14 +142,14 @@ Outputs sorted by depth: - Number: 266 - ListStringSingular: 222 - Choice: 94 -- Dict: 80 +- Dict: 79 - ListDictOrString: 21 - ListDict: 20 - Combo: 14 - ListString: 9 - ListDictSingular: 5 - ListListString: 2 -- StringDict: 1 +- StringDict: 2 - NumberChoice: 1 -------------------------------------------------------------------------------- Used as single data type: @@ -168,16 +168,17 @@ Used as single data type: - StringDict: 1 ['download_datasheets.options.classify_extra'] - NumberChoice: 1 ['gerber.options.gerber_precision'] -------------------------------------------------------------------------------- -9 different data type combinations +10 different data type combinations - Number,String: 92 - Boolean,String: 52 - Combo,ListDictOrString: 12 -- Dict,String: 6 ['blender_export.options.pcb3d', 'excellon.options.report', 'gerb_drill.options.report', 'kibom.options.conf', 'pcbdraw.options.style', 'pcbdraw.options.remap'] +- Dict,String: 5 ['blender_export.options.pcb3d', 'excellon.options.report', 'gerb_drill.options.report', 'kibom.options.conf', 'pcbdraw.options.style'] - ListDictOrString,String: 4 ['bom.options.columns.join', 'bom.options.cost_extra_columns.join', 'bom.options.xlsx.specs_columns.join', 'panelize.options.configs'] - Boolean,ListStringSingular: 3 ['bom.options.html.lcsc_link', 'bom.options.xlsx.lcsc_link', 'kibom.options.conf.lcsc_link'] - Choice,Dict: 2 ['excellon.options.map', 'gerb_drill.options.map'] - Dict,Number: 2 ['pcbdraw.options.margin', 'svg.options.margin'] - Boolean,Choice: 1 ['ibom.options.highlight_pin1'] +- String,StringDict: 1 ['pcbdraw.options.remap'] ================================================================================ ================================================================================ 21 preflights types with a total of 120 different parameters @@ -599,14 +600,14 @@ Totals sorted by depth: - Number: 295 - ListStringSingular: 251 - Choice: 124 -- Dict: 89 +- Dict: 88 - ListDict: 30 - ListDictOrString: 22 - Combo: 14 - ListString: 12 - ListDictSingular: 10 - ListListString: 4 -- StringDict: 1 +- StringDict: 2 - NumberChoice: 1 -------------------------------------------------------------------------------- Used as single data type: @@ -625,15 +626,16 @@ Used as single data type: - StringDict: 1 ['download_datasheets.options.classify_extra'] - NumberChoice: 1 ['gerber.options.gerber_precision'] -------------------------------------------------------------------------------- -10 different data type combinations +11 different data type combinations - Number,String: 107 - Boolean,String: 52 - Combo,ListDictOrString: 12 -- Dict,String: 6 ['blender_export.options.pcb3d', 'excellon.options.report', 'gerb_drill.options.report', 'kibom.options.conf', 'pcbdraw.options.style', 'pcbdraw.options.remap'] - Boolean,Dict: 6 ['draw_stackup.draw_stackup', 'drc.drc', 'erc.erc', 'run_drc.run_drc', 'run_erc.run_erc', 'update_xml.update_xml'] +- Dict,String: 5 ['blender_export.options.pcb3d', 'excellon.options.report', 'gerb_drill.options.report', 'kibom.options.conf', 'pcbdraw.options.style'] - ListDictOrString,String: 4 ['bom.options.columns.join', 'bom.options.cost_extra_columns.join', 'bom.options.xlsx.specs_columns.join', 'panelize.options.configs'] - Boolean,ListStringSingular: 3 ['bom.options.html.lcsc_link', 'bom.options.xlsx.lcsc_link', 'kibom.options.conf.lcsc_link'] - Choice,Dict: 2 ['excellon.options.map', 'gerb_drill.options.map'] - Dict,Number: 2 ['pcbdraw.options.margin', 'svg.options.margin'] - Boolean,Choice: 1 ['ibom.options.highlight_pin1'] +- String,StringDict: 1 ['pcbdraw.options.remap'] Found 2 unique warning/s (3 total)