Fix BaseConnectionWrapper.execute_wrapper (#752)

This is a context manager, not an iterator.

Currently mypy will complain if it's used as documented.
This commit is contained in:
Sigurd Ljødal
2021-11-15 16:14:42 +01:00
committed by GitHub
parent 331042d1c7
commit a57ae4fc76

View File

@@ -1,5 +1,5 @@
from datetime import tzinfo
from typing import Any, Callable, Dict, Iterator, List, Optional, Type, TypeVar
from typing import Any, Callable, ContextManager, Dict, Iterator, List, Optional, Type, TypeVar
from django.db.backends.base.client import BaseDatabaseClient
from django.db.backends.base.creation import BaseDatabaseCreation
@@ -98,5 +98,5 @@ class BaseDatabaseWrapper:
def schema_editor(self, *args: Any, **kwargs: Any) -> BaseDatabaseSchemaEditor: ...
def on_commit(self, func: Callable[[], None]) -> None: ...
def run_and_clear_commit_hooks(self) -> None: ...
def execute_wrapper(self, wrapper: _ExecuteWrapper) -> Iterator[None]: ...
def execute_wrapper(self, wrapper: _ExecuteWrapper) -> ContextManager[None]: ...
def copy(self: _T, alias: Optional[str] = ...) -> _T: ...