Skip to content

Commit be262f5

Browse files
authored
remove compat code for python<3.11 (#172)
* format with python 3.11 syntax * import `Self` from `typing` * remove compat code for exception groups * bump lockfile
1 parent 170f173 commit be262f5

File tree

8 files changed

+11
-48
lines changed

8 files changed

+11
-48
lines changed

pixi.lock

Lines changed: 7 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ dependencies = [
2626
"xarray",
2727
"cdshealpix",
2828
"h3ronpy",
29-
"typing-extensions",
3029
"lonboard>=0.9.3",
3130
"pyproj>=3.3",
3231
"matplotlib",
@@ -55,7 +54,7 @@ version-file = "xdggs/_version.py"
5554
only-include = ["xdggs"]
5655

5756
[tool.ruff]
58-
target-version = "py310"
57+
target-version = "py311"
5958
builtins = ["ellipsis"]
6059
exclude = [
6160
".git",

xdggs/grid.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,9 @@
11
import operator
22
from dataclasses import dataclass
3-
from typing import Any, TypeVar
3+
from typing import Any, Self, TypeVar
44

55
from xdggs.itertools import groupby, identity
66

7-
try:
8-
from typing import Self
9-
except ImportError: # pragma: no cover
10-
from typing_extensions import Self
11-
12-
try:
13-
ExceptionGroup
14-
except NameError: # pragma: no cover
15-
from exceptiongroup import ExceptionGroup
16-
177
T = TypeVar("T")
188

199

xdggs/h3.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
import json
22
from collections.abc import Mapping
33
from dataclasses import dataclass
4-
from typing import Any, ClassVar
5-
6-
try:
7-
from typing import Self
8-
except ImportError: # pragma: no cover
9-
from typing_extensions import Self
4+
from typing import Any, ClassVar, Self
105

116
import numpy as np
127
import xarray as xr

xdggs/healpix.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
import json
22
from collections.abc import Mapping
33
from dataclasses import dataclass
4-
from typing import Any, ClassVar, Literal, TypeVar
5-
6-
try:
7-
from typing import Self
8-
except ImportError: # pragma: no cover
9-
from typing_extensions import Self
4+
from typing import Any, ClassVar, Literal, Self, TypeVar
105

116
import cdshealpix.nested
127
import cdshealpix.ring

xdggs/tests/matchers.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22
import re
33
from dataclasses import dataclass, field
44

5-
try:
6-
ExceptionGroup
7-
except NameError:
8-
from exceptiongroup import BaseExceptionGroup, ExceptionGroup
9-
105

116
class MatchResult(enum.Enum):
127
match = 0

xdggs/tests/test_healpix.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@
1414
from xdggs import healpix
1515
from xdggs.tests import assert_exceptions_equal, geoarrow_to_shapely
1616

17-
try:
18-
ExceptionGroup
19-
except NameError: # pragma: no cover
20-
from exceptiongroup import ExceptionGroup
21-
2217

2318
# namespace class
2419
class strategies:

xdggs/tests/test_matchers.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22

33
from xdggs.tests import matchers
44

5-
try:
6-
ExceptionGroup
7-
except NameError: # pragma: no cover
8-
from exceptiongroup import ExceptionGroup
9-
105

116
class TestMatch:
127
def test_construct_simple(self):

0 commit comments

Comments
 (0)