Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
avocado
提交
3a809976
A
avocado
项目概览
openeuler
/
avocado
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
avocado
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3a809976
编写于
6月 05, 2014
作者:
R
Rudá Moura
提交者:
Ruda Moura
6月 05, 2014
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
avocado.utils.download: Update documentation.
Signed-off-by:
N
Ruda Moura
<
rmoura@redhat.com
>
上级
c1b7a5d5
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
21 addition
and
5 deletion
+21
-5
avocado/utils/download.py
avocado/utils/download.py
+21
-5
未找到文件。
avocado/utils/download.py
浏览文件 @
3a809976
...
@@ -29,7 +29,10 @@ log = logging.getLogger('avocado.test')
...
@@ -29,7 +29,10 @@ log = logging.getLogger('avocado.test')
def
is_url
(
path
):
def
is_url
(
path
):
"""
"""
Return true if path looks like a URL
Return `True` if path looks like an URL.
:param path: path to check.
:rtype: Boolean.
"""
"""
url_parts
=
urlparse
.
urlparse
(
path
)
url_parts
=
urlparse
.
urlparse
(
path
)
return
(
url_parts
[
0
]
in
(
'http'
,
'https'
,
'ftp'
,
'git'
))
return
(
url_parts
[
0
]
in
(
'http'
,
'https'
,
'ftp'
,
'git'
))
...
@@ -37,7 +40,13 @@ def is_url(path):
...
@@ -37,7 +40,13 @@ def is_url(path):
def
url_open
(
url
,
data
=
None
,
timeout
=
5
):
def
url_open
(
url
,
data
=
None
,
timeout
=
5
):
"""
"""
Wrapper to urllib2.urlopen with timeout addition.
Wrapper to :func:`urllib2.urlopen` with timeout addition.
:param url: URL to open.
:param data: (optional) data to post.
:param timeout: (optional) default timeout in seconds.
:return: file-like object.
:raises: `URLError`.
"""
"""
# Save old timeout
# Save old timeout
old_timeout
=
socket
.
getdefaulttimeout
()
old_timeout
=
socket
.
getdefaulttimeout
()
...
@@ -51,6 +60,12 @@ def url_open(url, data=None, timeout=5):
...
@@ -51,6 +60,12 @@ def url_open(url, data=None, timeout=5):
def
url_download
(
url
,
filename
,
data
=
None
,
timeout
=
300
):
def
url_download
(
url
,
filename
,
data
=
None
,
timeout
=
300
):
"""
"""
Retrieve a file from given url.
Retrieve a file from given url.
:param url: source URL.
:param filename: destination path.
:param data: (optional) data to post.
:param timeout: (optional) default timeout in seconds.
:return: `None`.
"""
"""
log
.
info
(
'Fetching %s -> %s'
,
url
,
filename
)
log
.
info
(
'Fetching %s -> %s'
,
url
,
filename
)
...
@@ -69,9 +84,10 @@ def get_file(src, dst, permissions=None):
...
@@ -69,9 +84,10 @@ def get_file(src, dst, permissions=None):
"""
"""
Get a file from src and put it in dest, returning dest path.
Get a file from src and put it in dest, returning dest path.
:param src: Source path or URL. May be local or a remote file.
:param src: source path or URL. May be local or a remote file.
:param dst: Destination path.
:param dst: destination path.
:returns: Destination path.
:param permissions: (optional) set access permissions.
:return: destination path.
"""
"""
if
src
==
dst
:
if
src
==
dst
:
return
return
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录