Skip to content

UuidMixin

Subclasses

Class Module Description
Uuid prettyqt.core.uuid
BluetoothUuid prettyqt.bluetooth.bluetoothuuid

⋔ Inheritance diagram

graph TD
  1473299804288["core.UuidMixin"]
  140713234304496["builtins.object"]
  140713234304496 --> 1473299804288

🛈 DocStrings

Source code in prettyqt\core\uuid.py
class UuidMixin:
    def __repr__(self):
        return get_repr(self, self.toString())

    def __str__(self):
        return self.toString()

    def __bool__(self):
        return not self.isNull()

    def __reduce__(self):
        return type(self), (self.toString(),)

    def __format__(self, format_spec: StringFormatStr):
        return self.to_string(format_spec)

    def get_variant(self) -> VariantStr:
        return VARIANTS.inverse[self.variant()]

    def get_version(self) -> VersionStr:
        return VERSION.inverse[self.version()]

    @classmethod
    def create_uuid(cls) -> Self:
        # workaround for PySide2, not able to clone in ctor
        return cls(cls.createUuid().toString())

    def to_string(
        self, fmt: StringFormatStr | QtCore.QUuid.StringFormat = "with_braces"
    ) -> str:
        """Return string representation of the Uuid.

        Allowed values are "with_braces", "without_braces", "id_128"

        Args:
            fmt: Uuid format to use
        """
        return self.toString(STRING_FORMATS.get_enum_value(fmt))

to_string(fmt: StringFormatStr | QtCore.QUuid.StringFormat = 'with_braces') -> str

Return string representation of the Uuid.

Allowed values are "with_braces", "without_braces", "id_128"

Parameters:

Name Type Description Default
fmt StringFormatStr | StringFormat

Uuid format to use

'with_braces'
Source code in prettyqt\core\uuid.py
def to_string(
    self, fmt: StringFormatStr | QtCore.QUuid.StringFormat = "with_braces"
) -> str:
    """Return string representation of the Uuid.

    Allowed values are "with_braces", "without_braces", "id_128"

    Args:
        fmt: Uuid format to use
    """
    return self.toString(STRING_FORMATS.get_enum_value(fmt))