pyglove 0.4.5.dev202501030808__py3-none-any.whl → 0.4.5.dev202501060809__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pyglove/core/__init__.py +24 -21
- pyglove/core/geno/base.py +53 -38
- pyglove/core/geno/base_test.py +2 -4
- pyglove/core/geno/categorical.py +36 -27
- pyglove/core/geno/custom.py +18 -15
- pyglove/core/geno/numerical.py +19 -16
- pyglove/core/geno/space.py +3 -4
- pyglove/core/hyper/base.py +6 -6
- pyglove/core/hyper/categorical.py +91 -52
- pyglove/core/hyper/custom.py +7 -7
- pyglove/core/hyper/custom_test.py +9 -10
- pyglove/core/hyper/derived.py +30 -22
- pyglove/core/hyper/derived_test.py +2 -4
- pyglove/core/hyper/dynamic_evaluation.py +3 -4
- pyglove/core/hyper/evolvable.py +57 -46
- pyglove/core/hyper/numerical.py +48 -24
- pyglove/core/hyper/numerical_test.py +9 -9
- pyglove/core/hyper/object_template.py +58 -46
- pyglove/core/logging_test.py +0 -2
- pyglove/core/patching/object_factory.py +4 -4
- pyglove/core/patching/pattern_based.py +4 -4
- pyglove/core/patching/rule_based.py +4 -3
- pyglove/core/symbolic/base.py +167 -131
- pyglove/core/symbolic/base_test.py +17 -19
- pyglove/core/symbolic/boilerplate.py +4 -5
- pyglove/core/symbolic/class_wrapper.py +9 -9
- pyglove/core/symbolic/compounding.py +2 -2
- pyglove/core/symbolic/compounding_test.py +2 -4
- pyglove/core/symbolic/dict.py +70 -54
- pyglove/core/symbolic/dict_test.py +117 -100
- pyglove/core/symbolic/diff.py +12 -12
- pyglove/core/symbolic/flags.py +1 -1
- pyglove/core/symbolic/functor.py +16 -15
- pyglove/core/symbolic/functor_test.py +2 -4
- pyglove/core/symbolic/inferred.py +2 -2
- pyglove/core/symbolic/list.py +70 -47
- pyglove/core/symbolic/list_test.py +117 -98
- pyglove/core/symbolic/object.py +42 -40
- pyglove/core/symbolic/object_test.py +95 -88
- pyglove/core/symbolic/origin.py +5 -7
- pyglove/core/symbolic/pure_symbolic.py +4 -3
- pyglove/core/symbolic/ref.py +12 -8
- pyglove/core/tuning/local_backend.py +2 -2
- pyglove/core/tuning/protocols.py +3 -3
- pyglove/core/typing/annotation_conversion.py +3 -3
- pyglove/core/typing/callable_ext.py +11 -13
- pyglove/core/typing/callable_signature.py +19 -18
- pyglove/core/typing/callable_signature_test.py +3 -5
- pyglove/core/typing/class_schema.py +48 -44
- pyglove/core/typing/class_schema_test.py +3 -5
- pyglove/core/typing/custom_typing.py +5 -4
- pyglove/core/typing/key_specs.py +5 -7
- pyglove/core/typing/key_specs_test.py +4 -4
- pyglove/core/typing/type_conversion.py +4 -5
- pyglove/core/typing/type_conversion_test.py +12 -12
- pyglove/core/typing/typed_missing.py +6 -7
- pyglove/core/typing/typed_missing_test.py +7 -8
- pyglove/core/typing/value_specs.py +210 -141
- pyglove/core/typing/value_specs_test.py +12 -13
- pyglove/core/utils/__init__.py +159 -0
- pyglove/core/{object_utils → utils}/common_traits_test.py +1 -3
- pyglove/core/{object_utils → utils}/docstr_utils_test.py +1 -3
- pyglove/core/{object_utils → utils}/error_utils.py +3 -3
- pyglove/core/{object_utils → utils}/error_utils_test.py +1 -1
- pyglove/core/{object_utils → utils}/formatting.py +1 -1
- pyglove/core/{object_utils → utils}/formatting_test.py +1 -2
- pyglove/core/{object_utils → utils}/hierarchical.py +23 -25
- pyglove/core/{object_utils → utils}/hierarchical_test.py +3 -5
- pyglove/core/{object_utils → utils}/json_conversion_test.py +1 -3
- pyglove/core/{object_utils → utils}/missing.py +2 -2
- pyglove/core/{object_utils → utils}/missing_test.py +2 -4
- pyglove/core/{object_utils → utils}/thread_local_test.py +1 -3
- pyglove/core/{object_utils → utils}/timing.py +3 -3
- pyglove/core/{object_utils → utils}/timing_test.py +2 -3
- pyglove/core/{object_utils → utils}/value_location.py +2 -2
- pyglove/core/{object_utils → utils}/value_location_test.py +2 -4
- pyglove/core/views/base.py +25 -29
- pyglove/core/views/html/base.py +14 -15
- pyglove/core/views/html/controls/base.py +5 -5
- pyglove/core/views/html/controls/progress_bar.py +3 -5
- pyglove/core/views/html/tree_view.py +37 -35
- {pyglove-0.4.5.dev202501030808.dist-info → pyglove-0.4.5.dev202501060809.dist-info}/METADATA +1 -1
- {pyglove-0.4.5.dev202501030808.dist-info → pyglove-0.4.5.dev202501060809.dist-info}/RECORD +90 -90
- {pyglove-0.4.5.dev202501030808.dist-info → pyglove-0.4.5.dev202501060809.dist-info}/WHEEL +1 -1
- pyglove/core/object_utils/__init__.py +0 -161
- /pyglove/core/{object_utils → utils}/common_traits.py +0 -0
- /pyglove/core/{object_utils → utils}/docstr_utils.py +0 -0
- /pyglove/core/{object_utils → utils}/json_conversion.py +0 -0
- /pyglove/core/{object_utils → utils}/thread_local.py +0 -0
- {pyglove-0.4.5.dev202501030808.dist-info → pyglove-0.4.5.dev202501060809.dist-info}/LICENSE +0 -0
- {pyglove-0.4.5.dev202501030808.dist-info → pyglove-0.4.5.dev202501060809.dist-info}/top_level.txt +0 -0
pyglove/core/views/base.py
CHANGED
@@ -136,18 +136,18 @@ import types
|
|
136
136
|
from typing import Any, Callable, Dict, Iterator, Optional, Sequence, Set, Type, Union
|
137
137
|
|
138
138
|
from pyglove.core import io as pg_io
|
139
|
-
from pyglove.core import object_utils
|
140
139
|
from pyglove.core import typing as pg_typing
|
140
|
+
from pyglove.core import utils
|
141
141
|
|
142
142
|
|
143
143
|
# Type definition for the value filter function.
|
144
144
|
NodeFilter = Callable[
|
145
145
|
[
|
146
|
-
|
147
|
-
Any,
|
148
|
-
Any,
|
146
|
+
utils.KeyPath, # The path to the value.
|
147
|
+
Any, # Current value.
|
148
|
+
Any, # Parent value
|
149
149
|
],
|
150
|
-
bool
|
150
|
+
bool, # Whether to include the value.
|
151
151
|
]
|
152
152
|
|
153
153
|
|
@@ -157,7 +157,7 @@ _TLS_KEY_OPERAND_STACK_BY_METHOD = '__view_operand_stack__'
|
|
157
157
|
_TLS_KEY_VIEW_OPTIONS = '__view_options__'
|
158
158
|
|
159
159
|
|
160
|
-
class Content(
|
160
|
+
class Content(utils.Formattable, metaclass=abc.ABCMeta):
|
161
161
|
"""Content: A type of media to be displayed in a view.
|
162
162
|
|
163
163
|
For example, `pg.Html` is a `Content` type that represents HTML to be
|
@@ -171,7 +171,7 @@ class Content(object_utils.Formattable, metaclass=abc.ABCMeta):
|
|
171
171
|
None
|
172
172
|
]
|
173
173
|
|
174
|
-
class SharedParts(
|
174
|
+
class SharedParts(utils.Formattable):
|
175
175
|
"""A part of the content that should appear just once.
|
176
176
|
|
177
177
|
For example, `pg.Html.Styles` is a `SharedParts` type that represents
|
@@ -244,7 +244,7 @@ class Content(object_utils.Formattable, metaclass=abc.ABCMeta):
|
|
244
244
|
**kwargs
|
245
245
|
) -> str:
|
246
246
|
if compact:
|
247
|
-
return
|
247
|
+
return utils.kvlist_str(
|
248
248
|
[
|
249
249
|
('parts', self._parts, {}),
|
250
250
|
],
|
@@ -252,7 +252,7 @@ class Content(object_utils.Formattable, metaclass=abc.ABCMeta):
|
|
252
252
|
compact=compact,
|
253
253
|
verbose=verbose,
|
254
254
|
root_indent=root_indent,
|
255
|
-
bracket_type=
|
255
|
+
bracket_type=utils.BracketType.ROUND,
|
256
256
|
)
|
257
257
|
return self.content
|
258
258
|
|
@@ -363,17 +363,16 @@ class Content(object_utils.Formattable, metaclass=abc.ABCMeta):
|
|
363
363
|
"""Formats the Content object."""
|
364
364
|
del kwargs
|
365
365
|
if compact:
|
366
|
-
return
|
366
|
+
return utils.kvlist_str(
|
367
367
|
[
|
368
368
|
('content', self.content, ''),
|
369
|
-
]
|
370
|
-
|
371
|
-
],
|
369
|
+
]
|
370
|
+
+ [(k, v, None) for k, v in self._shared_parts.items()],
|
372
371
|
label=self.__class__.__name__,
|
373
372
|
compact=compact,
|
374
373
|
verbose=verbose,
|
375
374
|
root_indent=root_indent,
|
376
|
-
bracket_type=
|
375
|
+
bracket_type=utils.BracketType.ROUND,
|
377
376
|
)
|
378
377
|
return self.to_str(content_only=content_only)
|
379
378
|
|
@@ -427,9 +426,9 @@ def view(
|
|
427
426
|
value: Any,
|
428
427
|
*,
|
429
428
|
name: Optional[str] = None,
|
430
|
-
root_path: Optional[
|
429
|
+
root_path: Optional[utils.KeyPath] = None,
|
431
430
|
view_id: str = 'html-tree-view',
|
432
|
-
**kwargs
|
431
|
+
**kwargs,
|
433
432
|
) -> Content:
|
434
433
|
"""Views an object through generating content based on a specific view.
|
435
434
|
|
@@ -451,8 +450,7 @@ def view(
|
|
451
450
|
with view_options(**kwargs) as options:
|
452
451
|
view_object = View.create(view_id)
|
453
452
|
return view_object.render(
|
454
|
-
value, name=name, root_path=root_path or
|
455
|
-
**options
|
453
|
+
value, name=name, root_path=root_path or utils.KeyPath(), **options
|
456
454
|
)
|
457
455
|
|
458
456
|
|
@@ -471,14 +469,14 @@ def view_options(**kwargs) -> Iterator[Dict[str, Any]]:
|
|
471
469
|
Yields:
|
472
470
|
The merged keyword arguments.
|
473
471
|
"""
|
474
|
-
parent_options =
|
472
|
+
parent_options = utils.thread_local_peek(_TLS_KEY_VIEW_OPTIONS, {})
|
475
473
|
# Deep merge the two dict.
|
476
|
-
options =
|
477
|
-
|
474
|
+
options = utils.merge([parent_options, kwargs])
|
475
|
+
utils.thread_local_push(_TLS_KEY_VIEW_OPTIONS, options)
|
478
476
|
try:
|
479
477
|
yield options
|
480
478
|
finally:
|
481
|
-
|
479
|
+
utils.thread_local_pop(_TLS_KEY_VIEW_OPTIONS)
|
482
480
|
|
483
481
|
|
484
482
|
class View(metaclass=abc.ABCMeta):
|
@@ -697,8 +695,8 @@ class View(metaclass=abc.ABCMeta):
|
|
697
695
|
value: Any,
|
698
696
|
*,
|
699
697
|
name: Optional[str] = None,
|
700
|
-
root_path: Optional[
|
701
|
-
**kwargs
|
698
|
+
root_path: Optional[utils.KeyPath] = None,
|
699
|
+
**kwargs,
|
702
700
|
) -> Content:
|
703
701
|
"""Renders the input value.
|
704
702
|
|
@@ -789,20 +787,18 @@ class View(metaclass=abc.ABCMeta):
|
|
789
787
|
) -> Iterator[Any]:
|
790
788
|
"""Context manager for tracking the value being rendered."""
|
791
789
|
del self
|
792
|
-
rendering_stack =
|
790
|
+
rendering_stack = utils.thread_local_get(
|
793
791
|
_TLS_KEY_OPERAND_STACK_BY_METHOD, {}
|
794
792
|
)
|
795
793
|
callsite_value = rendering_stack.get(view_method, None)
|
796
794
|
rendering_stack[view_method] = value
|
797
|
-
|
798
|
-
_TLS_KEY_OPERAND_STACK_BY_METHOD, rendering_stack
|
799
|
-
)
|
795
|
+
utils.thread_local_set(_TLS_KEY_OPERAND_STACK_BY_METHOD, rendering_stack)
|
800
796
|
try:
|
801
797
|
yield callsite_value
|
802
798
|
finally:
|
803
799
|
if callsite_value is None:
|
804
800
|
rendering_stack.pop(view_method)
|
805
801
|
if not rendering_stack:
|
806
|
-
|
802
|
+
utils.thread_local_del(_TLS_KEY_OPERAND_STACK_BY_METHOD)
|
807
803
|
else:
|
808
804
|
rendering_stack[view_method] = callsite_value
|
pyglove/core/views/html/base.py
CHANGED
@@ -20,8 +20,8 @@ import inspect
|
|
20
20
|
import typing
|
21
21
|
from typing import Any, Callable, Dict, Iterable, List, Optional, Sequence, Union
|
22
22
|
|
23
|
-
from pyglove.core import object_utils
|
24
23
|
from pyglove.core import typing as pg_typing
|
24
|
+
from pyglove.core import utils
|
25
25
|
from pyglove.core.views import base
|
26
26
|
|
27
27
|
NestableStr = Union[
|
@@ -33,11 +33,11 @@ NestableStr = Union[
|
|
33
33
|
NodeFilter = base.NodeFilter
|
34
34
|
NodeColor = Callable[
|
35
35
|
[
|
36
|
-
|
37
|
-
Any,
|
38
|
-
Any,
|
36
|
+
utils.KeyPath, # The path to the value.
|
37
|
+
Any, # Current value.
|
38
|
+
Any, # Parent value
|
39
39
|
],
|
40
|
-
Optional[str]
|
40
|
+
Optional[str], # The color of the node.
|
41
41
|
]
|
42
42
|
|
43
43
|
|
@@ -386,7 +386,7 @@ class Html(base.Content):
|
|
386
386
|
cls, nestable_str: NestableStr, separator: str = ' ', dedup: bool = True
|
387
387
|
) -> Optional[str]:
|
388
388
|
"""Concates the string nodes in a nestable object."""
|
389
|
-
flattened =
|
389
|
+
flattened = utils.flatten(nestable_str)
|
390
390
|
if isinstance(flattened, str):
|
391
391
|
return flattened
|
392
392
|
elif isinstance(flattened, dict):
|
@@ -456,8 +456,8 @@ class HtmlView(base.View):
|
|
456
456
|
value: Any,
|
457
457
|
*,
|
458
458
|
name: Optional[str] = None,
|
459
|
-
root_path: Optional[
|
460
|
-
**kwargs
|
459
|
+
root_path: Optional[utils.KeyPath] = None,
|
460
|
+
**kwargs,
|
461
461
|
) -> Html:
|
462
462
|
"""Renders the input value into an HTML object."""
|
463
463
|
# For customized HtmlConvertible objects, call their `to_html()` method.
|
@@ -473,8 +473,8 @@ class HtmlView(base.View):
|
|
473
473
|
value: Any,
|
474
474
|
*,
|
475
475
|
name: Optional[str] = None,
|
476
|
-
root_path: Optional[
|
477
|
-
**kwargs
|
476
|
+
root_path: Optional[utils.KeyPath] = None,
|
477
|
+
**kwargs,
|
478
478
|
) -> Html:
|
479
479
|
"""View's implementation of HTML rendering."""
|
480
480
|
|
@@ -483,9 +483,9 @@ def to_html(
|
|
483
483
|
value: Any,
|
484
484
|
*,
|
485
485
|
name: Optional[str] = None,
|
486
|
-
root_path: Optional[
|
486
|
+
root_path: Optional[utils.KeyPath] = None,
|
487
487
|
view_id: str = 'html-tree-view',
|
488
|
-
**kwargs
|
488
|
+
**kwargs,
|
489
489
|
) -> Html:
|
490
490
|
"""Returns the HTML representation of a value.
|
491
491
|
|
@@ -517,10 +517,10 @@ def to_html_str(
|
|
517
517
|
value: Any,
|
518
518
|
*,
|
519
519
|
name: Optional[str] = None,
|
520
|
-
root_path: Optional[
|
520
|
+
root_path: Optional[utils.KeyPath] = None,
|
521
521
|
view_id: str = 'html-tree-view',
|
522
522
|
content_only: bool = False,
|
523
|
-
**kwargs
|
523
|
+
**kwargs,
|
524
524
|
) -> str:
|
525
525
|
"""Returns a HTML str for a value.
|
526
526
|
|
@@ -545,4 +545,3 @@ def to_html_str(
|
|
545
545
|
view_id=view_id,
|
546
546
|
**kwargs
|
547
547
|
).to_str(content_only=content_only)
|
548
|
-
|
@@ -19,7 +19,7 @@ import inspect
|
|
19
19
|
import sys
|
20
20
|
from typing import Annotated, Any, Dict, Iterator, List, Optional, Union
|
21
21
|
|
22
|
-
from pyglove.core import
|
22
|
+
from pyglove.core import utils
|
23
23
|
from pyglove.core.symbolic import object as pg_object
|
24
24
|
from pyglove.core.views.html import base
|
25
25
|
|
@@ -89,16 +89,16 @@ class HtmlControl(pg_object.Object):
|
|
89
89
|
@contextlib.contextmanager
|
90
90
|
def track_scripts(cls) -> Iterator[List[str]]:
|
91
91
|
del cls
|
92
|
-
all_tracked =
|
92
|
+
all_tracked = utils.thread_local_get(_TLS_TRACKED_SCRIPTS, [])
|
93
93
|
current = []
|
94
94
|
all_tracked.append(current)
|
95
|
-
|
95
|
+
utils.thread_local_set(_TLS_TRACKED_SCRIPTS, all_tracked)
|
96
96
|
try:
|
97
97
|
yield current
|
98
98
|
finally:
|
99
99
|
all_tracked.pop(-1)
|
100
100
|
if not all_tracked:
|
101
|
-
|
101
|
+
utils.thread_local_del(_TLS_TRACKED_SCRIPTS)
|
102
102
|
|
103
103
|
def _sync_members(self, **fields) -> None:
|
104
104
|
"""Synchronizes displayed values to members."""
|
@@ -121,7 +121,7 @@ class HtmlControl(pg_object.Object):
|
|
121
121
|
_notebook.display(_notebook.Javascript(code))
|
122
122
|
|
123
123
|
# Track script execution.
|
124
|
-
all_tracked =
|
124
|
+
all_tracked = utils.thread_local_get(_TLS_TRACKED_SCRIPTS, [])
|
125
125
|
for tracked in all_tracked:
|
126
126
|
tracked.append(code)
|
127
127
|
|
@@ -16,7 +16,7 @@
|
|
16
16
|
import functools
|
17
17
|
from typing import Annotated, List, Optional, Union
|
18
18
|
|
19
|
-
from pyglove.core import
|
19
|
+
from pyglove.core import utils
|
20
20
|
from pyglove.core.symbolic import object as pg_object
|
21
21
|
# pylint: disable=g-importing-member
|
22
22
|
from pyglove.core.views.html.base import Html
|
@@ -73,10 +73,8 @@ class SubProgress(HtmlControl):
|
|
73
73
|
[],
|
74
74
|
id=self.element_id(),
|
75
75
|
styles=styles,
|
76
|
-
css_classes=[
|
77
|
-
|
78
|
-
object_utils.camel_to_snake(self.name, '-')
|
79
|
-
] + self.css_classes,
|
76
|
+
css_classes=['sub-progress', utils.camel_to_snake(self.name, '-')]
|
77
|
+
+ self.css_classes,
|
80
78
|
)
|
81
79
|
|
82
80
|
def increment(self, delta: int = 1):
|
@@ -16,13 +16,13 @@
|
|
16
16
|
import inspect
|
17
17
|
from typing import Any, Callable, Dict, Iterable, Literal, Optional, Sequence, Tuple, Union
|
18
18
|
|
19
|
-
from pyglove.core import
|
19
|
+
from pyglove.core import utils
|
20
20
|
from pyglove.core.symbolic import base as pg_symbolic
|
21
21
|
from pyglove.core.views.html import base
|
22
22
|
|
23
23
|
|
24
|
-
KeyPath =
|
25
|
-
KeyPathSet =
|
24
|
+
KeyPath = utils.KeyPath
|
25
|
+
KeyPathSet = utils.KeyPathSet
|
26
26
|
Html = base.Html
|
27
27
|
HtmlView = base.HtmlView
|
28
28
|
|
@@ -940,10 +940,13 @@ class HtmlTreeView(HtmlView):
|
|
940
940
|
return repr(value)
|
941
941
|
else:
|
942
942
|
return value
|
943
|
-
return
|
943
|
+
return utils.format(
|
944
944
|
value,
|
945
|
-
compact=False,
|
946
|
-
|
945
|
+
compact=False,
|
946
|
+
verbose=False,
|
947
|
+
hide_default_values=True,
|
948
|
+
python_format=True,
|
949
|
+
use_inferred=True,
|
947
950
|
max_bytes_len=64,
|
948
951
|
)
|
949
952
|
return Html.element(
|
@@ -1257,7 +1260,7 @@ class HtmlTreeView(HtmlView):
|
|
1257
1260
|
del parent, kwargs
|
1258
1261
|
if content is None:
|
1259
1262
|
content = Html.escape(
|
1260
|
-
|
1263
|
+
utils.format(
|
1261
1264
|
value,
|
1262
1265
|
root_path=root_path,
|
1263
1266
|
compact=False,
|
@@ -1302,7 +1305,7 @@ class HtmlTreeView(HtmlView):
|
|
1302
1305
|
class_name = f'{value.__name__}-class'
|
1303
1306
|
else:
|
1304
1307
|
class_name = type(value).__name__
|
1305
|
-
return
|
1308
|
+
return utils.camel_to_snake(class_name, '-')
|
1306
1309
|
|
1307
1310
|
@staticmethod
|
1308
1311
|
def init_uncollapse(
|
@@ -1341,40 +1344,40 @@ class HtmlTreeView(HtmlView):
|
|
1341
1344
|
@staticmethod
|
1342
1345
|
def get_passthrough_kwargs(
|
1343
1346
|
*,
|
1344
|
-
enable_summary: Optional[bool] =
|
1345
|
-
enable_summary_for_str: bool =
|
1346
|
-
max_summary_len_for_str: int =
|
1347
|
-
enable_summary_tooltip: bool =
|
1347
|
+
enable_summary: Optional[bool] = utils.MISSING_VALUE,
|
1348
|
+
enable_summary_for_str: bool = utils.MISSING_VALUE,
|
1349
|
+
max_summary_len_for_str: int = utils.MISSING_VALUE,
|
1350
|
+
enable_summary_tooltip: bool = utils.MISSING_VALUE,
|
1348
1351
|
key_style: Union[
|
1349
1352
|
Literal['label', 'summary'],
|
1350
|
-
Callable[[KeyPath, Any, Any], Literal['label', 'summary']]
|
1351
|
-
] =
|
1353
|
+
Callable[[KeyPath, Any, Any], Literal['label', 'summary']],
|
1354
|
+
] = utils.MISSING_VALUE,
|
1352
1355
|
key_color: Union[
|
1353
1356
|
Tuple[Optional[str], Optional[str]],
|
1354
|
-
Callable[[KeyPath, Any, Any], Tuple[Optional[str], Optional[str]]]
|
1355
|
-
] =
|
1357
|
+
Callable[[KeyPath, Any, Any], Tuple[Optional[str], Optional[str]]],
|
1358
|
+
] = utils.MISSING_VALUE,
|
1356
1359
|
include_keys: Union[
|
1357
1360
|
Iterable[Union[int, str]],
|
1358
1361
|
Callable[[KeyPath, Any, Any], Iterable[Union[int, str]]],
|
1359
|
-
None
|
1360
|
-
] =
|
1362
|
+
None,
|
1363
|
+
] = utils.MISSING_VALUE,
|
1361
1364
|
exclude_keys: Union[
|
1362
1365
|
Iterable[Union[int, str]],
|
1363
1366
|
Callable[[KeyPath, Any, Any], Iterable[Union[int, str]]],
|
1364
|
-
None
|
1365
|
-
] =
|
1366
|
-
enable_key_tooltip: bool =
|
1367
|
+
None,
|
1368
|
+
] = utils.MISSING_VALUE,
|
1369
|
+
enable_key_tooltip: bool = utils.MISSING_VALUE,
|
1367
1370
|
uncollapse: Union[
|
1368
1371
|
KeyPathSet, base.NodeFilter, None
|
1369
|
-
] =
|
1370
|
-
extra_flags: Optional[Dict[str, Any]] =
|
1371
|
-
highlight: Optional[base.NodeFilter] =
|
1372
|
-
lowlight: Optional[base.NodeFilter] =
|
1373
|
-
debug: bool =
|
1372
|
+
] = utils.MISSING_VALUE,
|
1373
|
+
extra_flags: Optional[Dict[str, Any]] = utils.MISSING_VALUE,
|
1374
|
+
highlight: Optional[base.NodeFilter] = utils.MISSING_VALUE,
|
1375
|
+
lowlight: Optional[base.NodeFilter] = utils.MISSING_VALUE,
|
1376
|
+
debug: bool = utils.MISSING_VALUE,
|
1374
1377
|
remove: Optional[Iterable[str]] = None,
|
1375
1378
|
**kwargs,
|
1376
1379
|
):
|
1377
|
-
|
1380
|
+
# pytype: enable=annotation-type-mismatch
|
1378
1381
|
"""Gets the rendering arguments to pass through to the child nodes."""
|
1379
1382
|
del kwargs
|
1380
1383
|
passthrough_kwargs = dict(
|
@@ -1386,23 +1389,22 @@ class HtmlTreeView(HtmlView):
|
|
1386
1389
|
key_style=key_style,
|
1387
1390
|
key_color=key_color,
|
1388
1391
|
include_keys=(
|
1389
|
-
include_keys if callable(include_keys)
|
1390
|
-
else object_utils.MISSING_VALUE
|
1392
|
+
include_keys if callable(include_keys) else utils.MISSING_VALUE
|
1391
1393
|
),
|
1392
1394
|
exclude_keys=(
|
1393
|
-
exclude_keys if callable(exclude_keys)
|
1394
|
-
else object_utils.MISSING_VALUE
|
1395
|
+
exclude_keys if callable(exclude_keys) else utils.MISSING_VALUE
|
1395
1396
|
),
|
1396
1397
|
uncollapse=uncollapse,
|
1397
1398
|
highlight=highlight,
|
1398
1399
|
lowlight=lowlight,
|
1399
1400
|
extra_flags=extra_flags,
|
1400
|
-
debug=debug
|
1401
|
+
debug=debug,
|
1401
1402
|
)
|
1402
1403
|
# Filter out missing values.
|
1403
1404
|
passthrough_kwargs = {
|
1404
|
-
k: v
|
1405
|
-
|
1405
|
+
k: v
|
1406
|
+
for k, v in passthrough_kwargs.items()
|
1407
|
+
if v is not utils.MISSING_VALUE
|
1406
1408
|
}
|
1407
1409
|
if remove:
|
1408
1410
|
return {
|
@@ -1467,7 +1469,7 @@ class HtmlTreeView(HtmlView):
|
|
1467
1469
|
)
|
1468
1470
|
|
1469
1471
|
# Deep hierarchy merge.
|
1470
|
-
return
|
1472
|
+
return utils.merge_tree(call_kwargs, overriden_kwargs)
|
1471
1473
|
|
1472
1474
|
@staticmethod
|
1473
1475
|
def merge_uncollapse(
|