Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
lkuchenb committed May 2, 2024
1 parent 54636ac commit 1749282
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"""Data models"""

import re
from typing import Optional

from metldata.builtin_transformations.infer_relations.path.path_elements import (
RelationPathElement,
Expand Down Expand Up @@ -107,7 +106,7 @@ def get_target_class(*, path_str: str) -> str:
return match.group(1)


def split_first_element(*, path_str: str) -> tuple[str, Optional[str]]:
def split_first_element(*, path_str: str) -> tuple[str, str | None]:
"""Return a tuple of the first element and the remaining path string.
Thereby, the target class of the first element is set as the source class of the
remaining path.
Expand Down
4 changes: 1 addition & 3 deletions src/metldata/custom_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@

"""A collection of custom types."""

from typing import Any

from typing_extensions import TypeAlias
from typing import Any, TypeAlias

Json: TypeAlias = dict[str, Any]

Expand Down
7 changes: 3 additions & 4 deletions src/metldata/transform/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@

from abc import ABC, abstractmethod
from collections import defaultdict
from collections.abc import Generator
from collections.abc import Callable, Generator
from graphlib import CycleError, TopologicalSorter
from typing import Callable, Generic, Optional, TypeVar
from typing import Generic, TypeAlias, TypeVar

from pydantic import (
BaseModel,
Expand All @@ -34,7 +34,6 @@
from schemapack.spec.custom_types import ClassName, ResourceId
from schemapack.spec.datapack import DataPack
from schemapack.spec.schemapack import SchemaPack
from typing_extensions import TypeAlias

from metldata.custom_types import Json

Expand Down Expand Up @@ -148,7 +147,7 @@ class WorkflowStepBase(BaseModel, ABC):

model_config = ConfigDict(frozen=True)
description: str = Field(..., description="A description of the step.")
input: Optional[str] = Field(
input: str | None = Field(
...,
description=(
"The name of the workflow step from which the output is used as input"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"""Test the path_str module."""

from contextlib import nullcontext
from typing import Optional

import pytest

Expand Down Expand Up @@ -132,7 +131,7 @@ def test_get_target_class(path_str: str, expected_target_class: str):
],
)
def test_split_first_element(
path_str: str, expected_first_element: str, expected_remaining_path: Optional[str]
path_str: str, expected_first_element: str, expected_remaining_path: str | None
):
"""Test the split_first_element method."""
observed_first_element, observed_remaining_path = split_first_element(
Expand Down

0 comments on commit 1749282

Please sign in to comment.