Opened 6 weeks ago

Closed 5 weeks ago

Last modified 2 days ago

#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 (2)

comment:1 by Eric Pettersen, 5 weeks ago

Resolution: fixed
Status: assignedclosed

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.

comment:2 by Tom Goddard, 2 days 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.

Note: See TracTickets for help on using tickets.