Spaces:
Running
Running
Merge branch 'parent-depth' into elicitation
Browse files
src/fastmcp/utilities/types.py
CHANGED
|
@@ -38,8 +38,11 @@ def get_cached_typeadapter(cls: T) -> TypeAdapter[T]:
|
|
| 38 |
create them once in a global scope and reuse them as often as possible.
|
| 39 |
However, this isn't feasible for user-generated functions. Instead, we use a
|
| 40 |
cache to minimize the cost of creating them as much as possible.
|
|
|
|
|
|
|
|
|
|
| 41 |
"""
|
| 42 |
-
return TypeAdapter(cls)
|
| 43 |
|
| 44 |
|
| 45 |
def issubclass_safe(cls: type, base: type) -> bool:
|
|
|
|
| 38 |
create them once in a global scope and reuse them as often as possible.
|
| 39 |
However, this isn't feasible for user-generated functions. Instead, we use a
|
| 40 |
cache to minimize the cost of creating them as much as possible.
|
| 41 |
+
|
| 42 |
+
The _parent_depth is set to 3 to look at an additional frame, since this
|
| 43 |
+
function is in its own scope.
|
| 44 |
"""
|
| 45 |
+
return TypeAdapter(cls, _parent_depth=3)
|
| 46 |
|
| 47 |
|
| 48 |
def issubclass_safe(cls: type, base: type) -> bool:
|