Skip to content

Commit

Permalink
add back compat with python 3.9
Browse files Browse the repository at this point in the history
  • Loading branch information
ilius committed Jan 2, 2025
1 parent d963b91 commit c8e4afc
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: "Test"

on:
push:
branches: ["master", "dev", "github-action"]
branches: ["master", "dev", "github-action", "python3.9"]
pull_request:
schedule:
- cron: "33 1 * * 3"
Expand All @@ -14,7 +14,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]

runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion pyglossary/entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def __init__(
"x": xdxf.
"""
# memory optimization:
if isinstance(word, list | tuple):
if isinstance(word, (list, tuple)):
if len(word) == 1:
word = word[0]
elif not isinstance(word, str):
Expand Down
2 changes: 1 addition & 1 deletion pyglossary/glossary_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
# ]


@dataclass(slots=True, frozen=True)
@dataclass(frozen=True)
class ConvertArgs:
inputFilename: str
inputFormat: str = ""
Expand Down
2 changes: 1 addition & 1 deletion pyglossary/plugins/appledict_bin/appledict_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
__all__ = ["AppleDictProperties", "from_metadata"]


@dataclass(slots=True, frozen=True)
@dataclass(frozen=True)
class AppleDictProperties:
# in plist file: IDXDictionaryVersion
# values := (1 | 2 | 3)
Expand Down
2 changes: 1 addition & 1 deletion pyglossary/plugins/babylon_bgl/bgl_language.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
__all__ = ["BabylonLanguage", "languageByCode"]


@dataclass(slots=True, frozen=True)
@dataclass(frozen=True)
class BabylonLanguage:

"""
Expand Down
2 changes: 1 addition & 1 deletion pyglossary/sort_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class NamedSortKey(NamedTuple):
sqlite: SQLiteSortKeyMakerType | None


@dataclass(slots=True) # not frozen because of mod
@dataclass # not frozen because of mod
class LocaleNamedSortKey:
name: str
desc: str
Expand Down
2 changes: 1 addition & 1 deletion pyglossary/ui/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def validateLangStr(st: str) -> str | None:
)


@dataclass(slots=True, frozen=True)
@dataclass(frozen=True)
class MainPrepareResult:
args: argparse.Namespace
uiType: str
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ exclude = ["pyglossary/plugin_lib/ripemd128.py"]

[tool.ruff]
line-length = 88
target-version = "py310"
target-version = "py39"

# Exclude a variety of commonly ignored directories.
exclude = [
Expand Down
6 changes: 6 additions & 0 deletions tests/entry_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

class TestEntryBasic(unittest.TestCase):
def test_exc_1(self):
if sys.version_info < (3, 10):
return
try:
Entry(b"word", "defi")
except TypeError as e:
Expand All @@ -23,6 +25,8 @@ def test_exc_2(self):
Entry(("word",), "defi")

def test_exc_3(self):
if sys.version_info < (3, 10):
return
try:
Entry("word", b"defi")
except TypeError as e:
Expand All @@ -31,6 +35,8 @@ def test_exc_3(self):
self.fail("must raise TypeError")

def test_exc_4(self):
if sys.version_info < (3, 10):
return
try:
Entry("word", ("defi",))
except TypeError as e:
Expand Down

0 comments on commit c8e4afc

Please sign in to comment.