diff options
author | Benjamin Schubert <contact@benschubert.me> | 2020-05-07 22:06:03 +0100 |
---|---|---|
committer | bst-marge-bot <marge-bot@buildstream.build> | 2020-05-11 16:27:12 +0000 |
commit | db2039fe2f333bc33342b4168910b7ed0a626bbd (patch) | |
tree | 388347936e06e19b8e93941b38046f456e4ee733 /src | |
parent | 8797ab18b5fe247fcf1409e1bde4dfe0037149eb (diff) | |
download | buildstream-db2039fe2f333bc33342b4168910b7ed0a626bbd.tar.gz |
lint: Stop using mutable objects for default arguments
Diffstat (limited to 'src')
-rw-r--r-- | src/buildstream/_gitsourcebase.py | 4 | ||||
-rw-r--r-- | src/buildstream/_includes.py | 9 | ||||
-rw-r--r-- | src/buildstream/testing/_utils/junction.py | 2 |
3 files changed, 9 insertions, 6 deletions
diff --git a/src/buildstream/_gitsourcebase.py b/src/buildstream/_gitsourcebase.py index 1f74bb972..e3b246677 100644 --- a/src/buildstream/_gitsourcebase.py +++ b/src/buildstream/_gitsourcebase.py @@ -70,14 +70,14 @@ def _strip_tag(rev): # tags (list): Tag configuration; see _GitSourceBase._load_tags # class _GitMirror(SourceFetcher): - def __init__(self, source, path, url, ref, *, primary=False, tags=[]): + def __init__(self, source, path, url, ref, *, primary=False, tags=None): super().__init__() self.source = source self.path = path self.url = url self.ref = ref - self.tags = tags + self.tags = tags or [] self.primary = primary self.mirror = os.path.join(source.get_mirror_directory(), utils.url_directory_name(url)) diff --git a/src/buildstream/_includes.py b/src/buildstream/_includes.py index b9a1c0d22..2ecb70a31 100644 --- a/src/buildstream/_includes.py +++ b/src/buildstream/_includes.py @@ -42,7 +42,7 @@ class Includes: # current_loader (Loader): Use alternative loader (for junction files) # only_local (bool): Whether to ignore junction files # process_project_options (bool): Whether to process options from current project - def _process(self, node, *, included=set(), current_loader=None, only_local=False, process_project_options=True): + def _process(self, node, *, included=None, current_loader=None, only_local=False, process_project_options=True): if current_loader is None: current_loader = self._loader @@ -69,8 +69,11 @@ class Includes: # only_local (bool): Whether to ignore junction files # process_project_options (bool): Whether to process options from current project def _process_node( - self, node, *, included=set(), current_loader=None, only_local=False, process_project_options=True + self, node, *, included=None, current_loader=None, only_local=False, process_project_options=True ): + if included is None: + included = set() + includes_node = node.get_node("(@)", allowed_types=[ScalarNode, SequenceNode], allow_none=True) if includes_node: @@ -172,7 +175,7 @@ class Includes: # only_local (bool): Whether to ignore junction files # process_project_options (bool): Whether to process options from current project def _process_value( - self, value, *, included=set(), current_loader=None, only_local=False, process_project_options=True + self, value, *, included=None, current_loader=None, only_local=False, process_project_options=True ): value_type = type(value) diff --git a/src/buildstream/testing/_utils/junction.py b/src/buildstream/testing/_utils/junction.py index 6f45ad590..8f80ed6bd 100644 --- a/src/buildstream/testing/_utils/junction.py +++ b/src/buildstream/testing/_utils/junction.py @@ -19,7 +19,7 @@ from .site import HAVE_GIT, GIT, GIT_ENV # Returns: # (str): The ref # -def generate_junction(tmpdir, subproject_path, junction_path, *, store_ref=True, options={}): +def generate_junction(tmpdir, subproject_path, junction_path, *, store_ref=True, options=None): # Create a repo to hold the subproject and generate # a junction element for it # |