From 366f4ff49a8a31d1e75ee1d55e362aab2c3db6b4 Mon Sep 17 00:00:00 2001 From: David Gardner Date: Tue, 15 Oct 2024 16:39:00 -0700 Subject: [PATCH] Remove deprecated extra = "forbid" --- examples/llm/vdb_upload/module/content_extractor_module.py | 6 ------ examples/llm/vdb_upload/module/file_source_pipe.py | 3 --- examples/llm/vdb_upload/module/rss_source_pipe.py | 3 --- examples/llm/vdb_upload/module/schema_transform.py | 6 ------ .../llm/vdb_upload/module/vdb_resource_tagging_module.py | 3 --- examples/llm/vdb_upload/module/web_scraper_module.py | 3 --- .../morpheus/morpheus/modules/schemas/deserialize_schema.py | 6 ++---- .../morpheus/modules/schemas/multi_file_source_schema.py | 3 --- .../morpheus/morpheus/modules/schemas/rss_source_schema.py | 3 --- .../modules/schemas/write_to_vector_db_schema.py | 3 --- 10 files changed, 2 insertions(+), 37 deletions(-) diff --git a/examples/llm/vdb_upload/module/content_extractor_module.py b/examples/llm/vdb_upload/module/content_extractor_module.py index c02dd89718..688a5c8b46 100755 --- a/examples/llm/vdb_upload/module/content_extractor_module.py +++ b/examples/llm/vdb_upload/module/content_extractor_module.py @@ -44,9 +44,6 @@ class CSVConverterSchema(BaseModel): chunk_size: int = 1024 text_column_names: List[str] - class Config: - extra = "forbid" - class ContentExtractorSchema(BaseModel): batch_size: int = 32 @@ -66,9 +63,6 @@ def val_converters_meta(cls, to_validate: Dict[str, Dict]) -> Dict[str, Dict]: validated_meta[key] = value return validated_meta - class Config: - extra = "forbid" - logger = logging.getLogger(__name__) diff --git a/examples/llm/vdb_upload/module/file_source_pipe.py b/examples/llm/vdb_upload/module/file_source_pipe.py index b39ee23e4e..fd9c9132a6 100644 --- a/examples/llm/vdb_upload/module/file_source_pipe.py +++ b/examples/llm/vdb_upload/module/file_source_pipe.py @@ -49,9 +49,6 @@ class FileSourcePipeSchema(BaseModel): watch: bool = False # Flag to watch file changes watch_interval: float = -5.0 # Interval to watch file changes - class Config: - extra = "forbid" - FileSourcePipeLoaderFactory = ModuleLoaderFactory("file_source_pipe", "morpheus_examples_llm", FileSourcePipeSchema) diff --git a/examples/llm/vdb_upload/module/rss_source_pipe.py b/examples/llm/vdb_upload/module/rss_source_pipe.py index 55b309e032..65ec5ca9dd 100644 --- a/examples/llm/vdb_upload/module/rss_source_pipe.py +++ b/examples/llm/vdb_upload/module/rss_source_pipe.py @@ -63,9 +63,6 @@ def validate_feed_input(cls, to_validate): # pylint: disable=no-self-argument raise ValueError('feed_input must be a string or a list of strings') - class Config: - extra = "forbid" - RSSSourcePipeLoaderFactory = ModuleLoaderFactory("rss_source_pipe", "morpheus_examples_llm", RSSSourcePipeSchema) diff --git a/examples/llm/vdb_upload/module/schema_transform.py b/examples/llm/vdb_upload/module/schema_transform.py index 43e86c3dd4..c4ae8724fe 100644 --- a/examples/llm/vdb_upload/module/schema_transform.py +++ b/examples/llm/vdb_upload/module/schema_transform.py @@ -40,16 +40,10 @@ class ColumnTransformSchema(BaseModel): op_type: str from_: Optional[str] = Field(None, alias="from") - class Config: - extra = "forbid" - class SchemaTransformSchema(BaseModel): schema_transform_config: Dict[str, Dict[str, Any]] = Field(default_factory=dict) - class Config: - extra = "forbid" - SchemaTransformLoaderFactory = ModuleLoaderFactory("schema_transform", "morpheus_examples_llm", SchemaTransformSchema) diff --git a/examples/llm/vdb_upload/module/vdb_resource_tagging_module.py b/examples/llm/vdb_upload/module/vdb_resource_tagging_module.py index 2e3227149a..874b9e8c6e 100644 --- a/examples/llm/vdb_upload/module/vdb_resource_tagging_module.py +++ b/examples/llm/vdb_upload/module/vdb_resource_tagging_module.py @@ -28,9 +28,6 @@ class VDBResourceTaggingSchema(BaseModel): vdb_resource_name: str - class Config: - extra = "forbid" - VDBResourceTaggingLoaderFactory = ModuleLoaderFactory("vdb_resource_tagging", "morpheus_examples_llm", diff --git a/examples/llm/vdb_upload/module/web_scraper_module.py b/examples/llm/vdb_upload/module/web_scraper_module.py index c361339d49..f149f10e83 100644 --- a/examples/llm/vdb_upload/module/web_scraper_module.py +++ b/examples/llm/vdb_upload/module/web_scraper_module.py @@ -42,9 +42,6 @@ class WebScraperSchema(BaseModel): cache_path: str = "./.cache/http/RSSDownloadStage.sqlite" cache_dir: str = "./.cache/llm/rss" - class Config: - extra = "forbid" - WebScraperLoaderFactory = ModuleLoaderFactory("web_scraper", "morpheus_examples_llm", WebScraperSchema) diff --git a/python/morpheus/morpheus/modules/schemas/deserialize_schema.py b/python/morpheus/morpheus/modules/schemas/deserialize_schema.py index 6e59410333..48ad55e7dd 100644 --- a/python/morpheus/morpheus/modules/schemas/deserialize_schema.py +++ b/python/morpheus/morpheus/modules/schemas/deserialize_schema.py @@ -17,14 +17,12 @@ from typing import Dict from typing import Optional -from pydantic import ConfigDict -from pydantic.dataclasses import dataclass +from pydantic import BaseModel logger = logging.getLogger(__name__) -@dataclass(config=ConfigDict(extra="forbid")) -class DeserializeSchema: +class DeserializeSchema(BaseModel): ensure_sliceable_index: bool = True message_type: str = "ControlMessage" task_type: Optional[str] = None diff --git a/python/morpheus/morpheus/modules/schemas/multi_file_source_schema.py b/python/morpheus/morpheus/modules/schemas/multi_file_source_schema.py index 5ce4f50b7f..4b484facc8 100644 --- a/python/morpheus/morpheus/modules/schemas/multi_file_source_schema.py +++ b/python/morpheus/morpheus/modules/schemas/multi_file_source_schema.py @@ -26,6 +26,3 @@ class MultiFileSourceSchema(BaseModel): watch_dir: bool = False watch_interval: float = 1.0 batch_size: int = 128 - - class Config: - extra = "forbid" diff --git a/python/morpheus/morpheus/modules/schemas/rss_source_schema.py b/python/morpheus/morpheus/modules/schemas/rss_source_schema.py index d2c6470061..e77b5dc5a1 100644 --- a/python/morpheus/morpheus/modules/schemas/rss_source_schema.py +++ b/python/morpheus/morpheus/modules/schemas/rss_source_schema.py @@ -32,6 +32,3 @@ class RSSSourceSchema(BaseModel): interval_sec: int = 600 stop_after_rec: int = 0 strip_markup: bool = True - - class Config: - extra = "forbid" diff --git a/python/morpheus_llm/morpheus_llm/modules/schemas/write_to_vector_db_schema.py b/python/morpheus_llm/morpheus_llm/modules/schemas/write_to_vector_db_schema.py index 8000dabfbc..ed027e0acd 100644 --- a/python/morpheus_llm/morpheus_llm/modules/schemas/write_to_vector_db_schema.py +++ b/python/morpheus_llm/morpheus_llm/modules/schemas/write_to_vector_db_schema.py @@ -50,6 +50,3 @@ def validate_resource_name(cls, to_validate): # pylint: disable=no-self-argumen if not to_validate: raise ValueError("Resource name must not be None or Empty.") return to_validate - - class Config: - extra = "forbid"