mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-06 04:04:26 +08:00
add linting stubs with flake8-pyi and check for unused imports (#186)
This commit is contained in:
@@ -28,6 +28,10 @@ jobs:
|
||||
python: 3.7
|
||||
script: 'flake8'
|
||||
|
||||
- name: Lint stubs with flake8-pyi and check for unused imports
|
||||
python: 3.7
|
||||
script: 'flake8 --config flake8-pyi.ini'
|
||||
|
||||
- name: Lint plugin code with isort
|
||||
python: 3.7
|
||||
script: 'isort --check --diff'
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
black
|
||||
pytest-mypy-plugins==1.0.3
|
||||
psycopg2
|
||||
flake8
|
||||
flake8==3.7.8
|
||||
flake8-pyi==19.3.0
|
||||
isort==4.3.21
|
||||
-e .
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import threading
|
||||
from collections import OrderedDict
|
||||
from typing import Any, Callable, List, Optional, Tuple, Type, Union, Iterable, DefaultDict, Dict
|
||||
from typing import Any, Callable, DefaultDict, Dict, Iterable, List, Optional, Tuple, Type, Union
|
||||
|
||||
from django.db.migrations.state import AppConfigStub
|
||||
from django.db.models.base import Model
|
||||
@@ -8,8 +8,8 @@ from django.db.models.base import Model
|
||||
from .config import AppConfig
|
||||
|
||||
class Apps:
|
||||
all_models: "Dict[str, OrderedDict[str, Type[Model]]]" = ...
|
||||
app_configs: "OrderedDict[str, AppConfig]" = ...
|
||||
all_models: Dict[str, OrderedDict[str, Type[Model]]] = ...
|
||||
app_configs: OrderedDict[str, AppConfig] = ...
|
||||
stored_app_configs: List[Any] = ...
|
||||
apps_ready: bool = ...
|
||||
ready_event: threading.Event = ...
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from typing import Any, List, Union
|
||||
|
||||
from django.contrib.admin.options import BaseModelAdmin, InlineModelAdmin, ModelAdmin
|
||||
from django.contrib.admin.options import BaseModelAdmin
|
||||
from django.core.checks.messages import Error
|
||||
|
||||
_CheckError = Union[str, Error]
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
from typing import Any, Optional
|
||||
from typing import Any
|
||||
|
||||
from django.contrib.admin.helpers import InlineAdminForm
|
||||
from django.contrib.admin.templatetags.base import InclusionAdminNode
|
||||
from django.template.base import Parser, Token
|
||||
from django.template.context import Context, RequestContext
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Optional
|
||||
from typing import Any
|
||||
|
||||
register: Any
|
||||
|
||||
|
||||
@@ -2,7 +2,11 @@ from collections import OrderedDict
|
||||
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union
|
||||
|
||||
from django.contrib.admin.filters import ListFilter, SimpleListFilter
|
||||
from django.contrib.admin.options import ModelAdmin, IS_POPUP_VAR as IS_POPUP_VAR, TO_FIELD_VAR as TO_FIELD_VAR
|
||||
from django.contrib.admin.options import ( # noqa: F401
|
||||
ModelAdmin,
|
||||
IS_POPUP_VAR as IS_POPUP_VAR,
|
||||
TO_FIELD_VAR as TO_FIELD_VAR,
|
||||
)
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.db.models.base import Model
|
||||
from django.db.models.expressions import Combinable, CombinedExpression, OrderBy
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from typing import Any, Callable, List, Optional, Set, Union
|
||||
from typing import Callable, List, Optional, Set, Union
|
||||
|
||||
from django.contrib.auth import REDIRECT_FIELD_NAME as REDIRECT_FIELD_NAME
|
||||
from django.contrib.auth import REDIRECT_FIELD_NAME as REDIRECT_FIELD_NAME # noqa: F401
|
||||
|
||||
def user_passes_test(
|
||||
test_func: Callable, login_url: Optional[str] = ..., redirect_field_name: str = ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Dict, Optional
|
||||
from typing import Any, Dict
|
||||
|
||||
UserModel: Any
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import getpass as getpass
|
||||
import getpass as getpass # noqa: F401
|
||||
from typing import Any
|
||||
|
||||
from django.core.management.base import BaseCommand
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Callable, List, Optional
|
||||
from typing import Any, Callable, List
|
||||
|
||||
from django import http
|
||||
from django.http.response import HttpResponse, HttpResponseRedirect
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
from pathlib import Path, PosixPath
|
||||
from typing import Any, List, Mapping, Optional, Protocol, Sequence, Set, Union
|
||||
|
||||
from django.contrib.auth.base_user import AbstractBaseUser
|
||||
from django.db.models.base import Model
|
||||
|
||||
_UserModel = Model
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, List, Optional
|
||||
from typing import Any, List
|
||||
|
||||
def check_generic_foreign_keys(app_configs: None = ..., **kwargs: Any) -> List[Any]: ...
|
||||
def check_model_name_lengths(app_configs: None = ..., **kwargs: Any) -> List[Any]: ...
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union, Generic
|
||||
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union
|
||||
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.core.checks.messages import Error
|
||||
from django.db.models.base import Model
|
||||
from django.db.models.expressions import Combinable
|
||||
from django.db.models.fields.mixins import FieldCacheMixin
|
||||
from django.db.models.fields.related import ForeignObject
|
||||
from django.db.models.fields.related_descriptors import ReverseManyToOneDescriptor
|
||||
from django.db.models.fields.reverse_related import ForeignObjectRel
|
||||
|
||||
from django.db.models.expressions import Combinable
|
||||
from django.db.models.fields import Field, PositiveIntegerField
|
||||
from django.db.models.fields.mixins import FieldCacheMixin
|
||||
from django.db.models.query import QuerySet
|
||||
from django.db.models.query_utils import FilteredRelation, PathInfo
|
||||
from django.db.models.sql.where import WhereNode
|
||||
|
||||
from django.db.models.fields import Field, PositiveIntegerField
|
||||
|
||||
class GenericForeignKey(FieldCacheMixin):
|
||||
# django-stubs implementation only fields
|
||||
_pyi_private_set_type: Union[Any, Combinable]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Optional, Union
|
||||
from typing import Union
|
||||
|
||||
from django.http.request import HttpRequest
|
||||
from django.http.response import HttpResponseRedirect
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from typing import Any, Optional
|
||||
|
||||
from django.contrib.flatpages.models import FlatPage
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.http.response import HttpResponse
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Dict, List, Optional, Union
|
||||
from typing import Any, Dict, List, Union
|
||||
|
||||
from django.contrib.messages.storage.base import BaseStorage
|
||||
from django.http.request import HttpRequest
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, List, Optional, Union
|
||||
from typing import Any, List, Optional
|
||||
|
||||
from django.http.request import HttpRequest
|
||||
from django.http.response import HttpResponseBase
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
from typing import Dict, Optional
|
||||
from typing import Dict
|
||||
|
||||
def get_level_tags() -> Dict[int, str]: ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Dict, Optional
|
||||
from typing import Dict
|
||||
|
||||
from django.forms.forms import BaseForm
|
||||
from django.http.response import HttpResponse
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
from typing import Any, Optional, Sequence
|
||||
from typing import Optional, Sequence
|
||||
|
||||
from django.db.models.query_utils import Q
|
||||
|
||||
from django.db.models import Index
|
||||
from django.db.models.query_utils import Q
|
||||
|
||||
class PostgresIndex(Index): ...
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, List, Optional
|
||||
from typing import Any, List
|
||||
|
||||
from django.core.checks.messages import Error
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ from typing import Any, Callable, Iterator, Optional, Tuple
|
||||
from django.core.files.base import File
|
||||
from django.core.files.storage import FileSystemStorage
|
||||
from django.utils.functional import LazyObject
|
||||
from django.utils.safestring import SafeText
|
||||
|
||||
class StaticFilesStorage(FileSystemStorage):
|
||||
base_location: Any = ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Optional
|
||||
from typing import Any
|
||||
|
||||
from django.template.base import Parser, Token
|
||||
from django.templatetags.static import StaticNode
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from collections import OrderedDict
|
||||
from typing import Any, Iterator, List, Optional, Tuple, Union
|
||||
from typing import Iterator, List, Optional, Tuple, Union
|
||||
|
||||
from django.core.files.storage import FileSystemStorage
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Optional
|
||||
from typing import Any
|
||||
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.http.response import FileResponse
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Dict, List, Optional
|
||||
from typing import Any, Dict, List
|
||||
|
||||
from django.core.exceptions import ObjectDoesNotExist
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, List, Optional
|
||||
from typing import Any, List
|
||||
|
||||
from django.core.checks.messages import Error
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
from typing import Any, List, Optional
|
||||
from typing import Any, List
|
||||
|
||||
def check_database_backends(*args: Any, **kwargs: Any) -> List[Any]: ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, List, Optional
|
||||
from typing import Any, List
|
||||
|
||||
from django.core.checks.messages import Warning
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, List, Optional
|
||||
from typing import Any, List
|
||||
|
||||
from django.core.checks.messages import Warning
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, List, Optional
|
||||
from typing import Any, List
|
||||
|
||||
from django.core.checks.messages import Warning
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, List, Optional
|
||||
from typing import Any, List
|
||||
|
||||
from django.core.checks.messages import Error
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Callable, List, Optional, Tuple, Union
|
||||
from typing import Any, Callable, List, Tuple, Union
|
||||
|
||||
from django.core.checks.messages import CheckMessage, Error, Warning
|
||||
from django.urls.resolvers import URLPattern, URLResolver
|
||||
|
||||
@@ -8,8 +8,8 @@ from django.utils.datastructures import MultiValueDict
|
||||
class UploadFileException(Exception): ...
|
||||
|
||||
class StopUpload(UploadFileException):
|
||||
connection_reset = ... # type: bool
|
||||
def __init__(self, connection_reset: bool = False) -> None: ...
|
||||
connection_reset: bool = ...
|
||||
def __init__(self, connection_reset: bool = ...) -> None: ...
|
||||
|
||||
class SkipFile(UploadFileException): ...
|
||||
class StopFutureHandlers(UploadFileException): ...
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from collections import Callable
|
||||
|
||||
def supports_color() -> bool: ...
|
||||
|
||||
class Style:
|
||||
|
||||
@@ -1,13 +1,6 @@
|
||||
import os
|
||||
import re
|
||||
from typing import Any, Pattern, Type, Optional
|
||||
from typing import Any, Optional, Pattern, Type
|
||||
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.utils.functional import cached_property
|
||||
from django.utils.jslex import prepare_js_for_gettext
|
||||
|
||||
from django.conf import settings
|
||||
from django.utils.translation import templatize
|
||||
|
||||
plural_forms_re: Pattern = ...
|
||||
STATUS_OK: int = ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Dict, List, Optional, Union, Iterable, Sequence, Protocol, Any
|
||||
from typing import Dict, List, Optional, Protocol, Sequence, Union
|
||||
|
||||
from django.db.models.base import Model
|
||||
from django.db.models.query import QuerySet
|
||||
|
||||
@@ -4,7 +4,7 @@ from typing import Any, Dict
|
||||
from wsgiref import simple_server
|
||||
|
||||
from django.core.handlers.wsgi import WSGIRequest, WSGIHandler
|
||||
from django.core.wsgi import get_wsgi_application as get_wsgi_application
|
||||
from django.core.wsgi import get_wsgi_application as get_wsgi_application # noqa: F401
|
||||
|
||||
class WSGIServer(simple_server.WSGIServer):
|
||||
request_queue_size: int = ...
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
from datetime import datetime, timedelta
|
||||
from typing import Any, Dict, List, Optional, Type, Union, Protocol
|
||||
|
||||
from django.contrib.sessions.serializers import PickleSerializer
|
||||
from datetime import timedelta
|
||||
from typing import Any, Dict, Optional, Protocol, Type, Union
|
||||
|
||||
class BadSignature(Exception): ...
|
||||
class SignatureExpired(BadSignature): ...
|
||||
|
||||
@@ -5,7 +5,7 @@ from typing import Any, Dict, List, Optional, Union, Pattern, Collection
|
||||
from uuid import UUID
|
||||
|
||||
from django.core.files.base import File
|
||||
from django.core.exceptions import ValidationError as ValidationError
|
||||
from django.core.exceptions import ValidationError as ValidationError # noqa: F401
|
||||
|
||||
EMPTY_VALUES: Any
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Optional
|
||||
from typing import Any
|
||||
|
||||
from django.db.backends.base.base import BaseDatabaseWrapper
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Optional
|
||||
from typing import Any
|
||||
|
||||
from django.db.backends.base.base import BaseDatabaseWrapper
|
||||
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
from datetime import date, datetime, timedelta
|
||||
from decimal import Decimal
|
||||
from typing import Any, List, Optional, Set, Tuple, Type, Union, Sequence
|
||||
from typing import Any, List, Optional, Sequence, Tuple, Type, Union
|
||||
|
||||
from django.core.management.color import Style
|
||||
from django.db import DefaultConnectionProxy
|
||||
from django.db.backends.base.base import BaseDatabaseWrapper
|
||||
from django.db.backends.sqlite3.base import DatabaseWrapper
|
||||
from django.db.backends.utils import CursorWrapper
|
||||
from django.db.models.base import Model
|
||||
from django.db.models.expressions import Case, Expression
|
||||
from django.db.models.fields import Field
|
||||
from django.db.models.sql.compiler import SQLCompiler
|
||||
|
||||
from django.db import DefaultConnectionProxy
|
||||
from django.db.models.fields import Field
|
||||
|
||||
class BaseDatabaseOperations:
|
||||
compiler_module: str = ...
|
||||
integer_field_ranges: Any = ...
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from typing import Any, List, Optional
|
||||
from typing import Any, List
|
||||
|
||||
from django.db.backends.base.base import BaseDatabaseWrapper
|
||||
|
||||
from django.db.models.fields import Field
|
||||
|
||||
class BaseDatabaseValidation:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Dict, List, Optional, Union
|
||||
from typing import Dict, List, Optional, Union
|
||||
|
||||
from django.db.backends.base.client import BaseDatabaseClient
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Dict, Optional
|
||||
from typing import Dict
|
||||
|
||||
from django.db.backends.base.client import BaseDatabaseClient
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
from sqlite3 import dbapi2 as Database
|
||||
from sqlite3 import dbapi2 as Database
|
||||
from typing import Any, Callable, Iterator
|
||||
from typing import Any, Callable
|
||||
|
||||
from django.db.backends.base.base import BaseDatabaseWrapper
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import types
|
||||
from datetime import date, datetime, time
|
||||
from decimal import Decimal
|
||||
from typing import Any, Dict, Iterator, List, Mapping, Optional, Sequence, Tuple, Union, Type
|
||||
from typing import Any, Dict, List, Mapping, Optional, Sequence, Tuple, Type, Union
|
||||
from uuid import UUID
|
||||
|
||||
logger: Any
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Optional, Tuple
|
||||
from typing import Optional, Tuple
|
||||
|
||||
from django.db.migrations.migration import Migration
|
||||
from django.db.utils import DatabaseError
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Callable, List, Optional, Tuple, Union, Set, Dict
|
||||
from typing import Any, Dict, List, Optional, Set, Tuple, Union
|
||||
|
||||
from django.db.migrations.migration import Migration, SwappableTuple
|
||||
from django.db.migrations.state import ProjectState
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Tuple, Type, List
|
||||
from typing import Any, List, Tuple
|
||||
|
||||
from django.db.backends.base.schema import BaseDatabaseSchemaEditor
|
||||
from django.db.migrations.state import ProjectState
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Iterable, Union, Optional, List
|
||||
from typing import Any
|
||||
|
||||
COMPILED_REGEX_TYPE: Any
|
||||
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
from typing import Any, Dict, List, Optional, Sequence, Set, Tuple, TypeVar, Union, ClassVar, Type
|
||||
|
||||
from django.db.models.manager import Manager
|
||||
from typing import Any, Dict, List, Optional, Sequence, Set, Tuple, TypeVar, Union
|
||||
|
||||
from django.core.checks.messages import CheckMessage
|
||||
|
||||
from django.db.models.manager import Manager
|
||||
from django.db.models.options import Options
|
||||
|
||||
_Self = TypeVar("_Self", bound="Model")
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Callable, List, Optional, Type, Union, Tuple, Iterable, overload, TypeVar
|
||||
from typing import Any, Callable, Iterable, List, Optional, Tuple, Type, TypeVar, Union, overload
|
||||
|
||||
from django.core.files.base import File
|
||||
from django.core.files.images import ImageFile
|
||||
@@ -6,7 +6,6 @@ from django.core.files.storage import FileSystemStorage, Storage
|
||||
from django.db.models.base import Model
|
||||
|
||||
from django.db.models.fields import Field, _FieldChoices, _ValidatorCallable, _ErrorMessagesToOverride
|
||||
from django.forms import fields as form_fields
|
||||
|
||||
BLANK_CHOICE_DASH: List[Tuple[str, str]] = ...
|
||||
|
||||
|
||||
@@ -1,43 +1,27 @@
|
||||
from typing import (
|
||||
Any,
|
||||
Callable,
|
||||
Dict,
|
||||
Iterable,
|
||||
List,
|
||||
Optional,
|
||||
Sequence,
|
||||
TYPE_CHECKING,
|
||||
Tuple,
|
||||
Type,
|
||||
TypeVar,
|
||||
Union,
|
||||
overload,
|
||||
)
|
||||
from typing import Any, Callable, Dict, Iterable, List, Optional, Sequence, Tuple, Type, TypeVar, Union, overload
|
||||
from uuid import UUID
|
||||
|
||||
from django.db import models
|
||||
from django.db.models.base import Model
|
||||
from django.db.models.fields import Field
|
||||
from django.db.models.query_utils import Q, PathInfo
|
||||
from django.db.models.manager import RelatedManager
|
||||
from django.db.models.expressions import Combinable
|
||||
from django.db.models.fields.mixins import FieldCacheMixin
|
||||
from django.db.models.query_utils import PathInfo, Q
|
||||
|
||||
from django.db import models
|
||||
from django.db.models import Field, Model
|
||||
from django.db.models.fields.related_descriptors import (
|
||||
from django.db.models.fields.related_descriptors import ( # noqa: F401
|
||||
ForwardOneToOneDescriptor as ForwardOneToOneDescriptor,
|
||||
ForwardManyToOneDescriptor as ForwardManyToOneDescriptor,
|
||||
ManyToManyDescriptor as ManyToManyDescriptor,
|
||||
ReverseOneToOneDescriptor as ReverseOneToOneDescriptor,
|
||||
ReverseManyToOneDescriptor as ReverseManyToOneDescriptor,
|
||||
)
|
||||
from django.db.models.fields.reverse_related import (
|
||||
from django.db.models.fields.reverse_related import ( # noqa: F401
|
||||
ForeignObjectRel as ForeignObjectRel,
|
||||
OneToOneRel as OneToOneRel,
|
||||
ManyToOneRel as ManyToOneRel,
|
||||
ManyToManyRel as ManyToManyRel,
|
||||
)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from django.db.models.manager import RelatedManager
|
||||
|
||||
_T = TypeVar("_T", bound=models.Model)
|
||||
_F = TypeVar("_F", bound=models.Field)
|
||||
_Choice = Tuple[Any, str]
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union
|
||||
|
||||
from django.db.models.base import Model
|
||||
from django.db.models.fields import AutoField, Field
|
||||
from django.db.models.fields.related import ForeignKey, OneToOneField, RelatedField
|
||||
from django.db.models.lookups import BuiltinLookup, StartsWith
|
||||
from django.db.models.query_utils import FilteredRelation, PathInfo, Q
|
||||
from django.db.models.query_utils import FilteredRelation, PathInfo
|
||||
from django.db.models.sql.where import WhereNode
|
||||
|
||||
from django.db.models.fields import AutoField, Field
|
||||
from .mixins import FieldCacheMixin
|
||||
|
||||
class ForeignObjectRel(FieldCacheMixin):
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
from collections import OrderedDict
|
||||
from datetime import datetime
|
||||
from typing import Any, Dict, Iterable, List, Optional, Tuple, Type, Union, Mapping
|
||||
from typing import Any, Iterable, List, Mapping, Optional, Tuple, Type, Union
|
||||
|
||||
from django.db.backends.sqlite3.base import DatabaseWrapper
|
||||
from django.db.models.expressions import Combinable, Expression, Func
|
||||
from django.db.models.expressions import Expression, Func
|
||||
from django.db.models.query_utils import RegisterLookupMixin
|
||||
from django.db.models.sql.compiler import SQLCompiler
|
||||
from django.db.models.sql.query import Query
|
||||
from django.utils.datastructures import OrderedSet
|
||||
from django.utils.safestring import SafeText
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import collections
|
||||
from typing import Any, Callable, Dict, Iterator, List, Optional, Set, Tuple, Type, Union, TypeVar, Generic, Sequence
|
||||
from typing import Any, Callable, Dict, Generic, Iterator, List, Optional, Sequence, Set, Tuple, Type, TypeVar, Union
|
||||
|
||||
from django.apps.config import AppConfig
|
||||
from django.apps.registry import Apps
|
||||
@@ -9,13 +9,13 @@ from django.contrib.postgres.fields.citext import CIText
|
||||
from django.db.backends.sqlite3.base import DatabaseWrapper
|
||||
from django.db.models.base import Model
|
||||
from django.db.models.fields.mixins import FieldCacheMixin
|
||||
from django.db.models.fields.related import OneToOneField, ManyToManyField
|
||||
from django.db.models.fields.related import ManyToManyField, OneToOneField
|
||||
from django.db.models.fields.reverse_related import ForeignObjectRel
|
||||
from django.db.models.manager import Manager
|
||||
from django.db.models.query_utils import PathInfo
|
||||
from django.utils.datastructures import ImmutableList
|
||||
|
||||
from django.db.models.fields import Field, mixins, AutoField
|
||||
from django.db.models.fields import AutoField, Field
|
||||
|
||||
PROXY_PARENTS: Any
|
||||
EMPTY_RELATION_TREE: Any
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import datetime
|
||||
from typing import (
|
||||
Any,
|
||||
Collection,
|
||||
Dict,
|
||||
Generic,
|
||||
Iterable,
|
||||
Iterator,
|
||||
List,
|
||||
@@ -14,18 +16,15 @@ from typing import (
|
||||
TypeVar,
|
||||
Union,
|
||||
overload,
|
||||
Generic,
|
||||
NamedTuple,
|
||||
Collection,
|
||||
)
|
||||
|
||||
from django.db.models.base import Model
|
||||
from django.db.models.expressions import Combinable as Combinable, F as F
|
||||
from django.db.models.expressions import Combinable as Combinable, F as F # noqa: F401
|
||||
from django.db.models.sql.query import Query, RawQuery
|
||||
|
||||
from django.db import models
|
||||
from django.db.models import Manager
|
||||
from django.db.models.query_utils import Q as Q
|
||||
from django.db.models.query_utils import Q as Q # noqa: F401
|
||||
|
||||
_T = TypeVar("_T", bound=models.Model, covariant=True)
|
||||
_QS = TypeVar("_QS", bound="_BaseQuerySet")
|
||||
@@ -43,8 +42,7 @@ class _BaseQuerySet(Generic[_T], Sized):
|
||||
def as_manager(cls) -> Manager[Any]: ...
|
||||
def __len__(self) -> int: ...
|
||||
def __bool__(self) -> bool: ...
|
||||
def __class_getitem__(cls, item: Type[_T]):
|
||||
pass
|
||||
def __class_getitem__(cls, item: Type[_T]): ...
|
||||
def __getstate__(self) -> Dict[str, Any]: ...
|
||||
# Technically, the other QuerySet must be of the same type _T, but _T is covariant
|
||||
def __and__(self: _QS, other: _BaseQuerySet[_T]) -> _QS: ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Optional, Tuple, Type, Union
|
||||
from typing import Tuple, Type, Union
|
||||
|
||||
from django.db.models.base import Model
|
||||
|
||||
|
||||
@@ -38,5 +38,5 @@ def atomic(using: _C) -> _C: ...
|
||||
|
||||
# Decorator or context-manager with parameters
|
||||
@overload
|
||||
def atomic(using: Optional[str] = ..., savepoint: bool = True) -> Atomic: ...
|
||||
def atomic(using: Optional[str] = ..., savepoint: bool = ...) -> Atomic: ...
|
||||
def non_atomic_requests(using: Callable = ...) -> Callable: ...
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
from typing import Any, Callable, List, Optional, Tuple, Type, Union
|
||||
|
||||
from django.apps.config import AppConfig
|
||||
from django.db.models.base import Model
|
||||
from typing import Any, Callable, List, Optional, Tuple, Union
|
||||
|
||||
NONE_ID: Any
|
||||
NO_RECEIVERS: Any
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
from datetime import datetime, timedelta
|
||||
from decimal import Decimal
|
||||
from typing import Any, Callable, List, Optional, Pattern, Sequence, Type, Union, Tuple, Iterable
|
||||
from typing import Any, Callable, Iterable, List, Optional, Pattern, Sequence, Tuple, Type, Union
|
||||
|
||||
from django.core.validators import BaseValidator
|
||||
from django.forms.boundfield import BoundField
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Dict, Iterator, List, Mapping, Optional, Sequence, Type, Union, Tuple
|
||||
from typing import Any, Dict, Iterator, List, Mapping, Optional, Sequence, Type, Union
|
||||
|
||||
from django.core.exceptions import ValidationError as ValidationError
|
||||
from django.forms.boundfield import BoundField
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
from typing import Any, Dict
|
||||
|
||||
from django.template.backends.base import BaseEngine
|
||||
from django.template.engine import Engine
|
||||
|
||||
from django.template import Template
|
||||
|
||||
|
||||
@@ -10,17 +10,16 @@ from typing import (
|
||||
Pattern,
|
||||
Set,
|
||||
Tuple,
|
||||
Type,
|
||||
TypeVar,
|
||||
Union,
|
||||
overload,
|
||||
TypeVar,
|
||||
Type,
|
||||
)
|
||||
|
||||
from django.contrib.auth.base_user import AbstractBaseUser
|
||||
from django.contrib.sessions.backends.base import SessionBase
|
||||
from django.db.models.base import Model
|
||||
from django.utils.datastructures import CaseInsensitiveMapping, ImmutableList, MultiValueDict
|
||||
|
||||
from django.contrib.auth.base_user import AbstractBaseUser
|
||||
from django.core.files import uploadedfile, uploadhandler
|
||||
from django.urls import ResolverMatch
|
||||
|
||||
|
||||
@@ -48,8 +48,8 @@ class HttpResponseBase(Iterable[Any]):
|
||||
samesite: str = ...,
|
||||
) -> None: ...
|
||||
def setdefault(self, key: str, value: str) -> None: ...
|
||||
def set_signed_cookie(self, key: str, value: str, salt: str = "", **kwargs: Any) -> None: ...
|
||||
def delete_cookie(self, key: str, path: str = "", domain: Optional[str] = ...) -> None: ...
|
||||
def set_signed_cookie(self, key: str, value: str, salt: str = ..., **kwargs: Any) -> None: ...
|
||||
def delete_cookie(self, key: str, path: str = ..., domain: Optional[str] = ...) -> None: ...
|
||||
def make_bytes(self, value: object) -> bytes: ...
|
||||
def close(self) -> None: ...
|
||||
def write(self, content: Union[str, bytes]) -> None: ...
|
||||
|
||||
@@ -22,8 +22,7 @@ def render(
|
||||
using: Optional[str] = ...,
|
||||
) -> HttpResponse: ...
|
||||
|
||||
class SupportsGetAbsoluteUrl(Protocol):
|
||||
pass
|
||||
class SupportsGetAbsoluteUrl(Protocol): ...
|
||||
|
||||
def redirect(
|
||||
to: Union[Callable, str, SupportsGetAbsoluteUrl], *args: Any, permanent: bool = ..., **kwargs: Any
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Optional
|
||||
from typing import Any
|
||||
|
||||
from django.http.request import HttpRequest
|
||||
from django.utils.safestring import SafeText
|
||||
|
||||
@@ -2,7 +2,7 @@ from datetime import date as _date, datetime, time as _time
|
||||
from typing import Any, Callable, Dict, List, Optional, Union
|
||||
|
||||
from django.utils.safestring import SafeText
|
||||
from django.utils.html import escape as escape
|
||||
from django.utils.html import escape as escape # noqa: F401
|
||||
|
||||
register: Any
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
from typing import Any, Dict, List, Optional, Union
|
||||
from . import engines as engines
|
||||
from . import engines as engines # noqa: F401
|
||||
|
||||
from django.http.request import HttpRequest
|
||||
from django.template.exceptions import TemplateDoesNotExist as TemplateDoesNotExist
|
||||
from django.template.exceptions import TemplateDoesNotExist as TemplateDoesNotExist # noqa: F401
|
||||
|
||||
def get_template(template_name: str, using: Optional[str] = ...) -> Any: ...
|
||||
def select_template(template_name_list: Union[List[str], str], using: Optional[str] = ...) -> Any: ...
|
||||
|
||||
@@ -7,7 +7,6 @@ from django.http.request import HttpRequest
|
||||
from django.template.base import Template
|
||||
from django.template.context import RequestContext
|
||||
from django.test.client import Client
|
||||
from django.utils.functional import SimpleLazyObject
|
||||
|
||||
from django.http import HttpResponse
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import logging
|
||||
from argparse import ArgumentParser
|
||||
from io import StringIO
|
||||
from typing import Any, Dict, List, Optional, Set, Tuple, Type, Union, Sequence
|
||||
from unittest import TestCase, TextTestResult, TestSuite
|
||||
from typing import Any, Dict, List, Optional, Sequence, Set, Tuple, Type
|
||||
from unittest import TestCase, TestSuite, TextTestResult
|
||||
|
||||
from django.db.backends.base.base import BaseDatabaseWrapper
|
||||
from django.test.testcases import SimpleTestCase, TestCase
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from typing import Any
|
||||
from django.core.signals import setting_changed as setting_changed
|
||||
from django.core.signals import setting_changed as setting_changed # noqa: F401
|
||||
|
||||
template_rendered: Any
|
||||
COMPLEX_OVERRIDE_SETTINGS: Any
|
||||
|
||||
@@ -15,7 +15,7 @@ from django.template.base import Template
|
||||
from django.test.client import Client
|
||||
from django.test.utils import CaptureQueriesContext, ContextList
|
||||
from django.utils.safestring import SafeText
|
||||
from django.db import connections as connections
|
||||
from django.db import connections as connections # noqa: F401
|
||||
|
||||
class _AssertNumQueriesContext(CaptureQueriesContext):
|
||||
test_case: SimpleTestCase = ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Dict, Type, Union, Protocol
|
||||
from typing import Any, Dict, Type, Union
|
||||
from uuid import UUID
|
||||
|
||||
class IntConverter:
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
from django.http import Http404
|
||||
|
||||
class Resolver404(Http404):
|
||||
pass
|
||||
|
||||
class NoReverseMatch(Exception):
|
||||
pass
|
||||
class Resolver404(Http404): ...
|
||||
class NoReverseMatch(Exception): ...
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from os.path import abspath
|
||||
from typing import Any, Optional, Union
|
||||
from typing import Any, Union
|
||||
|
||||
abspathu = abspath
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from hmac import HMAC
|
||||
from typing import Any, Callable, Optional, Union
|
||||
from typing import Callable, Optional, Union
|
||||
|
||||
using_sysrandom: bool
|
||||
|
||||
|
||||
@@ -71,5 +71,4 @@ class CaseInsensitiveMapping(Mapping):
|
||||
def __getitem__(self, key: str) -> Any: ...
|
||||
def __len__(self) -> int: ...
|
||||
def __iter__(self) -> Iterator[str]: ...
|
||||
def copy(self: _T) -> _T:
|
||||
return self
|
||||
def copy(self: _T) -> _T: ...
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
from datetime import timedelta
|
||||
from typing import Any, Optional
|
||||
|
||||
def duration_string(duration: timedelta) -> str: ...
|
||||
def duration_iso_string(duration: timedelta) -> str: ...
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union
|
||||
from functools import wraps as wraps
|
||||
from functools import wraps as wraps # noqa: F401
|
||||
|
||||
from django.db.models.base import Model
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Dict, List, Optional, Set, Tuple, Union, Iterable
|
||||
from typing import Any, Iterable, List, Optional, Tuple, Union
|
||||
|
||||
ETAG_MATCH: Any
|
||||
MONTHS: Any
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Optional
|
||||
from typing import Any
|
||||
|
||||
def clean_ipv6_address(ip_str: Any, unpack_ipv4: bool = ..., error_message: Any = ...): ...
|
||||
def is_valid_ipv6_address(ip_str: str) -> bool: ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, List, Optional
|
||||
from typing import Any, List
|
||||
|
||||
COMMON_P: str
|
||||
WORDS: Any
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Optional
|
||||
from typing import Any
|
||||
|
||||
def import_string(dotted_path: str) -> Any: ...
|
||||
def autodiscover_modules(*args: Any, **kwargs: Any) -> None: ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Optional
|
||||
from typing import Any
|
||||
|
||||
dot_re: Any
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Optional
|
||||
from typing import Any
|
||||
|
||||
def gettext(message: Any): ...
|
||||
|
||||
|
||||
12
flake8-pyi.ini
Normal file
12
flake8-pyi.ini
Normal file
@@ -0,0 +1,12 @@
|
||||
[flake8]
|
||||
filename =
|
||||
*.pyi
|
||||
exclude =
|
||||
django-sources
|
||||
test-data
|
||||
mypy_django_plugin
|
||||
scripts
|
||||
select = F401, Y
|
||||
max_line_length = 120
|
||||
per-file-ignores =
|
||||
*__init__.pyi: F401
|
||||
@@ -14,14 +14,6 @@ exclude =
|
||||
django-stubs
|
||||
test-data
|
||||
max_line_length = 120
|
||||
per-file-ignores =
|
||||
# E301: expected 1 blank line
|
||||
# E302: expected 2 blank lines
|
||||
# E305: expected 2 blank lines after class or function definition
|
||||
# E701: multiple statements on one line (colon)
|
||||
# E743: ambiguous function definition 'X'
|
||||
# F821: undefined name 'X'
|
||||
*.pyi: E301, E302, E305, E701, E743, F821
|
||||
|
||||
[metadata]
|
||||
license_file = LICENSE.txt
|
||||
|
||||
Reference in New Issue
Block a user