Return True if the given object is a potential dask key; False otherwise. The definition of a key in a Dask graph is any str, int, float, or tuple thereof. See Also -------- ishashable validate_key dask.typing.Key
(key: object)
| 152 | |
| 153 | |
| 154 | def iskey(key: object) -> bool: |
| 155 | """Return True if the given object is a potential dask key; False otherwise. |
| 156 | |
| 157 | The definition of a key in a Dask graph is any str, int, float, or tuple |
| 158 | thereof. |
| 159 | |
| 160 | See Also |
| 161 | -------- |
| 162 | ishashable |
| 163 | validate_key |
| 164 | dask.typing.Key |
| 165 | """ |
| 166 | typ = type(key) |
| 167 | if typ is tuple: |
| 168 | return all(iskey(i) for i in cast(tuple, key)) |
| 169 | return typ in {int, float, str} |
| 170 | |
| 171 | |
| 172 | def validate_key(key: object) -> None: |