fix pylint warning '(dangerous-default-value) Dangerous default value {} as argument'
authorAndrey Skvortsov <andrej.skvortzov@gmail.com>
Mon, 09 Oct 2017 16:04:39 +0300
changeset 1852 70c1cc354a8f
parent 1851 1b8b5324506c
child 1853 47a3f39bead0
fix pylint warning '(dangerous-default-value) Dangerous default value {} as argument'
PLCControler.py
controls/DebugVariablePanel/DebugVariableTextViewer.py
controls/DebugVariablePanel/DebugVariableViewer.py
controls/TextCtrlAutoComplete.py
editors/Viewer.py
graphics/FBD_Objects.py
graphics/GraphicCommons.py
graphics/LD_Objects.py
graphics/SFC_Objects.py
plcopen/plcopen.py
svgui/pyjs/pyjs.py
tests/tools/check_source.sh
xmlclass/xmlclass.py
xmlclass/xsdschema.py
--- a/PLCControler.py	Mon Oct 09 12:30:14 2017 +0300
+++ b/PLCControler.py	Mon Oct 09 16:04:39 2017 +0300
@@ -2330,8 +2330,8 @@
             element.remove(copy_body)
         return text
 
-    def GenerateNewName(self, tagname, name, format, start_idx=0, exclude={}, debug=False):
-        names = exclude.copy()
+    def GenerateNewName(self, tagname, name, format, start_idx=0, exclude=None, debug=False):
+        names = {} if exclude is None else exclude.copy()
         if tagname is not None:
             names.update(dict([(varname.upper(), True)
                                for varname in self.GetEditedElementVariables(tagname, debug)]))
--- a/controls/DebugVariablePanel/DebugVariableTextViewer.py	Mon Oct 09 12:30:14 2017 +0300
+++ b/controls/DebugVariablePanel/DebugVariableTextViewer.py	Mon Oct 09 16:04:39 2017 +0300
@@ -148,7 +148,7 @@
     Class that implements a Viewer that display variable values as a text
     """
 
-    def __init__(self, parent, window, items=[]):
+    def __init__(self, parent, window, items=None):
         """
         Constructor
         @param parent: Parent wx.Window of DebugVariableText
--- a/controls/DebugVariablePanel/DebugVariableViewer.py	Mon Oct 09 12:30:14 2017 +0300
+++ b/controls/DebugVariablePanel/DebugVariableViewer.py	Mon Oct 09 16:04:39 2017 +0300
@@ -52,13 +52,14 @@
     This class has to be inherited to effectively display variable values
     """
 
-    def __init__(self, window, items=[]):
+    def __init__(self, window, items=None):
         """
         Constructor
         @param window: Reference to the Debug Variable Panel
         @param items: List of DebugVariableItem displayed by Viewer
         """
         self.ParentWindow = window
+        items = [] if items is None else items
         self.ItemsDict = OrderedDict([(item.GetVariable(), item)
                                       for item in items])
         self.Items = self.ItemsDict.viewvalues()
--- a/controls/TextCtrlAutoComplete.py	Mon Oct 09 12:30:14 2017 +0300
+++ b/controls/TextCtrlAutoComplete.py	Mon Oct 09 16:04:39 2017 +0300
@@ -37,11 +37,12 @@
 
 class PopupWithListbox(wx.PopupWindow):
 
-    def __init__(self, parent, choices=[]):
+    def __init__(self, parent, choices=None):
         wx.PopupWindow.__init__(self, parent, wx.BORDER_SIMPLE)
 
         self.ListBox = wx.ListBox(self, -1, style=wx.LB_HSCROLL | wx.LB_SINGLE | wx.LB_SORT)
 
+        choices = [] if choices is None else choices
         self.SetChoices(choices)
 
         self.ListBox.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
--- a/editors/Viewer.py	Mon Oct 09 12:30:14 2017 +0300
+++ b/editors/Viewer.py	Mon Oct 09 16:04:39 2017 +0300
@@ -3480,7 +3480,7 @@
             return True
         return False
 
-    def GenerateNewName(self, element=None, blocktype=None, exclude={}):
+    def GenerateNewName(self, element=None, blocktype=None, exclude=None):
         if element is not None and isinstance(element, SFC_Step):
             format = "Step%d"
         else:
--- a/graphics/FBD_Objects.py	Mon Oct 09 12:30:14 2017 +0300
+++ b/graphics/FBD_Objects.py	Mon Oct 09 16:04:39 2017 +0300
@@ -43,7 +43,7 @@
     """
 
     # Create a new block
