-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add public variables #5
Conversation
scripts/collect_public_variables..py
Outdated
attr_of_instance = getattr(instance, class_attr_name) | ||
if attr_of_instance == None: | ||
continue | ||
typename = attr_of_instance.__class__.__name__ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can do something like this to extend the types with modules:
typename = attr_of_instance.__class__.__name__
modulename = attr_of_instance.__class__.__module__
if modulename != "builtins":
typename = f'{modulename}.{typename}'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting, I did not know about that one. It will solve several cases, but not nested class. So, all enums can not be typed for example, because they always lie within another class.
Still, it's better than nothing, I'll have an attempt at it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe using __class__.__qualname__
could solve this problem?
Hi folks, I'm interested in this changes. I have done some of it manually in a stubs folder in my own project, but I would love to see this merged. I don't know much about |
Hey @kaofelix, I have submitted PR #6 which, I believe, solves the remaining issues. Maybe @bluebird75 or @altendky could take a look and both PRs could be merged! |
Annotate public variables with qualified names and modules
Thanks @boldar99 . This looks much better |
Attempt to add public variables