: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.click_major
   cloup._util.click_minor
   cloup._util.click_version_ge_8_1
   cloup._util.T
   cloup._util.K
   cloup._util.V

                                           
Contents
--------
.. py:data:: click_version_tuple
   

   

.. py:data:: click_major
   

   

.. py:data:: click_minor
   

   

.. py:data:: click_version_ge_8_1
   

   

.. py:data:: T
   

   

.. py:data:: K
   

   

.. py:data:: V
   

   

.. py:function:: pick_non_missing(d)


.. py:function:: class_name(obj)


.. py:function:: check_arg(condition, msg = '')


.. py:function:: indent_lines(lines, width = 2)


.. py: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


.. py:function:: make_one_line_repr(obj, *args, **kwargs)


.. py:function:: pluralize(count, zero = '', one = '', many = '')


.. py:function:: coalesce(*values)

   Returns the first value that is not None (or None if no such value exists).


.. py:function:: first_bool(*values)

   Returns the first bool (or raises StopIteration if no bool is found).


.. py:function:: pick_not_none(iterable)


.. py:function:: check_positive_int(value, arg_name)


.. py:function:: identity(x)


.. py:class:: FrozenSpaceMeta(*args)

   Bases: :py:obj:`type`

   .. py:method:: __setattr__(key, value)

      Implement setattr(self, name, value).


   .. py:method:: asdict()


   .. py:method:: __contains__(item)


   .. py:method:: __getitem__(item)



.. py:class:: FrozenSpace

   A class used just as frozen namespace for constants.


.. py:function:: delete_keys(d, keys)


.. py:function:: reindent(text, indent = 0)



                                         