Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
eff56252
提交
eff56252
authored
7月 09, 2015
作者:
Iban Harlouchet
提交者:
Iban Harlouchet
7月 23, 2015
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
flake8 for theano/misc/gh_api.py
上级
d40710cd
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
27 行增加
和
28 行删除
+27
-28
gh_api.py
theano/misc/gh_api.py
+27
-27
test_flake8.py
theano/tests/test_flake8.py
+0
-1
没有找到文件。
theano/misc/gh_api.py
浏览文件 @
eff56252
...
@@ -19,31 +19,31 @@ token = None
...
@@ -19,31 +19,31 @@ token = None
def
get_auth_token
():
def
get_auth_token
():
global
token
global
token
if
token
is
not
None
:
if
token
is
not
None
:
return
token
return
token
import
keyring
import
keyring
token
=
keyring
.
get_password
(
'github'
,
fake_username
)
token
=
keyring
.
get_password
(
'github'
,
fake_username
)
if
token
is
not
None
:
if
token
is
not
None
:
return
token
return
token
print
(
"Please enter your github username and password. These are not "
print
(
"Please enter your github username and password. These are not "
"stored, only used to get an oAuth token. You can revoke this at "
"stored, only used to get an oAuth token. You can revoke this at "
"any time on Github."
)
"any time on Github."
)
user
=
input
(
"Username: "
)
user
=
input
(
"Username: "
)
pw
=
getpass
.
getpass
(
"Password: "
)
pw
=
getpass
.
getpass
(
"Password: "
)
auth_request
=
{
auth_request
=
{
"scopes"
:
[
"scopes"
:
[
"public_repo"
,
"public_repo"
,
"gist"
"gist"
],
],
"note"
:
"IPython tools"
,
"note"
:
"IPython tools"
,
"note_url"
:
"https://github.com/ipython/ipython/tree/master/tools"
,
"note_url"
:
"https://github.com/ipython/ipython/tree/master/tools"
,
}
}
response
=
requests
.
post
(
'https://api.github.com/authorizations'
,
response
=
requests
.
post
(
'https://api.github.com/authorizations'
,
auth
=
(
user
,
pw
),
data
=
json
.
dumps
(
auth_request
))
auth
=
(
user
,
pw
),
data
=
json
.
dumps
(
auth_request
))
response
.
raise_for_status
()
response
.
raise_for_status
()
token
=
json
.
loads
(
response
.
text
)[
'token'
]
token
=
json
.
loads
(
response
.
text
)[
'token'
]
keyring
.
set_password
(
'github'
,
fake_username
,
token
)
keyring
.
set_password
(
'github'
,
fake_username
,
token
)
...
@@ -57,40 +57,40 @@ def make_auth_header():
...
@@ -57,40 +57,40 @@ def make_auth_header():
def
post_issue_comment
(
project
,
num
,
body
):
def
post_issue_comment
(
project
,
num
,
body
):
url
=
'https://api.github.com/repos/{project}/issues/{num}/comments'
.
format
(
project
=
project
,
num
=
num
)
url
=
'https://api.github.com/repos/{project}/issues/{num}/comments'
.
format
(
project
=
project
,
num
=
num
)
payload
=
json
.
dumps
({
'body'
:
body
})
payload
=
json
.
dumps
({
'body'
:
body
})
r
=
requests
.
post
(
url
,
data
=
payload
,
headers
=
make_auth_header
())
r
=
requests
.
post
(
url
,
data
=
payload
,
headers
=
make_auth_header
())
# noqa
def
post_gist
(
content
,
description
=
''
,
filename
=
'file'
,
auth
=
False
):
def
post_gist
(
content
,
description
=
''
,
filename
=
'file'
,
auth
=
False
):
"""Post some text to a Gist, and return the URL."""
"""Post some text to a Gist, and return the URL."""
post_data
=
json
.
dumps
({
post_data
=
json
.
dumps
({
"description"
:
description
,
"description"
:
description
,
"public"
:
True
,
"public"
:
True
,
"files"
:
{
"files"
:
{
filename
:
{
filename
:
{
"content"
:
content
"content"
:
content
}
}
}
}
})
.
encode
(
'utf-8'
)
})
.
encode
(
'utf-8'
)
headers
=
make_auth_header
()
if
auth
else
{}
headers
=
make_auth_header
()
if
auth
else
{}
response
=
requests
.
post
(
"https://api.github.com/gists"
,
data
=
post_data
,
headers
=
headers
)
response
=
requests
.
post
(
"https://api.github.com/gists"
,
data
=
post_data
,
headers
=
headers
)
response
.
raise_for_status
()
response
.
raise_for_status
()
response_data
=
json
.
loads
(
response
.
text
)
response_data
=
json
.
loads
(
response
.
text
)
return
response_data
[
'html_url'
]
return
response_data
[
'html_url'
]
def
get_pull_request
(
project
,
num
,
github_api
=
3
):
def
get_pull_request
(
project
,
num
,
github_api
=
3
):
"""get pull request info by number
"""get pull request info by number
github_api : version of github api to use
github_api : version of github api to use
"""
"""
if
github_api
==
2
:
if
github_api
==
2
:
url
=
"http://github.com/api/v2/json/pulls/{project}/{num}"
.
format
(
project
=
project
,
num
=
num
)
url
=
"http://github.com/api/v2/json/pulls/{project}/{num}"
.
format
(
project
=
project
,
num
=
num
)
elif
github_api
==
3
:
elif
github_api
==
3
:
url
=
"https://api.github.com/repos/{project}/pulls/{num}"
.
format
(
project
=
project
,
num
=
num
)
url
=
"https://api.github.com/repos/{project}/pulls/{num}"
.
format
(
project
=
project
,
num
=
num
)
response
=
requests
.
get
(
url
)
response
=
requests
.
get
(
url
)
response
.
raise_for_status
()
response
.
raise_for_status
()
if
github_api
==
2
:
if
github_api
==
2
:
return
json
.
loads
(
response
.
text
)[
'pull'
]
return
json
.
loads
(
response
.
text
)[
'pull'
]
return
json
.
loads
(
response
.
text
)
return
json
.
loads
(
response
.
text
)
...
@@ -100,12 +100,12 @@ def get_pulls_list(project, github_api=3):
...
@@ -100,12 +100,12 @@ def get_pulls_list(project, github_api=3):
github_api : version of github api to use
github_api : version of github api to use
"""
"""
if
github_api
==
3
:
if
github_api
==
3
:
url
=
"https://api.github.com/repos/{project}/pulls"
.
format
(
project
=
project
)
url
=
"https://api.github.com/repos/{project}/pulls"
.
format
(
project
=
project
)
else
:
else
:
url
=
"http://github.com/api/v2/json/pulls/{project}"
.
format
(
project
=
project
)
url
=
"http://github.com/api/v2/json/pulls/{project}"
.
format
(
project
=
project
)
response
=
requests
.
get
(
url
)
response
=
requests
.
get
(
url
)
response
.
raise_for_status
()
response
.
raise_for_status
()
if
github_api
==
2
:
if
github_api
==
2
:
return
json
.
loads
(
response
.
text
)[
'pulls'
]
return
json
.
loads
(
response
.
text
)[
'pulls'
]
return
json
.
loads
(
response
.
text
)
return
json
.
loads
(
response
.
text
)
theano/tests/test_flake8.py
浏览文件 @
eff56252
...
@@ -184,7 +184,6 @@ whitelist_flake8 = [
...
@@ -184,7 +184,6 @@ whitelist_flake8 = [
"scan_module/scan_opt.py"
,
"scan_module/scan_opt.py"
,
"scan_module/tests/test_scan.py"
,
"scan_module/tests/test_scan.py"
,
"scan_module/tests/test_scan_opt.py"
,
"scan_module/tests/test_scan_opt.py"
,
"misc/gh_api.py"
,
"misc/check_blas.py"
,
"misc/check_blas.py"
,
"misc/latence_gpu_transfert.py"
,
"misc/latence_gpu_transfert.py"
,
"misc/cudamat_utils.py"
,
"misc/cudamat_utils.py"
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论