Skip to content

Commit

Permalink
get rid of protected objects (#57)
Browse files Browse the repository at this point in the history
Co-authored-by: Vitaliy Zakharkiv <zakharkiv.vv@uds.ua.energy>
  • Loading branch information
VitailOG and Vitaliy Zakharkiv authored Jan 8, 2024
1 parent 2bab05f commit db6318b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ wtf
coverage.json
site
wtf.py
.DS_Store
.DS_Store
.idea/
6 changes: 3 additions & 3 deletions fast_depends/core/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def build_call_model(
dep: Optional[Depends] = None
custom: Optional[CustomField] = None

if param.annotation is inspect._empty:
if param.annotation is inspect.Parameter.empty:
annotation = Any

elif get_origin(param.annotation) is Annotated:
Expand Down Expand Up @@ -117,7 +117,7 @@ def build_call_model(
), "You can not use `CustomField` with `Annotated` and default both"
custom = default

elif default is inspect._empty:
elif default is inspect.Parameter.empty:
class_fields[param_name] = (annotation, ...)

else:
Expand Down Expand Up @@ -169,7 +169,7 @@ def build_call_model(
)

response_model: Optional[Type[ResponseModel[T]]]
if cast and return_annotation and return_annotation is not inspect._empty:
if cast and return_annotation and return_annotation is not inspect.Parameter.empty:
response_model = create_model( # type: ignore[assignment]
"ResponseModel",
__config__=get_config_base(pydantic_config),
Expand Down
4 changes: 2 additions & 2 deletions fast_depends/core/model.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from contextlib import AsyncExitStack, ExitStack
from inspect import _empty, unwrap
from inspect import Parameter, unwrap
from typing import (
Any,
Awaitable,
Expand Down Expand Up @@ -191,7 +191,7 @@ def _solve(
kw = {}

for arg in self.keyword_args:
if (v := kwargs.pop(arg, _empty)) is not _empty:
if (v := kwargs.pop(arg, Parameter.empty)) is not Parameter.empty:
kw[arg] = v

if "kwargs" in self.alias_arguments:
Expand Down

0 comments on commit db6318b

Please sign in to comment.