data-apis / python-record-api

Inferring Python API signatures from tracing usage.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Put types in parent modules

saulshanabrook opened this issue · comments

Currently, we list the type where an object is defined as its module. However, many libraries define types in some sub-module but only expose them in a parent module.

So instead, when recording a type, we should look in all parent modules to see if they export this same type. If so, we should use that as the module name instead of where it is created.

Actually we should do this by relying on return type of getattr on modules... If we see a downstream thing getting an attribute of a module, that will be where the class is from!