From 474456006375343ea3de5a45a2873789ecd0f646 Mon Sep 17 00:00:00 2001 From: Hironori Yamamoto Date: Mon, 23 Sep 2024 17:49:03 +0900 Subject: [PATCH] fix: omit supports under Python 3.8 --- luigi/mypy.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/luigi/mypy.py b/luigi/mypy.py index 373e10c9b1..8de6d5a37e 100644 --- a/luigi/mypy.py +++ b/luigi/mypy.py @@ -7,6 +7,7 @@ from __future__ import annotations import re +import sys from typing import Callable, Dict, Final, Iterator, List, Literal, Optional from mypy.expandtype import expand_type, expand_type_by_instance @@ -60,7 +61,13 @@ METADATA_TAG: Final[str] = "task" -PARAMETER_FULLNAME_MATCHER: Final = re.compile(r"^luigi(\.parameter)?\.\w*Parameter$") +PARAMETER_FULLNAME_MATCHER: Final[re.Pattern] = re.compile( + r"^luigi(\.parameter)?\.\w*Parameter$" +) + +if sys.version_info[:2] < (3, 8): + # This plugin uses the walrus operator, which is only available in Python 3.8+ + raise RuntimeError("This plugin requires Python 3.8+") class TaskPlugin(Plugin):