Skip to content

Commit

Permalink
doc string updates
Browse files Browse the repository at this point in the history
  • Loading branch information
sbilge committed Aug 27, 2024
1 parent e34220c commit 6c3d6d7
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,12 @@ def assert_summary_exists(
json_schema=class_def.content.json_schema_dict,
path=instruction.target_content.object_path,
)
except KeyError as err:
except KeyError as exc:
raise ModelAssumptionError(
f"Object path {
instruction.target_content.object_path} does not exist"
+ f" in class {class_name}."
) from err
) from exc

# Check if the propert_name already exists in the model
if instruction.target_content.property_name not in target_schema.get(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ class CountReferencesConfig(BaseSettings):

count_references: list[AddReferenceCountPropertyInstruction] = Field(
...,
description=("A list of instructions describing for which class and corresponding relation path references should be counted."),
description=(
"A list of instructions describing for which class and"
+ " corresponding relation path references should be counted."
),
examples=[],
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@


class AddReferenceCountPropertyInstruction(BaseSettings):
"""A model describing an instruction to"""
"""A model describing an instruction for adding a reference count property to the
content schema of a class. It defines the class to be modified, the target content
where the property will be added, and the relationship path that describes how the
classes are connected.
"""

class_name: str = Field(..., description="The name of the class to modify.")

Expand Down
14 changes: 11 additions & 3 deletions src/metldata/transform/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,13 @@ class ModelAssumptionError(RuntimeError):


class MultiplicityError(ModelAssumptionError):
"""Raised when the relation does not conform the multiplicity."""
"""Raised when a relation in the model does not conform to the required multiplicity
constraints. It occurs when the actual cardinality of a relationship within a model
fails to meet the expected multiplicity criteria of a transformation. E.g.,
in 'count references' transformation, the target of a relation is required to
contribute multiple instances(`target=True`) to the relation, and this error is raised
if that condition is not satisfied.
"""


class ModelTransformationError(RuntimeError):
Expand Down Expand Up @@ -212,7 +218,8 @@ def validate_step_references(
continue
if step.input not in steps:
raise ValueError(
f"Step {step.input} referenced in step {step_name} is not defined."
f"Step {step.input} referenced in step {
step_name} is not defined."
)

if not step_with_no_input_found:
Expand All @@ -236,7 +243,8 @@ def validate_artifact_references(cls, values):
for artifact_name, step_name in artifacts.items():
if step_name not in steps:
raise ValueError(
f"Step {step_name} referenced in artifact {artifact_name} is not defined."
f"Step {step_name} referenced in artifact {
artifact_name} is not defined."
)

return values
Expand Down

0 comments on commit 6c3d6d7

Please sign in to comment.