ament_index_python.resources module

exception ament_index_python.resources.InvalidResourceNameError

Bases: ValueError

Raised when a resource name is invalid.

exception ament_index_python.resources.InvalidResourceTypeNameError

Bases: ValueError

Raised when a resource type name is invalid.

ament_index_python.resources.get_resource(resource_type: str, resource_name: str) Tuple[str, str]

Get the content of a specific resource and its prefix path.

Parameters:
  • resource_type (str) – the type of the resource

  • resource_names – the name of the resource

Returns:

a tuple of the content (bytes) of the resource and its prefix path

Raises:

EnvironmentError

Raises:

OSError

Raises:

LookupError

Raises:

InvalidResourceTypeNameError

Raises:

InvalidResourceNameError

ament_index_python.resources.get_resource_types() set[str]

Get the resource types.

Returns:

set of resource types within the search paths

Raises:

EnvironmentError

ament_index_python.resources.get_resources(resource_type: str) Dict[str, str]

Get the resource names of all resources of the specified type.

Parameters:

resource_type (str) – the type of the resource

Returns:

dict of resource names to the prefix path they are in

Raises:

EnvironmentError

Raises:

InvalidResourceTypeNameError

ament_index_python.resources.has_resource(resource_type: str, resource_name: str) str | Literal[False]

Check if a specific resource exists.

Parameters:
  • resource_type (str) – the type of the resource

  • resource_names – the name of the resource

Returns:

The prefix path if the resource exists, False otherwise

Raises:

EnvironmentError

Raises:

InvalidResourceTypeNameError

Raises:

InvalidResourceNameError