MCPcopy
hub / github.com/python-visualization/folium / get_obj_in_upper_tree

Function get_obj_in_upper_tree

folium/utilities.py:400–407  ·  view source on GitHub ↗

Return the first object in the parent tree of class `cls`.

(element: Element, cls: Type)

Source from the content-addressed store, hash-verified

398
399
400def get_obj_in_upper_tree(element: Element, cls: Type) -> Element:
401 """Return the first object in the parent tree of class `cls`."""
402 parent = element._parent
403 if parent is None:
404 raise ValueError(f"The top of the tree was reached without finding a {cls}")
405 if not isinstance(parent, cls):
406 return get_obj_in_upper_tree(parent, cls)
407 return parent
408
409
410def parse_options(**kwargs: TypeJsonValue) -> Dict[str, TypeJsonValueNoNone]:

Callers 4

renderMethod · 0.90
renderMethod · 0.90
renderMethod · 0.90

Calls

no outgoing calls

Tested by 1