mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-06 04:04:26 +08:00
Refactors validators types (#284)
* Update __init__.pyi
* It should not fail right now 🤔
* Refactor validators a bit
* Fixes CI
* Update __init__.pyi
This commit is contained in:
committed by
Maksim Kurnikov
parent
cb123de105
commit
7ba578f6b2
@@ -1,6 +1,6 @@
|
||||
from decimal import Decimal
|
||||
from re import RegexFlag
|
||||
from typing import Any, Dict, List, Optional, Union, Pattern, Collection, Callable, Tuple
|
||||
from typing import Any, Callable, Collection, Dict, List, Optional, Pattern, Tuple, Union
|
||||
|
||||
from django.core.files.base import File
|
||||
|
||||
@@ -13,7 +13,7 @@ def _lazy_re_compile(regex: _Regex, flags: int = ...): ...
|
||||
|
||||
class RegexValidator:
|
||||
regex: _Regex = ...
|
||||
message: Any = ...
|
||||
message: str = ...
|
||||
code: str = ...
|
||||
inverse_match: bool = ...
|
||||
flags: int = ...
|
||||
@@ -31,24 +31,24 @@ class URLValidator(RegexValidator):
|
||||
ul: str = ...
|
||||
ipv4_re: str = ...
|
||||
ipv6_re: str = ...
|
||||
hostname_re: Any = ...
|
||||
domain_re: Any = ...
|
||||
tld_re: Any = ...
|
||||
host_re: Any = ...
|
||||
schemes: Any = ...
|
||||
hostname_re: str = ...
|
||||
domain_re: str = ...
|
||||
tld_re: str = ...
|
||||
host_re: str = ...
|
||||
schemes: List[str] = ...
|
||||
def __init__(self, schemes: Optional[Collection[str]] = ..., **kwargs: Any) -> None: ...
|
||||
|
||||
integer_validator: Any
|
||||
integer_validator: RegexValidator = ...
|
||||
|
||||
def validate_integer(value: Optional[Union[float, str]]) -> None: ...
|
||||
|
||||
class EmailValidator:
|
||||
message: str = ...
|
||||
code: str = ...
|
||||
user_regex: Any = ...
|
||||
domain_regex: Any = ...
|
||||
literal_regex: Any = ...
|
||||
domain_whitelist: Any = ...
|
||||
user_regex: Pattern = ...
|
||||
domain_regex: Pattern = ...
|
||||
literal_regex: Pattern = ...
|
||||
domain_whitelist: List[str] = ...
|
||||
def __init__(
|
||||
self,
|
||||
message: Optional[_ErrorMessage] = ...,
|
||||
@@ -68,9 +68,10 @@ def validate_ipv4_address(value: str) -> None: ...
|
||||
def validate_ipv6_address(value: str) -> None: ...
|
||||
def validate_ipv46_address(value: str) -> None: ...
|
||||
|
||||
ip_address_validator_map: Dict[str, Tuple[Callable[[Any], None], str]]
|
||||
_IPValidator = Tuple[Callable[[Any], None], str]
|
||||
ip_address_validator_map: Dict[str, _IPValidator]
|
||||
|
||||
def ip_address_validators(protocol: str, unpack_ipv4: bool) -> Any: ...
|
||||
def ip_address_validators(protocol: str, unpack_ipv4: bool) -> _IPValidator: ...
|
||||
def int_list_validator(
|
||||
sep: str = ..., message: Optional[_ErrorMessage] = ..., code: str = ..., allow_negative: bool = ...
|
||||
) -> RegexValidator: ...
|
||||
@@ -92,7 +93,7 @@ class MinLengthValidator(BaseValidator): ...
|
||||
class MaxLengthValidator(BaseValidator): ...
|
||||
|
||||
class DecimalValidator:
|
||||
messages: Any = ...
|
||||
messages: Dict[str, str] = ...
|
||||
max_digits: int = ...
|
||||
decimal_places: int = ...
|
||||
def __init__(self, max_digits: Optional[Union[int, str]], decimal_places: Optional[Union[int, str]]) -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user