Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

universe.segment and universe.residues triger a deprecation warning #1476

Closed
jbarnoud opened this issue Jul 12, 2017 · 2 comments
Closed

universe.segment and universe.residues triger a deprecation warning #1476

jbarnoud opened this issue Jul 12, 2017 · 2 comments
Assignees
Milestone

Comments

@jbarnoud
Copy link
Contributor

Likeky following #1403, calling the segments property of a universe issues the following deprecation warning:

/home/jon/dev/mdanalysis/package/MDAnalysis/core/topologyattrs.py:1268: DeprecationWarning: `_get_named_segment` is deprecated!
Instant selector SegmentGroup.<name> is deprecated and will be removed in 1.0. Use SegmentGroup[SegmentGroup.segids == '<name>'] instead.
  return segmentgroup._get_named_segment(segid)

The residues property issues the following one:

/home/jon/dev/mdanalysis/package/MDAnalysis/core/topologyattrs.py:1064: DeprecationWarning: `_get_named_residue` is deprecated!
Instant selector ResidueGroup.<name> or Segment.<name> is deprecated and will be removed in 1.0. Use ResidueGroup[ResidueGroup.resnames == '<name>'] or Segment.residues[Segment.residues == '<name>'] instead.
  return residuegroup._get_named_residue(resname)

No warning should be emitted.

The atoms property does not emit warning as expected.

Resnames._get_named_residue and Segments._get_named_segment should handle the deprecation warning the same way as Atoms._get_named_atom; issue the warning only if the methods return something. See #1403 (comment) and a9f9655.

@kain88-de
Copy link
Member

Are you using python3 @jbarnoud ?

@jbarnoud
Copy link
Contributor Author

Yes I am. But I checked the issue on python 2 too.

In addition, it seems that universe.<segment id> does not go through _get_named_segment and therefore does not issue the deprecation warning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants