Skip to content

Commit

Permalink
fix travis error
Browse files Browse the repository at this point in the history
  • Loading branch information
TsumiNa committed Jan 21, 2018
1 parent be9b4f0 commit 0d3dbb2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ env:
- PYTHON_VERSION=3.6 BACKEND=agg

before_install:
- mkidr -p ~/.xenonpy/dataset
- mkidr -p ~/.xenonpy/cached
- cp travis/*.pkl ~/.xenonpy/dataset/
- list ~/.xenonpy
- cp travis/matplotlibrc_${BACKEND} matplotlibrc
- if [ $BACKEND == "qtagg" ]; then
export DISPLAY=:99.0;
Expand Down
4 changes: 1 addition & 3 deletions travis/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O mi
bash miniconda.sh -b -p $HOME/miniconda
export PATH="$HOME/miniconda/bin:$PATH"
export MPLBACKEN='Agg'
mkidr -p ~/.xenonpy/dataset
mkidr -p ~/.xenonpy/cached
cp travis/*.pkl ~/.xenonpy/dataset/

hash -r
conda config --set always_yes yes --set changeps1 no
conda update -q conda
Expand Down
8 changes: 4 additions & 4 deletions xenonpy/utils/datatools.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,14 @@ def __init__(self, path: str = None, *,
self.dataset_dir = Path().home() / __pkg_cfg_root__ / 'dataset'
self.cached_dir = Path().home() / __pkg_cfg_root__ / 'cached'

def _fetch_data(self, url: str, save_to):
def _fetch_data(self, url, save_to):

http = urllib3.PoolManager()

# fetch `name.pkl` file
try:
r = http.request('GET', url, preload_content=False)
with open(save_to, 'wb') as out:
with open(str(save_to), 'wb') as out:
while True:
data = r.read(self.chunk_size)
if not data:
Expand All @@ -141,7 +141,7 @@ def _fetch_data(self, url: str, save_to):
finally:
r.release_conn()

def __call__(self, name: str, include=None, exclude=None):
def __call__(self, name, include=None, exclude=None):
"""
load preset dataset.
Expand Down Expand Up @@ -236,7 +236,7 @@ class Saver(Iterator):
"""
Save data in a convenient way::
.. code: pytho
.. code: python
import numpy as np
np.random.seed(0)
Expand Down

0 comments on commit 0d3dbb2

Please sign in to comment.