+
    7*iכ c                  s  a  0 t $ R t^ RIHt ^ RIt^ RIt^ RIt^ RI	H
t
Ht ^ RIHtHt ^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ R	IHt ^ R
IHtHtHtHtHtHtHtHtH t H!t! ^ RI"H#t# ^ RI$t$^ RI$H%t%H&t&H't' ^ RI(H)t)H*t*H+t+H,t, ^ RI-H.t.H/t/H0t0H1t1H2t2H3t3 ^ RI4H5t5 ^RI6H7t7H8t8H9t9H:t: ^RI;H<t< ^RI=H>t>H?t? ^RI@HAtA ^RIBHCtC ^RIDHEtE ]'       d   ^RIFHGtG RtH]! R04      tI]P                   ! R1 R]7P                  ]%4      4       tL]]M]L! 4       3,          tN R2RR3RR4RR5RR6RR7R/R8 R9 lltO]]P]$P                  ! ^ 4      3,          tR ]]P]$P                  ! ^ 4      3,          tT ]]P]$P                  ! ^ 4      3,          tV ]]P]$P                  ! ^ 4      3,          tX ]]P]L! 4       3,          tY ]P                   ! R: R%]7P                  4      4       tZR2RR3RR4RR5RR6RR7RR;R/R< R= llt[]]\]$P                  ! ^ 4      3,          t] ]]\]$P                  ! ^ 4      3,          t^ ]]\]$P                  ! ^ 4      3,          t_ ]]\]$P                  ! ^ 4      3,          t` ]]\]L! R>4      3,          ta ]]\]Z! R?4      3,          tb R@RRARR2R/RB RC lltc]]d]L! 4       3,          te ]P                  ! R>RD7       ! RE R+]$P                  4      4       tgRFRRGRRHRR2RR@RRARRIR/RJ RK llth]]i]L! 4       3,          tj ]! RL]
RM7      tkR@RRAR/RN RO lltlR@RRAR/RP RQ lltm]! RR4      tnR@RRARRSR/RT RU llto]! RV4      tp]'       d   ]]pRW3,          tqM
 ! RX R4      tqR2RR3RR4RR5RR6RR7RRYRRZRR;R/	R[ R\ lltr]P                  ! R/ ]8P                  B  ! R] R^4      4       tt]]#]t! ^4      3,          tu ]]#]t! ^4      3,          tv ]]#]t! ^4      3,          tw ]]#]t! ^4      3,          tx ]]#]t! ^4      3,          ty ]]#]t! ^4      3,          tz ]]#]t! ^4      3,          t{ ]P                   ! R_ R`4      4       t|]]]|! Ra4      3,          t} ]]]|! Rb4      3,          t~ ]]]|! Rc4      3,          t ]]]|! Rd4      3,          t ]'       d   ]]pRW3,          tM
 ! Re R4      t]! RfR>Rg7      t ! Rh Ri]],          4      tRj Rk lt ! Rl R]],          4      tRm Rn ltRo Rp lt ! Rq Rr]],          4      t ! Rs R]]i,          4      t ! Rt R]]d,          4      t ! Ru Rv]i]4      t]1! Rw]ERx7       ! Ry R]i4      4       t ! Rz R]P4      tR{ R| lt]'       d   ]]RW3,          t]]RW3,          tM ! R} R4      t ! R~ R 4      tR2RR3RR4RR5RR6R/R R llt]'       d.   ]]RW3,          t]]RW3,          t]]RW3,          t]]RW3,          tM( ! R R#4      t ! R R$4      t ! R R!4      t ! R R"4      t ! R R&].4      t ! R R)]4      t ! R R]4      t]P                  ! R/ ]8P                  B  ! R R'4      4       t]P                  ! R/ ]8P                  B  ! R R(4      4       t]]d]! ]R7      3,          t ]]i]! ]R7      3,          t ]]d]! ]R7      3,          t ]]i]! ]R7      3,          t ]<! ]4      t]P                  ! R/ ]8P                  B  ! R R*4      4       t]P                  ! R/ ]8P                  BRR>/B  ! R R,4      4       t]P                  ! R/ ]8P                  BRR>/B  ! R R-4      4       t]P]\]i]M]]]! R4      0tR R lt ! R R4      t]'       d'   ] ]R.,          ]]iR.3,          ]i]M]P]\R3,          tR]R.&   M]0! R.]] ]]R.,          ]! R4      3,          ]]]iR.3,          ]! R4      3,          ]]i]! R4      3,          ]]M]! R4      3,          ]]P]! R4      3,          ]]\]! R4      3,          ]R]! R4      3,          3,          ]! ]RRR7      ]3,          4      t ! R R4      t]]I]3,          t ]P                   ! R R/]7P                  ]%4      4       tR# )z8The types module contains custom types used by pydantic.)annotationsN)HashableIterator)datedatetime)Decimal)Enum)Path)Pattern)
ModuleType)
TYPE_CHECKING	AnnotatedAnyCallableClassVarGenericLiteralTypeVarUnioncast)UUID)BaseMetadataMaxLenMinLen)
CoreSchemaPydanticCustomErrorSchemaSerializercore_schema)Protocol	TypeAliasTypeAliasType
deprecatedget_args
get_origin)is_union_origin)_fields_internal_dataclass_utils_validators)getattr_migration)GetCoreSchemaHandlerGetJsonSchemaHandlerPydanticUserError)JsonSchemaValue)PydanticDeprecatedSince20)CoreMetadataStrictImportStringJsonSecret	SecretStrSecretBytesPaymentCardNumberByteSizePastDate
FutureDatePastDatetimeFutureDatetimeAwareDatetimeNaiveDatetimeAllowInfNanEncoderProtocolEncodedBytes
EncodedStrBase64EncoderGetPydanticSchemaStringConstraintsTagDiscriminator	JsonValueFailFastTc                  s6    ] tR t^tt$ RtRtR]R&   R R ltRtR# )	r/   a?  !!! abstract "Usage Documentation"
    [Strict Mode with `Annotated` `Strict`](../concepts/strict_mode.md#strict-mode-with-annotated-strict)

A field metadata class to indicate that a field should be validated in strict mode.
Use this class as an annotation via [`Annotated`](https://docs.python.org/3/library/typing.html#typing.Annotated), as seen below.

Attributes:
    strict: Whether to validate the field in strict mode.

Example:
    ```python
    from typing import Annotated

    from pydantic.types import Strict

    StrictBool = Annotated[bool, Strict()]
    ```
Tboolstrictc                   V ^8  d   QhRR/#    returnint format   "3/usr/lib/python3.14/site-packages/pydantic/types.py__annotate__ZStrict.__annotate__   s     ! !# !    c                	,    \        V P                  4      # N)hashrJ   self   &rT   __hash__ZStrict.__hash__   s    DKK  rV   rP   N)	__name__
__module____qualname____firstlineno____doc__rJ   __annotations__r]   __static_attributes__rP   rV   rT   r/   r/   t   s    & FD! !rV   rJ   gtgeltlemultiple_ofc               s4    V ^8  d   QhRRRRRRRRRRRRR	R
/# )rM   rJ   bool | Nonere   
int | Nonerf   rg   rh   ri   rN   z	type[int]rP   rQ   rS   rT   rU   rU      sY     T TT 	T 		T
 	T 	T T TrV   c           
     s    \         \        V e   \        V 4      MR\        P                  ! WW4R7      Ve   \        P
                  ! V4      3,          # R3,          # )aY  
!!! warning "Discouraged"
    This function is **discouraged** in favor of using
    [`Annotated`](https://docs.python.org/3/library/typing.html#typing.Annotated) with
    [`Field`][pydantic.fields.Field] instead.

    This function will be **deprecated** in Pydantic 3.0.

    The reason is that `conint` returns a type, which doesn't play well with static analysis tools.

    === ":x: Don't do this"
        ```python
        from pydantic import BaseModel, conint

        class Foo(BaseModel):
            bar: conint(strict=True, gt=0)
        ```

    === ":white_check_mark: Do this"
        ```python
        from typing import Annotated

        from pydantic import BaseModel, Field

        class Foo(BaseModel):
            bar: Annotated[int, Field(strict=True, gt=0)]
        ```

A wrapper around `int` that allows for additional constraints.

Args:
    strict: Whether to validate the integer in strict mode. Defaults to `None`.
    gt: The value must be greater than this.
    ge: The value must be greater than or equal to this.
    lt: The value must be less than this.
    le: The value must be less than or equal to this.
    multiple_of: The value must be a multiple of this.

Returns:
    The wrapped integer type.

```python
from pydantic import BaseModel, ValidationError, conint

class ConstrainedExample(BaseModel):
    constrained_int: conint(gt=1)

m = ConstrainedExample(constrained_int=2)
print(repr(m))
#> ConstrainedExample(constrained_int=2)

try:
    ConstrainedExample(constrained_int=0)
except ValidationError as e:
    print(e.errors())
    '''
    [
        {
            'type': 'greater_than',
            'loc': ('constrained_int',),
            'msg': 'Input should be greater than 1',
            'input': 0,
            'ctx': {'gt': 1},
            'url': 'https://errors.pydantic.dev/2/v/greater_than',
        }
    ]
    '''
```

Nre   rf   rg   rh   )r   rO   r/   annotated_typesInterval
MultipleOf)rJ   re   rf   rg   rh   ri   s   $$$$$$rT   conintrp      sc    ^  ,v$  B"<3>3J"";/	V  QU	V rV   c                  s6    ] tR tRt$ RtRtR]R&   R R ltRtR	# )
r=   i  a  A field metadata class to indicate that a field should allow `-inf`, `inf`, and `nan`.

Use this class as an annotation via [`Annotated`](https://docs.python.org/3/library/typing.html#typing.Annotated), as seen below.

Attributes:
    allow_inf_nan: Whether to allow `-inf`, `inf`, and `nan`. Defaults to `True`.

Example:
    ```python
    from typing import Annotated

    from pydantic.types import AllowInfNan

    LaxFloat = Annotated[float, AllowInfNan()]
    ```
TrI   allow_inf_nanc               rK   rL   rP   rQ   rS   rT   rU   ZAllowInfNan.__annotate__  s     ( (# (rV   c                	rW   rX   )rY   rq   rZ   r\   rT   r]   ZAllowInfNan.__hash__  s    D&&''rV   rP   N)	r^   r_   r`   ra   rb   rq   rc   r]   rd   rP   rV   rT   r=   r=     s    " M4( (rV   rq   c               s8    V ^8  d   QhRRRRRRRRRRRRR	RR
R/# )rM   rJ   rj   re   zfloat | Nonerf   rg   rh   ri   rq   rN   ztype[float]rP   rQ   rS   rT   rU   rU     sd     V VV 	V 		V
 	V 	V V V VrV   c           
     s    \         \        V e   \        V 4      MR\        P                  ! WW4R7      Ve   \        P
                  ! V4      MRVe   \        V4      3,          # R3,          # )a  
!!! warning "Discouraged"
    This function is **discouraged** in favor of using
    [`Annotated`](https://docs.python.org/3/library/typing.html#typing.Annotated) with
    [`Field`][pydantic.fields.Field] instead.

    This function will be **deprecated** in Pydantic 3.0.

    The reason is that `confloat` returns a type, which doesn't play well with static analysis tools.

    === ":x: Don't do this"
        ```python
        from pydantic import BaseModel, confloat

        class Foo(BaseModel):
            bar: confloat(strict=True, gt=0)
        ```

    === ":white_check_mark: Do this"
        ```python
        from typing import Annotated

        from pydantic import BaseModel, Field

        class Foo(BaseModel):
            bar: Annotated[float, Field(strict=True, gt=0)]
        ```

A wrapper around `float` that allows for additional constraints.

Args:
    strict: Whether to validate the float in strict mode.
    gt: The value must be greater than this.
    ge: The value must be greater than or equal to this.
    lt: The value must be less than this.
    le: The value must be less than or equal to this.
    multiple_of: The value must be a multiple of this.
    allow_inf_nan: Whether to allow `-inf`, `inf`, and `nan`.

Returns:
    The wrapped float type.

```python
from pydantic import BaseModel, ValidationError, confloat

class ConstrainedExample(BaseModel):
    constrained_float: confloat(gt=1.0)

m = ConstrainedExample(constrained_float=1.1)
print(repr(m))
#> ConstrainedExample(constrained_float=1.1)

try:
    ConstrainedExample(constrained_float=0.9)
except ValidationError as e:
    print(e.errors())
    '''
    [
        {
            'type': 'greater_than',
            'loc': ('constrained_float',),
            'msg': 'Input should be greater than 1',
            'input': 0.9,
            'ctx': {'gt': 1.0},
            'url': 'https://errors.pydantic.dev/2/v/greater_than',
        }
    ]
    '''
```
Nrl   )r   floatr/   rm   rn   ro   r=   )rJ   re   rf   rg   rh   ri   rq      $$$$$$$rT   confloatrt     ss    `  ,v$  B"<3>3J"";/PT&3&?M"		K 
 FJ		K rV   TF
min_length
max_lengthc               s(    V ^8  d   QhRRRRRRRR/# )rM   ru   rk   rv   rJ   rj   rN   ztype[bytes]rP   rQ   rS   rT   rU   rU     s2        	
 rV   c                s    \         \        Ve   \        V4      MR\        P                  ! T ;'       g    ^ V4      3,          # )a
  A wrapper around `bytes` that allows for additional constraints.

Args:
    min_length: The minimum length of the bytes.
    max_length: The maximum length of the bytes.
    strict: Whether to validate the bytes in strict mode.

Returns:
    The wrapped bytes type.
N)r   bytesr/   rm   Len)ru   rv   rJ   s   $$$rT   conbytesry     s=       ,v$JOO!Z8	: rV   )frozenc                  s    ] tR tRt$ RtRtR]R&   RtR]R&   RtR]R&   Rt	R]R&   Rt
R	]R
&   RtR	]R&   RtR]R&   R R ltRtR# )rC   i  a  !!! abstract "Usage Documentation"
    [String types](./standard_library_types.md#strings)

A field metadata class to apply constraints to `str` types.
Use this class as an annotation via [`Annotated`](https://docs.python.org/3/library/typing.html#typing.Annotated), as seen below.

Attributes:
    strip_whitespace: Whether to remove leading and trailing whitespace.
    to_upper: Whether to convert the string to uppercase.
    to_lower: Whether to convert the string to lowercase.
    strict: Whether to validate the string in strict mode.
    min_length: The minimum length of the string.
    max_length: The maximum length of the string.
    pattern: A regex pattern that the string must match.

Example:
    ```python
    from typing import Annotated

    from pydantic.types import StringConstraints

    ConstrainedStr = Annotated[str, StringConstraints(min_length=1, max_length=10)]
    ```
Nrj   strip_whitespaceto_upperto_lowerrJ   rk   ru   rv   str | Pattern[str] | Nonepatternc               rK   )rM   rN   zIterator[BaseMetadata]rP   rQ   rS   rT   rU   ZStringConstraints.__annotate__  s      0 rV   c              #  	s  "   V P                   e   \        V P                   4      x  V P                  e   \        V P                  4      x  V P                  e   \        V P                  4      x  V P                  f+   V P                  f   V P                  f   V P                  eG   \        P                  ! V P                  V P                  V P                  V P                  R7      x  R # R # 5i)N)r{   r|   r}   r   )ru   r   rv   r   rJ   r/   r{   r   r}   r|   r#   pydantic_general_metadatarZ   r\   rT   __iter__ZStringConstraints.__iter__  s     ??&))??&));;"%%!!-||'}}(}}(33!%!6!6	  )s   C0C2rP   )r^   r_   r`   ra   rb   r{   rc   r|   r}   rJ   ru   rv   r   r   rd   rP   rV   rT   rC   rC     s[    2 %)k( Hk  Hk FK!J
!!J
!)-G&- rV   r{   r|   r}   r   c               s8    V ^8  d   QhRRRRRRRRRRRRR	R
RR/# )rM   r{   rj   r|   r}   rJ   ru   rk   rv   r   r~   rN   z	type[str]rP   rQ   rS   rT   rU   rU     sd     O O!O O 	O
 O O O 'O OrV   c                sH    \         \        \        V VVVVVVR7      3,          # )a  
!!! warning "Discouraged"
    This function is **discouraged** in favor of using
    [`Annotated`](https://docs.python.org/3/library/typing.html#typing.Annotated) with
    [`StringConstraints`][pydantic.types.StringConstraints] instead.

    This function will be **deprecated** in Pydantic 3.0.

    The reason is that `constr` returns a type, which doesn't play well with static analysis tools.

    === ":x: Don't do this"
        ```python
        from pydantic import BaseModel, constr

        class Foo(BaseModel):
            bar: constr(strip_whitespace=True, to_upper=True, pattern=r'^[A-Z]+$')
        ```

    === ":white_check_mark: Do this"
        ```python
        from typing import Annotated

        from pydantic import BaseModel, StringConstraints

        class Foo(BaseModel):
            bar: Annotated[
                str,
                StringConstraints(
                    strip_whitespace=True, to_upper=True, pattern=r'^[A-Z]+$'
                ),
            ]
        ```

A wrapper around `str` that allows for additional constraints.

```python
from pydantic import BaseModel, constr

class Foo(BaseModel):
    bar: constr(strip_whitespace=True, to_upper=True)

foo = Foo(bar='  hello  ')
print(foo)
#> bar='HELLO'
```

Args:
    strip_whitespace: Whether to remove leading and trailing whitespace.
    to_upper: Whether to turn all characters to uppercase.
    to_lower: Whether to turn all characters to lowercase.
    strict: Whether to validate the string in strict mode.
    min_length: The minimum length of the string.
    max_length: The maximum length of the string.
    pattern: A regex pattern to validate the string against.

Returns:
    The wrapped string type.
r{   r|   r}   rJ   ru   rv   r   )r   strrC   r   rs   rT   constrr     s7    H -!!	
		 rV   HashableItemType)Zboundc               (    V ^8  d   QhRRRRRRRR/# )rM   	item_typetype[HashableItemType]ru   rk   rv   rN   ztype[set[HashableItemType]]rP   rQ   rS   rT   rU   rU   G  s2     W W%W6@WU_W WrV   c               t    \         \        V ,          \        P                  ! T;'       g    ^ V4      3,          # )a   A wrapper around `typing.Set` that allows for additional constraints.

Args:
    item_type: The type of the items in the set.
    min_length: The minimum length of the set.
    max_length: The maximum length of the set.

Returns:
    The wrapped set type.
)r   Zsetrm   rx   r   ru   rv      &$$rT   consetr   G  s+     S^_%8%8q*%UUVVrV   c               r   )rM   r   r   ru   rk   rv   rN   z!type[frozenset[HashableItemType]]rP   rQ   rS   rT   rU   rU   W  s2     ] ]%]6@]U_]&]rV   c               r   )a  A wrapper around `typing.FrozenSet` that allows for additional constraints.

Args:
    item_type: The type of the items in the frozenset.
    min_length: The minimum length of the frozenset.
    max_length: The maximum length of the frozenset.

Returns:
    The wrapped frozenset type.
)r   Z	frozensetrm   rx   r   r   rT   confrozensetr   W  s-     Yy)?+>+>zQPZ+[[\\rV   AnyItemTypeunique_itemsc          
     s,    V ^8  d   QhRRRRRRRRRR	/# )
rM   r   ztype[AnyItemType]ru   rk   rv   r   rj   rN   ztype[list[AnyItemType]]rP   rQ   rS   rT   rU   rU   j  sC     X X X X 	X
 X XrV   c               s    Ve   \        RRR7      h\        \        V ,          \        P                  ! T;'       g    ^ V4      3,          # )a5  A wrapper around [`list`][] that adds validation.

Args:
    item_type: The type of the items in the list.
    min_length: The minimum length of the list. Defaults to None.
    max_length: The maximum length of the list. Defaults to None.
    unique_items: Whether the items in the list must be unique. Defaults to None.
        !!! warning Deprecated
            The `unique_items` parameter is deprecated, use `Set` instead.
            See [this issue](https://github.com/pydantic/pydantic-core/issues/296) for more details.

Returns:
    The wrapped list type.
z`unique_items` is removed, use `Set` instead(this feature is discussed in https://github.com/pydantic/pydantic-core/issues/296)zremoved-kwargsZcode)r+   r   listrm   rx   )r   ru   rv   r   s   &$$$rT   conlistr   j  sK    * f "
 	
 T)_o&9&9*//:&VVWWrV   AnyType.c                  s~    ] tR tRtRt]R R l4       t]R R l4       t]R R l4       t]	R	 R
 l4       t
R R ltRtR# )r0   i  a	  A type that can be used to import a Python object from a string.

`ImportString` expects a string and loads the Python object importable at that dotted path.
Attributes of modules may be separated from the module by `:` or `.`, e.g. if `'math:cos'` is provided,
the resulting field value would be the function `cos`. If a `.` is used and both an attribute and submodule
are present at the same path, the module will be preferred.

On model instantiation, pointers will be evaluated and imported. There is
some nuance to this behavior, demonstrated in the examples below.

```python
import math

from pydantic import BaseModel, Field, ImportString, ValidationError

class ImportThings(BaseModel):
    obj: ImportString

# A string value will cause an automatic import
my_cos = ImportThings(obj='math.cos')

# You can use the imported function as you would expect
cos_of_0 = my_cos.obj(0)
assert cos_of_0 == 1

# A string whose value cannot be imported will raise an error
try:
    ImportThings(obj='foo.bar')
except ValidationError as e:
    print(e)
    '''
    1 validation error for ImportThings
    obj
      Invalid python path: No module named 'foo.bar' [type=import_error, input_value='foo.bar', input_type=str]
    '''

# Actual python objects can be assigned as well
my_cos = ImportThings(obj=math.cos)
my_cos_2 = ImportThings(obj='math.cos')
my_cos_3 = ImportThings(obj='math:cos')
assert my_cos == my_cos_2 == my_cos_3

# You can set default field value either as Python object:
class ImportThingsDefaultPyObj(BaseModel):
    obj: ImportString = math.cos

# or as a string value (but only if used with `validate_default=True`)
class ImportThingsDefaultString(BaseModel):
    obj: ImportString = Field(default='math.cos', validate_default=True)

my_cos_default1 = ImportThingsDefaultPyObj()
my_cos_default2 = ImportThingsDefaultString()
assert my_cos_default1.obj == my_cos_default2.obj == math.cos

# note: this will not work!
class ImportThingsMissingValidateDefault(BaseModel):
    obj: ImportString = 'math.cos'

my_cos_default3 = ImportThingsMissingValidateDefault()
assert my_cos_default3.obj == 'math.cos'  # just string, not evaluated
```

Serializing an `ImportString` type to json is also possible.

```python
from pydantic import BaseModel, ImportString

class ImportThings(BaseModel):
    obj: ImportString

# Create an instance
m = ImportThings(obj='math.cos')
print(m)
#> obj=<built-in function cos>
print(m.model_dump_json())
#> {"obj":"math.cos"}
```
c                    V ^8  d   QhRRRR/# rM   itemr   rN   rP   rQ   rS   rT   rU   ImportString.__annotate__       	* 	* 	*W 	*rV   c                	(    \         W! 4       3,          # rX   r   clsr      &&rT   __class_getitem__ZImportString.__class_getitem__      T35[))rV   c               $    V ^8  d   QhRRRRRR/# rM   sourcez	type[Any]handlerr(   rN   core_schema.CoreSchemarP   rQ   rS   rT   rU   r     s$     	 	"	-A	#	rV   c                	s    \         P                  ! V P                  R R7      pWJ d'   \         P                  ! \        P
                  VR7      # \         P                  ! \        P
                  V! V4      VR7      # )json)	when_used)functionserializationr   schemar   )r   $plain_serializer_function_ser_schema
_serializeZ no_info_plain_validator_functionr&   Zimport_stringZ!no_info_before_validator_function)r   r   r   Z
serializer   &&& rT   __get_pydantic_core_schema__Z)ImportString.__get_pydantic_core_schema__  se     %II#..djkJ}"CC(66j  #DD(66wv^h rV   c               r   )rM   csr   r   r)   rN   r,   rP   rQ   rS   rT   rU   r     s#     	5 	5* 	5G[ 	5`o 	5rV   c                	s8    V! \         P                  ! 4       4      # rX   )r   
str_schema)r   r   r      &&&rT   __get_pydantic_json_schema__Z)ImportString.__get_pydantic_json_schema__  s    ;11344rV   c                    V ^8  d   QhRRRR/# )rM   vr   rN   r   rP   rQ   rS   rT   rU   r     s     	 	# 	# 	rV   c                	s^   \        V \        4      '       d   V P                  # \        V R 4      '       d.   \        V R4      '       d   V P                   RV P                   2# \        V R4      '       d:   V P
                  R8X  d   R# V P
                  R8X  d   R# V P
                  R8X  d   R	# V # )
