1.1 --- a/common.py Sat Oct 08 00:33:32 2016 +0200
1.2 +++ b/common.py Sat Oct 08 00:34:34 2016 +0200
1.3 @@ -811,6 +811,21 @@
1.4 else:
1.5 return "%s.%s" % (path, name)
1.6
1.7 +# Type deduction for usage.
1.8 +
1.9 +def get_types_for_usage(attrnames, objects):
1.10 +
1.11 + """
1.12 + Identify the types that can support the given 'attrnames', using the
1.13 + given 'objects' as the catalogue of type details.
1.14 + """
1.15 +
1.16 + types = []
1.17 + for name, _attrnames in objects.items():
1.18 + if set(attrnames).issubset(_attrnames):
1.19 + types.append(name)
1.20 + return types
1.21 +
1.22 # Useful data.
1.23
1.24 predefined_constants = "False", "None", "NotImplemented", "True"
2.1 --- a/deducer.py Sat Oct 08 00:33:32 2016 +0200
2.2 +++ b/deducer.py Sat Oct 08 00:34:34 2016 +0200
2.3 @@ -969,21 +969,6 @@
2.4 else:
2.5 return module_types
2.6
2.7 - # Type deduction for usage.
2.8 -
2.9 - def get_types_for_usage(self, attrnames, objects):
2.10 -
2.11 - """
2.12 - Identify the types that can support the given 'attrnames', using the
2.13 - given 'objects' as the catalogue of type details.
2.14 - """
2.15 -
2.16 - types = []
2.17 - for name, _attrnames in objects.items():
2.18 - if set(attrnames).issubset(_attrnames):
2.19 - types.append(name)
2.20 - return types
2.21 -
2.22 # More efficient usage-to-type indexing and retrieval.
2.23
2.24 def init_attr_type_indexes(self):