5050RELEASE_NOTES_DOC = os .path .join (DOCS_DIR , "ReleaseNotes.rst" )
5151
5252
53+ # Label extracted from :doc:`...`.
5354CheckLabel = str
5455Lines = List [str ]
5556BulletBlock = List [str ]
57+
58+ # Pair of the extracted label and its block
5659BulletItem = Tuple [CheckLabel , BulletBlock ]
60+
61+ # Index of the first line of a bullet block within the full lines list.
5762BulletStart = int
5863
64+ # All occurrences for a given label.
65+ DuplicateOccurrences = List [Tuple [BulletStart , BulletBlock ]]
5966
6067class BulletBlocks (NamedTuple ):
6168 """Structured result of parsing a bullet-list section.
@@ -217,7 +224,7 @@ def sort_blocks(blocks: List[BulletItem]) -> List[BulletBlock]:
217224
218225def find_duplicate_entries (
219226 lines : Sequence [str ], title : str
220- ) -> List [Tuple [str , List [ Tuple [ int , List [ str ]]] ]]:
227+ ) -> List [Tuple [CheckLabel , DuplicateOccurrences ]]:
221228 """Return detailed duplicate info as (key, [(start_idx, block_lines), ...]).
222229
223230 start_idx is the 0-based index of the first line of the bullet block in
@@ -235,17 +242,17 @@ def find_duplicate_entries(
235242 while i < n and not _is_bullet_start (lines [i ]):
236243 i += 1
237244
238- blocks_with_pos : List [Tuple [str , int , List [ str ] ]] = []
245+ blocks_with_pos : List [Tuple [CheckLabel , BulletStart , BulletBlock ]] = []
239246 res = _scan_bullet_blocks (lines , i , n )
240247 for bstart , block in res .blocks_with_pos :
241248 key = extract_label (block [0 ])
242249 blocks_with_pos .append ((key , bstart , block ))
243250
244- grouped : Dict [str , List [ Tuple [ int , List [ str ]]] ] = {}
251+ grouped : Dict [CheckLabel , DuplicateOccurrences ] = {}
245252 for key , start , block in blocks_with_pos :
246253 grouped .setdefault (key , []).append ((start , block ))
247254
248- result : List [Tuple [str , List [ Tuple [ int , List [ str ]]] ]] = []
255+ result : List [Tuple [CheckLabel , DuplicateOccurrences ]] = []
249256 for key , occs in grouped .items ():
250257 if len (occs ) > 1 :
251258 result .append ((key , occs ))
0 commit comments