File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change 2727
2828# Reassign variable to make it reexported for mypy
2929PYDANTIC_VERSION = P_VERSION
30- PYDANTIC_V2 = PYDANTIC_VERSION .startswith ("2." )
30+ PYDANTIC_VERSION_MINOR_TUPLE = tuple (int (x ) for x in PYDANTIC_VERSION .split ("." )[:2 ])
31+ PYDANTIC_V2 = PYDANTIC_VERSION_MINOR_TUPLE [0 ] == 2
3132
3233
3334sequence_annotation_to_type = {
Original file line number Diff line number Diff line change 66from pydantic .fields import FieldInfo
77from typing_extensions import Annotated , deprecated
88
9- from ._compat import PYDANTIC_V2 , PYDANTIC_VERSION , Undefined
9+ from ._compat import (
10+ PYDANTIC_V2 ,
11+ PYDANTIC_VERSION_MINOR_TUPLE ,
12+ Undefined ,
13+ )
1014
1115_Unset : Any = Undefined
1216
@@ -105,7 +109,7 @@ def __init__(
105109 stacklevel = 4 ,
106110 )
107111 current_json_schema_extra = json_schema_extra or extra
108- if PYDANTIC_VERSION < "2.7.0" :
112+ if PYDANTIC_VERSION_MINOR_TUPLE < ( 2 , 7 ) :
109113 self .deprecated = deprecated
110114 else :
111115 kwargs ["deprecated" ] = deprecated
@@ -561,7 +565,7 @@ def __init__(
561565 stacklevel = 4 ,
562566 )
563567 current_json_schema_extra = json_schema_extra or extra
564- if PYDANTIC_VERSION < "2.7.0" :
568+ if PYDANTIC_VERSION_MINOR_TUPLE < ( 2 , 7 ) :
565569 self .deprecated = deprecated
566570 else :
567571 kwargs ["deprecated" ] = deprecated
You can’t perform that action at this time.
0 commit comments