-
-
Notifications
You must be signed in to change notification settings - Fork 506
Standardize all context manager __exit__ methods #1194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from contextlib import ContextDecorator, contextmanager | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. unused import |
||
from contextlib import contextmanager | ||
from types import TracebackType | ||
from typing import Any, Callable, Iterator, Optional, Type, TypeVar, overload | ||
|
||
|
@@ -35,7 +35,7 @@ class Atomic: | |
self, | ||
exc_type: Optional[Type[BaseException]], | ||
exc_value: Optional[BaseException], | ||
traceback: Optional[TracebackType], | ||
exc_tb: Optional[TracebackType], | ||
) -> None: ... | ||
|
||
# Bare decorator | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
from types import TracebackType | ||
from typing import Any, Dict, Iterable, Iterator, List, Optional, Type | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. unused import |
||
from typing import Any, Dict, Iterable, List, Optional, Type | ||
|
||
from django.apps import AppConfig | ||
from django.db.backends.base.base import BaseDatabaseWrapper | ||
|
@@ -24,7 +24,10 @@ class DatabaseErrorWrapper: | |
def __init__(self, wrapper: Any) -> None: ... | ||
def __enter__(self) -> None: ... | ||
def __exit__( | ||
self, exc_type: Optional[Type[BaseException]], exc_value: Optional[BaseException], traceback: TracebackType | ||
self, | ||
exc_type: Optional[Type[BaseException]], | ||
exc_value: Optional[BaseException], | ||
exc_tb: Optional[TracebackType], | ||
) -> None: ... | ||
|
||
def load_backend(backend_name: str) -> Any: ... | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
import threading | ||
import unittest | ||
from datetime import date | ||
from types import TracebackType | ||
from typing import ( | ||
Any, | ||
Callable, | ||
|
@@ -50,10 +51,15 @@ class _AssertTemplateUsedContext: | |
context: ContextList = ... | ||
def __init__(self, test_case: Any, template_name: Any) -> None: ... | ||
def on_template_render(self, sender: Any, signal: Any, template: Any, context: Any, **kwargs: Any) -> None: ... | ||
def test(self): ... | ||
def message(self): ... | ||
def __enter__(self): ... | ||
def __exit__(self, exc_type: Any, exc_value: Any, traceback: Any): ... | ||
def test(self) -> None: ... | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
def message(self) -> str: ... | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed in Django 4.1, but previously returned a |
||
def __enter__(self) -> _AssertTemplateUsedContext: ... | ||
def __exit__( | ||
self, | ||
exc_type: Optional[Type[BaseException]], | ||
exc_value: Optional[BaseException], | ||
exc_tb: Optional[TracebackType], | ||
) -> None: ... | ||
|
||
class _AssertTemplateNotUsedContext(_AssertTemplateUsedContext): ... | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ class Archive: | |
exc_type: Optional[Type[BaseException]], | ||
exc_value: Optional[BaseException], | ||
traceback: Optional[TracebackType], | ||
) -> Optional[bool]: ... | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
) -> None: ... | ||
def extract(self, to_path: str) -> None: ... | ||
def list(self) -> None: ... | ||
def close(self) -> None: ... | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused import