Skip to content

Commit

Permalink
Replace __spec__.parent with __package__ (#9331)
Browse files Browse the repository at this point in the history
  • Loading branch information
hramezani committed Apr 28, 2024
1 parent 04d4501 commit 77d5f66
Showing 1 changed file with 130 additions and 130 deletions.
260 changes: 130 additions & 130 deletions pydantic/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,145 +220,145 @@

# A mapping of {<member name>: (package, <module name>)} defining dynamic imports
_dynamic_imports: 'dict[str, tuple[str, str]]' = {
'dataclasses': (__package__, '__module__'),
'dataclasses': (__spec__.parent, '__module__'),
# functional validators
'field_validator': (__package__, '.functional_validators'),
'model_validator': (__package__, '.functional_validators'),
'AfterValidator': (__package__, '.functional_validators'),
'BeforeValidator': (__package__, '.functional_validators'),
'PlainValidator': (__package__, '.functional_validators'),
'WrapValidator': (__package__, '.functional_validators'),
'SkipValidation': (__package__, '.functional_validators'),
'InstanceOf': (__package__, '.functional_validators'),
'field_validator': (__spec__.parent, '.functional_validators'),
'model_validator': (__spec__.parent, '.functional_validators'),
'AfterValidator': (__spec__.parent, '.functional_validators'),
'BeforeValidator': (__spec__.parent, '.functional_validators'),
'PlainValidator': (__spec__.parent, '.functional_validators'),
'WrapValidator': (__spec__.parent, '.functional_validators'),
'SkipValidation': (__spec__.parent, '.functional_validators'),
'InstanceOf': (__spec__.parent, '.functional_validators'),
# JSON Schema
'WithJsonSchema': (__package__, '.json_schema'),
'WithJsonSchema': (__spec__.parent, '.json_schema'),
# functional serializers
'field_serializer': (__package__, '.functional_serializers'),
'model_serializer': (__package__, '.functional_serializers'),
'PlainSerializer': (__package__, '.functional_serializers'),
'SerializeAsAny': (__package__, '.functional_serializers'),
'WrapSerializer': (__package__, '.functional_serializers'),
'field_serializer': (__spec__.parent, '.functional_serializers'),
'model_serializer': (__spec__.parent, '.functional_serializers'),
'PlainSerializer': (__spec__.parent, '.functional_serializers'),
'SerializeAsAny': (__spec__.parent, '.functional_serializers'),
'WrapSerializer': (__spec__.parent, '.functional_serializers'),
# config
'ConfigDict': (__package__, '.config'),
'with_config': (__package__, '.config'),
'ConfigDict': (__spec__.parent, '.config'),
'with_config': (__spec__.parent, '.config'),
# validate call
'validate_call': (__package__, '.validate_call_decorator'),
'validate_call': (__spec__.parent, '.validate_call_decorator'),
# errors
'PydanticErrorCodes': (__package__, '.errors'),
'PydanticUserError': (__package__, '.errors'),
'PydanticSchemaGenerationError': (__package__, '.errors'),
'PydanticImportError': (__package__, '.errors'),
'PydanticUndefinedAnnotation': (__package__, '.errors'),
'PydanticInvalidForJsonSchema': (__package__, '.errors'),
'PydanticErrorCodes': (__spec__.parent, '.errors'),
'PydanticUserError': (__spec__.parent, '.errors'),
'PydanticSchemaGenerationError': (__spec__.parent, '.errors'),
'PydanticImportError': (__spec__.parent, '.errors'),
'PydanticUndefinedAnnotation': (__spec__.parent, '.errors'),
'PydanticInvalidForJsonSchema': (__spec__.parent, '.errors'),
# fields
'Field': (__package__, '.fields'),
'computed_field': (__package__, '.fields'),
'PrivateAttr': (__package__, '.fields'),
'Field': (__spec__.parent, '.fields'),
'computed_field': (__spec__.parent, '.fields'),
'PrivateAttr': (__spec__.parent, '.fields'),
# alias
'AliasChoices': (__package__, '.aliases'),
'AliasGenerator': (__package__, '.aliases'),
'AliasPath': (__package__, '.aliases'),
'AliasChoices': (__spec__.parent, '.aliases'),
'AliasGenerator': (__spec__.parent, '.aliases'),
'AliasPath': (__spec__.parent, '.aliases'),
# main
'BaseModel': (__package__, '.main'),
'create_model': (__package__, '.main'),
'BaseModel': (__spec__.parent, '.main'),
'create_model': (__spec__.parent, '.main'),
# network
'AnyUrl': (__package__, '.networks'),
'AnyHttpUrl': (__package__, '.networks'),
'FileUrl': (__package__, '.networks'),
'HttpUrl': (__package__, '.networks'),
'FtpUrl': (__package__, '.networks'),
'WebsocketUrl': (__package__, '.networks'),
'AnyWebsocketUrl': (__package__, '.networks'),
'UrlConstraints': (__package__, '.networks'),
'EmailStr': (__package__, '.networks'),
'NameEmail': (__package__, '.networks'),
'IPvAnyAddress': (__package__, '.networks'),
'IPvAnyInterface': (__package__, '.networks'),
'IPvAnyNetwork': (__package__, '.networks'),
'PostgresDsn': (__package__, '.networks'),
'CockroachDsn': (__package__, '.networks'),
'AmqpDsn': (__package__, '.networks'),
'RedisDsn': (__package__, '.networks'),
'MongoDsn': (__package__, '.networks'),
'KafkaDsn': (__package__, '.networks'),
'NatsDsn': (__package__, '.networks'),
'MySQLDsn': (__package__, '.networks'),
'MariaDBDsn': (__package__, '.networks'),
'ClickHouseDsn': (__package__, '.networks'),
'validate_email': (__package__, '.networks'),
'AnyUrl': (__spec__.parent, '.networks'),
'AnyHttpUrl': (__spec__.parent, '.networks'),
'FileUrl': (__spec__.parent, '.networks'),
'HttpUrl': (__spec__.parent, '.networks'),
'FtpUrl': (__spec__.parent, '.networks'),
'WebsocketUrl': (__spec__.parent, '.networks'),
'AnyWebsocketUrl': (__spec__.parent, '.networks'),
'UrlConstraints': (__spec__.parent, '.networks'),
'EmailStr': (__spec__.parent, '.networks'),
'NameEmail': (__spec__.parent, '.networks'),
'IPvAnyAddress': (__spec__.parent, '.networks'),
'IPvAnyInterface': (__spec__.parent, '.networks'),
'IPvAnyNetwork': (__spec__.parent, '.networks'),
'PostgresDsn': (__spec__.parent, '.networks'),
'CockroachDsn': (__spec__.parent, '.networks'),
'AmqpDsn': (__spec__.parent, '.networks'),
'RedisDsn': (__spec__.parent, '.networks'),
'MongoDsn': (__spec__.parent, '.networks'),
'KafkaDsn': (__spec__.parent, '.networks'),
'NatsDsn': (__spec__.parent, '.networks'),
'MySQLDsn': (__spec__.parent, '.networks'),
'MariaDBDsn': (__spec__.parent, '.networks'),
'ClickHouseDsn': (__spec__.parent, '.networks'),
'validate_email': (__spec__.parent, '.networks'),
# root_model
'RootModel': (__package__, '.root_model'),
'RootModel': (__spec__.parent, '.root_model'),
# types
'Strict': (__package__, '.types'),
'StrictStr': (__package__, '.types'),
'conbytes': (__package__, '.types'),
'conlist': (__package__, '.types'),
'conset': (__package__, '.types'),
'confrozenset': (__package__, '.types'),
'constr': (__package__, '.types'),
'StringConstraints': (__package__, '.types'),
'ImportString': (__package__, '.types'),
'conint': (__package__, '.types'),
'PositiveInt': (__package__, '.types'),
'NegativeInt': (__package__, '.types'),
'NonNegativeInt': (__package__, '.types'),
'NonPositiveInt': (__package__, '.types'),
'confloat': (__package__, '.types'),
'PositiveFloat': (__package__, '.types'),
'NegativeFloat': (__package__, '.types'),
'NonNegativeFloat': (__package__, '.types'),
'NonPositiveFloat': (__package__, '.types'),
'FiniteFloat': (__package__, '.types'),
'condecimal': (__package__, '.types'),
'condate': (__package__, '.types'),
'UUID1': (__package__, '.types'),
'UUID3': (__package__, '.types'),
'UUID4': (__package__, '.types'),
'UUID5': (__package__, '.types'),
'FilePath': (__package__, '.types'),
'DirectoryPath': (__package__, '.types'),
'NewPath': (__package__, '.types'),
'Json': (__package__, '.types'),
'Secret': (__package__, '.types'),
'SecretStr': (__package__, '.types'),
'SecretBytes': (__package__, '.types'),
'StrictBool': (__package__, '.types'),
'StrictBytes': (__package__, '.types'),
'StrictInt': (__package__, '.types'),
'StrictFloat': (__package__, '.types'),
'PaymentCardNumber': (__package__, '.types'),
'ByteSize': (__package__, '.types'),
'PastDate': (__package__, '.types'),
'FutureDate': (__package__, '.types'),
'PastDatetime': (__package__, '.types'),
'FutureDatetime': (__package__, '.types'),
'AwareDatetime': (__package__, '.types'),
'NaiveDatetime': (__package__, '.types'),
'AllowInfNan': (__package__, '.types'),
'EncoderProtocol': (__package__, '.types'),
'EncodedBytes': (__package__, '.types'),
'EncodedStr': (__package__, '.types'),
'Base64Encoder': (__package__, '.types'),
'Base64Bytes': (__package__, '.types'),
'Base64Str': (__package__, '.types'),
'Base64UrlBytes': (__package__, '.types'),
'Base64UrlStr': (__package__, '.types'),
'GetPydanticSchema': (__package__, '.types'),
'Tag': (__package__, '.types'),
'Discriminator': (__package__, '.types'),
'JsonValue': (__package__, '.types'),
'OnErrorOmit': (__package__, '.types'),
'Strict': (__spec__.parent, '.types'),
'StrictStr': (__spec__.parent, '.types'),
'conbytes': (__spec__.parent, '.types'),
'conlist': (__spec__.parent, '.types'),
'conset': (__spec__.parent, '.types'),
'confrozenset': (__spec__.parent, '.types'),
'constr': (__spec__.parent, '.types'),
'StringConstraints': (__spec__.parent, '.types'),
'ImportString': (__spec__.parent, '.types'),
'conint': (__spec__.parent, '.types'),
'PositiveInt': (__spec__.parent, '.types'),
'NegativeInt': (__spec__.parent, '.types'),
'NonNegativeInt': (__spec__.parent, '.types'),
'NonPositiveInt': (__spec__.parent, '.types'),
'confloat': (__spec__.parent, '.types'),
'PositiveFloat': (__spec__.parent, '.types'),
'NegativeFloat': (__spec__.parent, '.types'),
'NonNegativeFloat': (__spec__.parent, '.types'),
'NonPositiveFloat': (__spec__.parent, '.types'),
'FiniteFloat': (__spec__.parent, '.types'),
'condecimal': (__spec__.parent, '.types'),
'condate': (__spec__.parent, '.types'),
'UUID1': (__spec__.parent, '.types'),
'UUID3': (__spec__.parent, '.types'),
'UUID4': (__spec__.parent, '.types'),
'UUID5': (__spec__.parent, '.types'),
'FilePath': (__spec__.parent, '.types'),
'DirectoryPath': (__spec__.parent, '.types'),
'NewPath': (__spec__.parent, '.types'),
'Json': (__spec__.parent, '.types'),
'Secret': (__spec__.parent, '.types'),
'SecretStr': (__spec__.parent, '.types'),
'SecretBytes': (__spec__.parent, '.types'),
'StrictBool': (__spec__.parent, '.types'),
'StrictBytes': (__spec__.parent, '.types'),
'StrictInt': (__spec__.parent, '.types'),
'StrictFloat': (__spec__.parent, '.types'),
'PaymentCardNumber': (__spec__.parent, '.types'),
'ByteSize': (__spec__.parent, '.types'),
'PastDate': (__spec__.parent, '.types'),
'FutureDate': (__spec__.parent, '.types'),
'PastDatetime': (__spec__.parent, '.types'),
'FutureDatetime': (__spec__.parent, '.types'),
'AwareDatetime': (__spec__.parent, '.types'),
'NaiveDatetime': (__spec__.parent, '.types'),
'AllowInfNan': (__spec__.parent, '.types'),
'EncoderProtocol': (__spec__.parent, '.types'),
'EncodedBytes': (__spec__.parent, '.types'),
'EncodedStr': (__spec__.parent, '.types'),
'Base64Encoder': (__spec__.parent, '.types'),
'Base64Bytes': (__spec__.parent, '.types'),
'Base64Str': (__spec__.parent, '.types'),
'Base64UrlBytes': (__spec__.parent, '.types'),
'Base64UrlStr': (__spec__.parent, '.types'),
'GetPydanticSchema': (__spec__.parent, '.types'),
'Tag': (__spec__.parent, '.types'),
'Discriminator': (__spec__.parent, '.types'),
'JsonValue': (__spec__.parent, '.types'),
'OnErrorOmit': (__spec__.parent, '.types'),
# type_adapter
'TypeAdapter': (__package__, '.type_adapter'),
'TypeAdapter': (__spec__.parent, '.type_adapter'),
# warnings
'PydanticDeprecatedSince20': (__package__, '.warnings'),
'PydanticDeprecatedSince26': (__package__, '.warnings'),
'PydanticDeprecationWarning': (__package__, '.warnings'),
'PydanticDeprecatedSince20': (__spec__.parent, '.warnings'),
'PydanticDeprecatedSince26': (__spec__.parent, '.warnings'),
'PydanticDeprecationWarning': (__spec__.parent, '.warnings'),
# annotated handlers
'GetCoreSchemaHandler': (__package__, '.annotated_handlers'),
'GetJsonSchemaHandler': (__package__, '.annotated_handlers'),
'GetCoreSchemaHandler': (__spec__.parent, '.annotated_handlers'),
'GetJsonSchemaHandler': (__spec__.parent, '.annotated_handlers'),
# generate schema from ._internal
'GenerateSchema': (__package__, '._internal._generate_schema'),
'GenerateSchema': (__spec__.parent, '._internal._generate_schema'),
# pydantic_core stuff
'ValidationError': ('pydantic_core', '.'),
'ValidationInfo': ('pydantic_core', '.core_schema'),
Expand All @@ -367,13 +367,13 @@
'FieldSerializationInfo': ('pydantic_core', '.core_schema'),
'SerializerFunctionWrapHandler': ('pydantic_core', '.core_schema'),
# deprecated, mostly not included in __all__
'root_validator': (__package__, '.deprecated.class_validators'),
'validator': (__package__, '.deprecated.class_validators'),
'BaseConfig': (__package__, '.deprecated.config'),
'Extra': (__package__, '.deprecated.config'),
'parse_obj_as': (__package__, '.deprecated.tools'),
'schema_of': (__package__, '.deprecated.tools'),
'schema_json_of': (__package__, '.deprecated.tools'),
'root_validator': (__spec__.parent, '.deprecated.class_validators'),
'validator': (__spec__.parent, '.deprecated.class_validators'),
'BaseConfig': (__spec__.parent, '.deprecated.config'),
'Extra': (__spec__.parent, '.deprecated.config'),
'parse_obj_as': (__spec__.parent, '.deprecated.tools'),
'schema_of': (__spec__.parent, '.deprecated.tools'),
'schema_json_of': (__spec__.parent, '.deprecated.tools'),
'FieldValidationInfo': ('pydantic_core', '.core_schema'),
}

Expand Down

0 comments on commit 77d5f66

Please sign in to comment.