Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
openEuler-Advisor
提交
594bf28b
O
openEuler-Advisor
项目概览
openeuler
/
openEuler-Advisor
通知
31
Star
4
Fork
4
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
openEuler-Advisor
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
594bf28b
编写于
5月 27, 2020
作者:
S
Shinwell Hu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
review tc comment and create reminder
上级
06d35f40
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
64 addition
and
0 deletion
+64
-0
tc_reminder.py
tc_reminder.py
+64
-0
未找到文件。
tc_reminder.py
0 → 100755
浏览文件 @
594bf28b
#!/usr/bin/python3
"""
This is a command line tool to create reminder list for TC member
"""
import
urllib
import
urllib.request
import
urllib.parse
import
argparse
import
json
import
sys
import
os
from
pprint
import
pprint
class
Advisor
:
def
__init__
(
self
):
self
.
secret
=
open
(
os
.
path
.
expanduser
(
"~/.gitee_token.json"
),
"r"
)
self
.
token
=
json
.
load
(
self
.
secret
)
# self.req = urllib.request.Request('https://gitee.com/api/v5/repos/#{owner}/issues')
self
.
header
=
{
"Content-Type"
:
"application/json;charset=UTF-8"
,
"User-Agent"
:
"Mozilla/5.0 (Windows NT 10.0; WOW64; rv:50.0) Gecko/20100101 Firefox/50.0"
}
self
.
list_url
=
"https://gitee.com/api/v5/repos/openeuler/community/pulls?access_token={token}&state=open&sort=created&direction=desc&page=1&per_page=100"
self
.
desc_url
=
"https://gitee.com/api/v5/repos/openeuler/community/pulls/{number}/comments?access_token={token}&page=1&per_page=100"
self
.
tc_members
=
[
"myeuler"
,
"cynthia_xh"
,
"shinwell_hu"
,
"dream0819"
,
"hanjun-guo"
,
"xiexiuqi"
,
"zhanghai_lucky"
]
def
get_gitee
(
self
,
url
):
req
=
urllib
.
request
.
Request
(
url
=
url
,
headers
=
self
.
header
,
method
=
"GET"
)
with
urllib
.
request
.
urlopen
(
req
)
as
u
:
resp
=
json
.
loads
(
u
.
read
().
decode
(
"utf-8"
))
return
resp
def
get_prs
(
self
):
url
=
self
.
list_url
.
format
(
token
=
self
.
token
[
"access_token"
])
return
self
.
get_gitee
(
url
)
def
get_pr_comments
(
self
,
number
):
url
=
self
.
desc_url
.
format
(
number
=
number
,
token
=
self
.
token
[
"access_token"
])
return
self
.
get_gitee
(
url
)
def
filter_out_tc
(
self
,
users
):
return
[
x
for
x
in
self
.
tc_members
if
x
in
users
]
if
__name__
==
"__main__"
:
par
=
argparse
.
ArgumentParser
()
args
=
par
.
parse_args
()
adv
=
Advisor
()
PRs
=
adv
.
get_prs
()
for
pr
in
PRs
:
pprint
(
"https://gitee.com/openeuler/community/pulls/{number}"
.
format
(
number
=
pr
[
"number"
]))
pprint
(
pr
[
"title"
])
comm
=
adv
.
get_pr_comments
(
pr
[
"number"
])
users
=
[]
for
c
in
comm
:
users
.
append
(
c
[
"user"
][
"login"
])
tc
=
adv
.
filter_out_tc
(
users
)
pprint
(
"Involved TC member:"
)
pprint
(
tc
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录