Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
38e42402
Y
YTBP
项目概览
YottaChain
/
YTBP
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Y
YTBP
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
38e42402
编写于
3月 28, 2018
作者:
J
joneric
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
added "Var" and {{ }} where appropriate
上级
9e6d4fe6
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
10 addition
and
10 deletion
+10
-10
scripts/abi_to_rc/abi_to_rc.py
scripts/abi_to_rc/abi_to_rc.py
+10
-10
未找到文件。
scripts/abi_to_rc/abi_to_rc.py
浏览文件 @
38e42402
...
...
@@ -60,37 +60,37 @@ def get_actions_inputs_types():
types
[
action
[
'name'
]].
append
(
field
[
'type'
])
# builds rows for the table
def
build_table_rows
():
def
build_table_rows
(
is_action
):
table_rows
=
[]
for
action
in
actions
:
action_string
=
"`
"
+
action
[
'name'
]
+
"
`"
action_string
=
"`
{{ "
+
action
[
'name'
]
+
" }}
`"
input_string
=
""
input_list
=
[]
type_string
=
""
type_list
=
[]
if
len
(
inputs
[
action
[
'name'
]])
>=
1
:
for
name
in
inputs
[
action
[
'name'
]]:
input_list
.
append
(
"`
"
+
name
+
"`"
)
input_list
.
append
(
"`
{{ "
+
name
+
(
"Var }}`"
if
is_action
else
" }}`"
)
)
input_string
=
'<br/>'
.
join
(
input_list
)
else
:
input_string
=
"`
"
+
action
[
'type'
]
+
"`"
input_string
=
"`
{{ "
+
action
[
'type'
]
+
(
"Var }}`"
if
is_action
else
" }}`"
)
if
len
(
types
[
action
[
'name'
]])
>=
1
:
for
name
in
types
[
action
[
'name'
]]:
type_list
.
append
(
"`
"
+
name
+
"
`"
)
type_list
.
append
(
"`
{{ "
+
name
+
" }}
`"
)
type_string
=
'<br/>'
.
join
(
type_list
)
else
:
type_string
=
"`
"
+
action
[
'type'
]
+
"
`"
type_string
=
"`
{{ "
+
action
[
'type'
]
+
" }}
`"
table_rows
.
append
(
'| '
+
action_string
+
' | '
+
input_string
+
' | '
+
type_string
+
' |'
)
return
table_rows
# generates an overview ricardian contract from the overview template
def
generate_rc_overview_file
():
tr
=
build_table_rows
()
tr
=
build_table_rows
(
False
)
abi_file_name
=
os
.
path
.
split
(
args
.
abi_file
)[
1
]
contract_name
=
os
.
path
.
splitext
(
abi_file_name
)[
0
]
rc_file_name
=
contract_name
+
'-rc.md'
dirname
=
os
.
path
.
split
(
args
.
abi_file
)[
0
]
subs
=
{
'contract'
:
contract_name
,
subs
=
{
'contract'
:
"{{ "
+
contract_name
+
" }}"
,
'action'
:
'actions'
if
len
(
actions
)
>
1
else
'action'
,
'input'
:
'inputs'
if
len
(
inputs
)
>
1
else
'input'
,
'type'
:
'types'
if
len
(
types
)
>
1
else
'type'
}
...
...
@@ -104,12 +104,12 @@ def generate_rc_overview_file():
# generates a ricardian contract for each action from the action template
def
generate_rc_action_files
():
tr
=
build_table_rows
()
tr
=
build_table_rows
(
True
)
abi_filename
=
os
.
path
.
split
(
args
.
abi_file
)[
1
]
contract_name
=
os
.
path
.
splitext
(
abi_filename
)[
0
]
dirname
=
os
.
path
.
split
(
args
.
abi_file
)[
0
]
for
action
in
actions
:
subs
=
{
'action'
:
action
[
'name'
]
,
subs
=
{
'action'
:
"{{ "
+
action
[
'name'
]
+
" }}"
,
'input'
:
'inputs'
if
len
(
inputs
[
action
[
'name'
]])
>
1
else
'input'
,
'type'
:
'types'
if
len
(
types
[
action
[
'name'
]])
>
1
else
'type'
}
subs
.
update
([(
k
+
'_header'
,
v
.
title
())
for
k
,
v
in
subs
.
copy
().
items
()])
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录