otx.api.utils.argument_checks#
Utils for checking functions and methods arguments.
Functions
|
Function raises ValueError exception if dictionary key or value has unexpected type. |
|
Function to check directory path string objects. |
|
Function raises ValueError exception if file has unexpected extension. |
|
Function to check file path string objects. |
|
Decorator to check input parameters type. |
|
Checks if the parameter is like a dataset. |
|
Function to check type of parameters with nested elements. |
|
Function raises ValueError exception if one of elements in collection has unexpected type. |
|
Function extracts nested expected types and raises ValueError exception if parameter has unexpected type. |
|
Function raises ValueError if one of string-parameter characters is not printable. |
|
Function raises ValueError exception if file not exists. |
Function raises ValueError exception if null character: '0' is specified in path to file. |
|
|
Function raises ValueError if parameter is empty. |
|
Function to get set of all base classes of parameter. |
|
Function to get parameter representation. |
Function raises ValueError exception if parameter has unexpected type. |
Classes
Abstract class to check input arguments. |
|
|
Class to check DatasetEntity-type parameters. |
|
Class to check directory path parameters. |
|
Class to check file_path-like parameters. |
|
Class to check input config_parameters. |
|
Class to check optional yaml file path parameters. |
|
Class to check optional directory path parameters. |
|
Class to check optional file_path-like parameters. |
|
Class to check optional image file path parameters. |
|
Class to check optional yaml file path parameters. |
- class otx.api.utils.argument_checks.BaseInputArgumentChecker[source]#
Bases:
ABC
Abstract class to check input arguments.
- class otx.api.utils.argument_checks.DatasetParamTypeCheck(parameter, parameter_name)[source]#
Bases:
BaseInputArgumentChecker
Class to check DatasetEntity-type parameters.
- class otx.api.utils.argument_checks.DirectoryPathCheck(parameter, parameter_name)[source]#
Bases:
BaseInputArgumentChecker
Class to check directory path parameters.
- class otx.api.utils.argument_checks.FilePathCheck(parameter, parameter_name, expected_file_extension)[source]#
Bases:
BaseInputArgumentChecker
Class to check file_path-like parameters.
- class otx.api.utils.argument_checks.InputConfigCheck(parameter, parameter_name)[source]#
Bases:
BaseInputArgumentChecker
Class to check input config_parameters.
- class otx.api.utils.argument_checks.JsonFilePathCheck(parameter, parameter_name)[source]#
Bases:
FilePathCheck
Class to check optional yaml file path parameters.
- class otx.api.utils.argument_checks.OptionalDirectoryPathCheck(parameter, parameter_name)[source]#
Bases:
BaseInputArgumentChecker
Class to check optional directory path parameters.
- class otx.api.utils.argument_checks.OptionalFilePathCheck(parameter, parameter_name, expected_file_extension)[source]#
Bases:
BaseInputArgumentChecker
Class to check optional file_path-like parameters.
- class otx.api.utils.argument_checks.OptionalImageFilePathCheck(parameter, parameter_name)[source]#
Bases:
OptionalFilePathCheck
Class to check optional image file path parameters.
- class otx.api.utils.argument_checks.YamlFilePathCheck(parameter, parameter_name)[source]#
Bases:
FilePathCheck
Class to check optional yaml file path parameters.
- otx.api.utils.argument_checks.check_dictionary_keys_values_type(parameter, parameter_name, expected_key_class, expected_value_class)[source]#
Function raises ValueError exception if dictionary key or value has unexpected type.
- otx.api.utils.argument_checks.check_directory_path(parameter, parameter_name)[source]#
Function to check directory path string objects.
- otx.api.utils.argument_checks.check_file_extension(file_path: str, file_path_name: str, expected_extensions: list)[source]#
Function raises ValueError exception if file has unexpected extension.
- otx.api.utils.argument_checks.check_file_path(parameter, parameter_name, expected_file_extensions)[source]#
Function to check file path string objects.
- otx.api.utils.argument_checks.check_input_parameters_type(custom_checks: dict | None = None)[source]#
Decorator to check input parameters type.
- Parameters:
custom_checks – dictionary where key - name of parameter and value - custom check class
- otx.api.utils.argument_checks.check_is_parameter_like_dataset(parameter, parameter_name)[source]#
Checks if the parameter is like a dataset.
Function raises ValueError exception if parameter does not have __len__, __getitem__ and get_subset attributes of DataSet-type object.
- otx.api.utils.argument_checks.check_nested_classes_parameters(parameter, parameter_name, origin_class, nested_elements_class)[source]#
Function to check type of parameters with nested elements.
- otx.api.utils.argument_checks.check_nested_elements_type(iterable, parameter_name, expected_type)[source]#
Function raises ValueError exception if one of elements in collection has unexpected type.
- otx.api.utils.argument_checks.check_parameter_type(parameter, parameter_name, expected_type)[source]#
Function extracts nested expected types and raises ValueError exception if parameter has unexpected type.
- otx.api.utils.argument_checks.check_that_all_characters_printable(parameter, parameter_name, allow_crlf=False)[source]#
Function raises ValueError if one of string-parameter characters is not printable.
- otx.api.utils.argument_checks.check_that_file_exists(file_path: str, file_path_name: str)[source]#
Function raises ValueError exception if file not exists.
- otx.api.utils.argument_checks.check_that_null_character_absents_in_string(parameter: str, parameter_name: str)[source]#
Function raises ValueError exception if null character: ‘0’ is specified in path to file.
- otx.api.utils.argument_checks.check_that_parameter_is_not_empty(parameter, parameter_name)[source]#
Function raises ValueError if parameter is empty.
- otx.api.utils.argument_checks.get_bases(parameter) set [source]#
Function to get set of all base classes of parameter.