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