I was thinking of working on a tool which interacts with Astroid's type
inference capabilities. It would either get the type hints of parameters
through function annotations or from @param tags in docstrings. This would
help create warnings where the parameter or something which uses it is
being used in an unexpected way, inconsistent with documentation.
I was wondering if there is any machine-readable information about what
types functions in the standard library expect? For example, PyCharm seems
to know that os.path.split cannot return a tuple of three values, so
x, y, z = os.path.split("a/path/here")
causes the IDE warning "needs more values to unpack". When I jump to the
documentation it's described like this:
def split(p) Inferred type: (p: one of (str, unicode)) -> (one of (str,
unicode, unknown),one of (str, unicode, unknown))
Split a pathname. Returns tuple "(head, tail)" where "tail" is
everything after the final slash. Either part may be empty.
Did JetBrains (who make PyCharm) gather this information themselves, or is
this kind of thing publicly available somewhere?
Thanks for your help,