Spaces:
Running
Running
Jeremiah Lowin commited on
Commit ·
59932ee
1
Parent(s): 24dfe01
Ensure deprecation warnings have stacklevel=2
Browse files
src/fastmcp/prompts/prompt_manager.py
CHANGED
|
@@ -60,6 +60,7 @@ class PromptManager:
|
|
| 60 |
warnings.warn(
|
| 61 |
"PromptManager.add_prompt_from_fn() is deprecated. Use Prompt.from_function() and call add_prompt() instead.",
|
| 62 |
DeprecationWarning,
|
|
|
|
| 63 |
)
|
| 64 |
prompt = FunctionPrompt.from_function(
|
| 65 |
fn, name=name, description=description, tags=tags
|
|
|
|
| 60 |
warnings.warn(
|
| 61 |
"PromptManager.add_prompt_from_fn() is deprecated. Use Prompt.from_function() and call add_prompt() instead.",
|
| 62 |
DeprecationWarning,
|
| 63 |
+
stacklevel=2,
|
| 64 |
)
|
| 65 |
prompt = FunctionPrompt.from_function(
|
| 66 |
fn, name=name, description=description, tags=tags
|
src/fastmcp/resources/resource_manager.py
CHANGED
|
@@ -125,6 +125,7 @@ class ResourceManager:
|
|
| 125 |
warnings.warn(
|
| 126 |
"add_resource_from_fn is deprecated. Use Resource.from_function() and call add_resource() instead.",
|
| 127 |
DeprecationWarning,
|
|
|
|
| 128 |
)
|
| 129 |
resource = Resource.from_function(
|
| 130 |
fn=fn,
|
|
@@ -181,6 +182,7 @@ class ResourceManager:
|
|
| 181 |
warnings.warn(
|
| 182 |
"add_template_from_fn is deprecated. Use ResourceTemplate.from_function() and call add_template() instead.",
|
| 183 |
DeprecationWarning,
|
|
|
|
| 184 |
)
|
| 185 |
template = ResourceTemplate.from_function(
|
| 186 |
fn,
|
|
|
|
| 125 |
warnings.warn(
|
| 126 |
"add_resource_from_fn is deprecated. Use Resource.from_function() and call add_resource() instead.",
|
| 127 |
DeprecationWarning,
|
| 128 |
+
stacklevel=2,
|
| 129 |
)
|
| 130 |
resource = Resource.from_function(
|
| 131 |
fn=fn,
|
|
|
|
| 182 |
warnings.warn(
|
| 183 |
"add_template_from_fn is deprecated. Use ResourceTemplate.from_function() and call add_template() instead.",
|
| 184 |
DeprecationWarning,
|
| 185 |
+
stacklevel=2,
|
| 186 |
)
|
| 187 |
template = ResourceTemplate.from_function(
|
| 188 |
fn,
|
src/fastmcp/tools/tool_manager.py
CHANGED
|
@@ -73,6 +73,7 @@ class ToolManager:
|
|
| 73 |
warnings.warn(
|
| 74 |
"ToolManager.add_tool_from_fn() is deprecated. Use Tool.from_function() and call add_tool() instead.",
|
| 75 |
DeprecationWarning,
|
|
|
|
| 76 |
)
|
| 77 |
tool = Tool.from_function(
|
| 78 |
fn,
|
|
|
|
| 73 |
warnings.warn(
|
| 74 |
"ToolManager.add_tool_from_fn() is deprecated. Use Tool.from_function() and call add_tool() instead.",
|
| 75 |
DeprecationWarning,
|
| 76 |
+
stacklevel=2,
|
| 77 |
)
|
| 78 |
tool = Tool.from_function(
|
| 79 |
fn,
|