2828try :
2929 import pandas as pd
3030except ImportError : # pragma: no cover
31- pd = None
31+ from unittest .mock import MagicMock
32+
33+ pd = MagicMock ()
3234
3335try :
3436 import polars as pl
3537except ImportError : # pragma: no cover
36- pl = None
38+ from unittest .mock import MagicMock
39+
40+ pl = MagicMock ()
3741
3842try :
3943 import pydot
4044except ImportError : # pragma: no cover
41- pydot = None
45+ from unittest .mock import MagicMock
46+
47+ pydot = MagicMock ()
4248
4349try :
4450 from PIL import Image , ImageDraw , ImageFont
4551except ImportError : # pragma: no cover
46- Image = ImageDraw = ImageFont = None
52+ from unittest .mock import MagicMock
53+
54+ Image = ImageDraw = ImageFont = MagicMock ()
4755
4856
4957__all__ = [
@@ -73,9 +81,10 @@ def print_tree(
7381 attr_omit_null : bool = False ,
7482 attr_bracket : List [str ] = ["[" , "]" ],
7583 style : Union [str , Iterable [str ], BasePrintStyle ] = "const" ,
76- ** print_kwargs : Any ,
84+ ** kwargs : Any ,
7785) -> None :
7886 """Print tree to console, starting from `tree`.
87+ Accepts kwargs for print() function.
7988
8089 - Able to select which node to print from, resulting in a subtree, using `node_name_or_path`
8190 - Able to customize for maximum depth to print, using `max_depth`
@@ -91,8 +100,6 @@ def print_tree(
91100 - (BasePrintStyle): `ANSIPrintStyle`, `ASCIIPrintStyle`, `ConstPrintStyle`, `ConstBoldPrintStyle`, `RoundedPrintStyle`,
92101 `DoublePrintStyle` style or inherit from `BasePrintStyle`
93102
94- Remaining kwargs are passed without modification to python's `print` function.
95-
96103 Examples:
97104 **Printing tree**
98105
@@ -249,7 +256,7 @@ def print_tree(
249256 if attr_str :
250257 attr_str = f" { attr_bracket_open } { attr_str } { attr_bracket_close } "
251258 node_str = f"{ _node .node_name } { attr_str } "
252- print (f"{ pre_str } { fill_str } { node_str } " , ** print_kwargs )
259+ print (f"{ pre_str } { fill_str } { node_str } " , ** kwargs )
253260
254261
255262def yield_tree (
@@ -433,9 +440,10 @@ def hprint_tree(
433440 max_depth : int = 0 ,
434441 intermediate_node_name : bool = True ,
435442 style : Union [str , Iterable [str ], BaseHPrintStyle ] = "const" ,
436- ** print_kwargs : Any ,
443+ ** kwargs : Any ,
437444) -> None :
438445 """Print tree in horizontal orientation to console, starting from `tree`.
446+ Accepts kwargs for print() function.
439447
440448 - Able to select which node to print from, resulting in a subtree, using `node_name_or_path`
441449 - Able to customize for maximum depth to print, using `max_depth`
@@ -448,8 +456,6 @@ def hprint_tree(
448456 - (BaseHPrintStyle): `ANSIHPrintStyle`, `ASCIIHPrintStyle`, `ConstHPrintStyle`, `ConstBoldHPrintStyle`,
449457 `RoundedHPrintStyle`, `DoubleHPrintStyle` style or inherit from BaseHPrintStyle
450458
451- Remaining kwargs are passed without modification to python's `print` function.
452-
453459 Examples:
454460 **Printing tree**
455461
@@ -549,7 +555,7 @@ def hprint_tree(
549555 max_depth = max_depth ,
550556 style = style ,
551557 )
552- print ("\n " .join (result ), ** print_kwargs )
558+ print ("\n " .join (result ), ** kwargs )
553559
554560
555561def hyield_tree (
0 commit comments