From 8d555eed9ac9777c414d8d530f1f6315ffa0f797 Mon Sep 17 00:00:00 2001 From: IAlibay Date: Mon, 15 Jun 2020 11:58:34 +0100 Subject: [PATCH 1/3] Removes py2 things from coordinates --- package/MDAnalysis/coordinates/DLPoly.py | 5 ---- package/MDAnalysis/coordinates/DMS.py | 2 -- package/MDAnalysis/coordinates/GMS.py | 2 -- package/MDAnalysis/coordinates/GSD.py | 5 +--- package/MDAnalysis/coordinates/INPCRD.py | 3 --- package/MDAnalysis/coordinates/LAMMPS.py | 24 +++++++------------ package/MDAnalysis/coordinates/MMTF.py | 2 -- package/MDAnalysis/coordinates/MOL2.py | 14 ++++------- package/MDAnalysis/coordinates/PDB.py | 17 ++++---------- package/MDAnalysis/coordinates/PDBQT.py | 1 - package/MDAnalysis/coordinates/ParmEd.py | 1 - package/MDAnalysis/coordinates/TXYZ.py | 6 +---- package/MDAnalysis/coordinates/XDR.py | 4 +--- package/MDAnalysis/coordinates/__init__.py | 3 --- package/MDAnalysis/coordinates/chain.py | 2 -- package/MDAnalysis/coordinates/core.py | 13 ++--------- package/MDAnalysis/coordinates/memory.py | 27 +++++++++------------- package/MDAnalysis/coordinates/null.py | 2 -- 18 files changed, 34 insertions(+), 99 deletions(-) diff --git a/package/MDAnalysis/coordinates/DLPoly.py b/package/MDAnalysis/coordinates/DLPoly.py index 5e322e4ffc1..b4e447aabfe 100644 --- a/package/MDAnalysis/coordinates/DLPoly.py +++ b/package/MDAnalysis/coordinates/DLPoly.py @@ -28,11 +28,6 @@ .. _Poly: http://www.stfc.ac.uk/SCD/research/app/ccg/software/DL_POLY/44516.aspx """ -from __future__ import (absolute_import, division, - print_function, unicode_literals) - -from six.moves import range - import numpy as np from . import base diff --git a/package/MDAnalysis/coordinates/DMS.py b/package/MDAnalysis/coordinates/DMS.py index b7e68b43d79..b85a1c9f2a5 100644 --- a/package/MDAnalysis/coordinates/DMS.py +++ b/package/MDAnalysis/coordinates/DMS.py @@ -32,8 +32,6 @@ .. _Desmond: http://www.deshawresearch.com/resources_desmond.html .. _DMS: http://www.deshawresearch.com/Desmond_Users_Guide-0.7.pdf """ -from __future__ import absolute_import - import numpy as np import sqlite3 diff --git a/package/MDAnalysis/coordinates/GMS.py b/package/MDAnalysis/coordinates/GMS.py index 46be3a34c09..fb997c5c732 100644 --- a/package/MDAnalysis/coordinates/GMS.py +++ b/package/MDAnalysis/coordinates/GMS.py @@ -37,8 +37,6 @@ :members: """ -from __future__ import absolute_import - import os import errno import re diff --git a/package/MDAnalysis/coordinates/GSD.py b/package/MDAnalysis/coordinates/GSD.py index e5968e32d34..5d10ef7348c 100644 --- a/package/MDAnalysis/coordinates/GSD.py +++ b/package/MDAnalysis/coordinates/GSD.py @@ -45,9 +45,6 @@ :inherited-members: """ -from __future__ import absolute_import, division -from six import raise_from - import numpy as np import os import gsd.hoomd @@ -103,7 +100,7 @@ def _read_frame(self, frame): try : myframe = self._file[frame] except IndexError: - raise_from(IOError, None) + raise IOError from None # set frame number self._frame = frame diff --git a/package/MDAnalysis/coordinates/INPCRD.py b/package/MDAnalysis/coordinates/INPCRD.py index c92e1f144d8..20bf50472ff 100644 --- a/package/MDAnalysis/coordinates/INPCRD.py +++ b/package/MDAnalysis/coordinates/INPCRD.py @@ -37,9 +37,6 @@ :members: """ -from __future__ import absolute_import, division, print_function, unicode_literals - -from six.moves import range from . import base diff --git a/package/MDAnalysis/coordinates/LAMMPS.py b/package/MDAnalysis/coordinates/LAMMPS.py index 7dd70a26a94..00d32031a4d 100644 --- a/package/MDAnalysis/coordinates/LAMMPS.py +++ b/package/MDAnalysis/coordinates/LAMMPS.py @@ -121,10 +121,6 @@ :inherited-members: """ -from __future__ import absolute_import - -from six.moves import zip, range, map -from six import raise_from import os import numpy as np @@ -161,9 +157,8 @@ def __init__(self, *args, **kwargs): if units.unit_types[unit] != unit_type: raise TypeError("LAMMPS DCDWriter: wrong unit {0!r} for unit type {1!r}".format(unit, unit_type)) except KeyError: - raise_from( - ValueError("LAMMPS DCDWriter: unknown unit {0!r}".format(unit)), - None) + errmsg = f"LAMMPS DCDWriter: unknown unit {unit}" + raise ValueError(errmsg) from None super(DCDWriter, self).__init__(*args, **kwargs) @@ -343,10 +338,9 @@ def _write_bonds(self, bonds): self.f.write('{:d} {:d} '.format(i, int(bond.type))+\ ' '.join((bond.atoms.indices + 1).astype(str))+'\n') except TypeError: - raise_from(TypeError('LAMMPS DATAWriter: Trying to write bond, ' - 'but bond type {} is not ' - 'numerical.'.format(bond.type)), - None) + errmsg = (f"LAMMPS DATAWriter: Trying to write bond, but bond " + f"type {bond.type} is not numerical.") + raise TypeError(errmsg) from None def _write_dimensions(self, dimensions): """Convert dimensions to triclinic vectors, convert lengths to native @@ -405,11 +399,9 @@ def write(self, selection, frame=None): try: atoms.types.astype(np.int32) except ValueError: - raise_from( - ValueError( - 'LAMMPS.DATAWriter: atom types must be ' - 'convertible to integers'), - None) + errmsg = ("LAMMPS.DATAWriter: atom types must be convertible to " + "integers") + raise ValueError(errmsg) from None try: velocities = atoms.velocities diff --git a/package/MDAnalysis/coordinates/MMTF.py b/package/MDAnalysis/coordinates/MMTF.py index f4abc9ac0bb..291ffb8e589 100644 --- a/package/MDAnalysis/coordinates/MMTF.py +++ b/package/MDAnalysis/coordinates/MMTF.py @@ -41,8 +41,6 @@ .. _MMTF: https://mmtf.rcsb.org/ """ -from __future__ import absolute_import - import mmtf from . import base diff --git a/package/MDAnalysis/coordinates/MOL2.py b/package/MDAnalysis/coordinates/MOL2.py index adfb002bf18..f92fbbfe244 100644 --- a/package/MDAnalysis/coordinates/MOL2.py +++ b/package/MDAnalysis/coordinates/MOL2.py @@ -111,9 +111,6 @@ 1 BENZENE 1 PERM 0 **** **** 0 ROOT """ -from __future__ import absolute_import -from six import raise_from - import numpy as np from . import base @@ -219,9 +216,9 @@ def _read_frame(self, frame): try: block = self.frames[frame] except IndexError: - raise_from(IOError("Invalid frame {0} for trajectory with length {1}" - "".format(frame, len(self))), - None) + errmsg = (f"Invalid frame {frame} for trajectory with length " + f"{len(self)}") + raise IOError(errmsg) from None sections, coords = self.parse_block(block) @@ -319,9 +316,8 @@ def encode_block(self, obj): try: molecule = ts.data['molecule'] except KeyError: - raise_from(NotImplementedError( - "MOL2Writer cannot currently write non MOL2 data"), - None) + errmsg = "MOL2Writer cannot currently write non MOL2 data" + raise NotImplementedError(errmsg) from None # Need to remap atom indices to 1 based in this selection mapping = {a: i for i, a in enumerate(obj.atoms, start=1)} diff --git a/package/MDAnalysis/coordinates/PDB.py b/package/MDAnalysis/coordinates/PDB.py index 649bde13808..fa1fac453c3 100644 --- a/package/MDAnalysis/coordinates/PDB.py +++ b/package/MDAnalysis/coordinates/PDB.py @@ -140,11 +140,7 @@ http://www.wwpdb.org/documentation/file-format-content/format32/v3.2.html """ -from __future__ import absolute_import - -from six.moves import range, zip -from six import raise_from, StringIO, BytesIO - +from io import StringIO, BytesIO import os import errno import itertools @@ -394,7 +390,7 @@ def _read_frame(self, frame): start = self._start_offsets[frame] stop = self._stop_offsets[frame] except IndexError: # out of range of known frames - raise_from(IOError, None) + raise IOError from None pos = 0 occupancy = np.ones(self.n_atoms) @@ -940,12 +936,9 @@ def _write_next_frame(self, ts=None, **kwargs): try: ts = self.ts except AttributeError: - raise_from( - NoDataError( - "PBDWriter: no coordinate data to write to " - "trajectory file" - ), - None) + errmsg = ("PBDWriter: no coordinate data to write to " + "trajectory file") + raise NoDataError(errmsg) from None self._check_pdb_coordinates() self._write_timestep(ts, **kwargs) diff --git a/package/MDAnalysis/coordinates/PDBQT.py b/package/MDAnalysis/coordinates/PDBQT.py index 077102adf4d..3152ccca3a2 100644 --- a/package/MDAnalysis/coordinates/PDBQT.py +++ b/package/MDAnalysis/coordinates/PDBQT.py @@ -38,7 +38,6 @@ http://autodock.scripps.edu/ """ -from __future__ import absolute_import import os import errno import itertools diff --git a/package/MDAnalysis/coordinates/ParmEd.py b/package/MDAnalysis/coordinates/ParmEd.py index c35b16103f0..ae88b17a7c1 100644 --- a/package/MDAnalysis/coordinates/ParmEd.py +++ b/package/MDAnalysis/coordinates/ParmEd.py @@ -72,7 +72,6 @@ """ -from __future__ import absolute_import import functools from . import base diff --git a/package/MDAnalysis/coordinates/TXYZ.py b/package/MDAnalysis/coordinates/TXYZ.py index 26cfce894a9..095d82b6206 100644 --- a/package/MDAnalysis/coordinates/TXYZ.py +++ b/package/MDAnalysis/coordinates/TXYZ.py @@ -45,10 +45,6 @@ :inherited-members: """ -from __future__ import absolute_import, division -from six.moves import range -from six import raise_from - import numpy as np import os import errno @@ -155,7 +151,7 @@ def _read_next_timestep(self, ts=None): ts.frame += 1 return ts except (ValueError, IndexError) as err: - raise_from(EOFError(err), None) + raise EOFError(err) from None def _reopen(self): self.close() diff --git a/package/MDAnalysis/coordinates/XDR.py b/package/MDAnalysis/coordinates/XDR.py index 281f1ff0c71..68d7c46d1cf 100644 --- a/package/MDAnalysis/coordinates/XDR.py +++ b/package/MDAnalysis/coordinates/XDR.py @@ -33,8 +33,6 @@ MDAnalysis.coordinates.TRR: Read and write GROMACS TRR trajectory files. MDAnalysis.lib.formats.libmdaxdr: Low level xdr format reader """ -from __future__ import absolute_import -import six import errno import numpy as np @@ -83,7 +81,7 @@ def read_numpy_offsets(filename): """ try: - return {k: v for k, v in six.iteritems(np.load(filename))} + return {k: v for k, v in np.load(filename).items()} except IOError: warnings.warn("Failed to load offsets file {}\n".format(filename)) return False diff --git a/package/MDAnalysis/coordinates/__init__.py b/package/MDAnalysis/coordinates/__init__.py index 361489a9ab0..5bdcff1f4b7 100644 --- a/package/MDAnalysis/coordinates/__init__.py +++ b/package/MDAnalysis/coordinates/__init__.py @@ -707,11 +707,8 @@ class can choose an appropriate reader automatically. raw :class:`~MDAnalysis.coordinates.base.Timestep` objects. """ -from __future__ import absolute_import __all__ = ['reader', 'writer'] -import six - from . import base from .core import reader, writer from . import chain diff --git a/package/MDAnalysis/coordinates/chain.py b/package/MDAnalysis/coordinates/chain.py index 2a7604f78e2..c0c0fea3e53 100644 --- a/package/MDAnalysis/coordinates/chain.py +++ b/package/MDAnalysis/coordinates/chain.py @@ -41,8 +41,6 @@ .. automethod:: _chained_iterator """ -from __future__ import absolute_import - import warnings import os.path diff --git a/package/MDAnalysis/coordinates/core.py b/package/MDAnalysis/coordinates/core.py index 47d05b110bb..45eb7659382 100644 --- a/package/MDAnalysis/coordinates/core.py +++ b/package/MDAnalysis/coordinates/core.py @@ -37,9 +37,6 @@ .. autofunction:: get_writer_for """ -from __future__ import absolute_import - -import six from ..lib import util from ..lib.mdamath import triclinic_box, triclinic_vectors, box_volume @@ -84,14 +81,8 @@ def reader(filename, format=None, **kwargs): try: return Reader(filename, **kwargs) except ValueError: - six.raise_from( - TypeError( - 'Unable to read {fn} with {r}.'.format( - fn=filename, - r=Reader - ) - ), - None) + errmsg = f'Unable to read {filename} with {Reader}.' + raise TypeError(errmsg) from None def writer(filename, n_atoms=None, **kwargs): diff --git a/package/MDAnalysis/coordinates/memory.py b/package/MDAnalysis/coordinates/memory.py index 23966ef1d19..a3a4212c357 100644 --- a/package/MDAnalysis/coordinates/memory.py +++ b/package/MDAnalysis/coordinates/memory.py @@ -184,8 +184,6 @@ :inherited-members: """ -from __future__ import absolute_import -from six import raise_from import logging import errno import numpy as np @@ -319,10 +317,9 @@ def __init__(self, coordinate_array, order='fac', if coordinate_array.ndim == 2 and coordinate_array.shape[1] == 3: coordinate_array = coordinate_array[np.newaxis, :, :] except AttributeError: - raise_from(TypeError("The input has to be a numpy.ndarray that " - "corresponds to the layout specified by the " - "'order' keyword."), - None) + errmsg = ("The input has to be a numpy.ndarray that corresponds " + "to the layout specified by the 'order' keyword.") + raise TypeError(errmsg) from None self.set_array(coordinate_array, order) self.n_frames = \ @@ -334,10 +331,9 @@ def __init__(self, coordinate_array, order='fac', try: velocities = np.asarray(velocities, dtype=np.float32) except ValueError: - raise_from( - TypeError("'velocities' must be array-like got {}" - "".format(type(velocities))), - None) + errmsg = (f"'velocities' must be array-like got " + f"{type(velocities)}") + raise TypeError(errmsg) from None # if single frame, make into array of 1 frame if velocities.ndim == 2: velocities = velocities[np.newaxis, :, :] @@ -354,9 +350,8 @@ def __init__(self, coordinate_array, order='fac', try: forces = np.asarray(forces, dtype=np.float32) except ValueError: - raise_from(TypeError("'forces' must be array like got {}" - "".format(type(forces))), - None) + errmsg = f"'forces' must be array like got {type(forces)}" + raise TypeError(errmsg) from None if forces.ndim == 2: forces = forces[np.newaxis, :, :] if not forces.shape == self.coordinate_array.shape: @@ -386,9 +381,9 @@ def __init__(self, coordinate_array, order='fac', try: dimensions = np.asarray(dimensions, dtype=np.float32) except ValueError: - raise_from(TypeError("'dimensions' must be array-like got {}" - "".format(type(dimensions))), - None) + errmsg = (f"'dimensions' must be array-like got " + f"{type(dimensions)}") + raise TypeError(errmsg) from None if dimensions.shape == (6,): # single box, tile this to trajectory length # allows modifying the box of some frames diff --git a/package/MDAnalysis/coordinates/null.py b/package/MDAnalysis/coordinates/null.py index 23a30a935d5..649d5a29755 100644 --- a/package/MDAnalysis/coordinates/null.py +++ b/package/MDAnalysis/coordinates/null.py @@ -37,8 +37,6 @@ :members: """ -from __future__ import absolute_import - from . import base From 4c0f0451150537d0107e93b9647a78fd774b2732 Mon Sep 17 00:00:00 2001 From: IAlibay Date: Mon, 15 Jun 2020 12:02:53 +0100 Subject: [PATCH 2/3] Removes py2 things from coordinate tests --- testsuite/MDAnalysisTests/coordinates/base.py | 2 -- testsuite/MDAnalysisTests/coordinates/reference.py | 1 - testsuite/MDAnalysisTests/coordinates/test_amber_inpcrd.py | 3 --- testsuite/MDAnalysisTests/coordinates/test_chemfiles.py | 2 -- testsuite/MDAnalysisTests/coordinates/test_copying.py | 2 -- testsuite/MDAnalysisTests/coordinates/test_crd.py | 3 --- testsuite/MDAnalysisTests/coordinates/test_dlpoly.py | 2 -- testsuite/MDAnalysisTests/coordinates/test_dms.py | 1 - testsuite/MDAnalysisTests/coordinates/test_fhiaims.py | 7 +------ testsuite/MDAnalysisTests/coordinates/test_gms.py | 3 --- testsuite/MDAnalysisTests/coordinates/test_gro.py | 3 +-- testsuite/MDAnalysisTests/coordinates/test_gsd.py | 2 -- testsuite/MDAnalysisTests/coordinates/test_memory.py | 1 - testsuite/MDAnalysisTests/coordinates/test_mmtf.py | 2 -- testsuite/MDAnalysisTests/coordinates/test_mol2.py | 3 --- testsuite/MDAnalysisTests/coordinates/test_namdbin.py | 3 --- testsuite/MDAnalysisTests/coordinates/test_null.py | 2 -- testsuite/MDAnalysisTests/coordinates/test_parmed.py | 2 -- testsuite/MDAnalysisTests/coordinates/test_pdb.py | 5 +---- testsuite/MDAnalysisTests/coordinates/test_pdbqt.py | 2 -- testsuite/MDAnalysisTests/coordinates/test_pqr.py | 1 - testsuite/MDAnalysisTests/coordinates/test_reader_api.py | 2 -- testsuite/MDAnalysisTests/coordinates/test_timestep_api.py | 2 -- testsuite/MDAnalysisTests/coordinates/test_trj.py | 1 - testsuite/MDAnalysisTests/coordinates/test_txyz.py | 3 --- testsuite/MDAnalysisTests/coordinates/test_windows.py | 2 -- .../coordinates/test_writer_registration.py | 2 -- 27 files changed, 3 insertions(+), 61 deletions(-) diff --git a/testsuite/MDAnalysisTests/coordinates/base.py b/testsuite/MDAnalysisTests/coordinates/base.py index 902ec1d9a34..d874a3d24b6 100644 --- a/testsuite/MDAnalysisTests/coordinates/base.py +++ b/testsuite/MDAnalysisTests/coordinates/base.py @@ -20,11 +20,9 @@ # MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations. # J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787 # -from __future__ import absolute_import import itertools import numpy as np import pytest -from six.moves import zip, range from unittest import TestCase from numpy.testing import (assert_equal, assert_almost_equal, assert_array_almost_equal, assert_allclose) diff --git a/testsuite/MDAnalysisTests/coordinates/reference.py b/testsuite/MDAnalysisTests/coordinates/reference.py index b195d0d5394..2d2ec036bb5 100644 --- a/testsuite/MDAnalysisTests/coordinates/reference.py +++ b/testsuite/MDAnalysisTests/coordinates/reference.py @@ -20,7 +20,6 @@ # MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations. # J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787 # -from __future__ import absolute_import import numpy as np from MDAnalysisTests import datafiles diff --git a/testsuite/MDAnalysisTests/coordinates/test_amber_inpcrd.py b/testsuite/MDAnalysisTests/coordinates/test_amber_inpcrd.py index 38720f74195..859db99b797 100644 --- a/testsuite/MDAnalysisTests/coordinates/test_amber_inpcrd.py +++ b/testsuite/MDAnalysisTests/coordinates/test_amber_inpcrd.py @@ -20,10 +20,7 @@ # MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations. # J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787 # -from __future__ import absolute_import - import numpy as np -from six.moves import zip from numpy.testing import (assert_allclose, assert_equal) diff --git a/testsuite/MDAnalysisTests/coordinates/test_chemfiles.py b/testsuite/MDAnalysisTests/coordinates/test_chemfiles.py index 21dd97759c9..ee2ff8da817 100644 --- a/testsuite/MDAnalysisTests/coordinates/test_chemfiles.py +++ b/testsuite/MDAnalysisTests/coordinates/test_chemfiles.py @@ -19,8 +19,6 @@ # MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations. # J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787 # -from __future__ import absolute_import - import numpy as np import pytest diff --git a/testsuite/MDAnalysisTests/coordinates/test_copying.py b/testsuite/MDAnalysisTests/coordinates/test_copying.py index 70e9acce867..26a5f60d621 100644 --- a/testsuite/MDAnalysisTests/coordinates/test_copying.py +++ b/testsuite/MDAnalysisTests/coordinates/test_copying.py @@ -20,8 +20,6 @@ # MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations. # J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787 # -from __future__ import absolute_import - import numpy as np try: from numpy import shares_memory diff --git a/testsuite/MDAnalysisTests/coordinates/test_crd.py b/testsuite/MDAnalysisTests/coordinates/test_crd.py index 4b32632f853..783a79e372d 100644 --- a/testsuite/MDAnalysisTests/coordinates/test_crd.py +++ b/testsuite/MDAnalysisTests/coordinates/test_crd.py @@ -20,9 +20,6 @@ # MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations. # J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787 # -from __future__ import absolute_import - -from six.moves import zip from collections import OrderedDict import pytest diff --git a/testsuite/MDAnalysisTests/coordinates/test_dlpoly.py b/testsuite/MDAnalysisTests/coordinates/test_dlpoly.py index ca20c66eced..fea3734b9d7 100644 --- a/testsuite/MDAnalysisTests/coordinates/test_dlpoly.py +++ b/testsuite/MDAnalysisTests/coordinates/test_dlpoly.py @@ -20,11 +20,9 @@ # MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations. # J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787 # -from __future__ import absolute_import import MDAnalysis as mda import numpy as np import pytest -from six.moves import zip from numpy.testing import (assert_equal, assert_allclose) diff --git a/testsuite/MDAnalysisTests/coordinates/test_dms.py b/testsuite/MDAnalysisTests/coordinates/test_dms.py index ad2acf06704..53804692d2b 100644 --- a/testsuite/MDAnalysisTests/coordinates/test_dms.py +++ b/testsuite/MDAnalysisTests/coordinates/test_dms.py @@ -20,7 +20,6 @@ # MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations. # J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787 # -from __future__ import absolute_import import MDAnalysis as mda import numpy as np import pytest diff --git a/testsuite/MDAnalysisTests/coordinates/test_fhiaims.py b/testsuite/MDAnalysisTests/coordinates/test_fhiaims.py index 5295697d405..ebdf0411769 100644 --- a/testsuite/MDAnalysisTests/coordinates/test_fhiaims.py +++ b/testsuite/MDAnalysisTests/coordinates/test_fhiaims.py @@ -20,11 +20,8 @@ # MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations. # J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787 # -from __future__ import absolute_import - import pytest -from six import StringIO -from six.moves import zip +from io import StringIO import os import MDAnalysis as mda @@ -37,8 +34,6 @@ assert_array_almost_equal, assert_almost_equal) -from six import StringIO - @pytest.fixture(scope='module') def universe(): diff --git a/testsuite/MDAnalysisTests/coordinates/test_gms.py b/testsuite/MDAnalysisTests/coordinates/test_gms.py index 3a6d293c355..c8219d3b1f3 100644 --- a/testsuite/MDAnalysisTests/coordinates/test_gms.py +++ b/testsuite/MDAnalysisTests/coordinates/test_gms.py @@ -20,10 +20,7 @@ # MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations. # J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787 # -from __future__ import absolute_import - import pytest -from six.moves import range import MDAnalysis as mda import numpy as np diff --git a/testsuite/MDAnalysisTests/coordinates/test_gro.py b/testsuite/MDAnalysisTests/coordinates/test_gro.py index 6577ecc73ab..b9d7225ca4f 100644 --- a/testsuite/MDAnalysisTests/coordinates/test_gro.py +++ b/testsuite/MDAnalysisTests/coordinates/test_gro.py @@ -20,7 +20,6 @@ # MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations. # J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787 # -from __future__ import absolute_import import MDAnalysis as mda import numpy as np from MDAnalysis.coordinates.GRO import GROReader, GROWriter @@ -44,7 +43,7 @@ assert_equal, ) import pytest -from six import StringIO +from io import StringIO class TestGROReaderOld(RefAdK): diff --git a/testsuite/MDAnalysisTests/coordinates/test_gsd.py b/testsuite/MDAnalysisTests/coordinates/test_gsd.py index 9c2f19e01d4..01a8db1485e 100644 --- a/testsuite/MDAnalysisTests/coordinates/test_gsd.py +++ b/testsuite/MDAnalysisTests/coordinates/test_gsd.py @@ -20,8 +20,6 @@ # MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations. # J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787 # -from __future__ import absolute_import - import pytest from numpy.testing import assert_almost_equal diff --git a/testsuite/MDAnalysisTests/coordinates/test_memory.py b/testsuite/MDAnalysisTests/coordinates/test_memory.py index 2e71fe9c2c0..de715add188 100644 --- a/testsuite/MDAnalysisTests/coordinates/test_memory.py +++ b/testsuite/MDAnalysisTests/coordinates/test_memory.py @@ -20,7 +20,6 @@ # MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations. # J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787 # -from __future__ import absolute_import import numpy as np import MDAnalysis as mda diff --git a/testsuite/MDAnalysisTests/coordinates/test_mmtf.py b/testsuite/MDAnalysisTests/coordinates/test_mmtf.py index 7270964bc29..90e2da39145 100644 --- a/testsuite/MDAnalysisTests/coordinates/test_mmtf.py +++ b/testsuite/MDAnalysisTests/coordinates/test_mmtf.py @@ -20,8 +20,6 @@ # MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations. # J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787 # -from __future__ import division, absolute_import - import pytest import numpy as np from numpy.testing import ( diff --git a/testsuite/MDAnalysisTests/coordinates/test_mol2.py b/testsuite/MDAnalysisTests/coordinates/test_mol2.py index b42f2d2b068..c5fb1650d15 100644 --- a/testsuite/MDAnalysisTests/coordinates/test_mol2.py +++ b/testsuite/MDAnalysisTests/coordinates/test_mol2.py @@ -20,10 +20,7 @@ # MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations. # J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787 # -from __future__ import absolute_import - import pytest -from six.moves import range import os from numpy.testing import ( diff --git a/testsuite/MDAnalysisTests/coordinates/test_namdbin.py b/testsuite/MDAnalysisTests/coordinates/test_namdbin.py index e2c0ef0ca04..d24835c0b66 100644 --- a/testsuite/MDAnalysisTests/coordinates/test_namdbin.py +++ b/testsuite/MDAnalysisTests/coordinates/test_namdbin.py @@ -20,10 +20,7 @@ # MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations. # J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787 # -from __future__ import absolute_import - import numpy as np -from six.moves import zip import os import pytest diff --git a/testsuite/MDAnalysisTests/coordinates/test_null.py b/testsuite/MDAnalysisTests/coordinates/test_null.py index 847dfb76aee..d91823df0c9 100644 --- a/testsuite/MDAnalysisTests/coordinates/test_null.py +++ b/testsuite/MDAnalysisTests/coordinates/test_null.py @@ -20,8 +20,6 @@ # MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations. # J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787 # -from __future__ import absolute_import - import MDAnalysis as mda import pytest diff --git a/testsuite/MDAnalysisTests/coordinates/test_parmed.py b/testsuite/MDAnalysisTests/coordinates/test_parmed.py index a1fe4e44326..6355090ece6 100644 --- a/testsuite/MDAnalysisTests/coordinates/test_parmed.py +++ b/testsuite/MDAnalysisTests/coordinates/test_parmed.py @@ -20,8 +20,6 @@ # MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations. # J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787 # -from __future__ import absolute_import - import pytest import MDAnalysis as mda diff --git a/testsuite/MDAnalysisTests/coordinates/test_pdb.py b/testsuite/MDAnalysisTests/coordinates/test_pdb.py index 0c20fb59e23..c337d54dbba 100644 --- a/testsuite/MDAnalysisTests/coordinates/test_pdb.py +++ b/testsuite/MDAnalysisTests/coordinates/test_pdb.py @@ -20,11 +20,8 @@ # MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations. # J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787 # -from __future__ import absolute_import - import pytest -from six import StringIO -from six.moves import zip +from io import StringIO import os import MDAnalysis as mda diff --git a/testsuite/MDAnalysisTests/coordinates/test_pdbqt.py b/testsuite/MDAnalysisTests/coordinates/test_pdbqt.py index fabb2927cbf..667ed61aa36 100644 --- a/testsuite/MDAnalysisTests/coordinates/test_pdbqt.py +++ b/testsuite/MDAnalysisTests/coordinates/test_pdbqt.py @@ -20,8 +20,6 @@ # MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations. # J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787 # -from __future__ import absolute_import - import MDAnalysis as mda from MDAnalysisTests.datafiles import PDBQT_input, PDBQT_querypdb from MDAnalysis.lib.NeighborSearch import AtomNeighborSearch diff --git a/testsuite/MDAnalysisTests/coordinates/test_pqr.py b/testsuite/MDAnalysisTests/coordinates/test_pqr.py index 8dd91cef2a6..daf1b64d818 100644 --- a/testsuite/MDAnalysisTests/coordinates/test_pqr.py +++ b/testsuite/MDAnalysisTests/coordinates/test_pqr.py @@ -20,7 +20,6 @@ # MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations. # J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787 # -from __future__ import absolute_import import MDAnalysis as mda import os import pytest diff --git a/testsuite/MDAnalysisTests/coordinates/test_reader_api.py b/testsuite/MDAnalysisTests/coordinates/test_reader_api.py index 0017f511af8..11a3fbaef36 100644 --- a/testsuite/MDAnalysisTests/coordinates/test_reader_api.py +++ b/testsuite/MDAnalysisTests/coordinates/test_reader_api.py @@ -20,8 +20,6 @@ # MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations. # J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787 # -from __future__ import absolute_import - import numpy as np from collections import OrderedDict from MDAnalysis.coordinates.base import ( diff --git a/testsuite/MDAnalysisTests/coordinates/test_timestep_api.py b/testsuite/MDAnalysisTests/coordinates/test_timestep_api.py index 7318681ac9a..7622f46bf5b 100644 --- a/testsuite/MDAnalysisTests/coordinates/test_timestep_api.py +++ b/testsuite/MDAnalysisTests/coordinates/test_timestep_api.py @@ -26,8 +26,6 @@ _TestTimestepInterface tests the Readers are correctly using Timesteps """ -from __future__ import absolute_import - import numpy as np from numpy.testing import assert_equal diff --git a/testsuite/MDAnalysisTests/coordinates/test_trj.py b/testsuite/MDAnalysisTests/coordinates/test_trj.py index e0545a14e61..a1900ca97e0 100644 --- a/testsuite/MDAnalysisTests/coordinates/test_trj.py +++ b/testsuite/MDAnalysisTests/coordinates/test_trj.py @@ -20,7 +20,6 @@ # MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations. # J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787 # -from __future__ import absolute_import import MDAnalysis as mda import numpy as np import pytest diff --git a/testsuite/MDAnalysisTests/coordinates/test_txyz.py b/testsuite/MDAnalysisTests/coordinates/test_txyz.py index 2bcaa4f87ff..a92089983b6 100644 --- a/testsuite/MDAnalysisTests/coordinates/test_txyz.py +++ b/testsuite/MDAnalysisTests/coordinates/test_txyz.py @@ -20,11 +20,8 @@ # MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations. # J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787 # -from __future__ import absolute_import - import pytest from numpy.testing import assert_almost_equal -from six.moves import zip from MDAnalysisTests.datafiles import TXYZ, ARC, ARC_PBC diff --git a/testsuite/MDAnalysisTests/coordinates/test_windows.py b/testsuite/MDAnalysisTests/coordinates/test_windows.py index 314a235a1e8..1375f92a17e 100644 --- a/testsuite/MDAnalysisTests/coordinates/test_windows.py +++ b/testsuite/MDAnalysisTests/coordinates/test_windows.py @@ -30,8 +30,6 @@ line ending files. """ -from __future__ import absolute_import - import numpy as np import pytest from numpy.testing import assert_almost_equal, assert_equal diff --git a/testsuite/MDAnalysisTests/coordinates/test_writer_registration.py b/testsuite/MDAnalysisTests/coordinates/test_writer_registration.py index 4021bc058f5..839516070ed 100644 --- a/testsuite/MDAnalysisTests/coordinates/test_writer_registration.py +++ b/testsuite/MDAnalysisTests/coordinates/test_writer_registration.py @@ -20,8 +20,6 @@ # MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations. # J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787 # -from __future__ import absolute_import - import pytest import MDAnalysis as mda From a71e67a13fc2fbf9f8c186b7f6084dbe21981c72 Mon Sep 17 00:00:00 2001 From: IAlibay Date: Mon, 15 Jun 2020 13:18:33 +0100 Subject: [PATCH 3/3] Removes py2 things from topology --- package/MDAnalysis/topology/CRDParser.py | 9 +++------ package/MDAnalysis/topology/DLPolyParser.py | 3 --- package/MDAnalysis/topology/DMSParser.py | 13 ++++--------- .../MDAnalysis/topology/ExtendedPDBParser.py | 1 - package/MDAnalysis/topology/FHIAIMSParser.py | 3 --- package/MDAnalysis/topology/GMSParser.py | 2 -- package/MDAnalysis/topology/GROParser.py | 13 ++++--------- package/MDAnalysis/topology/GSDParser.py | 2 -- package/MDAnalysis/topology/HoomdXMLParser.py | 2 -- package/MDAnalysis/topology/ITPParser.py | 3 +-- package/MDAnalysis/topology/LAMMPSParser.py | 17 +++++------------ package/MDAnalysis/topology/MMTFParser.py | 3 --- package/MDAnalysis/topology/MOL2Parser.py | 2 -- package/MDAnalysis/topology/MinimalParser.py | 1 - package/MDAnalysis/topology/PDBParser.py | 3 --- package/MDAnalysis/topology/PDBQTParser.py | 2 -- package/MDAnalysis/topology/PQRParser.py | 2 -- package/MDAnalysis/topology/PSFParser.py | 9 ++------- package/MDAnalysis/topology/ParmEdParser.py | 4 ---- package/MDAnalysis/topology/TOPParser.py | 12 +++--------- package/MDAnalysis/topology/TPRParser.py | 1 - package/MDAnalysis/topology/TXYZParser.py | 3 --- package/MDAnalysis/topology/XYZParser.py | 3 --- package/MDAnalysis/topology/__init__.py | 1 - package/MDAnalysis/topology/base.py | 6 +----- package/MDAnalysis/topology/core.py | 3 --- package/MDAnalysis/topology/guessers.py | 2 -- package/MDAnalysis/topology/tables.py | 1 - package/MDAnalysis/topology/tpr/__init__.py | 2 -- package/MDAnalysis/topology/tpr/obj.py | 4 ---- package/MDAnalysis/topology/tpr/setting.py | 3 --- package/MDAnalysis/topology/tpr/utils.py | 3 --- testsuite/MDAnalysisTests/topology/base.py | 2 -- testsuite/MDAnalysisTests/topology/test_crd.py | 2 -- .../MDAnalysisTests/topology/test_dlpoly.py | 1 - testsuite/MDAnalysisTests/topology/test_dms.py | 2 -- .../MDAnalysisTests/topology/test_fhiaims.py | 2 -- testsuite/MDAnalysisTests/topology/test_gms.py | 2 -- testsuite/MDAnalysisTests/topology/test_gro.py | 2 -- testsuite/MDAnalysisTests/topology/test_gsd.py | 2 -- .../MDAnalysisTests/topology/test_guessers.py | 2 -- .../MDAnalysisTests/topology/test_hoomdxml.py | 2 -- testsuite/MDAnalysisTests/topology/test_itp.py | 3 +-- .../MDAnalysisTests/topology/test_lammpsdata.py | 4 +--- .../MDAnalysisTests/topology/test_minimal.py | 2 -- testsuite/MDAnalysisTests/topology/test_mmtf.py | 2 -- testsuite/MDAnalysisTests/topology/test_mol2.py | 2 -- .../MDAnalysisTests/topology/test_parmed.py | 2 -- testsuite/MDAnalysisTests/topology/test_pdb.py | 4 +--- .../MDAnalysisTests/topology/test_pdbqt.py | 2 -- testsuite/MDAnalysisTests/topology/test_pqr.py | 4 +--- testsuite/MDAnalysisTests/topology/test_psf.py | 1 - testsuite/MDAnalysisTests/topology/test_top.py | 1 - .../topology/test_topology_base.py | 1 - .../topology/test_topology_str_types.py | 6 +----- .../MDAnalysisTests/topology/test_tprparser.py | 2 -- testsuite/MDAnalysisTests/topology/test_txyz.py | 2 -- testsuite/MDAnalysisTests/topology/test_xpdb.py | 1 - testsuite/MDAnalysisTests/topology/test_xyz.py | 2 -- 59 files changed, 28 insertions(+), 170 deletions(-) diff --git a/package/MDAnalysis/topology/CRDParser.py b/package/MDAnalysis/topology/CRDParser.py index fa2e287a0e0..05dbe9d4298 100644 --- a/package/MDAnalysis/topology/CRDParser.py +++ b/package/MDAnalysis/topology/CRDParser.py @@ -45,9 +45,6 @@ :inherited-members: """ -from __future__ import absolute_import -from six import raise_from - import numpy as np from ..lib.util import openany, FORTRANReader @@ -123,9 +120,9 @@ def parse(self, **kwargs): (serial, resnum, resName, name, x, y, z, segid, resid, tempFactor) = r.read(line) except Exception: - raise_from(ValueError("Check CRD format at line {0}: {1}" - "".format(linenum + 1, line.rstrip())), - None) + errmsg = (f"Check CRD format at line {linenum + 1}: " + f"{line.rstrip()}") + raise ValueError(errmsg) from None atomids.append(serial) atomnames.append(name) diff --git a/package/MDAnalysis/topology/DLPolyParser.py b/package/MDAnalysis/topology/DLPolyParser.py index 4b8f884ff71..5ee28eabce6 100644 --- a/package/MDAnalysis/topology/DLPolyParser.py +++ b/package/MDAnalysis/topology/DLPolyParser.py @@ -35,9 +35,6 @@ .. _Poly: http://www.stfc.ac.uk/SCD/research/app/ccg/software/DL_POLY/44516.aspx """ -from __future__ import (absolute_import, division, - print_function, unicode_literals) - import numpy as np from . import guessers diff --git a/package/MDAnalysis/topology/DMSParser.py b/package/MDAnalysis/topology/DMSParser.py index ef5f2b99aba..42515792e0f 100644 --- a/package/MDAnalysis/topology/DMSParser.py +++ b/package/MDAnalysis/topology/DMSParser.py @@ -40,9 +40,6 @@ :inherited-members: """ -from __future__ import absolute_import -from six import raise_from - import numpy as np import sqlite3 import os @@ -142,9 +139,8 @@ def dict_factory(cursor, row): ''.format(attrname)) vals = cur.fetchall() except sqlite3.DatabaseError: - raise_from( - IOError("Failed reading the atoms from DMS Database"), - None) + errmsg = "Failed reading the atoms from DMS Database" + raise IOError(errmsg) from None else: attrs[attrname] = np.array(vals, dtype=dt) @@ -153,9 +149,8 @@ def dict_factory(cursor, row): cur.execute('SELECT * FROM bond') bonds = cur.fetchall() except sqlite3.DatabaseError: - raise_from( - IOError("Failed reading the bonds from DMS Database"), - None) + errmsg = "Failed reading the bonds from DMS Database" + raise IOError(errmsg) from None else: bondlist = [] bondorder = {} diff --git a/package/MDAnalysis/topology/ExtendedPDBParser.py b/package/MDAnalysis/topology/ExtendedPDBParser.py index 8ad9bf999a7..256f0eebc88 100644 --- a/package/MDAnalysis/topology/ExtendedPDBParser.py +++ b/package/MDAnalysis/topology/ExtendedPDBParser.py @@ -53,7 +53,6 @@ :inherited-members: """ -from __future__ import absolute_import from . import PDBParser diff --git a/package/MDAnalysis/topology/FHIAIMSParser.py b/package/MDAnalysis/topology/FHIAIMSParser.py index 1965796b5b7..688a3e1626c 100644 --- a/package/MDAnalysis/topology/FHIAIMSParser.py +++ b/package/MDAnalysis/topology/FHIAIMSParser.py @@ -45,9 +45,6 @@ :inherited-members: """ -from __future__ import absolute_import - -from six.moves import range import numpy as np from . import guessers diff --git a/package/MDAnalysis/topology/GMSParser.py b/package/MDAnalysis/topology/GMSParser.py index 26075c20c0e..022fb990708 100644 --- a/package/MDAnalysis/topology/GMSParser.py +++ b/package/MDAnalysis/topology/GMSParser.py @@ -45,8 +45,6 @@ :inherited-members: """ -from __future__ import absolute_import - import re import numpy as np diff --git a/package/MDAnalysis/topology/GROParser.py b/package/MDAnalysis/topology/GROParser.py index 3cddcdc114e..23fb0af5655 100644 --- a/package/MDAnalysis/topology/GROParser.py +++ b/package/MDAnalysis/topology/GROParser.py @@ -44,11 +44,7 @@ :inherited-members: """ -from __future__ import absolute_import - import numpy as np -from six.moves import range -from six import raise_from from ..lib.util import openany from ..core.topologyattrs import ( @@ -104,11 +100,10 @@ def parse(self, **kwargs): names[i] = line[10:15].strip() indices[i] = int(line[15:20]) except (ValueError, TypeError): - raise_from( - IOError(( - "Couldn't read the following line of the .gro file:\n" - "{0}").format(line)), - None) + errmsg = ( + f"Couldn't read the following line of the .gro file:\n" + f"{line}") + raise IOError(errmsg) from None # Check all lines had names if not np.all(names): missing = np.where(names == '') diff --git a/package/MDAnalysis/topology/GSDParser.py b/package/MDAnalysis/topology/GSDParser.py index 57dc4f62b9b..c093c73cec4 100644 --- a/package/MDAnalysis/topology/GSDParser.py +++ b/package/MDAnalysis/topology/GSDParser.py @@ -51,8 +51,6 @@ :inherited-members: """ -from __future__ import absolute_import - import os import gsd.hoomd import numpy as np diff --git a/package/MDAnalysis/topology/HoomdXMLParser.py b/package/MDAnalysis/topology/HoomdXMLParser.py index 94b5b1149c4..5a0f5da1aae 100644 --- a/package/MDAnalysis/topology/HoomdXMLParser.py +++ b/package/MDAnalysis/topology/HoomdXMLParser.py @@ -46,8 +46,6 @@ :inherited-members: """ -from __future__ import absolute_import - import xml.etree.ElementTree as ET import numpy as np diff --git a/package/MDAnalysis/topology/ITPParser.py b/package/MDAnalysis/topology/ITPParser.py index 47c80c6ceaf..e2962632781 100644 --- a/package/MDAnalysis/topology/ITPParser.py +++ b/package/MDAnalysis/topology/ITPParser.py @@ -122,7 +122,6 @@ :inherited-members: """ -from __future__ import absolute_import from collections import defaultdict import os @@ -646,4 +645,4 @@ def build_system(self): self.residx.extend(residx) for system_param, mol_param in zip(self.params, params): - system_param.update(mol_param) \ No newline at end of file + system_param.update(mol_param) diff --git a/package/MDAnalysis/topology/LAMMPSParser.py b/package/MDAnalysis/topology/LAMMPSParser.py index 1e84cc5525a..699bc7e1a8c 100644 --- a/package/MDAnalysis/topology/LAMMPSParser.py +++ b/package/MDAnalysis/topology/LAMMPSParser.py @@ -75,11 +75,6 @@ """ -from __future__ import absolute_import, print_function - -from six.moves import range -from six import raise_from - import numpy as np import logging import string @@ -285,12 +280,11 @@ def parse(self, **kwargs): try: top = self._parse_atoms(sects['Atoms'], masses) except Exception: - raise_from(ValueError( + errmsg = ( "Failed to parse atoms section. You can supply a description " "of the atom_style as a keyword argument, " - "eg mda.Universe(..., atom_style='id resid x y z')" - ), - None) + "eg mda.Universe(..., atom_style='id resid x y z')") + raise ValueError(errmsg) from None # create mapping of id to index (ie atom id 10 might be the 0th atom) mapping = {atom_id: i for i, atom_id in enumerate(top.ids.values)} @@ -336,9 +330,8 @@ def read_DATA_timestep(self, n_atoms, TS_class, TS_kwargs, try: positions, ordering = self._parse_pos(sects['Atoms']) except KeyError as err: - raise_from( - IOError("Position information not found: {}".format(err)), - None) + errmsg = f"Position information not found: {err}" + raise IOError(errmsg) from None if 'Velocities' in sects: velocities = self._parse_vel(sects['Velocities'], ordering) diff --git a/package/MDAnalysis/topology/MMTFParser.py b/package/MDAnalysis/topology/MMTFParser.py index fbaa4dcc24b..3cce8d5e131 100644 --- a/package/MDAnalysis/topology/MMTFParser.py +++ b/package/MDAnalysis/topology/MMTFParser.py @@ -66,9 +66,6 @@ .. _Macromolecular Transmission Format (MMTF) format: https://mmtf.rcsb.org/ """ -from __future__ import absolute_import -from six.moves import zip - from collections import defaultdict import mmtf import numpy as np diff --git a/package/MDAnalysis/topology/MOL2Parser.py b/package/MDAnalysis/topology/MOL2Parser.py index 5a5bb733a9a..9a765449245 100644 --- a/package/MDAnalysis/topology/MOL2Parser.py +++ b/package/MDAnalysis/topology/MOL2Parser.py @@ -41,8 +41,6 @@ :inherited-members: """ -from __future__ import absolute_import - import os import numpy as np diff --git a/package/MDAnalysis/topology/MinimalParser.py b/package/MDAnalysis/topology/MinimalParser.py index b8c51d77537..6265018dde3 100644 --- a/package/MDAnalysis/topology/MinimalParser.py +++ b/package/MDAnalysis/topology/MinimalParser.py @@ -39,7 +39,6 @@ :inherited-members: """ -from __future__ import absolute_import from ..core._get_readers import get_reader_for from ..core.topology import Topology diff --git a/package/MDAnalysis/topology/PDBParser.py b/package/MDAnalysis/topology/PDBParser.py index d2865ed0e42..1e6f85739dd 100644 --- a/package/MDAnalysis/topology/PDBParser.py +++ b/package/MDAnalysis/topology/PDBParser.py @@ -60,12 +60,9 @@ :inherited-members: """ -from __future__ import absolute_import, print_function - import numpy as np import warnings -from six.moves import range from .guessers import guess_masses, guess_types from .tables import SYMB2Z from ..lib import util diff --git a/package/MDAnalysis/topology/PDBQTParser.py b/package/MDAnalysis/topology/PDBQTParser.py index 116d06df865..f9a6f97f184 100644 --- a/package/MDAnalysis/topology/PDBQTParser.py +++ b/package/MDAnalysis/topology/PDBQTParser.py @@ -55,8 +55,6 @@ .. _AutoDock: http://autodock.scripps.edu/ """ -from __future__ import absolute_import - import numpy as np from . import guessers diff --git a/package/MDAnalysis/topology/PQRParser.py b/package/MDAnalysis/topology/PQRParser.py index dcee1b845e2..e5f7b6415b4 100644 --- a/package/MDAnalysis/topology/PQRParser.py +++ b/package/MDAnalysis/topology/PQRParser.py @@ -47,8 +47,6 @@ .. _PDB: http://www.wwpdb.org/documentation/file-format """ -from __future__ import absolute_import - import numpy as np from . import guessers diff --git a/package/MDAnalysis/topology/PSFParser.py b/package/MDAnalysis/topology/PSFParser.py index 0ed22f45517..b2a7095d07f 100644 --- a/package/MDAnalysis/topology/PSFParser.py +++ b/package/MDAnalysis/topology/PSFParser.py @@ -43,10 +43,6 @@ :inherited-members: """ -from __future__ import absolute_import, division -from six.moves import range -from six import raise_from - import logging import functools from math import ceil @@ -280,10 +276,9 @@ def _parseatoms(self, lines, atoms_per, numlines): try: line = lines() except StopIteration: - err = ("{0} is not valid PSF file" - "".format(self.filename)) + err = f"{self.filename} is not valid PSF file" logger.error(err) - raise_from(ValueError(err), None) + raise ValueError(err) from None try: vals = set_type(atom_parser(line)) except ValueError: diff --git a/package/MDAnalysis/topology/ParmEdParser.py b/package/MDAnalysis/topology/ParmEdParser.py index 02db106807f..2961f8c4d17 100644 --- a/package/MDAnalysis/topology/ParmEdParser.py +++ b/package/MDAnalysis/topology/ParmEdParser.py @@ -80,10 +80,6 @@ :inherited-members: """ -from __future__ import absolute_import, division -from six.moves import range -from six import raise_from - import logging import functools from math import ceil diff --git a/package/MDAnalysis/topology/TOPParser.py b/package/MDAnalysis/topology/TOPParser.py index 5e38d578173..7e45727309b 100644 --- a/package/MDAnalysis/topology/TOPParser.py +++ b/package/MDAnalysis/topology/TOPParser.py @@ -88,10 +88,6 @@ :inherited-members: """ -from __future__ import absolute_import, division - -from six.moves import range, zip -from six import raise_from import numpy as np import itertools @@ -258,11 +254,9 @@ def next_getter(): try: next_section = line.split("%FLAG")[1].strip() except IndexError: - raise_from( - IndexError(( - "%FLAG section not found, formatting error " - "for PARM7 file {0} ").format(self.filename)), - None) + errmsg = (f"%FLAG section not found, formatting error " + f"for PARM7 file {self.filename} ") + raise IndexError(errmsg) from None # strip out a few values to play with them n_atoms = len(attrs['name']) diff --git a/package/MDAnalysis/topology/TPRParser.py b/package/MDAnalysis/topology/TPRParser.py index 1ac58c6fae9..1f495b369ac 100644 --- a/package/MDAnalysis/topology/TPRParser.py +++ b/package/MDAnalysis/topology/TPRParser.py @@ -146,7 +146,6 @@ .. _`Issue 2428`: https://github.com/MDAnalysis/mdanalysis/issues/2428 """ -from __future__ import absolute_import __author__ = "Zhuyi Xue" __copyright__ = "GNU Public Licence, v2" diff --git a/package/MDAnalysis/topology/TXYZParser.py b/package/MDAnalysis/topology/TXYZParser.py index 1a75ea2b073..ec737d31a61 100644 --- a/package/MDAnalysis/topology/TXYZParser.py +++ b/package/MDAnalysis/topology/TXYZParser.py @@ -43,11 +43,8 @@ """ -from __future__ import absolute_import - import itertools import numpy as np -from six.moves import zip from . import guessers from ..lib.util import openany diff --git a/package/MDAnalysis/topology/XYZParser.py b/package/MDAnalysis/topology/XYZParser.py index 66f05a5eb2d..4162e343517 100644 --- a/package/MDAnalysis/topology/XYZParser.py +++ b/package/MDAnalysis/topology/XYZParser.py @@ -38,9 +38,6 @@ :members: """ -from __future__ import absolute_import - -from six.moves import range import numpy as np from . import guessers diff --git a/package/MDAnalysis/topology/__init__.py b/package/MDAnalysis/topology/__init__.py index b12bddaf9a0..415343d813d 100644 --- a/package/MDAnalysis/topology/__init__.py +++ b/package/MDAnalysis/topology/__init__.py @@ -302,7 +302,6 @@ to the second atom. """ -from __future__ import absolute_import __all__ = ['core', 'PSFParser', 'PDBParser', 'PQRParser', 'GROParser', 'CRDParser', 'TOPParser', 'PDBQTParser', 'TPRParser', diff --git a/package/MDAnalysis/topology/base.py b/package/MDAnalysis/topology/base.py index 45e6b71e565..f9bf89f4a4b 100644 --- a/package/MDAnalysis/topology/base.py +++ b/package/MDAnalysis/topology/base.py @@ -36,10 +36,6 @@ :inherited-members: """ -from __future__ import absolute_import -import six -from six.moves import zip -# While reduce is a built-in in python 2, it is not in python 3 from functools import reduce import itertools @@ -95,7 +91,7 @@ def __init__(cls, name, bases, classdict): if '_format_hint' in classdict: _PARSER_HINTS[fmt_name] = classdict['_format_hint'].__func__ -class TopologyReaderBase(six.with_metaclass(_Topologymeta, IOBase)): +class TopologyReaderBase(IOBase, metaclass=_Topologymeta): """Base class for topology readers Parameters diff --git a/package/MDAnalysis/topology/core.py b/package/MDAnalysis/topology/core.py index ad39605b386..91596a0fefc 100644 --- a/package/MDAnalysis/topology/core.py +++ b/package/MDAnalysis/topology/core.py @@ -34,9 +34,6 @@ """ -from __future__ import print_function, absolute_import -import six - # Global imports import os.path import numpy as np diff --git a/package/MDAnalysis/topology/guessers.py b/package/MDAnalysis/topology/guessers.py index 71e12e22217..75f88883d3b 100644 --- a/package/MDAnalysis/topology/guessers.py +++ b/package/MDAnalysis/topology/guessers.py @@ -96,8 +96,6 @@ .. _user guide: https://www.mdanalysis.org/UserGuide/examples/constructing_universe.html#Adding-topology-attributes """ -from __future__ import absolute_import - import numpy as np import warnings import re diff --git a/package/MDAnalysis/topology/tables.py b/package/MDAnalysis/topology/tables.py index 97efb74c45c..ce25dbbeded 100644 --- a/package/MDAnalysis/topology/tables.py +++ b/package/MDAnalysis/topology/tables.py @@ -45,7 +45,6 @@ .. autodata:: TABLE_MASSES .. autodata:: TABLE_VDWRADII """ -from __future__ import absolute_import def kv2dict(s, convertor=str): diff --git a/package/MDAnalysis/topology/tpr/__init__.py b/package/MDAnalysis/topology/tpr/__init__.py index ad44a49a1a4..a1060581d10 100644 --- a/package/MDAnalysis/topology/tpr/__init__.py +++ b/package/MDAnalysis/topology/tpr/__init__.py @@ -38,8 +38,6 @@ * :mod:`MDAnalysis.topology.tpr.utils` """ -from __future__ import absolute_import - from .setting import SUPPORTED_VERSIONS __all__ = ["obj", "setting", "utils"] diff --git a/package/MDAnalysis/topology/tpr/obj.py b/package/MDAnalysis/topology/tpr/obj.py index 1b299332800..b14f5bd5198 100644 --- a/package/MDAnalysis/topology/tpr/obj.py +++ b/package/MDAnalysis/topology/tpr/obj.py @@ -31,10 +31,6 @@ =================================== """ -from __future__ import absolute_import - -from six.moves import range - from collections import namedtuple TpxHeader = namedtuple( diff --git a/package/MDAnalysis/topology/tpr/setting.py b/package/MDAnalysis/topology/tpr/setting.py index 19e661b556a..7cedde73b57 100644 --- a/package/MDAnalysis/topology/tpr/setting.py +++ b/package/MDAnalysis/topology/tpr/setting.py @@ -36,9 +36,6 @@ :data:`SUPPORTED_VERSIONS`. """ -from __future__ import absolute_import - -from six.moves import range #: Gromacs TPR file format versions that can be read by the TPRParser. SUPPORTED_VERSIONS = (58, 73, 83, 100, 103, 110, 112, 116, 119) diff --git a/package/MDAnalysis/topology/tpr/utils.py b/package/MDAnalysis/topology/tpr/utils.py index b6b78a0313a..baaf18e6b2e 100644 --- a/package/MDAnalysis/topology/tpr/utils.py +++ b/package/MDAnalysis/topology/tpr/utils.py @@ -46,9 +46,6 @@ The module also contains the :func:`do_inputrec` to read the TPR header with. """ -from __future__ import absolute_import - -from six.moves import range import numpy as np import xdrlib import struct diff --git a/testsuite/MDAnalysisTests/topology/base.py b/testsuite/MDAnalysisTests/topology/base.py index 0f8d5bdd41b..25cdba9076d 100644 --- a/testsuite/MDAnalysisTests/topology/base.py +++ b/testsuite/MDAnalysisTests/topology/base.py @@ -20,8 +20,6 @@ # MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations. # J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787 # -from __future__ import absolute_import - import pytest import MDAnalysis as mda diff --git a/testsuite/MDAnalysisTests/topology/test_crd.py b/testsuite/MDAnalysisTests/topology/test_crd.py index 487f260b7bd..846bff496f1 100644 --- a/testsuite/MDAnalysisTests/topology/test_crd.py +++ b/testsuite/MDAnalysisTests/topology/test_crd.py @@ -20,8 +20,6 @@ # MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations. # J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787 # -from __future__ import absolute_import - import MDAnalysis as mda from MDAnalysisTests.topology.base import ParserBase diff --git a/testsuite/MDAnalysisTests/topology/test_dlpoly.py b/testsuite/MDAnalysisTests/topology/test_dlpoly.py index 27d194fe10b..bc97e4671f6 100644 --- a/testsuite/MDAnalysisTests/topology/test_dlpoly.py +++ b/testsuite/MDAnalysisTests/topology/test_dlpoly.py @@ -20,7 +20,6 @@ # MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations. # J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787 # -from __future__ import absolute_import from numpy.testing import assert_equal import MDAnalysis as mda diff --git a/testsuite/MDAnalysisTests/topology/test_dms.py b/testsuite/MDAnalysisTests/topology/test_dms.py index 625fae27e3b..3bc78bedf40 100644 --- a/testsuite/MDAnalysisTests/topology/test_dms.py +++ b/testsuite/MDAnalysisTests/topology/test_dms.py @@ -20,8 +20,6 @@ # MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations. # J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787 # -from __future__ import absolute_import - import MDAnalysis as mda from MDAnalysisTests.topology.base import ParserBase diff --git a/testsuite/MDAnalysisTests/topology/test_fhiaims.py b/testsuite/MDAnalysisTests/topology/test_fhiaims.py index 0c47a07d454..4596ccfa2bc 100644 --- a/testsuite/MDAnalysisTests/topology/test_fhiaims.py +++ b/testsuite/MDAnalysisTests/topology/test_fhiaims.py @@ -20,8 +20,6 @@ # MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations. # J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787 # -from __future__ import absolute_import - from numpy.testing import assert_equal, assert_almost_equal import MDAnalysis as mda diff --git a/testsuite/MDAnalysisTests/topology/test_gms.py b/testsuite/MDAnalysisTests/topology/test_gms.py index 3c7ef3fe690..87b1795b352 100644 --- a/testsuite/MDAnalysisTests/topology/test_gms.py +++ b/testsuite/MDAnalysisTests/topology/test_gms.py @@ -20,8 +20,6 @@ # MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations. # J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787 # -from __future__ import absolute_import - from numpy.testing import assert_equal import MDAnalysis as mda diff --git a/testsuite/MDAnalysisTests/topology/test_gro.py b/testsuite/MDAnalysisTests/topology/test_gro.py index fc4b1848917..6a457cecb8d 100644 --- a/testsuite/MDAnalysisTests/topology/test_gro.py +++ b/testsuite/MDAnalysisTests/topology/test_gro.py @@ -20,8 +20,6 @@ # MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations. # J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787 # -from __future__ import absolute_import - import pytest import MDAnalysis as mda diff --git a/testsuite/MDAnalysisTests/topology/test_gsd.py b/testsuite/MDAnalysisTests/topology/test_gsd.py index 40a9f527692..10a345750e9 100644 --- a/testsuite/MDAnalysisTests/topology/test_gsd.py +++ b/testsuite/MDAnalysisTests/topology/test_gsd.py @@ -20,8 +20,6 @@ # MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations. # J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787 # -from __future__ import absolute_import - import pytest import MDAnalysis as mda diff --git a/testsuite/MDAnalysisTests/topology/test_guessers.py b/testsuite/MDAnalysisTests/topology/test_guessers.py index 7e91082d7b2..8d5758103fc 100644 --- a/testsuite/MDAnalysisTests/topology/test_guessers.py +++ b/testsuite/MDAnalysisTests/topology/test_guessers.py @@ -20,8 +20,6 @@ # MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations. # J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787 # -from __future__ import absolute_import - import pytest from numpy.testing import assert_equal import numpy as np diff --git a/testsuite/MDAnalysisTests/topology/test_hoomdxml.py b/testsuite/MDAnalysisTests/topology/test_hoomdxml.py index f406b392c4c..cd48bef4886 100644 --- a/testsuite/MDAnalysisTests/topology/test_hoomdxml.py +++ b/testsuite/MDAnalysisTests/topology/test_hoomdxml.py @@ -20,8 +20,6 @@ # MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations. # J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787 # -from __future__ import absolute_import - import MDAnalysis as mda from MDAnalysisTests.topology.base import ParserBase diff --git a/testsuite/MDAnalysisTests/topology/test_itp.py b/testsuite/MDAnalysisTests/topology/test_itp.py index 424cabca9f3..b16fd38bb12 100644 --- a/testsuite/MDAnalysisTests/topology/test_itp.py +++ b/testsuite/MDAnalysisTests/topology/test_itp.py @@ -20,7 +20,6 @@ # MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations. # J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787 # -from __future__ import absolute_import import pytest import MDAnalysis as mda @@ -335,4 +334,4 @@ def test_no_include(self): def test_missing_endif(self): with pytest.raises(IOError): with self.parser(ITP_no_endif) as p: - top = p.parse(include_dir=GMX_DIR) \ No newline at end of file + top = p.parse(include_dir=GMX_DIR) diff --git a/testsuite/MDAnalysisTests/topology/test_lammpsdata.py b/testsuite/MDAnalysisTests/topology/test_lammpsdata.py index fa8adabe3cc..083d0ca6d72 100644 --- a/testsuite/MDAnalysisTests/topology/test_lammpsdata.py +++ b/testsuite/MDAnalysisTests/topology/test_lammpsdata.py @@ -20,12 +20,10 @@ # MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations. # J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787 # -from __future__ import absolute_import - import pytest from numpy.testing import assert_equal import numpy as np -from six import StringIO +from io import StringIO import MDAnalysis as mda from MDAnalysisTests.topology.base import ParserBase diff --git a/testsuite/MDAnalysisTests/topology/test_minimal.py b/testsuite/MDAnalysisTests/topology/test_minimal.py index 593807a4325..6c275f0217c 100644 --- a/testsuite/MDAnalysisTests/topology/test_minimal.py +++ b/testsuite/MDAnalysisTests/topology/test_minimal.py @@ -20,8 +20,6 @@ # MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations. # J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787 # -from __future__ import absolute_import - import itertools import numpy as np import pytest diff --git a/testsuite/MDAnalysisTests/topology/test_mmtf.py b/testsuite/MDAnalysisTests/topology/test_mmtf.py index 0d245b6b636..c4e430cd0e7 100644 --- a/testsuite/MDAnalysisTests/topology/test_mmtf.py +++ b/testsuite/MDAnalysisTests/topology/test_mmtf.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import - import pytest from numpy.testing import assert_equal import mmtf diff --git a/testsuite/MDAnalysisTests/topology/test_mol2.py b/testsuite/MDAnalysisTests/topology/test_mol2.py index 513685f4e1d..47601d905e7 100644 --- a/testsuite/MDAnalysisTests/topology/test_mol2.py +++ b/testsuite/MDAnalysisTests/topology/test_mol2.py @@ -20,8 +20,6 @@ # MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations. # J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787 # -from __future__ import absolute_import - import pytest from numpy.testing import assert_equal diff --git a/testsuite/MDAnalysisTests/topology/test_parmed.py b/testsuite/MDAnalysisTests/topology/test_parmed.py index 07c93436387..9676e694591 100644 --- a/testsuite/MDAnalysisTests/topology/test_parmed.py +++ b/testsuite/MDAnalysisTests/topology/test_parmed.py @@ -20,8 +20,6 @@ # MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations. # J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787 # -from __future__ import absolute_import - import pytest import MDAnalysis as mda diff --git a/testsuite/MDAnalysisTests/topology/test_pdb.py b/testsuite/MDAnalysisTests/topology/test_pdb.py index c3bbc323d8a..24a9f39a424 100644 --- a/testsuite/MDAnalysisTests/topology/test_pdb.py +++ b/testsuite/MDAnalysisTests/topology/test_pdb.py @@ -20,9 +20,7 @@ # MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations. # J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787 # -from __future__ import absolute_import - -from six.moves import StringIO +from io import StringIO import pytest import warnings diff --git a/testsuite/MDAnalysisTests/topology/test_pdbqt.py b/testsuite/MDAnalysisTests/topology/test_pdbqt.py index 23a15971f18..4d2c94b9a70 100644 --- a/testsuite/MDAnalysisTests/topology/test_pdbqt.py +++ b/testsuite/MDAnalysisTests/topology/test_pdbqt.py @@ -20,8 +20,6 @@ # MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations. # J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787 # -from __future__ import absolute_import - import MDAnalysis as mda from MDAnalysisTests.topology.base import ParserBase diff --git a/testsuite/MDAnalysisTests/topology/test_pqr.py b/testsuite/MDAnalysisTests/topology/test_pqr.py index b7816b3ca2f..569b964e3ba 100644 --- a/testsuite/MDAnalysisTests/topology/test_pqr.py +++ b/testsuite/MDAnalysisTests/topology/test_pqr.py @@ -20,9 +20,7 @@ # MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations. # J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787 # -from __future__ import absolute_import - -from six.moves import StringIO +from io import StringIO from numpy.testing import assert_equal, assert_almost_equal import pytest import MDAnalysis as mda diff --git a/testsuite/MDAnalysisTests/topology/test_psf.py b/testsuite/MDAnalysisTests/topology/test_psf.py index bbfc2dbdbc1..950d756758f 100644 --- a/testsuite/MDAnalysisTests/topology/test_psf.py +++ b/testsuite/MDAnalysisTests/topology/test_psf.py @@ -20,7 +20,6 @@ # MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations. # J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787 # -from __future__ import absolute_import from numpy.testing import assert_equal import pytest diff --git a/testsuite/MDAnalysisTests/topology/test_top.py b/testsuite/MDAnalysisTests/topology/test_top.py index bf00b34cb43..8a2ad2ae30c 100644 --- a/testsuite/MDAnalysisTests/topology/test_top.py +++ b/testsuite/MDAnalysisTests/topology/test_top.py @@ -20,7 +20,6 @@ # MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations. # J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787 # -from __future__ import absolute_import import MDAnalysis as mda import pytest import numpy as np diff --git a/testsuite/MDAnalysisTests/topology/test_topology_base.py b/testsuite/MDAnalysisTests/topology/test_topology_base.py index c1e41466209..0a6099b17de 100644 --- a/testsuite/MDAnalysisTests/topology/test_topology_base.py +++ b/testsuite/MDAnalysisTests/topology/test_topology_base.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import import numpy as np from numpy.testing import assert_equal diff --git a/testsuite/MDAnalysisTests/topology/test_topology_str_types.py b/testsuite/MDAnalysisTests/topology/test_topology_str_types.py index 81077226fc9..8f7254702e2 100644 --- a/testsuite/MDAnalysisTests/topology/test_topology_str_types.py +++ b/testsuite/MDAnalysisTests/topology/test_topology_str_types.py @@ -20,10 +20,6 @@ # MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations. # J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787 # -from __future__ import division, absolute_import - - -from six import string_types import MDAnalysis import pytest @@ -86,4 +82,4 @@ def test_str_types(top_format, top, prop): # Related to Issue #1336 u = MDAnalysis.Universe(top, format=top_format) if hasattr(u.atoms[0], prop): - assert isinstance(getattr(u.atoms[0], prop), string_types) + assert isinstance(getattr(u.atoms[0], prop), str) diff --git a/testsuite/MDAnalysisTests/topology/test_tprparser.py b/testsuite/MDAnalysisTests/topology/test_tprparser.py index 2063ee70ebc..89db3aec158 100644 --- a/testsuite/MDAnalysisTests/topology/test_tprparser.py +++ b/testsuite/MDAnalysisTests/topology/test_tprparser.py @@ -20,8 +20,6 @@ # MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations. # J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787 # -from __future__ import absolute_import - import pytest from numpy.testing import assert_equal import functools diff --git a/testsuite/MDAnalysisTests/topology/test_txyz.py b/testsuite/MDAnalysisTests/topology/test_txyz.py index 09b3f970c3d..931e35d2026 100644 --- a/testsuite/MDAnalysisTests/topology/test_txyz.py +++ b/testsuite/MDAnalysisTests/topology/test_txyz.py @@ -20,8 +20,6 @@ # MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations. # J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787 # -from __future__ import absolute_import - import MDAnalysis as mda import pytest diff --git a/testsuite/MDAnalysisTests/topology/test_xpdb.py b/testsuite/MDAnalysisTests/topology/test_xpdb.py index 4ee976b3a40..25379b4243f 100644 --- a/testsuite/MDAnalysisTests/topology/test_xpdb.py +++ b/testsuite/MDAnalysisTests/topology/test_xpdb.py @@ -20,7 +20,6 @@ # MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations. # J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787 # -from __future__ import absolute_import import MDAnalysis as mda from MDAnalysisTests.topology.base import ParserBase diff --git a/testsuite/MDAnalysisTests/topology/test_xyz.py b/testsuite/MDAnalysisTests/topology/test_xyz.py index 21f1a1937d7..e45591a238c 100644 --- a/testsuite/MDAnalysisTests/topology/test_xyz.py +++ b/testsuite/MDAnalysisTests/topology/test_xyz.py @@ -20,8 +20,6 @@ # MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations. # J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787 # -from __future__ import absolute_import - import MDAnalysis as mda import pytest