dedalus.tools.general ===================== .. py:module:: dedalus.tools.general .. autoapi-nested-parse:: Extended built-ins, etc. Module Contents --------------- .. py:class:: DeferredTuple(entry_function, size) .. py:attribute:: entry_function .. py:attribute:: size .. py:class:: OrderedSet(*collections) Ordered set based on uniqueness of dictionary keys. Initialize self. See help(type(self)) for accurate signature. .. py:method:: add(item) .. py:method:: update(*args) D.update([E, ]**F) -> None. Update D from mapping/iterable E and F. If E is present and has a .keys() method, then does: for k in E.keys(): 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] .. py:function:: complex_to_float(dtype) .. py:function:: float_to_complex(dtype) .. py:function:: is_complex_dtype(dtype) .. py:function:: is_real_dtype(dtype) .. py:function:: natural_sort(iterable, reverse=False) Sort alphanumeric strings naturally, i.e. with "1" before "10". Based on http://stackoverflow.com/a/4836734. .. py:function:: oscillate(iterable, max_passes=np.inf) Oscillate forward and backward through an iterable. .. py:function:: replace(data, selectors, replacement) Make an iterator that replaces elements from data with replacement when the corresponding element in selectors evaluates to True. .. py:function:: rev_enumerate(sequence) Simple reversed enumerate. .. py:function:: unify(objects) Check if all objects in a collection are equal. If so, return one of them. If not, raise. .. py:function:: unify_attributes(objects, attr, require=True) Unify object attributes.