utility

Utilities mainly for internal use.

Functions

array_str(a[, nprint])

Stringification of an array.

attribute_repr_string(inst_str, attr_str)

Return a repr string for an attribute that respects line width.

cache_arguments(function)

Decorate function to cache the result with given arguments.

complex_dtype(dtype[, default])

Return complex counterpart of dtype if existing, else default.

conj_exponent(exp)

Conjugate exponent exp / (exp - 1).

dedent(string[, indent_str, max_levels])

Revert the effect of indentation.

dtype_repr(dtype)

Stringify dtype for repr with default for int and float.

dtype_str(dtype)

Stringify dtype for str with default for int and float.

indent(string[, indent_str])

Return a copy of string indented by indent_str.

is_string(obj)

Return True if obj behaves like a string, False else.

method_repr_string(inst_str, meth_str[, …])

Return a repr string for a method that respects line width.

nd_iterator(shape)

Iterator over n-d cube with shape.

npy_printoptions(\*\*extra_opts)

Context manager to temporarily set NumPy print options.

npy_random_seed(seed)

Context manager to temporarily set the NumPy random generator seed.

nullcontext([enter_result])

Backport of the Python >=3.7 trivial context manager.

pkg_supports(feature, pkg_version, pkg_feat_dict)

Return bool indicating whether a package supports feature.

real_dtype(dtype[, default])

Return the real counterpart of dtype if existing.

repr_string(outer_string, inner_strings[, …])

Return a pretty string for repr.

run_from_ipython()

If the process is run from IPython.

signature_string(posargs, optargs[, sep, mod])

Return a stringified signature from given arguments.

signature_string_parts(posargs, optargs[, mod])

Return stringified arguments as tuples.

unique(seq)

Return the unique values in a sequence.

writable_array(obj, \*\*kwargs)

Context manager that casts obj to a numpy.array and saves changes.