From 482bb6402e3b66733e977a374c6c89fbef02091c Mon Sep 17 00:00:00 2001 From: z0nerek <140495175+z0nerek@users.noreply.github.com> Date: Sat, 8 Aug 2026 15:05:10 +0200 Subject: [PATCH] Update is_enum to check for EnumType Refactor is_enum function to use EnumType for type checking. --- src/python/pants/option/native_options.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/python/pants/option/native_options.py b/src/python/pants/option/native_options.py index 38c3b0394cb..e9077694c01 100644 --- a/src/python/pants/option/native_options.py +++ b/src/python/pants/option/native_options.py @@ -7,7 +7,7 @@ import logging import shlex from collections.abc import Mapping, Sequence -from enum import Enum +from enum import Enum, EnumType from pathlib import Path from typing import Any @@ -172,8 +172,7 @@ def scope_str() -> str: return "global scope" if scope == GLOBAL_SCOPE else f"scope '{scope}'" def is_enum(typ): - # TODO: When we switch to Python 3.11, use: return isinstance(typ, EnumType) - return inspect.isclass(typ) and issubclass(typ, Enum) + return isinstance(typ, EnumType) def apply_callable(callable_type, val_str): try: