Skip to main content

Collect top level variable names using the ast.

Project description

ast_names

Collect top level variable names using the ast.

Installation

pip install ast_names

Usage

>>> from ast_names import ast_names
>>> ast_names("""
... import sys, os
... import sys as foo
...
... from foo import (
...     bar as baz,
...     alpha
... )
...
... MYCONSTANT = 1
...
... def my_func():
...     ...
...
... class MyClass:
...     ...
... """)
{'os', 'MYCONSTANT', 'alpha', 'baz', 'foo', 'sys', 'MyClass', 'my_func'}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ast_names-0.1.0.tar.gz (3.0 kB view hashes)

Uploaded Source

Built Distribution

ast_names-0.1.0-py2.py3-none-any.whl (3.5 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page