_uuid_key

Module Contents

Classes

HasUUID

A class where each instance has a UUID.

UUIDKey

Wraps a value and implements __eq__ and __hash__ based purely on id(value).

class HasUUID

Bases: Protocol

Inheritance diagram of modular_robot_physical._uuid_key.HasUUID

A class where each instance has a UUID.

property uuid: uuid.UUID

Get the uuid.

Returns:

The uuid.

# noqa: DAR202

class UUIDKey(value: _T)

Bases: Generic[_T]

Inheritance diagram of modular_robot_physical._uuid_key.UUIDKey

Wraps a value and implements __eq__ and __hash__ based purely on id(value).

property value: _T

Get the wrapped value.

Returns:

The value.

__eq__(other: object) bool

Compare with another wrapped value using their ids.

Parameters:

other – The object to compare with.

Returns:

Whether their ids are equal.

Raises:

ValueError – If the other objecgt is not an UUIDKey.

__hash__() int

Hash this object using its id only.

Returns:

The hash.