MCPcopy Index your code
hub / github.com/plotly/dash / map_grouping

Function map_grouping

dash/_grouping.py:126–142  ·  view source on GitHub ↗

Map a function over all of the scalar values of a grouping, maintaining the grouping structure :param fn: Single-argument function that accepts and returns scalar grouping values :param grouping: The grouping to map the function over :return: A new grouping with the same struct

(fn, grouping)

Source from the content-addressed store, hash-verified

124
125
126def map_grouping(fn, grouping):
127 """
128 Map a function over all of the scalar values of a grouping, maintaining the
129 grouping structure
130
131 :param fn: Single-argument function that accepts and returns scalar grouping values
132 :param grouping: The grouping to map the function over
133 :return: A new grouping with the same structure as input grouping with scalar
134 values updated by the input function.
135 """
136 if isinstance(grouping, (tuple, list)):
137 return [map_grouping(fn, g) for g in grouping]
138
139 if isinstance(grouping, dict):
140 return AttributeDict({k: map_grouping(fn, g) for k, g in grouping.items()})
141
142 return fn(grouping)
143
144
145def make_grouping_by_key(schema, source, default=None):

Callers 8

test_map_grouping_scalarFunction · 0.90
test_map_grouping_listFunction · 0.90
test_map_grouping_dictFunction · 0.90
test_map_grouping_mixedFunction · 0.90
make_schema_with_nonesFunction · 0.90
_prepare_groupingMethod · 0.85
make_grouping_by_keyFunction · 0.85

Calls 2

AttributeDictClass · 0.85
fnFunction · 0.50

Tested by 5

test_map_grouping_scalarFunction · 0.72
test_map_grouping_listFunction · 0.72
test_map_grouping_dictFunction · 0.72
test_map_grouping_mixedFunction · 0.72
make_schema_with_nonesFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…