Skip to content

Commit 77e22fc

Browse files
authored
Merge pull request #196 from IBM/cleanup-isort
Cleanup isort and add import headers
2 parents a0926a2 + a27e658 commit 77e22fc

File tree

76 files changed

+547
-294
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+547
-294
lines changed

.isort.cfg

Lines changed: 0 additions & 48 deletions
This file was deleted.

alembic/env.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
# -*- coding: utf-8 -*-
2+
# Standard
23
from logging.config import fileConfig
34

4-
from sqlalchemy import engine_from_config, pool
5-
5+
# First-Party
66
from alembic import context
77
from mcpgateway.config import settings
88

9+
# Third-Party
10+
from sqlalchemy import engine_from_config, pool
11+
912
# from mcpgateway.db import get_metadata
1013
# target_metadata = get_metadata()
1114

@@ -18,6 +21,7 @@
1821
if config.config_file_name is not None:
1922
fileConfig(config.config_file_name)
2023

24+
# First-Party
2125
# add your model's MetaData object here
2226
# for 'autogenerate' support
2327
# from myapp import mymodel

alembic/versions/b77ca9d2de7e_uuid_pk_and_slug_refactor.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,19 @@
66
Create Date: 2025-06-26 21:29:59.117140
77
88
"""
9-
import uuid
9+
# Standard
1010
from typing import Sequence, Union
11+
import uuid
1112

12-
import sqlalchemy as sa
13-
from sqlalchemy.orm import Session
14-
13+
# First-Party
1514
from alembic import op
1615
from mcpgateway.config import settings
1716
from mcpgateway.utils.create_slug import slugify
1817

18+
# Third-Party
19+
import sqlalchemy as sa
20+
from sqlalchemy.orm import Session
21+
1922
# revision identifiers, used by Alembic.
2023
revision: str = 'b77ca9d2de7e'
2124
down_revision: Union[str, Sequence[str], None] = None

alembic/versions/e4fc04d1a442_add_annotations_to_tables.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,15 @@
66
Create Date: 2025-06-27 21:45:35.099713
77
88
"""
9+
# Standard
910
from typing import Sequence, Union
1011

11-
import sqlalchemy as sa
12-
12+
# First-Party
1313
from alembic import op
1414

15+
# Third-Party
16+
import sqlalchemy as sa
17+
1518
# revision identifiers, used by Alembic.
1619
revision: str = 'e4fc04d1a442'
1720
down_revision: Union[str, Sequence[str], None] = 'b77ca9d2de7e'

gunicorn.config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
Reference: https://stackoverflow.com/questions/10855197/frequent-worker-timeout
1515
"""
1616

17+
# First-Party
1718
# Import Pydantic Settings singleton
1819
from mcpgateway.config import settings
1920

mcpgateway/admin.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,12 @@
1717
underlying data.
1818
"""
1919

20+
# Standard
2021
import json
2122
import logging
2223
from typing import Any, Dict, List, Union
2324

24-
from fastapi import APIRouter, Depends, HTTPException, Request
25-
from fastapi.responses import HTMLResponse, JSONResponse, RedirectResponse
26-
from sqlalchemy.orm import Session
27-
25+
# First-Party
2826
from mcpgateway.config import settings
2927
from mcpgateway.db import get_db
3028
from mcpgateway.schemas import (
@@ -61,6 +59,11 @@
6159
from mcpgateway.utils.create_jwt_token import get_jwt_token
6260
from mcpgateway.utils.verify_credentials import require_auth, require_basic_auth
6361

62+
# Third-Party
63+
from fastapi import APIRouter, Depends, HTTPException, Request
64+
from fastapi.responses import HTMLResponse, JSONResponse, RedirectResponse
65+
from sqlalchemy.orm import Session
66+
6467
# Initialize services
6568
server_service = ServerService()
6669
tool_service = ToolService()

mcpgateway/cache/resource_cache.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@
1212
- Thread-safe operations
1313
"""
1414

15+
# Standard
1516
import asyncio
17+
from dataclasses import dataclass
1618
import logging
1719
import time
18-
from dataclasses import dataclass
1920
from typing import Any, Dict, Optional
2021

2122
logger = logging.getLogger(__name__)

mcpgateway/cache/session_registry.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,35 +9,40 @@
99
using Redis or SQLAlchemy as optional backends for shared state between workers.
1010
"""
1111

12+
# Standard
1213
import asyncio
1314
import json
1415
import logging
1516
import time
1617
from typing import Any, Dict, Optional
1718

18-
import httpx
19-
from fastapi import HTTPException, status
20-
19+
# First-Party
2120
from mcpgateway.config import settings
22-
from mcpgateway.db import SessionMessageRecord, SessionRecord, get_db
21+
from mcpgateway.db import get_db, SessionMessageRecord, SessionRecord
2322
from mcpgateway.services import PromptService, ResourceService, ToolService
2423
from mcpgateway.transports import SSETransport
2524
from mcpgateway.types import Implementation, InitializeResult, ServerCapabilities
2625

26+
# Third-Party
27+
from fastapi import HTTPException, status
28+
import httpx
29+
2730
logger = logging.getLogger(__name__)
2831

2932
tool_service = ToolService()
3033
resource_service = ResourceService()
3134
prompt_service = PromptService()
3235

3336
try:
37+
# Third-Party
3438
from redis.asyncio import Redis
3539

3640
REDIS_AVAILABLE = True
3741
except ImportError:
3842
REDIS_AVAILABLE = False
3943

4044
try:
45+
# Third-Party
4146
from sqlalchemy import func
4247

4348
SQLALCHEMY_AVAILABLE = True

mcpgateway/cli.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,20 @@
3333
```
3434
"""
3535

36+
# Future
3637
from __future__ import annotations
3738

39+
# Standard
3840
import os
3941
import sys
4042
from typing import List
4143

42-
import uvicorn
43-
44+
# First-Party
4445
from mcpgateway import __version__
4546

47+
# Third-Party
48+
import uvicorn
49+
4650
# ---------------------------------------------------------------------------
4751
# Configuration defaults (overridable via environment variables)
4852
# ---------------------------------------------------------------------------

mcpgateway/config.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,16 @@
2929
- HEALTH_CHECK_INTERVAL: Gateway health check interval (default: 60)
3030
"""
3131

32-
import json
32+
# Standard
3333
from functools import lru_cache
3434
from importlib.resources import files
35+
import json
3536
from pathlib import Path
3637
from typing import Annotated, Any, Dict, List, Optional, Set, Union
3738

38-
import jq
39+
# Third-Party
3940
from fastapi import HTTPException
41+
import jq
4042
from jsonpath_ng.ext import parse
4143
from jsonpath_ng.jsonpath import JSONPath
4244
from pydantic import Field, field_validator

0 commit comments

Comments
 (0)