Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use __new__ in .pyi for Rust types #743

Merged
merged 1 commit into from
Jul 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions python/pydantic_core/_pydantic_core.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class Some(Generic[_T]):

@final
class SchemaValidator:
def __init__(self, schema: CoreSchema, config: CoreConfig | None = None) -> None: ...
def __new__(cls, schema: CoreSchema, config: CoreConfig | None = None) -> Self: ...
@property
def title(self) -> str: ...
def validate_python(
Expand Down Expand Up @@ -103,7 +103,7 @@ _IncEx: TypeAlias = set[int] | set[str] | dict[int, _IncEx] | dict[str, _IncEx]

@final
class SchemaSerializer:
def __init__(self, schema: CoreSchema, config: CoreConfig | None = None) -> None: ...
def __new__(cls, schema: CoreSchema, config: CoreConfig | None = None) -> Self: ...
def to_python(
self,
value: Any,
Expand Down Expand Up @@ -164,7 +164,7 @@ def to_jsonable_python(
) -> Any: ...

class Url(SupportsAllComparisons):
def __init__(self, url: str) -> None: ...
def __new__(cls, url: str) -> Self: ...
@property
def scheme(self) -> str: ...
@property
Expand All @@ -189,7 +189,7 @@ class Url(SupportsAllComparisons):
def __deepcopy__(self, memo: dict) -> str: ...

class MultiHostUrl(SupportsAllComparisons):
def __init__(self, url: str) -> None: ...
def __new__(cls, url: str) -> Self: ...
@property
def scheme(self) -> str: ...
@property
Expand Down Expand Up @@ -233,9 +233,9 @@ class ValidationError(ValueError):

@final
class PydanticCustomError(ValueError):
def __init__(
self, error_type: LiteralString, message_template: LiteralString, context: dict[str, Any] | None = None
) -> None: ...
def __new__(
cls, error_type: LiteralString, message_template: LiteralString, context: dict[str, Any] | None = None
) -> Self: ...
@property
def context(self) -> dict[str, Any] | None: ...
@property
Expand All @@ -246,9 +246,9 @@ class PydanticCustomError(ValueError):

@final
class PydanticKnownError(ValueError):
def __init__(
self, error_type: ErrorType, context: dict[str, str | int | float | decimal.Decimal] | None = None
) -> None: ...
def __new__(
cls, error_type: ErrorType, context: dict[str, str | int | float | decimal.Decimal] | None = None
) -> Self: ...
@property
def context(self) -> dict[str, str | int | float] | None: ...
@property
Expand All @@ -259,23 +259,23 @@ class PydanticKnownError(ValueError):

@final
class PydanticOmit(Exception):
def __new__(self) -> PydanticOmit: ...
def __new__(cls) -> Self: ...

@final
class PydanticUseDefault(Exception):
def __new__(self) -> PydanticUseDefault: ...
def __new__(cls) -> Self: ...

@final
class PydanticSerializationError(ValueError):
def __init__(self, message: str) -> None: ...
def __new__(cls, message: str) -> Self: ...

@final
class PydanticSerializationUnexpectedValue(ValueError):
def __init__(self, message: str | None = None) -> None: ...
def __new__(cls, message: str | None = None) -> Self: ...

@final
class ArgsKwargs:
def __init__(self, args: tuple[Any, ...], kwargs: dict[str, Any] | None = None) -> None: ...
def __new__(cls, args: tuple[Any, ...], kwargs: dict[str, Any] | None = None) -> Self: ...
@property
def args(self) -> tuple[Any, ...]: ...
@property
Expand Down