mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-13 23:41:55 +08:00
Version 1.10.0 release (#886)
* Version 1.10.0 release * Fixes CI * Fixes CI
This commit is contained in:
@@ -53,7 +53,7 @@ We rely on different `django` and `mypy` versions:
|
||||
|
||||
| django-stubs | mypy version | django version | python version
|
||||
| ------------ | ---- | ---- | ---- |
|
||||
| 1.10.0 | 0.931 | 3.2.x | ^3.7
|
||||
| 1.10.0 | 0.931+ | 3.2.x | ^3.7
|
||||
| 1.9.0 | 0.910 | 3.2.x | ^3.6
|
||||
| 1.8.0 | 0.812 | 3.1.x | ^3.6
|
||||
| 1.7.0 | 0.790 | 2.2.x \|\| 3.x | ^3.6
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
wheel
|
||||
black==22.1.0
|
||||
requests==2.27.1
|
||||
coreapi==2.3.3
|
||||
@@ -9,4 +8,6 @@ pytest-mypy-plugins==1.9.3
|
||||
psycopg2-binary
|
||||
-e ./django_stubs_ext
|
||||
-e .
|
||||
mypy==0.931
|
||||
|
||||
# Overrides:
|
||||
mypy==0.942
|
||||
|
||||
4
setup.py
4
setup.py
@@ -21,7 +21,7 @@ with open("README.md") as f:
|
||||
readme = f.read()
|
||||
|
||||
dependencies = [
|
||||
"mypy>=0.930,<0.940",
|
||||
"mypy>=0.930,<0.950",
|
||||
"django",
|
||||
"django-stubs-ext>=0.3.0",
|
||||
"tomli",
|
||||
@@ -33,7 +33,7 @@ dependencies = [
|
||||
|
||||
setup(
|
||||
name="django-stubs",
|
||||
version="1.9.0",
|
||||
version="1.10.0",
|
||||
description="Mypy stubs for Django",
|
||||
long_description=readme,
|
||||
long_description_content_type="text/markdown",
|
||||
|
||||
@@ -110,10 +110,10 @@
|
||||
from django.contrib import admin
|
||||
|
||||
class A(admin.ModelAdmin):
|
||||
radio_fields = {"some_field": 0} # E: Dict entry 0 has incompatible type "str": "Literal[0]"; expected "str": "Union[Literal[1], Literal[2]]"
|
||||
radio_fields = {"some_field": 0} # E: Dict entry 0 has incompatible type "str": "Literal[0]"; expected "str": "Literal[1, 2]"
|
||||
|
||||
class B(admin.ModelAdmin):
|
||||
radio_fields = {1: admin.VERTICAL} # E: Dict entry 0 has incompatible type "int": "Literal[2]"; expected "str": "Union[Literal[1], Literal[2]]"
|
||||
radio_fields = {1: admin.VERTICAL} # E: Dict entry 0 has incompatible type "int": "Literal[2]"; expected "str": "Literal[1, 2]"
|
||||
- case: errors_for_invalid_formfield_overrides
|
||||
main: |
|
||||
from django.contrib import admin
|
||||
|
||||
@@ -289,7 +289,7 @@
|
||||
reveal_type(values_no_params) # N: Revealed type is "builtins.dict*[builtins.str, Any]"
|
||||
|
||||
values_list_no_params = Blog.objects.annotate(foo=F('id')).values_list().get()
|
||||
reveal_type(values_list_no_params) # N: Revealed type is "builtins.tuple*[Any]"
|
||||
reveal_type(values_list_no_params) # N: Revealed type is "builtins.tuple*[Any, ...]"
|
||||
|
||||
values_list_flat_no_params = Blog.objects.annotate(foo=F('id')).values_list(flat=True).get()
|
||||
reveal_type(values_list_flat_no_params) # N: Revealed type is "builtins.int*"
|
||||
@@ -310,7 +310,7 @@
|
||||
qs1 = Blog.objects.values('text').annotate(foo=F('id'))
|
||||
reveal_type(qs1) # N: Revealed type is "django.db.models.query._QuerySet[django_stubs_ext.WithAnnotations[myapp__models__Blog, TypedDict({'foo': Any})], builtins.dict[builtins.str, Any]]"
|
||||
qs2 = Blog.objects.values_list('text').annotate(foo=F('id'))
|
||||
reveal_type(qs2) # N: Revealed type is "django.db.models.query._QuerySet[django_stubs_ext.WithAnnotations[myapp__models__Blog, TypedDict({'foo': Any})], builtins.tuple[Any]]"
|
||||
reveal_type(qs2) # N: Revealed type is "django.db.models.query._QuerySet[django_stubs_ext.WithAnnotations[myapp__models__Blog, TypedDict({'foo': Any})], builtins.tuple[Any, ...]]"
|
||||
qs3 = Blog.objects.values_list('text', named=True).annotate(foo=F('id'))
|
||||
# TODO: Would be nice to infer a NamedTuple which contains the field 'text' (str) + any number of other fields.
|
||||
# The reason it would have to appear to have any other fields is that annotate could potentially be called with
|
||||
@@ -327,7 +327,7 @@
|
||||
reveal_type(before_values_no_params) # N: Revealed type is "builtins.dict*[builtins.str, Any]"
|
||||
|
||||
before_values_list_no_params = Blog.objects.values_list().annotate(foo=F('id')).get()
|
||||
reveal_type(before_values_list_no_params) # N: Revealed type is "builtins.tuple*[Any]"
|
||||
reveal_type(before_values_list_no_params) # N: Revealed type is "builtins.tuple*[Any, ...]"
|
||||
|
||||
before_values_list_flat_no_params = Blog.objects.values_list(flat=True).annotate(foo=F('id')).get()
|
||||
reveal_type(before_values_list_flat_no_params) # N: Revealed type is "builtins.int*"
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
qs = Blog.objects.all()
|
||||
reveal_type(qs) # N: Revealed type is "django.db.models.query._QuerySet[myapp.models.Blog*, myapp.models.Blog*]"
|
||||
reveal_type(qs.get(id=1)) # N: Revealed type is "myapp.models.Blog*"
|
||||
reveal_type(iter(qs)) # N: Revealed type is "typing.Iterator[myapp.models.Blog*]"
|
||||
reveal_type(iter(qs)) # N: Revealed type is "typing.Iterator*[myapp.models.Blog*]"
|
||||
reveal_type(qs.iterator()) # N: Revealed type is "typing.Iterator[myapp.models.Blog*]"
|
||||
reveal_type(qs.first()) # N: Revealed type is "Union[myapp.models.Blog*, None]"
|
||||
reveal_type(qs.earliest()) # N: Revealed type is "myapp.models.Blog*"
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
reveal_type(query.all().get()) # N: Revealed type is "Tuple[builtins.str]"
|
||||
reveal_type(query.filter(age__gt=16).get()) # N: Revealed type is "Tuple[builtins.str]"
|
||||
reveal_type(query.exclude(age__lte=16).get()) # N: Revealed type is "Tuple[builtins.str]"
|
||||
reveal_type(query.annotate(name_length=Length("name")).get()) # N: Revealed type is "builtins.tuple*[Any]"
|
||||
reveal_type(query.annotate(name_length=Length("name")).get()) # N: Revealed type is "builtins.tuple*[Any, ...]"
|
||||
installed_apps:
|
||||
- myapp
|
||||
files:
|
||||
|
||||
Reference in New Issue
Block a user