fix warning

This commit is contained in:
saidsurucu
2025-06-24 23:56:25 +03:00
parent 849cea2ca8
commit 5accd34823
4 changed files with 11 additions and 19 deletions
+3 -5
View File
@@ -1,6 +1,6 @@
# danistay_mcp_module/models.py # 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 from typing import List, Optional, Dict, Any
class DanistayBaseSearchRequest(BaseModel): class DanistayBaseSearchRequest(BaseModel):
@@ -76,7 +76,7 @@ class DanistayApiDecisionEntry(BaseModel):
id: str id: str
# The API response for keyword search uses "daireKurul", detailed search example uses "daire". # 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". # 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) esasNo: Optional[str] = Field(None)
kararNo: Optional[str] = Field(None) kararNo: Optional[str] = Field(None)
kararTarihi: 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.") document_url: Optional[HttpUrl] = Field(None, description="URL (Belge URL) to the full document, constructed by the client.")
class Config: model_config = ConfigDict(populate_by_name=True, extra='ignore') # Important for alias to work and ignore extra fields
populate_by_name = True # Important for alias to work
extra = 'ignore' # Ignore any extra fields from API not defined in model
class DanistayApiResponseInnerData(BaseModel): class DanistayApiResponseInnerData(BaseModel):
"""Model for the inner 'data' object in the Danistay API search response.""" """Model for the inner 'data' object in the Danistay API search response."""
+3 -6
View File
@@ -1,6 +1,6 @@
# emsal_mcp_module/models.py # 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 from typing import List, Optional, Dict, Any
class EmsalDetailedSearchRequestData(BaseModel): class EmsalDetailedSearchRequestData(BaseModel):
@@ -32,9 +32,7 @@ class EmsalDetailedSearchRequestData(BaseModel):
pageSize: int pageSize: int
pageNumber: int pageNumber: int
class Config: model_config = ConfigDict(populate_by_name=True) # Enables use of alias in serialization (when dumping to dict for payload)
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
class EmsalSearchRequest(BaseModel): # This is the model the MCP tool will accept class EmsalSearchRequest(BaseModel): # This is the model the MCP tool will accept
"""Model for Emsal detailed search request, with user-friendly field names.""" """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.") document_url: Optional[HttpUrl] = Field(None, description="URL (Belge URL) to the full document, constructed by the client.")
class Config: model_config = ConfigDict(extra='ignore')
extra = 'ignore'
class EmsalApiResponseInnerData(BaseModel): class EmsalApiResponseInnerData(BaseModel):
"""Model for the inner 'data' object in the Emsal API search response.""" """Model for the inner 'data' object in the Emsal API search response."""
+3 -5
View File
@@ -1,5 +1,5 @@
# kik_mcp_module/models.py # 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 typing import List, Optional
from enum import Enum from enum import Enum
import base64 # Base64 encoding/decoding için 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}" combined_key = f"{self.karar_tipi.value}|{self.karar_no_str}"
return base64.b64encode(combined_key.encode('utf-8')).decode('utf-8') return base64.b64encode(combined_key.encode('utf-8')).decode('utf-8')
class Config: model_config = ConfigDict(populate_by_name=True)
populate_by_name = True
class KikSearchResult(BaseModel): class KikSearchResult(BaseModel):
"""Model for KIK search results.""" """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.") 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.") full_content_char_count: Optional[int] = Field(None, description="Total character count of the full markdown content before chunking.")
class Config: model_config = ConfigDict(populate_by_name=True)
populate_by_name = True
+2 -3
View File
@@ -1,6 +1,6 @@
# yargitay_mcp_module/models.py # 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 from typing import List, Optional, Dict, Any, Literal
# Yargıtay Chamber/Board Options # 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 # 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.") document_url: Optional[HttpUrl] = Field(None, description="Direct URL (Belge URL) to the decision document.")
class Config: model_config = ConfigDict(populate_by_name=True) # To allow populating by alias from API response
populate_by_name = True # To allow populating by alias from API response
class YargitayApiResponseInnerData(BaseModel): class YargitayApiResponseInnerData(BaseModel):