r_   r^   Z.namez<stdout>z
sys.stdoutz<stdin>z	sys.stdinz<stderr>z
sys.stderr)
isinstancer	   r^   Zhasattrr_   r   )r   r\   rT   r   ZImportString._serialize  s    !Z((zz!L))ga.D.D,,q55 F##66Z''VVy(&VVz)'HrV   c               rK   rM   rN   r   rP   rQ   rS   rT   rU   r   	       	" 	"c 	"rV   c                	    R # )r0   rP   rZ   r\   rT   __repr__ZImportString.__repr__	      !rV   rP   N)r^   r_   r`   ra   rb   classmethodr   r   r   staticmethodr   r   rd   rP   rV   rT   r0   r0     sc    M	^ 
	* 
	* 
	 
	 
	5 
	5 
	 
	 	" 	"rV   
max_digitsdecimal_placesc               s@    V ^8  d   QhRRRRRRRRRRRRR	R
RR
RRRR/
# )rM   rJ   rj   re   zint | Decimal | Nonerf   rg   rh   ri   r   rk   r   rq   rN   ztype[Decimal]rP   rQ   rS   rT   rU   rU     sz     [ [[ 	[ 		[
 	[ 	[ &[ [ [ [ [rV   c        	   
     s   \         \        V e   \        V 4      MR\        P                  ! WW4R7      Ve   \        P
                  ! V4      MR\        P                  ! WgR7      Ve   \        V4      3,          # R3,          # )a-	  
!!! warning "Discouraged"
    This function is **discouraged** in favor of using
    [`Annotated`](https://docs.python.org/3/library/typing.html#typing.Annotated) with
    [`Field`][pydantic.fields.Field] instead.

    This function will be **deprecated** in Pydantic 3.0.

    The reason is that `condecimal` returns a type, which doesn't play well with static analysis tools.

    === ":x: Don't do this"
        ```python
        from pydantic import BaseModel, condecimal

        class Foo(BaseModel):
            bar: condecimal(strict=True, allow_inf_nan=True)
        ```

    === ":white_check_mark: Do this"
        ```python
        from decimal import Decimal
        from typing import Annotated

        from pydantic import BaseModel, Field

        class Foo(BaseModel):
            bar: Annotated[Decimal, Field(strict=True, allow_inf_nan=True)]
        ```

A wrapper around Decimal that adds validation.

Args:
    strict: Whether to validate the value in strict mode. Defaults to `None`.
    gt: The value must be greater than this. Defaults to `None`.
    ge: The value must be greater than or equal to this. Defaults to `None`.
    lt: The value must be less than this. Defaults to `None`.
    le: The value must be less than or equal to this. Defaults to `None`.
    multiple_of: The value must be a multiple of this. Defaults to `None`.
    max_digits: The maximum number of digits. Defaults to `None`.
    decimal_places: The number of decimal places. Defaults to `None`.
    allow_inf_nan: Whether to allow infinity and NaN. Defaults to `None`.

```python
from decimal import Decimal

from pydantic import BaseModel, ValidationError, condecimal

class ConstrainedExample(BaseModel):
    constrained_decimal: condecimal(gt=Decimal('1.0'))

m = ConstrainedExample(constrained_decimal=Decimal('1.1'))
print(repr(m))
#> ConstrainedExample(constrained_decimal=Decimal('1.1'))

try:
    ConstrainedExample(constrained_decimal=Decimal('0.9'))
except ValidationError as e:
    print(e.errors())
    '''
    [
        {
            'type': 'greater_than',
            'loc': ('constrained_decimal',),
            'msg': 'Input should be greater than 1.0',
            'input': Decimal('0.9'),
            'ctx': {'gt': Decimal('1.0')},
            'url': 'https://errors.pydantic.dev/2/v/greater_than',
        }
    ]
    '''
```
Nrl   )r   r   )	r   r   r/   rm   rn   ro   r#   r   r=   )	rJ   re   rf   rg   rh   ri   r   r   rq   s	   $$$$$$$$$rT   
condecimalr     s    h  ,v$  B"<3>3J"";/PT))Z_&3&?M"	K  FJ	K rV   c                  sJ    ] tR tRt$ RtR]R&   R R ltR R ltR	 R
 ltRt	R# )UuidVersioniq  a  A field metadata class to indicate a [UUID](https://docs.python.org/3/library/uuid.html) version.

Use this class as an annotation via [`Annotated`](https://docs.python.org/3/library/typing.html#typing.Annotated), as seen below.

Attributes:
    uuid_version: The version of the UUID. Must be one of 1, 3, 4, 5, 6, 7 or 8.

Example:
    ```python
    from typing import Annotated
    from uuid import UUID

    from pydantic.types import UuidVersion

    UUID1 = Annotated[UUID, UuidVersion(1)]
    ```
zLiteral[1, 3, 4, 5, 6, 7, 8]uuid_versionc               r   rM   r   r   r   r)   rN   r,   rP   rQ   rS   rT   rU   UuidVersion.__annotate__  $      1<P	rV   c                	sz    V! V4      pVP                  R R4       VP                  RRV P                   2R7       V# )ZanyOfNstringuuidtyperR   )Zpopupdater   r[   r   r   field_schemar   rT   r   Z(UuidVersion.__get_pydantic_json_schema__  sE     {+$'D9J9J8K2LMrV   c               r   rM   r   r   r   r(   rN   r   rP   rQ   rS   rT   rU   r     s#      3 AU Zp rV   c                	s    V! V4      p\        VR ,          RV P                  P                  4       V P                  VR&   V# )r   r   Zversion)_check_annotated_type	__class__r^   r   r[   r   r   r   r   rT   r   Z(UuidVersion.__get_pydantic_core_schema__  s:    fVnfdnn6M6MN --yrV   c               rK   rL   rP   rQ   rS   rT   rU   r          - -# -rV   c                	>    \        \        V P                  4      4      # rX   )rY   r   r   rZ   r\   rT   r]   ZUuidVersion.__hash__  s    D**+,,rV   rP   N)
r^   r_   r`   ra   rb   rc   r   r   r]   rd   rP   rV   rT   r   r   q  s#    $ /.- -rV   r   c                  s    ] tR tRt$ R]R&   R R ltR R lt]R R	 l4       t]R
 R l4       t	]R R l4       t
]R R l4       tR R ltRtR# )PathTypei  z'Literal['file', 'dir', 'new', 'socket']	path_typec               r   r   rP   rQ   rS   rT   rU   PathType.__annotate__  r   rV   c                	s|    V! V4      pR RRR/pVP                  VP                  V P                  R4      RR7       V# )filez	file-pathdirzdirectory-pathpathr   )rR   r   )r   getr   )r[   r   r   r   Zformat_conversion   &&&  rT   r   Z%PathType.__get_pydantic_json_schema__  sJ     {+#[%9IJ#4#8#8#PW_`rV   c               r   r   rP   rQ   rS   rT   rU   r     s#     
 
3 
AU 
Zp 
rV   c                	s   R \        \        P                  V P                  4      R\        \        P                  V P                  4      R\        \        P                  V P
                  4      R\        \        P                  V P                  4      /p\        P                  ! W0P                  ,          V! V4      4      # )r   r   newsocket)	r   r   ZWithInfoValidatorFunctionvalidate_filevalidate_directoryvalidate_newvalidate_socket"with_info_after_validator_functionr   )r[   r   r   Zfunction_lookupr   rT   r   Z%PathType.__get_pydantic_core_schema__  s    D>>@R@RS4==t?V?VW4==t?P?PQd;@@$BVBVW	
 ==NN+FO
 	
rV   c               $    V ^8  d   QhRRRRRR/# rM   r   r   _core_schema.ValidationInforN   rP   rQ   rS   rT   rU   r     s'     X XD X%? XD XrV   c                	J    V P                  4       '       d   V # \        R R4      h)Zpath_not_filezPath does not point to a file)Zis_filer   r   r   r   rT   r   ZPathType.validate_file  s     <<>>K%o7VWWrV   c               r   r   rP   rQ   rS   rT   rU   r      s'     \ \d \'A \d \rV   c                	r   )Zpath_not_socketzPath does not point to a socket)Z	is_socketr   r   r   rT   r   ZPathType.validate_socket  s#    >>K%&79Z[[rV   c               r   r   rP   rQ   rS   rT   rU   r   '  s'     b b b*D b brV   c                	r   )Zpath_not_directoryz"Path does not point to a directory)Zis_dirr   r   r   rT   r   ZPathType.validate_directory&  s!    ;;==K%&:<`aarV   c               r   r   rP   rQ   rS   rT   rU   r   .  s"      4 $> 4 rV   c                	s    V P                  4       '       d   \        R R4      hV P                  P                  4       '       g   \        RR4      hV # )Zpath_existszPath already existsZparent_does_not_existzParent directory does not exist)Zexistsr   Zparentr   r   rT   r   ZPathType.validate_new-  sB    ;;==%m5JKK##%%%&=?`aaKrV   c               rK   rL   rP   rQ   rS   rT   rU   r   6  s     * *# *rV   c                	r   rX   )rY   r   r   rZ   r\   rT   r]   ZPathType.__hash__6  s    D())rV   rP   N)r^   r_   r`   ra   rc   r   r   r   r   r   r   r   r]   rd   rP   rV   rT   r   r     sr    66
 X X \ \ b b  * *rV   r   r   r   r   r   c                  sj    ] tR tRtRt]R R l4       t]R R l4       tR R ltR	 R
 lt	R R lt
RtR# )r1   i  aA  A special type wrapper which loads JSON before parsing.

You can use the `Json` data type to make Pydantic first load a raw JSON string before
validating the loaded data into the parametrized type:

```python
from typing import Any

from pydantic import BaseModel, Json, ValidationError

class AnyJsonModel(BaseModel):
    json_obj: Json[Any]

class ConstrainedJsonModel(BaseModel):
    json_obj: Json[list[int]]

print(AnyJsonModel(json_obj='{"b": 1}'))
#> json_obj={'b': 1}
print(ConstrainedJsonModel(json_obj='[1, 2, 3]'))
#> json_obj=[1, 2, 3]

try:
    ConstrainedJsonModel(json_obj=12)
except ValidationError as e:
    print(e)
    '''
    1 validation error for ConstrainedJsonModel
    json_obj
      JSON input should be string, bytes or bytearray [type=json_type, input_value=12, input_type=int]
    '''

try:
    ConstrainedJsonModel(json_obj='[a, b]')
except ValidationError as e:
    print(e)
    '''
    1 validation error for ConstrainedJsonModel
    json_obj
      Invalid JSON: expected value at line 1 column 2 [type=json_invalid, input_value='[a, b]', input_type=str]
    '''

try:
    ConstrainedJsonModel(json_obj='["a", "b"]')
except ValidationError as e:
    print(e)
    '''
    2 validation errors for ConstrainedJsonModel
    json_obj.0
      Input should be a valid integer, unable to parse string as an integer [type=int_parsing, input_value='a', input_type=str]
    json_obj.1
      Input should be a valid integer, unable to parse string as an integer [type=int_parsing, input_value='b', input_type=str]
    '''
```

When you dump the model using `model_dump` or `model_dump_json`, the dumped value will be the result of validation,
not the original JSON string. However, you can use the argument `round_trip=True` to get the original JSON string back:

```python
from pydantic import BaseModel, Json

class ConstrainedJsonModel(BaseModel):
    json_obj: Json[list[int]]

print(ConstrainedJsonModel(json_obj='[1, 2, 3]').model_dump_json())
#> {"json_obj":[1,2,3]}
print(
    ConstrainedJsonModel(json_obj='[1, 2, 3]').model_dump_json(round_trip=True)
)
#> {"json_obj":"[1,2,3]"}
```
c               r   r   rP   rQ   rS   rT   rU   Json.__annotate__  r   rV   c                	r   rX   r   r   r   rT   r   ZJson.__class_getitem__  r   rV   c               r   r   rP   rQ   rS   rT   rU   r     s(     	@ 	@c 	@DX 	@]s 	@rV   c                	sp    WJ d   \         P                  ! R 4      # \         P                  ! V! V4      4      # rX   )r   json_schemar   r   r   r   rT   r   Z!Json.__get_pydantic_core_schema__  s-    }"..t44"..wv??rV   c               rK   r   rP   rQ   rS   rT   rU   r     s     	 	c 	rV   c                	r   )r1   rP   rZ   r\   rT   r   ZJson.__repr__  s    rV   c               rK   rL   rP   rQ   rS   rT   rU   r          	$ 	$c 	$rV   c                	s*    \        \        V 4      4      # rX   )rY   r   rZ   r\   rT   r]   ZJson.__hash__  s    T
##rV   c               r   rM   otherr   rN   rI   rP   rQ   rS   rT   rU   r     s     	- 	- 	- 	-rV   c                	s.    \        V4      \        V 4      J # rX   )r   r[   r   r   rT   __eq__ZJson.__eq__  s    ;$t*,,rV   rP   N)r^   r_   r`   ra   rb   r   r   r   r   r]   r   rd   rP   rV   rT   r1   r1     sG    F	P 
	* 
	* 
	@ 
	@		$	- 	-rV   
SecretType)Z	covariantc                  sj    ] tR tRtR R ltR R ltR R ltR R	 ltR
 R ltR R lt	R R lt
RtR# )_SecretBasei   c               r   )rM   secret_valuer   rN   NonerP   rQ   rS   rT   rU   _SecretBase.__annotate__  s     6 6Z 6D 6rV   c                	s    Wn         R # rX   _secret_value)r[   r   r   rT   __init__Z_SecretBase.__init__  s    )5rV   c               rK   )rM   rN   r   rP   rQ   rS   rT   rU   r     s     " "* "rV   c                    V P                   # )z6Get the secret value.

Returns:
    The secret value.
r   rZ   r\   rT   get_secret_valueZ_SecretBase.get_secret_value  s     !!!rV   c               r   r   rP   rQ   rS   rT   rU   r     s     i iC iD irV   c                	s~    \        WP                  4      ;'       d"    V P                  4       VP                  4       8H  # rX   )r   r   r   r   r   rT   r   Z_SecretBase.__eq__  s1    %0hhT5J5J5LPUPfPfPh5hhrV   c               rK   rL   rP   rQ   rS   rT   rU   r     r   rV   c                	4    \        V P                  4       4      # rX   )rY   r   rZ   r\   rT   r]   Z_SecretBase.__hash__  s    D))+,,rV   c               rK   r   rP   rQ   rS   rT   rU   r     s     $ $ $rV   c                	r   rX   )r   _displayrZ   r\   rT   __str__Z_SecretBase.__str__  s    4==?##rV   c               rK   r   rP   rQ   rS   rT   rU   r     s     A A# ArV   c                	sX    V P                   P                   R V P                  4       : R2# )Z(Z))r   r^   r   rZ   r\   rT   r   Z_SecretBase.__repr__  s'    ..))*!DMMO+>a@@rV   c               rK   rM   rN   zstr | bytesrP   rQ   rS   rT   rU   r     s     " "+ "rV   c                	s    \         hrX   )ZNotImplementedErrorrZ   r\   rT   r   Z_SecretBase._display  s    !!rV   r   N)r^   r_   r`   ra   r   r   r   r]   r   r   r   rd   rP   rV   rT   r   r      s,    6"i-$A" "rV   r   c               r   )rM   valueSecret[SecretType]infocore_schema.SerializationInforN   zstr | Secret[SecretType]rP   rQ   rS   rT   rU   rU     s$      / 7T Yq rV   c                s>    VP                   R 8X  d   \        V 4      # V # r   )moder   r   r   r   rT   _serialize_secretr    s    yyF5zrV   c            
      s    ] tR tRtRtR R lt]R R l4       t]! ]	P                  ! ]	P                  ! ]RRR	7      R
7      4      tRtR# )r2   i#  a
  A generic base class used for defining a field with sensitive information that you do not want to be visible in logging or tracebacks.

You may either directly parametrize `Secret` with a type, or subclass from `Secret` with a parametrized type. The benefit of subclassing
is that you can define a custom `_display` method, which will be used for `repr()` and `str()` methods. The examples below demonstrate both
ways of using `Secret` to create a new secret type.

1. Directly parametrizing `Secret` with a type:

```python
from pydantic import BaseModel, Secret

SecretBool = Secret[bool]

class Model(BaseModel):
    secret_bool: SecretBool

m = Model(secret_bool=True)
print(m.model_dump())
#> {'secret_bool': Secret('**********')}

print(m.model_dump_json())
#> {"secret_bool":"**********"}

print(m.secret_bool.get_secret_value())
#> True
```

2. Subclassing from parametrized `Secret`:

```python
from datetime import date

from pydantic import BaseModel, Secret

class SecretDate(Secret[date]):
    def _display(self) -> str:
        return '****/**/**'

class Model(BaseModel):
    secret_date: SecretDate

m = Model(secret_date=date(2022, 1, 1))
print(m.model_dump())
#> {'secret_date': SecretDate('****/**/**')}

print(m.model_dump_json())
#> {"secret_date":"****/**/**"}

print(m.secret_date.get_secret_value())
#> 2022-01-01
```

The value returned by the `_display` method will be used for `repr()` and `str()`.

You can enforce constraints on the underlying type through annotations:
For example:

```python
from typing import Annotated

from pydantic import BaseModel, Field, Secret, ValidationError

SecretPosInt = Secret[Annotated[int, Field(gt=0, strict=True)]]

class Model(BaseModel):
    sensitive_int: SecretPosInt

m = Model(sensitive_int=42)
print(m.model_dump())
#> {'sensitive_int': Secret('**********')}

try:
    m = Model(sensitive_int=-42)  # (1)!
except ValidationError as exc_info:
    print(exc_info.errors(include_url=False, include_input=False))
    '''
    [
        {
            'type': 'greater_than',
            'loc': ('sensitive_int',),
            'msg': 'Input should be greater than 0',
            'ctx': {'gt': 0},
        }
    ]
    '''

try:
    m = Model(sensitive_int='42')  # (2)!
except ValidationError as exc_info:
    print(exc_info.errors(include_url=False, include_input=False))
    '''
    [
        {
            'type': 'int_type',
            'loc': ('sensitive_int',),
            'msg': 'Input should be a valid integer',
        }
    ]
    '''
```

1. The input value is not greater than 0, so it raises a validation error.
2. The input value is not an integer, so it raises a validation error because the `SecretPosInt` type has strict mode enabled.
c               rK   r   rP   rQ   rS   rT   rU   Secret.__annotate__  s     ? ?+ ?rV   c                	s6    V P                  4       '       d   R # R# z
********** )r   rZ   r\   rT   r   ZSecret._display  s    #4466|>B>rV   c               r   r   rP   rQ   rS   rT   rU   r    #     %
 %
) %
FZ %
_u %
rV   c           
     	s  a  R p\        V4      pVe   \        V4      ^ ,          pMl\        S R\        S R. 4      4      pV F*  p\        V4      \        J g   K  \        V4      ^ ,          pK,  	  V. 8X  g   Vf   \	        RS P
                   R24      hVP                  V4      pR V 3R llp\        P                  ! \        P                  ! VV4      \        P                  ! V 3R lV4      \        P                  ! \        RR	R
7      R7      # )NZ__orig_bases__Z	__bases__zCan't get secret type from zE. Please use Secret[<type>], or subclass from Secret[<type>] instead.c               rK   )rM   rN   r   rP   rQ   rS   rT   rU   Z9Secret.__get_pydantic_core_schema__.<locals>.__annotate__  s     	( 	(5G 	(rV   c                sp   < \        V \        4      '       d   V P                  4       p V! V 4      pS! V4      # rX   )r   r2   r   )r   r   Zvalidated_innerr      && rT   validate_secret_valueZBSecret.__get_pydantic_core_schema__.<locals>.validate_secret_value  s2    %((..0%enO''rV   c                s   < S! V 4      # rX   rP   )xr   s   &rT   Z<lambda>Z5Secret.__get_pydantic_core_schema__.<locals>.<lambda>  s
    sSTvrV   TalwaysZinfo_argr   python_schemar   r   )r!   r    getattrr2   	TypeErrorr^   Zgenerate_schemar   json_or_python_schemaZno_info_wrap_validator_function no_info_after_validator_functionr   r  )	r   r   r   Z
inner_typeZorigin_typeZbasesZbaseinner_schemar  s	   f&&      rT   r   Z#Secret.__get_pydantic_core_schema__  s	   
 ("!&)!,J C!173R3PQEd#v-!)$!2J  {j01#,, @Z Z 
 ..z:	( 	( 00%EE% $DDEUWcd%JJ!"
 	
rV   Tr  r  r   rP   N)r^   r_   r`   ra   rb   r   r   r   r   r   
any_schemar   r  __pydantic_serializer__rd   rP   rV   rT   r2   r2   #  sU    gR? %
 %
N /%JJ!"	
rV   c               r   )rM   r   r   rN   r   rP   rQ   rS   rT   rU   rU     s     ) ): )# )rV   c                s    V '       d   R # R# r  rP   r   r\   rT   _secret_displayr    s     <(b(rV   c               r   )rM   r   z_SecretField[SecretType]r   r  rN   zstr | _SecretField[SecretType]rP   rQ   rS   rT   rU   rU     s$      #+H#rV   c                sZ    VP                   R 8X  d   \        V P                  4       4      # V # r  )r  r  r   r  r   rT   _serialize_secret_fieldr    s+     yyF u55788rV   c            
      s    ] tR tRt$ R]R&   R]R&   ]R R l4       t]! ]P                  ! ]P                  ! ]RR	R
7      R7      4      tRtR# )_SecretFieldi  ClassVar[CoreSchema]_inner_schemaClassVar[str]_error_kindc               r   r   rP   rQ   rS   rT   rU   Z_SecretField.__annotate__  r	  rV   c                	s   a a R  V 3R llpR V V3R llp\         P                  ! V! RR7      V! RR7      RV./R7      # )	c               r   )rM   _core_schemar   r   r)   rN   r,   rP   rQ   rS   rT   rU   ?_SecretField.__get_pydantic_core_schema__.<locals>.__annotate__  s$     	 	*@ 	K_ 	ds 	rV   c                s`   < V! SP                   4      p\        P                  ! VR RRR7       V# )r   TZpassword)r   Z	writeOnlyrR   )r  r%   Zupdate_not_none)r!  r   r   r   r
  rT   get_json_schemaZB_SecretField.__get_pydantic_core_schema__.<locals>.get_json_schema  s5    !#"3"34K""!	 rV   c               r   )rM   rJ   rI   rN   r   rP   rQ   rS   rT   rU   r"    s     	 	d 	z 	rV   c           
     s*  < / SP                   CR V /Cp\        P                  ! SV4      p\        P                  ! \        P                  ! \        P
                  ! S4      V.SP                  R7      V\        P                  ! \        RRR7      R7      # )rJ   )custom_error_typeTr  r  r  )	r  r   r  r  union_schemaZis_instance_schemar   r   r  )rJ   r  r   r   r   s   &  rT   get_secret_schemaZD_SecretField.__get_pydantic_core_schema__.<locals>.get_secret_schema  s    Bc//B6BL%FFK 44)66#66v># '*oo ()NN+!& rV   F)rJ   TZpydantic_js_functions)Z
lax_schemaZstrict_schemametadata)r   Zlax_or_strict_schema)r   r   r   r#  r&  s   ff&  rT   r   Z)_SecretField.__get_pydantic_core_schema__  sG    	 		 	, //(6+48-/@A
 	
rV   Tr  r  r  rP   N)r^   r_   r`   ra   rc   r   r   r   r   r  r   r  r  rd   rP   rV   rT   r  r    sS    ''%
 %
N /%JJ'"	
rV   r  c                  n    ] tR tRt$ Rt]P                  ! 4       tR]R&   Rt	R]R&   R R	 lt
R
 R ltRtR# )r3   i	  a  A string used for storing sensitive information that you do not want to be visible in logging or tracebacks.

When the secret value is nonempty, it is displayed as `'**********'` instead of the underlying value in
calls to `repr()` and `str()`. If the value _is_ empty, it is displayed as `''`.

```python
from pydantic import BaseModel, SecretStr

class User(BaseModel):
    username: str
    password: SecretStr

user = User(username='scolvin', password='password1')

