Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix pyright checking #628

Merged
merged 4 commits into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
- run: ruff check **/*.py # ignore notebooks for now
if: matrix.test-format
- run: pyright --version
- run: pyright -p pyproject.toml
- run: pyright -p pyproject.toml --pythonversion ${{ matrix.python-version }}
- run: pytest

deploy:
Expand Down
2 changes: 1 addition & 1 deletion bioimageio/spec/_internal/_settings.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from pathlib import Path
from typing import Optional, Union

import pooch
import pooch # pyright: ignore [reportMissingTypeStubs]
from pydantic import Field
from pydantic_settings import BaseSettings, SettingsConfigDict
from typing_extensions import Annotated
Expand Down
9 changes: 7 additions & 2 deletions bioimageio/spec/_internal/io.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from __future__ import annotations

# pyright: reportUnnecessaryTypeIgnoreComment=warning

import hashlib
import sys
import warnings
Expand Down Expand Up @@ -27,7 +29,7 @@
from urllib.parse import urlparse, urlsplit, urlunsplit
from zipfile import ZipFile, is_zipfile

import pooch
import pooch # pyright: ignore [reportMissingTypeStubs]
import pydantic
from pydantic import (
AnyUrl,
Expand Down Expand Up @@ -219,7 +221,10 @@ def get_absolute(
PermissiveFileSource = Union[FileSource, str, pydantic.HttpUrl]

V_suffix = TypeVar("V_suffix", bound=FileSource)
path_or_url_adapter = TypeAdapter(Union[FilePath, DirectoryPath, HttpUrl])
# the type hints available for different python versions require this ignoring of reportUnknownVariableType
path_or_url_adapter = TypeAdapter( # pyright: ignore [reportUnknownVariableType]
Union[FilePath, DirectoryPath, HttpUrl]
)


def validate_suffix(
Expand Down
2 changes: 1 addition & 1 deletion scripts/generate_json_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from tempfile import TemporaryDirectory
from typing import Any, Dict, Literal, Final

from deepdiff import DeepDiff
from deepdiff import DeepDiff # pyright: ignore [reportMissingTypeStubs]
from pydantic import ConfigDict, TypeAdapter
from typing_extensions import assert_never

Expand Down
2 changes: 1 addition & 1 deletion tests/test_bioimageio_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from pathlib import Path
from typing import Any, Dict, Iterable, Mapping

import pooch
import pooch # pyright: ignore [reportMissingTypeStubs]
import pytest

from bioimageio.spec import settings
Expand Down
2 changes: 1 addition & 1 deletion tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import jsonschema
import pytest
from deepdiff import DeepDiff
from deepdiff import DeepDiff # pyright: ignore [reportMissingTypeStubs]
from pydantic import (
DirectoryPath,
RootModel,
Expand Down
Loading