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

Function ensure_set

dask/utils.py:1403–1415  ·  view source on GitHub ↗

Convert a generic Set into a set. Parameters ---------- s : Set copy : bool If True, guarantee that the return value is always a shallow copy of s; otherwise it may be the input itself.

(s: Set[T], *, copy: bool = False)

Source from the content-addressed store, hash-verified

1401
1402
1403def ensure_set(s: Set[T], *, copy: bool = False) -> set[T]:
1404 """Convert a generic Set into a set.
1405
1406 Parameters
1407 ----------
1408 s : Set
1409 copy : bool
1410 If True, guarantee that the return value is always a shallow copy of s;
1411 otherwise it may be the input itself.
1412 """
1413 if type(s) is set:
1414 return s.copy() if copy else s
1415 return set(s)
1416
1417
1418class OperatorMethodMixin:

Callers 1

test_ensure_setFunction · 0.90

Calls 2

setClass · 0.85
copyMethod · 0.45

Tested by 1

test_ensure_setFunction · 0.72