Pattern Matcher for Python AST
This tool is about finding patterns in AST structures. As such, it may be useful for static analysis and linting.
import pmast
pm = pmast.PatternDispatch()
@pm('FunctionDef.Return')
def on_return(data, fd, ret):
# Store return statement (an ast node) for each function
data[fd.name] = ret
class Foo(object):
def x(self):
return 3
def y(self, foo, bar):
return 4
data = pm.dispatch(Foo)
assert data['x'].value.n == 3
assert data['y'].value.n == 4
The intent here is to be a little bit like XPath for the Python AST module.
Metadata
Release files for pmast 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pmast-0.1.1.tar.gz | 2.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pmast-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 5.8 kB
Release files / pmast-0.1.1.tar.gz
| Download URL | pmast-0.1.1.tar.gz |
|---|---|
| Size | 2.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3a32a5543d255b3498de675c05be96b445859a759af02e39002ae7c5f19803a3
|
|
BLAKE2b-256 checksum How to use checksums |
6e539fe26bf5a0076d2c7501af89a206e24abe74d2e8a7dad78e56407fe9e416
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.1
|
Release files / pmast-0.1.1-py3-none-any.whl
| Download URL | pmast-0.1.1-py3-none-any.whl |
|---|---|
| Size | 3.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
031ac64e3ab6dbc0c5693c591cb9a4b7c6e0f5faa0289e5a9897525df1dab3c4
|
|
BLAKE2b-256 checksum How to use checksums |
5aea6343f8c2e0ee30a2ff07dd18143775b139c24ff9dd35f37999456c451dcf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.1
|