tdfs4ds.api_usage¶
tdfs4ds.api_usage
¶
Static check of a project's tdfs4ds calls against the installed tdfs4ds.
check_api_usage(paths) reads .py files and the code cells of .ipynb
notebooks, finds every call on tdfs4ds (tdfs4ds.x(...), tdfs4ds.a.b(...),
import tdfs4ds as fs, from tdfs4ds.x import y) and reports the names that do
not exist and the keyword arguments the function does not take. Nothing is run:
the code is parsed, and only tdfs4ds itself is imported to resolve the names.
The same functions check the package's own skills (tests/test_skills_consistency.py):
one rule for "does this call match tdfs4ds".
__all__
module-attribute
¶
resolve_dotted
¶
The object a dotted name designates (longest importable module, then attributes). Raises AttributeError / ImportError when it does not exist.
calls_in_tree
¶
(dotted target, ast.Call) for every call on module or on a name imported from it.
call_problems
¶
What is wrong with one call: an unknown name, or keywords the function does not take.
_sources
¶
(cell index or None, source) of a .py file or of a notebook's code cells.
check_api_usage
¶
Every tdfs4ds call in paths (files or folders of .py / .ipynb) that does
not match the installed tdfs4ds.
Returns rows {file, cell, line, name, problem} (cell = the notebook cell
index, None for a .py file). An empty list means every call resolved and every
keyword exists. A file that cannot be read or parsed gives one row with the reason;
nothing raises. Lines starting with % or ! (notebook magics) are ignored.