Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite1f9d15

Browse files
authored
Bumppydantic-core to v2.35.1 (#11963)
1 parent88c75cd commite1f9d15

File tree

12 files changed

+203
-140
lines changed

12 files changed

+203
-140
lines changed

‎docs/api/standard_library_types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ event = Event(dt='2032-04-23T10:20:30.400+02:30')
8181

8282
print(event.model_dump())
8383
"""
84-
{'dt': datetime.datetime(2032, 4, 23, 10, 20, 30, 400000, tzinfo=TzInfo(+02:30))}
84+
{'dt': datetime.datetime(2032, 4, 23, 10, 20, 30, 400000, tzinfo=TzInfo(9000))}
8585
"""
8686
```
8787

‎docs/why.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ Functional validators and serializers, as well as a powerful protocol for custom
363363

364364

365365
print(Meeting(when='2020-01-01T12:00+01:00'))
366-
#> when=datetime.datetime(2020, 1, 1, 12, 0, tzinfo=TzInfo(+01:00))
366+
#> when=datetime.datetime(2020, 1, 1, 12, 0, tzinfo=TzInfo(3600))
367367
print(Meeting(when='now'))
368368
#> when=datetime.datetime(2032, 1, 2, 3, 4, 5, 6)
369369
print(Meeting(when='2020-01-01T12:00'))

‎pydantic/_internal/_core_utils.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
from __future__importannotations
22

33
importinspect
4-
importos
54
fromcollections.abcimportMapping,Sequence
65
fromtypingimportTYPE_CHECKING,Any,Union
76

87
frompydantic_coreimportCoreSchema,core_schema
9-
frompydantic_coreimportvalidate_core_schemaas_validate_core_schema
108
fromtyping_extensionsimportTypeGuard,get_args,get_origin
119
fromtyping_inspectionimporttyping_objects
1210

@@ -109,12 +107,6 @@ def get_ref(s: core_schema.CoreSchema) -> None | str:
109107
returns.get('ref',None)
110108

111109

112-
defvalidate_core_schema(schema:CoreSchema)->CoreSchema:
113-
ifos.getenv('PYDANTIC_VALIDATE_CORE_SCHEMAS'):
114-
return_validate_core_schema(schema)
115-
returnschema
116-
117-
118110
def_clean_schema_for_pretty_print(obj:Any,strip_metadata:bool=True)->Any:# pragma: no cover
119111
"""A utility function to remove irrelevant information from a core schema."""
120112
ifisinstance(obj,Mapping):

‎pydantic/_internal/_generate_schema.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@
7070
get_ref,
7171
get_type_ref,
7272
is_list_like_schema_with_items_schema,
73-
validate_core_schema,
7473
)
7574
from ._decoratorsimport (
7675
Decorator,
@@ -655,9 +654,7 @@ def _apply_discriminator_to_union(
655654
returnschema
656655

657656
defclean_schema(self,schema:CoreSchema)->CoreSchema:
658-
schema=self.defs.finalize_schema(schema)
659-
schema=validate_core_schema(schema)
660-
returnschema
657+
returnself.defs.finalize_schema(schema)
661658

662659
def_add_js_function(self,metadata_schema:CoreSchema,js_function:Callable[...,Any])->None:
663660
metadata=metadata_schema.get('metadata', {})

‎pydantic/functional_serializers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ def dec(f: FieldSerializer) -> _decorators.PydanticDescriptorProxy[Any]:
300300
ifTYPE_CHECKING:
301301
# The first argument in the following callables represent the `self` type:
302302

303-
ModelPlainSerializerWithInfo:TypeAlias=Callable[[Any,SerializationInfo],Any]
303+
ModelPlainSerializerWithInfo:TypeAlias=Callable[[Any,SerializationInfo[Any]],Any]
304304
"""A model serializer method with the `info` argument, in `plain` mode."""
305305

306306
ModelPlainSerializerWithoutInfo:TypeAlias=Callable[[Any],Any]
@@ -309,7 +309,7 @@ def dec(f: FieldSerializer) -> _decorators.PydanticDescriptorProxy[Any]:
309309
ModelPlainSerializer:TypeAlias='ModelPlainSerializerWithInfo | ModelPlainSerializerWithoutInfo'
310310
"""A model serializer method in `plain` mode."""
311311

312-
ModelWrapSerializerWithInfo:TypeAlias=Callable[[Any,SerializerFunctionWrapHandler,SerializationInfo],Any]
312+
ModelWrapSerializerWithInfo:TypeAlias=Callable[[Any,SerializerFunctionWrapHandler,SerializationInfo[Any]],Any]
313313
"""A model serializer method with the `info` argument, in `wrap` mode."""
314314

315315
ModelWrapSerializerWithoutInfo:TypeAlias=Callable[[Any,SerializerFunctionWrapHandler],Any]

‎pydantic/functional_validators.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ class _OnlyValueValidatorClsMethod(Protocol):
328328
def__call__(self,cls:Any,value:Any,/)->Any: ...
329329

330330
class_V2ValidatorClsMethod(Protocol):
331-
def__call__(self,cls:Any,value:Any,info:core_schema.ValidationInfo,/)->Any: ...
331+
def__call__(self,cls:Any,value:Any,info:core_schema.ValidationInfo[Any],/)->Any: ...
332332

333333
class_OnlyValueWrapValidatorClsMethod(Protocol):
334334
def__call__(self,cls:Any,value:Any,handler:core_schema.ValidatorFunctionWrapHandler,/)->Any: ...
@@ -339,7 +339,7 @@ def __call__(
339339
cls:Any,
340340
value:Any,
341341
handler:core_schema.ValidatorFunctionWrapHandler,
342-
info:core_schema.ValidationInfo,
342+
info:core_schema.ValidationInfo[Any],
343343
/,
344344
)->Any: ...
345345

@@ -600,7 +600,7 @@ def __call__( # noqa: D102
600600
# or anything else that gets passed to validate_python
601601
# thus validators _must_ handle all cases
602602
value:Any,
603-
info:core_schema.ValidationInfo,
603+
info:core_schema.ValidationInfo[Any],
604604
/,
605605
)->Any: ...
606606

@@ -615,7 +615,7 @@ def __call__( # noqa: D102
615615
# or anything else that gets passed to validate_python
616616
# thus validators _must_ handle all cases
617617
value:Any,
618-
info:core_schema.ValidationInfo,
618+
info:core_schema.ValidationInfo[Any],
619619
/,
620620
)->Any: ...
621621

@@ -625,7 +625,7 @@ def __call__( # noqa: D102
625625
have info argument.
626626
"""
627627

628-
ModelAfterValidator=Callable[[_ModelType,core_schema.ValidationInfo],_ModelType]
628+
ModelAfterValidator=Callable[[_ModelType,core_schema.ValidationInfo[Any]],_ModelType]
629629
"""A `@model_validator` decorated function signature. This is used when `mode='after'`."""
630630

631631
_AnyModelWrapValidator=Union[ModelWrapValidator[_ModelType],ModelWrapValidatorWithoutInfo[_ModelType]]

‎pydantic/main.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,7 @@ def model_dump_json(
480480
self,
481481
*,
482482
indent:int|None=None,
483+
ensure_ascii:bool=False,
483484
include:IncEx|None=None,
484485
exclude:IncEx|None=None,
485486
context:Any|None=None,
@@ -499,6 +500,8 @@ def model_dump_json(
499500
500501
Args:
501502
indent: Indentation to use in the JSON output. If None is passed, the output will be compact.
503+
ensure_ascii: If `True`, the output is guaranteed to have all incoming non-ASCII characters escaped.
504+
If `False` (the default), these characters will be output as-is.
502505
include: Field(s) to include in the JSON output.
503506
exclude: Field(s) to exclude from the JSON output.
504507
context: Additional context to pass to the serializer.
@@ -519,6 +522,7 @@ def model_dump_json(
519522
returnself.__pydantic_serializer__.to_json(
520523
self,
521524
indent=indent,
525+
ensure_ascii=ensure_ascii,
522526
include=include,
523527
exclude=exclude,
524528
context=context,

‎pydantic/type_adapter.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,7 @@ def dump_json(
591591
/,
592592
*,
593593
indent:int|None=None,
594+
ensure_ascii:bool=False,
594595
include:IncEx|None=None,
595596
exclude:IncEx|None=None,
596597
by_alias:bool|None=None,
@@ -611,6 +612,8 @@ def dump_json(
611612
Args:
612613
instance: The instance to be serialized.
613614
indent: Number of spaces for JSON indentation.
615+
ensure_ascii: If `True`, the output is guaranteed to have all incoming non-ASCII characters escaped.
616+
If `False` (the default), these characters will be output as-is.
614617
include: Fields to include.
615618
exclude: Fields to exclude.
616619
by_alias: Whether to use alias names for field names.

‎pydantic/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def version_info() -> str:
6666
defcheck_pydantic_core_version()->bool:
6767
"""Check that the installed `pydantic-core` dependency is compatible."""
6868
# Keep this in sync with the version constraint in the `pyproject.toml` dependencies:
69-
return__pydantic_core_version__=='2.34.1'
69+
return__pydantic_core_version__=='2.35.1'
7070

7171

7272
defparse_mypy_version(version:str)->tuple[int,int,int]:

‎pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ classifiers = [
4444
]
4545
requires-python ='>=3.9'
4646
dependencies = [
47-
'typing-extensions>=4.12.2',
47+
'typing-extensions>=4.13.0',
4848
'annotated-types>=0.6.0',
4949
# Keep this in sync with the version in the `check_pydantic_core_version()` function:
50-
'pydantic-core==2.34.1',
50+
'pydantic-core==2.35.1',
5151
'typing-inspection>=0.4.0',
5252
]
5353
dynamic = ['version','readme']

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp