From 6330755ef6088458e8c51d07c0fb8e0bf6cb1639 Mon Sep 17 00:00:00 2001 From: Saeed Rasooli Date: Sat, 4 Jan 2025 05:58:27 +0330 Subject: [PATCH] fix ruff errors --- scal3/plugin_type.py | 9 ++++++--- scal3/utils.py | 5 ++++- scripts/version-set.py | 1 - 3 files changed, 10 insertions(+), 5 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: diff --git a/scripts/version-set.py b/scripts/version-set.py index d3418da58..4fdf9861c 100755 --- a/scripts/version-set.py +++ b/scripts/version-set.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- import sys from datetime import datetime