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 id> does not issue a deprecation warning #1478

Closed
jbarnoud opened this issue Jul 13, 2017 · 7 comments
Closed

universe.<segment id> does not issue a deprecation warning #1478

jbarnoud opened this issue Jul 13, 2017 · 7 comments
Assignees
Milestone

Comments

@jbarnoud
Copy link
Contributor

Expected behaviour

When using a segment instant selector from a Universe instance, a deprecation warning is issued. Indeed, instant selectors are deprecated and #1403 introduced deprecation warnings for them.

Actual behaviour

No deprecation warning is issued.

Segment instant selector are added directly to the universes name space here: https://github.com/MDAnalysis/mdanalysis/blob/develop/package/MDAnalysis/core/universe.py#L345. Without a proxy, accessing the segments cannot issue the warning.

This is already acknowledge in a comment: https://github.com/MDAnalysis/mdanalysis/blob/develop/package/MDAnalysis/core/universe.py#L322. However, this is the most documented way to use instant selectors.

Code to reproduce the behaviour

import MDAnalysis as mda
from MDAnalysisTests.datafiles import PSF, DCD

u = mda.Universe(PSF, DCD)
u.s4AKE
@richardjgowers
Copy link
Member

richardjgowers commented Jul 13, 2017 via email

@richardjgowers
Copy link
Member

Ok thinking about this, it might be possible to make u.SEGNAME actually a property, which first issues the dep warning and then returns the segment. So a little shim that makes this work correctly.

@richardjgowers richardjgowers added this to the 0.17.0 milestone Jul 13, 2017
@jbarnoud
Copy link
Contributor Author

jbarnoud commented Jul 13, 2017 via email

@richardjgowers
Copy link
Member

The other way would be to make them work like ag.CA (via a hack in __getattr__), but this would then lose the tab completion.. which is probably fine tbh.

@jbarnoud
Copy link
Contributor Author

jbarnoud commented Jul 13, 2017 via email

@richardjgowers
Copy link
Member

the latter, the segments wouldn't exist in the Universe namespace for tab completion inspection to see.

@jbarnoud
Copy link
Contributor Author

jbarnoud commented Jul 13, 2017 via email

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

2 participants