From 5accd3482374e043cf70b0f7ba6bfe20e1b7dc0f Mon Sep 17 00:00:00 2001 From: saidsurucu Date: Tue, 24 Jun 2025 23:56:25 +0300 Subject: [PATCH] fix warning --- danistay_mcp_module/models.py | 8 +++----- emsal_mcp_module/models.py | 9 +++------ kik_mcp_module/models.py | 8 +++----- yargitay_mcp_module/models.py | 5 ++--- 4 files changed, 11 insertions(+), 19 deletions(-) diff --git a/danistay_mcp_module/models.py b/danistay_mcp_module/models.py index 1b81885..c6ece0a 100644 --- a/danistay_mcp_module/models.py +++ b/danistay_mcp_module/models.py @@ -1,6 +1,6 @@ # danistay_mcp_module/models.py -from pydantic import BaseModel, Field, HttpUrl +from pydantic import BaseModel, Field, HttpUrl, ConfigDict from typing import List, Optional, Dict, Any class DanistayBaseSearchRequest(BaseModel): @@ -76,7 +76,7 @@ class DanistayApiDecisionEntry(BaseModel): id: str # The API response for keyword search uses "daireKurul", detailed search example uses "daire". # We use an alias to handle both and map to a consistent field name "chamber". - chamber: Optional[str] = Field(None, alias="daire", alt_alias="daireKurul", description="The chamber or board.") + chamber: Optional[str] = Field(None, alias="daire", description="The chamber or board.") esasNo: Optional[str] = Field(None) kararNo: Optional[str] = Field(None) kararTarihi: Optional[str] = Field(None) @@ -86,9 +86,7 @@ class DanistayApiDecisionEntry(BaseModel): document_url: Optional[HttpUrl] = Field(None, description="URL (Belge URL) to the full document, constructed by the client.") - class Config: - populate_by_name = True # Important for alias to work - extra = 'ignore' # Ignore any extra fields from API not defined in model + model_config = ConfigDict(populate_by_name=True, extra='ignore') # Important for alias to work and ignore extra fields class DanistayApiResponseInnerData(BaseModel): """Model for the inner 'data' object in the Danistay API search response.""" diff --git a/emsal_mcp_module/models.py b/emsal_mcp_module/models.py index 2a1235e..216cc2c 100644 --- a/emsal_mcp_module/models.py +++ b/emsal_mcp_module/models.py @@ -1,6 +1,6 @@ # emsal_mcp_module/models.py -from pydantic import BaseModel, Field, HttpUrl +from pydantic import BaseModel, Field, HttpUrl, ConfigDict from typing import List, Optional, Dict, Any class EmsalDetailedSearchRequestData(BaseModel): @@ -32,9 +32,7 @@ class EmsalDetailedSearchRequestData(BaseModel): pageSize: int pageNumber: int - class Config: - populate_by_name = True # Enables use of alias in serialization (when dumping to dict for payload) - # anystr_strip_whitespace = True # Optional: strip whitespace from strings + model_config = ConfigDict(populate_by_name=True) # Enables use of alias in serialization (when dumping to dict for payload) class EmsalSearchRequest(BaseModel): # This is the model the MCP tool will accept """Model for Emsal detailed search request, with user-friendly field names.""" @@ -75,8 +73,7 @@ class EmsalApiDecisionEntry(BaseModel): document_url: Optional[HttpUrl] = Field(None, description="URL (Belge URL) to the full document, constructed by the client.") - class Config: - extra = 'ignore' + model_config = ConfigDict(extra='ignore') class EmsalApiResponseInnerData(BaseModel): """Model for the inner 'data' object in the Emsal API search response.""" diff --git a/kik_mcp_module/models.py b/kik_mcp_module/models.py index 0b67a89..a940dc2 100644 --- a/kik_mcp_module/models.py +++ b/kik_mcp_module/models.py @@ -1,5 +1,5 @@ # kik_mcp_module/models.py -from pydantic import BaseModel, Field, HttpUrl, computed_field +from pydantic import BaseModel, Field, HttpUrl, computed_field, ConfigDict from typing import List, Optional from enum import Enum import base64 # Base64 encoding/decoding için @@ -46,8 +46,7 @@ class KikDecisionEntry(BaseModel): combined_key = f"{self.karar_tipi.value}|{self.karar_no_str}" return base64.b64encode(combined_key.encode('utf-8')).decode('utf-8') - class Config: - populate_by_name = True + model_config = ConfigDict(populate_by_name=True) class KikSearchResult(BaseModel): """Model for KIK search results.""" @@ -73,5 +72,4 @@ class KikDocumentMarkdown(BaseModel): is_paginated: bool = Field(False, description="True if the full markdown content is split into multiple pages.") full_content_char_count: Optional[int] = Field(None, description="Total character count of the full markdown content before chunking.") - class Config: - populate_by_name = True \ No newline at end of file + model_config = ConfigDict(populate_by_name=True) \ No newline at end of file diff --git a/yargitay_mcp_module/models.py b/yargitay_mcp_module/models.py index f9d27b4..4626ef1 100644 --- a/yargitay_mcp_module/models.py +++ b/yargitay_mcp_module/models.py @@ -1,6 +1,6 @@ # yargitay_mcp_module/models.py -from pydantic import BaseModel, Field, HttpUrl +from pydantic import BaseModel, Field, HttpUrl, ConfigDict from typing import List, Optional, Dict, Any, Literal # Yargıtay Chamber/Board Options @@ -115,8 +115,7 @@ class YargitayApiDecisionEntry(BaseModel): # This field will be populated by the client after fetching the search list document_url: Optional[HttpUrl] = Field(None, description="Direct URL (Belge URL) to the decision document.") - class Config: - populate_by_name = True # To allow populating by alias from API response + model_config = ConfigDict(populate_by_name=True) # To allow populating by alias from API response class YargitayApiResponseInnerData(BaseModel):