From 3309e49c6a401b4dd420b26379ad8209bcd4b19c Mon Sep 17 00:00:00 2001 From: Antti Kaihola <13725+akaihola@users.noreply.github.com> Date: Sun, 20 Oct 2024 10:56:13 +0200 Subject: [PATCH] fix: parse pyupgrade --target-version into an int-tuple --- src/darker/formatters/pyupgrade_formatter.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/darker/formatters/pyupgrade_formatter.py b/src/darker/formatters/pyupgrade_formatter.py index 95d6b73b5..67ef30b14 100644 --- a/src/darker/formatters/pyupgrade_formatter.py +++ b/src/darker/formatters/pyupgrade_formatter.py @@ -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) @@ -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]]: