Skip to content

Commit 8822bed

Browse files
committed
Mark all types non-enum as frozen dataclasses
Signed-off-by: Sahas Subramanian <[email protected]>
1 parent 779cc47 commit 8822bed

File tree

1 file changed

+8
-7
lines changed
  • src/frequenz/client/electricity_trading

1 file changed

+8
-7
lines changed

src/frequenz/client/electricity_trading/_types.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,7 @@ def to_pb(self) -> delivery_duration_pb2.DeliveryDuration.ValueType:
371371
return delivery_duration_pb2.DeliveryDuration.ValueType(self.value)
372372

373373

374+
@dataclass(frozen=True)
374375
class DeliveryPeriod:
375376
"""
376377
Time period during which the contract is delivered.
@@ -992,7 +993,7 @@ def to_pb(
992993
return self.value
993994

994995

995-
@dataclass()
996+
@dataclass(frozen=True)
996997
class Order: # pylint: disable=too-many-instance-attributes
997998
"""Represents an order in the electricity market."""
998999

@@ -1180,7 +1181,7 @@ def __eq__(self, other: object) -> bool:
11801181
)
11811182

11821183

1183-
@dataclass()
1184+
@dataclass(frozen=True)
11841185
class Trade: # pylint: disable=too-many-instance-attributes
11851186
"""Represents a private trade in the electricity market."""
11861187

@@ -1314,7 +1315,7 @@ def to_pb(self) -> electricity_trading_pb2.OrderDetail.StateDetail:
13141315
)
13151316

13161317

1317-
@dataclass()
1318+
@dataclass(frozen=True)
13181319
class OrderDetail:
13191320
"""
13201321
Represents an order with full details, including its ID, state, and associated UTC timestamps.
@@ -1401,7 +1402,7 @@ def to_pb(self) -> electricity_trading_pb2.OrderDetail:
14011402
)
14021403

14031404

1404-
@dataclass()
1405+
@dataclass(frozen=True)
14051406
class PublicTrade: # pylint: disable=too-many-instance-attributes
14061407
"""Represents a public order in the market."""
14071408

@@ -1929,7 +1930,7 @@ def to_pb(self) -> electricity_trading_pb2.PublicTradeFilter:
19291930
)
19301931

19311932

1932-
@dataclass()
1933+
@dataclass(frozen=True)
19331934
class UpdateOrder: # pylint: disable=too-many-instance-attributes
19341935
"""
19351936
Represents the order properties that can be updated after an order has been placed.
@@ -2069,7 +2070,7 @@ def to_pb(self) -> electricity_trading_pb2.UpdateGridpoolOrderRequest.UpdateOrde
20692070
)
20702071

20712072

2072-
@dataclass()
2073+
@dataclass(frozen=True)
20732074
class PublicOrder: # pylint: disable=too-many-instance-attributes
20742075
"""Represents a public order in the market."""
20752076

@@ -2170,7 +2171,7 @@ def to_pb(self) -> electricity_trading_pb2.PublicOrderBookRecord:
21702171
)
21712172

21722173

2173-
@dataclass()
2174+
@dataclass(frozen=True)
21742175
class PublicOrderBookFilter:
21752176
"""Parameters for filtering the public orders in the market."""
21762177

0 commit comments

Comments
 (0)