Skip to content

Commit 5dbe450

Browse files
committed
Use union annotation syntax that came with Python 3.10
1 parent c0e0458 commit 5dbe450

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

spin/__main__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import sys
77
import textwrap
88
import traceback
9-
from typing import Union
109

1110
import click
1211

@@ -31,7 +30,7 @@
3130
)
3231

3332

34-
def _detect_config_dir(path: pathlib.Path) -> Union[pathlib.Path, None]:
33+
def _detect_config_dir(path: pathlib.Path) -> pathlib.Path | None:
3534
path = path.resolve()
3635
files = os.listdir(path)
3736
if any(f in files for f in config_filenames):

spin/cmds/meson.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import sys
99
from enum import Enum
1010
from pathlib import Path
11-
from typing import Union
1211

1312
import click
1413

@@ -36,7 +35,7 @@ def _meson_cli():
3635
return [meson_cli]
3736

3837

39-
def editable_install_path(distname: str) -> Union[str, None]:
38+
def editable_install_path(distname: str) -> str | None:
4039
"""Return path of the editable install for package `distname`.
4140
4241
If the package is not an editable install, return None.
@@ -191,15 +190,15 @@ def _get_site_packages(build_dir: str) -> str:
191190
return site_packages
192191

193192

194-
def _meson_version() -> Union[str, None]:
193+
def _meson_version() -> str | None:
195194
try:
196195
p = _run(_meson_cli() + ["--version"], output=False, echo=False)
197196
return p.stdout.decode("ascii").strip()
198197
except:
199198
return None
200199

201200

202-
def _meson_version_configured(build_dir: str) -> Union[str, None]:
201+
def _meson_version_configured(build_dir: str) -> str | None:
203202
try:
204203
meson_info_fn = os.path.join(build_dir, "meson-info", "meson-info.json")
205204
with open(meson_info_fn) as f:

0 commit comments

Comments
 (0)