1# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding:utf-8 -*-
2# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
3#
4# MDAnalysis --- https://www.mdanalysis.org
5# Copyright (c) 2006-2017 The MDAnalysis Development Team and contributors
6# (see the file AUTHORS for the full list of names)
7#
8# Released under the GNU Public Licence, v2 or any higher version
9#
10# Please cite your use of MDAnalysis in published work:
11#
12# R. J. Gowers, M. Linke, J. Barnoud, T. J. E. Reddy, M. N. Melo, S. L. Seyler,
13# D. L. Dotson, J. Domanski, S. Buchoux, I. M. Kenney, and O. Beckstein.
14# MDAnalysis: A Python package for the rapid analysis of molecular dynamics
15# simulations. In S. Benthall and S. Rostrup editors, Proceedings of the 15th
16# Python in Science Conference, pages 102-109, Austin, TX, 2016. SciPy.
17#
18# N. Michaud-Agrawal, E. J. Denning, T. B. Woolf, and O. Beckstein.
19# MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations.
20# J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787
21#
22from __future__ import absolute_import
23import warnings
24
25from .groups import (Atom, AtomGroup, Residue, ResidueGroup, Segment,
26                     SegmentGroup)
27from . import universe
28
29
30def deprecate_class(class_new, message):
31    """utility to deprecate a class"""
32
33    class new_class(class_new):
34        def __init__(self, *args, **kwargs):
35            super(new_class, self).__init__(*args, **kwargs)
36            warnings.warn(message, DeprecationWarning)
37
38    return new_class
39
40
41Universe = deprecate_class(
42    universe.Universe,
43    "MDAnalysis.core.AtomGroup.Universe has been removed."
44    "Please use MDAnalysis.Universe."
45    "This stub will be removed in 1.0")
46
47_group_message = ("MDAnalysis.core.AtomGroup.{0} has been removed."
48                  "Please use MDAnalysis.groups.{0}"
49                  "This stub will be removed in 1.0")
50
51Atom = deprecate_class(Atom, message=_group_message.format('Atom'))
52AtomGroup = deprecate_class(
53    AtomGroup, message=_group_message.format('AtomGroup'))
54
55Residue = deprecate_class(Residue, message=_group_message.format('Residue'))
56ResidueGroup = deprecate_class(
57    ResidueGroup, message=_group_message.format('ResidueGroup'))
58
59Segment = deprecate_class(Segment, message=_group_message.format('Segment'))
60SegmentGroup = deprecate_class(
61    SegmentGroup, message=_group_message.format('SegmentGroup'))
62
63__all__ = [
64    'Universe', 'Atom', 'AtomGroup', 'Residue', 'ResidueGroup', 'Segment',
65    'SegmentGroup'
66]
67