Public interface to top-level pytype functions.
Class |
|
Preserve all state and results from running pytype. |
Function | check |
Returns results from running pytype. |
Function | check |
Check the types of a string of source code. |
Function | generate |
Run the inferencer on a string of source code, producing output. |
Function | get |
Undocumented |
Function | handle |
Handle the errorlog according to the given options. |
Function | parse |
Tries parsing a PYI file. |
Function | print |
Undocumented |
Function | process |
Check a .py file or generate a .pyi for it, according to options. |
Function | read |
Undocumented |
Function | wrap |
Catch pytype errors and reraise them as a single exception type. |
Function | write |
Dump a pickle of the ast to a file. |
Constant | ERROR |
Undocumented |
Variable | log |
Undocumented |
Function | _call |
Helper function to call analyze.check/infer_types. |
Function | _set |
Decorator to set the verbosity for a function that takes an options arg. |
Function | _write |
Undocumented |
def check_or_generate_pyi(options, loader=None, ctx=None) ->
AnalysisResult
:
(source)
¶
Returns results from running pytype. Args: options: config.Options object. loader: load_pytd.Loader object. ctx: A context Returns: A tuple, (errors.ErrorLog, PYI Ast as string or None, AST or None).
Run the inferencer on a string of source code, producing output. Args: src: The source code. options: config.Options object. loader: A load_pytd.Loader instance. ctx: A context Returns: A tuple, (errors.ErrorLog, PYI Ast as string, TypeDeclUnit). Raises: CompileError: If we couldn't parse the input file. UsageError: If the input filepath is invalid.
Check a .py file or generate a .pyi for it, according to options. Args: options: config.Options object. Returns: An error code (0 means no error).
Catch pytype errors and reraise them as a single exception type. NOTE: This will also wrap non-pytype errors thrown within the body of the code block; it is therefore recommended to use this to wrap a single function call. Args: exception_type: The class to wrap exceptions in. filename: A filename to use in error messages. Yields: nothing, just calls the code block.
def _call(analyze_types, src, options, loader, *, ctx=None): (source) ¶
Helper function to call analyze.check/infer_types.