Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions django-stubs/core/files/base.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unused import

import types
from types import TracebackType
from typing import IO, AnyStr, Iterator, Optional, Type, TypeVar, Union, type_check_only

from django.core.files.utils import FileProxyMixin
Expand All @@ -26,7 +25,7 @@ class File(FileProxyMixin[AnyStr], IO[AnyStr]):
self,
exc_type: Optional[Type[BaseException]],
exc_value: Optional[BaseException],
tb: Optional[types.TracebackType],
exc_tb: Optional[TracebackType],
) -> None: ...
def open(self: _T, mode: Optional[str] = ...) -> _T: ...
def close(self) -> None: ...
Expand Down
7 changes: 5 additions & 2 deletions django-stubs/core/mail/backends/base.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import types
from types import TracebackType
from typing import Any, Optional, Sequence, Type, TypeVar

from django.core.mail.message import EmailMessage
Expand All @@ -12,6 +12,9 @@ class BaseEmailBackend:
def close(self) -> None: ...
def __enter__(self: _T) -> _T: ...
def __exit__(
self, exc_type: Type[BaseException], exc_value: BaseException, traceback: types.TracebackType
self,
exc_type: Optional[Type[BaseException]],
exc_value: Optional[BaseException],
exc_tb: Optional[TracebackType],
) -> None: ...
def send_messages(self, email_messages: Sequence[EmailMessage]) -> int: ...
8 changes: 7 additions & 1 deletion django-stubs/db/backends/base/schema.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from logging import Logger
from types import TracebackType
from typing import Any, ContextManager, List, Optional, Sequence, Tuple, Type, Union

