Skip to content

Commit

Permalink
fix: Proper Dataclass Implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
dahbar committed Jan 3, 2024
1 parent d3d0515 commit 7603762
Showing 1 changed file with 6 additions and 19 deletions.
25 changes: 6 additions & 19 deletions polarion_rest_api_client/data_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,18 @@
import typing as t


@dataclasses.dataclass
class BaseItem:
"""A parent data class for WorkItem and Document."""

id: str | None = None
type: str | None = None
status: str | None = None
_checksum: str | None = None
_checksum: str | None = dataclasses.field(init=False, default=None)

def __init__(
self,
id: str | None = None,
type: str | None = None,
status: str | None = None,
):
self.id = id
self.type = type
self.status = status
self._checksum = None
def __post_init__(self):
"""Set initial checksum value."""
self._checksum = self.calculate_checksum()

def __eq__(self, other: object) -> bool:
"""Compare only BaseItem attributes."""
Expand Down Expand Up @@ -229,16 +223,9 @@ def __init__(
self.home_page_content = home_page_content


@dataclasses.dataclass
class TextContent:
"""A data class for home_page_content of a Polarion Document."""

type: str | None = None
value: str | None = None

def __init__(
self,
type: str | None = None,
value: str | None = None,
):
self.type = type
self.value = value

0 comments on commit 7603762

Please sign in to comment.