-
Notifications
You must be signed in to change notification settings - Fork 0
GH-53: refactor: Centralize relative dataframe-information-path and M… #58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Urfoex
merged 1 commit into
develop
from
refactor/GH-53-relative-dataframe-information-path-at-serialization
Aug 29, 2025
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,11 @@ | ||
| from dataclasses import dataclass | ||
| from typing import ClassVar | ||
|
|
||
| from pydantic import BaseModel, ConfigDict | ||
|
|
||
|
|
||
| class ProjectInformation(BaseModel): | ||
| model_config: ClassVar[ConfigDict] = ConfigDict(frozen=True) | ||
|
|
||
| @dataclass | ||
| class ProjectInformation: | ||
| project_name: str | ||
| pipeline_id: str | ||
| container_id: str |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,62 +1,20 @@ | ||
| from __future__ import annotations | ||
|
|
||
| from collections.abc import Mapping | ||
| from pathlib import Path | ||
| from typing import Annotated | ||
| from typing import ClassVar | ||
|
|
||
| from pydantic import Field, model_serializer | ||
| from pydantic.dataclasses import dataclass | ||
| from typing_extensions import TypedDict | ||
| from pydantic import BaseModel, ConfigDict | ||
|
|
||
| from getml_io.metadata.dataframe_information import DataFrameInformation | ||
| from getml_io.metadata.utils import derive_instance_with_relative_path | ||
| from getml_io.metadata.dataframe_information import ( | ||
| DataFrameInformation, | ||
| DataFrameInformationByName, | ||
| ) | ||
|
|
||
|
|
||
| class ContainerInformationDict(TypedDict): | ||
|
Urfoex marked this conversation as resolved.
|
||
| id: str | ||
| population: DataFrameInformation | None | ||
| peripheral: Mapping[str, DataFrameInformation] | ||
| subsets: Mapping[str, DataFrameInformation] | ||
| deep_copy: bool | ||
| class ContainerInformation(BaseModel): | ||
| model_config: ClassVar[ConfigDict] = ConfigDict(frozen=True) | ||
|
|
||
|
|
||
| @dataclass | ||
| class ContainerInformation: | ||
| id: str | ||
| population: DataFrameInformation | None | ||
| peripheral: Mapping[str, DataFrameInformation] | ||
| subsets: Mapping[str, DataFrameInformation] | ||
| peripheral: DataFrameInformationByName | ||
| subsets: DataFrameInformationByName | ||
| deep_copy: bool | ||
| path: Annotated[Path, Field(exclude=True)] | ||
|
|
||
| # TODO @urfoex: #53 Adjust relative path already in serialization function | ||
| @model_serializer() | ||
| def _serialize_model( | ||
| self, | ||
| ) -> ContainerInformationDict: | ||
| return { | ||
| "id": self.id, | ||
| "population": self._create_dataframe_information_with_relative_path( | ||
| self.population, | ||
| ) | ||
| if self.population | ||
| else None, | ||
| "peripheral": { | ||
| name: self._create_dataframe_information_with_relative_path(peripheral) | ||
| for name, peripheral in self.peripheral.items() | ||
| }, | ||
| "subsets": { | ||
| name: self._create_dataframe_information_with_relative_path(subset) | ||
| for name, subset in self.subsets.items() | ||
| }, | ||
| "deep_copy": self.deep_copy, | ||
| } | ||
|
|
||
| def _create_dataframe_information_with_relative_path( | ||
| self, | ||
| dataframe_information: DataFrameInformation, | ||
| ) -> DataFrameInformation: | ||
| return derive_instance_with_relative_path( | ||
| dataframe_information, | ||
| self.path, | ||
| ) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,15 @@ | ||
| from __future__ import annotations | ||
|
|
||
| from collections.abc import Mapping, Sequence | ||
| from typing import ClassVar | ||
|
|
||
| from pydantic.dataclasses import dataclass | ||
| from pydantic import BaseModel, ConfigDict | ||
|
|
||
| from getml_io.metadata.placeholder_information import PlaceholderInformation | ||
|
|
||
|
|
||
| @dataclass(frozen=True) | ||
| class DataModelInformation: | ||
| class DataModelInformation(BaseModel): | ||
| model_config: ClassVar[ConfigDict] = ConfigDict(frozen=True) | ||
|
|
||
| population: PlaceholderInformation | ||
| peripheral: Mapping[str, Sequence[PlaceholderInformation]] |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.