Skip to content

Commit

Permalink
fix regression in Python 3.10
Browse files Browse the repository at this point in the history
  • Loading branch information
ilius committed Feb 22, 2024
1 parent 4fb9f78 commit a8d3aa9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pyglossary/sq_entry_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"]

Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down

0 comments on commit a8d3aa9

Please sign in to comment.