- deprecated typings
- formatting
- spelling
Issue-ID: OAM-370
Change-Id: I844de77809f9b471aa7b80b54ca28786fac281c1
Signed-off-by: Martin Skorupski <martin.skorupski@highstreet-technologies.com>
import os
import os.path
import json
import os
import os.path
import json
-from typing import Dict, Union
__config_file: str = "config.json"
__configuration: dict = {}
__config_file: str = "config.json"
__configuration: dict = {}
- __configuration_schema_file: str = os.path.dirname(os.path.realpath(
- __file__)) + "/../model/jsonSchema/configuration.schema.json"
+ __configuration_schema_file: str = (
+ os.path.dirname(os.path.realpath(__file__))
+ + "/../model/jsonSchema/configuration.schema.json"
+ )
__config_schema: dict = {}
__config_schema: dict = {}
- __error_messsage: str = ""
+ __error_message: str = ""
__is_valid: bool = False
# constructor
__is_valid: bool = False
# constructor
with open(self.__configuration_schema_file) as content:
self.__config_schema = json.load(content)
self.__is_valid = self.__is_json_valid(
with open(self.__configuration_schema_file) as content:
self.__config_schema = json.load(content)
self.__is_valid = self.__is_json_valid(
- self.__configuration, self.__config_schema)
+ self.__configuration, self.__config_schema
+ )
def configuration_file(self) -> str:
"""
def configuration_file(self) -> str:
"""
"""
return self.__config_file
"""
return self.__config_file
- def configuration(self) -> Dict[str, Union[str, Dict[str, int]]]:
+ def configuration(self) -> dict[str, str | dict[str, int]]:
"""
Getter for the configuration as input parameter.
"""
Getter for the configuration as input parameter.
- :return Init configuration as Dict.
+ :return Init configuration as dict.
"""
return self.__configuration
def is_valid(self) -> bool:
"""
Getter for the validation result.
"""
return self.__configuration
def is_valid(self) -> bool:
"""
Getter for the validation result.
- :return Init configuration as Dict.
+ :return Init configuration as dict.
"""
return self.__is_valid
"""
return self.__is_valid
"""
Getter for the error message after validation process or an empty sting,
when configuration is valid.
"""
Getter for the error message after validation process or an empty sting,
when configuration is valid.
- :return Errormessage as string.
+ :return Error message as string.
- return self.__error_messsage
+ return self.__error_message
"""
try:
jsonschema.validate(instance=json_data, schema=json_schema)
"""
try:
jsonschema.validate(instance=json_data, schema=json_schema)
- self.__error_messsage = ""
+ self.__error_message = ""
except jsonschema.exceptions.ValidationError as err:
except jsonschema.exceptions.ValidationError as err:
- self.__error_messsage = err
+ self.__error_message = err