MCPcopy
hub / github.com/plotly/dash / grouping_len

Function grouping_len

dash/_grouping.py:63–78  ·  view source on GitHub ↗

Get the length of a grouping. The length equal to the number of scalar values contained in the grouping, which is equivalent to the length of the list that would result from calling flatten_grouping on the grouping value. :param grouping: The grouping value to calculate the length

(grouping)

Source from the content-addressed store, hash-verified

61
62
63def grouping_len(grouping):
64 """
65 Get the length of a grouping. The length equal to the number of scalar values
66 contained in the grouping, which is equivalent to the length of the list that would
67 result from calling flatten_grouping on the grouping value.
68
69 :param grouping: The grouping value to calculate the length of
70 :return: non-negative integer
71 """
72 if isinstance(grouping, (tuple, list)):
73 return sum([grouping_len(group_el) for group_el in grouping])
74
75 if isinstance(grouping, dict):
76 return sum([grouping_len(group_el) for group_el in grouping.values()])
77
78 return 1
79
80
81def make_grouping_by_index(schema, flat_values):

Callers 10

test_flatten_scalarFunction · 0.90
test_flatten_listFunction · 0.90
test_flatten_dictFunction · 0.90
test_flatten_mixedFunction · 0.90
test_flatten_odd_valueFunction · 0.90
make_dependency_groupingFunction · 0.90
_prepare_groupingMethod · 0.85
register_callbackFunction · 0.85

Calls

no outgoing calls

Tested by 7

test_flatten_scalarFunction · 0.72
test_flatten_listFunction · 0.72
test_flatten_dictFunction · 0.72
test_flatten_mixedFunction · 0.72
test_flatten_odd_valueFunction · 0.72
make_dependency_groupingFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…