Mixins¶
-
class
StorageMixin
[source]¶ Bases:
object
Mixin class to be inherited by a class that uses a StorageProperty.
Provides an instance specific storage space divided into namespaces.
-
storage
¶ Storage for the instance.
Returns: Return type: dict-like object
-
-
class
BaseLogMixin
[source]¶ Bases:
object
Base Mixin class to be inherited by a class requiring logging.
Derived classes can specify the logger_name by overriding the logger name variable.
Optionally, an instance of logging.Logger can be attached after instantiation using the logger attribute.
Extra information to each log record can be added permanently using the logger extra attribute.
-
log
(level, msg, *args, **kwargs)[source]¶ Log with the integer severity ‘level’ on the logger corresponding to this class.
Must be implemented by classes actually logging something.
Parameters: - level – severity level for this event.
- msg – message to be logged (can contain PEP3101 formatting codes)
- *args – arguments passed to logger.log
- **kwargs – keyword arguments passed to the logger.log
See also
log_info()
,log_debug()
,log_error()
,log_warning()
,log_critical()
-
log_critical
(msg, *args, **kwargs)[source]¶ Log with the severity ‘CRITICAL’ on the logger corresponding to this instance.
See also
-
log_debug
(msg, *args, **kwargs)[source]¶ Log with the severity ‘DEBUG’ on the logger corresponding to this instance.
See also
log()
,log_info()
,log_error()
,log_warning()
,log_critical()
-
log_error
(msg, *args, **kwargs)[source]¶ Log with the severity ‘ERROR’ on the logger corresponding to this instance.
See also
log()
,log_info()
,log_debug()
,log_warning()
,log_critical()
-
log_info
(msg, *args, **kwargs)[source]¶ Log with the severity ‘INFO’ on the logger corresponding to this instance.
See also
log()
,log_debug()
,log_error()
,log_warning()
,log_critical()
-
-
class
LogMixin
[source]¶ Bases:
pimpmyclass.mixins.BaseLogMixin
Mixin class to be inherited by a class requiring logging to Python std logging.
Derived classes can specify the logger_name by overriding the logger name variable.
Optionally, an instance of logging.Logger can be attached after instantiation using the logger attribute.
Extra information to each log record can be added permanently using the logger extra attribute.
-
log
(level, msg, *args, **kwargs)[source]¶ Log with the integer severity ‘level’ on the logger corresponding to this class.
Parameters: - level – severity level for this event.
- msg – message to be logged (can contain PEP3101 formatting codes)
- *args – arguments passed to logger.log
- **kwargs – keyword arguments passed to the logger.log
See also
log_info()
,log_debug()
,log_error()
,log_warning()
,log_critical()
-
-
class
LockMixin
[source]¶ Bases:
object
Mixin class to be inherited by a class requiring a reentrant lock.
-
class
AsyncMixin
[source]¶ Bases:
pimpmyclass.mixins.LockMixin
Mixin class to be inherited by a class requiring async operations.
Async operations are implemented using a single worker Thread Pool Executor that returns futures.
The number of pending tasks can be found in async_pending.