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.5.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: nr.pylang.ast-0.0.5.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.5.tar.gz
Algorithm Hash digest
SHA256 f0dc2a81cd3e08aa4349e7ab16a4945e7bd83acf961201f438bfabe7fbec9a3d
MD5 9bc3583c46f08a6ec6fb6c6fcc3c9f11
BLAKE2b-256 812d81403b158e39addf57a817740da5d1b9a41a55ee479bc2a35927c97de6be

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nr.pylang.ast-0.0.5-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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 a1a39380d88fab2c2a2bb816415df2afcb0b2d0bda2574af935c54a3e96264a5
MD5 4f008e3974fcb316e97ae7caa2f7508d
BLAKE2b-256 50f1ec7e550617dada84f2d19c85b4cdb5e6c7b37bb316bd0024895eafc2dceb

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