6
6
from docutils .parsers import rst
7
7
8
8
PYPA_SPEC_BASE_URL = "https://packaging.python.org/en/latest/specifications/"
9
- TYPING_SPEC_BASE_URL = "https://typing.readthedocs.io /en/latest/spec/"
9
+ TYPING_SPEC_BASE_URL = "https://typing.python.org /en/latest/spec/"
10
10
11
11
12
12
class PEPBanner (rst .Directive ):
@@ -26,16 +26,16 @@ class PEPBanner(rst.Directive):
26
26
css_classes = []
27
27
28
28
def run (self ) -> list [nodes .admonition ]:
29
-
30
29
if self .arguments :
31
30
link_content = self .arguments [0 ]
32
- pre_text = self .admonition_pre_template .format (
33
- link_content = link_content )
31
+ pre_text = self .admonition_pre_template .format (link_content = link_content )
34
32
else :
35
33
pre_text = self .admonition_pre_text
36
34
37
- close_button_node = nodes .paragraph ('' , '' , nodes .Text ('×' ), classes = ['close-button' ])
38
- close_button_node ['classes' ].append ('close-button' )
35
+ close_button_node = nodes .paragraph (
36
+ "" , "" , nodes .Text ("×" ), classes = ["close-button" ]
37
+ )
38
+ close_button_node ["classes" ].append ("close-button" )
39
39
40
40
pre_text_node = nodes .paragraph (pre_text )
41
41
pre_text_node .line = self .lineno
@@ -50,13 +50,13 @@ def run(self) -> list[nodes.admonition]:
50
50
51
51
source_lines = [pre_text ] + list (self .content or []) + [post_text ]
52
52
admonition_node = self .admonition_class (
53
- "\n " .join (source_lines ), classes = ["pep-banner" ] + self .css_classes )
53
+ "\n " .join (source_lines ), classes = ["pep-banner" ] + self .css_classes
54
+ )
54
55
55
56
admonition_node .append (pre_text_node )
56
57
admonition_node .append (close_button_node )
57
58
if self .content :
58
- self .state .nested_parse (
59
- self .content , self .content_offset , admonition_node )
59
+ self .state .nested_parse (self .content , self .content_offset , admonition_node )
60
60
admonition_node .append (post_text_node )
61
61
62
62
return [admonition_node ]
@@ -74,9 +74,7 @@ class CanonicalDocBanner(PEPBanner):
74
74
"This PEP is a historical document. "
75
75
"The up-to-date, canonical documentation can now be found elsewhere."
76
76
)
77
- admonition_post_text = (
78
- "See :pep:`1` for how to propose changes."
79
- )
77
+ admonition_post_text = "See :pep:`1` for how to propose changes."
80
78
css_classes = ["canonical-doc" , "sticky-banner" ]
81
79
82
80
@@ -113,7 +111,7 @@ class CanonicalTypingSpecBanner(PEPBanner):
113
111
admonition_pre_text = admonition_pre_template
114
112
admonition_post_text = (
115
113
"See the `typing specification update process "
116
- "<https://typing.readthedocs.io /en/latest/spec/meta.html>`__ "
114
+ "<https://typing.python.org /en/latest/spec/meta.html>`__ "
117
115
"for how to propose changes to the typing spec."
118
116
)
119
117
css_classes = ["canonical-typing-spec" , "sticky-banner" ]
0 commit comments