pyprig 1.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of pyprig might be problematic. Click here for more details.

Files changed (112) hide show
  1. pyprig/__init__.py +464 -0
  2. pyprig/_internal/__init__.py +0 -0
  3. pyprig/_internal/_config.py +408 -0
  4. pyprig/_internal/_core_metadata.py +97 -0
  5. pyprig/_internal/_core_utils.py +156 -0
  6. pyprig/_internal/_dataclasses.py +327 -0
  7. pyprig/_internal/_decorators.py +906 -0
  8. pyprig/_internal/_decorators_v1.py +174 -0
  9. pyprig/_internal/_discriminated_union.py +510 -0
  10. pyprig/_internal/_docs_extraction.py +113 -0
  11. pyprig/_internal/_fields.py +883 -0
  12. pyprig/_internal/_forward_ref.py +23 -0
  13. pyprig/_internal/_generate_schema.py +2980 -0
  14. pyprig/_internal/_generics.py +553 -0
  15. pyprig/_internal/_git.py +27 -0
  16. pyprig/_internal/_import_utils.py +20 -0
  17. pyprig/_internal/_known_annotated_metadata.py +405 -0
  18. pyprig/_internal/_mock_val_ser.py +237 -0
  19. pyprig/_internal/_model_construction.py +833 -0
  20. pyprig/_internal/_namespace_utils.py +299 -0
  21. pyprig/_internal/_repr.py +122 -0
  22. pyprig/_internal/_schema_gather.py +49 -0
  23. pyprig/_internal/_schema_generation_shared.py +126 -0
  24. pyprig/_internal/_serializers.py +53 -0
  25. pyprig/_internal/_signature.py +193 -0
  26. pyprig/_internal/_type_refs.py +128 -0
  27. pyprig/_internal/_typing_extra.py +502 -0
  28. pyprig/_internal/_utils.py +433 -0
  29. pyprig/_internal/_validate_call.py +141 -0
  30. pyprig/_internal/_validators.py +541 -0
  31. pyprig/_migration.py +317 -0
  32. pyprig/alias_generators.py +62 -0
  33. pyprig/aliases.py +136 -0
  34. pyprig/annotated_handlers.py +123 -0
  35. pyprig/class_validators.py +5 -0
  36. pyprig/color.py +605 -0
  37. pyprig/config.py +1295 -0
  38. pyprig/dataclasses.py +385 -0
  39. pyprig/datetime_parse.py +5 -0
  40. pyprig/decorator.py +5 -0
  41. pyprig/deprecated/__init__.py +0 -0
  42. pyprig/deprecated/class_validators.py +257 -0
  43. pyprig/deprecated/config.py +72 -0
  44. pyprig/deprecated/copy_internals.py +224 -0
  45. pyprig/deprecated/decorator.py +286 -0
  46. pyprig/deprecated/json.py +142 -0
  47. pyprig/deprecated/parse.py +81 -0
  48. pyprig/deprecated/tools.py +104 -0
  49. pyprig/env_settings.py +5 -0
  50. pyprig/error_wrappers.py +5 -0
  51. pyprig/errors.py +185 -0
  52. pyprig/experimental/__init__.py +1 -0
  53. pyprig/experimental/arguments_schema.py +44 -0
  54. pyprig/experimental/missing_sentinel.py +29 -0
  55. pyprig/experimental/pipeline.py +684 -0
  56. pyprig/fields.py +2065 -0
  57. pyprig/functional_serializers.py +461 -0
  58. pyprig/functional_validators.py +920 -0
  59. pyprig/generics.py +5 -0
  60. pyprig/help.py +68 -0
  61. pyprig/json.py +5 -0
  62. pyprig/json_schema.py +3253 -0
  63. pyprig/main.py +1942 -0
  64. pyprig/mypy.py +1465 -0
  65. pyprig/networks.py +1417 -0
  66. pyprig/parse.py +5 -0
  67. pyprig/plugin/__init__.py +190 -0
  68. pyprig/plugin/_loader.py +58 -0
  69. pyprig/plugin/_schema_validator.py +152 -0
  70. pyprig/py.typed +0 -0
  71. pyprig/root_model.py +186 -0
  72. pyprig/schema.py +5 -0
  73. pyprig/tools.py +5 -0
  74. pyprig/type_adapter.py +776 -0
  75. pyprig/types.py +3405 -0
  76. pyprig/typing.py +5 -0
  77. pyprig/utils.py +5 -0
  78. pyprig/v1/__init__.py +131 -0
  79. pyprig/v1/_hypothesis_plugin.py +391 -0
  80. pyprig/v1/annotated_types.py +72 -0
  81. pyprig/v1/class_validators.py +361 -0
  82. pyprig/v1/color.py +494 -0
  83. pyprig/v1/config.py +191 -0
  84. pyprig/v1/dataclasses.py +500 -0
  85. pyprig/v1/datetime_parse.py +248 -0
  86. pyprig/v1/decorator.py +264 -0
  87. pyprig/v1/env_settings.py +350 -0
  88. pyprig/v1/error_wrappers.py +161 -0
  89. pyprig/v1/errors.py +646 -0
  90. pyprig/v1/fields.py +1253 -0
  91. pyprig/v1/generics.py +400 -0
  92. pyprig/v1/json.py +112 -0
  93. pyprig/v1/main.py +1130 -0
  94. pyprig/v1/mypy.py +949 -0
  95. pyprig/v1/networks.py +747 -0
  96. pyprig/v1/parse.py +66 -0
  97. pyprig/v1/py.typed +0 -0
  98. pyprig/v1/schema.py +1163 -0
  99. pyprig/v1/tools.py +92 -0
  100. pyprig/v1/types.py +1205 -0
  101. pyprig/v1/typing.py +627 -0
  102. pyprig/v1/utils.py +807 -0
  103. pyprig/v1/validators.py +768 -0
  104. pyprig/v1/version.py +38 -0
  105. pyprig/validate_call_decorator.py +121 -0
  106. pyprig/validators.py +5 -0
  107. pyprig/version.py +118 -0
  108. pyprig/warnings.py +130 -0
  109. pyprig-1.2.0.dist-info/METADATA +111 -0
  110. pyprig-1.2.0.dist-info/RECORD +112 -0
  111. pyprig-1.2.0.dist-info/WHEEL +4 -0
  112. pyprig-1.2.0.dist-info/licenses/LICENSE +21 -0
