Skip to content

Commit

Permalink
use __new__ in .pyi for Rust types (#743)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhewitt authored Jul 5, 2023
1 parent d08d269 commit 4527b80
Showing 1 changed file with 15 additions and 15 deletions.
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

0 comments on commit 4527b80

Please sign in to comment.