pymel.util.proxyClass

proxyClass(cls, classname, dataAttrName=None, dataFuncName=None, remove=(), makeDefaultInit=False, sourceIsImmutable=True)

This function will generate a proxy class which keeps the internal data separate from the wrapped class. This is useful for emulating immutable types such as str and tuple, while using mutable data. Be aware that changing data will break hashing. not sure the best solution to this, but a good approach would be to subclass your proxy and implement a valid __hash__ method.

Parameters:
cls : type
The class to wrap
classname : string
The name to give the resulting proxy class
dataAttrName : string
The name of an attribute on which an instance of the wrapped class will be stored. Either dataAttrname or dataFuncName must be given, but not both.
dataFuncName : string
The name of an attribute on which reside a function, which takes no arguments, and when called, will return an instance of the wrapped class. Either dataAttrname or dataFuncName must be given, but not both.
remove : string iterable
An iterable of name of attributes which should NOT be wrapped. Note that certain attributes will never be wrapped - the list of such items is found in the NOT_PROXY_WRAPPED constant.
makeDefaultInit : bool
If True and dataAttrName is True, then a ‘default’ __init__ function will be created, which creates an instance of the wrapped class, and assigns it to the dataAttr. Defaults to False If dataAttrName is False, does nothing
sourceIsImmutable : bool
This parameter is included only for backwards compatibility - it is ignored.
Return type:type

Previous topic

pymel.util.prod

Next topic

pymel.util.putEnv

Core

Core Modules

Other Modules

This Page