Make sure that the definition order in stubs are ignored

This commit is contained in:
Dave Halter
2019-12-15 18:41:37 +01:00
parent 9d35adda02
commit 38eb2c9ba3
3 changed files with 34 additions and 0 deletions

View File

@@ -51,6 +51,16 @@ class StubModuleValue(ModuleValue):
for f in filters:
yield f
def _as_context(self):
return StubModuleContext(self)
class StubModuleContext(ModuleContext):
def get_filters(self, until_position=None, origin_scope=None):
# Make sure to ignore the position, because positions are not relevant
# for stubs.
return super(StubModuleContext, self).get_filters(origin_scope=origin_scope)
class TypingModuleWrapper(StubModuleValue):
def get_filters(self, *args, **kwargs):