robot.running.arguments package

Submodules

robot.running.arguments.argumentconverter module

class robot.running.arguments.argumentconverter.ArgumentConverter(arg_spec: ArgumentSpec, custom_converters: CustomArgumentConverters, dry_run: bool = False, languages: LanguagesLike = None)[source]

Bases: object

convert(positional, named)[source]

robot.running.arguments.argumentmapper module

class robot.running.arguments.argumentmapper.ArgumentMapper(arg_spec: ArgumentSpec)[source]

Bases: object

map(positional, named, replace_defaults=True)[source]
class robot.running.arguments.argumentmapper.KeywordCallTemplate(spec: ArgumentSpec)[source]

Bases: object

fill_positional(positional)[source]
fill_named(named)[source]
replace_defaults()[source]
class robot.running.arguments.argumentmapper.DefaultValue(value)[source]

Bases: object

resolve(variables)[source]

robot.running.arguments.argumentparser module

class robot.running.arguments.argumentparser.ArgumentParser(type: str = 'Keyword', error_reporter: Callable[[str], None] | None = None)[source]

Bases: ABC

abstract parse(source: Any, name: str | None = None) ArgumentSpec[source]
class robot.running.arguments.argumentparser.PythonArgumentParser(type: str = 'Keyword', error_reporter: Callable[[str], None] | None = None)[source]

Bases: ArgumentParser

parse(method, name=None)[source]
class robot.running.arguments.argumentparser.ArgumentSpecParser(type: str = 'Keyword', error_reporter: Callable[[str], None] | None = None)[source]

Bases: ArgumentParser

parse(arguments, name=None)[source]
class robot.running.arguments.argumentparser.DynamicArgumentParser(type: str = 'Keyword', error_reporter: Callable[[str], None] | None = None)[source]

Bases: ArgumentSpecParser

class robot.running.arguments.argumentparser.UserKeywordArgumentParser(type: str = 'Keyword', error_reporter: Callable[[str], None] | None = None)[source]

Bases: ArgumentSpecParser

robot.running.arguments.argumentresolver module

class robot.running.arguments.argumentresolver.ArgumentResolver(spec: ArgumentSpec, resolve_named: bool = True, resolve_args_until: int | None = None, dict_to_kwargs: bool = False)[source]

Bases: object

resolve(arguments, variables=None)[source]
class robot.running.arguments.argumentresolver.NamedArgumentResolver(spec: ArgumentSpec)[source]

Bases: object

resolve(arguments, variables=None)[source]
class robot.running.arguments.argumentresolver.NullNamedArgumentResolver[source]

Bases: object

resolve(arguments, variables=None)[source]
class robot.running.arguments.argumentresolver.DictToKwargs(spec: ArgumentSpec, enabled: bool = False)[source]

Bases: object

handle(positional, named)[source]
class robot.running.arguments.argumentresolver.VariableReplacer(spec: ArgumentSpec, resolve_until: int | None = None)[source]

Bases: object

replace(positional, named, variables=None)[source]

robot.running.arguments.argumentspec module

class robot.running.arguments.argumentspec.ArgumentSpec(name: str | Callable[[], str] | None = None, type: str = 'Keyword', positional_only: Sequence[str] = (), positional_or_named: Sequence[str] = (), var_positional: str | None = None, named_only: Sequence[str] = (), var_named: str | None = None, defaults: Mapping[str, Any] | None = None, embedded: Sequence[str] = (), types: Mapping[str, TypeInfo] | None = None, return_type: TypeInfo | None = None)[source]

Bases: object

type
positional_only
positional_or_named
var_positional
named_only
var_named
embedded
defaults
property name: str | None
types
return_type
property positional: tuple[str, ...]
property named: tuple[str, ...]
property minargs: int
property maxargs: int
property argument_names: tuple[str, ...]
resolve(arguments, variables=None, converters=None, resolve_named=True, resolve_args_until=None, dict_to_kwargs=False, languages=None) tuple[list, list][source]
convert(positional, named, converters=None, dry_run=False, languages=None) tuple[list, list][source]
map(positional, named, replace_defaults=True) tuple[list, list][source]
copy() ArgumentSpec[source]
class robot.running.arguments.argumentspec.ArgInfo(kind: str, name: str = '', type: ~robot.running.arguments.typeinfo.TypeInfo | None = None, default: ~typing.Any =)[source]