pyprig/__init__.py ADDED
@@ -0,0 +1,464 @@
1
+ from importlib import import_module
2
+ from typing import TYPE_CHECKING
3
+ from warnings import warn
4
+
5
+ from ._migration import getattr_migration
6
+ from .version import VERSION, _ensure_pydantic_core_version
7
+
8
+ from .help import get_help
9
+ get_help()
10
+
11
+ _ensure_pydantic_core_version()
12
+ del _ensure_pydantic_core_version
13
+
14
+ if TYPE_CHECKING:
15
+ # import of virtually everything is supported via `__getattr__` below,
16
+ # but we need them here for type checking and IDE support
17
+ import pydantic_core
18
+ from pydantic_core.core_schema import (
19
+ FieldSerializationInfo,
20
+ SerializationInfo,
21
+ SerializerFunctionWrapHandler,
22
+ ValidationInfo,
23
+ ValidatorFunctionWrapHandler,
24
+ )
25
+
26
+ from . import dataclasses
27
+ from .aliases import AliasChoices, AliasGenerator, AliasPath
28
+ from .annotated_handlers import GetCoreSchemaHandler, GetJsonSchemaHandler
29
+ from .config import ConfigDict, with_config
30
+ from .errors import *
31
+ from .fields import Field, PrivateAttr, computed_field
32
+ from .functional_serializers import (
33
+ PlainSerializer,
34
+ SerializeAsAny,
35
+ WrapSerializer,
36
+ field_serializer,
37
+ model_serializer,
38
+ )
39
+ from .functional_validators import (
40
+ AfterValidator,
41
+ BeforeValidator,
42
+ InstanceOf,
43
+ ModelWrapValidatorHandler,
44
+ PlainValidator,
45
+ SkipValidation,
46
+ ValidateAs,
47
+ WrapValidator,
48
+ field_validator,
49
+ model_validator,
50
+ )
51
+ from .json_schema import WithJsonSchema
52
+ from .main import *
53
+ from .networks import *
54
+ from .type_adapter import TypeAdapter
55
+ from .types import *
56
+ from .validate_call_decorator import validate_call
57
+ from .warnings import (
58
+ PydanticDeprecatedSince20,
59
+ PydanticDeprecatedSince26,
60
+ PydanticDeprecatedSince29,
61
+ PydanticDeprecatedSince210,
62
+ PydanticDeprecatedSince211,
63
+ PydanticDeprecatedSince212,
64
+ PydanticDeprecatedSince214,
65
+ PydanticDeprecationWarning,
66
+ PydanticExperimentalWarning,
67
+ )
68
+
69
+ MISSING = pydantic_core.MISSING
70
+ ValidationError = pydantic_core.ValidationError
71
+ from .deprecated.class_validators import root_validator, validator
72
+ from .deprecated.config import BaseConfig, Extra
73
+ from .deprecated.tools import *
74
+ from .root_model import RootModel
75
+
76
+ __version__ = VERSION
77
+ __all__ = (
78
+ # dataclasses
79
+ 'dataclasses',
80
+ # functional validators
81
+ 'field_validator',
82
+ 'model_validator',
83
+ 'AfterValidator',
84
+ 'BeforeValidator',
85
+ 'PlainValidator',
86
+ 'WrapValidator',
87
+ 'SkipValidation',
88
+ 'ValidateAs',
89
+ 'InstanceOf',
90
+ 'ModelWrapValidatorHandler',
91
+ # JSON Schema
92
+ 'WithJsonSchema',
93
+ # deprecated V1 functional validators, these are imported via `__getattr__` below
94
+ 'root_validator',
95
+ 'validator',
96
+ # functional serializers
97
+ 'field_serializer',
98
+ 'model_serializer',
99
+ 'PlainSerializer',
100
+ 'SerializeAsAny',
101
+ 'WrapSerializer',
102
+ # config
103
+ 'ConfigDict',
104
+ 'with_config',
105
+ # deprecated V1 config, these are imported via `__getattr__` below
106
+ 'BaseConfig',
107
+ 'Extra',
108
+ # validate_call
109
+ 'validate_call',
110
+ # errors
111
+ 'PydanticErrorCodes',
112
+ 'PydanticUserError',
113
+ 'PydanticSchemaGenerationError',
114
+ 'PydanticImportError',
115
+ 'PydanticUndefinedAnnotation',
116
+ 'PydanticInvalidForJsonSchema',
117
+ 'PydanticForbiddenQualifier',
118
+ # fields
119
+ 'Field',
120
+ 'computed_field',
121
+ 'PrivateAttr',
122
+ # alias
123
+ 'AliasChoices',
124
+ 'AliasGenerator',
125
+ 'AliasPath',
126
+ # main
127
+ 'BaseModel',
128
+ 'create_model',
129
+ # network
130
+ 'AnyUrl',
131
+ 'AnyHttpUrl',
132
+ 'FileUrl',
133
+ 'HttpUrl',
134
+ 'FtpUrl',
135
+ 'WebsocketUrl',
136
+ 'AnyWebsocketUrl',
137
+ 'UrlConstraints',
138
+ 'EmailStr',
139
+ 'NameEmail',
140
+ 'IPvAnyAddress',
141
+ 'IPvAnyInterface',
142
+ 'IPvAnyNetwork',
143
+ 'PostgresDsn',
144
+ 'CockroachDsn',
145
+ 'AmqpDsn',
146
+ 'RedisDsn',
147
+ 'MongoDsn',
148
+ 'KafkaDsn',
149
+ 'NatsDsn',
150
+ 'MySQLDsn',
151
+ 'MariaDBDsn',
152
+ 'ClickHouseDsn',
153
+ 'SnowflakeDsn',
154
+ 'validate_email',
155
+ # root_model
156
+ 'RootModel',
157
+ # deprecated tools, these are imported via `__getattr__` below
158
+ 'parse_obj_as',
159
+ 'schema_of',
160
+ 'schema_json_of',
161
+ # types
162
+ 'Strict',
163
+ 'StrictStr',
164
+ 'conbytes',
165
+ 'conlist',
166
+ 'conset',
167
+ 'confrozenset',
168
+ 'constr',
169
+ 'StringConstraints',
170
+ 'ImportString',
171
+ 'conint',
172
+ 'PositiveInt',
173
+ 'NegativeInt',
174
+ 'NonNegativeInt',
175
+ 'NonPositiveInt',
176
+ 'confloat',
177
+ 'PositiveFloat',
178
+ 'NegativeFloat',
179
+ 'NonNegativeFloat',
180
+ 'NonPositiveFloat',
181
+ 'FiniteFloat',
182
+ 'condecimal',
183
+ 'condate',
184
+ 'UUID1',
185
+ 'UUID3',
186
+ 'UUID4',
187
+ 'UUID5',
188
+ 'UUID6',
189
+ 'UUID7',
190
+ 'UUID8',
191
+ 'FilePath',
192
+ 'DirectoryPath',
193
+ 'NewPath',
194
+ 'Json',
195
+ 'Secret',
196
+ 'SecretStr',
197
+ 'SecretBytes',
198
+ 'SocketPath',
199
+ 'StrictBool',
200
+ 'StrictBytes',
201
+ 'StrictInt',
202
+ 'StrictFloat',
203
+ 'PaymentCardNumber',
204
+ 'ByteSize',
205
+ 'PastDate',
206
+ 'FutureDate',
207
+ 'PastDatetime',
208
+ 'FutureDatetime',
209
+ 'AwareDatetime',
210
+ 'NaiveDatetime',
211
+ 'AllowInfNan',
212
+ 'EncoderProtocol',
213
+ 'EncodedBytes',
214
+ 'EncodedStr',
215
+ 'Base64Encoder',
216
+ 'Base64Bytes',
217
+ 'Base64Str',
218
+ 'Base64UrlBytes',
219
+ 'Base64UrlStr',
220
+ 'GetPydanticSchema',
221
+ 'Tag',
222
+ 'Discriminator',
223
+ 'JsonValue',
224
+ 'FailFast',
225
+ # type_adapter
226
+ 'TypeAdapter',
227
+ # version
228
+ '__version__',
229
+ 'VERSION',
230
+ # warnings
231
+ 'PydanticDeprecatedSince20',
232
+ 'PydanticDeprecatedSince26',
233
+ 'PydanticDeprecatedSince29',
234
+ 'PydanticDeprecatedSince210',
235
+ 'PydanticDeprecatedSince211',
236
+ 'PydanticDeprecatedSince212',
237
+ 'PydanticDeprecatedSince214',
238
+ 'PydanticDeprecationWarning',
239
+ 'PydanticExperimentalWarning',
240
+ # annotated handlers
241
+ 'GetCoreSchemaHandler',
242
+ 'GetJsonSchemaHandler',
243
+ # pydantic_core
244
+ 'MISSING',
245
+ 'ValidationError',
246
+ 'ValidationInfo',
247
+ 'SerializationInfo',
248
+ 'ValidatorFunctionWrapHandler',
249
+ 'FieldSerializationInfo',
250
+ 'SerializerFunctionWrapHandler',
251
+ 'OnErrorOmit',
252
+ )
253
+
254
+ # A mapping of {<member name>: (package, <module name>)} defining dynamic imports
255
+ _dynamic_imports: 'dict[str, tuple[str, str]]' = {
256
+ 'dataclasses': (__spec__.parent, '__module__'),
257
+ # functional validators
258
+ 'field_validator': (__spec__.parent, '.functional_validators'),
259
+ 'model_validator': (__spec__.parent, '.functional_validators'),
260
+ 'AfterValidator': (__spec__.parent, '.functional_validators'),
261
+ 'BeforeValidator': (__spec__.parent, '.functional_validators'),
262
+ 'PlainValidator': (__spec__.parent, '.functional_validators'),
263
+ 'WrapValidator': (__spec__.parent, '.functional_validators'),
264
+ 'SkipValidation': (__spec__.parent, '.functional_validators'),
265
+ 'InstanceOf': (__spec__.parent, '.functional_validators'),
266
+ 'ValidateAs': (__spec__.parent, '.functional_validators'),
267
+ 'ModelWrapValidatorHandler': (__spec__.parent, '.functional_validators'),
268
+ # JSON Schema
269
+ 'WithJsonSchema': (__spec__.parent, '.json_schema'),
270
+ # functional serializers
271
+ 'field_serializer': (__spec__.parent, '.functional_serializers'),
272
+ 'model_serializer': (__spec__.parent, '.functional_serializers'),
273
+ 'PlainSerializer': (__spec__.parent, '.functional_serializers'),
274
+ 'SerializeAsAny': (__spec__.parent, '.functional_serializers'),
275
+ 'WrapSerializer': (__spec__.parent, '.functional_serializers'),
276
+ # config
277
+ 'ConfigDict': (__spec__.parent, '.config'),
278
+ 'with_config': (__spec__.parent, '.config'),
279
+ # validate call
280
+ 'validate_call': (__spec__.parent, '.validate_call_decorator'),
281
+ # errors
282
+ 'PydanticErrorCodes': (__spec__.parent, '.errors'),
283
+ 'PydanticUserError': (__spec__.parent, '.errors'),
284
+ 'PydanticSchemaGenerationError': (__spec__.parent, '.errors'),
285
+ 'PydanticImportError': (__spec__.parent, '.errors'),
286
+ 'PydanticUndefinedAnnotation': (__spec__.parent, '.errors'),
287
+ 'PydanticInvalidForJsonSchema': (__spec__.parent, '.errors'),
288
+ 'PydanticForbiddenQualifier': (__spec__.parent, '.errors'),
289
+ # fields
290
+ 'Field': (__spec__.parent, '.fields'),
291
+ 'computed_field': (__spec__.parent, '.fields'),
292
+ 'PrivateAttr': (__spec__.parent, '.fields'),
293
+ # alias
294
+ 'AliasChoices': (__spec__.parent, '.aliases'),
295
+ 'AliasGenerator': (__spec__.parent, '.aliases'),
296
+ 'AliasPath': (__spec__.parent, '.aliases'),
297
+ # main
298
+ 'BaseModel': (__spec__.parent, '.main'),
299
+ 'create_model': (__spec__.parent, '.main'),
300
+ # network
301
+ 'AnyUrl': (__spec__.parent, '.networks'),
302
+ 'AnyHttpUrl': (__spec__.parent, '.networks'),
303
+ 'FileUrl': (__spec__.parent, '.networks'),
304
+ 'HttpUrl': (__spec__.parent, '.networks'),
305
+ 'FtpUrl': (__spec__.parent, '.networks'),
306
+ 'WebsocketUrl': (__spec__.parent, '.networks'),
307
+ 'AnyWebsocketUrl': (__spec__.parent, '.networks'),
308
+ 'UrlConstraints': (__spec__.parent, '.networks'),
309
+ 'EmailStr': (__spec__.parent, '.networks'),
310
+ 'NameEmail': (__spec__.parent, '.networks'),
311
+ 'IPvAnyAddress': (__spec__.parent, '.networks'),
312
+ 'IPvAnyInterface': (__spec__.parent, '.networks'),
313
+ 'IPvAnyNetwork': (__spec__.parent, '.networks'),
314
+ 'PostgresDsn': (__spec__.parent, '.networks'),
315
+ 'CockroachDsn': (__spec__.parent, '.networks'),
316
+ 'AmqpDsn': (__spec__.parent, '.networks'),
317
+ 'RedisDsn': (__spec__.parent, '.networks'),
318
+ 'MongoDsn': (__spec__.parent, '.networks'),
319
+ 'KafkaDsn': (__spec__.parent, '.networks'),
320
+ 'NatsDsn': (__spec__.parent, '.networks'),
321
+ 'MySQLDsn': (__spec__.parent, '.networks'),
322
+ 'MariaDBDsn': (__spec__.parent, '.networks'),
323
+ 'ClickHouseDsn': (__spec__.parent, '.networks'),
324
+ 'SnowflakeDsn': (__spec__.parent, '.networks'),
325
+ 'validate_email': (__spec__.parent, '.networks'),
326
+ # root_model
327
+ 'RootModel': (__spec__.parent, '.root_model'),
328
+ # types
329
+ 'Strict': (__spec__.parent, '.types'),
330
+ 'StrictStr': (__spec__.parent, '.types'),
331
+ 'conbytes': (__spec__.parent, '.types'),
332
+ 'conlist': (__spec__.parent, '.types'),
333
+ 'conset': (__spec__.parent, '.types'),
334
+ 'confrozenset': (__spec__.parent, '.types'),
335
+ 'constr': (__spec__.parent, '.types'),
336
+ 'StringConstraints': (__spec__.parent, '.types'),
337
+ 'ImportString': (__spec__.parent, '.types'),
338
+ 'conint': (__spec__.parent, '.types'),
339
+ 'PositiveInt': (__spec__.parent, '.types'),
340
+ 'NegativeInt': (__spec__.parent, '.types'),
341
+ 'NonNegativeInt': (__spec__.parent, '.types'),
342
+ 'NonPositiveInt': (__spec__.parent, '.types'),
343
+ 'confloat': (__spec__.parent, '.types'),
344
+ 'PositiveFloat': (__spec__.parent, '.types'),
345
+ 'NegativeFloat': (__spec__.parent, '.types'),
346
+ 'NonNegativeFloat': (__spec__.parent, '.types'),
347
+ 'NonPositiveFloat': (__spec__.parent, '.types'),
348
+ 'FiniteFloat': (__spec__.parent, '.types'),
349
+ 'condecimal': (__spec__.parent, '.types'),
350
+ 'condate': (__spec__.parent, '.types'),
351
+ 'UUID1': (__spec__.parent, '.types'),
352
+ 'UUID3': (__spec__.parent, '.types'),
353
+ 'UUID4': (__spec__.parent, '.types'),
354
+ 'UUID5': (__spec__.parent, '.types'),
355
+ 'UUID6': (__spec__.parent, '.types'),
356
+ 'UUID7': (__spec__.parent, '.types'),
357
+ 'UUID8': (__spec__.parent, '.types'),
358
+ 'FilePath': (__spec__.parent, '.types'),
359
+ 'DirectoryPath': (__spec__.parent, '.types'),
360
+ 'NewPath': (__spec__.parent, '.types'),
361
+ 'Json': (__spec__.parent, '.types'),
362
+ 'Secret': (__spec__.parent, '.types'),
363
+ 'SecretStr': (__spec__.parent, '.types'),
364
+ 'SecretBytes': (__spec__.parent, '.types'),
365
+ 'StrictBool': (__spec__.parent, '.types'),
366
+ 'StrictBytes': (__spec__.parent, '.types'),
367
+ 'StrictInt': (__spec__.parent, '.types'),
368
+ 'StrictFloat': (__spec__.parent, '.types'),
369
+ 'PaymentCardNumber': (__spec__.parent, '.types'),
370
+ 'ByteSize': (__spec__.parent, '.types'),
371
+ 'PastDate': (__spec__.parent, '.types'),
372
+ 'SocketPath': (__spec__.parent, '.types'),
373
+ 'FutureDate': (__spec__.parent, '.types'),
374
+ 'PastDatetime': (__spec__.parent, '.types'),
375
+ 'FutureDatetime': (__spec__.parent, '.types'),
376
+ 'AwareDatetime': (__spec__.parent, '.types'),
377
+ 'NaiveDatetime': (__spec__.parent, '.types'),
378
+ 'AllowInfNan': (__spec__.parent, '.types'),
379
+ 'EncoderProtocol': (__spec__.parent, '.types'),
380
+ 'EncodedBytes': (__spec__.parent, '.types'),
381
+ 'EncodedStr': (__spec__.parent, '.types'),
382
+ 'Base64Encoder': (__spec__.parent, '.types'),
383
+ 'Base64Bytes': (__spec__.parent, '.types'),
384
+ 'Base64Str': (__spec__.parent, '.types'),
385
+ 'Base64UrlBytes': (__spec__.parent, '.types'),
386
+ 'Base64UrlStr': (__spec__.parent, '.types'),
387
+ 'GetPydanticSchema': (__spec__.parent, '.types'),
388
+ 'Tag': (__spec__.parent, '.types'),
389
+ 'Discriminator': (__spec__.parent, '.types'),
390
+ 'JsonValue': (__spec__.parent, '.types'),
391
+ 'OnErrorOmit': (__spec__.parent, '.types'),
392
+ 'FailFast': (__spec__.parent, '.types'),
393
+ # type_adapter
394
+ 'TypeAdapter': (__spec__.parent, '.type_adapter'),
395
+ # warnings
396
+ 'PydanticDeprecatedSince20': (__spec__.parent, '.warnings'),
397
+ 'PydanticDeprecatedSince26': (__spec__.parent, '.warnings'),
398
+ 'PydanticDeprecatedSince29': (__spec__.parent, '.warnings'),
399
+ 'PydanticDeprecatedSince210': (__spec__.parent, '.warnings'),
400
+ 'PydanticDeprecatedSince211': (__spec__.parent, '.warnings'),
401
+ 'PydanticDeprecatedSince212': (__spec__.parent, '.warnings'),
402
+ 'PydanticDeprecatedSince214': (__spec__.parent, '.warnings'),
403
+ 'PydanticDeprecationWarning': (__spec__.parent, '.warnings'),
404
+ 'PydanticExperimentalWarning': (__spec__.parent, '.warnings'),
405
+ # annotated handlers
406
+ 'GetCoreSchemaHandler': (__spec__.parent, '.annotated_handlers'),
407
+ 'GetJsonSchemaHandler': (__spec__.parent, '.annotated_handlers'),
408
+ # pydantic_core stuff
409
+ 'MISSING': ('pydantic_core', '.'),
410
+ 'ValidationError': ('pydantic_core', '.'),
411
+ 'ValidationInfo': ('pydantic_core', '.core_schema'),
412
+ 'SerializationInfo': ('pydantic_core', '.core_schema'),
413
+ 'ValidatorFunctionWrapHandler': ('pydantic_core', '.core_schema'),
414
+ 'FieldSerializationInfo': ('pydantic_core', '.core_schema'),
415
+ 'SerializerFunctionWrapHandler': ('pydantic_core', '.core_schema'),
416
+ # deprecated, mostly not included in __all__
417
+ 'root_validator': (__spec__.parent, '.deprecated.class_validators'),
418
+ 'validator': (__spec__.parent, '.deprecated.class_validators'),
419
+ 'BaseConfig': (__spec__.parent, '.deprecated.config'),
420
+ 'Extra': (__spec__.parent, '.deprecated.config'),
421
+ 'parse_obj_as': (__spec__.parent, '.deprecated.tools'),
422
+ 'schema_of': (__spec__.parent, '.deprecated.tools'),
423
+ 'schema_json_of': (__spec__.parent, '.deprecated.tools'),
424
+ # deprecated dynamic imports
425
+ 'FieldValidationInfo': ('pydantic_core', '.core_schema'),
426
+ 'GenerateSchema': (__spec__.parent, '._internal._generate_schema'),
427
+ }
428
+ _deprecated_dynamic_imports = {'FieldValidationInfo', 'GenerateSchema'}
429
+
430
+ _getattr_migration = getattr_migration(__name__)
431
+
432
+
433
+ def __getattr__(attr_name: str) -> object:
434
+ if attr_name in _deprecated_dynamic_imports:
435
+ from pyprig.warnings import PydanticDeprecatedSince20
436
+
437
+ warn(
438
+ f'Importing {attr_name} from `pyprig` is deprecated. This feature is either no longer supported, or is not public.',
439
+ PydanticDeprecatedSince20,
440
+ stacklevel=2,
441
+ )
442
+
443
+ dynamic_attr = _dynamic_imports.get(attr_name)
444
+ if dynamic_attr is None:
445
+ return _getattr_migration(attr_name)
446
+
447
+ package, module_name = dynamic_attr
448
+
449
+ if module_name == '__module__':
450
+ result = import_module(f'.{attr_name}', package=package)
451
+ globals()[attr_name] = result
452
+ return result
453
+ else:
454
+ module = import_module(module_name, package=package)
455
+ result = getattr(module, attr_name)
456
+ g = globals()
457
+ for k, (_, v_module_name) in _dynamic_imports.items():
458
+ if v_module_name == module_name and k not in _deprecated_dynamic_imports:
459
+ g[k] = getattr(module, k)
460
+ return result
461
+
462
+
463
+ def __dir__() -> list[str]:
464
+ return list(__all__)
File without changes