From 1a316d55f4fa23c776618ec614a74a332bcb7140 Mon Sep 17 00:00:00 2001 From: Zeyu Chen Date: Tue, 1 Jan 2019 09:22:06 +0800 Subject: [PATCH] upgrade licence --- LICENSE | 4 +++- paddle_hub/downloader.py | 11 ++++------- paddle_hub/module.py | 19 +++++++++++++++++-- paddle_hub/test_downloader.py | 5 ++--- 4 files changed, 26 insertions(+), 13 deletions(-) diff --git a/LICENSE b/LICENSE index 261eeb9e..c8dd3ab2 100644 --- a/LICENSE +++ b/LICENSE @@ -1,3 +1,5 @@ +Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved + Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -186,7 +188,7 @@ same "printed page" as the copyright notice for easier 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"); you may not use this file except in compliance with the License. diff --git a/paddle_hub/downloader.py b/paddle_hub/downloader.py index 3f0e5cac..f37a77a4 100644 --- a/paddle_hub/downloader.py +++ b/paddle_hub/downloader.py @@ -26,14 +26,8 @@ import hashlib import requests import tempfile import tarfile -""" -tqdm prograss hook -""" -__all__ = [ - 'MODULE_HOME', 'download', 'md5file', 'split', 'cluster_files_reader', - 'convert', 'download_and_uncompress' -] +__all__ = ['MODULE_HOME', 'download', 'md5file', 'download_and_uncompress'] # TODO(ZeyuChen) add environment varialble to set MODULE_HOME MODULE_HOME = os.path.expanduser('~/.cache/paddle/module') @@ -119,6 +113,9 @@ def download_and_uncompress(url, save_name=None): class TqdmProgress(tqdm): + """ + tqdm prograss hook + """ last_block = 0 def update_to(self, block_num=1, block_size=1, total_size=None): diff --git a/paddle_hub/module.py b/paddle_hub/module.py index 0c677011..cee76ef3 100644 --- a/paddle_hub/module.py +++ b/paddle_hub/module.py @@ -1,17 +1,32 @@ +# 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 division from __future__ import print_function import paddle.fluid as fluid +import paddle_hub as hub import numpy as np -# import paddle_hub as hub import tempfile import os from collections import defaultdict - from paddle_hub.downloader import download_and_uncompress +__all__ = ["Module", "ModuleSpec"] + class Module(object): def __init__(self, module_url): diff --git a/paddle_hub/test_downloader.py b/paddle_hub/test_downloader.py index be3919a3..d8d3cdf6 100644 --- a/paddle_hub/test_downloader.py +++ b/paddle_hub/test_downloader.py @@ -12,15 +12,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -import downloader as dl import unittest +import downloader as dl class TestDownloader(unittest.TestCase): def test_download(self): link = "http://paddlehub.bj.bcebos.com/word2vec/word2vec-dim16-simple-example-1.tar.gz" - module_path = dl. - ownload_and_uncompress(link) + module_path = dl.download_and_uncompress(link) if __name__ == "__main__": -- GitLab