import os
from distutils.core import setup
from typing import List

from setuptools import find_packages


def find_stub_files(name: str) -> List[str]:
    result = []
    for root, dirs, files in os.walk(name):
        for file in files:
            if file.endswith(".pyi"):
                if os.path.sep in root:
                    sub_root = root.split(os.path.sep, 1)[-1]
                    file = os.path.join(sub_root, file)
                result.append(file)
    return result


with open("README.md") as f:
    readme = f.read()

dependencies = [
    "mypy>=0.790",
    "typing-extensions",
    "django",
    "django-stubs-ext",
]

setup(
    name="django-stubs",
    version="1.8.0",
    description="Mypy stubs for Django",
    long_description=readme,
    long_description_content_type="text/markdown",
    license="MIT",
    url="https://github.com/typeddjango/django-stubs",
    author="Maksim Kurnikov",
    author_email="maxim.kurnikov@gmail.com",
    py_modules=[],
    python_requires=">=3.6",
    install_requires=dependencies,
    packages=["django-stubs", *find_packages(exclude=["scripts"])],
    package_data={"django-stubs": find_stub_files("django-stubs")},
    classifiers=[
        "License :: OSI Approved :: MIT License",
        "Operating System :: OS Independent",
        "Programming Language :: Python :: 3.6",
        "Programming Language :: Python :: 3.7",
        "Programming Language :: Python :: 3.8",
        "Programming Language :: Python :: 3.9",
        "Typing :: Typed",
        "Framework :: Django",
        "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",
    },
)

setup.py
import os
from distutils.core import setup
from typing import List

from setuptools import find_packages


def find_stub_files(name: str) -> List[str]:
    result = []
    for root, dirs, files in os.walk(name):
        for file in files:
            if file.endswith(".pyi"):
                if os.path.sep in root:
                    sub_root = root.split(os.path.sep, 1)[-1]
                    file = os.path.join(sub_root, file)
                result.append(file)
    return result


with open("README.md") as f:
    readme = f.read()

dependencies = [
    "mypy>=0.900",
    "typing-extensions",
    "django",
    "django-stubs-ext",
]

setup(
    name="django-stubs",
    version="1.8.0",
    description="Mypy stubs for Django",
    long_description=readme,
    long_description_content_type="text/markdown",
    license="MIT",
    url="https://github.com/typeddjango/django-stubs",
    author="Maksim Kurnikov",
    author_email="maxim.kurnikov@gmail.com",
    py_modules=[],
    python_requires=">=3.6",
    install_requires=dependencies,
    packages=["django-stubs", *find_packages(exclude=["scripts"])],
    package_data={"django-stubs": find_stub_files("django-stubs")},
    classifiers=[
        "License :: OSI Approved :: MIT License",
        "Operating System :: OS Independent",
        "Programming Language :: Python :: 3.6",
        "Programming Language :: Python :: 3.7",
        "Programming Language :: Python :: 3.8",
        "Programming Language :: Python :: 3.9",
        "Typing :: Typed",
        "Framework :: Django",
        "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",
    },
)

setup.py
diff --git a/django-stubs/forms/models.pyi b/django-stubs/forms/models.pyi
index 1cb275f18..2e471ded8 100644
--- a/django-stubs/forms/models.pyi
+++ b/django-stubs/forms/models.pyi
@@ -2,6 +2,7 @@ from datetime import datetime
 from typing import (
     Any,
     Callable,
+    Collection,
     Dict,
     Iterator,
     List,
@@ -36,7 +37,7 @@ from django.db.models import ForeignKey
 
 ALL_FIELDS: str
 
-_Fields = Union[List[Union[Callable, str]], Sequence[str], Literal["__all__"]]
+_Fields = Union[Collection[str], Literal["__all__"]]
 _Labels = Dict[str, str]
 _ErrorMessages = Dict[str, Dict[str, str]]
 
diff --git a/setup.py b/setup.py
index 95d0b4979..59a205f5b 100644
--- a/setup.py
+++ b/setup.py
@@ -21,7 +21,7 @@ def find_stub_files(name: str) -> List[str]:
     readme = f.read()
 
 dependencies = [
-    "mypy>=0.790",
+    "mypy>=0.900",
     "typing-extensions",
     "django",
     "django-stubs-ext",

"field" and "exclude" arguments of model_to_dict() do not accept sets
# Bug report

## What's wrong

Our test suite contains code that simplifies to this fragment:
```py
from typing import Mapping

from django.db.models.base import Model
from django.forms import model_to_dict


def check(instance: Model, data: Mapping[str, object]) -> None:
    assert data == model_to_dict(instance, fields=data.keys())
```

When checking that with mypy, it reports:
```
testcase.py:8: error: Argument "fields" to "model_to_dict" has incompatible type "AbstractSet[str]";
expected "Union[List[Union[Callable[..., Any], str]], Sequence[str], Literal['__all__'], None]"
[arg-type]
        assert data == model_to_dict(instance, fields=data.keys())
```

## How is that should be

The implementation of `model_to_dict()` only needs `__bool__()` and `__contains__()` to be provided by the `fields` and `exclude` arguments, so passing a keys set should not be flagged as an error.

I think a solution could be to replace `Sequence` in the stubs annotation with `Collection`.

## System information

- OS: Ubuntu Linux 18.04
- `python` version: 3.6.9
- `django` version: 2.2.1
- `mypy` version: 0.812
- `django-stubs` version: 1.8.0

