Skip to content

UuidMixin

Sub classes

Name Children Inherits
Uuid
prettyqt.core._uuid
Stores a Universally Unique Identifier (UUID).
    BluetoothUuid
    prettyqt.bluetooth.bluetoothuuid
    Generates a UUID for each Bluetooth service.

      🛈 DocStrings

      Bases: _UuidBase

      Source code in prettyqt/core/_uuid.py
      class UuidMixin(_UuidBase):
          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))
      

      :fa-brands-github: Show source on GitHub