Skip to main content

This package provides a module-level source-code generator which operates on the AST from the built-in compiler.ast module.

Note that this AST is not compatible with the new ast module in Python 2.6.

Usage

The generator works on AST parse trees.

>>> from compiler import parse
>>> tree = parse("""\
...     print 'Hello, world!'
... """)

We can now generate Python-code equivalent to the original using the source-code generator.

>>> from sourcecodegen import ModuleSourceCodeGenerator
>>> generator = ModuleSourceCodeGenerator(tree)
>>> print generator.getSourceCode()
print 'Hello, world!'

Author

Malthe Borch <mborch@gmail.com>

Download files

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

Source Distribution

sourcecodegen-0.4.tar.gz (10.0 kB view details)

Uploaded Source

File details

Details for the file sourcecodegen-0.4.tar.gz.

File metadata

  • Download URL: sourcecodegen-0.4.tar.gz
  • Upload date:
  • Size: 10.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for sourcecodegen-0.4.tar.gz
Algorithm Hash digest
SHA256 4f33036fadce541d8a74434305c7be452394ed502f4be1e8c6c30bd3bcd3761b
MD5 2db0aafa509d3f4591792acbdc5c2525
BLAKE2b-256 a9c162acaa2cd85e62fc16ead1953234a6d281e2bc87826dfaa99e00d5c6babc

See more details on using hashes here.

Release history Release notifications | RSS feed

0.6.14

1 file

0.6.13

1 file

0.6.12

1 file

0.6.11

1 file

0.6.10

1 file

0.6.9

1 file

0.6.8

1 file

0.6.7

1 file

0.6.6

1 file

0.6.5

1 file

0.6.4

1 file

0.6.3

1 file

0.6.2

1 file

0.6.1

1 file

0.6

1 file

0.5

1 file

This release

0.4 This release

1 file

0.3

1 file

0.2

1 file

0.1

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page