Conversation
|
Task linked: DEV-7731 Update Python SDK |
charlta
left a comment
There was a problem hiding this comment.
How much fun did you have trying to figure out what parts of the JVM SDK change you needed to pull across with the vastly different way the proto2cim stuff works? It was a PITA for me to review 😜
| from zepben.ewb.services.common.base_service import BaseService | ||
| from typing import Callable, Type, TYPE_CHECKING | ||
|
|
||
| if TYPE_CHECKING: |
There was a problem hiding this comment.
nit: Although unlikely to be a problem, moving imports into the if TYPE_CHECKING: stops them being imported, which is a breaking change for anyone that imports this file and relies on these being available.
I assume this has been done as these types are only used for type checking. I also assume you missed the 99% of other cases where we don't if TYPE_CHECKING: guard the others across the code base 😁
| def __str__(self) -> str: | ||
| """ | ||
| Printable version of the object including its name, mrid, and optionally, type | ||
| """ |
There was a problem hiding this comment.
todo: Didn't promote _validate_reference and _validate_reference_field from IdentifiedObject
|
|
||
|
|
||
| def add_to_network_or_none(func: TProtoToCimFunc) -> TProtoToCimFunc: | ||
| def add_to_service_or_none(func: TProtoToCimFunc) -> TProtoToCimFunc: |
There was a problem hiding this comment.
nit: The rename of this function (good) didn't trigger a change to the customerProto2Cim because this isn't used there (bad?)
| """ | ||
|
|
||
| @property | ||
| def mrid(self) -> str: |
There was a problem hiding this comment.
todo: You missed the test for this
| def _create_name_type(name_type: str, desc: str, name: str, io_mrid: str) -> NameType: | ||
| # noinspection PyArgumentList | ||
| nt = NameType(name_type, desc) | ||
| nt = NameType(name=name_type, description=desc) |
There was a problem hiding this comment.
todo: No problem here, but you missed changing the types on a lot (if not all) the validate functions the comparators use. e.g. validate_ordered or validate_unordered
Might be worth looking at any TypeVar with bound=IdentifiedObject
| # End Model # | ||
| ############# | ||
|
|
||
| def _add_or_throw(self, identifiable: Identifiable) -> bool: |
There was a problem hiding this comment.
nit: Not for here, but the schema tests weren't modified so here is where I am choosing to link it....
CimDatabaseSchemaCommonTests.create_identified_object and its overrides/usage haven't been updated. These probably don't really matter at this stage, but would be nice to keep them inline with the JVM side.
|
|
||
| responses = self._stub.getCustomersForContainer(self._batch_send(GetCustomersForContainerRequest(), mrids), timeout=self.timeout) | ||
| async for response in responses: | ||
| for cio in response.identifiedObjects: |
There was a problem hiding this comment.
todo: response.identifiedObjects isn't valid anymore, which raises the question of why doesn't this fail in a test?
I can put raise ValueError("is this tested?") here and there are still no test failures, so there is something very wrong , or it is untested.
…` subclasses of ``Identifiable`` Signed-off-by: Max Chesterfield <max.chesterfield@zepben.com> a Signed-off-by: Max Chesterfield <max.chesterfield@zepben.com> make ``Name`` a subclass of identifiable Signed-off-by: Max Chesterfield <max.chesterfield@zepben.com> bump zepben.protobuf to 1.4.0b4. and make work Function names, Type hints, docs, and much more are WRONG, but the code works. Signed-off-by: Max Chesterfield <max.chesterfield@zepben.com> GrpcClient kinda done, could definitely refactor some of the child classes into this base to dedupe stuff Signed-off-by: Max Chesterfield <max.chesterfield@zepben.com> BaseService, Differences and Comparator. Difference, ReferenceResolvers Signed-off-by: Max Chesterfield <max.chesterfield@zepben.com> rename `add_to_network_or_none` to `add_to_service_or_none` as network is misleading and wrong. Signed-off-by: Max Chesterfield <max.chesterfield@zepben.com> I think thats all. Signed-off-by: Max Chesterfield <max.chesterfield@zepben.com> missed some stuff, docs on BaseService were all sorts of whack Signed-off-by: Max Chesterfield <max.chesterfield@zepben.com> PR Changes Signed-off-by: Max Chesterfield <max.chesterfield@zepben.com> fix type hinting in ServiceComparatorValidator Signed-off-by: Max Chesterfield <max.chesterfield@zepben.com> sum hints bad, good now Signed-off-by: Max Chesterfield <max.chesterfield@zepben.com> parameterise, and make pretty Signed-off-by: Max Chesterfield <max.chesterfield@zepben.com> name.mrid and stuff Signed-off-by: Max Chesterfield <max.chesterfield@zepben.com>
Signed-off-by: Max Chesterfield <max.chesterfield@zepben.com>
d05214e to
5c3979d
Compare
Description
Port over jvm sdk changes.
changes that snuck in:
add_to_network_or_nonetoadd_to_service_or_noneAssociated tasks
List any other tasks / PRs that are required to be merged alongside this one (e.g. front end task for back end change or vice versa). If a PR exists, add a link. If not, just add an appropriate note here so reviewers know there is a dependency and will hold off merging until all things are ready.
Test Steps
Explain in detail how your reviewer can test the changes proposed in this PR. If it cannot be tested, leave an explanation on why.
Checklist
If any of these are not applicable, strikethrough the line
~like this~. Do not delete it!. Let the reviewer decide if you should have done it.Code
Security
When developing applications, use following guidelines for information security considerations:
Documentation
Breaking Changes
Please leave a summary of the breaking changes here and then post it on the Slack breaking-changes channel to notify the team about it.