@@ -50,7 +50,6 @@ def is_unit_blocked(self) -> bool:
5050import pathlib
5151import re
5252import typing
53- from typing import Dict , List , Optional , Tuple
5453
5554from charms .data_platform_libs .v0 .s3 import (
5655 CredentialsChangedEvent ,
@@ -113,7 +112,7 @@ def is_unit_blocked(self) -> bool:
113112
114113# Increment this PATCH version before using `charmcraft publish-lib` or reset
115114# to 0 if you are raising the major API version
116- LIBPATCH = 14
115+ LIBPATCH = 15
117116
118117ANOTHER_S3_CLUSTER_REPOSITORY_ERROR_MESSAGE = "S3 repository claimed by another cluster"
119118MOVE_RESTORED_CLUSTER_TO_ANOTHER_S3_REPOSITORY_ERROR = (
@@ -150,7 +149,7 @@ def _s3_integrator_relation_exists(self) -> bool:
150149 """Returns whether a relation with the s3-integrator exists."""
151150 return bool (self .model .get_relation (S3_INTEGRATOR_RELATION_NAME ))
152151
153- def _retrieve_s3_parameters (self ) -> Tuple [ Dict [str , str ], List [str ]]:
152+ def _retrieve_s3_parameters (self ) -> tuple [ dict [str , str ], list [str ]]:
154153 """Retrieve S3 parameters from the S3 integrator relation.
155154
156155 Returns: tuple of (s3_parameters, missing_required_parameters)
@@ -196,7 +195,7 @@ def _upload_logs_to_s3(
196195 stdout : str ,
197196 stderr : str ,
198197 log_filename : str ,
199- s3_parameters : Dict [str , str ],
198+ s3_parameters : dict [str , str ],
200199 ) -> bool :
201200 """Upload logs to S3 at the specified location.
202201
@@ -219,7 +218,7 @@ def _upload_logs_to_s3(
219218 # ------------------ List Backups ------------------
220219
221220 @staticmethod
222- def _format_backups_list (backup_list : List [ Tuple [str , str ]]) -> str :
221+ def _format_backups_list (backup_list : list [ tuple [str , str ]]) -> str :
223222 """Formats the provided list of backups as a table."""
224223 backups = [f"{ 'backup-id' :<21} | { 'backup-type' :<12} | backup-status" ]
225224
@@ -359,7 +358,7 @@ def _on_create_backup(self, event: ActionEvent) -> None:
359358 })
360359 self .charm ._on_update_status (None )
361360
362- def _can_unit_perform_backup (self ) -> Tuple [bool , Optional [ str ] ]:
361+ def _can_unit_perform_backup (self ) -> tuple [bool , str | None ]:
363362 """Validates whether this unit can perform a backup.
364363
365364 Returns: tuple of (success, error_message)
@@ -390,7 +389,7 @@ def _can_unit_perform_backup(self) -> Tuple[bool, Optional[str]]:
390389
391390 return True , None
392391
393- def _pre_backup (self ) -> Tuple [bool , Optional [ str ] ]:
392+ def _pre_backup (self ) -> tuple [bool , str | None ]:
394393 """Runs operations required before performing a backup.
395394
396395 Returns: tuple of (success, error_message)
@@ -415,7 +414,7 @@ def _pre_backup(self) -> Tuple[bool, Optional[str]]:
415414
416415 return True , None
417416
418- def _backup (self , backup_path : str , s3_parameters : Dict ) -> Tuple [bool , Optional [ str ] ]:
417+ def _backup (self , backup_path : str , s3_parameters : dict ) -> tuple [bool , str | None ]:
419418 """Runs the backup operations.
420419
421420 Args:
@@ -450,7 +449,7 @@ def _backup(self, backup_path: str, s3_parameters: Dict) -> Tuple[bool, Optional
450449
451450 return True , None
452451
453- def _post_backup (self ) -> Tuple [bool , Optional [ str ] ]:
452+ def _post_backup (self ) -> tuple [bool , str | None ]:
454453 """Runs operations required after performing a backup.
455454
456455 Returns: tuple of (success, error_message)
@@ -613,7 +612,7 @@ def _on_restore(self, event: ActionEvent) -> None: # noqa: C901
613612 # update status as soon as possible
614613 self .charm ._on_update_status (None )
615614
616- def _pre_restore (self ) -> Tuple [bool , str ]:
615+ def _pre_restore (self ) -> tuple [bool , str ]:
617616 """Perform operations that need to be done before performing a restore.
618617
619618 Returns: tuple of (success, error_message)
@@ -635,7 +634,7 @@ def _pre_restore(self) -> Tuple[bool, str]:
635634
636635 return True , ""
637636
638- def _restore (self , backup_id : str , s3_parameters : Dict [str , str ]) -> Tuple [bool , bool , str ]:
637+ def _restore (self , backup_id : str , s3_parameters : dict [str , str ]) -> tuple [bool , bool , str ]:
639638 """Run the restore operations.
640639
641640 Args:
@@ -687,7 +686,7 @@ def _restore(self, backup_id: str, s3_parameters: Dict[str, str]) -> Tuple[bool,
687686
688687 return True , True , ""
689688
690- def _clean_data_dir_and_start_mysqld (self ) -> Tuple [bool , str ]:
689+ def _clean_data_dir_and_start_mysqld (self ) -> tuple [bool , str ]:
691690 """Run idempotent operations run after restoring a backup.
692691
693692 Returns tuple of (success, error_message)
@@ -711,8 +710,8 @@ def _clean_data_dir_and_start_mysqld(self) -> Tuple[bool, str]:
711710 return True , ""
712711
713712 def _pitr_restore (
714- self , restore_to_time : str , s3_parameters : Dict [str , str ]
715- ) -> Tuple [bool , str ]:
713+ self , restore_to_time : str , s3_parameters : dict [str , str ]
714+ ) -> tuple [bool , str ]:
716715 try :
717716 logger .info ("Restoring point-in-time-recovery" )
718717 stdout , stderr = self .charm ._mysql .restore_pitr (
@@ -728,7 +727,7 @@ def _pitr_restore(
728727 return False , f"Failed to restore point-in-time-recovery to the { restore_to_time } "
729728 return True , ""
730729
731- def _post_restore (self ) -> Tuple [bool , str ]:
730+ def _post_restore (self ) -> tuple [bool , str ]:
732731 """Run operations required after restoring a backup.
733732
734733 Returns: tuple of (success, error_message)
@@ -836,7 +835,7 @@ def _on_s3_credentials_gone(self, event: CredentialsGoneEvent) -> None:
836835 "Exception is occurred when trying to stop binlogs collecting after S3 relation depart. It may be a leader departure"
837836 )
838837
839- def get_binlogs_collector_config (self ) -> Dict [str , str ]:
838+ def get_binlogs_collector_config (self ) -> dict [str , str ]:
840839 """Return binlogs collector service config file.
841840
842841 Returns: dict of binlogs collector service config
0 commit comments