mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-10 22:11:54 +08:00
django-stubs-ext@0.2.0
This commit is contained in:
@@ -4,7 +4,6 @@ from django.db.models import lookups
|
||||
from django.db.models.lookups import PostgresOperatorLookup, Transform
|
||||
from typing import Any, Optional, Callable
|
||||
|
||||
|
||||
class JSONField(CheckFieldDefaultMixin, Field):
|
||||
def __init__(
|
||||
self,
|
||||
@@ -17,7 +16,6 @@ class JSONField(CheckFieldDefaultMixin, Field):
|
||||
|
||||
class DataContains(PostgresOperatorLookup): ...
|
||||
class ContainedBy(PostgresOperatorLookup): ...
|
||||
|
||||
class HasKeyLookup(PostgresOperatorLookup): ...
|
||||
class HasKey(HasKeyLookup): ...
|
||||
class HasKeys(HasKeyLookup): ...
|
||||
@@ -30,13 +28,13 @@ class KeyTransform(Transform):
|
||||
def preprocess_lhs(self, compiler: Any, connection: Any, lhs_only: bool = ...): ...
|
||||
|
||||
class KeyTextTransform(KeyTransform): ...
|
||||
|
||||
class KeyTransformTextLookupMixin:
|
||||
def __init__(self, key_transform: Any, *args: Any, **kwargs: Any) -> None: ...
|
||||
|
||||
class CaseInsensitiveMixin: ...
|
||||
class KeyTransformIsNull(lookups.IsNull): ...
|
||||
class KeyTransformIn(lookups.In): ...
|
||||
|
||||
class KeyTransformExact(JSONExact): ...
|
||||
class KeyTransformIExact(CaseInsensitiveMixin, KeyTransformTextLookupMixin, lookups.IExact): ...
|
||||
class KeyTransformIContains(CaseInsensitiveMixin, KeyTransformTextLookupMixin, lookups.IContains): ...
|
||||
@@ -46,7 +44,6 @@ class KeyTransformEndsWith(KeyTransformTextLookupMixin, lookups.EndsWith): ...
|
||||
class KeyTransformIEndsWith(CaseInsensitiveMixin, KeyTransformTextLookupMixin, lookups.IEndsWith): ...
|
||||
class KeyTransformRegex(KeyTransformTextLookupMixin, lookups.Regex): ...
|
||||
class KeyTransformIRegex(CaseInsensitiveMixin, KeyTransformTextLookupMixin, lookups.IRegex): ...
|
||||
|
||||
class KeyTransformNumericLookupMixin: ...
|
||||
class KeyTransformLt(KeyTransformNumericLookupMixin, lookups.LessThan): ...
|
||||
class KeyTransformLte(KeyTransformNumericLookupMixin, lookups.LessThanOrEqual): ...
|
||||
|
||||
@@ -6,7 +6,6 @@ from django.db.models.base import Model
|
||||
from django.db.models.expressions import BaseExpression, Combinable
|
||||
from django.db.models.query_utils import Q
|
||||
|
||||
|
||||
class Index:
|
||||
model: Type[Model]
|
||||
suffix: str = ...
|
||||
|
||||
@@ -15,7 +15,7 @@ class BadHeaderError(ValueError): ...
|
||||
class ResponseHeaders(CaseInsensitiveMapping):
|
||||
store: Dict[str, str] = ...
|
||||
def __init__(self, data: Dict[str, str]) -> None: ...
|
||||
def _convert_to_charset(self, value: Union[bytes, str], charset: str, mime_encode: str=...) -> str: ...
|
||||
def _convert_to_charset(self, value: Union[bytes, str], charset: str, mime_encode: str = ...) -> str: ...
|
||||
def __delitem__(self, key: str) -> None: ...
|
||||
def __setitem__(self, key: str, value: str) -> None: ...
|
||||
def pop(self, key: str, default: Optional[str] = ...) -> str: ...
|
||||
|
||||
@@ -30,9 +30,7 @@ class Library:
|
||||
@overload
|
||||
def simple_tag(self, func: _C) -> _C: ...
|
||||
@overload
|
||||
def simple_tag(
|
||||
self, takes_context: Optional[bool] = ..., name: Optional[str] = ...
|
||||
) -> Callable[[_C], _C]: ...
|
||||
def simple_tag(self, takes_context: Optional[bool] = ..., name: Optional[str] = ...) -> Callable[[_C], _C]: ...
|
||||
def inclusion_tag(
|
||||
self,
|
||||
filename: Union[Template, str],
|
||||
|
||||
@@ -4,7 +4,9 @@ from .resolvers import URLResolver, URLPattern
|
||||
from ..conf.urls import IncludedURLConf
|
||||
from ..http.response import HttpResponseBase
|
||||
|
||||
def include(arg: Any, namespace: Optional[str] = ...) -> Tuple[List[Union[URLResolver, URLPattern]], Optional[str], Optional[str]]: ...
|
||||
def include(
|
||||
arg: Any, namespace: Optional[str] = ...
|
||||
) -> Tuple[List[Union[URLResolver, URLPattern]], Optional[str], Optional[str]]: ...
|
||||
|
||||
# path()
|
||||
@overload
|
||||
|
||||
@@ -3,7 +3,9 @@ from typing import Any, Optional
|
||||
from django.http.request import HttpRequest
|
||||
from django.http.response import FileResponse
|
||||
|
||||
def serve(request: HttpRequest, path: str, document_root: Optional[str] = ..., show_indexes: bool = ...) -> FileResponse: ...
|
||||
def serve(
|
||||
request: HttpRequest, path: str, document_root: Optional[str] = ..., show_indexes: bool = ...
|
||||
) -> FileResponse: ...
|
||||
|
||||
DEFAULT_DIRECTORY_INDEX_TEMPLATE: str
|
||||
template_translatable: Any
|
||||
|
||||
@@ -11,7 +11,7 @@ dependencies = [
|
||||
|
||||
setup(
|
||||
name="django-stubs-ext",
|
||||
version="0.1.0",
|
||||
version="0.2.0",
|
||||
description="Monkey-patching and extensions for django-stubs",
|
||||
long_description=readme,
|
||||
long_description_content_type="text/markdown",
|
||||
@@ -19,6 +19,8 @@ setup(
|
||||
url="https://github.com/typeddjango/django-stubs",
|
||||
author="Simula Proxy",
|
||||
author_email="3nki.nam.shub@gmail.com",
|
||||
maintainer="Nikita Sobolev",
|
||||
maintainer_email="mail@sobolevn.me",
|
||||
py_modules=[],
|
||||
python_requires=">=3.6",
|
||||
install_requires=dependencies,
|
||||
@@ -35,6 +37,7 @@ setup(
|
||||
"Framework :: Django :: 2.2",
|
||||
"Framework :: Django :: 3.0",
|
||||
"Framework :: Django :: 3.1",
|
||||
"Framework :: Django :: 3.2",
|
||||
],
|
||||
project_urls={
|
||||
"Release notes": "https://github.com/typeddjango/django-stubs/releases",
|
||||
|
||||
@@ -71,10 +71,11 @@ def test_patched_version_specific(
|
||||
assert el.cls[int] is el.cls
|
||||
|
||||
|
||||
def test_patched_mypy_builtins(make_generic_classes: _MakeGenericClasses) -> None:
|
||||
def test_patched_mypy_builtins(
|
||||
make_generic_classes: _MakeGenericClasses,
|
||||
) -> None:
|
||||
"""Ensures that we properly patch builtins with `mypy` specific helpers."""
|
||||
make_generic_classes()
|
||||
|
||||
assert builtins.reveal_type
|
||||
assert builtins.reveal_locals
|
||||
|
||||
reveal_type(reveal_locals) # noqa: F821
|
||||
|
||||
Reference in New Issue
Block a user