@@ -101,15 +101,14 @@ class Kaleido(choreo.Browser):
101101
102102 ### KALEIDO LIFECYCLE FUNCTIONS ###
103103
104- def __init__ ( # noqa: PLR0913
104+ def __init__ (
105105 self ,
106- * args : Any , # TODO(AJP): does choreographer take args?
106+ # *args: Any, force named vars for all choreographer passthrough
107107 n : int = 1 ,
108108 timeout : int | None = 90 ,
109109 page_generator : None | PageGenerator | str | Path = None ,
110110 plotlyjs : str | Path | None = None , # TODO(AJP): with page generator
111111 mathjax : str | Path | None = None , # TODO(AJP): with page generator?
112- stepper : bool = False ,
113112 ** kwargs : Any ,
114113 ) -> None :
115114 """
@@ -142,17 +141,12 @@ def __init__( # noqa: PLR0913
142141 disabled. Defaults to None- which means to use version 2.35 via
143142 CDN.
144143
145- stepper (bool, optional):
146- A diagnostic tool that will ask the user to press enter between
147- rendering each image. Only useful if also used with
148- `headless=False`. See below. Defaults to False.
149-
150144 **kwargs (Any):
151145 Additional keyword arguments passed through to the underlying
152- Choreographer.browser constructor. Notable options include,
146+ Choreographer.browser constructor. Notable options include
153147 `headless=False` (show window), `enable_sandbox=True` (turn on
154148 sandboxing), and `enable_gpu=True` which will allow use of the
155- GPU. The defaults for these options are True, False, False
149+ GPU. The defaults for these options are True, False, and False
156150 respectively.
157151
158152 """
@@ -166,22 +160,21 @@ def __init__( # noqa: PLR0913
166160 page = page_generator
167161 self ._timeout = timeout
168162 self ._n = n
169- self ._stepper = stepper
170163 self ._plotlyjs = plotlyjs
171164 self ._mathjax = mathjax
172165
173166 # Diagnostic
174167 _logger .debug (f"Timeout: { self ._timeout } " )
175168
176169 try :
177- super ().__init__ (* args , * *kwargs )
170+ super ().__init__ (** kwargs )
178171 except ChromeNotFoundError :
179172 raise ChromeNotFoundError (
180173 "Kaleido v1 and later requires Chrome to be installed. "
181174 "To install Chrome, use the CLI command `kaleido_get_chrome`, "
182175 "or from Python, use either `await kaleido.get_chrome()` "
183176 "or `kaleido.get_chrome_sync()`." ,
184- ) from None # overwriting the error entirely.
177+ ) from None # overwriting the error entirely. (diagnostics)
185178
186179 # save this for open() because it requires close()
187180 self ._saved_page_arg = page
@@ -226,8 +219,7 @@ async def _conform_tabs(self, tabs: Listish[choreo.Tab] | None = None) -> None:
226219 _logger .debug2 (f"Subscribing * to tab: { tab } ." )
227220 tab .subscribe ("*" , _utils .event_printer (f"tab-{ i !s} : Event Dump:" ))
228221
229- kaleido_tabs = [_KaleidoTab (tab , _stepper = self ._stepper ) for tab in tabs ]
230- # TODO(AJP): why doesn't stepper use the global?
222+ kaleido_tabs = [_KaleidoTab (tab ) for tab in tabs ]
231223
232224 await asyncio .gather (* (tab .navigate (self ._index ) for tab in kaleido_tabs ))
233225
@@ -308,10 +300,7 @@ async def _return_kaleido_tab(self, tab: _KaleidoTab) -> None:
308300 await self .tabs_ready .put (tab )
309301 _logger .debug (f"{ tab .tab .target_id [:4 ]} put back." )
310302
311- #### WE'RE HERE
312-
313- # this task must calculate full_path before it
314- # awaits, ie yielding control.
303+ # _retuner_task MUST calculate full_path before it awaits
315304 async def _render_task (
316305 self ,
317306 fig_arg : FigureDict ,
@@ -363,6 +352,7 @@ async def write_fig_from_object(
363352 * ,
364353 cancel_on_error : bool = False ,
365354 _write : Literal [False ],
355+ stepper : bool = False ,
366356 ) -> bytes : ...
367357
368358 @overload
@@ -372,6 +362,7 @@ async def write_fig_from_object(
372362 * ,
373363 cancel_on_error : Literal [True ],
374364 _write : Literal [True ] = True ,
365+ stepper : bool = False ,
375366 ) -> None : ...
376367
377368 @overload
@@ -381,6 +372,7 @@ async def write_fig_from_object(
381372 * ,
382373 cancel_on_error : Literal [False ] = False ,
383374 _write : Literal [True ] = True ,
375+ stepper : bool = False ,
384376 ) -> tuple [Exception ]: ...
385377
386378 @overload
@@ -390,6 +382,7 @@ async def write_fig_from_object(
390382 * ,
391383 cancel_on_error : bool ,
392384 _write : Literal [True ] = True ,
385+ stepper : bool = False ,
393386 ) -> tuple [Exception ] | None : ...
394387
395388 async def write_fig_from_object (
@@ -398,6 +391,7 @@ async def write_fig_from_object(
398391 * ,
399392 cancel_on_error = False ,
400393 _write : bool = True , # backwards compatibility!
394+ stepper : bool = False ,
401395 ) -> None | bytes | tuple [Exception ]:
402396 """Temp."""
403397 if not _write :
@@ -418,6 +412,7 @@ async def write_fig_from_object(
418412 fig_arg = fig_arg ,
419413 topojson = fig_arg .get ("topojson" ),
420414 _write = _write , # backwards compatibility
415+ stepper = stepper ,
421416 ),
422417 )
423418 tasks .add (t )
@@ -438,14 +433,15 @@ async def write_fig_from_object(
438433 if main_task :
439434 self ._main_render_coroutines .remove (main_task )
440435
441- async def write_fig (
436+ async def write_fig ( # noqa: PLR0913
442437 self ,
443438 fig : _fig_tools .Figurish ,
444439 path : None | Path | str = None ,
445440 opts : None | _fig_tools .LayoutOpts = None ,
446441 * ,
447442 topojson : str | None = None ,
448443 cancel_on_error : bool = False ,
444+ stepper : bool = False ,
449445 ) -> tuple [Exception ] | None :
450446 """Temp."""
451447 if _fig_tools .is_figurish (fig ) or not isinstance (
@@ -467,6 +463,7 @@ async def _temp_generator() -> AsyncGenerator[FigureDict, None]:
467463 return await self .write_fig_from_object (
468464 fig_dicts = generator ,
469465 cancel_on_error = cancel_on_error ,
466+ stepper = stepper ,
470467 )
471468
472469 async def calc_fig (
@@ -475,6 +472,7 @@ async def calc_fig(
475472 opts : None | _fig_tools .LayoutOpts = None ,
476473 * ,
477474 topojson : str | None = None ,
475+ stepper : bool = False ,
478476 ) -> bytes :
479477 """Temp."""
480478
@@ -489,4 +487,5 @@ async def _temp_generator():
489487 fig_dicts = _temp_generator (),
490488 cancel_on_error = True ,
491489 _write = False ,
490+ stepper = stepper ,
492491 )
0 commit comments