summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngelos Evripiotis <jevripiotis@bloomberg.net>2019-03-12 17:27:22 +0000
committerJürg Billeter <j@bitron.ch>2019-03-14 16:21:43 +0000
commit499f6115fffbca18bb18dd1ab937872904aac56f (patch)
treebfd7daa104353d759a452de052ed9de9a3b0ae06
parentd8fc3e8f6e3d20860d71eb847a05ed795c46e935 (diff)
downloadbuildstream-499f6115fffbca18bb18dd1ab937872904aac56f.tar.gz
element.py: remove redundant `__defaults_set`
Use the conventional `None` value to indicate that the class variable `__defaults` is not yet initialized. This lets us remove `__defaults_set`.
-rw-r--r--buildstream/element.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/buildstream/element.py b/buildstream/element.py
index 5d1f0622b..9ec65edaa 100644
--- a/buildstream/element.py
+++ b/buildstream/element.py
@@ -132,8 +132,7 @@ class Element(Plugin):
All elements derive from this class, this interface defines how
the core will be interacting with Elements.
"""
- __defaults = {} # The defaults from the yaml file and project
- __defaults_set = False # Flag, in case there are no defaults at all
+ __defaults = None # The defaults from the yaml file and project
__instantiated_elements = {} # A hash of Element by MetaElement
__redundant_source_refs = [] # A list of (source, ref) tuples which were redundantly specified
@@ -2371,7 +2370,7 @@ class Element(Plugin):
def __init_defaults(self, plugin_conf):
# Defaults are loaded once per class and then reused
#
- if not self.__defaults_set:
+ if self.__defaults is None:
defaults = {}
if plugin_conf is not None:
@@ -2399,7 +2398,6 @@ class Element(Plugin):
# Set the data class wide
type(self).__defaults = defaults
- type(self).__defaults_set = True
# This will resolve the final environment to be used when
# creating sandboxes for this element