Bases: object

Contains argument information. Only used by Libdoc.

POSITIONAL_ONLY = 'POSITIONAL_ONLY'
POSITIONAL_ONLY_MARKER = 'POSITIONAL_ONLY_MARKER'
POSITIONAL_OR_NAMED = 'POSITIONAL_OR_NAMED'
VAR_POSITIONAL = 'VAR_POSITIONAL'
NAMED_ONLY_MARKER = 'NAMED_ONLY_MARKER'
NAMED_ONLY = 'NAMED_ONLY'
VAR_NAMED = 'VAR_NAMED'
property required: bool
property default_repr: str | None

robot.running.arguments.argumentvalidator module

class robot.running.arguments.argumentvalidator.ArgumentValidator(arg_spec: ArgumentSpec)[source]

Bases: object

validate(positional, named, dryrun=False)[source]

robot.running.arguments.customconverters module

class robot.running.arguments.customconverters.CustomArgumentConverters(converters)[source]

Bases: object

classmethod from_dict(converters, library=None)[source]
get_converter_info(type_)[source]
class robot.running.arguments.customconverters.ConverterInfo(type, converter, value_types, library=None)[source]

Bases: object

property name
property doc
classmethod for_converter(type_, converter, library)[source]
convert(value)[source]

robot.running.arguments.embedded module

class robot.running.arguments.embedded.EmbeddedArguments(name: Pattern, args: Sequence[str] = (), custom_patterns: Mapping[str, str] | None = None)[source]

Bases: object

classmethod from_name(name: str) EmbeddedArguments | None[source]
match(name: str) Match | None[source]
map(args: Sequence[Any]) list[tuple[str, Any]][source]
validate(args: Sequence[Any])[source]

Validate that embedded args match custom regexps.

Initial validation is done already when matching keywords, but this validation makes sure arguments match also if they are given as variables.

Currently, argument not matching only causes a deprecation warning, but that will be changed to ValueError in RF 8.0: https://github.com/robotframework/robotframework/issues/4069

class robot.running.arguments.embedded.EmbeddedArgumentParser[source]

Bases: object

parse(string: str) EmbeddedArguments | None[source]

robot.running.arguments.typeconverters module

class robot.running.arguments.typeconverters.TypeConverter(type_info: TypeInfo, custom_converters: CustomArgumentConverters | None = None, languages: Languages | None = None)[source]

Bases: object

type = None
type_name = None
abc = None
value_types = (<class 'str'>,)
doc = None
classmethod register(converter: type[TypeConverter]) type[TypeConverter][source]
classmethod converter_for(type_info: TypeInfo, custom_converters: CustomArgumentConverters | None = None, languages: Languages | None = None) TypeConverter | None[source]
classmethod handles(type_info: TypeInfo) bool[source]
convert(value: Any, name: str | None = None, kind: str = 'Argument') Any[source]
no_conversion_needed(value: Any) bool[source]
class robot.running.arguments.typeconverters.EnumConverter(type_info: TypeInfo, custom_converters: CustomArgumentConverters | None = None, languages: Languages | None = None)[source]

Bases: TypeConverter

type

alias of Enum

property type_name
property value_types

Built-in immutable sequence.

If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable’s items.

If the argument is a tuple, the return value is the same object.

class robot.running.arguments.typeconverters.AnyConverter(type_info: TypeInfo, custom_converters: CustomArgumentConverters | None = None, languages: Languages | None = None)[source]

Bases: TypeConverter

type

alias of Any

