MCPcopy Create free account
hub / github.com/ImageEngine/cortex / __parameterisedSetItemOp

Function __parameterisedSetItemOp

python/IECore/ParameterisedOverwriting.py:43–60  ·  view source on GitHub ↗

Smart version of __setitem__ operator. Uses Parameter.smartSetValue() function for dynamic type conversion.

( self, attrName, attrValue )

Source from the content-addressed store, hash-verified

41"""
42
43def __parameterisedSetItemOp( self, attrName, attrValue ):
44 """
45 Smart version of __setitem__ operator. Uses Parameter.smartSetValue() function for
46 dynamic type conversion.
47 """
48 try:
49 parameters = IECore.Parameterised.parameters( self )
50 except:
51 # it's probably a derived class and the constructor did not initialized Parameterised.
52 # So the attribute must be a class attribute and not a Parameter attribute.
53 # \todo Might want to rethink this logic
54 self.__dict__[ attrName ] = attrValue
55 else:
56 if parameters.has_key( attrName ):
57 parameters[ attrName ].smartSetValue( attrValue )
58 else:
59 # allow assignment of other attributes to the object.
60 self.__dict__[ attrName ] = attrValue
61
62IECore.Parameterised.__setitem__ = __parameterisedSetItemOp
63

Callers

nothing calls this directly

Calls 2

has_keyMethod · 0.80
parametersMethod · 0.45

Tested by

no test coverage detected