Fix linting issues with ruff --fix

Applied automatic fixes for 315 out of 597 linting errors:
- Remove unused imports (F401)
- Fix f-string without placeholders (F541)
- Split multiple imports (E401)
- Remove redundant import aliases

Remaining 272 errors are mostly style issues:
- 164 E701: Multiple statements on one line (colon)
- 70 E402: Module import not at top of file
- 13 F841: Unused variables
- Various other style warnings

Code functionality unchanged - all fixes are cosmetic improvements.
This commit is contained in:
saidsurucu
2025-09-20 01:13:30 +03:00
parent 6f94eca33c
commit 9b43070754
70 changed files with 1127 additions and 277 deletions
@@ -2,13 +2,13 @@
# This client is for Bireysel Başvuru: https://kararlarbilgibankasi.anayasa.gov.tr
import httpx
from bs4 import BeautifulSoup, Tag
from typing import Dict, Any, List, Optional, Tuple
from bs4 import BeautifulSoup
from typing import List, Optional, Tuple
import logging
import html
import re
import io
from urllib.parse import urlencode, urljoin, quote
from urllib.parse import urljoin
from markitdown import MarkItDown
import math # For math.ceil for pagination
@@ -3,12 +3,12 @@
import httpx
from bs4 import BeautifulSoup
from typing import Dict, Any, List, Optional, Tuple
from typing import List, Optional, Tuple
import logging
import html
import re
import io
from urllib.parse import urlencode, urljoin, quote
from urllib.parse import urljoin
from markitdown import MarkItDown
import math # For math.ceil for pagination
@@ -2,7 +2,6 @@
# Unified client for both Norm Denetimi and Bireysel Başvuru
import logging
from typing import Optional
from urllib.parse import urlparse
from .models import (
+8 -13
View File
@@ -10,16 +10,12 @@ Usage:
"""
import os
import time
import logging
from datetime import datetime, timedelta
from fastapi import FastAPI, Request, HTTPException, Query
from fastapi.responses import JSONResponse, HTMLResponse
from fastapi.exception_handlers import http_exception_handler
from starlette.middleware import Middleware
from starlette.middleware.cors import CORSMiddleware
from starlette.responses import Response
from starlette.requests import Request as StarletteRequest
# Import the MCP app creator function
from mcp_server_main import create_app
@@ -103,7 +99,6 @@ mcp_app = mcp_server.http_app(path="/")
# Configure JSON encoder for proper Turkish character support
import json
from fastapi.responses import JSONResponse
class UTF8JSONResponse(JSONResponse):
def __init__(self, content=None, status_code=200, headers=None, **kwargs):
@@ -461,14 +456,14 @@ async def mcp_oauth_callback(request: Request, clerk_token: str = Query(None)):
logger.info("User authenticated successfully via Clerk")
# Return success response
return HTMLResponse(f"""
return HTMLResponse("""
<html>
<head>
<title>MCP Connection Successful</title>
<style>
body {{ font-family: Arial, sans-serif; text-align: center; padding: 50px; }}
.success {{ color: #28a745; }}
.token {{ background: #f8f9fa; padding: 15px; border-radius: 5px; margin: 20px 0; word-break: break-all; }}
body { font-family: Arial, sans-serif; text-align: center; padding: 50px; }
.success { color: #28a745; }
.token { background: #f8f9fa; padding: 15px; border-radius: 5px; margin: 20px 0; word-break: break-all; }
</style>
</head>
<body>
@@ -481,13 +476,13 @@ async def mcp_oauth_callback(request: Request, clerk_token: str = Query(None)):
<p>You can now close this window and return to your MCP client.</p>
<script>
// Try to close the popup if opened as such
if (window.opener) {{
window.opener.postMessage({{
if (window.opener) {
window.opener.postMessage({
type: 'MCP_AUTH_SUCCESS',
token: 'use_clerk_jwt_token'
}}, '*');
}, '*');
setTimeout(() => window.close(), 3000);
}}
}
</script>
</body>
</html>
@@ -1,13 +1,12 @@
# bddk_mcp_module/client.py
import httpx
from typing import List, Optional, Dict, Any
from typing import Optional
import logging
import os
import re
import io
import math
from urllib.parse import urlparse
from markitdown import MarkItDown
from .models import (
@@ -1,7 +1,7 @@
# bddk_mcp_module/models.py
from pydantic import BaseModel, Field
from typing import List, Optional
from typing import List
class BddkSearchRequest(BaseModel):
"""
@@ -1,8 +1,7 @@
# bedesten_mcp_module/models.py
from pydantic import BaseModel, Field
from typing import List, Optional, Dict, Any, Literal, Union
from datetime import datetime
from typing import List, Optional, Dict, Any, Literal
# Import compressed BirimAdiEnum for chamber filtering
from .enums import BirimAdiEnum
@@ -1,11 +1,9 @@
# danistay_mcp_module/client.py
import httpx
from bs4 import BeautifulSoup
from typing import Dict, Any, List, Optional
from typing import Dict, List, Optional
import logging
import html
import re
import io
from markitdown import MarkItDown
@@ -2,10 +2,9 @@
import httpx
# from bs4 import BeautifulSoup # Uncomment if needed for advanced HTML pre-processing
from typing import Dict, Any, List, Optional
from typing import Dict, Optional
import logging
import html
import re
import io
from markitdown import MarkItDown
@@ -7,11 +7,9 @@ import os
from typing import List, Dict, Any, Optional
from datetime import datetime
from fastapi import FastAPI, HTTPException, Query, Depends, Body
from fastapi import FastAPI, HTTPException, Query
from fastapi.middleware.cors import CORSMiddleware
from fastapi.responses import JSONResponse
from pydantic import BaseModel, Field
import json
# Import the main MCP app
from mcp_server_main import app as mcp_server
@@ -10,13 +10,12 @@ from playwright.async_api import (
)
from bs4 import BeautifulSoup
import logging
from typing import Dict, Any, List, Optional
from typing import List, Optional
import urllib.parse
import base64 # Base64 için
import re
import html as html_parser
from markitdown import MarkItDown
import os
import math
import io
import random
@@ -907,7 +906,7 @@ class KikApiClient:
event_target_for_submit = self.FIELD_LOCATORS['search_button_id']
# Use human-like clicking for search button
search_button_selector = f"a[id='{event_target_for_submit}']"
logger.info(f"Performing human-like search button click...")
logger.info("Performing human-like search button click...")
try:
# Hide datepicker first to prevent interference
@@ -1181,7 +1180,7 @@ class KikApiClient:
try:
if await current_main_page.locator(self.MODAL_CLOSE_BUTTON_SELECTOR).is_visible(timeout=2000):
await current_main_page.locator(self.MODAL_CLOSE_BUTTON_SELECTOR).click()
await current_main_page.wait_for_selector(f"div#detayPopUp:not(.in)", timeout=5000)
await current_main_page.wait_for_selector("div#detayPopUp:not(.in)", timeout=5000)
except: pass
return KikDocumentMarkdown(
@@ -1,5 +1,5 @@
# kik_mcp_module/models.py
from pydantic import BaseModel, Field, HttpUrl, computed_field, ConfigDict
from pydantic import BaseModel, Field, computed_field, ConfigDict
from typing import List, Optional
from enum import Enum
import base64 # Base64 encoding/decoding için
@@ -2,13 +2,13 @@
import httpx
from bs4 import BeautifulSoup
from typing import List, Optional, Dict, Any
from typing import Optional, Dict, Any
import logging
import os
import re
import io
import math
from urllib.parse import urljoin, urlparse, parse_qs
from urllib.parse import urlparse
from markitdown import MarkItDown
from pydantic import HttpUrl
@@ -1,7 +1,7 @@
# kvkk_mcp_module/models.py
from pydantic import BaseModel, Field, HttpUrl
from typing import List, Optional, Any
from typing import List, Optional
class KvkkSearchRequest(BaseModel):
"""Model for KVKK (Personal Data Protection Authority) search request via Brave API."""
@@ -36,7 +36,7 @@ def create_clerk_oauth_config() -> OAuthConfig:
scopes=["mcp:tools:read", "mcp:tools:write", "openid", "profile", "email"]
)
logger.info(f"Created Clerk OAuth config with adapter endpoints")
logger.info("Created Clerk OAuth config with adapter endpoints")
logger.info(f"Clerk domain: {clerk_domain}")
logger.debug(f"Authorization endpoint: {config.authorization_endpoint}")
logger.debug(f"Token endpoint: {config.token_endpoint}")
@@ -9,7 +9,7 @@ import time
import logging
from dataclasses import dataclass
from datetime import datetime, timedelta
from typing import Any, Optional
from typing import Any
from urllib.parse import urlencode
import httpx
@@ -18,7 +18,7 @@ from fastapi.responses import RedirectResponse, JSONResponse
try:
from clerk_backend_api import Clerk
CLERK_AVAILABLE = True
except ImportError as e:
except ImportError:
CLERK_AVAILABLE = False
Clerk = None
@@ -6,7 +6,7 @@ Uses Redis for authorization code storage to support multi-machine deployment
import os
import logging
from typing import Optional
from urllib.parse import urlencode, quote
from urllib.parse import urlencode
from fastapi import APIRouter, Request, Query, HTTPException
from fastapi.responses import RedirectResponse, JSONResponse
@@ -39,7 +39,6 @@ def get_redis_session_store():
if redis_store is None:
try:
import concurrent.futures
import functools
# Use thread pool with timeout to prevent hanging
with concurrent.futures.ThreadPoolExecutor(max_workers=1) as executor:
@@ -206,7 +205,6 @@ async def oauth_callback(
auth_code = f"clerk_auth_{os.urandom(16).hex()}"
# Prepare code data
import time
code_data = {
"user_id": user_id,
"session_id": session_id,
@@ -225,7 +223,7 @@ async def oauth_callback(
if success:
logger.info(f"Stored authorization code {auth_code[:10]}... in Redis with real JWT token")
else:
logger.error(f"Failed to store authorization code in Redis, falling back to in-memory")
logger.error("Failed to store authorization code in Redis, falling back to in-memory")
# Fall back to in-memory storage
if not hasattr(oauth_callback, '_code_storage'):
oauth_callback._code_storage = {}
@@ -236,7 +234,7 @@ async def oauth_callback(
if not hasattr(oauth_callback, '_code_storage'):
oauth_callback._code_storage = {}
oauth_callback._code_storage[auth_code] = code_data
logger.info(f"Stored authorization code in memory (fallback)")
logger.info("Stored authorization code in memory (fallback)")
# Redirect back to client with authorization code
redirect_params = {
+32 -57
View File
@@ -8,8 +8,7 @@ import json
import time
from collections import defaultdict
from pydantic import HttpUrl, Field
from typing import Optional, Dict, List, Literal, Any, Union
import urllib.parse
from typing import Dict, List, Literal, Any
import tiktoken
from fastmcp.server.middleware import Middleware, MiddlewareContext
from fastmcp.server.dependencies import get_access_token, AccessToken
@@ -159,7 +158,7 @@ class TokenCountingMiddleware(Middleware):
return result
except Exception as e:
except Exception:
duration_ms = (time.perf_counter() - start_time) * 1000
self.log_token_usage("tool_call_error", input_tokens, 0,
tool_name, duration_ms)
@@ -189,7 +188,7 @@ class TokenCountingMiddleware(Middleware):
return result
except Exception as e:
except Exception:
duration_ms = (time.perf_counter() - start_time) * 1000
self.log_token_usage("resource_read_error", 0, 0,
resource_uri, duration_ms)
@@ -219,7 +218,7 @@ class TokenCountingMiddleware(Middleware):
return result
except Exception as e:
except Exception:
duration_ms = (time.perf_counter() - start_time) * 1000
self.log_token_usage("prompt_get_error", 0, 0,
prompt_name, duration_ms)
@@ -260,10 +259,6 @@ def create_app(auth=None):
# --- Module Imports ---
from yargitay_mcp_module.client import YargitayOfficialApiClient
from yargitay_mcp_module.models import (
YargitayDetailedSearchRequest, YargitayDocumentMarkdown, CompactYargitaySearchResult,
YargitayBirimEnum, CleanYargitayDecisionEntry
)
from bedesten_mcp_module.client import BedestenApiClient
from bedesten_mcp_module.models import (
BedestenSearchRequest, BedestenSearchData,
@@ -271,10 +266,6 @@ from bedesten_mcp_module.models import (
)
from bedesten_mcp_module.enums import BirimAdiEnum
from danistay_mcp_module.client import DanistayApiClient
from danistay_mcp_module.models import (
DanistayKeywordSearchRequest, DanistayDetailedSearchRequest,
DanistayDocumentMarkdown, CompactDanistaySearchResult
)
from emsal_mcp_module.client import EmsalApiClient
from emsal_mcp_module.models import (
EmsalSearchRequest, EmsalDocumentMarkdown, CompactEmsalSearchResult
@@ -288,15 +279,7 @@ from anayasa_mcp_module.client import AnayasaMahkemesiApiClient
from anayasa_mcp_module.bireysel_client import AnayasaBireyselBasvuruApiClient
from anayasa_mcp_module.unified_client import AnayasaUnifiedClient
from anayasa_mcp_module.models import (
AnayasaNormDenetimiSearchRequest,
AnayasaSearchResult,
AnayasaDocumentMarkdown,
AnayasaBireyselReportSearchRequest,
AnayasaBireyselReportSearchResult,
AnayasaBireyselBasvuruDocumentMarkdown,
AnayasaUnifiedSearchRequest,
AnayasaUnifiedSearchResult,
AnayasaUnifiedDocumentMarkdown,
# Removed enum imports - now using Literal strings in models
)
# KIK Module Imports
@@ -318,14 +301,9 @@ from rekabet_mcp_module.models import (
from sayistay_mcp_module.client import SayistayApiClient
from sayistay_mcp_module.models import (
GenelKurulSearchRequest, GenelKurulSearchResponse,
TemyizKuruluSearchRequest, TemyizKuruluSearchResponse,
DaireSearchRequest, DaireSearchResponse,
SayistayDocumentMarkdown,
SayistayUnifiedSearchRequest, SayistayUnifiedSearchResult,
SayistayUnifiedDocumentMarkdown
)
from sayistay_mcp_module.enums import DaireEnum, KamuIdaresiTuruEnum, WebKararKonusuEnum
from sayistay_mcp_module.unified_client import SayistayUnifiedClient
# KVKK Module Imports
@@ -339,14 +317,11 @@ from kvkk_mcp_module.models import (
# BDDK Module Imports
from bddk_mcp_module.client import BddkApiClient
from bddk_mcp_module.models import (
BddkSearchRequest,
BddkSearchResult,
BddkDocumentMarkdown
BddkSearchRequest
)
# Create a placeholder app that will be properly initialized after tools are defined
from fastmcp import FastMCP
# Placeholder app for decorators - will be replaced in create_app() after all tools are defined
app = FastMCP("Yargı MCP Server Placeholder")
@@ -1372,7 +1347,7 @@ async def search_emsal_detailed_decisions(
page_size=page_size
)
logger.info(f"Tool 'search_emsal_detailed_decisions' called.")
logger.info("Tool 'search_emsal_detailed_decisions' called.")
try:
api_response = await emsal_client_instance.search_detailed_decisions(search_query)
if api_response.data:
@@ -1384,8 +1359,8 @@ async def search_emsal_detailed_decisions(
)
logger.warning("API response for Emsal search did not contain expected data structure.")
return CompactEmsalSearchResult(decisions=[], total_records=0, requested_page=search_query.page_number, page_size=search_query.page_size)
except Exception as e:
logger.exception(f"Error in tool 'search_emsal_detailed_decisions'.")
except Exception:
logger.exception("Error in tool 'search_emsal_detailed_decisions'.")
raise
@app.tool(
@@ -1401,8 +1376,8 @@ async def get_emsal_document_markdown(id: str) -> EmsalDocumentMarkdown:
if not id or not id.strip(): raise ValueError("Document ID required for Emsal.")
try:
return await emsal_client_instance.get_decision_document_as_markdown(id)
except Exception as e:
logger.exception(f"Error in tool 'get_emsal_document_markdown'.")
except Exception:
logger.exception("Error in tool 'get_emsal_document_markdown'.")
raise
# --- MCP Tools for Uyusmazlik ---
@@ -1470,11 +1445,11 @@ async def search_uyusmazlik_decisions(
not_hepsi=not_hepsi
)
logger.info(f"Tool 'search_uyusmazlik_decisions' called.")
logger.info("Tool 'search_uyusmazlik_decisions' called.")
try:
return await uyusmazlik_client_instance.search_decisions(search_params)
except Exception as e:
logger.exception(f"Error in tool 'search_uyusmazlik_decisions'.")
except Exception:
logger.exception("Error in tool 'search_uyusmazlik_decisions'.")
raise
@app.tool(
@@ -1493,8 +1468,8 @@ async def get_uyusmazlik_document_markdown_from_url(
raise ValueError("Document URL (document_url) is required for Uyuşmazlık document retrieval.")
try:
return await uyusmazlik_client_instance.get_decision_document_as_markdown(str(document_url))
except Exception as e:
logger.exception(f"Error in tool 'get_uyusmazlik_document_markdown_from_url'.")
except Exception:
logger.exception("Error in tool 'get_uyusmazlik_document_markdown_from_url'.")
raise
# --- DEACTIVATED: MCP Tools for Anayasa Mahkemesi (Individual Tools) ---
@@ -1585,8 +1560,8 @@ async def search_anayasa_unified(
result = await anayasa_unified_client_instance.search_unified(request)
return json.dumps(result.model_dump(), ensure_ascii=False, indent=2)
except Exception as e:
logger.exception(f"Error in tool 'search_anayasa_unified'.")
except Exception:
logger.exception("Error in tool 'search_anayasa_unified'.")
raise
@app.tool(
@@ -1607,8 +1582,8 @@ async def get_anayasa_document_unified(
result = await anayasa_unified_client_instance.get_document_unified(document_url, page_number)
return json.dumps(result.model_dump(mode='json'), ensure_ascii=False, indent=2)
except Exception as e:
logger.exception(f"Error in tool 'get_anayasa_document_unified'.")
except Exception:
logger.exception("Error in tool 'get_anayasa_document_unified'.")
raise
# --- MCP Tools for KIK (Kamu İhale Kurulu) ---
@@ -1654,15 +1629,15 @@ async def search_kik_decisions(
page=page
)
logger.info(f"Tool 'search_kik_decisions' called.")
logger.info("Tool 'search_kik_decisions' called.")
try:
api_response = await kik_client_instance.search_decisions(search_query)
page_param_for_log = search_query.page if hasattr(search_query, 'page') else 1
if not api_response.decisions and api_response.total_records == 0 and page_param_for_log == 1:
logger.warning(f"KIK search returned no decisions for query.")
logger.warning("KIK search returned no decisions for query.")
return api_response
except Exception as e:
logger.exception(f"Error in KIK search tool 'search_kik_decisions'.")
except Exception:
logger.exception("Error in KIK search tool 'search_kik_decisions'.")
current_page_val = search_query.page if hasattr(search_query, 'page') else 1
return KikSearchResult(decisions=[], total_records=0, current_page=current_page_val)
@@ -1758,7 +1733,7 @@ async def search_rekabet_kurumu_decisions(
try:
return await rekabet_client_instance.search_decisions(search_query)
except Exception as e:
except Exception:
logger.exception("Error in tool 'search_rekabet_kurumu_decisions'.")
return RekabetSearchResult(decisions=[], retrieved_page_number=page, total_records_found=0, total_pages=0)
@@ -1781,7 +1756,7 @@ async def get_rekabet_kurumu_document(
try:
return await rekabet_client_instance.get_decision_document(karar_id, page_number=current_page_to_fetch)
except Exception as e:
except Exception:
logger.exception(f"Error in tool 'get_rekabet_kurumu_document'. Karar ID: {karar_id}")
raise
@@ -1876,7 +1851,7 @@ For best results, use exact phrases with quotes for legal terms."""),
"page_size": pageSize,
"searched_courts": court_types
}
except Exception as e:
except Exception:
logger.exception("Error in tool 'search_bedesten_unified'")
raise
@@ -1898,7 +1873,7 @@ async def get_bedesten_document_markdown(
try:
return await bedesten_client_instance.get_document_as_markdown(documentId)
except Exception as e:
except Exception:
logger.exception("Error in tool 'get_kyb_bedesten_document_markdown'")
raise
@@ -2087,7 +2062,7 @@ async def search_sayistay_unified(
web_karar_metni=web_karar_metni
)
return await sayistay_unified_client_instance.search_unified(search_request)
except Exception as e:
except Exception:
logger.exception("Error in tool 'search_sayistay_unified'")
raise
@@ -2111,7 +2086,7 @@ async def get_sayistay_document_unified(
try:
return await sayistay_unified_client_instance.get_document_unified(decision_id, decision_type)
except Exception as e:
except Exception:
logger.exception("Error in tool 'get_sayistay_document_unified'")
raise
@@ -2698,7 +2673,7 @@ async def search(
logger.info(f"ChatGPT Deep Research search completed. Found {len(results)} results via Bedesten API.")
return {"results": results}
except Exception as e:
except Exception:
logger.exception("Error in ChatGPT Deep Research search tool")
# Return partial results if any were found
if results:
@@ -2827,7 +2802,7 @@ async def fetch(
doc = await bedesten_client_instance.get_document_as_markdown(doc_id)
"""
except Exception as e:
except Exception:
logger.exception(f"Error fetching ChatGPT Deep Research document {id}")
raise
@@ -2874,7 +2849,7 @@ def main():
app.run()
except KeyboardInterrupt:
logger.info("Server shut down by user (KeyboardInterrupt).")
except Exception as e:
except Exception:
logger.exception("Server failed to start or crashed.")
finally:
logger.info(f"{app.name} server has shut down.")
@@ -11,8 +11,8 @@ import os
import json
import time
import logging
from typing import Optional, Dict, Any, Union
from datetime import datetime, timedelta
from typing import Optional, Dict, Any
from datetime import datetime
logger = logging.getLogger(__name__)
@@ -4,10 +4,9 @@ import httpx
from bs4 import BeautifulSoup
from typing import List, Optional, Tuple, Dict, Any
import logging
import html
import re
import io # For io.BytesIO
from urllib.parse import urlencode, urljoin, quote, parse_qs, urlparse
from urllib.parse import urljoin, parse_qs, urlparse
from markitdown import MarkItDown
import math
@@ -18,8 +17,7 @@ from .models import (
RekabetKurumuSearchRequest,
RekabetDecisionSummary,
RekabetSearchResult,
RekabetDocument,
RekabetKararTuruGuidEnum
RekabetDocument
)
from pydantic import HttpUrl # Ensure HttpUrl is imported from pydantic
@@ -1,7 +1,7 @@
# rekabet_mcp_module/models.py
from pydantic import BaseModel, Field, HttpUrl
from typing import List, Optional, Any
from typing import List, Optional
from enum import Enum
# Enum for decision type GUIDs (used by the client and expected by the website)
+1 -1
View File
@@ -93,7 +93,7 @@ def main():
config["workers"] = args.workers
# Print startup information
print(f"Starting Yargı MCP server...")
print("Starting Yargı MCP server...")
print(f"Host: {args.host}")
print(f"Port: {args.port}")
print(f"Transport: {args.transport}")
@@ -1,13 +1,11 @@
# sayistay_mcp_module/client.py
import httpx
import re
from bs4 import BeautifulSoup
from typing import Dict, Any, List, Optional, Tuple
from typing import Dict, List, Optional, Tuple
import logging
import html
import io
from urllib.parse import urlencode, urljoin
from urllib.parse import urlencode
from markitdown import MarkItDown
from .models import (
@@ -16,7 +14,7 @@ from .models import (
DaireSearchRequest, DaireSearchResponse, DaireDecision,
SayistayDocumentMarkdown
)
from .enums import DaireEnum, KamuIdaresiTuruEnum, WebKararKonusuEnum, WEB_KARAR_KONUSU_MAPPING
from .enums import WEB_KARAR_KONUSU_MAPPING
logger = logging.getLogger(__name__)
if not logger.hasHandlers():
@@ -1,7 +1,7 @@
# sayistay_mcp_module/models.py
from pydantic import BaseModel, Field
from typing import Optional, List, Union, Dict, Any, Literal
from typing import Optional, List, Dict, Any, Literal
from enum import Enum
from .enums import DaireEnum, KamuIdaresiTuruEnum, WebKararKonusuEnum
@@ -2,8 +2,6 @@
# Unified client for all three Sayıştay decision types
import logging
from typing import Optional, Dict, Any
from urllib.parse import urlparse
from .models import (
SayistayUnifiedSearchRequest,
@@ -13,7 +13,7 @@ import os
from starlette.applications import Starlette
from starlette.routing import Mount, Route
from starlette.requests import Request
from starlette.responses import JSONResponse, PlainTextResponse, RedirectResponse
from starlette.responses import JSONResponse
from starlette.middleware import Middleware
from starlette.middleware.cors import CORSMiddleware
from starlette.middleware.authentication import AuthenticationMiddleware
@@ -1,4 +1,5 @@
import os, stripe
import os
import stripe
from clerk_backend_api import Clerk # Clerk backend SDK
from fastapi import APIRouter, Request, HTTPException
@@ -3,7 +3,7 @@
import httpx
import aiohttp
from bs4 import BeautifulSoup
from typing import Dict, Any, List, Optional, Union, Tuple
from typing import List, Optional, Tuple
import logging
import html
import re
@@ -1,20 +1,16 @@
# yargitay_mcp_module/client.py
import httpx
from bs4 import BeautifulSoup # Still needed for pre-processing HTML before markitdown
from typing import Dict, Any, List, Optional
from typing import Optional
import logging
import html
import re
import io
from markitdown import MarkItDown
from .models import (
YargitayDetailedSearchRequest,
YargitayApiSearchResponse,
YargitayApiDecisionEntry,
YargitayDocumentMarkdown,
CompactYargitaySearchResult
YargitayDocumentMarkdown
)
logger = logging.getLogger(__name__)
@@ -1,7 +1,7 @@
# yargitay_mcp_module/models.py
from pydantic import BaseModel, Field, HttpUrl, ConfigDict
from typing import List, Optional, Dict, Any, Literal
from typing import List, Optional, Literal
# Yargıtay Chamber/Board Options
YargitayBirimEnum = Literal[