type_name = 'Any'
value_types = (typing.Any,)
classmethod handles(type_info: TypeInfo)[source]
no_conversion_needed(value)[source]
class robot.running.arguments.typeconverters.StringConverter(type_info: TypeInfo, custom_converters: CustomArgumentConverters | None = None, languages: Languages | None = None)[source]

Bases: TypeConverter

type

alias of str

type_name = 'string'
value_types = (typing.Any,)
class robot.running.arguments.typeconverters.BooleanConverter(type_info: TypeInfo, custom_converters: CustomArgumentConverters | None = None, languages: Languages | None = None)[source]

Bases: TypeConverter

type

alias of bool

type_name = 'boolean'
value_types = (<class 'str'>, <class 'int'>, <class 'float'>, <class 'NoneType'>)
class robot.running.arguments.typeconverters.IntegerConverter(type_info: TypeInfo, custom_converters: CustomArgumentConverters | None = None, languages: Languages | None = None)[source]

Bases: TypeConverter

type

alias of int

abc

alias of Integral

type_name = 'integer'
value_types = (<class 'str'>, <class 'float'>)
class robot.running.arguments.typeconverters.FloatConverter(type_info: TypeInfo, custom_converters: CustomArgumentConverters | None = None, languages: Languages | None = None)[source]

Bases: TypeConverter

type

alias of float

abc

alias of Real

type_name = 'float'
value_types = (<class 'str'>, <class 'numbers.Real'>)
class robot.running.arguments.typeconverters.DecimalConverter(type_info: TypeInfo, custom_converters: CustomArgumentConverters | None = None, languages: Languages | None = None)[source]

Bases: TypeConverter

type

alias of Decimal

type_name = 'decimal'
value_types = (<class 'str'>, <class 'int'>, <class 'float'>)
class robot.running.arguments.typeconverters.BytesConverter(type_info: TypeInfo, custom_converters: CustomArgumentConverters | None = None, languages: Languages | None = None)[source]

Bases: TypeConverter

type

alias of bytes

type_name = 'bytes'
value_types = (<class 'str'>, <class 'bytearray'>)
class robot.running.arguments.typeconverters.ByteArrayConverter(type_info: TypeInfo, custom_converters: CustomArgumentConverters | None = None, languages: Languages | None = None)[source]

Bases: TypeConverter

type

alias of bytearray

type_name = 'bytearray'
value_types = (<class 'str'>, <class 'bytes'>)
class robot.running.arguments.typeconverters.DateTimeConverter(type_info: TypeInfo, custom_converters: CustomArgumentConverters | None = None, languages: Languages | None = None)[source]

Bases: TypeConverter

type

alias of datetime

type_name = 'datetime'
value_types = (<class 'str'>, <class 'int'>, <class 'float'>)
class robot.running.arguments.typeconverters.DateConverter(type_info: TypeInfo, custom_converters: CustomArgumentConverters | None = None, languages: Languages | None = None)[source]

Bases: TypeConverter

type

alias of date

type_name = 'date'
class robot.running.arguments.typeconverters.TimeDeltaConverter(type_info: TypeInfo, custom_converters: CustomArgumentConverters | None = None, languages: Languages | None = None)[source]

Bases: TypeConverter

type

alias of timedelta

type_name = 'timedelta'
value_types = (<class 'str'>, <class 'int'>, <class 'float'>)
class robot.running.arguments.typeconverters.PathConverter(type_info: TypeInfo, custom_converters: CustomArgumentConverters | None = None, languages: Languages | None = None)[source]

Bases: TypeConverter

type

alias of Path

abc

alias of PathLike

type_name = 'Path'
value_types = (<class 'str'>, <class 'pathlib.PurePath'>)
class robot.running.arguments.typeconverters.NoneConverter(type_info: TypeInfo, custom_converters: CustomArgumentConverters | None = None, languages: Languages | None = None)[source]

Bases: TypeConverter

type

alias of None

type_name = 'None'
classmethod handles(type_info: TypeInfo) bool[source]
class robot.running.arguments.typeconverters.ListConverter(type_info: TypeInfo, custom_converters: CustomArgumentConverters | None = None, languages: Languages | None = None)[source]

