typing: Amend inaccurate type annotations.

This amend some type annotations that turn out to be inaccurate with
django-stubs.
This commit is contained in:
PIG208
2021-07-26 23:32:10 +08:00
committed by Tim Abbott
parent caaa424ef5
commit e517f967b8
7 changed files with 23 additions and 10 deletions

View File

@@ -5,7 +5,7 @@ from typing import Any, Dict, List, Optional, Sequence
import pytz
from django.conf import settings
from django.db import connection
from django.db.backends.utils import CursorWrapper
from django.db.models.query import QuerySet
from django.template import loader
from django.urls import reverse
@@ -39,7 +39,7 @@ def make_table(
return content
def dictfetchall(cursor: connection.cursor) -> List[Dict[str, Any]]:
def dictfetchall(cursor: CursorWrapper) -> List[Dict[str, Any]]:
"Returns all rows from a cursor as a dict"
desc = cursor.description
return [dict(zip((col[0] for col in desc), row)) for row in cursor.fetchall()]