|
1 | 1 | import typing as t |
2 | 2 | from collections import deque |
3 | | -from copy import copy |
4 | 3 | from dataclasses import is_dataclass |
5 | 4 |
|
6 | 5 | from pydantic import ( |
|
21 | 20 | from .fields import ModelField |
22 | 21 | from .types import NoneType, Undefined, UnionType |
23 | 22 |
|
24 | | -FieldInfoType = t.TypeVar("FieldInfoType", bound=FieldInfo) |
25 | | - |
26 | | - |
27 | 23 | sequence_annotation_to_type = { |
28 | 24 | t.Sequence: list, |
29 | 25 | t.List: list, |
@@ -98,17 +94,6 @@ def get_definitions( |
98 | 94 | return field_mapping, definitions # type: ignore[return-value] |
99 | 95 |
|
100 | 96 |
|
101 | | -def copy_from_field_info( |
102 | | - *, from_: FieldInfo, to_: t.Type[t.Union[FieldInfoType, FieldInfo]], **kwargs: t.Any |
103 | | -) -> t.Union[FieldInfoType, FieldInfo]: |
104 | | - # copy_of_from = copy(from_) |
105 | | - _attributes_set = getattr(from_, "_attributes_set", {}) |
106 | | - _attributes_set.update(kwargs) |
107 | | - new_field = to_(**_attributes_set) |
108 | | - new_field.metadata = copy(from_.metadata) |
109 | | - return new_field |
110 | | - |
111 | | - |
112 | 97 | def is_scalar_field(field: ModelField) -> bool: |
113 | 98 | from ellar.common.params.params import BodyFieldInfo, WsBodyFieldInfo |
114 | 99 |
|
@@ -251,14 +236,14 @@ def is_bytes_annotation(annotation: t.Any) -> bool: |
251 | 236 | return False |
252 | 237 |
|
253 | 238 |
|
254 | | -def __default_skip(type_: t.Any) -> bool: |
| 239 | +def __default_skip__(type_: t.Any) -> bool: |
255 | 240 | return False |
256 | 241 |
|
257 | 242 |
|
258 | 243 | def search_in_annotation( |
259 | 244 | annotations: t.Sequence[t.Any], |
260 | 245 | lookup: t.Tuple, |
261 | | - skip: t.Callable[..., bool] = __default_skip, |
| 246 | + skip: t.Callable[..., bool] = __default_skip__, |
262 | 247 | ) -> t.Union[bool, t.Any]: |
263 | 248 | for item in annotations: |
264 | 249 | item_origin = get_origin(item) or item |
|
0 commit comments