print(user)
#> username='scolvin' password=SecretStr('**********')
print(user.password.get_secret_value())
#> password1
print((SecretStr('password'), SecretStr('')))
#> (SecretStr('**********'), SecretStr(''))
```

As seen above, by default, [`SecretStr`][pydantic.types.SecretStr] (and [`SecretBytes`][pydantic.types.SecretBytes])
will be serialized as `**********` when serializing to json.

You can use the [`field_serializer`][pydantic.functional_serializers.field_serializer] to dump the
secret as plain-text when serializing to json.

```python
from pydantic import BaseModel, SecretBytes, SecretStr, field_serializer

class Model(BaseModel):
    password: SecretStr
    password_bytes: SecretBytes

    @field_serializer('password', 'password_bytes', when_used='json')
    def dump_secret(self, v):
        return v.get_secret_value()

model = Model(password='IAmSensitive', password_bytes=b'IAmSensitiveBytes')
print(model)
#> password=SecretStr('**********') password_bytes=SecretBytes(b'**********')
print(model.password)
#> **********
print(model.model_dump())
'''
{
    'password': SecretStr('**********'),
    'password_bytes': SecretBytes(b'**********'),
}
'''
print(model.model_dump_json())
#> {"password":"IAmSensitive","password_bytes":"IAmSensitiveBytes"}
```
r  r  Zstring_typer  r   c               rK   rL   rP   rQ   rS   rT   rU   SecretStr.__annotate__E       ' ' 'rV   c                	rW   rX   lenr   rZ   r\   rT   __len__ZSecretStr.__len__E      4%%&&rV   c               rK   r   rP   rQ   rS   rT   rU   r)  H  s     3 3# 3rV   c                	rW   rX   )r  r   rZ   r\   rT   r   ZSecretStr._displayH  s    t1122rV   rP   N)r^   r_   r`   ra   rb   r   r   r  rc   r   r-  r   rd   rP   rV   rT   r3   r3   	  s7    6p +6*@*@*BM'B!.K.'3 3rV   c                  r(  )r4   iL  a  A bytes used for storing sensitive information that you do not want to be visible in logging or tracebacks.

It displays `b'**********'` instead of the string value on `repr()` and `str()` calls.
When the secret value is nonempty, it is displayed as `b'**********'` instead of the underlying value in
calls to `repr()` and `str()`. If the value _is_ empty, it is displayed as `b''`.

```python
from pydantic import BaseModel, SecretBytes

class User(BaseModel):
    username: str
    password: SecretBytes

user = User(username='scolvin', password=b'password1')
#> username='scolvin' password=SecretBytes(b'**********')
print(user.password.get_secret_value())
#> b'password1'
print((SecretBytes(b'password'), SecretBytes(b'')))
#> (SecretBytes(b'**********'), SecretBytes(b''))
```
r  r  Z
bytes_typer  r   c               rK   rL   rP   rQ   rS   rT   rU   SecretBytes.__annotate__f  r*  rV   c                	rW   rX   r+  rZ   r\   rT   r-  ZSecretBytes.__len__f  r.  rV   c               rK   )rM   rN   rw   rP   rQ   rS   rT   rU   r/  i  s     < <% <rV   c                	sH    \        V P                  4      P                  4       # rX   )r  r   encoderZ   r\   rT   r   ZSecretBytes._displayi  s    t11299;;rV   rP   N)r^   r_   r`   ra   rb   r   Zbytes_schemar  rc   r   r-  r   rd   rP   rV   rT   r4   r4   L  s6    , +6*B*B*DM'D!-K-'< <rV   c                  s2    ] tR tRtRtRtRtRtR R ltRt	R	# )
PaymentCardBrandip  zAmerican ExpressZ
MastercardZVisar   c               rK   r   rP   rQ   rS   rT   rU   ZPaymentCardBrand.__annotate__v  s       rV   c                	r   rX   r  rZ   r\   rT   r   ZPaymentCardBrand.__str__v  s    zzrV   rP   N)
r^   r_   r`   ra   amex
mastercardvisar   r   rd   rP   rV   rT   r1  r1  p  s     DJDE rV   r1  zThe `PaymentCardNumber` class is deprecated, use `pydantic_extra_types` instead. See https://docs.pydantic.dev/latest/api/pydantic_extra_types_payment/#pydantic_extra_types.payment.PaymentCardNumber.)Zcategoryc                  s    ] tR tRt$ RtRtR]R&   ^tR]R&   ^tR]R&   R	]R
&   R	]R&   R]R&   R R lt	]
R R l4       t]
R R l4       t]R R l4       t]
R R l4       t]
R R l4       t]R R l4       tRtR# )r5   iz  z<Based on: https://en.wikipedia.org/wiki/Payment_card_number.TzClassVar[bool]r{   zClassVar[int]ru   rv   r   binlast4r1  brandc               rK   )rM   card_numberr   rP   rQ   rS   rT   rU   PaymentCardNumber.__annotate__  s     6 6C 6rV   c                	s    V P                  V4       V P                  V4      pVR ,          V n        VRR V n        V P	                  V4      V n        R# ):Ni   NNi)validate_digitsvalidate_luhn_check_digitr5  r6  validate_brandr7  )r[   r8  r   rT   r   ZPaymentCardNumber.__init__  sK    [)44[Ar? %
((5
rV   c               r   r   rP   rQ   rS   rT   rU   r9    s#     
 
) 
FZ 
_u 
rV   c           	     	s    \         P                  ! V P                  \         P                  ! V P                  V P
                  V P                  R 7      4      # ))ru   rv   r{   )r   r   validater   ru   rv   r{   r   r   rT   r   Z.PaymentCardNumber.__get_pydantic_core_schema__  s@    ==LL"">>cnnWZWkWk
 	
rV   c               r   )rM   r   r   input_valuer   rN   r5   rP   rQ   rS   rT   rU   r9    s#        .H  3  M^  rV   c               s    V ! V4      # )zCValidate the card number and return a `PaymentCardNumber` instance.rP   )r   r>  r   s   ""&rT   r=  ZPaymentCardNumber.validate  s     ;rV   c               rK   r   rP   rQ   rS   rT   rU   r9    s     ; ; ;rV   c                sl    \        V 4      ^
,
          pV P                   RV,           V P                   2# )z^Mask all but the last 4 digits of the card number.

Returns:
    A masked card number string.
Z*)r,  r5  r6  )r[   Z
num_masked   & rT   maskedZPaymentCardNumber.masked  s2     Y^
((C*,-djj\::rV   c               r   )rM   r8  r   rN   r   rP   rQ   rS   rT   rU   r9    s     e e# e$ erV   c                sJ    VP                  4       '       g   \        RR4      hR# )z,Validate that the card number is all digits.Zpayment_card_number_digitszCard number is not all digitsN)Zisdigitr   )r   r8  r   rT   r:  Z!PaymentCardNumber.validate_digits  s'     ""$$%&BDcdd %rV   c               r   )rM   r8  r   rN   rP   rQ   rS   rT   rU   r9    s      C C rV   c                sD   \        VR,          4      p\        V4      pV^,          p\        V^,
          4       FC  p\        W,          4      pV^,          V8X  d
   V^,          pV^	8  d
   V^	,          pW&,          pKE  	  V^
,          ^ 8H  pV'       g   \        RR4      hV# )z7Based on: https://en.wikipedia.org/wiki/Luhn_algorithm.Zpayment_card_number_luhnzCard number is not luhn validi)rO   r,  Zranger   )r   r8  Zsum_ZlengthZparityiZdigitvalids   &&      rT   r;  Z+PaymentCardNumber.validate_luhn_check_digit  s     ;r?#[!!vz"A'E1u
qy
MD # r	Q%&@BabbrV   c               r   )rM   r8  r   rN   r1  rP   rQ   rS   rT   rU   r9    s        C  ,<  rV   c                s&   V ^ ,          R8X  d   \         P                  pMb^3\        V R,          4      u;8:  d   ^78:  d   M M\         P                  pM/V R,          R
9   d   \         P                  pM\         P
                  pRpV\         P                  9   d   ^p\        V 4      V8H  pMNV\         P                  8X  d   Rp\        V 4      R9   pM(V\         P                  8X  d   ^p\        V 4      V8H  pMRpV'       g   \        RRRVR	V/4      hV# )zValidate length based on BIN for major brands:
https://en.wikipedia.org/wiki/Payment_card_number#Issuer_identification_number_(IIN).
Z4:NrM   NNz13, 16 or 19TZpayment_card_number_brandz3Length for a {brand} card must be {required_length}r7  required_length>   Z34Z37>   i   i   i   )r1  r4  rO   r3  r2  r   r,  r   )r8  r7  rC  rB  s   &   rT   r<  Z PaymentCardNumber.validate_brand  s    
 q>S $))E3{2'-2-$//E_,$))E$**E,0$/// O$7E&+++,O$4E&+++ O$7EE%+E%!2OD 
 rV   )r5  r7  r6  N)r^   r_   r`   ra   rb   r{   rc   ru   rv   r   r   r   r=  Zpropertyr@  r:  r;  r   r<  rd   rP   rV   rT   r5   r5   z  s     G'+n+ "J" "J"	HJ6 
 
     ; ; e e
  "    rV   c                  s   ] tR tRtRt/ R^bRR)bRR*bRR+bRR,bRR-bR	R.bR
R/bRR0bRR1bRR2bRR3bRR4bRR5bRR6bRR7bRR8bRR9RR:RR;RR<RR=RR>RR?RR@RRA/	Ct]P                  ]P                  4        U Uu/ uF&  w  rRV 9  g   K  V P                  4       ^ ,          VbK(  	  upp 4       Rt	]
P                  ! ]	]
P                  4      t]R R  l4       t]R! R" l4       tRBR# R$ lltR% R& ltR'tR(# u upp i )Cr6   i  a  Converts a string representing a number of bytes with units (such as `'1KB'` or `'11.5MiB'`) into an integer.

You can use the `ByteSize` data type to (case-insensitively) convert a string representation of a number of bytes into
an integer, and also to print out human-readable strings representing a number of bytes.

In conformance with [IEC 80000-13 Standard](https://en.wikipedia.org/wiki/ISO/IEC_80000) we interpret `'1KB'` to mean 1000 bytes,
and `'1KiB'` to mean 1024 bytes. In general, including a middle `'i'` will cause the unit to be interpreted as a power of 2,
rather than a power of 10 (so, for example, `'1 MB'` is treated as `1_000_000` bytes, whereas `'1 MiB'` is treated as `1_048_576` bytes).

!!! info
    Note that `1b` will be parsed as "1 byte" and not "1 bit".

```python
from pydantic import BaseModel, ByteSize

class MyModel(BaseModel):
    size: ByteSize

print(MyModel(size=52000).size)
#> 52000
print(MyModel(size='3000 KiB').size)
#> 3072000

m = MyModel(size='50 PB')
print(m.size.human_readable())
#> 44.4PiB
print(m.size.human_readable(decimal=True))
#> 50.0PB
print(m.size.human_readable(separator=' '))
#> 44.4 PiB

print(m.size.to('TiB'))
#> 45474.73508864641
```
bZkbZmbZgbZtbZpbZebZkibZmibZgibZtibZpibZeibZbitZkbitZmbitZgbitZtbitZpbitZebitZkibitZmibitZgibitZtibitZpibitZeibitrA  z^\s*(\d*\.?\d+)\s*(\w+)?c               r   r   rP   rQ   rS   rT   rU   ByteSize.__annotate__0  s#     
 
) 
FZ 
_u 
rV   c                	s@   \         P                  ! V P                  \         P                  ! \         P                  ! V P
                  R 7      \         P                  ! ^ R7      .RRR7      \         P                  ! \        \         P                  ! ^ R7      R7      R7      # ))r   )rf   	byte_size/could not parse value and unit from byte stringr$  custom_error_message)Zreturn_schemar   )	r   r   	_validater%  r   byte_string_patternZ
int_schemar   rO   r   r   rT   r   Z%ByteSize.__get_pydantic_core_schema__/  sy    ==]]++**33J3JK**a0 #.%V &JJ;#9#9Q#?
 	
