qudi.util.overload.OverloadProxy

class qudi.util.overload.OverloadProxy(obj, overload_key, *args, **kwargs)[source]

Bases: builtins.object

Instances of this class serve as proxies for objects containing attributes of type OverloadedAttribute. It can be used to hide the overloading mechanism by fixing the overloaded attribute access key in a OverloadProxy instance. This allows for interfacing an overloaded attribute in the object represented by this proxy by normal “pythonic” means without the additional key-mapping lookup usually required by OverloadedAttribute.

Heavily inspired by this python recipe under PSF License: https://code.activestate.com/recipes/496741-object-proxying/

__init__(obj: Any, overload_key: str)[source]

Methods

__init__(obj, overload_key)

static __new__(cls, obj, overload_key, *args, **kwargs)[source]

creates an proxy instance referencing obj. (obj, *args, **kwargs) are passed to this class’ __init__, so deriving classes can define an __init__ method of their own.

note: _class_proxy_cache is unique per class (each deriving class must hold its own cache)