24
24
from typing import (
25
25
TYPE_CHECKING ,
26
26
Any ,
27
- Dict ,
28
27
Iterator ,
29
- List ,
30
28
Mapping ,
31
29
NoReturn ,
32
30
Optional ,
33
- Tuple ,
34
31
Type ,
35
32
Union ,
36
33
)
76
73
_UNKNOWN_ERROR : int = 8
77
74
_WRITE_CONCERN_ERROR : int = 64
78
75
79
- _COMMANDS : Tuple [str , str , str ] = ("insert" , "update" , "delete" )
76
+ _COMMANDS : tuple [str , str , str ] = ("insert" , "update" , "delete" )
80
77
81
78
82
79
class _Run :
@@ -85,8 +82,8 @@ class _Run:
85
82
def __init__ (self , op_type : int ) -> None :
86
83
"""Initialize a new Run object."""
87
84
self .op_type : int = op_type
88
- self .index_map : List [int ] = []
89
- self .ops : List [Any ] = []
85
+ self .index_map : list [int ] = []
86
+ self .ops : list [Any ] = []
90
87
self .idx_offset : int = 0
91
88
92
89
def index (self , idx : int ) -> int :
@@ -182,7 +179,7 @@ def __init__(
182
179
common .validate_is_document_type ("let" , self .let )
183
180
self .comment : Optional [str ] = comment
184
181
self .ordered = ordered
185
- self .ops : List [ Tuple [int , Mapping [str , Any ]]] = []
182
+ self .ops : list [ tuple [int , Mapping [str , Any ]]] = []
186
183
self .executed = False
187
184
self .bypass_doc_val = bypass_document_validation
188
185
self .uses_collation = False
@@ -219,12 +216,12 @@ def add_update(
219
216
multi : bool = False ,
220
217
upsert : bool = False ,
221
218
collation : Optional [Mapping [str , Any ]] = None ,
222
- array_filters : Optional [List [Mapping [str , Any ]]] = None ,
219
+ array_filters : Optional [list [Mapping [str , Any ]]] = None ,
223
220
hint : Union [str , SON [str , Any ], None ] = None ,
224
221
) -> None :
225
222
"""Create an update document and add it to the list of ops."""
226
223
validate_ok_for_update (update )
227
- cmd : Dict [str , Any ] = dict (
224
+ cmd : dict [str , Any ] = dict (
228
225
[("q" , selector ), ("u" , update ), ("multi" , multi ), ("upsert" , upsert )]
229
226
)
230
227
if collation is not None :
@@ -414,7 +411,7 @@ def execute_command(
414
411
generator : Iterator [Any ],
415
412
write_concern : WriteConcern ,
416
413
session : Optional [ClientSession ],
417
- ) -> Dict [str , Any ]:
414
+ ) -> dict [str , Any ]:
418
415
"""Execute using write commands."""
419
416
# nModified is only reported for write commands, not legacy ops.
420
417
full_result = {
0 commit comments