1.1 --- a/deducer.py Thu Oct 13 23:27:17 2016 +0200
1.2 +++ b/deducer.py Fri Oct 14 18:34:14 2016 +0200
1.3 @@ -399,13 +399,14 @@
1.4 locations.sort()
1.5
1.6 for location in locations:
1.7 - name, test, test_type, base, traversed, attrnames, context, \
1.8 + name, test, test_type, base, traversed, traversal_modes, attrnames, context, \
1.9 first_method, final_method, attr = self.access_plans[location]
1.10
1.11 print >>f_attrs, encode_access_location(location), \
1.12 name, test, test_type or "{}", \
1.13 base or "{}", \
1.14 ".".join(traversed) or "{}", \
1.15 + ".".join(traversal_modes) or "{}", \
1.16 ".".join(attrnames) or "{}", \
1.17 context, first_method, final_method, attr or "{}"
1.18
1.19 @@ -1854,13 +1855,18 @@
1.20 dynamic_base = ref.get_origin()
1.21
1.22 traversed = []
1.23 + traversal_modes = []
1.24 + provider_kind = first(provider_kinds)
1.25
1.26 # Traverse remaining attributes.
1.27
1.28 while len(attrs) == 1:
1.29 attr = first(attrs)
1.30 + accessor_kind = attr.get_kind()
1.31
1.32 traversed.append(attrname)
1.33 + traversal_modes.append(accessor_kind == provider_kind and "object" or "class")
1.34 +
1.35 del remaining[0]
1.36
1.37 if not remaining:
1.38 @@ -1871,11 +1877,13 @@
1.39 if attr.static():
1.40 base = attr.get_origin()
1.41 traversed = []
1.42 + traversal_modes = []
1.43
1.44 # Get the next attribute.
1.45
1.46 attrname = remaining[0]
1.47 attrs = self.importer.get_attributes(attr, attrname)
1.48 + provider_kind = self.importer.get_attribute_provider(attr, attrname)
1.49
1.50 # Where many attributes are suggested, no single attribute identity can
1.51 # be loaded.
1.52 @@ -1916,6 +1924,6 @@
1.53
1.54 context = len(traversed or remaining) == 1 and (base and "base" or "original-accessor") or "final-accessor"
1.55
1.56 - return name, test, test_type, base, traversed, remaining, context, first_method, final_method, origin
1.57 + return name, test, test_type, base, traversed, traversal_modes, remaining, context, first_method, final_method, origin
1.58
1.59 # vim: tabstop=4 expandtab shiftwidth=4