rV   c               r   )rM   r   r   r>  r   rN   r6   rP   rQ   rS   rT   rU   rE  A  s"     3 3/I 3C 3h 3rV   c               	s    V ! \        V4      4      #   \         d     Mi ; iT P                  P                  \	        T4      4      pTf   \        RR4      hTP                  4       w  rETf   Rp T P                  TP                  4       ,          pM  \         d    \        RRRT/4      hi ; iT ! \        \        T4      T,          4      4      # )NrF  rG  rD  byte_size_unitz%could not interpret byte unit: {unit}unit)rO   
ValueErrorbyte_string_reZmatchr   r   Zgroups
byte_sizeslowerKeyErrorrr   )r   r>  r   Z	str_matchZscalarrM  Z	unit_mults   ""&    rT   rJ  ZByteSize._validate@  s    	s;'(( 		 &&,,S-=>	%k3dee '')<D	qtzz|4I 	q%&68_bhjnaopp	q 3uV}y0122s    !!1!B B.c               s$    V ^8  d   QhRRRRRR/# )rM   decimalrI   	separatorr   rN   rP   rQ   rS   rT   rU   rE  V  s!     4 4d 4s 4C 4rV   c                s    V'       d   RpRpRpMRpR	pRp\        V 4      pV F8  p\        V4      V8  d   VR8X  d   VR V V 2u # VR V V 2u # Wc,          pK:  	  VR V V 2# )
a[  Converts a byte size to a human readable string.

Args:
    decimal: If True, use decimal units (e.g. 1000 bytes per KB). If False, use binary units
        (e.g. 1024 bytes per KiB).
    separator: A string used to split the value and unit. Defaults to an empty string ('').

Returns:
    A human readable string representation of the byte size.
  BZEB   ZEiBz0.0fz0.1f)rV  ZKBZMBZGBZTBZPB)rV  ZKiBZMiBZGiBZTiBZPiB)rr   Zabs)r[   rS  rT  ZdivisorZunitsZ
final_unitZnumrM  s   &&&     rT   human_readableZByteSize.human_readableV  s     G5EJG:EJDkD3x'!3;!$Z	{4&99!$Z	{4&99NC  dI;zl33rV   c               r   )rM   rM  r   rN   rr   rP   rQ   rS   rT   rU   rE  u  s      s u rV   c                s     V P                   VP                  4       ,          pW,          #   \         d    \        RRRT/4      hi ; i)a}  Converts a byte size to another unit, including both byte and bit units.

Args:
    unit: The unit to convert to. Must be one of the following: B, KB, MB, GB, TB, PB, EB,
        KiB, MiB, GiB, TiB, PiB, EiB (byte units) and
        bit, kbit, mbit, gbit, tbit, pbit, ebit,
        kibit, mibit, gibit, tibit, pibit, eibit (bit units).

Returns:
    The byte size in the new unit.
rL  z%Could not interpret byte unit: {unit}rM  )rP  rQ  rR  r   )r[   rM  Zunit_div   && rT   toZByteSize.tou  sQ    	qtzz|4H   	q%&68_bhjnaopp	qs	   !+ ArP   NrU  i@B i ʚ;l    J)l     I5 l     NZorW  i   i   @l        l           l            g      ?g     @_@g    @g    e͝Ag   =Bg  4&kBg Ngm{Cg      `@g       Ag      Ag      @Bg      Bg      C)Fr  )r^   r_   r`   ra   rb   rP  r   ZitemsrQ  rK  reZcompileZ
IGNORECASErO  r   r   rJ  rX  rZ  rd   )Zkr   s   00rT   r6   r6     s   "HQe 	e 	e	
 	f 	f 	f 	u 	u 	u 	u 	u 	u 	u 		  		!" 		#$ 	


5J8 :3C3C3EV3E41TUqwwy|Q3EVW5ZZ 3R]]CN
 
  3 3*4> W Ws   0C+
 C+
c               s(    V ^8  d   QhRRRRRRRR/# )rM   annotated_typer   expected_type
annotationrN   r   rP   rQ   rS   rT   rU   rU     s/     v v# vc vs vW[ vrV   c                s:    W8w  d   \        R V RV  R2RR7      hR# )Z'z' cannot annotate 'z'.zinvalid-annotated-typer   Nr*   )r\  r]  r^  r   rT   r   r     s-    &!J</B>BRRT U\tuu 'rV   c                  <    ] tR tRtRt]R R l4       tR R ltRtR# )	r7   i  zA date in the past.c               r   r   rP   rQ   rS   rT   rU   PastDate.__annotate__  $     
	 
	"
	-A
	#
	rV   c                	    WJ d   \         P                  ! R R7      # V! V4      p\        VR,          RV P                  4       R VR&   V# )pastnow_opr   r   re  r   Zdate_schemar   r^   r   r   r   r   r   rT   r   Z%PastDate.__get_pydantic_core_schema__  sF     }"..f== %fVnfcllK#)x rV   c               rK   r   rP   rQ   rS   rT   rU   r`    s     	 	c 	rV   c                	r   )r7   rP   rZ   r\   rT   r   ZPastDate.__repr__  s    rV   rP   N	r^   r_   r`   ra   rb   r   r   r   rd   rP   rV   rT   r7   r7     s!    !	
	 

		 	rV   c                  r_  )	r8   i  zA date in the future.c               r   r   rP   rQ   rS   rT   rU   FutureDate.__annotate__  ra  rV   c                	rb  )futurerd  r   r   re  rf  rg  r   rT   r   Z'FutureDate.__get_pydantic_core_schema__  sF     }"..h?? %fVnfcllK#+x rV   c               rK   r   rP   rQ   rS   rT   rU   ri    s     	  	 c 	 rV   c                	r   )r8   rP   rZ   r\   rT   r   ZFutureDate.__repr__  s    rV   rP   Nrh  rP   rV   rT   r8   r8     s!    #	
	 

		  	 rV   c               s0    V ^8  d   QhRRRRRRRRRRRR	/# )
rM   rJ   rj   re   zdate | Nonerf   rg   rh   rN   z
type[date]rP   rQ   rS   rT   rU   rU     sF       	 		
 	 	 rV   c           
     st    \         \        V e   \        V 4      MR\        P                  ! WW4R7      3,          # )a  A wrapper for date that adds constraints.

Args:
    strict: Whether to validate the date value in strict mode. Defaults to `None`.
    gt: The value must be greater than this. Defaults to `None`.
    ge: The value must be greater than or equal to this. Defaults to `None`.
    lt: The value must be less than this. Defaults to `None`.
    le: The value must be less than or equal to this. Defaults to `None`.

Returns:
    A date type with the specified constraints.
Nrl   )r   r   r/   rm   rn   )rJ   re   rf   rg   rh   s   $$$$$rT   condaterk    s7    (  ,v$  B"<	> rV   c                  r_  )	r;   i  z'A datetime that requires timezone info.c               r   r   rP   rQ   rS   rT   rU   AwareDatetime.__annotate__  ra  rV   c                	rb  )Zawaretz_constraintr   r   rn  r   Zdatetime_schemar   r^   rg  r   rT   r   Z*AwareDatetime.__get_pydantic_core_schema__  F     }"22II %fVnj#,,O*1'rV   c               rK   r   rP   rQ   rS   rT   rU   rl         	# 	#c 	#rV   c                	r   )r;   rP   rZ   r\   rT   r   ZAwareDatetime.__repr__      "rV   rP   Nrh  rP   rV   rT   r;   r;     s!    5	
	 

		# 	#rV   c                  r_  )	r<   i  z.A datetime that doesn't require timezone info.c               r   r   rP   rQ   rS   rT   rU   NaiveDatetime.__annotate__  ra  rV   c                	rb  )Znaiverm  r   r   rn  ro  rg  r   rT   r   Z*NaiveDatetime.__get_pydantic_core_schema__  rp  rV   c               rK   r   rP   rQ   rS   rT   rU   rs  	  rq  rV   c                	r   )r<   rP   rZ   r\   rT   r   ZNaiveDatetime.__repr__	  rr  rV   rP   Nrh  rP   rV   rT   r<   r<     s!    <	
	 

		# 	#rV   c                  r_  )	r9   i	  z$A datetime that must be in the past.c               r   r   rP   rQ   rS   rT   rU   PastDatetime.__annotate__	  ra  rV   c                	rb  )rc  rd  r   r   re  ro  rg  r   rT   r   Z)PastDatetime.__get_pydantic_core_schema__	  sF     }"22&AA %fVnj#,,O#)x rV   c               rK   r   rP   rQ   rS   rT   rU   rt  	  r   rV   c                	r   )r9   rP   rZ   r\   rT   r   ZPastDatetime.__repr__	  r   rV   rP   Nrh  rP   rV   rT   r9   r9   	  s!    2	
	 

		" 	"rV   c                  r_  )	r:   i	  z&A datetime that must be in the future.c               r   r   rP   rQ   rS   rT   rU   FutureDatetime.__annotate__	  ra  rV   c                	rb  )rj  rd  r   r   re  ro  rg  r   rT   r   Z+FutureDatetime.__get_pydantic_core_schema__	  sF     }"22(CC %fVnj#,,O#+x rV   c               rK   r   rP   rQ   rS   rT   rU   ru  +	  r   rV   c                	r   )r:   rP   rZ   r\   rT   r   ZFutureDatetime.__repr__+	  s    #rV   rP   Nrh  rP   rV   rT   r:   r:   	  s!    4	
	 

		$ 	$rV   c                  \    ] tR tRtRt]R R l4       t]R R l4       t]R R l4       tR	t	R
# )r>   i2	  z:Protocol for encoding and decoding data to and from bytes.c               r   rM   datarw   rN   rP   rQ   rS   rT   rU   EncoderProtocol.__annotate__6	  s     	 	% 	E 	rV   c                    R# )zhDecode the data using the encoder.

Args:
    data: The data to decode.

Returns:
    The decoded data.
NrP   )r   rx  r   rT   decodeZEncoderProtocol.decode5	       	rV   c               r   rM   r   rw   rN   rP   rQ   rS   rT   rU   ry  B	  s     	 	5 	U 	rV   c                rz  )ziEncode the data using the encoder.

Args:
    value: The data to encode.

Returns:
    The encoded data.
NrP   r   r   r   rT   r0  ZEncoderProtocol.encodeA	  r|  rV   c               rK   r   rP   rQ   rS   rT   rU   ry  N	  s       rV   c                rz  )^Get the JSON format for the encoded data.

Returns:
    The JSON format for the encoded data.
NrP   r   r\   rT   get_json_formatZEncoderProtocol.get_json_formatM	  s     	rV   rP   N
r^   r_   r`   ra   rb   r   r{  r0  r  rd   rP   rV   rT   r>   r>   2	  s?    D	 	 	 	  rV   c                  rv  )rA   iW	  z'Standard (non-URL-safe) Base64 encoder.c               r   rw  rP   rQ   rS   rT   rU   Base64Encoder.__annotate__[	       n n% nE nrV   c           	          \         P                  ! V4      #   \         d   p\        RRR\	        T4      /4      hRp?ii ; izDecode the data from base64 encoded bytes to original bytes data.

Args:
    data: The data to decode.

Returns:
    The decoded data.
Zbase64_decodez Base64 decoding error: '{error}'ZerrorN)base64Z	b64decoderN  r   r   r   rx  ZerY  rT   r{  ZBase64Encoder.decodeZ	  sH    	n##D)) 	n%o7Y\cehijek[lmm	n    A ;A c               r   r}  rP   rQ   rS   rT   rU   r  j	  s     	' 	'5 	'U 	'rV   c                .    \         P                  ! V4      # z|Encode the data from bytes to a base64 encoded bytes.

Args:
    value: The data to encode.

Returns:
    The encoded data.
)r  Z	b64encoder~  r   rT   r0  ZBase64Encoder.encodei	  s     &&rV   c               rK   )rM   rN   zLiteral['base64']rP   rQ   rS   rT   rU   r  v	  s       1 rV   c                rz  )r  r  rP   r  r\   rT   r  ZBase64Encoder.get_json_formatu	  s     rV   rP   Nr  rP   rV   rT   rA   rA   W	  sA    1n n 	' 	'  rV   c                  rv  )Base64UrlEncoderi	  zURL-safe Base64 encoder.c               r   rw  rP   rQ   rS   rT   rU   Base64UrlEncoder.__annotate__	  r  rV   c           	     r  r  )r  Zurlsafe_b64decoderN  r   r   r  rY  rT   r{  ZBase64UrlEncoder.decode	  sH    	n++D11 	n%o7Y\cehijek[lmm	nr  c               r   r}  rP   rQ   rS   rT   rU   r  	  s     	/ 	/5 	/U 	/rV   c                r  r  )r  Zurlsafe_b64encoder~  r   rT   r0  ZBase64UrlEncoder.encode	  s     ''..rV   c               rK   )rM   rN   zLiteral['base64url']rP   rQ   rS   rT   rU   r  	  s       4 rV   c                rz  )r  Z	base64urlrP   r  r\   rT   r  Z Base64UrlEncoder.get_json_format	  s     rV   rP   Nr  rP   rV   rT   r  r  	  sA    "n n 	/ 	/  rV   r  c                  b    ] tR tRt$ RtR]R&   R R ltR R ltR	 R
 ltR R lt	R R lt
RtR# )r?   i	  aW  A bytes type that is encoded and decoded using the specified encoder.

`EncodedBytes` needs an encoder that implements `EncoderProtocol` to operate.

```python
from typing import Annotated

