:py:mod:`cobra.util.util` ========================= .. py:module:: cobra.util.util .. autoapi-nested-parse:: General utilities used across the package. Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: cobra.util.util.AutoVivification Functions ~~~~~~~~~ .. autoapisummary:: cobra.util.util.format_long_string cobra.util.util.show_versions .. py:function:: format_long_string(string: str, max_length: int = 50) -> str Shorten long string into a small string with ellipsis. :param string: The long string to shorten. :type string: str :param max_length: The maximum length after which to append ellipsis (default 50). :type max_length: int, optional :returns: The shortened string. :rtype: str .. py:class:: AutoVivification Bases: :py:obj:`dict` Implementation of Perl's autovivification feature. .. rubric:: Notes For more information, check https://stackoverflow.com/a/652284/280182 . .. py:method:: __getitem__(item: Any) -> Any Retrieve if item is found, else add it. :param item: The object to look for. :type item: Any :returns: The retrieved object. :rtype: Any .. py:function:: show_versions() -> None Print dependency information.