diff --git a/update_version.py b/update_version.py index 54a47e4..6cf194b 100644 --- a/update_version.py +++ b/update_version.py @@ -27,11 +27,13 @@ def validate_version(version: str) -> bool: Returns: True if valid, False otherwise """ - pattern = r'^\d+\.\d+\.\d+(?:-[a-zA-Z0-9]+)?$' + pattern = r"^\d+\.\d+\.\d+(?:-[a-zA-Z0-9]+)?$" return bool(re.match(pattern, version)) -def update_file(file_path: Path, old_pattern: str, new_version: str, multiline: bool = False) -> bool: +def update_file( + file_path: Path, old_pattern: str, new_version: str, multiline: bool = False +) -> bool: """Update version in a file. Args: @@ -94,10 +96,7 @@ def main() -> int: # Use word boundary to match 'version' but not 'python_version' pattern = r'^version = "[^"]+"' success &= update_file( - pyproject_path, - pattern, - f'version = "{new_version}"', - multiline=True + pyproject_path, pattern, f'version = "{new_version}"', multiline=True ) else: print(f"✗ {pyproject_path} not found") @@ -106,11 +105,7 @@ def main() -> int: # Update __init__.py if init_path.exists(): pattern = r'__version__ = "[^"]+"' - success &= update_file( - init_path, - pattern, - f'__version__ = "{new_version}"' - ) + success &= update_file(init_path, pattern, f'__version__ = "{new_version}"') else: print(f"✗ {init_path} not found") success = False