MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / _identify_keys_and_nested

Method _identify_keys_and_nested

lib/matplotlib/figure.py:2073–2099  ·  view source on GitHub ↗

Given a 2D object array, identify unique IDs and nested mosaics Parameters ---------- mosaic : 2D object array Returns ------- unique_ids : tuple The unique non-sub mosaic entries in this mosaic

(mosaic)

Source from the content-addressed store, hash-verified

2071 return out
2072
2073 def _identify_keys_and_nested(mosaic):
2074 """
2075 Given a 2D object array, identify unique IDs and nested mosaics
2076
2077 Parameters
2078 ----------
2079 mosaic : 2D object array
2080
2081 Returns
2082 -------
2083 unique_ids : tuple
2084 The unique non-sub mosaic entries in this mosaic
2085 nested : dict[tuple[int, int], 2D object array]
2086 """
2087 # make sure we preserve the user supplied order
2088 unique_ids = cbook._OrderedSet()
2089 nested = {}
2090 for j, row in enumerate(mosaic):
2091 for k, v in enumerate(row):
2092 if v == empty_sentinel:
2093 continue
2094 elif not cbook.is_scalar_or_string(v):
2095 nested[(j, k)] = _make_array(v)
2096 else:
2097 unique_ids.add(v)
2098
2099 return tuple(unique_ids), nested
2100
2101 def _do_layout(gs, mosaic, unique_ids, nested):
2102 """

Callers

nothing calls this directly

Calls 1

addMethod · 0.45

Tested by

no test coverage detected