Skip to main content

Uast, user abstract syntax tree, is a

Project description

Uast

Uast, User friendly Abstract Syntax Tree, is a wrapper of the python module AST. It provides an user friendly interface to work with abstract syntax tree.

Quickstart

To install Sequentium, use the following command:

pip install sequentium

Suppose that you want really to know what is contained in the script: example/example_1.py, but you don't want to open it because it is too big and so complicated. You can just print a schema of its structure to have an ideas what is going on:

import uast

parsed_script = uast.parse(source='example/example_1.py')
print(parsed_script.schema())

Quick start

Uast permits to past entire scripts or just Python syntax

Parse a script

Parse a Python Snippet

Suppose we have the following python snippet of code

example = """
class User:

    def __init__(self, username: str, password: str):
        username = self.username
        password = self.password

    def check_password(self) -> bool:
        self.password == 'foo'
"""

We can parse it using the following

import uast

parsed_code = uast.parse(example)

Command line interface

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

uast-0.0.0.tar.gz (14.9 kB view hashes)

Uploaded Source

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