# HG changeset patch # User Paul Boddie # Date 1478818549 -3600 # Node ID ef09cc743496c527c82bfd455ff0cfb6390ef662 # Parent d1d5987e9261e4a581b73020f2e963b28af4ac5f Where references do not provide definitive origin details, introduce a requirement for each module directly providing such references. diff -r d1d5987e9261 -r ef09cc743496 importer.py --- a/importer.py Thu Nov 10 23:27:13 2016 +0100 +++ b/importer.py Thu Nov 10 23:55:49 2016 +0100 @@ -410,11 +410,14 @@ # Record the resolved names and identify required modules. else: + # Find the providing module of this reference. + # Where definitive details of the origin cannot be found, + # identify the provider using the deferred reference. + # NOTE: This may need to test for static origins. + + provider = self.get_module_provider(found.unresolved() and ref or found) ref.mutate(found) - # Find the providing module of this reference. - - provider = self.get_module_provider(ref) if provider: module.required.add(provider) diff -r d1d5987e9261 -r ef09cc743496 referencing.py --- a/referencing.py Thu Nov 10 23:27:13 2016 +0100 +++ b/referencing.py Thu Nov 10 23:55:49 2016 +0100 @@ -90,7 +90,8 @@ """ Return whether the reference describes an object from the given 'kinds', where such kinds may be "", "", "", - "" or "". + "" or "". Unresolved references may also have kinds of + "" and "". """ if not isinstance(kinds, (list, tuple)): @@ -103,6 +104,12 @@ return self.get_origin().split(".") + def unresolved(self): + + "Return whether this reference is unresolved." + + return self.has_kind(["", ""]) + def static(self): "Return this reference if it refers to a static object, None otherwise."