1
1
"""The standard domain."""
2
2
3
3
import re
4
- import sys
5
4
from copy import copy
6
- from typing import (TYPE_CHECKING , Any , Callable , Dict , Iterable , Iterator , List , Optional ,
7
- Tuple , Type , Union , cast )
5
+ from typing import (TYPE_CHECKING , Any , Callable , Dict , Final , Iterable , Iterator , List ,
6
+ Optional , Tuple , Type , Union , cast )
8
7
9
8
from docutils import nodes
10
9
from docutils .nodes import Element , Node , system_message
29
28
30
29
logger = logging .getLogger (__name__ )
31
30
32
- if sys .version_info [:2 ] >= (3 , 8 ):
33
- from typing import Final
34
- else :
35
- Final = Any
36
-
37
31
# RE for option descriptions
38
32
option_desc_re = re .compile (r'((?:/|--|-|\+)?[^\s=]+)(=?\s*.*)' )
39
33
# RE for grammar tokens
@@ -589,7 +583,7 @@ class StandardDomain(Domain):
589
583
'doc' : XRefRole (warn_dangling = True , innernodeclass = nodes .inline ),
590
584
}
591
585
592
- initial_data : Final = {
586
+ initial_data : Final = { # type: ignore[misc]
593
587
'progoptions' : {}, # (program, name) -> docname, labelid
594
588
'objects' : {}, # (type, name) -> docname, labelid
595
589
'labels' : { # labelname -> docname, labelid, sectionname
@@ -604,6 +598,12 @@ class StandardDomain(Domain):
604
598
},
605
599
}
606
600
601
+ _virtual_doc_names : Dict [str , Tuple [str , str ]] = { # labelname -> docname, sectionname
602
+ 'genindex' : ('genindex' , _ ('Index' )),
603
+ 'modindex' : ('py-modindex' , _ ('Module Index' )),
604
+ 'search' : ('search' , _ ('Search Page' )),
605
+ }
606
+
607
607
dangling_warnings = {
608
608
'term' : 'term not in glossary: %(target)r' ,
609
609
'numref' : 'undefined label: %(target)r' ,
0 commit comments