Skip to content

nvbn/__transformers__

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Experimental module for AST transformations

Install

pip install git+https://github.com/nvbn/__transformers__

Usage

Available transformations:

  • ellipsis_partialmap(lambda x: x + 1, ...) to lambda y: map(lambda x: x + 1, y);
  • matmul_pipe"hello world" @ print to print("hello world").

Enable transformations in code:

from __transformers__ import ellipsis_partial, matmul_pipe
  
range(10) @ map(lambda x: x ** 2, ...) @ list @ print 

Run code with transformations:

➜ python -m __transformers__ -m python_module   
[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]

➜ python -m __transformers__ python/module/path.py                 
[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]

Manually enable transformations from code:

from __transformers__ import setup

setup()

import module_that_use_transformers

Rationale

License MIT

About

Experimental module for AST transformations

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages