astvalidate
A series of AST validators for validating the integrity of the given abstract syntax tree.
API
validate(tree: ast.Module, level: Optional[Literal[1, 2, 3]] = None) -> bool
tree is the AST object that you want to verify. level is an argument to pass the
level of strictness, and turn on/off some of the validators. For a detailed list of validators,
see the table below:
| Validator | Level | Description |
|---|---|---|
| Syntatical | 1 | Emulates syntax warnings that are normally generated by compiler. |
| Simple | 1 | Does simple verifications, similar to PyAST_Validate interface |
| Symbolic | 2 | Emulates syntax error that are normally generated by symbol table |
| Contextual | 3 | Ensures everything is in the right context. |
If there are any errors, validate() will raise a SyntaxError or issue SyntaxWarnings
on the location of the target node.
import ast
import astvalidate
tree = ast.parse("""
def func():
raise ValueError from something
""")
tree.body[0].body[0].exc = None
assert astvalidate.validate(tree)
File "<string>", line 3
SyntaxError: Raise's cause can't be used without setting an exception
Metadata
Release files for astvalidate 2021.12.31
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| astvalidate-2021.12.31.tar.gz | 8.5 kB | Without provenance | Details for astvalidate-2021.12.31.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| astvalidate-2021.12.31-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for astvalidate-2021.12.31-py2.py3-none-any.whl |
Total release size: 19.2 kB
Release files / astvalidate-2021.12.31.tar.gz
| Download URL | astvalidate-2021.12.31.tar.gz |
|---|---|
| Size | 8.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
20a1d5714310b08260f7ce2451ab260b420d318de1f9dc2e15cbcd7862643d54
|
|
BLAKE2b-256 checksum How to use checksums |
c5179fd02437622bfcf546e528ac729f735df46463c9c008636131c8f573b0e5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
|
Release files / astvalidate-2021.12.31-py2.py3-none-any.whl
| Download URL | astvalidate-2021.12.31-py2.py3-none-any.whl |
|---|---|
| Size | 10.7 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
158cdb44b8af69fdd0b61dd1b84755196c79d9863f43daed69c81fcd9326d0f0
|
|
BLAKE2b-256 checksum How to use checksums |
fecbb4396dfaac87feb567f1d5cdeeb8ea5f1062c9d0d381f68c09d432534726
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
|
Security for astvalidate 2021.12.31
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.