easysun / zhpy Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/zhpy
Automatically exported from code.google.com/p/zhpy
add Simplified Chinese documents
Original issue reported on code.google.com by gasolin
on 20 Aug 2007 at 3:11
轉換內建的異常類型如 ImportError 等.
Original issue reported on code.google.com by gasolin
on 11 Aug 2007 at 2:14
support python 3000 while it's ready
Original issue reported on code.google.com by gasolin
on 3 Sep 2007 at 2:39
What steps will reproduce the problem?
1. In a directory without any .ini file. Prepare a test.py file.
2. zhpy --cn test.py -v
3. New a abc.ini file. No matter what content inside.
4. zhpy --cn test.py -v
Step 2 works fine. Step 4 has problems.
cnpy
file abc.ini
zhpy Exception: you may input unproper source
global name 'ConfigParser' is not defined
What version of the product are you using? On what operating system?
winxp sp2, python 2.5.1, zhpy1.1
Please provide any additional information below.
Not tested if the plugin extend dict has the same problem or not.
Original issue reported on code.google.com by [email protected]
on 10 Oct 2007 at 7:42
注意到当前zhpy 的配置文件还是 .ini 格式,
建议使用原生的.py 作为配置,减少解析过程,易于扩展
Original issue reported on code.google.com by Zoom.Quiet
on 10 Aug 2007 at 2:03
add zhimport to support zhpy module
Original issue reported on code.google.com by [email protected]
on 12 Oct 2007 at 4:56
What steps will reproduce the problem?
1. foo=u"""第一行
第二行"""
2. foo被翻译错误。现象出现在文件或者交互式命令行中。
What is the expected output? What do you see instead?
不应被翻译。
What version of the product are you using? On what operating system?
winxp sp2
Python 2.5.1
pyparse 1.4.7
zhpy:0.94, 1.0
Original issue reported on code.google.com by [email protected]
on 8 Oct 2007 at 10:58
provide pygments syntax highlighter for document
Original issue reported on code.google.com by gasolin
on 3 Sep 2007 at 2:37
將 python source 轉成 zhpy source
Original issue reported on code.google.com by gasolin
on 20 Aug 2007 at 8:37
Add some pyzh example test cases to ensure
the further fixes for 'python source to zhpy' function are valid.
Original issue reported on code.google.com by gasolin
on 11 Oct 2007 at 5:41
考虑是用 p_数字_v 来作为转换后的名字,
数字是 unicode 值,
这样无须字典就可以双向转换。
Original issue reported on code.google.com by [email protected]
on 22 Aug 2007 at 9:10
Attachments:
http://groups.google.com/group/python-cn/browse_thread/thread/4966f25deda929e1/#
Provide some level of GUI editor support
Original issue reported on code.google.com by gasolin
on 3 Sep 2007 at 2:38
draft zhpy interpreter implementation
http://groups.google.com/group/python-cn/browse_thread/thread/d85ad9a285998774/a
55caca591268753#a55caca591268753
{{{
zhpy.py
os.chdir(os.getcwd())
+# no args
+if len(sys.argv) == 1:
+ from zhipy import interpreter
+ interpreter()
+ sys.exit()
}}}
{{{
#zhipy by jiahua huang
# -*- coding: utf-8 -*-
def _indict(dic):
'''indict({'a':'1'}) -> {'1':'a'}
'''
d = {}
dick = dic.keys()
dick.reverse()
map(d.update, map(lambda i: {dic[i]:i}, dick))
return d
from zhpy import *
en_cndict = _indict(cndict)
en_twdict = _indict(twdict)
"""def convertToChinese(s, l, t):
tmp = t[0]
if tmp in en_twdict:
return en_twdict[tmp]
elif re.match(r'^p_[_\d]*_v\d?$', tmp):
tmp2 = ''
for i in tmp.split('_'):
if i.isdigit():
tmp2 += unichr(int(i)).encode('utf8')
return tmp2
else:
return tmp
englishChars = srange('[0-z]')
englishWord = Word(englishChars)
englishWord.setParseAction(convertToChinese)
englishWord = quotedString | englishWord"""
import code
def code4zh2en(code):
"""
"""
for k, v in replacedict.items():
code = code.replace(k,v)
ucode = code.decode("utf8")
result = chineseWord.transformString(ucode)
result = result.encode("utf8")
return result
class console(code.InteractiveConsole):
"""
"""
def push(self, line):
line = code4zh2en(line)
self.buffer.append(line)
source = "\n".join(self.buffer)
more = self.runsource(source, self.filename)
if not more:
self.resetbuffer()
return more
def interpreter():
"""
zhpy interpreter
"""
import readline, rlcompleter
readline.parse_and_bind("tab: complete")
con = console()
banner = 'Python %s\nzhipy.py - An Chinese Interactive Python
shell'%(sys.version)
con.interact(banner)
}}}
Original issue reported on code.google.com by gasolin
on 24 Aug 2007 at 6:49
当前 zhpy 的标准使用过程是:
1. 写好中文脚本
2. 通过zhpy 生成正常脚本
3. 调用python 环境执行
都是手工执行的,不利于实用脚本的实时调试,
建议给出自动联级执行方式,
e.g:
zhpy -p my.py
就自动完成以上2~3, 实际输出的是
python my_py.py(生成后的脚本名)
的执行
Original issue reported on code.google.com by Zoom.Quiet
on 10 Aug 2007 at 2:11
improve Traditional Chinese keywords
Original issue reported on code.google.com by gasolin
on 22 Aug 2007 at 8:54
问题描述
1. 打印 '''测试半角() 全角()句号。.'''
结果这些全角符号()。被替换成半角。
2. 文件zhdc.py的两个单引号没有替换。
# punctuations
replacedict = {
"(":"(",
")":")",
"。":".",
""":'"',
""":'"',
"'":"'",
"'":"'",
",":",",
":":":",
"!":"!",
}
Original issue reported on code.google.com by [email protected]
on 12 Sep 2007 at 2:54
问题概述。
zhpy发生ConfigParser.MissingSectionHeaderError: File contains no section
headers错误。
如何重现问题。
环境
Simplified Chinese WinXP SP2, python 2.5.1, zhpy 0.9.2.
把C:\python25和C:\Python25\Scripts加入PATH环境变量。
步骤
开始,运行,cmd。在cmd窗口中启动python并输入如下指令。
{{{
import zhpy as z
z.zh_exec("打印 u'哈哈'")
}}}
Error as below
{{{
>>> import zhpy as z
>>> z.zh_exec("打印 u'哈哈'")
file ntuser.ini
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "c:\python25\lib\site-packages\zhpy-0.9.2-py2.5.egg\zhpy\zhpy.py",
line 254, in zh_exec
annotator()
File "c:\python25\lib\site-packages\zhpy-0.9.2-py2.5.egg\zhpy\zhpy.py",
line 141, in annotator
ini_annotator(verbose)
File "c:\python25\lib\site-packages\zhpy-0.9.2-py2.5.egg\zhpy\zhpy.py",
line 103, in ini_annotator
conf.read(f)
File "c:\python25\lib\ConfigParser.py", line 267, in read
self._read(fp, filename)
File "c:\python25\lib\ConfigParser.py", line 462, in _read
raise MissingSectionHeaderError(fpname, lineno, line)
ConfigParser.MissingSectionHeaderError: File contains no section headers.
file: ntuser.ini, line: 1
'\xff\xfe\r\x00\n'
>>> zhpy.__version__
'0.9.2'
}}}
另外当我第一次不带任何参数运行zhpy.exe的时候也得到同样的
错误。
Original issue reported on code.google.com by [email protected]
on 12 Sep 2007 at 2:05
What steps will reproduce the problem?
1. 在开发目录下有foo.py
2. 启动zhpy命令行
3. import foo
4. sys.path.insert(0, '')
5. import foo
What is the expected output? What do you see instead?
第三步出错
What version of the product are you using? On what operating system?
winxp sp2
python 2.5.1
zhpy 0.94, 1.0
Please provide any additional information below.
根据python教程(Python Tutorial) 6.1.1节,应当包含当前路径。
Original issue reported on code.google.com by [email protected]
on 8 Oct 2007 at 11:04
improve Simplified Chinese keywords
Original issue reported on code.google.com by gasolin
on 13 Aug 2007 at 1:51
twdict
"主程式":'if __name == "__main__"'
cndict
"主程序":'if __name == "__main__"'
Original issue reported on code.google.com by gasolin
on 26 Aug 2007 at 1:21
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.