Skip to content

Commit c2ed77e

Browse files
committed
fix: pylint issues
Signed-off-by: Frederico Araujo <[email protected]>
1 parent 750d090 commit c2ed77e

File tree

6 files changed

+19
-17
lines changed

6 files changed

+19
-17
lines changed

mcpgateway/plugins/framework/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ def json_to_payload(self, hook: str, payload: Union[str | dict]) -> PluginPayloa
188188
# Fall back to global registry
189189
if not hook_payload_type:
190190
# First-Party
191-
from mcpgateway.plugins.framework.hook_registry import get_hook_registry
191+
from mcpgateway.plugins.framework.hook_registry import get_hook_registry # pylint: disable=import-outside-toplevel
192192

193193
registry = get_hook_registry()
194194
hook_payload_type = registry.get_payload_type(hook)
@@ -223,7 +223,7 @@ def json_to_result(self, hook: str, result: Union[str | dict]) -> PluginResult:
223223
# Fall back to global registry
224224
if not hook_result_type:
225225
# First-Party
226-
from mcpgateway.plugins.framework.hook_registry import get_hook_registry
226+
from mcpgateway.plugins.framework.hook_registry import get_hook_registry # pylint: disable=import-outside-toplevel
227227

228228
registry = get_hook_registry()
229229
hook_result_type = registry.get_result_type(hook)

mcpgateway/plugins/framework/external/mcp/client.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,9 +316,12 @@ async def shutdown(self) -> None:
316316
class ExternalHookRef(HookRef):
317317
"""A Hook reference point for external plugins."""
318318

319-
def __init__(self, hook: str, plugin_ref: PluginRef):
319+
def __init__(self, hook: str, plugin_ref: PluginRef): # pylint: disable=super-init-not-called
320320
"""Initialize a hook reference point for an external plugin.
321321
322+
Note: We intentionally don't call super().__init__() because external plugins
323+
use invoke_hook() rather than direct method attributes.
324+
322325
Args:
323326
hook: name of the hook point.
324327
plugin_ref: The reference to the plugin to hook.

mcpgateway/plugins/framework/external/mcp/server/runtime.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,12 @@ async def _start_health_check_server(self, health_port: int) -> None:
157157
health_port: Port number for the health check server.
158158
"""
159159
# Third-Party
160-
from starlette.applications import Starlette
161-
from starlette.requests import Request
162-
from starlette.responses import JSONResponse
163-
from starlette.routing import Route
160+
from starlette.applications import Starlette # pylint: disable=import-outside-toplevel
161+
from starlette.requests import Request # pylint: disable=import-outside-toplevel
162+
from starlette.responses import JSONResponse # pylint: disable=import-outside-toplevel
163+
from starlette.routing import Route # pylint: disable=import-outside-toplevel
164164

165-
async def health_check(request: Request):
165+
async def health_check(_request: Request):
166166
"""Health check endpoint for container orchestration.
167167
168168
Args:
@@ -192,11 +192,11 @@ async def run_streamable_http_async(self) -> None:
192192

193193
# Add health check endpoint to main app
194194
# Third-Party
195-
from starlette.requests import Request
196-
from starlette.responses import JSONResponse
197-
from starlette.routing import Route
195+
from starlette.requests import Request # pylint: disable=import-outside-toplevel
196+
from starlette.responses import JSONResponse # pylint: disable=import-outside-toplevel
197+
from starlette.routing import Route # pylint: disable=import-outside-toplevel
198198

199-
async def health_check(request: Request):
199+
async def health_check(_request: Request):
200200
"""Health check endpoint for container orchestration.
201201
202202
Args:
@@ -254,7 +254,7 @@ async def run():
254254
Raises:
255255
Exception: If plugin server initialization or execution fails.
256256
"""
257-
global SERVER
257+
global SERVER # pylint: disable=global-statement
258258

259259
# Initialize plugin server
260260
SERVER = ExternalPluginServer()

mcpgateway/plugins/framework/manager.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -612,8 +612,7 @@ async def invoke_hook_for_plugin(
612612
if isinstance(payload, (str, dict)):
613613
pydantic_payload = plugin.json_to_payload(hook_type, payload)
614614
return await self._executor.execute_plugin(hook_ref, pydantic_payload, context, violations_as_exceptions)
615-
else:
616-
raise ValueError(f"When payload_as_json=True, payload must be str or dict, got {type(payload)}")
615+
raise ValueError(f"When payload_as_json=True, payload must be str or dict, got {type(payload)}")
617616
# When payload_as_json=False, payload should already be a PluginPayload
618617
if not isinstance(payload, PluginPayload):
619618
raise ValueError(f"When payload_as_json=False, payload must be a PluginPayload, got {type(payload)}")

mcpgateway/plugins/framework/registry.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def register(self, plugin: Plugin) -> None:
9898
self._priority_cache.pop(hook_type, None)
9999
self._hooks_by_name[plugin.name] = plugin_hooks
100100

101-
logger.info(f"Registered plugin: {plugin.name} with hooks: {[h for h in plugin.hooks]}")
101+
logger.info(f"Registered plugin: {plugin.name} with hooks: {list(plugin.hooks)}")
102102

103103
def unregister(self, plugin_name: str) -> None:
104104
"""Unregister a plugin given its name.

mcpgateway/plugins/mcp/entities/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def _register_mcp_hooks():
4545
"""
4646
# Import here to avoid circular dependency at module load time
4747
# First-Party
48-
from mcpgateway.plugins.framework.hook_registry import get_hook_registry
48+
from mcpgateway.plugins.framework.hook_registry import get_hook_registry # pylint: disable=import-outside-toplevel
4949

5050
registry = get_hook_registry()
5151

0 commit comments

Comments
 (0)