Skip to content

Commit

Permalink
fix: fix tests for Python 3.9
Browse files Browse the repository at this point in the history
  • Loading branch information
bolinocroustibat committed Nov 14, 2024
1 parent 0664dcc commit 01d6feb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions bumpx/helpers.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import logging
import shlex
import subprocess
from typing import Any
from typing import Any, Optional


class BumprError(Exception):
Expand All @@ -15,7 +15,9 @@ def check_output(*args, **kwargs):
)


def execute(command, verbose: bool = False, replacements=None, dryrun: bool = False) -> str | None:
def execute(
command, verbose: bool = False, replacements=None, dryrun: bool = False
) -> Optional[str]:
logger = logging.getLogger(__name__)
replacements = replacements or {}
if not command:
Expand Down
3 changes: 2 additions & 1 deletion bumpx/version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import re
from typing import Optional


class Version:
Expand Down Expand Up @@ -41,7 +42,7 @@ def __unicode__(self):
return pattern.format(**self.__dict__)

@classmethod
def parse(cls, string: str) -> "Version" | None:
def parse(cls, string: str) -> Optional["Version"]:
match = cls.PATTERN.match(string)
if match:
return cls(**match.groupdict())
Expand Down
3 changes: 2 additions & 1 deletion tasks.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import sys
from typing import Optional

from invoke import task

Expand Down Expand Up @@ -71,7 +72,7 @@ def error(text: str) -> None:
sys.stdout.flush()


def exit(text: str | None = None, code=-1) -> None:
def exit(text: Optional[str] = None, code=-1) -> None:
if text:
error(text)
sys.exit(code)
Expand Down

0 comments on commit 01d6feb

Please sign in to comment.