viam.resource.types

Attributes

RESOURCE_NAMESPACE_RDK

RESOURCE_TYPE_COMPONENT

RESOURCE_TYPE_SERVICE

ResourceCreator

Validator

Classes

Subtype

Represents a known component/service (resource) API

ModelFamily

Represents a family of related models

Model

Represents a specific model within a family of models

SupportsGetGeometries

The SupportsGetGeometries protocol defines the requirements for a resource to call get_geometries.

Functions

resource_name_from_string(→ viam.proto.common.ResourceName)

Create a ResourceName from its string representation (namespace:resource_type:resource_subtype/<optional_remote:>name)

Module Contents

viam.resource.types.RESOURCE_NAMESPACE_RDK = 'rdk'
viam.resource.types.RESOURCE_TYPE_COMPONENT = 'component'
viam.resource.types.RESOURCE_TYPE_SERVICE = 'service'
class viam.resource.types.Subtype(namespace: str, resource_type: str, resource_subtype: str)[source]

Represents a known component/service (resource) API

namespace: str

The namespace of the resource

resource_type: str

The type of the resource, for example component or service

resource_subtype: str

The subtype of the resource for example servo, arm, vision

__str__() str[source]
__repr__() str[source]
__hash__() int[source]
__eq__(other: object) bool[source]
classmethod from_resource_name(resource_name: viam.proto.common.ResourceName) typing_extensions.Self[source]

Convert a `ResourceName` into a `Subtype`

Parameters:

resource_name (viam.proto.common.ResourceName) – The ResourceName to convert

Returns:

A new Subtype

Return type:

Self

classmethod from_string(string: str) typing_extensions.Self[source]

Create a `Subtype` from its string representation (namespace:resource_type:resource_subtype)

Parameters:

string (str) – The Subtype as a string

Raises:

ValueError – Raised if the string does not represent a valid Subtype

Returns:

A new Subtype

Return type:

Self

class viam.resource.types.ModelFamily(namespace: str, family: str)[source]

Represents a family of related models

namespace: str

The namespace of the model family

family: str

The family name

DEFAULT_FAMILY_NAME: ClassVar[str] = 'builtin'
DEFAULT: ClassVar[ModelFamily]
__str__() str[source]
__repr__() str[source]
__hash__() int[source]
__eq__(other: object) bool[source]
class viam.resource.types.Model(model_family: ModelFamily, name: str)[source]

Represents a specific model within a family of models

model_family: ModelFamily

The family to which this model belongs

name: str

The name of the model

__str__() str[source]
__repr__() str[source]
__hash__() int[source]
__eq__(other: object) bool[source]
classmethod from_string(model: str, *, ignore_errors=False) typing_extensions.Self[source]

Create a `Model` from its string representation (namespace:family:name).

Parameters:
  • model (str) – The Model as a string

  • ignore_errors (bool, optional) – If namespace or family are not found in the string, default to empty string rather than raise an exception. Defaults to False.

Raises:

ValueError – Raised if the provided string is not a valid Model

Returns:

The Model

Return type:

Self

viam.resource.types.resource_name_from_string(string: str) viam.proto.common.ResourceName[source]

Create a ResourceName from its string representation (namespace:resource_type:resource_subtype/<optional_remote:>name)

Parameters:

string (str) – The ResourceName as a string

Raises:

ValueError – Raised if the provided string is not a valid ResourceName

Returns:

The new ResourceName

Return type:

viam.proto.common.ResourceName

viam.resource.types.ResourceCreator: TypeAlias = Callable[[ComponentConfig, Mapping[ResourceName, 'ResourceBase']], 'ResourceBase']
viam.resource.types.Validator: TypeAlias = Callable[[ComponentConfig], Sequence[str]]
class viam.resource.types.SupportsGetGeometries[source]

Bases: Protocol

The SupportsGetGeometries protocol defines the requirements for a resource to call get_geometries.

async GetGeometries(request: viam.proto.common.GetGeometriesRequest, *, timeout: float | None = None, **kwargs) viam.proto.common.GetGeometriesResponse[source]