Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 35F1C200D27 for ; Wed, 11 Oct 2017 04:49:00 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 3473A160BE1; Wed, 11 Oct 2017 02:49:00 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 7ABAA160BE0 for ; Wed, 11 Oct 2017 04:48:59 +0200 (CEST) Received: (qmail 54734 invoked by uid 500); 11 Oct 2017 02:48:58 -0000 Mailing-List: contact commits-help@mxnet.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@mxnet.incubator.apache.org Delivered-To: mailing list commits@mxnet.incubator.apache.org Received: (qmail 54724 invoked by uid 99); 11 Oct 2017 02:48:58 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Oct 2017 02:48:58 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 8CC3281A74; Wed, 11 Oct 2017 02:48:57 +0000 (UTC) Date: Wed, 11 Oct 2017 02:48:56 +0000 To: "commits@mxnet.apache.org" Subject: [incubator-mxnet] branch master updated: Get bz2 data fix (#8020) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <150769013680.23091.1533919419028857947@gitbox.apache.org> From: jxie@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: incubator-mxnet X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 506dd28e5b030437e4aa41d262f4a5c97b0070de X-Git-Newrev: fa47c6116e1cfadd6bdeff4a4bbec689a2892a1b X-Git-Rev: fa47c6116e1cfadd6bdeff4a4bbec689a2892a1b X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated archived-at: Wed, 11 Oct 2017 02:49:00 -0000 This is an automated email from the ASF dual-hosted git repository. jxie pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git The following commit(s) were added to refs/heads/master by this push: new fa47c61 Get bz2 data fix (#8020) fa47c61 is described below commit fa47c6116e1cfadd6bdeff4a4bbec689a2892a1b Author: Anirudh Subramanian AuthorDate: Tue Oct 10 19:48:54 2017 -0700 Get bz2 data fix (#8020) * Add documentation * Add kdda example * Changes to documentation * Additional changes to the documentation * Remove chdir calls --- python/mxnet/test_utils.py | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/python/mxnet/test_utils.py b/python/mxnet/test_utils.py index bc92257..78e5bdd 100644 --- a/python/mxnet/test_utils.py +++ b/python/mxnet/test_utils.py @@ -1442,10 +1442,31 @@ def get_mnist(): 'test_data':test_img, 'test_label':test_lbl} def get_bz2_data(data_dir, data_name, url, data_origin_name): - """Download and extract bz2 data.""" - download(url, dirname=data_dir, overwrite=False) - os.chdir(data_dir) + """Download and extract bz2 data. + + Parameters + ---------- + + data_dir : str + Absolute or relative path of the directory name to store bz2 files + data_name : str + Name of the output file in which bz2 contents will be extracted + url : str + URL to download data from + data_origin_name : str + Name of the downloaded b2 file + + Examples + -------- + >>> get_bz2_data("data_dir", "kdda.t", + "https://www.csie.ntu.edu.tw/~cjlin/libsvmtools/datasets/binary/kdda.t.bz2", + "kdda.t.bz2") + """ + + data_name = os.path.join(data_dir, data_name) + data_origin_name = os.path.join(data_dir, data_origin_name) if not os.path.exists(data_name): + download(url, dirname=data_dir, overwrite=False) bz_file = bz2.BZ2File(data_origin_name, 'rb') with open(data_name, 'wb') as fout: try: @@ -1454,7 +1475,6 @@ def get_bz2_data(data_dir, data_name, url, data_origin_name): finally: bz_file.close() os.remove(data_origin_name) - os.chdir("..") def set_env_var(key, val, default_val=""): """Set environment variable -- To stop receiving notification emails like this one, please contact ['"commits@mxnet.apache.org" '].