From d76954bc7f94e3ac4d1820eadd72c4050142615d Mon Sep 17 00:00:00 2001 From: vitthalmagadum Date: Thu, 6 Mar 2025 22:53:04 -0500 Subject: [PATCH] fixing the python version compatibility issue with typing --- anta/tests/system.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/anta/tests/system.py b/anta/tests/system.py index 8675191bf..2d9054be5 100644 --- a/anta/tests/system.py +++ b/anta/tests/system.py @@ -8,7 +8,7 @@ from __future__ import annotations import re -from typing import TYPE_CHECKING, Any, ClassVar, Self +from typing import TYPE_CHECKING, Any, ClassVar from pydantic import model_validator @@ -18,10 +18,16 @@ from anta.tools import get_value if TYPE_CHECKING: + import sys from ipaddress import IPv4Address from anta.models import AntaTemplate + if sys.version_info >= (3, 11): + from typing import Self + else: + from typing_extensions import Self + CPU_IDLE_THRESHOLD = 25 MEMORY_THRESHOLD = 0.25 DISK_SPACE_THRESHOLD = 75