diff --git a/.travis.yml b/.travis.yml index 03a33bf8808..7df09d23593 100644 --- a/.travis.yml +++ b/.travis.yml @@ -58,7 +58,7 @@ matrix: - env: NAME="Lint" PYLINTRC="${TRAVIS_BUILD_DIR}/package/.pylintrc" - MAIN_CMD="pylint package/MDAnalysis && pylint testsuite/MDAnalysisTests" + MAIN_CMD="pylint --py3k package/MDAnalysis && pylint --py3k testsuite/MDAnalysisTests" SETUP_CMD="" BUILD_CMD="" CONDA_DEPENDENCIES="" diff --git a/package/MDAnalysis/analysis/align.py b/package/MDAnalysis/analysis/align.py index 4e6c7f6b197..e67a00cd7d3 100644 --- a/package/MDAnalysis/analysis/align.py +++ b/package/MDAnalysis/analysis/align.py @@ -183,15 +183,10 @@ .. autofunction:: get_matching_atoms """ -from __future__ import division, absolute_import - import os.path import warnings import logging -from six.moves import range, zip, zip_longest -from six import raise_from, string_types - import numpy as np import Bio.SeqIO @@ -508,20 +503,18 @@ def alignto(mobile, reference, select=None, weights=None, if subselection is None: # mobile_atoms is Universe mobile_atoms = mobile.universe.atoms - elif isinstance(subselection, string_types): + elif isinstance(subselection, str): # select mobile_atoms from string mobile_atoms = mobile.select_atoms(subselection) else: try: # treat subselection as AtomGroup mobile_atoms = subselection.atoms - except AttributeError: - raise_from( - TypeError( - "subselection must be a selection string, an" - " AtomGroup or Universe or None" - ), - None) + except AttributeError as exc: + err = ("subselection must be a selection string, an" + " AtomGroup or Universe or None") + raise TypeError(err) from exc + # _fit_to DOES subtract center of mass, will provide proper min_rmsd mobile_atoms, new_rmsd = _fit_to(mobile_coordinates, ref_coordinates, @@ -1348,12 +1341,12 @@ def get_atoms_byres(g, match_mask=np.logical_not(mismatch_mask)): else: try: mass_mismatches = (np.absolute(ag1.masses - ag2.masses) > tol_mass) - except ValueError: + except ValueError as exc: errmsg = ("Failed to find matching atoms: len(reference) = {}, len(mobile) = {} " "Try to improve your selections for mobile and reference.").format( ag1.n_atoms, ag2.n_atoms) logger.error(errmsg) - raise_from(SelectionError(errmsg), None) + raise SelectionError(errmsg) from exc if np.any(mass_mismatches): # Test 2 failed.