Skip to content

Commit 4612de7

Browse files
committed
Improve deprecation messages
Signed-off-by: Leandro Lucarella <[email protected]>
1 parent abac31c commit 4612de7

File tree

4 files changed

+38
-11
lines changed

4 files changed

+38
-11
lines changed

src/frequenz/client/common/metric/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,10 @@ class Metric(enum.Enum):
142142
SENSOR_IRRADIANCE = PBMetric.METRIC_SENSOR_IRRADIANCE
143143

144144
@classmethod
145-
@deprecated("Use `frequenz.client.common.proto.enum_from_proto` instead.")
145+
@deprecated(
146+
"frequenz.client.common.metric.Metric.from_proto() is deprecated. "
147+
"Use frequenz.client.common.proto.enum_from_proto instead."
148+
)
146149
def from_proto(cls, metric: PBMetric.ValueType) -> Self:
147150
"""Convert a protobuf Metric value to Metric enum.
148151

src/frequenz/client/common/microgrid/components/__init__.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,10 @@ class ComponentCategory(enum.Enum):
105105
"""A Heating, Ventilation, and Air Conditioning (HVAC) system."""
106106

107107
@classmethod
108-
@deprecated("Use `frequenz.client.common.proto.enum_from_proto` instead.")
108+
@deprecated(
109+
"frequenz.client.common.microgrid.components.ComponentCategory.from_proto() is deprecated. "
110+
"Use frequenz.client.common.proto.enum_from_proto instead."
111+
)
109112
def from_proto(
110113
cls, component_category: PBComponentCategory.ValueType
111114
) -> ComponentCategory:
@@ -211,7 +214,11 @@ class ComponentStateCode(enum.Enum):
211214
"""The precharger circuit is closed, allowing full current to flow to the main circuit."""
212215

213216
@classmethod
214-
@deprecated("Use `frequenz.client.common.proto.enum_from_proto` instead.")
217+
@deprecated(
218+
"frequenz.client.common.microgrid.components.ComponentStateCode."
219+
"from_proto() is deprecated. "
220+
"Use frequenz.client.common.proto.enum_from_proto instead."
221+
)
215222
def from_proto(
216223
cls, component_state: PBComponentStateCode.ValueType
217224
) -> ComponentStateCode:
@@ -390,7 +397,11 @@ class ComponentErrorCode(enum.Enum):
390397
times."""
391398

392399
@classmethod
393-
@deprecated("Use `frequenz.client.common.proto.enum_from_proto` instead.")
400+
@deprecated(
401+
"frequenz.client.common.microgrid.components."
402+
"ComponentErrorCode.from_proto() is deprecated. "
403+
"Use frequenz.client.common.proto.enum_from_proto instead."
404+
)
394405
def from_proto(
395406
cls, component_error_code: PBComponentErrorCode.ValueType
396407
) -> ComponentErrorCode:

src/frequenz/client/common/microgrid/electrical_components/__init__.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,11 @@ class ElectricalComponentCategory(enum.Enum):
8989
"""A heating, ventilation, and air conditioning (HVAC) system."""
9090

9191
@classmethod
92-
@deprecated("Use `frequenz.client.common.proto.enum_from_proto` instead.")
92+
@deprecated(
93+
"frequenz.client.common.microgrid.electrical_components."
94+
"ElectricalComponentCategory.from_proto() is deprecated. "
95+
"Use frequenz.client.common.proto.enum_from_proto instead."
96+
)
9397
def from_proto(
9498
cls, component_category: PBElectricalComponentCategory.ValueType
9599
) -> ElectricalComponentCategory:
@@ -217,7 +221,11 @@ class ElectricalComponentStateCode(enum.Enum):
217221
"""The precharger circuit is closed, allowing full current to flow to the main circuit."""
218222

219223
@classmethod
220-
@deprecated("Use `frequenz.client.common.proto.enum_from_proto` instead.")
224+
@deprecated(
225+
"frequenz.client.common.microgrid.electrical_components."
226+
"ElectricalComponentStateCode.from_proto() is deprecated. "
227+
"Use frequenz.client.common.proto.enum_from_proto instead."
228+
)
221229
def from_proto(
222230
cls, component_state: PBElectricalComponentStateCode.ValueType
223231
) -> ElectricalComponentStateCode:
@@ -432,7 +440,11 @@ class ElectricalComponentDiagnosticCode(enum.Enum):
432440
times."""
433441

434442
@classmethod
435-
@deprecated("Use `frequenz.client.common.proto.enum_from_proto` instead.")
443+
@deprecated(
444+
"frequenz.client.common.microgrid.electrical_components."
445+
"ElectricalComponentDiagnosticCode.from_proto() is deprecated. "
446+
"Use frequenz.client.common.proto.enum_from_proto instead."
447+
)
436448
def from_proto(
437449
cls, component_error_code: PBElectricalComponentDiagnosticCode.ValueType
438450
) -> ElectricalComponentDiagnosticCode:

src/frequenz/client/common/pagination/__init__.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424

2525

2626
@deprecated(
27-
"Params is deprecated, use "
28-
"frequenz.api.common.v1.pagination.pagination_params_pb2.PaginationParams"
29-
" from the API directly instead.",
27+
"frequenz.client.common.pagination.Params is deprecated. "
28+
"Use frequenz.api.common.v1.pagination.pagination_params_pb2.PaginationParams "
29+
"from the API directly instead.",
3030
)
3131
@dataclass(frozen=True, kw_only=True)
3232
class Params:
@@ -65,7 +65,8 @@ def to_proto(self) -> PBPaginationParams:
6565

6666

6767
@deprecated(
68-
"Info is deprecated, use PaginationInfo instead.",
68+
"frequenz.client.common.pagination.Info is deprecated. "
69+
"Use frequenz.client.common.pagination.PaginationInfo instead.",
6970
)
7071
@dataclass(frozen=True, kw_only=True)
7172
class Info:

0 commit comments

Comments
 (0)