luminal.interfaces.photon
Module Contents
Classes
The metaclass for the abstract base class |
|
Base class for all Luminal photons. |
- class IPhotonMeta(*args, **kwargs)
Bases:
abc.ABCMeta,luminal.interfaces.metadata.MetaPropertiesThe metaclass for the abstract base class
IPhotonthat enables the specification of authorship, version, tags, and a description for the derived classes.This metaclass is used to define several class attributes for any class that derives from the base class
IPhoton. The attributes are used to provide metadata about the derived class. The metaclass is created by inheriting fromABCMetaandMetaPropertiesand includes multiple attributes.Usage
This metaclass is typically used by inheriting it from an
IPhotonbase class.To specify values for the metadata attributes in a derived class, simply define the corresponding attributes inside the class definition with appropriate values.
Examples
>>> class MyPhotonInterface(metaclass=IPhotonMeta): >>> ...
Here, a new class named
MyPhotonInterfaceis created with the photon-specific metadata.
- class IPhoton(*args, **kwargs)
Base class for all Luminal photons.
Important
This class provides several other utility functions and properties that can be used by Luminal photons.
- property photon_name: str
Returns the name of the
IPhoton.- Parameters:
cls (
Type[Self@IPhoton]) – The base class itself.- Returns:
The name of the photon.
- Return type:
- property photon_author: str
Returns the author of the
IPhoton.- Parameters:
cls (
Type[Self@IPhoton]) – The base class itself.- Returns:
The author of the photon, as a string.
- Return type:
- property photon_version: str
Returns the version of the
IPhoton.- Parameters:
cls (
Type[Self@IPhoton]) – The base class itself.- Returns:
The version of the photon, as a string.
- Return type:
- property photon_description: str
Returns the description of the
IPhoton.- Parameters:
cls (
Type[Self@IPhoton]) – The base class itself.- Returns:
The description of the photon, as a string.
- Return type:
- property photon_tags: list[str]
Returns the list of tags associated with the
IPhoton.- Parameters:
cls (
Type[Self@IPhoton]) – The base class itself.- Returns:
The list of tags associated with the photon, as a list of strings.
- Return type:
- _print(message, print_output=True, file=sys.stdout, **kwargs)
Prints the given message to the console or a file.
- print(message, print_output=True, file=sys.stdout, **kwargs)
Prints the given message to the console or a file.
- eprint(message, print_output=True, file=sys.stderr, **kwargs)
Prints the given error message to the console or a file.
- async finalize()
A method that can, and should, be overridden to perform finalization tasks when the photon is unloaded.
- Returns:
A flag which returns
Trueif the finalization method completed successfully, elseFalse.- Return type:
- Raises:
FinalizerNotImplementedError – If this method is not implemented by the subclass.