mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-13 15:31:55 +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
|
| 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.7.0 | 0.790 | 2.2.x \|\| 3.x | ^3.6
|
||||||
| 1.6.0 | 0.780 | 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
|
| 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:
|
class Atomic:
|
||||||
using: Optional[str] = ...
|
using: Optional[str] = ...
|
||||||
savepoint: bool = ...
|
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.
|
# When decorating, return the decorated function as-is, rather than clobbering it as ContextDecorator does.
|
||||||
def __call__(self, func: _C) -> _C: ...
|
def __call__(self, func: _C) -> _C: ...
|
||||||
def __enter__(self) -> None: ...
|
def __enter__(self) -> None: ...
|
||||||
@@ -38,7 +38,7 @@ def atomic(using: _C) -> _C: ...
|
|||||||
|
|
||||||
# Decorator or context-manager with parameters
|
# Decorator or context-manager with parameters
|
||||||
@overload
|
@overload
|
||||||
def atomic(using: Optional[str] = ..., savepoint: bool = ...) -> Atomic: ...
|
def atomic(using: Optional[str] = ..., savepoint: bool = ..., durable: bool = ...) -> Atomic: ...
|
||||||
|
|
||||||
# Bare decorator
|
# Bare decorator
|
||||||
@overload
|
@overload
|
||||||
|
|||||||
@@ -7,6 +7,8 @@
|
|||||||
pass
|
pass
|
||||||
with transaction.atomic(using="mydb", savepoint=False):
|
with transaction.atomic(using="mydb", savepoint=False):
|
||||||
pass
|
pass
|
||||||
|
with transaction.atomic(using="mydb", savepoint=False, durable=True):
|
||||||
|
pass
|
||||||
|
|
||||||
- case: transaction_atomic_decorator
|
- case: transaction_atomic_decorator
|
||||||
main: |
|
main: |
|
||||||
|
|||||||
Reference in New Issue
Block a user