Skip to main content

Package description here.

Project description

Note: This package is in the dangerous land of 0.x.y versions and may be subject to breaking changes with minor version increments.

nr.pylang.ast

This package provides tools for processing the AST as generated by the Python ast module.

Module: dynamic_eval

This module provides an AST rewriter that takes and Read/Write operations on global variables and rewrites them to retrieve the variable by a function instead. Non-global variables are left untouched.

Example:

import os
from os import path

parent_dir = path.dirname(__file__)

def main():
  filename = path.join(parent_dir, 'foo.py')
  print(filename)

Will be converted to:

import os; __dict__['os'] = os
from os import path; __dict__['path'] = path

__dict__['parent_dir'] = __dict__['path'].dirname(__dict__['__file__'])

def main():
  filename = __dict__['path'].join(__dict__['parent_dir'], 'foo.py')
  __dict__['print'](filename)

Copyright © 2020 Niklas Rosenstein

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

nr.pylang.ast-0.0.4.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

nr.pylang.ast-0.0.4-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file nr.pylang.ast-0.0.4.tar.gz.

File metadata

  • Download URL: nr.pylang.ast-0.0.4.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.7.3

File hashes

Hashes for nr.pylang.ast-0.0.4.tar.gz
Algorithm Hash digest
SHA256 71a02079adc3dd90421ffb1824f741180c456cbb43cbe00e1519313405cf1511
MD5 2ac272878c1d23819d1a357d93d72278
BLAKE2b-256 9e01a8cba552117027b37dedefbacf12d394d5ed99347b2dbafe4e80481ff359

See more details on using hashes here.

File details

Details for the file nr.pylang.ast-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: nr.pylang.ast-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.7.3

File hashes

Hashes for nr.pylang.ast-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 772af95e8b8fafd40e24f78d3ff0b10d3f487119aae4e92c3d7b79aa3420e904
MD5 85370ddb4e439579c63953e4f9c08ae6
BLAKE2b-256 5ba88544b80ddbf71753f9d0a51873f1146a28703b97ef9ba306b7548752bf1e

See more details on using hashes here.

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