Skip to content

Use less specific types in validators args #49

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

Merged
merged 1 commit into from
Mar 18, 2019
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
11 changes: 7 additions & 4 deletions django-stubs/core/validators.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from datetime import datetime
from decimal import Decimal
from re import RegexFlag
from typing import Any, Dict, List, Optional, Union, Pattern
from typing import Any, Dict, List, Optional, Union, Pattern, Collection
from uuid import UUID

from django.core.files.base import File
Expand Down Expand Up @@ -38,7 +38,7 @@ class URLValidator(RegexValidator):
tld_re: Any = ...
host_re: Any = ...
schemes: Any = ...
def __init__(self, schemes: Optional[List[str]] = ..., **kwargs: Any) -> None: ...
def __init__(self, schemes: Optional[Collection[str]] = ..., **kwargs: Any) -> None: ...

integer_validator: Any

Expand All @@ -52,7 +52,7 @@ class EmailValidator:
literal_regex: Any = ...
domain_whitelist: Any = ...
def __init__(
self, message: Optional[str] = ..., code: Optional[str] = ..., whitelist: Optional[List[str]] = ...
self, message: Optional[str] = ..., code: Optional[str] = ..., whitelist: Optional[Collection[str]] = ...
) -> None: ...
def __call__(self, value: Optional[str]) -> None: ...
def validate_domain_part(self, domain_part: str) -> bool: ...
Expand Down Expand Up @@ -119,7 +119,10 @@ class FileExtensionValidator:
code: str = ...
allowed_extensions: List[str] = ...
def __init__(
self, allowed_extensions: Optional[List[str]] = ..., message: Optional[str] = ..., code: Optional[str] = ...
self,
allowed_extensions: Optional[Collection[str]] = ...,
message: Optional[str] = ...,
code: Optional[str] = ...,
) -> None: ...
def __call__(self, value: File) -> None: ...

Expand Down