3838
3939
4040def  merge_dict (
41-     dst : t .Dict [str , t .Optional [str ]], src : t .Dict [str , t .Optional [str ]]
41+     dst : t .Dict [str , t .Optional [str ]],
42+     src : t .Dict [str , t .Optional [str ]],
4243) ->  t .Dict [str , t .Optional [str ]]:
4344    for  k , v  in  src .items ():
4445        if  k  not  in dst :
@@ -47,14 +48,16 @@ def merge_dict(
4748
4849
4950def  get_basename (
50-     text : str , options : t .Dict [str , str ], prefix : t .Optional [str ] =  "aafig" 
51+     text : str ,
52+     options : t .Dict [str , str ],
53+     prefix : t .Optional [str ] =  "aafig" ,
5154) ->  str :
5255    options  =  options .copy ()
5356    if  "format"  in  options :
5457        del  options ["format" ]
5558    hashkey  =  text  +  str (options )
56-     id  =  sha (hashkey .encode ("utf-8" )).hexdigest ()
57-     return  f"{ prefix } { id }  
59+     _id  =  sha (hashkey .encode ("utf-8" )).hexdigest ()
60+     return  f"{ prefix } { _id }  
5861
5962
6063class  AafigError (SphinxError ):
@@ -106,7 +109,7 @@ def render_aafig_images(app: "Sphinx", doctree: nodes.Node) -> None:
106109    if  aafigure  is  None :
107110        logger .warn (
108111            "aafigure module not installed, ASCII art images " 
109-             "will be rendered as literal text" 
112+             "will be rendered as literal text" , 
110113        )
111114    for  img  in  doctree .traverse (nodes .image ):
112115        if  not  hasattr (img , "aafig" ):
@@ -115,23 +118,23 @@ def render_aafig_images(app: "Sphinx", doctree: nodes.Node) -> None:
115118            continue 
116119        options  =  img .aafig ["options" ]
117120        text  =  img .aafig ["text" ]
118-         format  =  app .builder .format 
121+         _format  =  app .builder .format 
119122        merge_dict (options , app .builder .config .aafig_default_options )
120-         if  format  in  format_map :
121-             options ["format" ] =  format_map [format ]
123+         if  _format  in  format_map :
124+             options ["format" ] =  format_map [_format ]
122125        else :
123126            logger .warn (
124127                'unsupported builder format "%s", please ' 
125128                "add a custom entry in aafig_format config " 
126-                 "option for this builder"  %  format 
129+                 "option for this builder"  %  _format , 
127130            )
128131            img .replace_self (nodes .literal_block (text , text ))
129132            continue 
130133        if  options ["format" ] is  None :
131134            img .replace_self (nodes .literal_block (text , text ))
132135            continue 
133136        try :
134-             fname , outfn , id , extra  =  render_aafigure (app , text , options )
137+             fname , outfn , _id , extra  =  render_aafigure (app , text , options )
135138        except  AafigError  as  exc :
136139            logger .warn ("aafigure error: "  +  str (exc ))
137140            img .replace_self (nodes .literal_block (text , text ))
@@ -152,7 +155,9 @@ def __init__(self, *args: object, **kwargs: object) -> None:
152155
153156
154157def  render_aafigure (
155-     app : "Sphinx" , text : str , options : t .Dict [str , str ]
158+     app : "Sphinx" ,
159+     text : str ,
160+     options : t .Dict [str , str ],
156161) ->  t .Tuple [str , str , t .Optional [str ], t .Optional [str ]]:
157162    """Render an ASCII art figure into the requested format output file.""" 
158163    if  aafigure  is  None :
@@ -172,7 +177,7 @@ def render_aafigure(
172177                "aafig: the builder format %s is not officially " 
173178                "supported, aafigure images could not work. " 
174179                "Please report problems and working builder to " 
175-                 "avoid this warning in the future"  %  app .builder .format 
180+                 "avoid this warning in the future"  %  app .builder .format , 
176181            )
177182        relfn  =  fname 
178183        outfn  =  path .join (app .builder .outdir , fname )
0 commit comments