11import csv
2- import datetime
2+ import html
3+ import io
34import json
4- import types
5+ import os
56from typing import (
6- Annotated ,
7+ IO ,
78 Any ,
89 Dict ,
910 List ,
10- Literal ,
11- Mapping ,
1211 Optional ,
13- Sequence ,
1412 Set ,
1513 Tuple ,
1614 Type ,
2119
2220import pandas as pd
2321from pydantic import BaseModel , Field , create_model
22+ from pydantic ._internal ._model_construction import ModelMetaclass
2423
2524from agentics .core .utils import sanitize_dict_keys , sanitize_field_name
2625
@@ -46,12 +45,6 @@ def copy_attribute_values(
4645 return state
4746
4847
49- from typing import Type
50-
51- import pandas as pd
52- from pydantic import BaseModel
53-
54-
5548def get_pydantic_fields (atype : Type [BaseModel ]):
5649 """
5750 Extract Pydantic model fields and return them in the same
@@ -103,11 +96,6 @@ def get_active_fields(state: BaseModel, allowed_fields: Set[str] = None) -> Set[
10396 return active_fields & allowed_fields if allowed_fields else active_fields
10497
10598
106- import io
107- import os
108- from typing import IO
109-
110-
11199def pydantic_model_from_csv (
112100 file_source : Union [str , os .PathLike , IO [str ], IO [bytes ], object ],
113101) -> type [BaseModel ]:
@@ -467,9 +455,6 @@ def _base_normalize(s: str) -> str:
467455 return (_base_normalize (s ), False )
468456
469457
470- import html
471-
472-
473458def pydantic_to_markdown (obj : BaseModel , title : str | None = None ) -> str :
474459 """
475460 Pretty-print a Pydantic model instance as a Markdown table,
@@ -500,10 +485,6 @@ def pydantic_to_markdown(obj: BaseModel, title: str | None = None) -> str:
500485 return "\n " .join (lines )
501486
502487
503- from pydantic import BaseModel , create_model
504- from pydantic ._internal ._model_construction import ModelMetaclass
505-
506-
507488def _check_compatibility (A , B ):
508489 """
509490 Returns True if A and B have no conflicting field annotations.
@@ -718,9 +699,6 @@ def project_as_superclass(Model: type[BaseModel], selected_fields):
718699 return Projected
719700
720701
721- from pydantic import BaseModel , create_model
722-
723-
724702def project_as_superclass (Model : type [BaseModel ], selected_fields ):
725703 if isinstance (selected_fields , str ):
726704 selected_fields = [selected_fields ]
0 commit comments