mirror of
https://github.com/Mic92/nix-update.git
synced 2024-09-17 13:27:27 +03:00
treewide: stop using Union type in favour of |
This commit is contained in:
parent
01408b8b13
commit
f969788b35
@ -2,7 +2,7 @@ import json
|
||||
import os
|
||||
from dataclasses import InitVar, dataclass, field
|
||||
from textwrap import dedent, indent
|
||||
from typing import Any, Dict, List, Literal, Optional, Union
|
||||
from typing import Any, Dict, List, Literal, Optional
|
||||
from urllib.parse import ParseResult, urlparse
|
||||
|
||||
from .errors import UpdateError
|
||||
@ -57,7 +57,7 @@ class Package:
|
||||
has_update_script: bool
|
||||
|
||||
raw_version_position: InitVar[Optional[Dict[str, Any]]]
|
||||
raw_cargo_lock: InitVar[Union[Literal[False], str, None]]
|
||||
raw_cargo_lock: InitVar[Literal[False] | str | None]
|
||||
|
||||
parsed_url: Optional[ParseResult] = None
|
||||
new_version: Optional[Version] = None
|
||||
@ -69,7 +69,7 @@ class Package:
|
||||
self,
|
||||
import_path: str,
|
||||
raw_version_position: Optional[Dict[str, Any]],
|
||||
raw_cargo_lock: Union[Literal[False], str, None],
|
||||
raw_cargo_lock: Literal[False] | str | None,
|
||||
) -> None:
|
||||
url = self.url or (self.urls[0] if self.urls else None)
|
||||
if url:
|
||||
|
@ -9,7 +9,7 @@ import tomllib
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
from os import path
|
||||
from pathlib import Path
|
||||
from typing import Dict, Literal, Optional, Tuple, Union
|
||||
from typing import Dict, Literal, Optional, Tuple
|
||||
|
||||
from .errors import UpdateError
|
||||
from .eval import CargoLockInSource, CargoLockInStore, NoCargoLock, Package, eval_attr
|
||||
@ -152,7 +152,9 @@ def update_cargo_deps_hash(opts: Options, filename: str, current_hash: str) -> N
|
||||
replace_hash(filename, current_hash, target_hash)
|
||||
|
||||
|
||||
def update_cargo_lock(opts: Options, filename: str, dst: Union[CargoLockInSource, CargoLockInStore]) -> None:
|
||||
def update_cargo_lock(
|
||||
opts: Options, filename: str, dst: CargoLockInSource | CargoLockInStore
|
||||
) -> None:
|
||||
res = run(
|
||||
[
|
||||
"nix",
|
||||
|
@ -2,7 +2,7 @@ import os
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from typing import IO, Any, Callable, Dict, List, Optional, Union
|
||||
from typing import IO, Any, Callable, Dict, List, Optional
|
||||
|
||||
HAS_TTY = sys.stdout.isatty()
|
||||
ROOT = Path(os.path.dirname(os.path.realpath(__file__)))
|
||||
@ -24,9 +24,9 @@ info = color_text(32)
|
||||
|
||||
def run(
|
||||
command: List[str],
|
||||
cwd: Optional[Union[Path, str]] = None,
|
||||
stdout: Union[None, int, IO[Any]] = subprocess.PIPE,
|
||||
stderr: Union[None, int, IO[Any]] = None,
|
||||
cwd: Optional[Path | str] = None,
|
||||
stdout: None | int | IO[Any] = subprocess.PIPE,
|
||||
stderr: None | int | IO[Any] = None,
|
||||
check: bool = True,
|
||||
extra_env: Dict[str, str] = {},
|
||||
) -> "subprocess.CompletedProcess[str]":
|
||||
|
Loading…
Reference in New Issue
Block a user