-
Notifications
You must be signed in to change notification settings - Fork 667
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
Comments
You really do find all the best bugs -_-.
…On Thu, 13 Jul 2017, 12:55 p.m. Jonathan Barnoud, ***@***.***> wrote:
Expected behaviour
When using a segment instant selector from a Universe instance, a
deprecation warning is issued. Indeed, instant selectors are deprecated and
#1403 <#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 mdafrom MDAnalysisTests.datafiles import PSF, DCD
u = mda.Universe(PSF, DCD)
u.s4AKE
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1478>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AI0jB6m64c2iT833tyjMlZ4YJzrmfy0wks5sNgWsgaJpZM4OW4uu>
.
|
Ok thinking about this, it might be possible to make |
On 07/13/2017 03:23 PM, Richard Gowers wrote:
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.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1478 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABUWuoms2xz1uf16beiAk9Kv_MyhYhJZks5sNhpdgaJpZM4OW4uu>.
I had a brief look at descriptors, but I did not go through. The issue I
see is that descriptors (and therefore properties that are just a
shortcut to the descriptor mechanism) are attached to the class and not
to the instance. I am not sure we can have instance wide descriptors.
|
The other way would be to make them work like |
On 07/13/2017 04:04 PM, Richard Gowers wrote:
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.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1478 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABUWusu42y-gnp0r2mGyYM6-Yxel-YZuks5sNiP_gaJpZM4OW4uu>.
Would we loose all tab-completion or only the tab-completion of the
segment names? In the former case it would be annoying, in the latter it
is not be a big deal, the feature is deprecated anyway.
|
the latter, the segments wouldn't exist in the Universe namespace for tab completion inspection to see. |
On 07/13/2017 04:10 PM, Richard Gowers wrote:
the latter, the segments wouldn't exist in the Universe namespace for
tab completion inspection to see.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1478 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABUWuudCatWk6NiKuig94gVcwqgfKHtEks5sNiVUgaJpZM4OW4uu>.
Then it is probably the better solution. Loosing tab-completion for a
feature we are phasing out is not really a problem in point of view.
|
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
The text was updated successfully, but these errors were encountered: