Metadata-Version: 2.1
Name: pmast
Version: 0.1.1
Summary: Pattern Matching for the Python AST
Home-page: https://github.com/campadrenalin/pmast
Author: Philip Horger
Author-email: campadrenalin@gmail.com
License: MIT
Platform: UNKNOWN
Classifier: License :: OSI Approved :: MIT License
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Operating System :: OS Independent
Description-Content-Type: text/markdown

# 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.

```python
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.


