@@ -275,10 +275,10 @@ def apply(self, **kwargs: Any) -> None:
275275 patch = patch .next_node ()
276276
277277 # ignore unexpected markups in translation message
278- unexpected = (
278+ unexpected : Tuple [ Type [ Element ], ...] = (
279279 nodes .paragraph , # expected form of translation
280280 nodes .title # generated by above "Subelements phase2"
281- ) # type: Tuple[Type[Element], ...]
281+ )
282282
283283 # following types are expected if
284284 # config.gettext_additional_targets is configured
@@ -296,16 +296,16 @@ def list_replace_or_append(lst: List[N], old: N, new: N) -> None:
296296 lst .append (new )
297297
298298 is_autofootnote_ref = NodeMatcher (nodes .footnote_reference , auto = Any )
299- old_foot_refs = node . traverse ( is_autofootnote_ref ) # type : List[nodes.footnote_reference] # NOQA
300- new_foot_refs = patch . traverse ( is_autofootnote_ref ) # type : List[nodes.footnote_reference] # NOQA
299+ old_foot_refs : List [nodes .footnote_reference ] = node . traverse ( is_autofootnote_ref )
300+ new_foot_refs : List [nodes .footnote_reference ] = patch . traverse ( is_autofootnote_ref )
301301 if len (old_foot_refs ) != len (new_foot_refs ):
302302 old_foot_ref_rawsources = [ref .rawsource for ref in old_foot_refs ]
303303 new_foot_ref_rawsources = [ref .rawsource for ref in new_foot_refs ]
304304 logger .warning (__ ('inconsistent footnote references in translated message.' +
305305 ' original: {0}, translated: {1}' )
306306 .format (old_foot_ref_rawsources , new_foot_ref_rawsources ),
307307 location = node )
308- old_foot_namerefs = {} # type : Dict[str, List[nodes.footnote_reference]]
308+ old_foot_namerefs : Dict [str , List [nodes .footnote_reference ]] = {}
309309 for r in old_foot_refs :
310310 old_foot_namerefs .setdefault (r .get ('refname' ), []).append (r )
311311 for newf in new_foot_refs :
@@ -339,8 +339,8 @@ def list_replace_or_append(lst: List[N], old: N, new: N) -> None:
339339 # * use translated refname for section refname.
340340 # * inline reference "`Python <...>`_" has no 'refname'.
341341 is_refnamed_ref = NodeMatcher (nodes .reference , refname = Any )
342- old_refs = node .traverse (is_refnamed_ref ) # type: List[nodes.reference]
343- new_refs = patch .traverse (is_refnamed_ref ) # type: List[nodes.reference]
342+ old_refs : List [ nodes . reference ] = node .traverse (is_refnamed_ref )
343+ new_refs : List [ nodes . reference ] = patch .traverse (is_refnamed_ref )
344344 if len (old_refs ) != len (new_refs ):
345345 old_ref_rawsources = [ref .rawsource for ref in old_refs ]
346346 new_ref_rawsources = [ref .rawsource for ref in new_refs ]
@@ -368,7 +368,7 @@ def list_replace_or_append(lst: List[N], old: N, new: N) -> None:
368368 is_refnamed_footnote_ref = NodeMatcher (nodes .footnote_reference , refname = Any )
369369 old_foot_refs = node .traverse (is_refnamed_footnote_ref )
370370 new_foot_refs = patch .traverse (is_refnamed_footnote_ref )
371- refname_ids_map = {} # type : Dict[str, List[str]]
371+ refname_ids_map : Dict [str , List [str ]] = {}
372372 if len (old_foot_refs ) != len (new_foot_refs ):
373373 old_foot_ref_rawsources = [ref .rawsource for ref in old_foot_refs ]
374374 new_foot_ref_rawsources = [ref .rawsource for ref in new_foot_refs ]
@@ -385,8 +385,8 @@ def list_replace_or_append(lst: List[N], old: N, new: N) -> None:
385385
386386 # citation should use original 'ids'.
387387 is_citation_ref = NodeMatcher (nodes .citation_reference , refname = Any )
388- old_cite_refs = node . traverse ( is_citation_ref ) # type : List[nodes.citation_reference] # NOQA
389- new_cite_refs = patch . traverse ( is_citation_ref ) # type : List[nodes.citation_reference] # NOQA
388+ old_cite_refs : List [nodes .citation_reference ] = node . traverse ( is_citation_ref )
389+ new_cite_refs : List [nodes .citation_reference ] = patch . traverse ( is_citation_ref )
390390 refname_ids_map = {}
391391 if len (old_cite_refs ) != len (new_cite_refs ):
392392 old_cite_ref_rawsources = [ref .rawsource for ref in old_cite_refs ]
@@ -456,7 +456,7 @@ def get_ref_key(node: addnodes.pending_xref) -> Tuple[str, str, str]:
456456 if 'index' in self .config .gettext_additional_targets :
457457 # Extract and translate messages for index entries.
458458 for node , entries in traverse_translatable_index (self .document ):
459- new_entries = [] # type : List[Tuple[str, str, str, str, str]]
459+ new_entries : List [Tuple [str , str , str , str , str ]] = [ ]
460460 for type , msg , tid , main , key_ in entries :
461461 msg_parts = split_index_msg (type , msg )
462462 msgstr_parts = []
0 commit comments