from pydantic import BaseModel, EncodedBytes, EncoderProtocol, ValidationError

class MyEncoder(EncoderProtocol):
    @classmethod
    def decode(cls, data: bytes) -> bytes:
        if data == b'**undecodable**':
            raise ValueError('Cannot decode data')
        return data[13:]

    @classmethod
    def encode(cls, value: bytes) -> bytes:
        return b'**encoded**: ' + value

    @classmethod
    def get_json_format(cls) -> str:
        return 'my-encoder'

MyEncodedBytes = Annotated[bytes, EncodedBytes(encoder=MyEncoder)]

class Model(BaseModel):
    my_encoded_bytes: MyEncodedBytes

# Initialize the model with encoded data
m = Model(my_encoded_bytes=b'**encoded**: some bytes')

# Access decoded value
print(m.my_encoded_bytes)
#> b'some bytes'

# Serialize into the encoded form
print(m.model_dump())
#> {'my_encoded_bytes': b'**encoded**: some bytes'}

# Validate encoded data
try:
    Model(my_encoded_bytes=b'**undecodable**')
except ValidationError as e:
    print(e)
    '''
    1 validation error for Model
    my_encoded_bytes
      Value error, Cannot decode data [type=value_error, input_value=b'**undecodable**', input_type=bytes]
    '''
```
type[EncoderProtocol]encoderc               r   r   rP   rQ   rS   rT   rU   EncodedBytes.__annotate__	  $      1<P	rV   c                	l    V! V4      pVP                  R V P                  P                  4       R7       V# r   r   r   r  r  r   r   rT   r   Z)EncodedBytes.__get_pydantic_json_schema__	  4     {+$,,2N2N2PQrV   c               r   r   rP   rQ   rS   rT   rU   r  	  #     
 
9 
G[ 
`v 
rV   c                	    V! V4      p\        VR ,          RV P                  P                  4       \        P                  ! V P
                  V\        P                  ! V P                  R7      R7      # )r   rw   r   r   )r   r   r^   r   r   r{  r   r0  r   r   rT   r   Z)EncodedBytes.__get_pydantic_core_schema__	  sW    fVngt~~7N7NO==[[%JJTXT_T_`
 	
rV   c               r   )rM   rx  rw   r   r   rN   rP   rQ   rS   rT   rU   r  	  s"     	) 	)5 	)%? 	)E 	)rV   c                8    V P                   P                  V4      # zrDecode the data using the specified encoder.

Args:
    data: The data to decode.

Returns:
    The decoded data.
)r  r{  r[   rx  r   r   rT   r{  ZEncodedBytes.decode	  s     ||""4((rV   c               r   r}  rP   rQ   rS   rT   rU   r  	  s     	* 	*E 	*e 	*rV   c                r  zsEncode the data using the specified encoder.

Args:
    value: The data to encode.

Returns:
    The encoded data.
)r  r0  r[   r   r   rT   r0  ZEncodedBytes.encode	  s     ||""5))rV   c               rK   rL   rP   rQ   rS   rT   rU   r  
       " "# "rV   c                	rW   rX   rY   r  rZ   r\   rT   r]   ZEncodedBytes.__hash__
      DLL!!rV   rP   N)r^   r_   r`   ra   rb   rc   r   r   r{  r0  r]   rd   rP   rV   rT   r?   r?   	  s.    3j #"
	)	*" "rV   c                  r  )r@   i

  a.  A str type that is encoded and decoded using the specified encoder.

`EncodedStr` needs an encoder that implements `EncoderProtocol` to operate.

```python
from typing import Annotated

from pydantic import BaseModel, EncodedStr, EncoderProtocol, ValidationError

class MyEncoder(EncoderProtocol):
    @classmethod
    def decode(cls, data: bytes) -> bytes:
        if data == b'**undecodable**':
            raise ValueError('Cannot decode data')
        return data[13:]

    @classmethod
    def encode(cls, value: bytes) -> bytes:
        return b'**encoded**: ' + value

    @classmethod
    def get_json_format(cls) -> str:
        return 'my-encoder'

MyEncodedStr = Annotated[str, EncodedStr(encoder=MyEncoder)]

class Model(BaseModel):
    my_encoded_str: MyEncodedStr

# Initialize the model with encoded data
m = Model(my_encoded_str='**encoded**: some str')

# Access decoded value
print(m.my_encoded_str)
#> some str

# Serialize into the encoded form
print(m.model_dump())
#> {'my_encoded_str': '**encoded**: some str'}

# Validate encoded data
try:
    Model(my_encoded_str='**undecodable**')
except ValidationError as e:
    print(e)
    '''
    1 validation error for Model
    my_encoded_str
      Value error, Cannot decode data [type=value_error, input_value='**undecodable**', input_type=str]
    '''
```
r  r  c               r   r   rP   rQ   rS   rT   rU   EncodedStr.__annotate__C
  r  rV   c                	r  r  r  r   r   rT   r   Z'EncodedStr.__get_pydantic_json_schema__C
  r  rV   c               r   r   rP   rQ   rS   rT   rU   r  J
  r  rV   c                	r  )r   r   r  r   )r   r   r^   r   r   
decode_strr   
encode_strr   r   rT   r   Z'EncodedStr.__get_pydantic_core_schema__J
  sW    fVneT^^5L5LM==__%JJTXTcTcd
 	
rV   c               r   )rM   rx  r   r   r   rN   rP   rQ   rS   rT   rU   r  S
  s"     	; 	;s 	;'A 	;c 	;rV   c                sp    V P                   P                  VP                  4       4      P                  4       # r  )r  r{  r0  r  r   rT   r  ZEncodedStr.decode_strS
  s(     ||""4;;=188::rV   c               r   )rM   r   r   rN   rP   rQ   rS   rT   rU   r  ^
  s     	< 	< 	< 	<rV   c                sp    V P                   P                  VP                  4       4      P                  4       # r  )r  r0  r{  r  r   rT   r  ZEncodedStr.encode_str^
  s(     ||""5<<>299;;rV   c               rK   rL   rP   rQ   rS   rT   rU   r  i
  r  rV   c                	rW   rX   r  rZ   r\   rT   r]   ZEncodedStr.__hash__i
  r  rV   rP   N)r^   r_   r`   ra   rb   rc   r   r   r  r  r]   rd   rP   rV   rT   r@   r@   

  s.    3j #"
	;	<" "rV   )r  c                  sl    ] tR tRt$ RtRtR]R&   RtR]R&   ]'       g   R R	 lt	]
P                  tR
tR# )rB   i  a*  !!! abstract "Usage Documentation"
    [Using `GetPydanticSchema` to Reduce Boilerplate](../concepts/types.md#using-getpydanticschema-to-reduce-boilerplate)

A convenience class for creating an annotation that provides pydantic custom type hooks.

This class is intended to eliminate the need to create a custom "marker" which defines the
 `__get_pydantic_core_schema__` and `__get_pydantic_json_schema__` custom hook methods.

For example, to have a field treated by type checkers as `int`, but by pydantic as `Any`, you can do:
```python
from typing import Annotated, Any

from pydantic import BaseModel, GetPydanticSchema

HandleAsAny = GetPydanticSchema(lambda _s, h: h(Any))

class Model(BaseModel):
    x: Annotated[int, HandleAsAny]  # pydantic sees `x: Any`

print(repr(Model(x='abc').x))
#> 'abc'
```
Nz8Callable[[Any, GetCoreSchemaHandler], CoreSchema] | Noneget_pydantic_core_schemaz=Callable[[Any, GetJsonSchemaHandler], JsonSchemaValue] | Noneget_pydantic_json_schemac               r   )rM   r   r   rN   r   rP   rQ   rS   rT   rU   ZGetPydanticSchema.__annotate__=  s     	; 	;C 	;C 	;rV   c                s    VR8X  d   V P                   '       d   V P                   # VR8X  d   V P                  '       d   V P                  # \        P                  W4      # )zgUse this rather than defining `__get_pydantic_core_schema__` etc. to reduce the number of nested calls.r   r   )r  r  objectZ__getattribute__)r[   r   r   rT   __getattr__ZGetPydanticSchema.__getattr__=  sS    55$:W:W:W44477D<Y<Y<Y444..t::rV   rP   )r^   r_   r`   ra   rb   r  rc   r  r
   r  r  r]   rd   rP   rV   rT   rB   rB     s8    0 Z^V]^b[b
 	; HrV   rz   c                  s2    ] tR tRt$ RtR]R&   R R ltRtR# )	rD   iI  a	  Provides a way to specify the expected tag to use for a case of a (callable) discriminated union.

Also provides a way to label a union case in error messages.

When using a callable `Discriminator`, attach a `Tag` to each case in the `Union` to specify the tag that
should be used to identify that case. For example, in the below example, the `Tag` is used to specify that
if `get_discriminator_value` returns `'apple'`, the input should be validated as an `ApplePie`, and if it
returns `'pumpkin'`, the input should be validated as a `PumpkinPie`.

The primary role of the `Tag` here is to map the return value from the callable `Discriminator` function to
the appropriate member of the `Union` in question.

```python
from typing import Annotated, Any, Literal, Union

from pydantic import BaseModel, Discriminator, Tag

class Pie(BaseModel):
    time_to_cook: int
    num_ingredients: int

class ApplePie(Pie):
    fruit: Literal['apple'] = 'apple'

class PumpkinPie(Pie):
    filling: Literal['pumpkin'] = 'pumpkin'

def get_discriminator_value(v: Any) -> str:
    if isinstance(v, dict):
        return v.get('fruit', v.get('filling'))
    return getattr(v, 'fruit', getattr(v, 'filling', None))

class ThanksgivingDinner(BaseModel):
    dessert: Annotated[
        Union[
            Annotated[ApplePie, Tag('apple')],
            Annotated[PumpkinPie, Tag('pumpkin')],
        ],
        Discriminator(get_discriminator_value),
    ]

apple_variation = ThanksgivingDinner.model_validate(
    {'dessert': {'fruit': 'apple', 'time_to_cook': 60, 'num_ingredients': 8}}
)
print(repr(apple_variation))
'''
ThanksgivingDinner(dessert=ApplePie(time_to_cook=60, num_ingredients=8, fruit='apple'))
'''

pumpkin_variation = ThanksgivingDinner.model_validate(
    {
        'dessert': {
            'filling': 'pumpkin',
            'time_to_cook': 40,
            'num_ingredients': 6,
        }
    }
)
print(repr(pumpkin_variation))
'''
ThanksgivingDinner(dessert=PumpkinPie(time_to_cook=40, num_ingredients=6, filling='pumpkin'))
'''
```

