ats_utilities.checker package

Module contents

Module
__init__.py
Copyright
Copyright (C) 2017 Vladimir Roncevic <elektron.ronca@gmail.com> ats_utilities is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. ats_utilities is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Info
Defined class ATSChecker with attribute(s) and method(s). Created API fo checking parameters for object methods and functions.
class ats_utilities.checker.ATSChecker[source]

Bases: object

Defined class ATSChecker with attribute(s) and method(s). Created API fo checking parameters for object methods and functions. It defines:

attributes:
NO_ERROR - no error, error id (0).
TYPE_ERROR - type param error id (1).
VALUE_ERROR - value param error id (2).
FORMAT_ERROR - wrong format error id (3).
__start_message - start segment of usage message.
__list_of_params - list of parameters for method/function.
__error_type - list of mapped errors.
__error_type_index - error type index.
__error_value_index - error value index.
methods:
__init__ - initial constructor.
collect_params - collect all parameters in one list.
usage_message - prepare usage message for method/function.
check_types - check parameters (types) for method/function.
check_values - check parameters (values) for method/function.
priority_error - set priority error id (TYPE_ERROR).
check_params - check parameters for method/function.
__str__ - str dunder method for object ATSChecker.
FORMAT_ERROR = 3
NO_ERROR = 0
TYPE_ERROR = 1
VALUE_ERROR = 2
check_params(params_description)[source]

Check parameters for method/function.

Parameters:params_description (<list>) – parameters description.
Returns:usage message, status (0 | 1 | 2 | 3).
Return type:<str>, <int>
Exceptions:None
check_types(params_description)[source]

Check parameters (types) for method/function.

Parameters:params_description (<OrderedDict>) – parameters description.
Returns:boolean status, True (ok) | False.
Return type:<bool>
Exceptions:None
check_values(params_description)[source]

Check parameters (values) for method/function.

Parameters:params_description (<OrderedDict>) – parameters description.
Returns:boolean status, True (ok) | False.
Return type:<bool>
Exceptions:None
collect_params(params_description)[source]

Collect all parameters in one list.

Parameters:
  • params_description (<OrderedDict>) – description for parameters.
  • verbose (<bool>) – enable/disable verbose option.
Returns:

True (format for params ok) | False.

Returns:

boolean status, True (ok) | False.

Return type:

<bool>

Exceptions:

None

priority_error()[source]

Set priority error id (TYPE_ERROR).

Returns:priority error id (0 | 1 | 2 | 3) | None.
Return type:<int> | <NoneType>
Exceptions:None
usage_message()[source]

Prepare usage message for method/function.

Returns:usage message for method/function.
Return type:<str>
Exceptions:None