@@ -151,11 +151,6 @@ def __getitem__(self, item: str) -> Any: # pragma: no cover
151151 """Get item by key."""
152152 return self .get (item ) # ty: ignore
153153
154- @classmethod
155- def parse_obj (cls , obj : Any ) -> Self :
156- """Parse object into Config model."""
157- return cls .model_validate (obj )
158-
159154 @classmethod
160155 def get_fields (cls ) -> dict [str , Any ]:
161156 """Get model fields."""
@@ -396,17 +391,15 @@ def validate_all_exports_collision_strategy(self: Self) -> Self: # ty: ignore
396391 raise Error (self .__validate_all_exports_collision_strategy_err )
397392 return self
398393
399- from pydantic import field_validator as _field_validator # noqa: PLC0415
400-
401- @_field_validator ("input_model" , mode = "before" )
394+ @field_validator ("input_model" , mode = "before" )
402395 @classmethod
403396 def coerce_input_model_to_list (cls , v : str | list [str ] | None ) -> list [str ] | None : # ty: ignore
404397 """Convert string input_model to list for backwards compatibility."""
405398 if isinstance (v , str ):
406399 return [v ]
407400 return v
408401
409- @_field_validator ("class_name_affix_scope" , mode = "before" )
402+ @field_validator ("class_name_affix_scope" , mode = "before" )
410403 @classmethod
411404 def validate_class_name_affix_scope (cls , v : str | ClassNameAffixScope | None ) -> ClassNameAffixScope : # ty: ignore
412405 """Convert string to ClassNameAffixScope enum."""
@@ -564,7 +557,7 @@ def merge_args(self, args: Namespace) -> None:
564557 if set_args .get ("use_annotated" ):
565558 set_args ["field_constraints" ] = True
566559
567- parsed_args = Config .parse_obj (set_args )
560+ parsed_args = Config .model_validate (set_args )
568561 for field_name in set_args :
569562 setattr (self , field_name , getattr (parsed_args , field_name ))
570563
@@ -1063,7 +1056,7 @@ def main(args: Sequence[str] | None = None) -> Exit: # noqa: PLR0911, PLR0912,
10631056 return Exit .OK
10641057
10651058 try :
1066- config = Config .parse_obj (pyproject_config )
1059+ config = Config .model_validate (pyproject_config )
10671060 config .merge_args (namespace )
10681061 except Error as e :
10691062 print (e .message , file = sys .stderr ) # noqa: T201
0 commit comments