File: request.py

package info (click to toggle)
python-django-stubs 5.2.9-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,832 kB
  • sloc: python: 5,185; makefile: 15; sh: 8
file content (10 lines) | stat: -rw-r--r-- 403 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
from mypy.plugin import MethodContext
from mypy.types import Type as MypyType
from mypy.types import UninhabitedType, get_proper_type


def check_querydict_is_mutable(ctx: MethodContext) -> MypyType:
    ret_type = get_proper_type(ctx.default_return_type)
    if isinstance(ret_type, UninhabitedType):
        ctx.api.fail("This QueryDict is immutable.", ctx.context)
    return ctx.default_return_type