mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-10 22:11:54 +08:00
[3.2] Add durable argument to atomic (#586)
* [3.2] Add durable argument to atomic * Adjust compatibility table for 3.2 * Update README.md Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
This commit is contained in:
@@ -42,7 +42,8 @@ We rely on different `django` and `mypy` versions:
|
||||
|
||||
| django-stubs | mypy version | django version | python version
|
||||
| ------------ | ---- | ---- | ---- |
|
||||
| 1.8.0 | 0.812 | 2.2.x \|\| 3.x | ^3.6
|
||||
| 1.9.0-dev | 0.812 | 3.2.x | ^3.6
|
||||
| 1.8.0 | 0.812 | 3.1.x | ^3.6
|
||||
| 1.7.0 | 0.790 | 2.2.x \|\| 3.x | ^3.6
|
||||
| 1.6.0 | 0.780 | 2.2.x \|\| 3.x | ^3.6
|
||||
| 1.5.0 | 0.770 | 2.2.x \|\| 3.x | ^3.6
|
||||
|
||||
@@ -26,7 +26,7 @@ _C = TypeVar("_C", bound=Callable) # Any callable
|
||||
class Atomic:
|
||||
using: Optional[str] = ...
|
||||
savepoint: bool = ...
|
||||
def __init__(self, using: Optional[str], savepoint: bool) -> None: ...
|
||||
def __init__(self, using: Optional[str], savepoint: bool, durable: bool) -> None: ...
|
||||
# When decorating, return the decorated function as-is, rather than clobbering it as ContextDecorator does.
|
||||
def __call__(self, func: _C) -> _C: ...
|
||||
def __enter__(self) -> None: ...
|
||||
@@ -38,7 +38,7 @@ def atomic(using: _C) -> _C: ...
|
||||
|
||||
# Decorator or context-manager with parameters
|
||||
@overload
|
||||
def atomic(using: Optional[str] = ..., savepoint: bool = ...) -> Atomic: ...
|
||||
def atomic(using: Optional[str] = ..., savepoint: bool = ..., durable: bool = ...) -> Atomic: ...
|
||||
|
||||
# Bare decorator
|
||||
@overload
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
pass
|
||||
with transaction.atomic(using="mydb", savepoint=False):
|
||||
pass
|
||||
with transaction.atomic(using="mydb", savepoint=False, durable=True):
|
||||
pass
|
||||
|
||||
- case: transaction_atomic_decorator
|
||||
main: |
|
||||
|
||||
Reference in New Issue
Block a user