-    def __init__(self, parent, type, name, id=None, extension=0, inputs=None, connectors={}, executionControl=False, executionOrder=0):
+    def __init__(self, parent, type, name, id=None, extension=0, inputs=None, connectors=None, executionControl=False, executionOrder=0):
         Graphic_Element.__init__(self, parent)
         self.Type = None
         self.Description = None
@@ -174,7 +174,7 @@
         self.RefreshConnected()
 
     # Refresh the positions of wires connected to inputs and outputs
-    def RefreshConnected(self, exclude=[]):
+    def RefreshConnected(self, exclude=None):
         for input in self.Inputs:
             input.MoveConnected(exclude)
         for output in self.Outputs:
@@ -236,7 +236,7 @@
         return None
 
     # Changes the block type
-    def SetType(self, type, extension, inputs=None, connectors={}, executionControl=False):
+    def SetType(self, type, extension, inputs=None, connectors=None, executionControl=False):
         if type != self.Type or self.Extension != extension or executionControl != self.ExecutionControl:
             if type != self.Type:
                 self.Type = type
@@ -259,6 +259,7 @@
                 self.Description = _(comment) + blocktype.get("usage", "")
             else:
                 self.Colour = wx.RED
+                connectors = {} if connectors is None else connectors
                 inputs = connectors.get("inputs", [])
                 outputs = connectors.get("outputs", [])
                 self.Description = None
@@ -611,7 +612,7 @@
         self.RefreshConnected()
 
     # Refresh the position of wires connected to connector
-    def RefreshConnected(self, exclude=[]):
+    def RefreshConnected(self, exclude=None):
         if self.Input:
             self.Input.MoveConnected(exclude)
         if self.Output:
@@ -883,7 +884,7 @@
         self.RefreshConnected()
 
     # Refresh the position of wires connected to connector
-    def RefreshConnected(self, exclude=[]):
+    def RefreshConnected(self, exclude=None):
         if self.Connector:
             self.Connector.MoveConnected(exclude)
 
--- a/graphics/GraphicCommons.py	Mon Oct 09 12:30:14 2017 +0300
+++ b/graphics/GraphicCommons.py	Mon Oct 09 16:04:39 2017 +0300
@@ -548,7 +548,7 @@
             return 0, 0
 
     # Moves the element
-    def Move(self, dx, dy, exclude=[]):
+    def Move(self, dx, dy, exclude=None):
         self.Pos.x += max(-self.BoundingBox.x, dx)
         self.Pos.y += max(-self.BoundingBox.y, dy)
         self.RefreshConnected(exclude)
@@ -1305,7 +1305,7 @@
         return len(self.Wires) > 0
 
     # Move the wires connected
-    def MoveConnected(self, exclude=[]):
+    def MoveConnected(self, exclude=None):
         if len(self.Wires) > 0:
             # Calculate the new position of the end point
             parent_pos = self.ParentBlock.GetPosition()
@@ -1313,7 +1313,7 @@
             y = parent_pos[1] + self.Pos.y + self.Direction[1] * CONNECTOR_SIZE
             # Move the corresponding point on all the wires connected
             for wire, index in self.Wires:
-                if wire not in exclude:
+                if (exclude is None) or (wire not in exclude):
                     if index == 0:
                         wire.MoveStartPoint(wx.Point(x, y))
                     else:
@@ -1625,7 +1625,8 @@
                 rect = rect.Union(wx.Rect(x, y, width, height))
         return rect
 
-    def Clone(self, parent, connectors={}, dx=0, dy=0):
+    def Clone(self, parent, connectors=None, dx=0, dy=0):
+        connectors = {} if connectors is None else connectors
         start_connector = connectors.get(self.StartConnected, None)
         end_connector = connectors.get(self.EndConnected, None)
         if start_connector is not None and end_connector is not None:
--- a/graphics/LD_Objects.py	Mon Oct 09 12:30:14 2017 +0300
+++ b/graphics/LD_Objects.py	Mon Oct 09 16:04:39 2017 +0300
@@ -196,7 +196,7 @@
         self.RefreshConnected()
 
     # Refresh the position of wires connected to power rail
-    def RefreshConnected(self, exclude=[]):
+    def RefreshConnected(self, exclude=None):
         for connector in self.Connectors:
             connector.MoveConnected(exclude)
 
@@ -506,7 +506,7 @@
         return LD_ELEMENT_SIZE
 
     # Refresh the position of wire connected to contact
-    def RefreshConnected(self, exclude=[]):
+    def RefreshConnected(self, exclude=None):
         self.Input.MoveConnected(exclude)
         self.Output.MoveConnected(exclude)
 
@@ -826,7 +826,7 @@
         return LD_ELEMENT_SIZE
 
     # Refresh the position of wire connected to coil
-    def RefreshConnected(self, exclude=[]):
+    def RefreshConnected(self, exclude=None):
         self.Input.MoveConnected(exclude)
         self.Output.MoveConnected(exclude)
 
--- a/graphics/SFC_Objects.py	Mon Oct 09 12:30:14 2017 +0300
+++ b/graphics/SFC_Objects.py	Mon Oct 09 16:04:39 2017 +0300
@@ -246,7 +246,7 @@
         self.RefreshConnected()
 
     # Refresh the position of wires connected to step
-    def RefreshConnected(self, exclude=[]):
+    def RefreshConnected(self, exclude=None):
         if self.Input:
             self.Input.MoveConnected(exclude)
         if self.Output:
@@ -767,7 +767,7 @@
         self.RefreshConnected()
 
     # Refresh the position of the wires connected to transition
-    def RefreshConnected(self, exclude=[]):
+    def RefreshConnected(self, exclude=None):
         self.Input.MoveConnected(exclude)
         self.Output.MoveConnected(exclude)
         if self.Type == "connection":
@@ -1211,7 +1211,7 @@
                 self.Size[0] + 2 * SFC_SIMULTANEOUS_SEQUENCE_EXTRA + 1, self.Size[1] + 1)
 
     # Refresh the position of wires connected to divergence
-    def RefreshConnected(self, exclude=[]):
+    def RefreshConnected(self, exclude=None):
         for input in self.Inputs:
             input.MoveConnected(exclude)
         for output in self.Outputs:
@@ -1613,7 +1613,7 @@
         self.RefreshConnected()
 
     # Refresh the position of wires connected to jump
-    def RefreshConnected(self, exclude=[]):
+    def RefreshConnected(self, exclude=None):
         if self.Input:
             self.Input.MoveConnected(exclude)
 
