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

Uploaded Source

Built Distribution

nr.pylang.ast-0.0.3-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nr.pylang.ast-0.0.3.tar.gz
  • Upload date:
  • Size: 6.4 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.3.tar.gz
Algorithm Hash digest
SHA256 c390d1b41a8d469923febb926a3784f77b8be0fc7d2ec788d88f71cbd628f9dc
MD5 6674db1a7d674bbff2910581ad5e30a1
BLAKE2b-256 9a73ad9ee7d6103e455905841ad1452928b5d966709191d17a21aa656ecd9c0f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nr.pylang.ast-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 8.0 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 31190d303605571c27a6103c7af42a864839e24bcf114760e72d27255cc8cf70
MD5 94e8b05a2bf78e442f7af024cb271dcf
BLAKE2b-256 2c7fd4b8d11266e3c7b21ef383d6bbfaae293e798ebf0de01ae64769df565753

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