From 1ba6167b8fc86964bfb0f12f266eb25b8233e194 Mon Sep 17 00:00:00 2001 From: James Ennis Date: Wed, 14 Feb 2018 15:11:44 +0000 Subject: pylint - dealt with dangerous-default-value warning --- .pylintrc | 1 - buildstream/_artifactcache/pushreceive.py | 4 ++-- buildstream/_yaml.py | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.pylintrc b/.pylintrc index a45c41c73..f028212c0 100644 --- a/.pylintrc +++ b/.pylintrc @@ -112,7 +112,6 @@ disable=##################################### # Messages that report warnings which should be addressed # ########################################################### - dangerous-default-value, global-statement, len-as-condition, logging-format-interpolation, diff --git a/buildstream/_artifactcache/pushreceive.py b/buildstream/_artifactcache/pushreceive.py index 63adeb153..b23dc1a84 100644 --- a/buildstream/_artifactcache/pushreceive.py +++ b/buildstream/_artifactcache/pushreceive.py @@ -392,7 +392,7 @@ class ProcessWithPipes(object): class OSTreePusher(object): - def __init__(self, repopath, remotepath, branches=[], verbose=False, + def __init__(self, repopath, remotepath, branches=None, verbose=False, debug=False, output=None): self.repopath = repopath self.remotepath = remotepath @@ -410,7 +410,7 @@ class OSTreePusher(object): self.repo.open(None) # Enumerate branches to push - if len(branches) == 0: + if branches is None: _, self.refs = self.repo.list_refs(None, None) else: self.refs = {} diff --git a/buildstream/_yaml.py b/buildstream/_yaml.py index 2e29f5e18..718f7321b 100644 --- a/buildstream/_yaml.py +++ b/buildstream/_yaml.py @@ -325,7 +325,7 @@ def node_get_provenance(node, key=None, indices=None): # Note: # Returned strings are stripped of leading and trailing whitespace # -def node_get(node, expected_type, key, indices=[], default_value=None): +def node_get(node, expected_type, key, indices=None, default_value=None): value = node.get(key, default_value) provenance = node_get_provenance(node) if value is None: @@ -333,7 +333,7 @@ def node_get(node, expected_type, key, indices=[], default_value=None): "{}: Dictionary did not contain expected key '{}'".format(provenance, key)) path = key - if indices: + if indices is not None: # Implied type check of the element itself value = node_get(node, list, key) for index in indices: -- cgit v1.2.1