Skip to content
Snippets Groups Projects
Commit e11ddf13 authored by Iustin Pop's avatar Iustin Pop
Browse files

pylint cleanups: dangerous initializers


Plus a silence for a wrong "uninitialized var".

Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarOlivier Tharan <olive@google.com>
parent 7e950d31
No related branches found
No related tags found
No related merge requests found
......@@ -130,6 +130,8 @@ class ConfdClient:
@param peers: list of peer nodes
"""
# we are actually called from init, so:
# pylint: disable-msg=W0201
if not isinstance(peers, list):
raise errors.ProgrammerError("peers must be a list")
self._peers = peers
......
......@@ -48,7 +48,7 @@ __all__ = ["ConfigObject", "ConfigData", "NIC", "Disk", "Instance",
_TIMESTAMPS = ["ctime", "mtime"]
_UUID = ["uuid"]
def FillDict(defaults_dict, custom_dict, skip_keys=[]):
def FillDict(defaults_dict, custom_dict, skip_keys=None):
"""Basic function to apply settings on top a default dict.
@type defaults_dict: dict
......@@ -63,11 +63,12 @@ def FillDict(defaults_dict, custom_dict, skip_keys=[]):
"""
ret_dict = copy.deepcopy(defaults_dict)
ret_dict.update(custom_dict)
for k in skip_keys:
try:
del ret_dict[k]
except KeyError:
pass
if skip_keys:
for k in skip_keys:
try:
del ret_dict[k]
except KeyError:
pass
return ret_dict
......
......@@ -46,12 +46,14 @@ class Mapper:
"""Map resource to method.
"""
def __init__(self, connector=CONNECTOR):
def __init__(self, connector=None):
"""Resource mapper constructor.
@param connector: a dictionary, mapping method name with URL path regexp
"""
if connector is None:
connector = CONNECTOR
self._connector = connector
def getController(self, uri):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment