@@ -232,7 +232,7 @@ def get_version_from_cargo_toml(directory_path: Path) -> Version | None:
232232 return None
233233
234234 # 5. Safely access the version string
235- version_str = package_data .get ("version" )
235+ version_str = package_data .get ("version" ) # type: ignore
236236 if not isinstance (version_str , str ) or not version_str : # Check if it's a non-empty string
237237 console .print (f"Missing, empty, or invalid 'version' string in [package] table of { cargo_toml_path } " )
238238 return None
@@ -458,7 +458,7 @@ def get_pre_release_identifier() -> str | None:
458458 return questionary .text (
459459 "Enter the pre-release identifier" ,
460460 default = "alpha" ,
461- validate = lambda x : bool ((match := re .match (r"[0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*" , x )) and match .group () == x ),
461+ validate = lambda x : bool ((match := re .match (r"[0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*" , x )) and match .group () == x ), # type: ignore
462462 ).ask ()
463463
464464
@@ -557,10 +557,10 @@ def update_file(filename: str, search_pattern: str | None, replace_text: str, ve
557557def show_file_diff (old_content : str , new_content : str , filename : str ) -> None :
558558 old_lines = old_content .splitlines ()
559559 new_lines = new_content .splitlines ()
560- diff = list (Differ ().compare (old_lines , new_lines ))
560+ diff = list [ str ] (Differ ().compare (old_lines , new_lines ))
561561 print_lines = extract_context_lines (diff )
562562
563- diffs = []
563+ diffs : list [ str ] = []
564564 format_diff_lines (diff , print_lines , diffs )
565565 if diffs :
566566 console .print ()
@@ -572,7 +572,7 @@ def show_file_diff(old_content: str, new_content: str, filename: str) -> None:
572572
573573
574574def extract_context_lines (diff : list [str ]) -> dict [int , str ]:
575- print_lines = {}
575+ print_lines : dict [ int , str ] = {}
576576 for i , line in enumerate (diff ):
577577 if line .startswith (("+" , "-" )):
578578 for j in range (i - 3 , i + 3 ):
@@ -600,7 +600,7 @@ def format_diff_lines(diff: list[str], print_lines: dict[int, str], diffs: list[
600600def execute_git_commands (args : VersionArgs , next_version : Version , verbose : int ) -> None :
601601 git_tag = f"v{ next_version } "
602602
603- commands = []
603+ commands : list [ str ] = []
604604 if args .no_commit :
605605 if verbose > 0 :
606606 console .print ("Skipping commit" )
@@ -641,7 +641,7 @@ def version( # noqa: PLR0913
641641 custom : bool = typer .Option (False , "--custom" , help = "custom version to bump to" ),
642642) -> None :
643643 # Check for mutually exclusive options
644- exclusive_options = [patch , minor , major , prepatch , preminor , premajor , custom ]
644+ exclusive_options : list [ bool | str ] = [patch , minor , major , prepatch , preminor , premajor , custom ]
645645 if sum (bool (opt ) for opt in exclusive_options ) > 1 :
646646 typer .echo ("Error: Only one version bump option can be specified at a time." )
647647 raise typer .Exit (1 )
0 commit comments