typeshed_client
typeshed_client copied to clipboard
get_fully_qualified_name doesn't work for nested classes
For example,
import typeshed_client
resolver = typeshed_client.Resolver()
resolver.get_fully_qualified_name('imaplib.IMAP4')
works but
resolver.get_fully_qualified_name('imaplib.IMAP4.readonly')
does not. It's possible this is intended behavior, since you can get the definition for the imaplib.IMAP4.readonly
class with
resolver.get_fully_qualified_name('imaplib.IMAP4').child_nodes['readonly']
but this behavior is unintuitive to me (why should it matter whether the class is nested or not?), so if it is by design then it would be helpful to add a note to the documentation saying get_fully_qualified_name
only works for top-level names.
(In fact it would be nice if get_fully_qualified_name
worked for methods, etc. too so that anything defined in typeshed
could be looked up directly without having to sometimes traverse through child_nodes
. For example one could write get_fully_qualified_name(f'{func.__module__}.{func.__qualname__}')
to see if there is a definition for a function or method func
. If there's interest in that I can try to put together a PR.)