!!! note
    You must specify a `Tag` for every case in a `Tag` that is associated with a
    callable `Discriminator`. Failing to do so will result in a `PydanticUserError` with code
    [`callable-discriminator-no-tag`](../errors/usage_errors.md#callable-discriminator-no-tag).

See the [Discriminated Unions] concepts docs for more details on how to use `Tag`s.

[Discriminated Unions]: ../concepts/unions.md#discriminated-unions
r   tagc               r   rM   source_typer   r   r(   rN   r   rP   rQ   rS   rT   rU   ZTag.__annotate__  s#       FZ _i rV   c                	sl    V! V4      p\        R VP                  R/ 4      4      pV P                  VR&   V# )r.   r'  pydantic_internal_union_tag_key)r   Z
setdefaultr  )r[   r  r   r   r'  r   rT   r   Z Tag.__get_pydantic_core_schema__  s9    %(9(9*b(IJ6:hh23rV   rP   N)r^   r_   r`   ra   rb   rc   r   rd   rP   rV   rT   rD   rD   I  s    HT 
H rV   c                  st    ] tR tRt$ RtR]R&    RtR]R&    RtR]R&    RtR	]R
&    R R lt	RR R llt
RtR# )rE   i  ac	  !!! abstract "Usage Documentation"
    [Discriminated Unions with `Callable` `Discriminator`](../concepts/unions.md#discriminated-unions-with-callable-discriminator)

Provides a way to use a custom callable as the way to extract the value of a union discriminator.

This allows you to get validation behavior like you'd get from `Field(discriminator=<field_name>)`,
but without needing to have a single shared field across all the union choices. This also makes it
possible to handle unions of models and primitive types with discriminated-union-style validation errors.
Finally, this allows you to use a custom callable as the way to identify which member of a union a value
belongs to, while still seeing all the performance benefits of a discriminated union.

Consider this example, which is much more performant with the use of `Discriminator` and thus a `TaggedUnion`
than it would be as a normal `Union`.

```python
from typing import Annotated, Any, Literal, Union

from pydantic import BaseModel, Discriminator, Tag

class Pie(BaseModel):
    time_to_cook: int
    num_ingredients: int

class ApplePie(Pie):
    fruit: Literal['apple'] = 'apple'

class PumpkinPie(Pie):
    filling: Literal['pumpkin'] = 'pumpkin'

def get_discriminator_value(v: Any) -> str:
    if isinstance(v, dict):
        return v.get('fruit', v.get('filling'))
    return getattr(v, 'fruit', getattr(v, 'filling', None))

class ThanksgivingDinner(BaseModel):
    dessert: Annotated[
        Union[
            Annotated[ApplePie, Tag('apple')],
            Annotated[PumpkinPie, Tag('pumpkin')],
        ],
        Discriminator(get_discriminator_value),
    ]

apple_variation = ThanksgivingDinner.model_validate(
    {'dessert': {'fruit': 'apple', 'time_to_cook': 60, 'num_ingredients': 8}}
)
print(repr(apple_variation))
'''
ThanksgivingDinner(dessert=ApplePie(time_to_cook=60, num_ingredients=8, fruit='apple'))
'''

pumpkin_variation = ThanksgivingDinner.model_validate(
    {
        'dessert': {
            'filling': 'pumpkin',
            'time_to_cook': 40,
            'num_ingredients': 6,
        }
    }
)
print(repr(pumpkin_variation))
'''
ThanksgivingDinner(dessert=PumpkinPie(time_to_cook=40, num_ingredients=6, filling='pumpkin'))
'''
```

See the [Discriminated Unions] concepts docs for more details on how to use `Discriminator`s.

[Discriminated Unions]: ../concepts/unions.md#discriminated-unions
zstr | Callable[[Any], Hashable]discriminatorNz
str | Noner$  rI  z#dict[str, int | str | float] | Nonecustom_error_contextc               r   r  rP   rQ   rS   rT   rU   Discriminator.__annotate__  s(     
B 
B 
BFZ 
B_i 
BrV   c                	sD   \        \        V4      4      '       g$   \        \        V 4      P                   R V 24      h\        V P                  \        4      '       d,   ^ RIH	p V! \        W! V P                  R7      3,          4      # V! V4      pV P                  WB4      # )z% must be used with a Union type, not )Field)r  )r"   r!   r  r   r^   r   r  r   Zpydanticr  r   _convert_schema)r[   r  r   r  original_schemar   rT   r   Z*Discriminator.__get_pydantic_core_schema__  s    z+677tDz2233XYdXefggd((#..&9[%dFXFX2Y%YZ[[%k2O''AArV   c               r   )rM   r  r   r   zGetCoreSchemaHandler | NonerN   zcore_schema.TaggedUnionSchemarP   rQ   rS   rT   rU   r    s$     >
 >
5>
@[>
	&>
rV   c                	s   VR ,          R8w  d   \         P                  ! V.4      p/ pVR,           F  pRp\        V\        4      '       d   Vw  rE\	        RVP                  R4      4      pVe   VP                  R4      ;'       g    TpVfj   VeQ   VR ,          R8X  dC    VP                  V4      p\	        RVP                  R4      4      pVe   VP                  R4      pVf   \        RV R	2R
R7      hWCV&   K  	  V P                  pVf   VP                  R4      pV P                  pVf   VP                  R4      pV P                  p	V	f   VP                  R4      p	Vf   VP                  R4      MTp\         P                  ! VV P                  VVV	VP                  R4      VP                  R4      VP                  R4      VP                  R4      R7	      #   \         d     EL
i ; i)r   ZunionZchoicesNzCoreMetadata | Noner'  r  zdefinition-refz`Tag` not provided for choice z used with `Discriminator`zcallable-discriminator-no-tagr   r$  rI  r  rJ   refr   )r$  rI  r  rJ   r  r'  r   )r   r%  r   Ztupler   r   Zresolve_ref_schemaZLookupErrorr+   r$  rI  r  Ztagged_union_schemar  )
r[   r  r   Ztagged_union_choicesZchoicer  r'  r$  rI  r  s
   &&&       rT   r  ZDiscriminator._convert_schema  s    6"g-
 *667HIO!%i00FC&%(($16::j3IJH#ll#DELL{&6&>=M+MR!(!;!;F!C $((=vzz*?U#V#/"*,,/P"QC;+8@Z[<  )/%3 18 !22$ / 3 34G H#88'#2#6#67M#N #88'#2#6#67M#N HYHaO//0CDgx.. /!5!5"&&x0##E*$((4)--o>

 
	
9 ' s   !GG-,G-rP   rX   )r^   r_   r`   ra   rb   rc   r$  rI  r  r   r  rd   rP   rV   rT   rE   rE     sW    EN 32
 %)z( (,*+*@D=D*
B>
 >
rV   c               r   )rM   r  r   rN   r   rP   rQ   rS   rT   rU   rU   F  s     8 8c 8c 8rV   c                sP   \        V 4      pV\        9   d   VP                  # \        V \        4      '       d   R # \        V \
        4      '       d   R# \        V \        4      '       d   R# \        V \        4      '       d   R# \        V \        4      '       d   R# \        VRR4      # )rO   rr   r   r   dictr^   z<no type name>)
r   _JSON_TYPESr^   r   rO   rr   r   r   r  r  )r  Ztype_r?  rT   _get_type_namer  F  s    GE~~ !S!U!S!T!T 5*&677rV   c                  ,    ] tR tRt]R R l4       tRtR# )_AllowAnyJsoni[  c               r   r  rP   rQ   rS   rT   rU   Z_AllowAnyJson.__annotate__]  s(     t ts tEY t^h trV   c                	sh    V! V4      p\         P                  ! \         P                  ! 4       VR 7      # ))r   r  )r   r  r  )r   r  r   r  r   rT   r   Z*_AllowAnyJson.__get_pydantic_core_schema__\  s)    ,00[=S=S=UerssrV   rP   Nr^   r_   r`   ra   r   r   rd   rP   rV   rT   r  r  [  s    t trV   r  r   r   r  r   rI   rO   rr   ZNoneTypezinvalid-json-valuez input was not a valid JSON valuerH  c                  r  )_OnErrorOmiti  c               r   r  rP   rQ   rS   rT   rU   Z_OnErrorOmit.__annotate__  s(     ] ]s ]EY ]^h ]rV   c                	s>    \         P                  ! V! V4      R R7      # )Zomit)r   Zon_error)r   Zwith_default_schema)r   r  r   r   rT   r   Z)_OnErrorOmit.__get_pydantic_core_schema__  s    
 ..gk6JU[\\rV   rP   Nr  rP   rV   rT   r  r    s    ] ]rV   r  c                  s*    ] tR tRt$ RtRtR]R&   RtR# )rG   i  a  A `FailFast` annotation can be used to specify that validation should stop at the first error.

This can be useful when you want to validate a large amount of data and you only need to know if it's valid or not.

You might want to enable this setting if you want to validate your data faster (basically, if you use this,
validation will be more performant with the caveat that you get less information).

```python
from typing import Annotated

from pydantic import BaseModel, FailFast, ValidationError

class Model(BaseModel):
    x: Annotated[list[int], FailFast()]

# This will raise a single error for the first invalid value and stop validation
try:
    obj = Model(x=[1, 2, 'a', 4, 5, 'b', 7, 8, 9, 'c'])
except ValidationError as e:
    print(e)
    '''
    1 validation error for Model
    x.2
      Input should be a valid integer, unable to parse string as an integer [type=int_parsing, input_value='a', input_type=str]
    '''
```
TrI   	fail_fastrP   N)r^   r_   r`   ra   rb   r  rc   rd   rP   rV   rT   rG   rG     s    8 ItrV   )@r/   	StrictStr
SocketPathry   r   r   r   r   r0   rp   PositiveIntNegativeIntNonNegativeIntNonPositiveIntrt   PositiveFloatNegativeFloatNonNegativeFloatNonPositiveFloatFiniteFloatr   UUID1UUID3UUID4UUID5UUID6UUID7UUID8FilePathDirectoryPathNewPathr1   r2   r3   r4   
StrictBoolStrictBytes	StrictIntStrictFloatr5   r6   r7   r8   r9   r:   rk  r;   r<   r=   r>   r?   r@   rA   Base64Bytes	Base64StrBase64UrlBytesBase64UrlStrrB   rC   rD   rE   rF   OnErrorOmitrG   rP   )__conditional_annotations__rb   Z
__future__r    Z_annotationsr  ZdataclassesZ_dataclassesr[  Zcollections.abcr   r   r   r   rS  r   Zenumr   Zpathlibr   r   Ztypesr	   Ztypingr
   r   r   r   r   r   r   r   r   r   r   r   rm   r   r   r   Zpydantic_corer   r   r   r   Ztyping_extensionsr   r   r   r   r    r!   Ztyping_inspection.introspectionr"   Z	_internalr#   r$   r%   r&   Z
_migrationr'   Zannotated_handlersr(   r)   Zerrorsr+   r   r,   Zwarningsr-   Z_internal._core_metadatar.   Z__all__rH   Z	dataclassZPydanticMetadatar/   rI   r  rp   rO   ZGtr  ZLtr  ZLer  ZGer  r  r=   rt   rr   r  r  r  r  r  r  ry   rw   r  ZGroupedMetadatarC   r   r   r  r   r   r   r   r   r   r0   r   Z
slots_truer   r  r  r  r  r  r  r  r   r  r  r  r  r1   r   r   r  r2   r  r  r  r3   r4   r1  r5   r6   r   r7   r8   rk  r;   r<   r9   r:   r>   rA   r  r?   r@   r  r  r  r  r^   r  rB   rD   rE   r   r  r   r  r  r  rF   rc   r  r  rG   )r  s   @rT   <module>r     s
   > 2  " 	 . #          8 8 X X b b ; H H ) J % ( /6AH CL !W%%| ! !8 tVX~&
 :
TT T 	T
 T T #Tn _//223< _//223< 3 2 21 556< 3 2 21 556< c68m$	. ('** ( (0VV V 	V
 V V !%V "&Vr %!3!3A!667< %!3!3A!667< UO$6$6q$99: < UO$6$6q$99: < vd|+,& {5112$! " 	. vx( 4 t$477 4 %4nO$(O !O !	O
 O "O "O *.Od c68m$	 5 -X> WCGWbfW ]CG]bf]  m$X "X "	X
 !%XD )
Wc\*Ly" y"~[[  $[  $	[
  $[  $[ )-[ "[ "&[ "&[B 9-889$- $- :$-N 	$A&' 	$A&' 	$A&' 	$A&' 	$A&' 	$A&' 	$A&'" 7* 7* 7*t T8F++,(R $/0(R D(5/)
* ntXh//0
 ' Wc\"D[- [-B \T2
"'*% "8][$ ]@)4;z* 4n@3S! @3F<,u% <HsD  }&
d d
dT]s ]Fv
 s#H49%J &   (  	
  : hm,Mhm,MXs]+Lx}-N# #&# #&" "&$ $."h "J%O %P% %P 9-889_" _" :_"D 9-889_" _" :_"D |MBBCLZ c:m<<=	-\ 5,7G"HHI* j1ABBC,  ) 9-889+ + :+\ F-88FFQ Q GQh F-88FFa
 a
 Ga
H E3dD$t*=8*t t  [S+	Iy )X ${+S[89$sK/0#f+=>#s5z/*$F+,#s5z/*%W-.$J/02 "6%G
 	
I,] ] <( w''  rV   