4040
4141
4242def 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 ]]:
4646 for k , v in src .items ():
4747 if k not in dst :
4848 dst [k ] = v
@@ -51,15 +51,15 @@ def merge_dict(
5151
5252def get_basename (
5353 text : str ,
54- options : t . Dict [str , str ],
54+ options : dict [str , str ],
5555 prefix : t .Optional [str ] = "aafig" ,
5656) -> str :
5757 options = options .copy ()
5858 if "format" in options :
5959 del options ["format" ]
6060 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_ } "
6363
6464
6565class AafigError (SphinxError ):
@@ -83,7 +83,7 @@ class AafigDirective(images.Image): # type:ignore
8383 option_spec = images .Image .option_spec .copy ()
8484 option_spec .update (own_option_spec )
8585
86- def run (self ) -> t . List [nodes .Node ]:
86+ def run (self ) -> list [nodes .Node ]:
8787 aafig_options = {}
8888 own_options_keys = [self .own_option_spec .keys (), "scale" ]
8989 for k , v in self .options .items ():
@@ -120,13 +120,13 @@ def render_aafig_images(app: "Sphinx", doctree: nodes.Node) -> None:
120120 continue
121121 options = img .aafig ["options" ]
122122 text = img .aafig ["text" ]
123- _format = app .builder .format
123+ format_ = app .builder .format
124124 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_ ]
127127 else :
128128 logger .warning (
129- f'unsupported builder format "{ _format } ", please '
129+ f'unsupported builder format "{ format_ } ", please '
130130 "add a custom entry in aafig_format config "
131131 "option for this builder" ,
132132 )
@@ -159,8 +159,8 @@ def __init__(self, *args: object, **kwargs: object) -> None:
159159def render_aafigure (
160160 app : "Sphinx" ,
161161 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 ]]:
164164 """Render an ASCII art figure into the requested format output file."""
165165 if aafigure is None :
166166 raise AafigureNotInstalled
0 commit comments