Bases: TypeConverter

type

alias of list

abc

alias of Sequence

value_types = (<class 'str'>, <class 'collections.abc.Sequence'>)
type_name = 'list'
no_conversion_needed(value)[source]
class robot.running.arguments.typeconverters.TupleConverter(type_info: TypeInfo, custom_converters: CustomArgumentConverters | None = None, languages: Languages | None = None)[source]

Bases: TypeConverter

type

alias of tuple

value_types = (<class 'str'>, <class 'collections.abc.Sequence'>)
type_name = 'tuple'
no_conversion_needed(value)[source]
class robot.running.arguments.typeconverters.TypedDictConverter(type_info: TypedDictInfo, custom_converters: CustomArgumentConverters | None = None, languages: Languages | None = None)[source]

Bases: TypeConverter

type = 'TypedDict'
value_types = (<class 'str'>, <class 'collections.abc.Mapping'>)
type_info: TypedDictInfo
classmethod handles(type_info: TypeInfo) bool[source]
no_conversion_needed(value)[source]
class robot.running.arguments.typeconverters.DictionaryConverter(type_info: TypeInfo, custom_converters: CustomArgumentConverters | None = None, languages: Languages | None = None)[source]

Bases: TypeConverter

type

alias of dict

abc

alias of Mapping

value_types = (<class 'str'>, <class 'collections.abc.Mapping'>)
type_name = 'dictionary'
no_conversion_needed(value)[source]
class robot.running.arguments.typeconverters.SetConverter(type_info: TypeInfo, custom_converters: CustomArgumentConverters | None = None, languages: Languages | None = None)[source]

Bases: TypeConverter

type

alias of set

abc

alias of Set

value_types = (<class 'str'>, <class 'collections.abc.Container'>)
type_name = 'set'
no_conversion_needed(value)[source]
class robot.running.arguments.typeconverters.FrozenSetConverter(type_info: TypeInfo, custom_converters: CustomArgumentConverters | None = None, languages: Languages | None = None)[source]

Bases: SetConverter

type

alias of frozenset

type_name = 'frozenset'
class robot.running.arguments.typeconverters.UnionConverter(type_info: TypeInfo, custom_converters: CustomArgumentConverters | None = None, languages: Languages | None = None)[source]

Bases: TypeConverter

type = typing.Union
property type_name
classmethod handles(type_info: TypeInfo) bool[source]
no_conversion_needed(value)[source]
class robot.running.arguments.typeconverters.LiteralConverter(type_info: TypeInfo, custom_converters: CustomArgumentConverters | None = None, languages: Languages | None = None)[source]

Bases: TypeConverter

type = typing.Literal
value_types = (typing.Any,)
type_name = 'Literal'
literal_converter_for(type_info: TypeInfo, languages: Languages | None = None) TypeConverter[source]
classmethod handles(type_info: TypeInfo) bool[source]
no_conversion_needed(value: Any) bool[source]
class robot.running.arguments.typeconverters.CustomConverter(type_info: TypeInfo, converter_info: ConverterInfo, languages: Languages | None = None)[source]

Bases: TypeConverter

property type_name
property doc
property value_types

Built-in immutable sequence.

If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable’s items.

If the argument is a tuple, the return value is the same object.

class robot.running.arguments.typeconverters.NullConverter[source]

Bases: object

convert(value, name, kind='Argument')[source]
no_conversion_needed(value)[source]

robot.running.arguments.typeinfo module

class robot.running.arguments.typeinfo.TypeInfo(name: str | None = None, type: ~typing.Any =, nested: ~collections.abc.Sequence[~robot.running.arguments.typeinfo.TypeInfo] | None = None)[source]

Bases: object

Represents an argument type.

Normally created using the from_type_hint() classmethod. With unions and parametrized types, nested contains nested types.

Values can be converted according to this type info by using the convert() method.

Part of the public API starting from Robot Framework 7.0. In such usage should be imported via the robot.api package.

