缩小python 2模块
liquif的Python项目详细描述
liquen后面的python 2迷你者 几乎完全基于gareth rees的minipy<;http://garethrees.org/>;
简介
liquify是python 2的一个小型化工具,主要用于维护小型化代码作为导入模块的可用性(这意味着它保留了可能用于调用小型化代码的外部代码的函数和变量)。例如:
$ cat fib.py cache = {0: 0, 1: 1, 2: 1, 3: 2} def fibonacci(n): """Return the nth Fibonacci number.""" if n not in cache: a = n // 2 r = n % 2 m = (r * 2) - 1 cache[n] = fibonacci(a + 1) ** 2 + m * fibonacci(a + r - 1) ** 2 return cache[n] $ liquify --module --docstrings fib.py cache={0:0,1:1,2:1,3:2} def fibonnacci(a): if a not in b:d=a//2;e=a%2;f=e*2-1;b[a]=fibonnacci(d+1)**2+f*c(d+e-1)**2 return b[a]
命令行
Usage: liquify [options] [-o OUTPUT] FILE Options: --version show program's version number and exit -h, --help show this help message and exit -o OUTPUT, --output=OUTPUT output file (default: stdout) -D, --docstrings remove docstrings and other statements with no side effects (implies --noselftest) -R, --rename aggressively rename non-preserved variables -i INDENT, --indent=INDENT number of spaces per indentation level -p PRESERVE, --preserve=PRESERVE preserve words from renaming (separate by commas) -m, --module preserve top level object names (for use as imported --nojoinlines put each statement on its own line --noselftest skip the self-test --debug dump the parse tree
许可证
Liquify是免费软件:您可以在 自由党公布的GNU通用公共许可条款 软件基础,许可证的版本3,或者 选项)任何更高版本。
这个程序的发布是希望它会有用,但是 没有任何保证;甚至没有 适销性或适合某一特定目的的适销性。有关详细信息,请参见GNU General Public License。