40
40
41
41
42
42
def merge_dict (
43
- dst : t . Dict [str , t .Optional [str ]],
44
- src : t . Dict [str , t .Optional [str ]],
45
- ) -> t . Dict [str , t .Optional [str ]]:
43
+ dst : dict [str , t .Optional [str ]],
44
+ src : dict [str , t .Optional [str ]],
45
+ ) -> dict [str , t .Optional [str ]]:
46
46
for k , v in src .items ():
47
47
if k not in dst :
48
48
dst [k ] = v
@@ -51,15 +51,15 @@ def merge_dict(
51
51
52
52
def get_basename (
53
53
text : str ,
54
- options : t . Dict [str , str ],
54
+ options : dict [str , str ],
55
55
prefix : t .Optional [str ] = "aafig" ,
56
56
) -> str :
57
57
options = options .copy ()
58
58
if "format" in options :
59
59
del options ["format" ]
60
60
hashkey = text + str (options )
61
- _id = sha (hashkey .encode ("utf-8" )).hexdigest ()
62
- return f"{ prefix } -{ _id } "
61
+ id_ = sha (hashkey .encode ("utf-8" )).hexdigest ()
62
+ return f"{ prefix } -{ id_ } "
63
63
64
64
65
65
class AafigError (SphinxError ):
@@ -83,7 +83,7 @@ class AafigDirective(images.Image): # type:ignore
83
83
option_spec = images .Image .option_spec .copy ()
84
84
option_spec .update (own_option_spec )
85
85
86
- def run (self ) -> t . List [nodes .Node ]:
86
+ def run (self ) -> list [nodes .Node ]:
87
87
aafig_options = {}
88
88
own_options_keys = [self .own_option_spec .keys (), "scale" ]
89
89
for k , v in self .options .items ():
@@ -120,13 +120,13 @@ def render_aafig_images(app: "Sphinx", doctree: nodes.Node) -> None:
120
120
continue
121
121
options = img .aafig ["options" ]
122
122
text = img .aafig ["text" ]
123
- _format = app .builder .format
123
+ format_ = app .builder .format
124
124
merge_dict (options , app .builder .config .aafig_default_options )
125
- if _format in format_map :
126
- options ["format" ] = format_map [_format ]
125
+ if format_ in format_map :
126
+ options ["format" ] = format_map [format_ ]
127
127
else :
128
128
logger .warning (
129
- f'unsupported builder format "{ _format } ", please '
129
+ f'unsupported builder format "{ format_ } ", please '
130
130
"add a custom entry in aafig_format config "
131
131
"option for this builder" ,
132
132
)
@@ -159,8 +159,8 @@ def __init__(self, *args: object, **kwargs: object) -> None:
159
159
def render_aafigure (
160
160
app : "Sphinx" ,
161
161
text : str ,
162
- options : t . Dict [str , str ],
163
- ) -> t . Tuple [str , str , t .Optional [str ], t .Optional [str ]]:
162
+ options : dict [str , str ],
163
+ ) -> tuple [str , str , t .Optional [str ], t .Optional [str ]]:
164
164
"""Render an ASCII art figure into the requested format output file."""
165
165
if aafigure is None :
166
166
raise AafigureNotInstalled
0 commit comments