File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed
Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change 4141import itertools
4242import numbers
4343import numpy as np
44+ import warnings
4445
4546from numpy .lib .utils import deprecate
4647
@@ -411,9 +412,6 @@ def getattr__(atomgroup, name):
411412 raise AttributeError ("'{0}' object has no attribute '{1}'" .format (
412413 atomgroup .__class__ .__name__ , name ))
413414
414- @deprecate (message = "Instant selector AtomGroup['<name>'] or AtomGroup.<name> "
415- "is deprecated and will be removed in 1.0. "
416- "Use AtomGroup.select_atoms('name <name>') instead." )
417415 def _get_named_atom (group , name ):
418416 """Get all atoms with name *name* in the current AtomGroup.
419417
@@ -438,10 +436,12 @@ def _get_named_atom(group, name):
438436 "No atoms with name '{0}'" .format (name ))
439437 elif len (atomlist ) == 1 :
440438 # XXX: keep this, makes more sense for names
441- return atomlist [0 ]
442- else :
443- # XXX: but inconsistent (see residues and Issue 47)
444- return atomlist
439+ atomlist = atomlist [0 ]
440+ warnings .warn ("Instant selector AtomGroup['<name>'] or AtomGroup.<name> "
441+ "is deprecated and will be removed in 1.0. "
442+ "Use AtomGroup.select_atoms('name <name>') instead." ,
443+ DeprecationWarning )
444+ return atomlist
445445
446446 # AtomGroup already has a getattr
447447# transplants[AtomGroup].append(
You can’t perform that action at this time.
0 commit comments