Skip to content

Commit 6ea328f

Browse files
committed
treewide: stop using Union type in favour of |
1 parent 41828fd commit 6ea328f

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

nix_update/eval.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import os
33
from dataclasses import InitVar, dataclass, field
44
from textwrap import dedent, indent
5-
from typing import Any, Dict, List, Literal, Optional, Union
5+
from typing import Any, Dict, List, Literal, Optional
66
from urllib.parse import ParseResult, urlparse
77

88
from .errors import UpdateError
@@ -57,7 +57,7 @@ class Package:
5757
has_update_script: bool
5858

5959
raw_version_position: InitVar[Optional[Dict[str, Any]]]
60-
raw_cargo_lock: InitVar[Union[Literal[False], str, None]]
60+
raw_cargo_lock: InitVar[Literal[False] | str | None]
6161

6262
parsed_url: Optional[ParseResult] = None
6363
new_version: Optional[Version] = None
@@ -69,7 +69,7 @@ def __post_init__(
6969
self,
7070
import_path: str,
7171
raw_version_position: Optional[Dict[str, Any]],
72-
raw_cargo_lock: Union[Literal[False], str, None],
72+
raw_cargo_lock: Literal[False] | str | None,
7373
) -> None:
7474
url = self.url or (self.urls[0] if self.urls else None)
7575
if url:

nix_update/update.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from concurrent.futures import ThreadPoolExecutor
1010
from os import path
1111
from pathlib import Path
12-
from typing import Dict, Literal, Optional, Tuple, Union
12+
from typing import Dict, Literal, Optional, Tuple
1313

1414
from .errors import UpdateError
1515
from .eval import CargoLockInSource, CargoLockInStore, NoCargoLock, Package, eval_attr
@@ -152,7 +152,7 @@ def update_cargo_deps_hash(opts: Options, filename: str, current_hash: str) -> N
152152
replace_hash(filename, current_hash, target_hash)
153153

154154

155-
def update_cargo_lock(opts: Options, filename: str, dst: Union[CargoLockInSource, CargoLockInStore]) -> None:
155+
def update_cargo_lock(opts: Options, filename: str, dst: CargoLockInSource | CargoLockInStore) -> None:
156156
res = run(
157157
[
158158
"nix",

nix_update/utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import subprocess
33
import sys
44
from pathlib import Path
5-
from typing import IO, Any, Callable, Dict, List, Optional, Union
5+
from typing import IO, Any, Callable, Dict, List, Optional
66

77
HAS_TTY = sys.stdout.isatty()
88
ROOT = Path(os.path.dirname(os.path.realpath(__file__)))
@@ -24,9 +24,9 @@ def wrapper(text: str) -> None:
2424

2525
def run(
2626
command: List[str],
27-
cwd: Optional[Union[Path, str]] = None,
28-
stdout: Union[None, int, IO[Any]] = subprocess.PIPE,
29-
stderr: Union[None, int, IO[Any]] = None,
27+
cwd: Optional[Path | str] = None,
28+
stdout: None | int | IO[Any] = subprocess.PIPE,
29+
stderr: None | int | IO[Any] = None,
3030
check: bool = True,
3131
extra_env: Dict[str, str] = {},
3232
) -> "subprocess.CompletedProcess[str]":

0 commit comments

Comments
 (0)