from django.db.backends.base.base import BaseDatabaseWrapper
Expand Down Expand Up @@ -47,7 +48,12 @@ class BaseDatabaseSchemaEditor(ContextManager[Any]):
deferred_sql: Any = ...
atomic: Any = ...
def __enter__(self) -> BaseDatabaseSchemaEditor: ...
def __exit__(self, exc_type: Any, exc_value: Any, traceback: Any) -> None: ...
def __exit__(
self,
exc_type: Optional[Type[BaseException]],
exc_value: Optional[BaseException],
exc_tb: Optional[TracebackType],
) -> None: ...
def execute(self, sql: Union[Statement, str], params: Optional[Sequence[Any]] = ...) -> None: ...
def quote_name(self, name: str) -> str: ...
def column_sql(
Expand Down
8 changes: 4 additions & 4 deletions django-stubs/db/backends/utils.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import datetime
import types
from contextlib import contextmanager
from decimal import Decimal
from logging import Logger
from types import TracebackType
from typing import (
Any,
Dict,
Expand Down Expand Up @@ -48,9 +48,9 @@ class CursorWrapper:
def __enter__(self) -> CursorWrapper: ...
def __exit__(
self,
type: Optional[Type[BaseException]],
value: Optional[BaseException],
traceback: Optional[types.TracebackType],
exc_type: Optional[Type[BaseException]],
exc_value: Optional[BaseException],
exc_tb: Optional[TracebackType],
) -> None: ...
def callproc(
self, procname: str, params: Optional[Sequence[Any]] = ..., kparams: Optional[Dict[str, int]] = ...
Expand Down
4 changes: 2 additions & 2 deletions django-stubs/db/transaction.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from contextlib import ContextDecorator, contextmanager
Copy link
Contributor Author

Choose a reason for hiding this comment

The 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

Expand Down Expand Up @@ -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
Expand Down
7 changes: 5 additions & 2 deletions django-stubs/db/utils.pyi
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
Copy link
Contributor Author

Choose a reason for hiding this comment

The 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
Expand All @@ -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: ...
Expand Down
8 changes: 7 additions & 1 deletion django-stubs/template/context.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from contextlib import contextmanager
from types import TracebackType
from typing import Any, Callable, Dict, Iterable, Iterator, List, Optional, Type, TypeVar, Union

from django.http.request import HttpRequest
Expand All @@ -16,7 +17,12 @@ class ContextDict(dict):
context: BaseContext = ...
def __init__(self, context: BaseContext, *args: Any, **kwargs: Any) -> None: ...
def __enter__(self) -> ContextDict: ...
def __exit__(self, *args: Any, **kwargs: Any) -> None: ...
def __exit__(
self,
exc_type: Optional[Type[BaseException]],
exc_value: Optional[BaseException],
exc_tb: Optional[TracebackType],
) -> None: ...

class BaseContext(Iterable[Any]):
def __init__(self, dict_: Any = ...) -> None: ...
Expand Down
14 changes: 10 additions & 4 deletions django-stubs/test/testcases.pyi
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,
Expand Down Expand Up @@ -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: ...
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

def message(self) -> str: ...
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

def __enter__(self) -> _AssertTemplateUsedContext: ...
def __exit__(
self,
exc_type: Optional[Type[BaseException]],
exc_value: Optional[BaseException],
exc_tb: Optional[TracebackType],
) -> None: ...

class _AssertTemplateNotUsedContext(_AssertTemplateUsedContext): ...

Expand Down
15 changes: 13 additions & 2 deletions django-stubs/test/utils.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ from contextlib import contextmanager
from decimal import Decimal
from io import StringIO
from logging import Logger
from types import TracebackType
from typing import (
Any,
Callable,
Expand Down Expand Up @@ -61,7 +62,12 @@ class TestContextDecorator:
def enable(self) -> Any: ...
def disable(self) -> None: ...
def __enter__(self) -> Optional[Apps]: ...
def __exit__(self, exc_type: None, exc_value: None, traceback: None) -> None: ...
def __exit__(
self,
exc_type: Optional[Type[BaseException]],
exc_value: Optional[BaseException],
exc_tb: Optional[TracebackType],
) -> None: ...
def decorate_class(self, cls: _TestClass) -> _TestClass: ...
def decorate_callable(self, func: _C) -> _C: ...
def __call__(self, decorated: _DecoratedTest) -> Any: ...
Expand Down Expand Up @@ -100,7 +106,12 @@ class CaptureQueriesContext:
@property
def captured_queries(self) -> List[Dict[str, str]]: ...
def __enter__(self) -> CaptureQueriesContext: ...
def __exit__(self, exc_type: None, exc_value: None, traceback: None) -> None: ...
def __exit__(
self,
exc_type: Optional[Type[BaseException]],
exc_value: Optional[BaseException],
exc_tb: Optional[TracebackType],
) -> None: ...

class ignore_warnings(TestContextDecorator):
ignore_kwargs: Dict[str, Any] = ...
Expand Down
2 changes: 1 addition & 1 deletion django-stubs/utils/archive.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Archive:
exc_type: Optional[Type[BaseException]],
exc_value: Optional[BaseException],
traceback: Optional[TracebackType],
) -> Optional[bool]: ...
Copy link
Contributor Author

Choose a reason for hiding this comment

The 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: ...
Expand Down
4 changes: 2 additions & 2 deletions django-stubs/utils/timezone.pyi
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import types
from contextlib import ContextDecorator
from datetime import date
from datetime import datetime as datetime
from datetime import time
from datetime import timedelta as timedelta
from datetime import timezone
from datetime import tzinfo as tzinfo
from types import TracebackType
from typing import Any, Optional, Type, Union, overload

import pytz
Expand Down Expand Up @@ -38,7 +38,7 @@ class override(ContextDecorator):
self,
exc_type: Optional[Type[BaseException]],
exc_value: Optional[BaseException],
traceback: Optional[types.TracebackType],
exc_tb: Optional[TracebackType],
) -> None: ...

def localtime(value: Optional[datetime] = ..., timezone: Optional[_TzInfoT] = ...) -> datetime: ...
Expand Down
4 changes: 2 additions & 2 deletions django-stubs/utils/translation/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import functools
import types
from contextlib import ContextDecorator
from types import TracebackType
from typing import Any, Callable, Optional, Type, Union

from django.http.request import HttpRequest
Expand Down Expand Up @@ -60,7 +60,7 @@ class override(ContextDecorator):
self,
exc_type: Optional[Type[BaseException]],
exc_value: Optional[BaseException],
traceback: Optional[types.TracebackType],
exc_tb: Optional[TracebackType],
) -> None: ...

def get_language() -> str: ...
Expand Down