| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
The electrical component connection converters are new in this development cycle (the `_electrical_component_connection.py` module did not exist in v0.4.0), so the `_with_issues` flavor was never released and can be removed outright rather than deprecated. Its only diagnostic — a "self-referencing connection" major issue — is already encoded in the return type: a connection whose source and destination match is returned as a `SelfReferencingElectricalComponentConnection`. Routing the same fact through a side-channel `major_issues`/`minor_issues` string list (and the wrapper's warning/debug logging built from it) was therefore redundant. Fold the conversion directly into `electrical_component_connection_from_proto`, which now reports malformed input purely via the returned type, and drop the issue arrays, the logging and the now-unused `logging` import. Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
The `ElectricalComponent` message-level converters are new in this
development cycle (v0.4.0 shipped only the enum converters in this module),
so the `_with_issues` flavor was never released and can be removed outright
rather than deprecated.
Every diagnostic it collected is already encoded in the returned type:
* an unspecified category -> `UnspecifiedElectricalComponent`
* an unrecognized category -> `UnrecognizedElectricalComponent`
* a category that disagrees with its carried info ->
`MismatchedCategoryElectricalComponent`
* an unspecified/unrecognized battery, EV charger or inverter type ->
the matching `Unrecognized*` class (preserving the raw wire `type`)
Routing the same facts through a side-channel `major_issues`/`minor_issues`
string list (and the wrapper's warning/debug logging built from it) was
therefore redundant.
Fold the conversion into the plain `electrical_component_from_proto`, which
now reports malformed input purely via the returned type, and simplify the
private helper to `_electrical_component_base_from_proto` (no issue
arguments). The now-unused `logging` import and module logger go with them.
Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
The `MetricSample` and `MetricConnection` converters only shipped in the `_with_issues` flavor, which reports an unspecified/unrecognized metric or category through a side-channel `major_issues`/`minor_issues` string list. That information is already carried by the returned type, though: `MetricSample.metric` and `MetricConnection.category` are `... | int` (the raw `0` for unspecified, the raw value for unrecognized) and bounds are a `BoundsSet | InvalidBoundsSet`, so the issue list is redundant. Add plain `metric_sample_from_proto` and `metric_connection_from_proto` converters that drop the issue arrays and let callers read validity off the returned object (or the raising `get_*()` accessors). `RELEASE_NOTES.md` already referred to `metric_sample_from_proto` as the dataclass-level converter; this makes it real. The released `_with_issues` variants are intentionally left untouched here; they are deprecated in a follow-up commit. Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
`metric_sample_from_proto_with_issues` and `metric_connection_from_proto_with_issues` were released in v0.4.0, so they are deprecated rather than removed, in favour of the type-system `metric_sample_from_proto` / `metric_connection_from_proto` added in the previous commit. Add the `@deprecated` decorator and a `Warning: Deprecated` docstring admonition to both, matching the existing `bounds_from_proto_with_issues` deprecation. `metric_sample_from_proto_with_issues` still delegates to the now-deprecated `metric_connection_from_proto_with_issues` to preserve its released issue-collecting behaviour, so wrap that internal call in a `warnings.catch_warnings()` block: calling the sample converter then emits only its own `DeprecationWarning`, not the connection one as well. Update the existing tests to expect the deprecation via `pytest.deprecated_call`; the raw-int-0 / no-enum-warning guarantees now live on the new converters' tests. Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
| Back | FazBrowse Home | New Git URL |
This PR deprecates and removes all the remaining instances of _with_issues() functions, that should now have an anternative that reports issues via the type system. This should finalize #239 for the v0.4.1 release.