Skip to content

Commit

Permalink
Move ContentEvaluationResult from ahbicht.content_evaluation to `…
Browse files Browse the repository at this point in the history
…ahbicht.models` (#487)

* Move `ContentEvaluationResult` from `ahbicht.content_evaluation` to `ahbicht.models`

* install black[jupyter]

* black 2024

---------

Co-authored-by: Konstantin <konstantin.klein+github@hochfrequenz.de>
  • Loading branch information
hf-kklein and Konstantin authored Oct 1, 2024
1 parent 852060e commit 2ef0df0
Show file tree
Hide file tree
Showing 22 changed files with 23 additions and 25 deletions.
2 changes: 1 addition & 1 deletion json_schemas/generate_json_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
2 changes: 1 addition & 1 deletion src/ahbicht/content_evaluation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion src/ahbicht/content_evaluation/categorized_key_extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/ahbicht/content_evaluation/evaluator_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -38,6 +37,7 @@
DictBasedPackageResolver,
PackageResolver,
)
from ahbicht.models.content_evaluation_result import ContentEvaluationResult


# pylint:disable=too-few-public-methods
Expand Down
2 changes: 1 addition & 1 deletion src/ahbicht/content_evaluation/fc_evaluators.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/ahbicht/content_evaluation/rc_evaluators.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion src/ahbicht/expressions/hints_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion src/ahbicht/expressions/package_expansion.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions src/ahbicht/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"""
this is a subpackage that contains all models used by ahbicht.
"""
2 changes: 1 addition & 1 deletion unittests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion unittests/test_ahb_expression_evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion unittests/test_categorized_key_extraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 1 addition & 2 deletions unittests/test_cer_based_fc_evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
3 changes: 1 addition & 2 deletions unittests/test_cer_based_hints_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
3 changes: 1 addition & 2 deletions unittests/test_cer_based_package_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion unittests/test_cer_based_rc_evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion unittests/test_evaluator_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
3 changes: 1 addition & 2 deletions unittests/test_json_serialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion unittests/test_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 1 addition & 2 deletions unittests/test_validity_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 2ef0df0

Please sign in to comment.