pyrolab.configure.uniquify_class#
- uniquify_class(cls: Type[Service]) Type[Service][source]#
Returns a new class with a unique name that inherits from the original.
No other attributes or parameters are modified. The new class has the same metadata and acts in an identical way as the original.
There are instances where a unique class is useful. For example, if there are multiple hardware instances of the same device, but each has different autoconnect parameters, since PyroLab stores device autoconnect parameters as class attributes, it is not possible to have multiple instances of the same class with different autoconnect parameters. Creating a unique class allows Pyro5 to dynamically create and destroy the class while maintaining the same autoconnect parameters and not interfering with other instances of the same driver.
- Parameters:
- clsType[Service]
The class to uniquify.
- Returns:
- Type[Service]
The uniquified class (name begins with the original name and is suffixed with an underscore followed by a random string generated by uuid4).