44"""MySQL Router charm"""
55
66import abc
7+ import collections .abc
78import dataclasses
89import logging
9- import typing
1010
1111import charm_refresh
1212import ops
@@ -99,7 +99,7 @@ def __init__(self, *args) -> None:
9999
100100 @property
101101 @abc .abstractmethod
102- def _subordinate_relation_endpoint_names (self ) -> typing . Optional [ typing . Iterable [str ]] :
102+ def _subordinate_relation_endpoint_names (self ) -> collections . abc . Collection [str ] | None :
103103 """Subordinate relation endpoint names
104104
105105 Does NOT include relations where charm is principal
@@ -117,7 +117,7 @@ def _logrotate(self) -> logrotate.LogRotate:
117117
118118 @property
119119 @abc .abstractmethod
120- def _cos_relation_type (self ) -> typing . Type [cos .COSRelation ]:
120+ def _cos_relation_type (self ) -> type [cos .COSRelation ]:
121121 """COSRelation type"""
122122
123123 @abc .abstractmethod
@@ -129,22 +129,22 @@ def _read_only_endpoints(self, *, event) -> str:
129129 """MySQL Router read-only endpoint"""
130130
131131 @abc .abstractmethod
132- def is_externally_accessible (self , * , event ) -> typing . Optional [ bool ] :
132+ def is_externally_accessible (self , * , event ) -> bool | None :
133133 """Whether endpoints should be externally accessible.
134134
135135 Only defined in vm charm to return True/False. In k8s charm, returns None.
136136 """
137137
138138 @abc .abstractmethod
139- def tls_sans_ip (self , * , event ) -> typing . Optional [ typing . List [ str ]] :
139+ def tls_sans_ip (self , * , event ) -> list [ str ] | None :
140140 """TLS IP subject alternative names"""
141141
142142 @abc .abstractmethod
143- def tls_sans_dns (self , * , event ) -> typing . Optional [ typing . List [ str ]] :
143+ def tls_sans_dns (self , * , event ) -> list [ str ] | None :
144144 """TLS DNS subject alternative names"""
145145
146146 @abc .abstractmethod
147- def _status (self , * , event ) -> typing . Optional [ ops .StatusBase ] :
147+ def _status (self , * , event ) -> ops .StatusBase | None :
148148 """Status of the charm."""
149149
150150 @property
@@ -153,26 +153,26 @@ def _tls_certificate_saved(self) -> bool:
153153 return self .tls .certificate_saved
154154
155155 @property
156- def _tls_key (self ) -> typing . Optional [ str ] :
156+ def _tls_key (self ) -> str | None :
157157 """Custom TLS key"""
158158 return self .tls .key
159159
160160 @property
161- def _tls_certificate_authority (self ) -> typing . Optional [ str ] :
161+ def _tls_certificate_authority (self ) -> str | None :
162162 """Custom TLS certificate authority"""
163163 return self .tls .certificate_authority
164164
165165 @property
166- def _tls_certificate (self ) -> typing . Optional [ str ] :
166+ def _tls_certificate (self ) -> str | None :
167167 """Custom TLS certificate"""
168168 return self .tls .certificate
169169
170170 @property
171- def tracing_endpoint (self ) -> typing . Optional [ str ] :
171+ def tracing_endpoint (self ) -> str | None :
172172 """Otlp http endpoint for charm instrumentation."""
173173 return self ._cos_relation .tracing_endpoint
174174
175- def _cos_exporter_config (self , event ) -> typing . Optional [ cos .ExporterConfig ] :
175+ def _cos_exporter_config (self , event ) -> cos .ExporterConfig | None :
176176 """Returns the exporter config for MySQLRouter exporter if cos relation exists"""
177177 cos_relation_exists = (
178178 self ._cos_relation .relation_exists
@@ -203,8 +203,7 @@ def get_workload(self, *, event, refresh: charm_refresh.Common = None):
203203 )
204204
205205 @staticmethod
206- # TODO python3.10 min version: Use `list` instead of `typing.List`
207- def _prioritize_statuses (statuses : typing .List [ops .StatusBase ]) -> ops .StatusBase :
206+ def _prioritize_statuses (statuses : list [ops .StatusBase ]) -> ops .StatusBase :
208207 """Report the highest priority status.
209208
210209 (Statuses of the same type are reported in the order they were added to `statuses`)
0 commit comments