Skip to content

Commit

Permalink
Activate tox envs
Browse files Browse the repository at this point in the history
  • Loading branch information
Benoît Coste committed Jun 3, 2019
1 parent 66d00dc commit 3774d12
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 44 deletions.
8 changes: 5 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@ addons:
apt:
packages:
- libhdf5-dev
- python-tk

cache: pip
install:
- pip install tox
- pip install 'matplotlib==1.5.2' tox
- pip install .
script:
- if [[ $TRAVIS_PYTHON_VERSION == 2.7 ]]; then tox -e py27; fi
- if [[ $TRAVIS_PYTHON_VERSION == 3.5 ]]; then tox --skip-missing-interpreters; fi
- if [[ $TRAVIS_PYTHON_VERSION == 3.6 ]]; then tox -e py36; fi
- if [[ $TRAVIS_PYTHON_VERSION == 3.5 ]]; then tox -e py35; fi
- if [[ $TRAVIS_PYTHON_VERSION == 3.6 ]]; then tox -e py36 -e lint; fi
before_deploy:
- pip install twine
deploy:
Expand Down
2 changes: 1 addition & 1 deletion .pylintrc → pylintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[MESSAGES CONTROL]
disable=bad-continuation,fixme,invalid-name,len-as-condition,no-else-return,ungrouped-imports
disable=bad-continuation,fixme,invalid-name,len-as-condition,no-else-return,ungrouped-imports,useless-object-inheritance

[FORMAT]
# Maximum number of characters on a single line.
Expand Down
4 changes: 2 additions & 2 deletions tmd/Topology/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ def get_average_persistence_image(ph_list, xlims=None, ylims=None,
xlims=xlims, ylims=ylims)
if not np.isnan(np.sum(im)):
im_av = weight * im
except BaseException:
except BaseException: # pylint: disable=broad-except
pass
else:
try:
Expand All @@ -270,7 +270,7 @@ def get_average_persistence_image(ph_list, xlims=None, ylims=None,
if not np.isnan(np.sum(im)):
im_av = np.add(im_av, weight * im)
k = k + 1
except BaseException:
except BaseException: # pylint: disable=broad-except
pass
return im_av / k

Expand Down
2 changes: 2 additions & 0 deletions tmd/Topology/methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,10 @@ def _phi_theta(u, v):
Returns phi, theta
"""
phi1 = np.arctan2(u[1], u[0])
# pylint: disable=assignment-from-no-return
theta1 = np.arccos(u[2] / np.linalg.norm(u))

# pylint: disable=assignment-from-no-return
phi2 = np.arctan2(v[1], v[0])
theta2 = np.arccos(v[2] / np.linalg.norm(v))

Expand Down
1 change: 1 addition & 0 deletions tmd/Tree/methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ def get_direction_between(self, start_id=0, end_id=1):
defined as end point - start point
normalized as a unit vector.
'''
# pylint: disable=assignment-from-no-return
vect = _np.subtract([self.x[end_id], self.y[end_id], self.z[end_id]],
[self.x[start_id], self.y[start_id], self.z[start_id]])

Expand Down
2 changes: 2 additions & 0 deletions tmd/view/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ def persistence_image(ph, new_fig=True, subplot=111, xlims=None, ylims=None,
if xlims is None or xlims is None:
xlims, ylims = analysis.get_limits(ph, coll=False)

# pylint: disable=unexpected-keyword-arg
Zn = analysis.get_persistence_image_data(ph, norm_factor=norm_factor, bw_method=bw_method,
xlims=xlims, ylims=ylims)
fig, ax = _cm.get_figure(new_fig=new_fig, subplot=subplot)
Expand Down Expand Up @@ -156,6 +157,7 @@ def persistence_image_average(ph_list, new_fig=True, subplot=111, xlims=None,
cmap=jet_map, weighted=False, **kwargs):
"""Merges a list of ph diagrams and plots their respective average image.
"""
# pylint: disable=unexpected-keyword-arg
av_imgs = analysis.get_average_persistence_image(ph_list, xlims=xlims, ylims=ylims,
norm_factor=norm_factor, weighted=weighted)
if xlims is None or xlims is None:
Expand Down
2 changes: 1 addition & 1 deletion tmd/view/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,7 @@ def seg_length(seg):
angles = _np.array([seg_angle(s) for s in segs])
lens = _np.array([seg_length(s) for s in segs])
ranges = [[i * 2 * _np.pi / bins - _np.pi, (i + 1) * 2 * _np.pi / bins - _np.pi]
for i in xrange(bins)]
for i in range(bins)]
results = [r + [_np.sum(lens[_np.where((angles > r[0]) & (angles < r[1]))[0]])]
for r in ranges]

Expand Down
58 changes: 21 additions & 37 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,56 +3,40 @@ name = tmd
testdeps =
nose
tqdm
commands = nosetests

[testenv]
deps = {[base]testdeps}
extras = viewer
commands = nosetests

[tox]
envlist =
check-version
pycodestyle
pylint
lint
py27
py35

[testenv:check-version]
skip_install = true
# commands = /gpfs/bbp.cscs.ch/apps/viz/platform/binfiles/bbp-nse-ci/0.0.1/bin/do_release.py -p . check-version


[testenv:pycodestyle]
deps = pycodestyle
commands = true | pycodestyle {[base]name} --exclude tests

[testenv:pylint]
deps = pylint
commands = true | pylint {[base]name}

[testenv:py27]
deps = {[base]testdeps}
commands = true | nosetests
py36

[testenv:py35]
deps = {[base]testdeps}
commands = true | nosetests

[testenv:py36]
deps = {[base]testdeps}
commands = true | nosetests
[testenv:lint]
basepython = python3
deps =
pycodestyle
pylint
commands =
pycodestyle --config=pycodestylerc --exclude=tests tmd
pylint --rcfile=pylintrc --extension-pkg-whitelist=numpy --ignore=tests tmd

[testenv:coverage]
deps =
{[base]testdeps}
coverage
commands =
true | coverage run --source {[base]name} {envbindir}/nosetests
true | coverage report --show-missing
true | coverage xml

[testenv:docs]
changedir = doc
deps = sphinx
commands = true | make html
whitelist_externals = make
coverage run --source {[base]name} {envbindir}/nosetests
coverage report --show-missing
coverage xml

# E731: do not assign a lambda expression, use a def
# W504: Line break occurred after a binary operator
[pycodestyle]
ignore = E731
ignore = E731,W504
max-line-length = 100

0 comments on commit 3774d12

Please sign in to comment.