Skip to content

Commit

Permalink
Use python3.8 compatible type annotations (#207)
Browse files Browse the repository at this point in the history
Needed for subordinate VM charm
  • Loading branch information
carlcsaposs-canonical authored Mar 5, 2024
1 parent a5a4bc9 commit c0e3d42
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,15 @@ def is_compatible(self) -> bool:
"""Whether upgrade is supported from previous versions"""
assert self.versions_set
try:
previous_version_strs: dict[str, str] = json.loads(self._app_databag["versions"])
previous_version_strs: typing.Dict[str, str] = json.loads(
self._app_databag["versions"]
)
except KeyError as exception:
logger.debug("`versions` missing from peer relation", exc_info=exception)
return False
# TODO charm versioning: remove `.split("+")` (which removes git hash before comparing)
previous_version_strs["charm"] = previous_version_strs["charm"].split("+")[0]
previous_versions: dict[str, poetry_version.Version] = {
previous_versions: typing.Dict[str, poetry_version.Version] = {
key: poetry_version.Version.parse(value)
for key, value in previous_version_strs.items()
}
Expand Down Expand Up @@ -177,7 +179,7 @@ def upgrade_resumed(self) -> bool:

@property
@abc.abstractmethod
def _unit_workload_versions(self) -> dict[str, str]:
def _unit_workload_versions(self) -> typing.Dict[str, str]:
"""{Unit name: unique identifier for unit's workload version}
If and only if this version changes, the workload will restart (during upgrade or
Expand Down

0 comments on commit c0e3d42

Please sign in to comment.