:orphan: :mod:`cloup._util` ================== .. py:module:: cloup._util .. autoapi-nested-parse:: Generic utilities. Classes ------- .. autosummary:: ~cloup._util.FrozenSpaceMeta ~cloup._util.FrozenSpace Functions --------- .. autosummary:: ~cloup._util.pick_non_missing ~cloup._util.class_name ~cloup._util.check_arg ~cloup._util.indent_lines ~cloup._util.make_repr ~cloup._util.make_one_line_repr ~cloup._util.pluralize ~cloup._util.coalesce ~cloup._util.first_bool ~cloup._util.pick_not_none ~cloup._util.check_positive_int ~cloup._util.identity ~cloup._util.delete_keys ~cloup._util.reindent Attributes ---------- .. autoapisummary:: cloup._util.click_version_tuple cloup._util.T cloup._util.K cloup._util.V Contents -------- .. data:: click_version_tuple .. data:: T .. data:: K .. data:: V .. function:: pick_non_missing(d) .. function:: class_name(obj) .. function:: check_arg(condition, msg = '') .. function:: indent_lines(lines, width=2) .. function:: make_repr(obj, *args, _line_len = 60, _indent = 2, **kwargs) Generate repr(obj). :param obj: object to represent :param args: positional arguments in the repr :param _line_len: if the repr length exceeds this, arguments will be on their own line; if negative, the repr will be in a single line regardless of its length :param _indent: indentation width of arguments in case they are shown in their own line :param kwargs: keyword arguments in the repr :return: str .. function:: make_one_line_repr(obj, *args, **kwargs) .. function:: pluralize(count, zero = '', one = '', many = '') .. function:: coalesce(*values) Returns the first value that is not None (or None if no such value exists). .. function:: first_bool(*values) Returns the first bool (or raises StopIteration if no bool is found). .. function:: pick_not_none(iterable) .. function:: check_positive_int(value, arg_name) .. function:: identity(x) .. class:: FrozenSpaceMeta(cls, *args) Bases: :py:obj:`type` .. method:: __setattr__(cls, key, value) Implement setattr(self, name, value). .. method:: asdict(cls) .. method:: __contains__(cls, item) .. method:: __getitem__(cls, item) .. class:: FrozenSpace A class used just as frozen namespace for constants. .. function:: delete_keys(d, keys) .. function:: reindent(text, indent = 0)