1.1 --- a/branching.py Mon Oct 17 15:39:07 2016 +0200
1.2 +++ b/branching.py Mon Oct 17 18:56:34 2016 +0200
1.3 @@ -77,15 +77,17 @@
1.4 else:
1.5 return [b for b in self.get_all_suppliers(name) if name in b.assignments]
1.6
1.7 - def set_usage(self, name, attrname, invocation=False):
1.8 + def set_usage(self, name, attrname, invocation=False, assignment=False):
1.9
1.10 """
1.11 Record usage on the given 'name' of the attribute 'attrname', noting the
1.12 - invocation of the attribute if 'invocation' is set to a true value.
1.13 + invocation of the attribute if 'invocation' is set to a true value, or
1.14 + noting the assignment of the attribute if 'assignment' is set to a true
1.15 + value.
1.16 """
1.17
1.18 if self.usage.has_key(name):
1.19 - self.usage[name].add((attrname, invocation))
1.20 + self.usage[name].add((attrname, invocation, assignment))
1.21
1.22 def get_usage(self):
1.23
1.24 @@ -483,12 +485,13 @@
1.25
1.26 return branch
1.27
1.28 - def use_attribute(self, name, attrname, invocation=False):
1.29 + def use_attribute(self, name, attrname, invocation=False, assignment=False):
1.30
1.31 """
1.32 Indicate the use on the given 'name' of an attribute with the given
1.33 'attrname', optionally involving an invocation of the attribute if
1.34 - 'invocation' is set to a true value.
1.35 + 'invocation' is set to a true value, or involving an assignment of the
1.36 + attribute if 'assignment' is set to a true value.
1.37
1.38 Return all branches that support 'name'.
1.39 """
1.40 @@ -499,7 +502,7 @@
1.41
1.42 if branches.has_key(name):
1.43 for branch in branches[name]:
1.44 - branch.set_usage(name, attrname, invocation)
1.45 + branch.set_usage(name, attrname, invocation, assignment)
1.46 return branches[name]
1.47 else:
1.48 return None