Skip to content

Commit

Permalink
removed explicit DeprecationWarning for AtomGroup["name"]
Browse files Browse the repository at this point in the history
It turns out that with this warning in place we raise two deprecation warnings because we also
have a warning on _get_named_atom(item).

Example output:

 >>> w.atoms['AAA']
 .../mdanalysis/package/MDAnalysis/core/groups.py:1520: DeprecationWarning: Using the [] operator with strings is deprecated and will be removed in 1.0. Please use `select_atoms('name AAA')` instead.
   category=DeprecationWarning)
 .../mdanalysis/package/MDAnalysis/core/groups.py:1522: DeprecationWarning: `_get_named_atom` is deprecated!
 Instant selector AtomGroup['<name>'] or AtomGroup.<name> is deprecated and will be removed in 1.0. Use AtomGroup.select_atoms('name <name>') instead.
   return self._get_named_atom(item)
 <Atom 1: AAA of resname RsA, resid 1 and segid SegA>
  • Loading branch information
orbeckst committed Jun 18, 2017
1 parent 156a61c commit 2c96f04
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions package/MDAnalysis/core/groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -1513,11 +1513,6 @@ def __getitem__(self, item):
#
# u.atoms['HT1'] access, otherwise default
if isinstance(item, string_types):
warnings.warn("Using the [] operator with strings is deprecated "
"and will be removed in 1.0. "
"Please use `select_atoms('name {}')` "
"instead.".format(item),
category=DeprecationWarning)
try:
return self._get_named_atom(item)
except (AttributeError, selection.SelectionError):
Expand Down

0 comments on commit 2c96f04

Please sign in to comment.