Package rosmaster :: Module validators

Module validators

source code

Internal-use Python decorators for parameter validation

Classes
  ParameterInvalid
Exception that is raised when a parameter fails validation checks
Functions
 
isstring(s)
Small helper version to check an object is a string in a way that works for both Python 2 and 3
source code
 
non_empty(param_name)
Validator that checks that parameter is not empty
source code
 
non_empty_str(param_name)
Validator that checks that parameter is a string and non-empty
source code
 
not_none(param_name)
Validator that checks that parameter is not None
source code
 
is_api(paramName)
Validator that checks that parameter is a valid API handle (i.e.
source code
 
is_topic(param_name)
Validator that checks that parameter is a valid ROS topic name
source code
 
is_service(param_name)
Validator that checks that parameter is a valid ROS service name
source code
 
empty_or_valid_name(param_name)
empty or valid graph resource name.
source code
 
valid_name_validator_resolved(param_name, param_value, caller_id) source code
 
valid_name_validator_unresolved(param_name, param_value, caller_id) source code
str
valid_name(param_name, resolve=True)
Validator that resolves names and also ensures that they are not empty
source code
str
global_name(param_name)
Validator that checks for valid, global graph resource name.
source code
 
valid_type_name(param_name)
validator that checks the type name is specified correctly
source code
Variables
  TYPE_SEPARATOR = '/'
  ROSRPC = 'rosrpc://'
  __package__ = 'rosmaster'
Function Details

is_api(paramName)

source code 

Validator that checks that parameter is a valid API handle (i.e. URI). Both http and rosrpc are allowed schemes.

empty_or_valid_name(param_name)

source code 

empty or valid graph resource name. Validator that resolves names unless they an empty string is supplied, in which case an empty string is returned.

valid_name(param_name, resolve=True)

source code 

Validator that resolves names and also ensures that they are not empty

Parameters:
  • param_name (str) - name
  • resolve (bool) - if True/omitted, the name will be resolved to a global form. Otherwise, no resolution occurs.
Returns: str
resolved parameter value

global_name(param_name)

source code 

Validator that checks for valid, global graph resource name.

Returns: str
parameter value