Skip to content

[MISC] Add ty typechecking#1744

Draft
dragomirp wants to merge 4 commits into
mainfrom
ty-typechecking
Draft

[MISC] Add ty typechecking#1744
dragomirp wants to merge 4 commits into
mainfrom
ty-typechecking

Conversation

@dragomirp

Copy link
Copy Markdown
Contributor

Issue

Solution

Checklist

  • I have added or updated any relevant documentation.
  • I have cleaned any remaining cloud resources from my accounts.

dragomirp and others added 2 commits June 4, 2026 14:52
Fix all 194 type errors reported by ty across 11 source files. Main
patterns fixed: annotate self.charm as PostgresqlOperatorCharm via
TYPE_CHECKING guards, add str | None narrowing for optional secrets and
endpoints, fix implicit None returns, convert dict_keys to list before
subscripting, and suppress dynamic Literal constructs with ty: ignore.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@dragomirp dragomirp added the not bug or enhancement PR is not 'bug' or 'enhancement'. For release notes label Jun 4, 2026
@github-actions github-actions Bot added the Libraries: Out of sync The charm libs used are out-of-sync label Jun 4, 2026
Comment thread src/relations/async_replication.py Fixed
Comment thread src/charm.py Fixed
Comment thread src/cluster.py Fixed
Comment thread src/cluster.py Fixed
Comment thread src/cluster.py Fixed

@property
def _relation(self) -> Relation:
def _relation(self) -> Relation | None:
Comment thread src/cluster.py
raise Exception("Cannot get version found.")

def get_member_ip(self, member_name: str) -> str:
def get_member_ip(self, member_name: str) -> str | None:
Comment thread src/charm.py
return {self.unit, *self._peers.units}

def scoped_peer_data(self, scope: Scopes) -> dict | None:
def scoped_peer_data(self, scope: Scopes) -> RelationDataContent | dict[str, str] | None:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Libraries: Out of sync The charm libs used are out-of-sync not bug or enhancement PR is not 'bug' or 'enhancement'. For release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants