xoa.misc

xoa.misc#

Miscellaneous low level utilities

Functions

dict_check_defaults(dd, **defaults)

Check that a dictionary has some default values

dict_filter(kwargs, filters[, defaults, ...])

Filter out kwargs (typically extra calling keywords)

dict_merge(*dd[, mergesubdicts, mergelists, ...])

Merge dictionaries

get_axis_slices(ndim, axis, **kwargs)

Get standard slices for an axis of a ndim array

gunique(seq)

Create a generator that yields unique items whilst preserving the order

is_empty(x)

Check if empty

is_iterable(obj[, nostr, nogen])

Check if an object is iterable or not

list_xr_names(obj[, data_vars, coords, dims])

List the data vars, coords and dims names of a xarray dataset or data array

match_attrs(obj, checks[, ignorecase, transform])

Check that at least one of the attributes matches check list

match_string(ss, checks[, ignorecase, transform])

Check that a string verify a check list that consists of a list of either strings or callables

Classes

ArgList(argsi)

Utility to always manage arguments as list and return results as input

ArgTuple(argsi)

Utility to always manage arguments as tuple and return results as input

Choices(choices[, case_insensitive, ...])

Choice management for a function or method parameter

DefaultEnumMeta(cls, bases, classdict, *[, ...])

Enum meta-class that support default value and None

IntEnumChoices(new_class_name, /, names, *)

XEnumMeta(cls, bases, classdict, *[, ...])

Extended version of Enum meta-class