File tree 2 files changed +9
-4
lines changed
2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change 27
27
28
28
# Reassign variable to make it reexported for mypy
29
29
PYDANTIC_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
31
32
32
33
33
34
sequence_annotation_to_type = {
Original file line number Diff line number Diff line change 6
6
from pydantic .fields import FieldInfo
7
7
from typing_extensions import Annotated , deprecated
8
8
9
- from ._compat import PYDANTIC_V2 , PYDANTIC_VERSION , Undefined
9
+ from ._compat import (
10
+ PYDANTIC_V2 ,
11
+ PYDANTIC_VERSION_MINOR_TUPLE ,
12
+ Undefined ,
13
+ )
10
14
11
15
_Unset : Any = Undefined
12
16
@@ -105,7 +109,7 @@ def __init__(
105
109
stacklevel = 4 ,
106
110
)
107
111
current_json_schema_extra = json_schema_extra or extra
108
- if PYDANTIC_VERSION < "2.7.0" :
112
+ if PYDANTIC_VERSION_MINOR_TUPLE < ( 2 , 7 ) :
109
113
self .deprecated = deprecated
110
114
else :
111
115
kwargs ["deprecated" ] = deprecated
@@ -561,7 +565,7 @@ def __init__(
561
565
stacklevel = 4 ,
562
566
)
563
567
current_json_schema_extra = json_schema_extra or extra
564
- if PYDANTIC_VERSION < "2.7.0" :
568
+ if PYDANTIC_VERSION_MINOR_TUPLE < ( 2 , 7 ) :
565
569
self .deprecated = deprecated
566
570
else :
567
571
kwargs ["deprecated" ] = deprecated
You can’t perform that action at this time.
0 commit comments