Uuid#

Added in version 0.78.

class Uuid(*args, **kwargs)#

An object representing an UUID.

Constructors#

class Uuid
classmethod new_from_string(str: str, len: int, fmt: UuidFormat) Uuid | None#

Creates a new UUID from its string representation str.

Added in version 0.78.

Parameters:
  • str – a string

  • len – the length of str, or -1 is str is NUL terminated

  • fmt – flags from UuidFormat for which fmt(s) to accept

classmethod new_v4() Uuid#

Creates a new random UUID.

Added in version 0.78.

Methods#

class Uuid
dup() Uuid#

Creates a copy of uuid.

Added in version 0.78.

equal(other: Uuid) bool#

Compares uuid and other for equality.

Added in version 0.78.

Parameters:

other

free() None#

Frees uuid.

Added in version 0.78.

free_to_string(fmt: UuidFormat, len: int) str#

Frees uuid and returns its string representation, see to_string() for more information.

Added in version 0.78.

Parameters:
  • fmt – a UuidFormat

  • len – a location to store the length of the returned string, or None

new_v5(data: str, len: int) Uuid#

Creates a new UUID for ns and str.

Added in version 0.78.

Parameters:
  • data – string data

  • len – the length of data, or -1 if str is NUL terminated

to_string(fmt: UuidFormat) tuple[str, int]#

Returns the string representation of uuid.

Added in version 0.78.

Parameters:

fmt – a UuidFormat

classmethod validate_string(str: str, len: int, fmt: UuidFormat) bool#

Checks whether str is a valid string representation of an UUID.

Added in version 0.78.

Parameters:
  • str – a string

  • len – the length of str, or -1 is str is NUL terminated

  • fmt – a UuidFormat