Skip to content

Commit

Permalink
fix: parse pyupgrade --target-version into an int-tuple
Browse files Browse the repository at this point in the history
  • Loading branch information
akaihola committed Oct 21, 2024
1 parent c6ead87 commit 3309e49
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/darker/formatters/pyupgrade_formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ def run(
target_versions_in = validate_target_versions(
self.config["target_version"], supported_target_versions
)
target_version_str = min(target_versions_in)
target_version = (int(target_version_str[0]), int(target_version_str[1:]))
target_version = min(target_versions_in)
else:
target_version = (3, 9)

Expand All @@ -95,7 +94,10 @@ def run(

def _read_cli_args(self, args: Namespace) -> None:
if getattr(args, "target_version", None):
self.config["target_version"] = {args.target_version}
self.config["target_version"] = (
int(args.target_version[2]),
int(args.target_version[3:]),
)


def _get_supported_target_versions() -> set[tuple[int, int]]:
Expand Down

0 comments on commit 3309e49

Please sign in to comment.