提交 1a316d55 编写于 作者: Z Zeyu Chen

upgrade licence

上级 9dfd6e56
Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved
Apache License Apache License
Version 2.0, January 2004 Version 2.0, January 2004
http://www.apache.org/licenses/ http://www.apache.org/licenses/
...@@ -186,7 +188,7 @@ ...@@ -186,7 +188,7 @@
same "printed page" as the copyright notice for easier same "printed page" as the copyright notice for easier
identification within third-party archives. identification within third-party archives.
Copyright [yyyy] [name of copyright owner] Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
......
...@@ -26,14 +26,8 @@ import hashlib ...@@ -26,14 +26,8 @@ import hashlib
import requests import requests
import tempfile import tempfile
import tarfile import tarfile
"""
tqdm prograss hook
"""
__all__ = [ __all__ = ['MODULE_HOME', 'download', 'md5file', 'download_and_uncompress']
'MODULE_HOME', 'download', 'md5file', 'split', 'cluster_files_reader',
'convert', 'download_and_uncompress'
]
# TODO(ZeyuChen) add environment varialble to set MODULE_HOME # TODO(ZeyuChen) add environment varialble to set MODULE_HOME
MODULE_HOME = os.path.expanduser('~/.cache/paddle/module') MODULE_HOME = os.path.expanduser('~/.cache/paddle/module')
...@@ -119,6 +113,9 @@ def download_and_uncompress(url, save_name=None): ...@@ -119,6 +113,9 @@ def download_and_uncompress(url, save_name=None):
class TqdmProgress(tqdm): class TqdmProgress(tqdm):
"""
tqdm prograss hook
"""
last_block = 0 last_block = 0
def update_to(self, block_num=1, block_size=1, total_size=None): def update_to(self, block_num=1, block_size=1, total_size=None):
......
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import absolute_import from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function
import paddle.fluid as fluid import paddle.fluid as fluid
import paddle_hub as hub
import numpy as np import numpy as np
# import paddle_hub as hub
import tempfile import tempfile
import os import os
from collections import defaultdict from collections import defaultdict
from paddle_hub.downloader import download_and_uncompress from paddle_hub.downloader import download_and_uncompress
__all__ = ["Module", "ModuleSpec"]
class Module(object): class Module(object):
def __init__(self, module_url): def __init__(self, module_url):
......
...@@ -12,15 +12,14 @@ ...@@ -12,15 +12,14 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import downloader as dl
import unittest import unittest
import downloader as dl
class TestDownloader(unittest.TestCase): class TestDownloader(unittest.TestCase):
def test_download(self): def test_download(self):
link = "http://paddlehub.bj.bcebos.com/word2vec/word2vec-dim16-simple-example-1.tar.gz" link = "http://paddlehub.bj.bcebos.com/word2vec/word2vec-dim16-simple-example-1.tar.gz"
module_path = dl. module_path = dl.download_and_uncompress(link)
ownload_and_uncompress(link)
if __name__ == "__main__": if __name__ == "__main__":
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册