def convert_py2rb(s, path='', base_path_count=0, modules=[], mod_paths={}):
"""
Takes Python code as a string 's' and converts this to Ruby.
Example:
>>> convert_py2rb("x[3:]")
'x[3..-1]'
"""
v = RB(path, base_path_count, mod_paths)
for m in modules:
t = ast.parse(m)
v.visit(t)
v.clear()
t = ast.parse(s)
v.visit(t)
return v.read()
评论列表
文章目录