[+] release .whl, fix ruff
This commit is contained in:
parent
91dbbde50d
commit
1e73d19122
@ -3,36 +3,36 @@ import inspect
|
||||
import collections
|
||||
|
||||
from typing import (
|
||||
TypeVar, Callable, Any, Optional,
|
||||
Mapping, cast,
|
||||
TypeVar,
|
||||
Callable,
|
||||
Any,
|
||||
Optional,
|
||||
Mapping,
|
||||
cast,
|
||||
)
|
||||
|
||||
P = TypeVar('P')
|
||||
R = TypeVar('R')
|
||||
|
||||
def validate_params(
|
||||
view: Callable[..., R]
|
||||
) -> Callable[..., R]:
|
||||
import inspect
|
||||
|
||||
def validate_params(view: Callable[..., R]) -> Callable[..., R]:
|
||||
class Parameter:
|
||||
kind: Any
|
||||
annotation: Any
|
||||
|
||||
parameters = cast(
|
||||
Mapping[str, Parameter],
|
||||
inspect.signature(view).parameters
|
||||
)
|
||||
parameters = cast(Mapping[str, Parameter], inspect.signature(view).parameters)
|
||||
|
||||
positional_parameters: collections.OrderedDict[str, type[Any]] = \
|
||||
collections.OrderedDict((
|
||||
positional_parameters: collections.OrderedDict[str, type[Any]] = collections.OrderedDict(
|
||||
(
|
||||
(k, v.annotation)
|
||||
for k, v in parameters.items()
|
||||
if v.kind in (
|
||||
if v.kind
|
||||
in (
|
||||
inspect.Parameter.POSITIONAL_ONLY,
|
||||
inspect.Parameter.POSITIONAL_OR_KEYWORD,
|
||||
)
|
||||
))
|
||||
)
|
||||
)
|
||||
positional_names = list(positional_parameters)
|
||||
|
||||
model = pydantic.create_model(
|
||||
@ -40,7 +40,8 @@ def validate_params(
|
||||
**{
|
||||
k: v.annotation
|
||||
for k, v in parameters.items()
|
||||
if v.kind in (
|
||||
if v.kind
|
||||
in (
|
||||
inspect.Parameter.POSITIONAL_OR_KEYWORD,
|
||||
inspect.Parameter.POSITIONAL_ONLY,
|
||||
inspect.Parameter.KEYWORD_ONLY,
|
||||
@ -48,16 +49,13 @@ def validate_params(
|
||||
},
|
||||
__config__=pydantic.ConfigDict(
|
||||
arbitrary_types_allowed=True,
|
||||
)
|
||||
),
|
||||
)
|
||||
|
||||
def wrapper(*args: Any, **kwargs: Any) -> R:
|
||||
# data = model.model_validate(
|
||||
|
||||
kwargs_to_check : dict[str, Any] = {
|
||||
k : v
|
||||
for k, v in kwargs.items()
|
||||
}
|
||||
kwargs_to_check: dict[str, Any] = {k: v for k, v in kwargs.items()}
|
||||
|
||||
for i, o in enumerate(args):
|
||||
k = positional_names[i]
|
||||
|
BIN
releases/whl/online_fxreader_pr34-0.1.5.17+27.22-py3-none-any.whl
(Stored with Git LFS)
Normal file
BIN
releases/whl/online_fxreader_pr34-0.1.5.17+27.22-py3-none-any.whl
(Stored with Git LFS)
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user