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