char package

Submodules

char.main module

This is one and only file with working code in the whole package

exception ArgumentTypeError[source]

Bases: TypeError

Error that type of argument is incorrect

Parameters:TypeError (Exception) – Wrong type of argument was given to function
char(function=None, dict_tuple_types_by_prefix=None, dict_tuple_types_by_prefix_to_update_default=None, bool_is_to_skip_none_value=True)[source]

Decorator for checking types of arguments in function

Check is done according to prefices that was given (or default ones) E.G.

if name of variable starts with int_ and there is prefix “int_” in dict which describe how to check types then if for the argument will be given value with any another type then ArgumentTypeError Exception will be raised
Parameters:
  • function (function, optional) – To call dec without arguments. Defaults to None.
  • dict_tuple_types_by_prefix (dict, optional) – Rules how to check types. Defaults to None.
  • dict_tuple_types_by_prefix_to_update_default (dict, optional) – Additional to default Rules how to check types. Defaults to None.
  • bool_is_to_skip_none_value (bool, optional) – Flag what to do with None values. Defaults to True.
Returns:

Decorator without arguments

Return type:

function

check_type_of_1_argument(str_function_name, str_argument_name, argument_value, tuple_types_var_can_be)[source]

Check type of one argument for function

Parameters:
  • str_function_name (str) – Name of function from which method is called
  • str_argument_name (str) – Name of argument to check
  • argument_value (Any) – Value that was given to this argument
  • tuple_types_var_can_be (tuple of types) – Types this arg can be
Raises:

ArgumentTypeError – Wrong type of argument, child from TypeError

Module contents

char(function=None, dict_tuple_types_by_prefix=None, dict_tuple_types_by_prefix_to_update_default=None, bool_is_to_skip_none_value=True)[source]

Decorator for checking types of arguments in function

Check is done according to prefices that was given (or default ones) E.G.

if name of variable starts with int_ and there is prefix “int_” in dict which describe how to check types then if for the argument will be given value with any another type then ArgumentTypeError Exception will be raised
Parameters:
  • function (function, optional) – To call dec without arguments. Defaults to None.
  • dict_tuple_types_by_prefix (dict, optional) – Rules how to check types. Defaults to None.
  • dict_tuple_types_by_prefix_to_update_default (dict, optional) – Additional to default Rules how to check types. Defaults to None.
  • bool_is_to_skip_none_value (bool, optional) – Flag what to do with None values. Defaults to True.
Returns:

Decorator without arguments

Return type:

function

check_arguments(function=None, dict_tuple_types_by_prefix=None, dict_tuple_types_by_prefix_to_update_default=None, bool_is_to_skip_none_value=True)

Decorator for checking types of arguments in function

Check is done according to prefices that was given (or default ones) E.G.

if name of variable starts with int_ and there is prefix “int_” in dict which describe how to check types then if for the argument will be given value with any another type then ArgumentTypeError Exception will be raised
Parameters:
  • function (function, optional) – To call dec without arguments. Defaults to None.
  • dict_tuple_types_by_prefix (dict, optional) – Rules how to check types. Defaults to None.
  • dict_tuple_types_by_prefix_to_update_default (dict, optional) – Additional to default Rules how to check types. Defaults to None.
  • bool_is_to_skip_none_value (bool, optional) – Flag what to do with None values. Defaults to True.
Returns:

Decorator without arguments

Return type:

function

check_types_of_arguments(function=None, dict_tuple_types_by_prefix=None, dict_tuple_types_by_prefix_to_update_default=None, bool_is_to_skip_none_value=True)

Decorator for checking types of arguments in function

Check is done according to prefices that was given (or default ones) E.G.

if name of variable starts with int_ and there is prefix “int_” in dict which describe how to check types then if for the argument will be given value with any another type then ArgumentTypeError Exception will be raised
Parameters:
  • function (function, optional) – To call dec without arguments. Defaults to None.
  • dict_tuple_types_by_prefix (dict, optional) – Rules how to check types. Defaults to None.
  • dict_tuple_types_by_prefix_to_update_default (dict, optional) – Additional to default Rules how to check types. Defaults to None.
  • bool_is_to_skip_none_value (bool, optional) – Flag what to do with None values. Defaults to True.
Returns:

Decorator without arguments

Return type:

function