: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.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.listOfNotNone ~cloup._util.check_positive_int ~cloup._util.identity ~cloup._util.pop_many Attributes ---------- .. autoapisummary:: cloup._util.click_version_tuple cloup._util.T Contents -------- .. data:: click_version_tuple .. data:: T .. 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, default=None) Returns the first value that is not None (or ``default`` if no such value exists). Inspired by the homonym SQL function. .. function:: listOfNotNone(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:: pop_many(d, *keys)