ProDy icon indicating copy to clipboard operation
ProDy copied to clipboard

deprecation prep

Open jamesmkrieger opened this issue 4 years ago • 1 comments

I have introduced some try/except blocks to account for things becoming deprecated. The relevant warnings came from pytest from Python 3.8 on Ubuntu 20.04 (Windows Subsystem for Linux 2):

prody/atomic/select.py:445
  /mnt/c/Users/james/code/ProDy/prody/atomic/select.py:445: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.9 it will stop working
    from collections import Iterable

prody/apps/evol_apps/__init__.py:3
  /mnt/c/Users/james/code/ProDy/prody/apps/evol_apps/__init__.py:3: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
    import imp

prody/compounds/pdbligands.py:161
prody/compounds/pdbligands.py:161
  /mnt/c/Users/james/code/ProDy/prody/compounds/pdbligands.py:161: DeprecationWarning: `np.bool` is a deprecated alias for the builtin `bool`. To silence this warning, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
  Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
    leaving_atom_flags = np.zeros(n_atoms, np.bool)

prody/compounds/pdbligands.py:162
prody/compounds/pdbligands.py:162
  /mnt/c/Users/james/code/ProDy/prody/compounds/pdbligands.py:162: DeprecationWarning: `np.bool` is a deprecated alias for the builtin `bool`. To silence this warning, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
  Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
    aromatic_flags = np.zeros(n_atoms, np.bool)

prody/compounds/pdbligands.py:163
prody/compounds/pdbligands.py:163
  /mnt/c/Users/james/code/ProDy/prody/compounds/pdbligands.py:163: DeprecationWarning: `np.bool` is a deprecated alias for the builtin `bool`. To silence this warning, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
  Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
    stereo_configs = np.zeros(n_atoms, np.bool)

prody/trajectory/dcdfile.py:273: 2 warnings
prody/tests/apps/test_prody_catdcd.py: 38 warnings
prody/tests/apps/test_prody_pca.py: 4 warnings
prody/tests/measure/test_measure.py: 10 warnings
prody/tests/trajectory/test_dcdfile.py: 4 warnings
prody/tests/trajectory/test_frame.py: 6 warnings
  /mnt/c/Users/james/code/ProDy/prody/trajectory/dcdfile.py:273: DeprecationWarning: The binary mode of fromstring is deprecated, as it behaves surprisingly on unicode inputs. Use frombuffer instead
    xyz = fromstring(self._file.read(self._itemsize * n_floats),

prody/trajectory/dcdfile.py:320: 1 warning
prody/tests/apps/test_prody_catdcd.py: 6 warnings
prody/tests/measure/test_measure.py: 2 warnings
prody/tests/trajectory/test_dcdfile.py: 3 warnings
  /mnt/c/Users/james/code/ProDy/prody/trajectory/dcdfile.py:320: DeprecationWarning: The binary mode of fromstring is deprecated, as it behaves surprisingly on unicode inputs. Use frombuffer instead
    data = fromstring(data, self._dtype)

prody/sequence/sequence.py:32: 75 warnings
prody/tests/sequence/test_msafile.py: 175 warnings
  /mnt/c/Users/james/code/ProDy/prody/sequence/sequence.py:32: DeprecationWarning: The binary mode of fromstring is deprecated, as it behaves surprisingly on unicode inputs. Use frombuffer instead
    self._seq = fromstring(one, '|S1')

prody/tests/apps/test_prody_catdcd.py: 21 warnings
prody/tests/measure/test_measure.py: 6 warnings
prody/tests/trajectory/test_frame.py: 6 warnings
  /mnt/c/Users/james/code/ProDy/prody/trajectory/dcdfile.py:294: DeprecationWarning: The binary mode of fromstring is deprecated, as it behaves surprisingly on unicode inputs. Use frombuffer instead
    unitcell = fromstring(self._file.read(48), dtype=np.float64)

prody/tests/ensemble/test_functions.py: 9 warnings
prody/tests/ensemble/test_pdbensemble.py: 19 warnings
prody/tests/sequence/test_msa.py: 25 warnings
prody/tests/sequence/test_msafile.py: 100 warnings
prody/tests/sequence/test_sequence.py: 1 warning
  /mnt/c/Users/james/code/ProDy/prody/sequence/sequence.py:52: DeprecationWarning: tostring() is deprecated. Use tobytes() instead.
    return self._array.tostring().decode()

prody/tests/sequence/test_analysis.py: 129 warnings
  /mnt/c/Users/james/code/ProDy/prody/sequence/analysis.py:592: PendingDeprecationWarning: the matrix subclass is not the recommended way to represent matrices or deal with linear algebra (see https://docs.scipy.org/doc/numpy/user/numpy-for-matlab-users.html). Please adjust your code to use regular ndarray.
    c = matrix.dot(matrix(zeros((length*q, 1), float)),

prody/tests/sequence/test_analysis.py: 129 warnings
  /mnt/c/Users/james/code/ProDy/prody/sequence/analysis.py:593: PendingDeprecationWarning: the matrix subclass is not the recommended way to represent matrices or deal with linear algebra (see https://docs.scipy.org/doc/numpy/user/numpy-for-matlab-users.html). Please adjust your code to use regular ndarray.
    matrix(zeros((1, length*q), float)))

prody/tests/sequence/test_analysis.py: 129 warnings
  /home/jkrieger/anaconda3/envs/wsl_prody/lib/python3.8/site-packages/numpy/matrixlib/defmatrix.py:69: PendingDeprecationWarning: the matrix subclass is not the recommended way to represent matrices or deal with linear algebra (see https://docs.scipy.org/doc/numpy/user/numpy-for-matlab-users.html). Please adjust your code to use regular ndarray.
    return matrix(data, dtype=dtype, copy=False)

prody/tests/sequence/test_sequence.py::TestSequence::testStringConversion
  /mnt/c/Users/james/code/ProDy/prody/sequence/sequence.py:36: DeprecationWarning: The binary mode of fromstring is deprecated, as it behaves surprisingly on unicode inputs. Use frombuffer instead
    self._seq = fromstring(args[0], '|S1')

-- Docs: https://docs.pytest.org/en/stable/warnings.html

I have accounted for a number of these but not all of them.

jamesmkrieger avatar Aug 01 '21 16:08 jamesmkrieger

I haven't quite worked out how to automatically trigger GitHub Actions CI, but here's the output from manually triggering on this branch: https://github.com/jamesmkrieger/ProDy/actions/runs/1087735002

This check passed.

jamesmkrieger avatar Aug 01 '21 16:08 jamesmkrieger