Robot Framework
robot.utils.robottypes Namespace Reference

Functions

def _get_type_name (typ)
 
def _has_args (typ)
 
def is_bytes (item)
 
def is_dict_like (item)
 
def is_falsy (item)
 Opposite of :func:is_truthy. More...
 
def is_integer (item)
 
def is_list_like (item)
 
def is_number (item)
 
def is_pathlike (item)
 
def is_string (item)
 
def is_truthy (item)
 Returns True or False depending on is the item considered true or not. More...
 
def is_union (item, allow_tuple=False)
 
def type_name (item, capitalize=False)
 Return "non-technical" type name for objects and types. More...
 
def type_repr (typ)
 Return string representation for types. More...
 

Variables

dictionary FALSE_STRINGS = {'FALSE', 'NO', 'OFF', '0', 'NONE', ''}
 
dictionary TRUE_STRINGS = {'TRUE', 'YES', 'ON', '1'}
 
tuple typeddict_types = ()
 
tuple UnionType = ()
 

Function Documentation

◆ _get_type_name()

def robot.utils.robottypes._get_type_name (   typ)
private

Definition at line 132 of file robottypes.py.

◆ _has_args()

def robot.utils.robottypes._has_args (   typ)
private

Definition at line 140 of file robottypes.py.

◆ is_bytes()

def robot.utils.robottypes.is_bytes (   item)

Definition at line 54 of file robottypes.py.

◆ is_dict_like()

def robot.utils.robottypes.is_dict_like (   item)

Definition at line 72 of file robottypes.py.

◆ is_falsy()

def robot.utils.robottypes.is_falsy (   item)

Opposite of :func:is_truthy.

Definition at line 169 of file robottypes.py.

◆ is_integer()

def robot.utils.robottypes.is_integer (   item)

Definition at line 46 of file robottypes.py.

◆ is_list_like()

def robot.utils.robottypes.is_list_like (   item)

Definition at line 66 of file robottypes.py.

◆ is_number()

def robot.utils.robottypes.is_number (   item)

Definition at line 50 of file robottypes.py.

◆ is_pathlike()

def robot.utils.robottypes.is_pathlike (   item)

Definition at line 62 of file robottypes.py.

◆ is_string()

def robot.utils.robottypes.is_string (   item)

Definition at line 58 of file robottypes.py.

◆ is_truthy()

def robot.utils.robottypes.is_truthy (   item)

Returns True or False depending on is the item considered true or not.

Validation rules:

- If the value is a string, it is considered false if it is `'FALSE'`,
  `'NO'`, `'OFF'`, `'0'`, `'NONE'` or `''`, case-insensitively.
- Other strings are considered true.
- Other values are handled by using the standard `bool()` function.

Designed to be used also by external test libraries that want to handle
Boolean values similarly as Robot Framework itself. See also
:func:`is_falsy`.

Definition at line 162 of file robottypes.py.

◆ is_union()

def robot.utils.robottypes.is_union (   item,
  allow_tuple = False 
)

Definition at line 76 of file robottypes.py.

◆ type_name()

def robot.utils.robottypes.type_name (   item,
  capitalize = False 
)

Return "non-technical" type name for objects and types.

For example, 'integer' instead of 'int' and 'file' instead of 'TextIOWrapper'.

Definition at line 86 of file robottypes.py.

◆ type_repr()

def robot.utils.robottypes.type_repr (   typ)

Return string representation for types.

Aims to look as much as the source code as possible. For example, 'List[Any]'
instead of 'typing.List[typing.Any]'.

Definition at line 116 of file robottypes.py.

Variable Documentation

◆ FALSE_STRINGS

dictionary robot.utils.robottypes.FALSE_STRINGS = {'FALSE', 'NO', 'OFF', '0', 'NONE', ''}

Definition at line 43 of file robottypes.py.

◆ TRUE_STRINGS

dictionary robot.utils.robottypes.TRUE_STRINGS = {'TRUE', 'YES', 'ON', '1'}

Definition at line 42 of file robottypes.py.

◆ typeddict_types

tuple robot.utils.robottypes.typeddict_types = ()

Definition at line 29 of file robottypes.py.

◆ UnionType

tuple robot.utils.robottypes.UnionType = ()

Definition at line 24 of file robottypes.py.