From 7a751eec86aed7f484e71e1971a7d1dc47d563d2 Mon Sep 17 00:00:00 2001 From: Irfan Alibay Date: Sat, 29 Feb 2020 22:06:51 +0000 Subject: [PATCH] Atomgroup removal (#2562) * Completes #1070 and moves us towards v1.0 #2443 * Removed AtomGroup stubs. * Removed unnecessary import from groups.py * Removes deprecation test * Update CHANGELOG --- package/CHANGELOG | 1 + package/MDAnalysis/core/AtomGroup.py | 67 ------------------- package/MDAnalysis/core/__init__.py | 1 - package/MDAnalysis/core/groups.py | 2 - .../MDAnalysisTests/core/test_atomgroup.py | 6 -- 5 files changed, 1 insertion(+), 76 deletions(-) delete mode 100644 package/MDAnalysis/core/AtomGroup.py diff --git a/package/CHANGELOG b/package/CHANGELOG index b315d06017a..9ab0f957240 100644 --- a/package/CHANGELOG +++ b/package/CHANGELOG @@ -86,6 +86,7 @@ Enhancements * Improve the distance search in water bridge analysis with capped_distance (PR #2480) Changes + * Removed AtomGroup stubs (PR #1070, Issue #2443). * encore.hes() doesn't accept the details keyword anymore, it always returns the relevant details instead, consistently with ces() and dres(), in the form of a dictionary (Issue #2465) diff --git a/package/MDAnalysis/core/AtomGroup.py b/package/MDAnalysis/core/AtomGroup.py deleted file mode 100644 index 3967fe7a9ec..00000000000 --- a/package/MDAnalysis/core/AtomGroup.py +++ /dev/null @@ -1,67 +0,0 @@ -# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding:utf-8 -*- -# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 -# -# MDAnalysis --- https://www.mdanalysis.org -# Copyright (c) 2006-2017 The MDAnalysis Development Team and contributors -# (see the file AUTHORS for the full list of names) -# -# Released under the GNU Public Licence, v2 or any higher version -# -# Please cite your use of MDAnalysis in published work: -# -# R. J. Gowers, M. Linke, J. Barnoud, T. J. E. Reddy, M. N. Melo, S. L. Seyler, -# D. L. Dotson, J. Domanski, S. Buchoux, I. M. Kenney, and O. Beckstein. -# MDAnalysis: A Python package for the rapid analysis of molecular dynamics -# simulations. In S. Benthall and S. Rostrup editors, Proceedings of the 15th -# Python in Science Conference, pages 102-109, Austin, TX, 2016. SciPy. -# doi: 10.25080/majora-629e541a-00e -# -# N. Michaud-Agrawal, E. J. Denning, T. B. Woolf, and O. Beckstein. -# 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 warnings - -from .groups import (Atom, AtomGroup, Residue, ResidueGroup, Segment, - SegmentGroup) -from . import universe - - -def deprecate_class(class_new, message): - """utility to deprecate a class""" - - class new_class(class_new): - def __init__(self, *args, **kwargs): - super(new_class, self).__init__(*args, **kwargs) - warnings.warn(message, DeprecationWarning) - - return new_class - - -Universe = deprecate_class( - universe.Universe, - "MDAnalysis.core.AtomGroup.Universe has been removed." - "Please use MDAnalysis.Universe." - "This stub will be removed in 1.0") - -_group_message = ("MDAnalysis.core.AtomGroup.{0} has been removed." - "Please use MDAnalysis.groups.{0}" - "This stub will be removed in 1.0") - -Atom = deprecate_class(Atom, message=_group_message.format('Atom')) -AtomGroup = deprecate_class( - AtomGroup, message=_group_message.format('AtomGroup')) - -Residue = deprecate_class(Residue, message=_group_message.format('Residue')) -ResidueGroup = deprecate_class( - ResidueGroup, message=_group_message.format('ResidueGroup')) - -Segment = deprecate_class(Segment, message=_group_message.format('Segment')) -SegmentGroup = deprecate_class( - SegmentGroup, message=_group_message.format('SegmentGroup')) - -__all__ = [ - 'Universe', 'Atom', 'AtomGroup', 'Residue', 'ResidueGroup', 'Segment', - 'SegmentGroup' -] diff --git a/package/MDAnalysis/core/__init__.py b/package/MDAnalysis/core/__init__.py index ee659fc524f..35ed5b0031e 100644 --- a/package/MDAnalysis/core/__init__.py +++ b/package/MDAnalysis/core/__init__.py @@ -55,4 +55,3 @@ from . import groups from . import selection -from . import AtomGroup diff --git a/package/MDAnalysis/core/groups.py b/package/MDAnalysis/core/groups.py index 952ce6534be..0d6ad9d07ba 100644 --- a/package/MDAnalysis/core/groups.py +++ b/package/MDAnalysis/core/groups.py @@ -100,8 +100,6 @@ import os import warnings -from numpy.lib.utils import deprecate - from .. import _ANCHOR_UNIVERSES, _CONVERTERS from ..lib import util from ..lib.util import cached, warn_if_not_unique, unique_int_1d diff --git a/testsuite/MDAnalysisTests/core/test_atomgroup.py b/testsuite/MDAnalysisTests/core/test_atomgroup.py index 14d3b853d15..42b0a153d34 100644 --- a/testsuite/MDAnalysisTests/core/test_atomgroup.py +++ b/testsuite/MDAnalysisTests/core/test_atomgroup.py @@ -56,12 +56,6 @@ import pytest -class TestDeprecationWarnings(object): - def test_AtomGroupUniverse_usage_warning(self): - with pytest.deprecated_call(): - mda.core.AtomGroup.Universe(PSF, DCD) - - class TestAtomGroupToTopology(object): """Test the conversion of AtomGroup to TopologyObjects""" @pytest.fixture()