MCPcopy Create free account
hub / github.com/dask/dask / validate_key

Function validate_key

dask/core.py:172–192  ·  view source on GitHub ↗

Validate the format of a dask key. See Also -------- iskey

(key: object)

Source from the content-addressed store, hash-verified

170
171
172def validate_key(key: object) -> None:
173 """Validate the format of a dask key.
174
175 See Also
176 --------
177 iskey
178 """
179 if iskey(key):
180 return
181 typ = type(key)
182
183 if typ is tuple:
184 index = None
185 try:
186 for index, part in enumerate(cast(tuple, key)): # noqa: B007
187 validate_key(part)
188 except TypeError as e:
189 raise TypeError(
190 f"Composite key contains unexpected key type at {index=} ({key=!r})"
191 ) from e
192 raise TypeError(f"Unexpected key type {typ} ({key=!r})")
193
194
195@overload

Callers 2

test_validate_keyFunction · 0.90
test_clone_keyFunction · 0.90

Calls 1

iskeyFunction · 0.85

Tested by 2

test_validate_keyFunction · 0.72
test_clone_keyFunction · 0.72