dedalus.tools.general

Extended built-ins, etc.

Module Contents

class OrderedSet(*collections)

Ordered set based on uniqueness of dictionary keys.

Initialize self. See help(type(self)) for accurate signature.

update(*args)

D.update([E, ]**F) -> None. Update D from dict/iterable E and F. If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

add(item)
rev_enumerate(sequence)

Simple reversed enumerate.

natural_sort(iterable, reverse=False)

Sort alphanumeric strings naturally, i.e. with “1” before “10”. Based on http://stackoverflow.com/a/4836734.

oscillate(iterable, max_passes=np.inf)

Oscillate forward and backward through an iterable.

unify(objects)

Check if all objects in a collection are equal. If so, return one of them. If not, raise.

unify_attributes(objects, attr, require=True)

Unify object attributes.

replace(data, selectors, replacement)

Make an iterator that replaces elements from data with replacement when the corresponding element in selectors evaluates to True.

class DeferredTuple(entry_function, size)
is_real_dtype(dtype)
is_complex_dtype(dtype)