1
0
forked from VimPlug/jedi

Make version_info understandable so it can be used in for typeshed

This commit is contained in:
Dave Halter
2018-10-30 23:31:57 +01:00
parent 3581ce7059
commit f2d67f4a5d
2 changed files with 37 additions and 0 deletions

View File

@@ -219,9 +219,16 @@ class NameWithStubMixin(object):
yield actual_context
class VersionInfo(ContextWrapper):
pass
class StubOnlyName(TreeNameDefinition):
def infer(self):
inferred = super(StubOnlyName, self).infer()
if self.string_name == 'version_info' and self.get_root_context().py__name__() == 'sys':
return [VersionInfo(c) for c in inferred]
return [
StubOnlyClass.create_cached(c.evaluator, c) if isinstance(c, ClassContext) else c
for c in inferred