-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update artifact & dataframe domain init
- Loading branch information
Showing
6 changed files
with
131 additions
and
32 deletions.
There are no files selected for viewing
This file contains 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,21 +1,65 @@ | ||
from __future__ import annotations | ||
from dataclasses import dataclass | ||
from typing import TYPE_CHECKING, List, Optional | ||
|
||
from dataclasses import dataclass, field | ||
from datetime import datetime | ||
from typing import List, Optional | ||
from rubicon_ml.domain.mixin import CommentMixin, InitMixin, TagMixin | ||
|
||
from rubicon_ml.domain.mixin import CommentMixin, TagMixin | ||
from rubicon_ml.domain.utils import uuid | ||
if TYPE_CHECKING: | ||
from datetime import datetime | ||
|
||
|
||
@dataclass | ||
class Artifact(TagMixin, CommentMixin): | ||
name: str | ||
@dataclass(init=False) | ||
class Artifact(CommentMixin, InitMixin, TagMixin): | ||
"""A domain-level artifact. | ||
id: str = field(default_factory=uuid.uuid4) | ||
description: Optional[str] = None | ||
created_at: datetime = field(default_factory=datetime.utcnow) | ||
tags: List[str] = field(default_factory=list) | ||
comments: List[str] = field(default_factory=list) | ||
name : str | ||
The artifact's name. | ||
comments : list of str, optional | ||
Additional text information and observations about the artifact. Defaults to | ||
`None`. | ||
created_at : datetime, optional | ||
The date and time the artifact was created. Defaults to `None` and uses | ||
`datetime.datetime.now` to generate a UTC timestamp. `created_at` should be | ||
left as `None` to allow for automatic generation. | ||
description : str, optional | ||
A description of the artifact. Defaults to `None`. | ||
id : str, optional | ||
The artifact's unique identifier. Defaults to `None` and uses `uuid.uuid4` | ||
to generate a unique ID. `id` should be left as `None` to allow for automatic | ||
generation. | ||
parent_id : str, optional | ||
The unique identifier of the project or experiment the artifact belongs to. | ||
Defaults to `None`. | ||
tags : list of str, optional | ||
The values this artifact is tagged with. Defaults to `None`. | ||
""" | ||
|
||
name: str | ||
comments: Optional[List[str]] = None | ||
created_at: Optional["datetime"] = None | ||
description: Optional[str] = None | ||
id: Optional[str] = None | ||
parent_id: Optional[str] = None | ||
tags: Optional[List[str]] = None | ||
|
||
def __init__( | ||
self, | ||
name: str, | ||
comments: Optional[List[str]] = None, | ||
created_at: Optional["datetime"] = None, | ||
description: Optional[str] = None, | ||
id: Optional[str] = None, | ||
parent_id: Optional[str] = None, | ||
tags: Optional[List[str]] = None, | ||
**kwargs, | ||
): | ||
"""Initialize this domain artifact.""" | ||
|
||
self._check_extra_kwargs(kwargs) | ||
|
||
self.name = name | ||
self.comments = comments or [] | ||
self.created_at = self._init_created_at(created_at) | ||
self.description = description | ||
self.id = self._init_id(id) | ||
self.parent_id = parent_id | ||
self.tags = tags or [] |
This file contains 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,20 +1,65 @@ | ||
from __future__ import annotations | ||
from dataclasses import dataclass | ||
from typing import TYPE_CHECKING, List, Optional | ||
|
||
from dataclasses import dataclass, field | ||
from datetime import datetime | ||
from typing import List, Optional | ||
from rubicon_ml.domain.mixin import CommentMixin, InitMixin, TagMixin | ||
|
||
from rubicon_ml.domain.mixin import CommentMixin, TagMixin | ||
from rubicon_ml.domain.utils import uuid | ||
if TYPE_CHECKING: | ||
from datetime import datetime | ||
|
||
|
||
@dataclass | ||
class Dataframe(TagMixin, CommentMixin): | ||
id: str = field(default_factory=uuid.uuid4) | ||
name: Optional[str] = None | ||
description: Optional[str] = None | ||
tags: List[str] = field(default_factory=list) | ||
comments: List[str] = field(default_factory=list) | ||
created_at: datetime = field(default_factory=datetime.utcnow) | ||
@dataclass(init=False) | ||
class Dataframe(CommentMixin, InitMixin, TagMixin): | ||
"""A domain-level dataframe. | ||
comments : list of str, optional | ||
Additional text information and observations about the dataframe. Defaults to | ||
`None`. | ||
created_at : datetime, optional | ||
The date and time the dataframe was created. Defaults to `None` and uses | ||
`datetime.datetime.now` to generate a UTC timestamp. `created_at` should be | ||
left as `None` to allow for automatic generation. | ||
description : str, optional | ||
A description of the dataframe. Defaults to `None`. | ||
id : str, optional | ||
The dataframe's unique identifier. Defaults to `None` and uses `uuid.uuid4` | ||
to generate a unique ID. `id` should be left as `None` to allow for automatic | ||
generation. | ||
name : str, optional | ||
The dataframe's name. Defaults to `None`. | ||
parent_id : str, optional | ||
The unique identifier of the project or experiment the dataframe belongs to. | ||
Defaults to `None`. | ||
tags : list of str, optional | ||
The values this dataframe is tagged with. Defaults to `None`. | ||
""" | ||
|
||
comments: Optional[List[str]] = None | ||
created_at: Optional["datetime"] = None | ||
description: Optional[str] = None | ||
id: Optional[str] = None | ||
name: Optional[str] = None | ||
parent_id: Optional[str] = None | ||
tags: Optional[List[str]] = None | ||
|
||
def __init__( | ||
self, | ||
comments: Optional[List[str]] = None, | ||
created_at: Optional["datetime"] = None, | ||
description: Optional[str] = None, | ||
id: Optional[str] = None, | ||
name: Optional[str] = None, | ||
parent_id: Optional[str] = None, | ||
tags: Optional[List[str]] = None, | ||
**kwargs, | ||
): | ||
"""Initialize this doimain dataframe.""" | ||
|
||
self._check_extra_kwargs(kwargs) | ||
|
||
self.comments = comments or [] | ||
self.created_at = self._init_created_at(created_at) | ||
self.description = description | ||
self.id = self._init_id(id) | ||
self.name = name | ||
self.parent_id = parent_id | ||
self.tags = tags or [] |
This file contains 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 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 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 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