From 06a4f77df5f6472beb0ad25127bc41dd7e907d16 Mon Sep 17 00:00:00 2001 From: Saeed Rasooli Date: Sat, 4 Jan 2025 05:58:27 +0330 Subject: [PATCH] fix ruff 0.8.5 errors --- scal3/plugin_type.py | 9 ++++++--- scal3/utils.py | 5 ++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/scal3/plugin_type.py b/scal3/plugin_type.py index 390179c19..6dffeb664 100644 --- a/scal3/plugin_type.py +++ b/scal3/plugin_type.py @@ -1,16 +1,19 @@ from __future__ import annotations -import typing +from typing import TYPE_CHECKING from scal3.s_object import SObj +if TYPE_CHECKING: + from collections.abc import Sequence + class BasePlugin(SObj): name: str | None external: bool loaded: bool - params: typing.Sequence[str] - essentialParams: typing.Sequence[str] + params: Sequence[str] + essentialParams: Sequence[str] def getArgs(self): ... diff --git a/scal3/utils.py b/scal3/utils.py index 0de1fd55e..31989aeff 100644 --- a/scal3/utils.py +++ b/scal3/utils.py @@ -26,6 +26,9 @@ from math import ceil, floor from typing import Any +if typing.TYPE_CHECKING: + from collections.abc import Iterator + Number: typing.TypeAlias = int | float @@ -213,7 +216,7 @@ def insert(self, index: int, key: str, value: Any): self.keyList.insert(index, key) dict.__setitem__(self, key, value) # noqa: PLC2801 - def sort(self, attr: str | None = None) -> typing.Iterator: + def sort(self, attr: str | None = None) -> Iterator: if attr is None: self.keyList.sort() else: