(*x)
| 22 | |
| 23 | def dedup(x:Iterable[T]): return list(dict.fromkeys(x)) # retains list order |
| 24 | def argfix(*x): |
| 25 | if x and x[0].__class__ in (tuple, list): |
| 26 | if len(x) != 1: raise ValueError(f"bad arg {x}") |
| 27 | return tuple(x[0]) |
| 28 | return x |
| 29 | # https://stackoverflow.com/questions/3382352/equivalent-of-numpy-argsort-in-basic-python |
| 30 | def argsort(x): return type(x)(sorted(range(len(x)), key=x.__getitem__)) |
| 31 | def all_same(items:Sequence): return all(x == items[0] for x in items) # works for empty input |
no outgoing calls
searching dependent graphs…