1616import tempfile
1717from datetime import datetime
1818from pathlib import Path
19- from typing import Callable , Dict , Iterable , List , Optional , Sequence , Set , Tuple , Union
19+ from typing import Callable , Iterable , Optional , Sequence , Union
2020
2121from tabulate import tabulate
2222
@@ -192,7 +192,7 @@ def querybuilder():
192192 EXPORT_LOGGER .report (initial_summary )
193193
194194 # Store starting UUIDs, to write to metadata
195- starting_uuids : Dict [EntityTypes , Set [str ]] = {
195+ starting_uuids : dict [EntityTypes , set [str ]] = {
196196 EntityTypes .USER : set (),
197197 EntityTypes .COMPUTER : set (),
198198 EntityTypes .GROUP : set (),
@@ -201,7 +201,7 @@ def querybuilder():
201201
202202 # Store all entity IDs to be written to the archive
203203 # Note, this is the order they will be written to the archive
204- entity_ids : Dict [EntityTypes , Set [int ]] = {
204+ entity_ids : dict [EntityTypes , set [int ]] = {
205205 ent : set ()
206206 for ent in [
207207 EntityTypes .USER ,
@@ -376,12 +376,12 @@ def transform(d):
376376
377377def _collect_all_entities (
378378 querybuilder : QbType ,
379- entity_ids : Dict [EntityTypes , Set [int ]],
379+ entity_ids : dict [EntityTypes , set [int ]],
380380 include_authinfos : bool ,
381381 include_comments : bool ,
382382 include_logs : bool ,
383383 batch_size : int ,
384- ) -> Tuple [ List [ Tuple [int , int ]], Set [LinkQuadruple ]]:
384+ ) -> tuple [ list [ tuple [int , int ]], set [LinkQuadruple ]]:
385385 """Collect all entities.
386386
387387 :returns: (group_id_to_node_id, link_data) and updates entity_ids
@@ -393,11 +393,7 @@ def progress_str(name):
393393 with get_progress_reporter ()(desc = progress_str ('' ), total = 9 ) as progress :
394394 progress .set_description_str (progress_str ('Nodes' ))
395395 entity_ids [EntityTypes .NODE ].update (
396- querybuilder ()
397- .append (orm .Node , project = 'id' )
398- .all ( # type: ignore[arg-type]
399- batch_size = batch_size , flat = True
400- )
396+ querybuilder ().append (orm .Node , project = 'id' ).all (batch_size = batch_size , flat = True )
401397 )
402398 progress .update ()
403399
@@ -417,7 +413,7 @@ def progress_str(name):
417413 querybuilder ()
418414 .append (
419415 orm .Group ,
420- project = 'id' , # type: ignore[arg-type]
416+ project = 'id' ,
421417 )
422418 .all (batch_size = batch_size , flat = True )
423419 )
@@ -429,15 +425,15 @@ def progress_str(name):
429425 .append (orm .Node , with_group = 'group' , project = 'id' )
430426 .distinct ()
431427 )
432- group_nodes : List [ Tuple [int , int ]] = qbuilder .all (batch_size = batch_size ) # type: ignore[assignment]
428+ group_nodes : list [ tuple [int , int ]] = qbuilder .all (batch_size = batch_size ) # type: ignore[assignment]
433429
434430 progress .set_description_str (progress_str ('Computers' ))
435431 progress .update ()
436432 entity_ids [EntityTypes .COMPUTER ].update (
437433 querybuilder ()
438434 .append (
439435 orm .Computer ,
440- project = 'id' , # type: ignore[arg-type]
436+ project = 'id' ,
441437 )
442438 .all (batch_size = batch_size , flat = True )
443439 )
@@ -449,7 +445,7 @@ def progress_str(name):
449445 querybuilder ()
450446 .append (
451447 orm .AuthInfo ,
452- project = 'id' , # type: ignore[arg-type]
448+ project = 'id' ,
453449 )
454450 .all (batch_size = batch_size , flat = True )
455451 )
@@ -461,7 +457,7 @@ def progress_str(name):
461457 querybuilder ()
462458 .append (
463459 orm .Log ,
464- project = 'id' , # type: ignore[arg-type]
460+ project = 'id' ,
465461 )
466462 .all (batch_size = batch_size , flat = True )
467463 )
@@ -473,7 +469,7 @@ def progress_str(name):
473469 querybuilder ()
474470 .append (
475471 orm .Comment ,
476- project = 'id' , # type: ignore[arg-type]
472+ project = 'id' ,
477473 )
478474 .all (batch_size = batch_size , flat = True )
479475 )
@@ -484,7 +480,7 @@ def progress_str(name):
484480 querybuilder ()
485481 .append (
486482 orm .User ,
487- project = 'id' , # type: ignore[arg-type]
483+ project = 'id' ,
488484 )
489485 .all (batch_size = batch_size , flat = True )
490486 )
@@ -494,14 +490,14 @@ def progress_str(name):
494490
495491def _collect_required_entities (
496492 querybuilder : QbType ,
497- entity_ids : Dict [EntityTypes , Set [int ]],
498- traversal_rules : Dict [str , bool ],
493+ entity_ids : dict [EntityTypes , set [int ]],
494+ traversal_rules : dict [str , bool ],
499495 include_authinfos : bool ,
500496 include_comments : bool ,
501497 include_logs : bool ,
502498 backend : StorageBackend ,
503499 batch_size : int ,
504- ) -> Tuple [ List [ Tuple [int , int ]], Set [LinkQuadruple ]]:
500+ ) -> tuple [ list [ tuple [int , int ]], set [LinkQuadruple ]]:
505501 """Collect required entities, given a set of starting entities and provenance graph traversal rules.
506502
507503 :returns: (group_id_to_node_id, link_data) and updates entity_ids
@@ -513,7 +509,7 @@ def progress_str(name):
513509 with get_progress_reporter ()(desc = progress_str ('' ), total = 7 ) as progress :
514510 # get all nodes from groups
515511 progress .set_description_str (progress_str ('Nodes (groups)' ))
516- group_nodes : List [ Tuple [int , int ]] = []
512+ group_nodes : list [ tuple [int , int ]] = []
517513 if entity_ids [EntityTypes .GROUP ]:
518514 qbuilder = querybuilder ()
519515 qbuilder .append (
@@ -632,7 +628,7 @@ def progress_str(name):
632628
633629
634630def _stream_repo_files (
635- key_format : str , writer : ArchiveWriterAbstract , node_ids : Set [int ], backend : StorageBackend , batch_size : int
631+ key_format : str , writer : ArchiveWriterAbstract , node_ids : set [int ], backend : StorageBackend , batch_size : int
636632) -> None :
637633 """Collect all repository object keys from the nodes, then stream the files to the archive."""
638634 keys = set (
@@ -652,7 +648,7 @@ def _stream_repo_files(
652648 progress .update ()
653649
654650
655- def _check_unsealed_nodes (querybuilder : QbType , node_ids : Set [int ], batch_size : int ) -> None :
651+ def _check_unsealed_nodes (querybuilder : QbType , node_ids : set [int ], batch_size : int ) -> None :
656652 """Check no process nodes are unsealed, i.e. all processes have completed."""
657653 qbuilder = (
658654 querybuilder ()
@@ -678,7 +674,7 @@ def _check_unsealed_nodes(querybuilder: QbType, node_ids: Set[int], batch_size:
678674
679675def _check_node_licenses (
680676 querybuilder : QbType ,
681- node_ids : Set [int ],
677+ node_ids : set [int ],
682678 allowed_licenses : Union [None , Sequence [str ], Callable ],
683679 forbidden_licenses : Union [None , Sequence [str ], Callable ],
684680 batch_size : int ,
0 commit comments