is_typed_dict = False
name
type
nested

Nested types as a tuple of TypeInfo objects.

Used with parameterized types and unions.

property is_union
classmethod from_type_hint(hint: Any) TypeInfo[source]

Construct a TypeInfo based on a type hint.

The type hint can be in various different formats:

  • an actual type such as int

  • a parameterized type such as list[int]

  • a union such as int | float

  • a string such as 'int', 'list[int]' or 'int | float'

  • a TypedDict (represented as a TypedDictInfo)

  • a sequence of supported type hints to create a union from such as [int, float] or ('int', 'list[int]')

In special cases, for example with dictionaries or sequences, using the more specialized methods like from_dict() or from_sequence() may be more appropriate than using this generic method.

classmethod from_type(hint: type) TypeInfo[source]

Construct a TypeInfo based on an actual type.

Use from_type_hint() if the type hint can also be something else than a concrete type such as a string.

classmethod from_string(hint: str) TypeInfo[source]

Construct a TypeInfo based on a string.

In addition to just types names or their aliases like int or integer, supports also parameterized types like list[int] as well as unions like int | float.

Use from_type_hint() if the type hint can also be something else than a string such as an actual type.

classmethod from_sequence(sequence: tuple | list) TypeInfo[source]

Construct a TypeInfo based on a sequence of types.

Types can be actual types, strings, or anything else accepted by from_type_hint(). If the sequence contains just one type, a TypeInfo created based on it is returned. If there are more types, the returned TypeInfo represents a union. Using an empty sequence is an error.

Use from_type_hint() if other types than sequences need to supported.

convert(value: Any, name: str | None = None, custom_converters: CustomArgumentConverters | dict | None = None, languages: LanguagesLike = None, kind: str = 'Argument')[source]

Convert value based on type information this TypeInfo contains.

Parameters:
  • value – Value to convert.

  • name – Name of the argument or other thing to convert. Used only for error reporting.

  • custom_converters – Custom argument converters.

  • languages – Language configuration. During execution, uses the current language configuration by default.

  • kind – Type of the thing to be converted. Used only for error reporting.

Raises:

TypeError if there is no converter for this type or ValueError is conversion fails.

Returns:

Converted value.

class robot.running.arguments.typeinfo.TypedDictInfo(name: str, type: type)[source]

Bases: TypeInfo

Represents TypedDict used as an argument.

is_typed_dict = True
required
annotations

robot.running.arguments.typeinfoparser module

class robot.running.arguments.typeinfoparser.TokenType(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

NAME = 1
LEFT_SQUARE = 2
RIGHT_SQUARE = 3
PIPE = 4
COMMA = 5
class robot.running.arguments.typeinfoparser.Token(type: robot.running.arguments.typeinfoparser.TokenType, value: str, position: int = -1)[source]

Bases: object

type: TokenType
value: str
position: int = -1
class robot.running.arguments.typeinfoparser.TypeInfoTokenizer(source: str)[source]

Bases: object

markers = {',': TokenType.COMMA, '[': TokenType.LEFT_SQUARE, ']': TokenType.RIGHT_SQUARE, '|': TokenType.PIPE}
property at_end: bool
tokenize() list[Token][source]
advance() str[source]
peek() str | None[source]
name()[source]
add_token(type: TokenType)[source]
class robot.running.arguments.typeinfoparser.TypeInfoParser(source: str)[source]

Bases: object

property at_end: bool
parse() TypeInfo[source]
type() TypeInfo[source]
params(literal: bool = False) list[TypeInfo][source]
union() list[TypeInfo][source]
match(*types: TokenType) bool[source]
check(expected: TokenType) bool[source]
advance() Token | None[source]
peek() Token | None[source]
error(message: str, token: Token | None = None)[source]

robot.running.arguments.typevalidator module

class robot.running.arguments.typevalidator.TypeValidator(spec: ArgumentSpec)[source]

Bases: object

validate(types: Mapping | Sequence | None) dict[str, TypeInfo] | None[source]