Skip to content

Conversation

@sobolevn
Copy link
Member

@sobolevn sobolevn commented Aug 6, 2022

There was a TODO item for this.
My solution is not 100% complete, but it is something.
Getting path from FuncDef / etc is pretty hard.

Showcase:
Снимок экрана 2022-08-06 в 11 39 36
Снимок экрана 2022-08-06 в 11 36 57

# TODO: find out how we can get filenames from other nodes:
if isinstance(self.stub_object, nodes.TypeInfo):
stub_file = os.path.abspath(
self.stub_object.module_name.replace(".", os.path.sep) + ".pyi"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might not be accurate. Sometimes stubtest's definitions come from .py files (e.g. with packages that have mixed inline types and stubs). While it's rare for such definitions to be involved in errors, it's possible, and it would be very confusing if we lied.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's also not necessarily the case that the stubs are relative to the current directory. They could be installed

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, this is more complex than I thought!

@hauntsaninja
Copy link
Collaborator

Alternative PR: #13342

@sobolevn sobolevn closed this Aug 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants