Skip to content

Commit c060d3b

Browse files
committed
Get working in all supported versions of Python
1 parent 68f6664 commit c060d3b

11 files changed

Lines changed: 60 additions & 183 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
strategy:
1010
matrix:
1111
# Keep this in sync with tox.ini
12-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
12+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
1313
platform: [ubuntu-latest, macos-latest, windows-latest]
1414
runs-on: ${{ matrix.platform }}
1515
steps:

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ classifiers = [
1515
"Natural Language :: English",
1616
"Programming Language :: Python",
1717
"Programming Language :: Python :: 3",
18-
"Programming Language :: Python :: 3.9",
1918
"Programming Language :: Python :: 3.10",
2019
"Programming Language :: Python :: 3.11",
2120
"Programming Language :: Python :: 3.12",
2221
"Programming Language :: Python :: 3.13",
22+
"Programming Language :: Python :: 3.14",
2323
]
24-
requires-python = ">=3.9"
24+
requires-python = ">=3.10"
2525
dependencies = [
2626
"lark",
2727
"python-statemachine",

src/pathseq/_arithmetic_sequence.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
from collections.abc import Iterator, Sequence
22
import decimal
3-
from typing import overload, Protocol, Self, TypeVar
3+
from typing import overload, Protocol, TypeVar
4+
5+
from typing_extensions import Self # PY311
46

57
from ._ast import FileNumT
68
from ._decimal_range import DecimalRange

src/pathseq/_ast/_loose_type.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
from __future__ import annotations
22

33
from dataclasses import dataclass
4-
from typing import Literal, Self, TypeAlias, Union
4+
from typing import Literal, TypeAlias, Union
5+
6+
from typing_extensions import Self # PY311
57

68
from ._base import (
79
non_recursive_asdict,

src/pathseq/_ast/_type.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
from __future__ import annotations
22

33
from dataclasses import dataclass
4-
from typing import Self
4+
5+
from typing_extensions import Self # PY311
56

67
from ._base import (
78
non_recursive_asdict,

src/pathseq/_decimal_range.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
from collections.abc import Iterator
44
import decimal
55
import math
6-
from typing import Self
6+
7+
from typing_extensions import Self # PY311
78

89

910
class DecimalRangeIterator:

src/pathseq/_file_num_seq.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
from collections.abc import Iterable, Iterator, Sequence
44
import decimal
55
import itertools
6-
from typing import Generic, overload, Self
6+
from typing import Generic, overload, TypeGuard
77

88
from typing_extensions import (
9-
TypeGuard, # PY310
9+
Self, # PY311
1010
)
1111

1212
from ._arithmetic_sequence import ArithmeticSequence

src/pathseq/_formatter.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,22 @@
77
class GlobFormatter(Formatter):
88
"""Format to a glob pattern to match paths in the given sequence."""
99

10+
def __init__(self) -> None:
11+
self._ignore_next_range = False
12+
1013
def range(self, range_: PaddedRange[int] | PaddedRange[Decimal]) -> str:
14+
if self._ignore_next_range:
15+
self._ignore_next_range = False
16+
return ""
17+
1118
return "*"
1219

20+
def inter_range(self, inter_range: str) -> str:
21+
if not inter_range:
22+
self._ignore_next_range = True
23+
24+
return inter_range
25+
1326

1427
class FileNumberFormatter(Formatter):
1528
def __init__(self, *numbers: int | Decimal) -> None:

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
isolated_build = true
33
envlist =
44
# Keep this in sync with .github/workflows/main.yml
5-
py{39,310,311,312,313}
5+
py{310,311,312,313,314}
66
format
77
typecheck
88
lint

0 commit comments

Comments
 (0)