Skip to content

Commit

Permalink
Fix annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
Viicos committed Mar 4, 2024
1 parent 2c364ce commit 6c89119
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pydantic/networks.py
Expand Up @@ -8,7 +8,7 @@
from typing import TYPE_CHECKING, Any

from pydantic_core import MultiHostUrl, PydanticCustomError, Url, core_schema
from typing_extensions import Annotated, TypeAlias
from typing_extensions import Annotated, Self, TypeAlias

from ._internal import _fields, _repr, _schema_generation_shared
from ._migration import getattr_migration
Expand Down Expand Up @@ -494,11 +494,11 @@ def __get_pydantic_core_schema__(
)

@classmethod
def _validate(cls, input_value: NameEmail | str, /) -> NameEmail:
def _validate(cls, input_value: Self | str, /) -> Self:
if isinstance(input_value, cls):
return input_value
else:
name, email = validate_email(input_value) # type: ignore[arg-type]
name, email = validate_email(input_value)
return cls(name, email)

def __str__(self) -> str:
Expand Down

0 comments on commit 6c89119

Please sign in to comment.