@@ -1785,7 +1785,7 @@
     """
 
     # Create a new action block
-    def __init__(self, parent, actions=[], id=None):
+    def __init__(self, parent, actions=None, id=None):
         Graphic_Element.__init__(self, parent)
         self.Id = id
         self.Size = wx.Size(SFC_ACTION_MIN_SIZE[0], SFC_ACTION_MIN_SIZE[1])
@@ -1865,7 +1865,7 @@
         self.BoundingBox = wx.Rect(self.Pos.x, self.Pos.y, self.Size[0] + 1, self.Size[1] + 1)
 
     # Refresh the position of wires connected to action block
-    def RefreshConnected(self, exclude=[]):
+    def RefreshConnected(self, exclude=None):
         self.Input.MoveConnected(exclude)
 
     # Returns input action block connector
@@ -1893,7 +1893,8 @@
         self.RefreshConnected()
 
     # Changes the action block actions
-    def SetActions(self, actions):
+    def SetActions(self, actions=None):
+        actions = [] if actions is None else actions
         self.Actions = actions
         self.ColSize = [0, 0, 0]
         min_height = 0
--- a/plcopen/plcopen.py	Mon Oct 09 12:30:14 2017 +0300
+++ b/plcopen/plcopen.py	Mon Oct 09 16:04:39 2017 +0300
@@ -482,7 +482,8 @@
         self.types.removedataTypeElement(name)
     setattr(cls, "removedataType", removedataType)
 
-    def getpous(self, exclude=None, filter=[]):
+    def getpous(self, exclude=None, filter=None):
+        filter = [] if filter is None else filter
         return self.xpath(
             "ppx:types/ppx:pous/ppx:pou%s%s" %
             (("[@name!='%s']" % exclude) if exclude is not None else '',
@@ -615,7 +616,8 @@
         return [value.getname() for value in enumerated_values_xpath(self)]
     setattr(cls, "GetEnumeratedDataTypeValues", GetEnumeratedDataTypeValues)
 
-    def Search(self, criteria, parent_infos=[]):
+    def Search(self, criteria, parent_infos=None):
+        parent_infos = [] if parent_infos is None else parent_infos
         result = self.types.Search(criteria, parent_infos)
         for configuration in self.instances.configurations.getconfiguration():
             result.extend(configuration.Search(criteria, parent_infos))
@@ -756,7 +758,8 @@
                     variables.remove(variables[i])
 
 
-def _SearchInConfigurationResource(self, criteria, parent_infos=[]):
+def _SearchInConfigurationResource(self, criteria, parent_infos=None):
+    parent_infos = [] if parent_infos is None else parent_infos
     search_result = _Search([("name", self.getname())], criteria, parent_infos)
     var_number = 0
     for varlist in self.getglobalVars():
@@ -810,7 +813,8 @@
     setattr(cls, "removeVariableByAddress", _removeConfigurationResourceVariableByAddress)
     setattr(cls, "removeVariableByFilter", _removeConfigurationResourceVariableByFilter)
 
-    def Search(self, criteria, parent_infos=[]):
+    def Search(self, criteria, parent_infos=None):
+        parent_infos = [] if parent_infos is None else parent_infos
         search_result = []
         parent_infos = parent_infos + ["C::%s" % self.getname()]
         filter = criteria["filter"]
@@ -848,7 +852,8 @@
     setattr(cls, "removeVariableByAddress", _removeConfigurationResourceVariableByAddress)
     setattr(cls, "removeVariableByFilter", _removeConfigurationResourceVariableByFilter)
 
-    def Search(self, criteria, parent_infos=[]):
+    def Search(self, criteria, parent_infos=None):
+        parent_infos = [] if parent_infos is None else parent_infos
         parent_infos = parent_infos[:-1] + ["R::%s::%s" % (parent_infos[-1].split("::")[1], self.getname())]
         search_result = _SearchInConfigurationResource(self, criteria, parent_infos)
         task_number = 0
@@ -896,7 +901,8 @@
             self.interval = update_address(self.interval, address_model, new_leading)
     setattr(cls, "updateElementAddress", updateElementAddress)
 
-    def Search(self, criteria, parent_infos=[]):
+    def Search(self, criteria, parent_infos=None):
+        parent_infos = [] if parent_infos is None else parent_infos
         return _Search([("single", self.getsingle()),
                         ("interval", self.getinterval()),
                         ("priority", str(self.getpriority()))],
@@ -918,7 +924,8 @@
             self.typeName = new_name
     setattr(cls, "updateElementName", updateElementName)
 
-    def Search(self, criteria, parent_infos=[]):
+    def Search(self, criteria, parent_infos=None):
+        parent_infos = [] if parent_infos is None else parent_infos
         return _Search([("name", self.getname()),
                         ("type", self.gettypeName())],
                        criteria, parent_infos)
@@ -961,7 +968,8 @@
         return vartype_content_name
     setattr(cls, "gettypeAsText", gettypeAsText)
 
-    def Search(self, criteria, parent_infos=[]):
+    def Search(self, criteria, parent_infos=None):
+        parent_infos = [] if parent_infos is None else parent_infos
         search_result = _Search([("name", self.getname()),
                                  ("type", self.gettypeAsText()),
                                  ("location", self.getaddress())],
@@ -1058,7 +1066,8 @@
             raise ValueError(_("\"%s\" POU doesn't exist !!!") % name)
     setattr(cls, "removepouElement", removepouElement)
 
-    def Search(self, criteria, parent_infos=[]):
+    def Search(self, criteria, parent_infos=None):
+        parent_infos = [] if parent_infos is None else parent_infos
         search_result = []
         for datatype in self.dataTypes.getdataType():
             search_result.extend(datatype.Search(criteria, parent_infos))
@@ -1083,7 +1092,8 @@
 def _updateDataTypeDataTypesClass(cls):
     setattr(cls, "updateElementName", _updateBaseTypeElementName)
 
-    def Search(self, criteria, parent_infos=[]):
+    def Search(self, criteria, parent_infos=None):
+        parent_infos = [] if parent_infos is None else parent_infos
         search_result = []
         filter = criteria["filter"]
         if filter == "all" or "datatype" in filter:
@@ -1114,7 +1124,8 @@
                 element.type.updateElementName(old_name, new_name)
     setattr(cls, "updateElementName", updateElementName)
 
-    def Search(self, criteria, parent_infos=[]):
+    def Search(self, criteria, parent_infos=None):
+        parent_infos = [] if parent_infos is None else parent_infos
         search_result = []
         content_name = self.content.getLocalTag()
         if content_name in ["derived", "array", "enum", "subrangeSigned", "subrangeUnsigned"]:
@@ -1144,7 +1155,8 @@
             self.name = new_name
     setattr(cls, "updateElementName", updateElementName)
 
-    def Search(self, criteria, parent_infos=[]):
+    def Search(self, criteria, parent_infos=None):
+        parent_infos = [] if parent_infos is None else parent_infos
         return [(tuple(parent_infos),) + result for result in TestTextElement(self.name, criteria)]
     setattr(cls, "Search", Search)
 
@@ -1160,7 +1172,8 @@
 def _updateArrayDataTypeClass(cls):
     setattr(cls, "updateElementName", _updateBaseTypeElementName)
 
-    def Search(self, criteria, parent_infos=[]):
+    def Search(self, criteria, parent_infos=None):
+        parent_infos = [] if parent_infos is None else parent_infos
         search_result = self.baseType.Search(criteria, parent_infos)
         for i, dimension in enumerate(self.getdimension()):
             search_result.extend(_Search([("lower", dimension.getlower()),
@@ -1178,7 +1191,8 @@
 # ----------------------------------------------------------------------
 
 
-def _SearchInSubrange(self, criteria, parent_infos=[]):
+def _SearchInSubrange(self, criteria, parent_infos=None):
+    parent_infos = [] if parent_infos is None else parent_infos
     search_result = self.baseType.Search(criteria, parent_infos)
     search_result.extend(_Search([("lower", self.range.getlower()),
                                   ("upper", self.range.getupper())],
@@ -1211,7 +1225,8 @@
 
     enumerated_datatype_values_xpath = PLCOpen_XPath("ppx:values/ppx:value")
 
-    def Search(self, criteria, parent_infos=[]):
+    def Search(self, criteria, parent_infos=None):
+        parent_infos = [] if parent_infos is None else parent_infos
         search_result = []
         for i, value in enumerate(enumerated_datatype_values_xpath(self)):
             for result in TestTextElement(value.getname(), criteria):
@@ -1604,7 +1619,8 @@
                             content.remove(variable)
     setattr(cls, "removeVariableByFilter", removeVariableByFilter)
 
-    def Search(self, criteria, parent_infos=[]):
+    def Search(self, criteria, parent_infos=None):
+        parent_infos = [] if parent_infos is None else parent_infos
         search_result = []
         filter = criteria["filter"]
         if filter == "all" or self.getpouType() in filter:
@@ -1969,7 +1985,8 @@
                 element.updateElementAddress(address_model, new_leading)
     setattr(cls, "updateElementAddress", updateElementAddress)
 
-    def Search(self, criteria, parent_infos=[]):
+    def Search(self, criteria, parent_infos=None):
+        parent_infos = [] if parent_infos is None else parent_infos
         if self.content.getLocalTag() in ["IL", "ST"]:
             search_result = self.content.Search(criteria, parent_infos + ["body", 0])
         else:
@@ -2117,7 +2134,7 @@
     pass
 
 
-def _SearchInElement(self, criteria, parent_infos=[]):
+def _SearchInElement(self, criteria, parent_infos=None):
     return []
 
 
@@ -2174,7 +2191,8 @@
         self.content.updateElementAddress(address_model, new_leading)
     setattr(cls, "updateElementAddress", updateElementAddress)
 
-    def Search(self, criteria, parent_infos=[]):
+    def Search(self, criteria, parent_infos=None):
+        parent_infos = [] if parent_infos is None else parent_infos
         return self.content.Search(criteria, parent_infos + ["comment", self.getlocalId(), "content"])
     setattr(cls, "Search", Search)
 
@@ -2218,7 +2236,8 @@
             _translateConnections(input.connectionPointIn, dx, dy)
     setattr(cls, "translate", translate)
 
-    def Search(self, criteria, parent_infos=[]):
+    def Search(self, criteria, parent_infos=None):
+        parent_infos = [] if parent_infos is None else parent_infos
         parent_infos = parent_infos + ["block", self.getlocalId()]
         search_result = _Search([("name", self.getinstanceName()),
                                  ("type", self.gettypeName())],
@@ -2255,7 +2274,8 @@
 
 
 def _getSearchInLDElement(ld_element_type):
-    def SearchInLDElement(self, criteria, parent_infos=[]):
+    def SearchInLDElement(self, criteria, parent_infos=None):
+        parent_infos = [] if parent_infos is None else parent_infos
         return _Search([("reference", self.variable)], criteria, parent_infos + [ld_element_type, self.getlocalId()])
     return SearchInLDElement
 
@@ -2284,7 +2304,8 @@
 
 
 def _updateStepSfcObjectSingleClass(cls):
-    def Search(self, criteria, parent_infos=[]):
+    def Search(self, criteria, parent_infos=None):
+        parent_infos = [] if parent_infos is None else parent_infos
         return _Search([("name", self.getname())], criteria, parent_infos + ["step", self.getlocalId()])
     setattr(cls, "Search", Search)
 
@@ -2396,7 +2417,8 @@
         return None
     setattr(cls, "getconnections", getconnections)
 
-    def Search(self, criteria, parent_infos=[]):
+    def Search(self, criteria, parent_infos=None):
+        parent_infos = [] if parent_infos is None else parent_infos
         parent_infos = parent_infos + ["transition", self.getlocalId()]
         search_result = []
         content = self.condition.getcontent()
@@ -2475,7 +2497,8 @@
             self.inline.updateElementAddress(address_model, new_leading)
     setattr(cls, "updateElementAddress", updateElementAddress)
 
-    def Search(self, criteria, parent_infos=[]):
+    def Search(self, criteria, parent_infos=None):
+        parent_infos = [] if parent_infos is None else parent_infos
         qualifier = self.getqualifier()
         if qualifier is None:
             qualifier = "N"
@@ -2548,7 +2571,8 @@
             action.updateElementAddress(address_model, new_leading)
     setattr(cls, "updateElementAddress", updateElementAddress)
 
-    def Search(self, criteria, parent_infos=[]):
+    def Search(self, criteria, parent_infos=None):
+        parent_infos = [] if parent_infos is None else parent_infos
         parent_infos = parent_infos + ["action_block", self.getlocalId()]
         search_result = []
         for idx, action in enumerate(self.action):
@@ -2565,7 +2589,8 @@
 # ----------------------------------------------------------------------
 
 
-def _SearchInIOVariable(self, criteria, parent_infos=[]):
+def _SearchInIOVariable(self, criteria, parent_infos=None):
+    parent_infos = [] if parent_infos is None else parent_infos
     return _Search([("expression", self.expression)], criteria, parent_infos + ["io_variable", self.getlocalId()])
 
 
@@ -2597,7 +2622,8 @@
     setattr(cls, "Search", _SearchInIOVariable)
 
 
-def _SearchInConnector(self, criteria, parent_infos=[]):
+def _SearchInConnector(self, criteria, parent_infos=None):
+    parent_infos = [] if parent_infos is None else parent_infos
     return _Search([("name", self.getname())], criteria, parent_infos + ["connector", self.getlocalId()])
 
 
--- a/svgui/pyjs/pyjs.py	Mon Oct 09 12:30:14 2017 +0300
+++ b/svgui/pyjs/pyjs.py	Mon Oct 09 16:04:39 2017 +0300
@@ -1636,12 +1636,13 @@
 
 class AppTranslator(object):
 
-    def __init__(self, library_dirs=[], parser=None, dynamic=False,
+    def __init__(self, library_dirs=None, parser=None, dynamic=False,
                  optimize=False, verbose=True):
         self.extension = ".py"
         self.optimize = optimize
         self.library_modules = []
         self.overrides = {}
+        library_dirs = [] if library_dirs is None else library_dirs
         self.library_dirs = path + library_dirs
         self.dynamic = dynamic
         self.verbose = verbose
@@ -1675,7 +1676,7 @@
         raise Exception("file not found: " + file_name)
 
     def _translate(self, module_name, is_app=True, debug=False,
-                   imported_js=set()):
+                   imported_js=None):
         if module_name not in self.library_modules:
             self.library_modules.append(module_name)
 
@@ -1701,6 +1702,8 @@
                        self.findFile)
 
         module_str = output.getvalue()
+        if imported_js is None:
+            imported_js = set()
         imported_js.update(set(t.imported_js))
         imported_modules_str = ""
         for module in t.imported_modules:
@@ -1713,27 +1716,28 @@
         return imported_modules_str + module_str
 
     def translate(self, module_name, is_app=True, debug=False,
-                  library_modules=[]):
+                  library_modules=None):
         app_code = cStringIO.StringIO()
         lib_code = cStringIO.StringIO()
         imported_js = set()
         self.library_modules = []
         self.overrides = {}
-        for library in library_modules:
-            if library.endswith(".js"):
-                imported_js.add(library)
-                continue
-            self.library_modules.append(library)
-            if self.verbose:
-                print('Including LIB', library)
-            print('\n//\n// BEGIN LIB '+library+'\n//\n', file=lib_code)
-            print(self._translate(library, False, debug=debug, imported_js=imported_js),
-                  file=lib_code)
-
-            print("/* initialize static library */", file=lib_code)
-            print("%s%s();\n" % (UU, library), file=lib_code)
-
-            print('\n//\n// END LIB '+library+'\n//\n', file=lib_code)
+        if library_modules is not None:
+            for library in library_modules:
+                if library.endswith(".js"):
+                    imported_js.add(library)
+                    continue
+                self.library_modules.append(library)
+                if self.verbose:
+                    print('Including LIB', library)
+                print('\n//\n// BEGIN LIB '+library+'\n//\n', file=lib_code)
+                print(self._translate(library, False, debug=debug, imported_js=imported_js),
+                      file=lib_code)
+
+                print("/* initialize static library */", file=lib_code)
+                print("%s%s();\n" % (UU, library), file=lib_code)
+
+                print('\n//\n// END LIB '+library+'\n//\n', file=lib_code)
         if module_name:
             print(self._translate(module_name, is_app, debug=debug, imported_js=imported_js),
                   file=app_code)
--- a/tests/tools/check_source.sh	Mon Oct 09 12:30:14 2017 +0300
+++ b/tests/tools/check_source.sh	Mon Oct 09 16:04:39 2017 +0300
@@ -221,6 +221,7 @@
     enable=$enable,W0612          # (unused-variable) Unused variable 'X'
     enable=$enable,W0611          # (unused-import) Unused import X
     enable=$enable,C1001          # (old-style-class) Old-style class defined. Problem with PyJS
+    enable=$enable,W0102          # (dangerous-default-value) Dangerous default value {} as argument
 
     # enable=$enable,W0403        # relative import
     # enable=
--- a/xmlclass/xmlclass.py	Mon Oct 09 12:30:14 2017 +0300
+++ b/xmlclass/xmlclass.py	Mon Oct 09 16:04:39 2017 +0300
@@ -240,12 +240,14 @@
     return GetInteger
 
 
-def GenerateFloatExtraction(type, extra_values=[]):
+def GenerateFloatExtraction(type, extra_values=None):
     """
     Function that generates an extraction function for float
     @param type: name of the type of float
     @return: function generated
     """
+    extra_values = [] if extra_values is None else extra_values
+
     def GetFloat(attr, extract=True):
         """
         Function that extracts a float from a tree node or a string
--- a/xmlclass/xsdschema.py	Mon Oct 09 12:30:14 2017 +0300
+++ b/xmlclass/xsdschema.py	Mon Oct 09 16:04:39 2017 +0300
@@ -50,9 +50,10 @@
     return generateXMLTextMethod
 
 
-def GenerateFloatXMLText(extra_values=[], decimal=None):
+def GenerateFloatXMLText(extra_values=None, decimal=None):
     float_format = (lambda x: "{:.{width}f}".format(x, width=decimal).rstrip('0')
                     if decimal is not None else str)
+    extra_values = [] if extra_values is None else extra_values
 
     def generateXMLTextMethod(value, name=None, indent=0):
         text = ""