@@ -195,7 +195,7 @@ async def open(self):
195195 del self ._saved_page_arg
196196
197197 if isinstance (page , (Path , str )):
198- if (_p := _utils .get_path (page )).is_file ():
198+ if (_p := path_tools .get_path (page )).is_file ():
199199 self ._index = _p .as_uri ()
200200 else :
201201 raise FileNotFoundError (f"{ page !s} does not exist." )
@@ -333,6 +333,8 @@ async def _render_task(
333333 spec ["format" ], # should just take spec
334334 )
335335 full_path .touch () # claim our name
336+ else :
337+ full_path = None
336338
337339 tab = await self ._get_kaleido_tab ()
338340
@@ -354,7 +356,7 @@ async def _render_task(
354356 ),
355357 self ._timeout ,
356358 )
357- if _write :
359+ if _write and full_path :
358360 render_prof .profile_log .tick ("starting file write" )
359361 await _utils .to_thread (full_path .write_bytes , img_bytes )
360362 render_prof .profile_log .tick ("file write done" )
@@ -363,7 +365,7 @@ async def _render_task(
363365 return img_bytes
364366 except BaseException as e :
365367 render_prof .profile_log .tick ("errored out" )
366- if _write :
368+ if _write and full_path :
367369 full_path .unlink () # failure, no write
368370 render_prof .error = e
369371 raise
@@ -518,15 +520,15 @@ async def calc_fig(
518520 stacklevel = 2 ,
519521 )
520522
521- async def _temp_generator ():
522- yield {
523+ spec : FigureDict = {
523524 "fig" : fig ,
524525 "opts" : opts ,
525526 "topojson" : topojson ,
526527 }
527-
528- return await self .write_fig_from_object (
529- fig_dicts = _temp_generator (),
528+ # pyright > mypy, but:
529+ # pyright doesn't understand literals in overloads as well
530+ return await self .write_fig_from_object ( # type: ignore[reportCallIssue]
531+ fig_dicts = spec ,
530532 cancel_on_error = True ,
531533 _write = False ,
532534 stepper = stepper ,
0 commit comments