diff --git a/json_schemas/generate_json_schemas.py b/json_schemas/generate_json_schemas.py index 8ab3b493..9586b075 100644 --- a/json_schemas/generate_json_schemas.py +++ b/json_schemas/generate_json_schemas.py @@ -11,7 +11,6 @@ from marshmallow_jsonschema import JSONSchema # type:ignore[import] from ahbicht.content_evaluation.categorized_key_extract import CategorizedKeyExtractSchema -from ahbicht.content_evaluation.content_evaluation_result import ContentEvaluationResultSchema from ahbicht.evaluation_results import ( AhbExpressionEvaluationResultSchema, FormatConstraintEvaluationResultSchema, @@ -20,6 +19,7 @@ from ahbicht.expressions.condition_nodes import EvaluatedFormatConstraintSchema from ahbicht.json_serialization.tree_schema import TokenSchema # , TreeSchema from ahbicht.mapping_results import ConditionKeyConditionTextMappingSchema, PackageKeyConditionExpressionMappingSchema +from ahbicht.models.content_evaluation_result import ContentEvaluationResultSchema schema_types: List[Type[Schema]] = [ RequirementConstraintEvaluationResultSchema, diff --git a/pyproject.toml b/pyproject.toml index 12cda0d4..b8e5b12c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,7 +36,7 @@ dynamic = ["readme", "version"] [project.optional-dependencies] coverage = ["coverage==7.6.1"] docs = ["sphinx==8.0.2", "sphinx-rtd-theme==2.0.0"] -formatting = ["black==24.8.0", "isort==5.13.2"] +formatting = ["black[jupyter]==24.8.0", "isort==5.13.2"] json_schemas = ["marshmallow-jsonschema==0.13.0", "setuptools==75.1.0"] linting = ["pylint==3.3.1"] spellcheck = ["codespell==2.3.0"] diff --git a/src/ahbicht/content_evaluation/__init__.py b/src/ahbicht/content_evaluation/__init__.py index fe6dd737..9d6d0623 100644 --- a/src/ahbicht/content_evaluation/__init__.py +++ b/src/ahbicht/content_evaluation/__init__.py @@ -7,7 +7,6 @@ from lark import Token, Tree -from ahbicht.content_evaluation.content_evaluation_result import ContentEvaluationResult from ahbicht.content_evaluation.evaluationdatatypes import EvaluatableData from ahbicht.content_evaluation.fc_evaluators import FcEvaluator from ahbicht.content_evaluation.rc_evaluators import ContentEvaluationResultBasedRcEvaluator, RcEvaluator @@ -16,6 +15,7 @@ from ahbicht.expressions.ahb_expression_evaluation import evaluate_ahb_expression_tree from ahbicht.expressions.condition_expression_parser import extract_categorized_keys_from_tree from ahbicht.expressions.expression_resolver import parse_expression_including_unresolved_subexpressions +from ahbicht.models.content_evaluation_result import ContentEvaluationResult async def is_valid_expression( diff --git a/src/ahbicht/content_evaluation/categorized_key_extract.py b/src/ahbicht/content_evaluation/categorized_key_extract.py index f26fa3c3..1c16bd89 100644 --- a/src/ahbicht/content_evaluation/categorized_key_extract.py +++ b/src/ahbicht/content_evaluation/categorized_key_extract.py @@ -8,8 +8,8 @@ import attrs from marshmallow import Schema, fields, post_load -from ahbicht.content_evaluation.content_evaluation_result import ContentEvaluationResult from ahbicht.expressions.condition_nodes import ConditionFulfilledValue, EvaluatedFormatConstraint +from ahbicht.models.content_evaluation_result import ContentEvaluationResult # pylint: disable=too-few-public-methods, unused-argument diff --git a/src/ahbicht/content_evaluation/evaluator_factory.py b/src/ahbicht/content_evaluation/evaluator_factory.py index 20cd69fe..43bfc146 100644 --- a/src/ahbicht/content_evaluation/evaluator_factory.py +++ b/src/ahbicht/content_evaluation/evaluator_factory.py @@ -15,7 +15,6 @@ import inject from efoli import EdifactFormat, EdifactFormatVersion -from ahbicht.content_evaluation.content_evaluation_result import ContentEvaluationResult from ahbicht.content_evaluation.evaluationdatatypes import EvaluatableData, EvaluatableDataProvider from ahbicht.content_evaluation.fc_evaluators import ( ContentEvaluationResultBasedFcEvaluator, @@ -38,6 +37,7 @@ DictBasedPackageResolver, PackageResolver, ) +from ahbicht.models.content_evaluation_result import ContentEvaluationResult # pylint:disable=too-few-public-methods diff --git a/src/ahbicht/content_evaluation/fc_evaluators.py b/src/ahbicht/content_evaluation/fc_evaluators.py index aa9e0f04..f183b0e2 100644 --- a/src/ahbicht/content_evaluation/fc_evaluators.py +++ b/src/ahbicht/content_evaluation/fc_evaluators.py @@ -16,12 +16,12 @@ import inject -from ahbicht.content_evaluation.content_evaluation_result import ContentEvaluationResult, ContentEvaluationResultSchema from ahbicht.content_evaluation.evaluationdatatypes import EvaluatableData, EvaluatableDataProvider from ahbicht.content_evaluation.evaluators import Evaluator from ahbicht.content_evaluation.german_strom_and_gas_tag import has_no_utc_offset, is_xtag_limit from ahbicht.evaluation_results import FormatConstraintEvaluationResult from ahbicht.expressions.condition_nodes import EvaluatedFormatConstraint +from ahbicht.models.content_evaluation_result import ContentEvaluationResult, ContentEvaluationResultSchema text_to_be_evaluated_by_format_constraint: ContextVar[Optional[str]] = ContextVar( "text_to_be_evaluated_by_format_constraint", default=None diff --git a/src/ahbicht/content_evaluation/rc_evaluators.py b/src/ahbicht/content_evaluation/rc_evaluators.py index df34cda3..c6567388 100644 --- a/src/ahbicht/content_evaluation/rc_evaluators.py +++ b/src/ahbicht/content_evaluation/rc_evaluators.py @@ -10,10 +10,10 @@ from abc import ABC, abstractmethod from typing import Dict, List, Optional -from ahbicht.content_evaluation.content_evaluation_result import ContentEvaluationResult, ContentEvaluationResultSchema from ahbicht.content_evaluation.evaluationdatatypes import EvaluatableData, EvaluationContext from ahbicht.content_evaluation.evaluators import Evaluator from ahbicht.expressions.condition_nodes import ConditionFulfilledValue +from ahbicht.models.content_evaluation_result import ContentEvaluationResult, ContentEvaluationResultSchema class RcEvaluator(Evaluator, ABC): diff --git a/src/ahbicht/expressions/hints_provider.py b/src/ahbicht/expressions/hints_provider.py index 15610447..5fabef57 100644 --- a/src/ahbicht/expressions/hints_provider.py +++ b/src/ahbicht/expressions/hints_provider.py @@ -14,11 +14,11 @@ import inject from efoli import EdifactFormat, EdifactFormatVersion -from ahbicht.content_evaluation.content_evaluation_result import ContentEvaluationResult, ContentEvaluationResultSchema from ahbicht.content_evaluation.evaluationdatatypes import EvaluatableData, EvaluatableDataProvider # pylint: disable = too-few-public-methods from ahbicht.expressions.condition_nodes import Hint +from ahbicht.models.content_evaluation_result import ContentEvaluationResult, ContentEvaluationResultSchema class HintsProvider(ABC): diff --git a/src/ahbicht/expressions/package_expansion.py b/src/ahbicht/expressions/package_expansion.py index 7e25b53f..70fda2f7 100644 --- a/src/ahbicht/expressions/package_expansion.py +++ b/src/ahbicht/expressions/package_expansion.py @@ -12,9 +12,9 @@ import inject from efoli import EdifactFormat, EdifactFormatVersion -from ahbicht.content_evaluation.content_evaluation_result import ContentEvaluationResult, ContentEvaluationResultSchema from ahbicht.content_evaluation.evaluationdatatypes import EvaluatableData, EvaluatableDataProvider from ahbicht.mapping_results import PackageKeyConditionExpressionMapping, PackageKeyConditionExpressionMappingSchema +from ahbicht.models.content_evaluation_result import ContentEvaluationResult, ContentEvaluationResultSchema # pylint:disable=too-few-public-methods diff --git a/src/ahbicht/models/__init__.py b/src/ahbicht/models/__init__.py new file mode 100644 index 00000000..22391c59 --- /dev/null +++ b/src/ahbicht/models/__init__.py @@ -0,0 +1,3 @@ +""" +this is a subpackage that contains all models used by ahbicht. +""" diff --git a/src/ahbicht/content_evaluation/content_evaluation_result.py b/src/ahbicht/models/content_evaluation_result.py similarity index 100% rename from src/ahbicht/content_evaluation/content_evaluation_result.py rename to src/ahbicht/models/content_evaluation_result.py diff --git a/unittests/conftest.py b/unittests/conftest.py index 92b8cde0..65262b66 100644 --- a/unittests/conftest.py +++ b/unittests/conftest.py @@ -8,10 +8,10 @@ from _pytest.fixtures import SubRequest from ahbicht.content_evaluation import ContentEvaluationResult, EvaluatableData, TokenLogicProvider -from ahbicht.content_evaluation.content_evaluation_result import ContentEvaluationResultSchema from ahbicht.content_evaluation.evaluationdatatypes import EvaluatableDataProvider from ahbicht.content_evaluation.evaluator_factory import create_content_evaluation_result_based_evaluators from ahbicht.content_evaluation.token_logic_provider import SingletonTokenLogicProvider +from ahbicht.models.content_evaluation_result import ContentEvaluationResultSchema from unittests.defaults import default_test_format, default_test_version diff --git a/unittests/test_ahb_expression_evaluation.py b/unittests/test_ahb_expression_evaluation.py index a362bfde..93c0ad70 100644 --- a/unittests/test_ahb_expression_evaluation.py +++ b/unittests/test_ahb_expression_evaluation.py @@ -8,7 +8,6 @@ import pytest import pytest_asyncio -from ahbicht.content_evaluation.content_evaluation_result import ContentEvaluationResult from ahbicht.content_evaluation.evaluationdatatypes import EvaluatableDataProvider from ahbicht.content_evaluation.evaluator_factory import create_and_inject_hardcoded_evaluators from ahbicht.content_evaluation.token_logic_provider import SingletonTokenLogicProvider, TokenLogicProvider @@ -22,6 +21,7 @@ from ahbicht.expressions.condition_nodes import ConditionFulfilledValue, EvaluatedFormatConstraint from ahbicht.expressions.enums import ModalMark, PrefixOperator, RequirementIndicator from ahbicht.expressions.expression_resolver import parse_expression_including_unresolved_subexpressions +from ahbicht.models.content_evaluation_result import ContentEvaluationResult from unittests.defaults import ( default_test_format, default_test_version, diff --git a/unittests/test_categorized_key_extraction.py b/unittests/test_categorized_key_extraction.py index 7f14e61b..ee8ec196 100644 --- a/unittests/test_categorized_key_extraction.py +++ b/unittests/test_categorized_key_extraction.py @@ -7,9 +7,9 @@ import pytest from ahbicht.content_evaluation.categorized_key_extract import CategorizedKeyExtract, CategorizedKeyExtractSchema -from ahbicht.content_evaluation.content_evaluation_result import ContentEvaluationResult, ContentEvaluationResultSchema from ahbicht.expressions.condition_expression_parser import extract_categorized_keys from ahbicht.expressions.condition_nodes import ConditionFulfilledValue, EvaluatedFormatConstraint +from ahbicht.models.content_evaluation_result import ContentEvaluationResult, ContentEvaluationResultSchema class TestCategorizedKeyExtraction: diff --git a/unittests/test_cer_based_fc_evaluator.py b/unittests/test_cer_based_fc_evaluator.py index 0b7ce4b8..cbc469f5 100644 --- a/unittests/test_cer_based_fc_evaluator.py +++ b/unittests/test_cer_based_fc_evaluator.py @@ -4,11 +4,10 @@ import inject import pytest -from _pytest.fixtures import SubRequest -from ahbicht.content_evaluation.content_evaluation_result import ContentEvaluationResult from ahbicht.content_evaluation.token_logic_provider import TokenLogicProvider from ahbicht.expressions.condition_nodes import EvaluatedFormatConstraint +from ahbicht.models.content_evaluation_result import ContentEvaluationResult from unittests.defaults import default_test_format, default_test_version diff --git a/unittests/test_cer_based_hints_provider.py b/unittests/test_cer_based_hints_provider.py index fd3c0ff6..9e85ea22 100644 --- a/unittests/test_cer_based_hints_provider.py +++ b/unittests/test_cer_based_hints_provider.py @@ -4,10 +4,9 @@ import inject import pytest -from _pytest.fixtures import SubRequest -from ahbicht.content_evaluation.content_evaluation_result import ContentEvaluationResult from ahbicht.content_evaluation.token_logic_provider import TokenLogicProvider +from ahbicht.models.content_evaluation_result import ContentEvaluationResult from unittests.defaults import default_test_format, default_test_version diff --git a/unittests/test_cer_based_package_resolver.py b/unittests/test_cer_based_package_resolver.py index 63044e0a..0c025c4c 100644 --- a/unittests/test_cer_based_package_resolver.py +++ b/unittests/test_cer_based_package_resolver.py @@ -2,11 +2,10 @@ import inject import pytest -from _pytest.fixtures import SubRequest -from ahbicht.content_evaluation.content_evaluation_result import ContentEvaluationResult from ahbicht.content_evaluation.token_logic_provider import TokenLogicProvider from ahbicht.mapping_results import PackageKeyConditionExpressionMapping +from ahbicht.models.content_evaluation_result import ContentEvaluationResult from unittests.defaults import default_test_format, default_test_version diff --git a/unittests/test_cer_based_rc_evaluator.py b/unittests/test_cer_based_rc_evaluator.py index cd127de9..c7b6dd4b 100644 --- a/unittests/test_cer_based_rc_evaluator.py +++ b/unittests/test_cer_based_rc_evaluator.py @@ -4,9 +4,9 @@ import pytest -from ahbicht.content_evaluation.content_evaluation_result import ContentEvaluationResult from ahbicht.content_evaluation.rc_evaluators import ContentEvaluationResultBasedRcEvaluator, RcEvaluator from ahbicht.expressions.condition_nodes import ConditionFulfilledValue +from ahbicht.models.content_evaluation_result import ContentEvaluationResult from unittests.conftest import store_content_evaluation_result_in_evaluatable_data diff --git a/unittests/test_evaluator_factory.py b/unittests/test_evaluator_factory.py index 53ea69e4..5c1691b5 100644 --- a/unittests/test_evaluator_factory.py +++ b/unittests/test_evaluator_factory.py @@ -7,12 +7,12 @@ import pytest from _pytest.fixtures import SubRequest -from ahbicht.content_evaluation.content_evaluation_result import ContentEvaluationResult from ahbicht.content_evaluation.evaluator_factory import create_and_inject_hardcoded_evaluators from ahbicht.expressions.ahb_expression_evaluation import evaluate_ahb_expression_tree from ahbicht.expressions.condition_nodes import ConditionFulfilledValue, EvaluatedFormatConstraint from ahbicht.expressions.enums import ModalMark, RequirementIndicator from ahbicht.expressions.expression_resolver import parse_expression_including_unresolved_subexpressions +from ahbicht.models.content_evaluation_result import ContentEvaluationResult from unittests.defaults import default_test_format, default_test_version, return_empty_dummy_evaluatable_data diff --git a/unittests/test_json_serialization.py b/unittests/test_json_serialization.py index ca8e2b68..1de13e36 100644 --- a/unittests/test_json_serialization.py +++ b/unittests/test_json_serialization.py @@ -12,7 +12,6 @@ from maus.models.edifact_components import DataElementDataType from ahbicht.content_evaluation.categorized_key_extract import CategorizedKeyExtract, CategorizedKeyExtractSchema -from ahbicht.content_evaluation.content_evaluation_result import ContentEvaluationResult, ContentEvaluationResultSchema from ahbicht.evaluation_results import ( AhbExpressionEvaluationResult, AhbExpressionEvaluationResultSchema, @@ -31,11 +30,11 @@ PackageKeyConditionExpressionMapping, PackageKeyConditionExpressionMappingSchema, ) +from ahbicht.models.content_evaluation_result import ContentEvaluationResult, ContentEvaluationResultSchema from ahbicht.validation.validation_results import ( DataElementValidationResult, DataElementValidationResultSchema, ListOfValidationResultInContext, - ListOfValidationResultInContextSchema, SegmentLevelValidationResult, SegmentLevelValidationResultSchema, ValidationResultInContext, diff --git a/unittests/test_validation.py b/unittests/test_validation.py index 7ff0f7ef..a92bd092 100644 --- a/unittests/test_validation.py +++ b/unittests/test_validation.py @@ -14,10 +14,10 @@ ValuePoolEntry, ) -from ahbicht.content_evaluation.content_evaluation_result import ContentEvaluationResult from ahbicht.content_evaluation.evaluator_factory import create_and_inject_hardcoded_evaluators from ahbicht.expressions.condition_nodes import ConditionFulfilledValue, EvaluatedFormatConstraint from ahbicht.expressions.enums import ModalMark, PrefixOperator, RequirementIndicator +from ahbicht.models.content_evaluation_result import ContentEvaluationResult from ahbicht.validation.validation import ( combine_requirements_of_different_levels, map_requirement_validation_values, diff --git a/unittests/test_validity_check.py b/unittests/test_validity_check.py index f356cfd3..f74f3350 100644 --- a/unittests/test_validity_check.py +++ b/unittests/test_validity_check.py @@ -5,12 +5,11 @@ import pytest from ahbicht.content_evaluation import is_valid_expression -from ahbicht.content_evaluation.content_evaluation_result import ContentEvaluationResult, ContentEvaluationResultSchema from ahbicht.content_evaluation.evaluationdatatypes import EvaluatableData, EvaluatableDataProvider from ahbicht.content_evaluation.evaluator_factory import create_content_evaluation_result_based_evaluators from ahbicht.content_evaluation.token_logic_provider import SingletonTokenLogicProvider, TokenLogicProvider -from ahbicht.expressions.ahb_expression_parser import parse_ahb_expression_to_single_requirement_indicator_expressions from ahbicht.expressions.expression_resolver import parse_expression_including_unresolved_subexpressions +from ahbicht.models.content_evaluation_result import ContentEvaluationResult, ContentEvaluationResultSchema from unittests.defaults import default_test_format, default_test_version _content_evaluation_result: ContextVar[Optional[ContentEvaluationResult]] = ContextVar(