Skip to content

Commit

Permalink
fix: add defaults to view fields, make init kw-only
Browse files Browse the repository at this point in the history
  • Loading branch information
jvansanten committed Jan 8, 2025
1 parent b813461 commit c157980
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
16 changes: 8 additions & 8 deletions ampel/view/SnapView.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from typing import Self


@dataclass(frozen=True, slots=True)
@dataclass(frozen=True, slots=True, kw_only=True)
class SnapView:
"""
View of a given ampel object (with unique stock id).
Expand All @@ -44,15 +44,15 @@ class SnapView:
"""

id: StockId
stock: None | StockDocument
origin: None | OneOrMany[int]
t0: None | Sequence[DataPoint]
t1: None | Sequence[T1Document]
t2: None | Sequence[T2DocView]
stock: None | StockDocument = None
origin: None | OneOrMany[int] = None
t0: None | Sequence[DataPoint] = None
t1: None | Sequence[T1Document] = None
t2: None | Sequence[T2DocView] = None
# Logs, if added by T3 complement stage
logs: None | Sequence[LogDocument]
logs: None | Sequence[LogDocument] = None
# Free-form information addable via instances of AbsBufferComplement
extra: None | dict[str, Any]
extra: None | dict[str, Any] = None


@classmethod
Expand Down
6 changes: 3 additions & 3 deletions ampel/view/T2DocView.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from typing import Self


@dataclass(frozen=True, slots=True)
@dataclass(frozen=True, slots=True, kw_only=True)
class T2DocView:
"""
View of a given T2Document (with unique stock id).
Expand All @@ -36,13 +36,13 @@ class T2DocView:
stock: StockId | Sequence[StockId]
unit: int | str
confid: None | int
config: None | dict[str, Any]
config: None | dict[str, Any] = None
link: T2Link
tag: Sequence[Tag]
code: int
t2_type: int
meta: Sequence[MetaRecord]
body: None | Sequence[UBson]
body: None | Sequence[UBson] = None


@classmethod # Static ctor
Expand Down
10 changes: 5 additions & 5 deletions ampel/view/T3DocView.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,22 @@
from typing import Self


@dataclass(frozen=True, slots=True)
@dataclass(frozen=True, slots=True, kw_only=True)
class T3DocView:
"""
View of a given T3Document.
A t3 view contains read-only information from a T3Document
and provides convenience methods to access it.
"""

stock: None | Sequence[StockId]
stock: None | Sequence[StockId] = None
unit: str
confid: int
config: None | dict[str, Any]
tag: None | Tag | Sequence[Tag]
config: None | dict[str, Any] = None
tag: None | Tag | Sequence[Tag] = None
code: int
meta: MetaRecord
body: UBson
body: UBson = None


@classmethod # Static ctor
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "ampel-interface"
version = "0.10.4"
version = "0.10.4.post0"
description = "Base classes for the Ampel analysis platform"
authors = ["Valery Brinnel"]
maintainers = ["Jakob van Santen <[email protected]>"]
Expand Down

0 comments on commit c157980

Please sign in to comment.