mirror of
https://github.com/Mic92/nix-update.git
synced 2024-09-11 10:35:43 +03:00
fix pyright lints (#188)
This commit is contained in:
parent
aee90c0274
commit
1186454210
@ -1,6 +1,6 @@
|
||||
import re
|
||||
from functools import partial
|
||||
from typing import Callable, List, Optional
|
||||
from typing import Callable, List, Optional, Protocol
|
||||
from urllib.parse import ParseResult
|
||||
|
||||
from ..errors import VersionError
|
||||
@ -23,6 +23,12 @@ from .version import Version, VersionPreference
|
||||
# return repo["version"]
|
||||
# return None
|
||||
|
||||
|
||||
class SnapshotFetcher(Protocol):
|
||||
def __call__(self, url: ParseResult, branch: str) -> List[Version]:
|
||||
...
|
||||
|
||||
|
||||
fetchers: List[Callable[[ParseResult], List[Version]]] = [
|
||||
fetch_crate_versions,
|
||||
fetch_pypi_versions,
|
||||
@ -34,7 +40,7 @@ fetchers: List[Callable[[ParseResult], List[Version]]] = [
|
||||
fetch_sourcehut_versions,
|
||||
]
|
||||
|
||||
branch_snapshots_fetchers: List[Callable[[ParseResult, str], List[Version]]] = [
|
||||
branch_snapshots_fetchers: List[SnapshotFetcher] = [
|
||||
fetch_gitea_snapshots,
|
||||
fetch_github_snapshots,
|
||||
fetch_gitlab_snapshots,
|
||||
|
@ -13,10 +13,12 @@ TEST_ROOT = Path(__file__).parent.resolve()
|
||||
|
||||
|
||||
def fake_urlopen(url: str) -> BinaryIO:
|
||||
del url
|
||||
return open(TEST_ROOT.joinpath("test_branch.atom"), "rb")
|
||||
|
||||
|
||||
def test_branch(helpers: conftest.Helpers) -> None:
|
||||
del helpers
|
||||
with unittest.mock.patch("urllib.request.urlopen", fake_urlopen):
|
||||
assert (
|
||||
fetch_latest_version(
|
||||
|
Loading…
Reference in New Issue
Block a user