#19992 closed enhancement (fixed)
RFE: deregister attributes
| Reported by: | Tom Goddard | Owned by: | Eric Pettersen |
|---|---|---|---|
| Priority: | moderate | Milestone: | |
| Component: | Structure Analysis | Version: | |
| Keywords: | Cc: | ||
| Blocked By: | Blocking: | ||
| Notify when closed: | Platform: | all | |
| Project: | ChimeraX |
Description
My mutation structure coloring code currently registers a Residue attribute called "mutation_score". Later the user may rename this. Then they may create a new attribute named "mutation_score". Only the attribute value type may be float the first time and int the second time. That gives an error. Is there a way when the user renames the attribute for me to deregister the attribute name? Or can I reregister changing float to int without an error? I did not see a way to do it.
Change History (4)
comment:1 by , 7 weeks ago
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
comment:2 by , 2 weeks ago
It is not too convenient to use this deregister_attr() routine since my code does not keep track of which attributes it has registered. It would be nice if I can deregister an attribute without getting an error if it is already deregistered. Maybe it could have a keyword argument error_if_not_registered = True.
comment:3 by , 6 days ago
It seems like in the most likely usage case you won't care if the attribute was previously registered, so I added an "unregistered_okay" keyword (default True) to deregister().
comment:4 by , 6 days ago
THe unregistered_okay is not in release candidate. Don't want my mutation score code for the release and in develop to diverge so I'll wait until after release to use deregister.
Added attribute deregistration and renaming methods (deregister_attr and rename_attr. The renaming method only moves the meta-information about the attributes -- it does not move/rename the attribute name/value pair in individual class instances.