Utils Module

Utility helpers for drivers and toolchains.

Provides reusable mixins and helper functions to streamline logging and implementation checks across steps and drivers.

has_impl:

Check whether a subclass provides its own implementation of a method.

short_repr:

Produce a short, human-readable string representation of an object.

LoggerMixin:

Mixin providing standardized logging for start, success, and error events.

plugorm.utils.has_impl(baseclass: type, subclass: type, method_name: str) bool[source]

Checks whether a subclass implements a given method.

Determines if the provided method name has been implemented by checking their identities

Parameters:
  • baseclass (type) – The baseclass of the subclass.

  • subclass (type) – The subclass to check.

  • method_name (str) – The method name to verify.

Returns:

True if the method is implemented, False otherwise.

Return type:

bool

Raises:

AttributeError – If the baseclass does not implement the method

plugorm.utils.short_repr(value: Any, max_len: int = 120) str[source]

Generates a shortened string representation of a value.

Produces a truncated repr(value) if it exceeds the specified maximum length, appending ... to indicate truncation. Useful for logging and debugging large or verbose objects.

Parameters:
  • value (Any) – The object to represent as a string.

  • max_len (int, optional) – The maximum allowed length of the representation. Defaults to 120.

Returns:

The shortened string representation of the value.

Return type:

str