Download BioScientist/UNCOMMITTED_CHANGES.patch from czty/BioOcto: direct link, hf CLI and curl.
- Browser
- Download file 1.66 kB
-
https://huggingface.co/datasets/czty/BioOcto/resolve/main/BioScientist/UNCOMMITTED_CHANGES.patch
- Command line
-
hf download hf://datasets/czty/BioOcto/BioScientist/UNCOMMITTED_CHANGES.patch
-
curl -L -o UNCOMMITTED_CHANGES.patch https://huggingface.co/datasets/czty/BioOcto/resolve/main/BioScientist/UNCOMMITTED_CHANGES.patch
1.66 kB
| diff --git a/agent_system/toolbase/register_mcp_servers_to_biomni.py b/agent_system/toolbase/register_mcp_servers_to_biomni.py | |
| index 5cb314a..d4cc409 100644 | |
| --- a/agent_system/toolbase/register_mcp_servers_to_biomni.py | |
| +++ b/agent_system/toolbase/register_mcp_servers_to_biomni.py | |
| from mcp.server.fastmcp import FastMCP | |
| SOURCE_SERVER = Path({source_server_path!r}) | |
| +LOCAL_SERVER = Path(__file__).with_name(SOURCE_SERVER.name) | |
| SERVER_NAME = {server_name!r} | |
| class _ShimMCP: | |
| @staticmethod | |
| - def tool(): | |
| + def tool(*args, **kwargs): | |
| + if args and callable(args[0]) and len(args) == 1 and not kwargs: | |
| + return args[0] | |
| def _decorator(fn): | |
| return fn | |
| return _decorator | |
| +def _resolve_source_server(): | |
| + if LOCAL_SERVER.exists() and LOCAL_SERVER.name != Path(__file__).name: | |
| + return LOCAL_SERVER | |
| + return SOURCE_SERVER | |
| + | |
| + | |
| def _load_functions(): | |
| - code = SOURCE_SERVER.read_text(encoding="utf-8") | |
| - tree = ast.parse(code, filename=str(SOURCE_SERVER)) | |
| + source_server = _resolve_source_server() | |
| + code = source_server.read_text(encoding="utf-8") | |
| + tree = ast.parse(code, filename=str(source_server)) | |
| function_names = [n.name for n in tree.body if isinstance(n, ast.FunctionDef) and not n.name.startswith("_")] | |
| namespace = {{ | |
| "__name__": "__mcp_source__", | |
| "mcp": _ShimMCP(), | |
| }} | |
| - exec(compile(code, str(SOURCE_SERVER), "exec"), namespace, namespace) | |
| + exec(compile(code, str(source_server), "exec"), namespace, namespace) | |
| loaded = [] | |
| for name in function_names: | |
| fn = namespace.get(name) | |