Fixed B006 Do not use mutable data structures for argument defaults.
This commit is contained in:
parent
15b2075c96
commit
f26ab6ede8
|
|
@ -1532,15 +1532,15 @@ class Schematic(object):
|
|||
raise SchFileError('Wrong entry in title block', line, f)
|
||||
self.title_block[m.group(1)] = m.group(2)
|
||||
|
||||
def load(self, fname, project, sheet_path='', sheet_path_h='/', libs={}, fields=[], fields_lc=set(), parent=None):
|
||||
def load(self, fname, project, sheet_path='', sheet_path_h='/', libs=None, fields=None, fields_lc=None, parent=None):
|
||||
""" Load a v5.x KiCad Schematic.
|
||||
The caller must be sure the file exists.
|
||||
Only the schematics are loaded not the libs. """
|
||||
logger.debug("Loading sheet from "+fname)
|
||||
self.fname = fname
|
||||
self.libs = libs
|
||||
self.fields = fields
|
||||
self.fields_lc = fields_lc
|
||||
self.libs = {} if libs is None else libs
|
||||
self.fields = [] if fields is None else fields
|
||||
self.fields_lc = set() if fields_lc is None else fields_lc
|
||||
self.project = project
|
||||
self.sheet_path = sheet_path
|
||||
self.sheet_path_h = sheet_path_h
|
||||
|
|
@ -1961,7 +1961,7 @@ class Schematic(object):
|
|||
tp = pin.type2name.get(pin.type, 'unknown')
|
||||
pn.set('type', tp)
|
||||
|
||||
def save_netlist(self, fhandle, comps, excluded=False, fitted=True, no_field=[]):
|
||||
def save_netlist(self, fhandle, comps, excluded=False, fitted=True, no_field=()):
|
||||
""" This is a partial netlist in XML, only useful for BoMs """
|
||||
root = Element("export")
|
||||
root.set('version', self.netlist_version)
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ logger = log.get_logger()
|
|||
CROSSED_LIB = 'kibot_crossed'
|
||||
|
||||
|
||||
def _check_is_symbol_list(e, allow_orphan_symbol=[]):
|
||||
def _check_is_symbol_list(e, allow_orphan_symbol=()):
|
||||
# Each entry is a list
|
||||
if not isinstance(e, list):
|
||||
if isinstance(e, Symbol):
|
||||
|
|
|
|||
|
|
@ -457,9 +457,11 @@ class QR_LibOptions(BaseOptions):
|
|||
raise KiPlotConfigurationError(error)
|
||||
return ki_file
|
||||
|
||||
def load_k6_sheets(self, fname, sheets={}):
|
||||
def load_k6_sheets(self, fname, sheets=None):
|
||||
logger.debug('- Loading '+fname)
|
||||
sheet = self.load_sexp_file(fname)
|
||||
if sheets is None:
|
||||
sheets = {}
|
||||
sheets[fname] = sheet
|
||||
if not is_symbol('kicad_sch', sheet[0]):
|
||||
raise KiPlotConfigurationError('No kicad_sch signature in '+fname)
|
||||
|
|
|
|||
|
|
@ -602,7 +602,7 @@ def test_no_colorama(test_dir):
|
|||
ctx.search_err(r'\[31m.\[1mERROR:Testing 1 2 3')
|
||||
|
||||
|
||||
def check_test_v5_sch_deps(ctx, deps, extra=[], in_output=False):
|
||||
def check_test_v5_sch_deps(ctx, deps, extra=(), in_output=False):
|
||||
ndeps = 4
|
||||
if in_output:
|
||||
ndeps -= 1
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ CSV_EXPR = r'^"%s",[^,]+,[^,]+,([-\d\.]+),([-\d\.]+),([-\d\.]+),(\S+)$'
|
|||
ASCII_EXPR = r'^%s\s+\S+\s+\S+\s+([-\d\.]+)\s+([-\d\.]+)\s+([-\d\.]+)\s+(\S+)\s*$'
|
||||
|
||||
|
||||
def expect_position(ctx, file, comp, no_comp=[], inches=False, csv=False, neg_x=False):
|
||||
def expect_position(ctx, file, comp, no_comp=(), inches=False, csv=False, neg_x=False):
|
||||
"""
|
||||
Check if a list of components are or aren't in the file
|
||||
"""
|
||||
|
|
|
|||
Loading…
Reference in New Issue