MCPcopy
hub / github.com/dask/dask / is_namedtuple_instance

Function is_namedtuple_instance

dask/utils.py:2205–2219  ·  view source on GitHub ↗

Returns True if obj is an instance of a namedtuple. Note: This function checks for the existence of the methods and attributes that make up the namedtuple API, so it will return True IFF obj's type implements that API.

(obj: Any)

Source from the content-addressed store, hash-verified

2203
2204
2205def is_namedtuple_instance(obj: Any) -> bool:
2206 """Returns True if obj is an instance of a namedtuple.
2207
2208 Note: This function checks for the existence of the methods and
2209 attributes that make up the namedtuple API, so it will return True
2210 IFF obj's type implements that API.
2211 """
2212 return (
2213 isinstance(obj, tuple)
2214 and hasattr(obj, "_make")
2215 and hasattr(obj, "_asdict")
2216 and hasattr(obj, "_replace")
2217 and hasattr(obj, "_fields")
2218 and hasattr(obj, "_field_defaults")
2219 )
2220
2221
2222def get_default_shuffle_method() -> str:

Callers 4

to_task_daskFunction · 0.90
_unpackFunction · 0.90
parse_inputFunction · 0.90
convert_legacy_taskFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…