forked from phoenix-oss/llama-stack-mirror
ci: add mypy for static type checking (#1101)
# What does this PR do? - Enable mypy to run in the CI on a subset of the repository - Fix a few mypy errors - Run mypy from pre-commit Signed-off-by: Sébastien Han <seb@redhat.com> [//]: # (If resolving an issue, uncomment and update the line below) [//]: # (Closes #[issue-number]) ## Test Plan [Describe the tests you ran to verify your changes with result summaries. *Provide clear instructions so the plan can be easily re-executed.*] [//]: # (## Documentation) Signed-off-by: Sébastien Han <seb@redhat.com>
This commit is contained in:
parent
25fddccfd8
commit
9bbe34694d
8 changed files with 125 additions and 91 deletions
|
@ -5,12 +5,10 @@
|
|||
# the root directory of this source tree.
|
||||
|
||||
from dataclasses import dataclass
|
||||
from typing import Any, Callable, List, Optional, TypeVar
|
||||
from typing import Any, Callable, List, Optional, Protocol, TypeVar
|
||||
|
||||
from .strong_typing.schema import json_schema_type, register_schema # noqa: F401
|
||||
|
||||
T = TypeVar("T")
|
||||
|
||||
|
||||
@dataclass
|
||||
class WebMethod:
|
||||
|
@ -22,6 +20,13 @@ class WebMethod:
|
|||
raw_bytes_request_body: Optional[bool] = False
|
||||
|
||||
|
||||
class HasWebMethod(Protocol):
|
||||
__webmethod__: WebMethod
|
||||
|
||||
|
||||
T = TypeVar("T", bound=HasWebMethod) # Bound T to classes that match this protocol
|
||||
|
||||
|
||||
def webmethod(
|
||||
route: Optional[str] = None,
|
||||
method: Optional[str] = None,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue