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

Method __init__

dask/_task_spec.py:938–961  ·  view source on GitHub ↗
(self, /, *args: Any, **kwargs: Any)

Source from the content-addressed store, hash-verified

936 klass = dict
937
938 def __init__(self, /, *args: Any, **kwargs: Any):
939 if args:
940 assert not kwargs
941 if len(args) == 1:
942 args = args[0]
943 if isinstance(args, dict): # type: ignore[unreachable]
944 args = tuple(itertools.chain(*args.items())) # type: ignore[unreachable]
945 elif isinstance(args, (list, tuple)):
946 if all(
947 len(el) == 2 if isinstance(el, (list, tuple)) else False
948 for el in args
949 ):
950 args = tuple(itertools.chain(*args))
951 else:
952 raise ValueError("Invalid argument provided")
953
954 if len(args) % 2 != 0:
955 raise ValueError("Invalid number of arguments provided")
956
957 elif kwargs:
958 assert not args
959 args = tuple(itertools.chain(*kwargs.items()))
960
961 super().__init__(*args)
962
963 def __repr__(self):
964 values = ", ".join(f"{k}: {v}" for k, v in batched(self.args, 2, strict=True))

Callers

nothing calls this directly

Calls 3

allFunction · 0.85
itemsMethod · 0.45
__init__Method · 0.45

Tested by

no test coverage detected