diff --git a/pyglossary/sq_entry_list.py b/pyglossary/sq_entry_list.py index dd5db464e..2a3e35954 100644 --- a/pyglossary/sq_entry_list.py +++ b/pyglossary/sq_entry_list.py @@ -21,7 +21,7 @@ import os from os.path import isfile from pickle import dumps, loads -from typing import TYPE_CHECKING, Self +from typing import TYPE_CHECKING if TYPE_CHECKING: from collections.abc import Callable, Iterable, Iterator @@ -30,6 +30,10 @@ from .glossary_types import EntryType, RawEntryType from .sort_keys import NamedSortKey +# from typing import Self +# typing.Self is new in Python 3.11. + + __all__ = ["SqEntryList"] @@ -156,7 +160,7 @@ def append(self, entry: "EntryType") -> None: if self._len % 1000 == 0: self._con.commit() - def __iadd__(self, other: "Iterable") -> Self: + def __iadd__(self, other: "Iterable"): # -> Self for item in other: self.append(item) return self diff --git a/pyproject.toml b/pyproject.toml index 4c8f7e618..ac5e6aa3b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -65,6 +65,7 @@ lint.select = [ "RUF", # Ruff-specific rules ] lint.ignore = [ + "PYI034", # py3.11: `__iadd__` methods in classes like `SqEntryList` usually return `self` at runtime "PT027", # Use `pytest.raises` instead of unittest-style `assertRaises` "PD011", # Use `.to_numpy()` instead of `.values`, WTF? "ICN001", # `tkinter` should be imported as `tk`, WTF?