@@ -328,7 +328,7 @@ class CoreFieldParameters(TypedDict):
328
328
},
329
329
"constraints" : {
330
330
"description" : "List of constraint names, which are defined for this need." ,
331
- "schema" : {"type" : "array" , "items" : {"type" : "string" }, "default" : [] },
331
+ "schema" : {"type" : "array" , "items" : {"type" : "string" }, "default" : () },
332
332
"allow_default" : "str_list" ,
333
333
"allow_df" : True ,
334
334
"allow_extend" : True ,
@@ -361,7 +361,7 @@ class CoreFieldParameters(TypedDict):
361
361
},
362
362
"sections" : {
363
363
"description" : "Sections of the need." ,
364
- "schema" : {"type" : "array" , "items" : {"type" : "string" }, "default" : [] },
364
+ "schema" : {"type" : "array" , "items" : {"type" : "string" }, "default" : () },
365
365
"exclude_import" : True ,
366
366
},
367
367
"section_name" : {
@@ -424,10 +424,6 @@ class NeedsInfoType(TypedDict):
424
424
style : None | str
425
425
"""Comma-separated list of CSS classes (all appended by `needs_style_`)."""
426
426
427
- # TODO why is it called arch?
428
- arch : dict [str , str ]
429
- """Mapping of uml key to uml content."""
430
-
431
427
external_css : str
432
428
"""CSS class name, added to the external reference."""
433
429
@@ -439,21 +435,11 @@ class NeedsInfoType(TypedDict):
439
435
"""Hexadecimal color code of the type."""
440
436
type_style : str
441
437
442
- is_modified : bool
443
- """Whether the need was modified by needextend."""
444
438
modifications : int
445
439
"""Number of modifications by needextend."""
446
440
447
- # used to distinguish a part from a need
448
- is_need : bool
449
- is_part : bool
450
441
# Mapping of parts, a.k.a. sub-needs, IDs to data that overrides the need's data
451
- parts : dict [str , NeedsPartType ]
452
- # additional information required for compatibility with parts
453
- id_parent : str
454
- """<parent ID>, or <self ID> if not a part."""
455
- id_complete : str
456
- """<parent ID>.<self ID>, or <self ID> if not a part."""
442
+ parts : Mapping [str , NeedsPartType ]
457
443
458
444
# content creation information
459
445
jinja_content : bool
@@ -463,6 +449,8 @@ class NeedsInfoType(TypedDict):
463
449
content : str
464
450
pre_content : None | str
465
451
post_content : None | str
452
+ doctype : str
453
+ """Type of the document where the need is defined, e.g. '.rst'."""
466
454
467
455
# these default to False and are updated in check_links post-process
468
456
has_dead_links : bool
@@ -473,27 +461,45 @@ class NeedsInfoType(TypedDict):
473
461
"""
474
462
475
463
# constraints information
476
- constraints : list [str ]
477
- """List of constraint names, which are defined for this need."""
478
464
# set in process_need_nodes (-> process_constraints) transform
479
- constraints_results : dict [str , dict [str , bool ]]
465
+ constraints_results : Mapping [str , dict [str , bool ]]
480
466
"""Mapping of constraint name, to check name, to result."""
481
- constraints_passed : bool
482
- """True if all constraints passed, False if any failed, None if not yet checked."""
483
467
constraints_error : None | str
484
468
"""An error message set if any constraint failed, and `error_message` field is set in config."""
485
469
486
470
# additional source information
487
- doctype : str
488
- """Type of the document where the need is defined, e.g. '.rst'."""
489
471
# set in analyse_need_locations transform
490
- sections : list [str ]
491
- section_name : None | str
492
- """Simply the first section."""
472
+ sections : tuple [str , ...]
493
473
signature : None | str
494
474
"""Derived from a docutils desc_name node."""
475
+
476
+ arch : Mapping [str , str ] # short for architecture.
477
+ """Mapping of uml key to uml content."""
478
+
479
+
480
+ class NeedsInfoComputedType (TypedDict ):
481
+ """Data for a single need, that can be computed from existing data.
482
+
483
+ These fields are used for convenience in filters.
484
+ """
485
+
486
+ is_need : bool
487
+ is_part : bool
488
+ is_modified : bool
489
+ """Whether the need was modified by needextend."""
490
+ # additional information required for compatibility with parts
491
+ id_parent : str
492
+ """<parent ID>, or <self ID> if not a part."""
493
+ id_complete : str
494
+ """<parent ID>.<self ID>, or <self ID> if not a part."""
495
+ section_name : None | str
496
+ """Simply the first section."""
495
497
parent_need : None | str
496
498
"""Simply the first parent id."""
499
+ constraints : tuple [str , ...]
500
+ """List of constraint names, which are defined for this need."""
501
+ constraints_passed : bool
502
+ """True if all constraints passed, False if any failed, None if not yet checked."""
497
503
498
504
499
505
class NeedsBaseDataType (TypedDict ):
0 commit comments