# HG changeset patch # User Paul Boddie # Date 1475879674 -7200 # Node ID c7d3a8bf2cdc2923a60b27d16da56a74431903a0 # Parent 674502205b57c4c4861326cd6550a68c82c36521 Moved a generic method into the common module as a function. diff -r 674502205b57 -r c7d3a8bf2cdc common.py --- a/common.py Sat Oct 08 00:33:32 2016 +0200 +++ b/common.py Sat Oct 08 00:34:34 2016 +0200 @@ -811,6 +811,21 @@ else: return "%s.%s" % (path, name) +# Type deduction for usage. + +def get_types_for_usage(attrnames, objects): + + """ + Identify the types that can support the given 'attrnames', using the + given 'objects' as the catalogue of type details. + """ + + types = [] + for name, _attrnames in objects.items(): + if set(attrnames).issubset(_attrnames): + types.append(name) + return types + # Useful data. predefined_constants = "False", "None", "NotImplemented", "True" diff -r 674502205b57 -r c7d3a8bf2cdc deducer.py --- a/deducer.py Sat Oct 08 00:33:32 2016 +0200 +++ b/deducer.py Sat Oct 08 00:34:34 2016 +0200 @@ -969,21 +969,6 @@ else: return module_types - # Type deduction for usage. - - def get_types_for_usage(self, attrnames, objects): - - """ - Identify the types that can support the given 'attrnames', using the - given 'objects' as the catalogue of type details. - """ - - types = [] - for name, _attrnames in objects.items(): - if set(attrnames).issubset(_attrnames): - types.append(name) - return types - # More efficient usage-to-type indexing and retrieval. def init_attr_type_indexes(self):