inform


Nameinform JSON
Version 1.29 PyPI version JSON
download
home_pageNone
Summaryprint & logging utilities for communicating with user
upload_time2024-04-27 20:26:32
maintainerNone
docs_urlNone
authorKen Kundert
requires_python>=3.6
licenseNone
keywords inform logging printing
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage
            Inform — Print & Logging Utilities
==================================

|build status| |downloads| |rtd status| |coverage| |pypi version| |anaconda version| |python version|

:Author: Ken Kundert
:Version: 1.29
:Released: 2024-04-27

A package that provides specialized print functions that are used when 
communicating with the user. It allows you to easily print attractive, 
informative, and consistent error messages.  For example:

.. code-block:: python

    >> from inform import display, warn, error
    >> display(
    ..     'Display is like print'
    ..     'except that it supports logging and can be disabled.'
    ..     sep=', ')
    Display is like print, except that it supports logging and can be disabled.

    >> warn('warnings get a header that is printed in yellow.')
    warning: warnings get a header that is printed in yellow.

    >> error('errors get a header that is printed in red.')
    error: errors get a header that is printed in red.

Inform also provides logging and output control.

In addition, Inform provides a powerful generic exception that can be used 
directly as a general purpose exception, or can be subclassed to produce 
powerful specialized exceptions.  Inform exceptions are unique in that they keep 
all of the named and unnamed arguments so they can be used when reporting 
errors.

You can find the documentation on `ReadTheDocs
<https://inform.readthedocs.io>`_. You can download and install the latest
stable version of the code from `PyPI <https://pypi.python.org>`_ using::

    pip3 install --user --upgrade inform

You can find the latest development version of the source code on
`Github <https://github.com/KenKundert/inform>`_.


Introduction
------------

This package defines a collection of *print* functions that have different 
roles.  These functions are referred to as *informants* and are described below 
in the Informants section. They include include *log*, *comment*, *codicil*, 
*narrate*, *display*, *output*, *notify*, *debug*, *warn*, *error*, *fatal* and 
*panic*.

With the simplest use of the program, you simply import the informants you need 
and call them (they take the same arguments as Python's built-in *print* 
function):

.. code-block:: python

    >>> from inform import display
    >>> display('ice', 9)
    ice 9

For more control of the informants, you can import and instantiate the Inform 
class yourself along with the desired informants.  This gives you the ability to 
specify options:

.. code-block:: python

    >>> from inform import Inform, display, error
    >>> Inform(logfile=False, prog_name=False)
    <...>
    >>> display('hello')
    hello
    >>> error('file not found.', culprit='data.in')
    error: data.in: file not found.

An object of the Inform class is referred to as an informer (not to be confused 
with the print functions, which are  referred to as informants). Once 
instantiated, you can use the informer to change various settings, terminate the 
program, or return a count of the number of errors that have occurred.

.. code-block:: python

    >>> from inform import Inform, error
    >>> informer = Inform(prog_name="prog")
    >>> error('file not found.', culprit='data.in')
    prog error: data.in: file not found.
    >>> informer.errors_accrued()
    1

You can create your own informants:

.. code-block:: python

    >>> from inform import Inform, InformantFactory

    >>> verbose1 = InformantFactory(output=lambda m: m.verbosity >= 1)
    >>> verbose2 = InformantFactory(output=lambda m: m.verbosity >= 2)
    >>> with Inform(verbosity=0):
    ...     verbose1('First level of verbosity.')
    ...     verbose2('Second level of verbosity.')

    >>> with Inform(verbosity=1):
    ...     verbose1('First level of verbosity.')
    ...     verbose2('Second level of verbosity.')
    First level of verbosity.

    >>> with Inform(verbosity=2):
    ...     verbose1('First level of verbosity.')
    ...     verbose2('Second level of verbosity.')
    First level of verbosity.
    Second level of verbosity.

The argument *verbosity* is not an explicitly supported argument to Inform.  In 
this case Inform simply saves the value and makes it available as an attribute, 
and it is this attribute that is queried by the lambda function passed to the 
InformantFactory when creating the informants.


Exception
---------
An exception, *Error*, is provided that takes the same arguments as an 
informant.  This allows you to catch the exception and handle it if you like.  
The exception provides the *report* and *terminate* methods that processes the 
exception as an error or fatal error if you find that you can do nothing else 
with the exception:

.. code-block:: python

    >>> from inform import Inform, Error

    >>> Inform(prog_name='myprog')
    <...>
    >>> try:
    ...     raise Error('must not be zero.', culprit='naught')
    ... except Error as e:
    ...     e.report()
    myprog error: naught: must not be zero.

*Error* also provides get_message() and get_culprit() methods, which return the 
message and the culprit. You can also cast the exception to a string to get 
a string that contains both the message and the culprit formatted so that it can 
be shown to the user.

Any keyword arguments provided will be available in *e.kwargs*, but certain 
keyword arguments are reserved by inform (see above).

One common approach to using *Error* is to pass all the arguments that make up 
the error message as unnamed arguments and then assemble them into the message 
by providing a template.  In that way the arguments are directly available to 
the handler if needed. For example:

.. code-block:: python

    >>> from difflib import get_close_matches
    >>> from inform import Error, codicil, conjoin, fmt

    >>> known_names = 'alpha beta gamma delta epsilon'.split()
    >>> name = 'alfa'

    >>> try:
    ...     if name not in known_names:
    ...         raise Error(name, template="name '{}' is not defined.")
    ... except Error as e:
    ...     candidates = get_close_matches(e.args[0], known_names, 1, 0.6)
    ...     candidates = conjoin(candidates, conj=' or ')
    ...     e.report()
    ...     codicil(fmt('Did you mean {candidates}?'))
    myprog error: name 'alfa' is not defined.
        Did you mean alpha?


Utilities
---------

Several utility functions are provided for your convenience. They are often 
helpful when creating messages.

indent:
    Indents the text.

conjoin:
    Like ''.join(), but allows you to specify a conjunction that is placed 
    between the last two elements, ex:

    .. code-block:: python

        >>> from inform import conjoin
        >>> conjoin(['a', 'b', 'c'])
        'a, b and c'

        >>> conjoin(['a', 'b', 'c'], conj=' or ')
        'a, b or c'

cull:
    Strips items from a collection that have a particular value.

join:
    Combines the arguments in a manner very similar to an informant and returns 
    the result as a string.

fmt:
    Similar to ''.format(), but it can pull arguments from the local scope.

render:
    Recursively convert an object to a string with reasonable formatting.  Has 
    built in support for the base Python types (None, bool, int, float, str, 
    set, tuple, list, and dict).  If you confine yourself to these types, the 
    output of render() can be read by the Python interpreter. Other types are 
    converted to string with repr().

plural:
    Produces either the singular or plural form of a word based on a count.

full_stop:
    Adds a period to the end of the string if needed (if the last character is 
    not a period, question mark or exclamation mark).

columns:
    Distribute array over enough columns to fill the screen.

os_error:
    Generates clean messages for operating system errors.

is_str:
    Returns *True* if its argument is a string-like object.

is_iterable:
    Returns *True* if its argument is iterable.

is_collection:
    Returns *True* if its argument is iterable but is not a string.

is_mapping:
    Returns *True* if its argument is a mapping (are dictionary like).

For example:

.. code-block:: python

    >>> from inform import Inform, display, error, conjoin, cull, fmt, os_error

    >>> Inform(prog_name=False)
    <...>
    >>> filenames = cull(['a', 'b', None, 'd'])
    >>> filetype = 'CSV'
    >>> display(
    ...     fmt(
    ...         'Reading {filetype} files: {names}.',
    ...         names=conjoin(filenames),
    ...     )
    ... )
    Reading CSV files: a, b and d.

    >>> contents = {}
    >>> for name in filenames:
    ...     try:
    ...         with open(name) as f:
    ...             contents[name] = f.read()
    ...     except IOError as e:
    ...         error(os_error(e))
    error: a: no such file or directory.
    error: b: no such file or directory.
    error: d: no such file or directory.

Notice that *filetype* was not explicitly passed into *fmt()* even though it was 
explicitly called out in the format string.  *filetype* can be left out of the 
argument list because if *fmt* does not find a named argument in its argument 
list, it will look for a variable of the same name in the local scope.

Here is an example of render():

.. code-block:: python

    >>> from inform import render, display
    >>> s1='alpha string'
    >>> s2='beta string'
    >>> n=42
    >>> S={s1, s2}
    >>> L=[s1, n, S]
    >>> d = {1:s1, 2:s2}
    >>> D={'s': s1, 'n': n, 'S': S, 'L': L, 'd':d}
    >>> display('D', '=', render(D, True))
    D = {
        'L': [
            'alpha string',
            42,
            {'alpha string', 'beta string'},
        ],
        'S': {'alpha string', 'beta string'},
        'd': {1: 'alpha string', 2: 'beta string'},
        'n': 42,
        's': 'alpha string',
    }

Finally, here is an example of full_stop and columns. It prints out the phonetic 
alphabet.

.. code-block:: python

    >>> from inform import columns, full_stop
    >>> title = 'Display the NATO phonetic alphabet'
    >>> words = """
    ...     Alfa Bravo Charlie Delta Echo Foxtrot Golf Hotel India Juliett Kilo
    ...     Lima Mike November Oscar Papa Quebec Romeo Sierra Tango Uniform
    ...     Victor Whiskey X-ray Yankee Zulu
    ... """.split()
    >>> display(full_stop(title), columns(words), sep='\n')
    Display the NATO phonetic alphabet.
        Alfa      Echo      India     Mike      Quebec    Uniform   Yankee
        Bravo     Foxtrot   Juliett   November  Romeo     Victor    Zulu
        Charlie   Golf      Kilo      Oscar     Sierra    Whiskey
        Delta     Hotel     Lima      Papa      Tango     X-ray

Debugging Functions
"""""""""""""""""""
The debugging functions are intended to be used when you want to print something 
out when debugging your program.  They are colorful to make it easier to find 
them among the program's normal output, and a header is added that describes 
the location they were called from. This makes it easier to distinguish several 
debug message and also makes it easy to find and remove the functions once you 
are done debugging.

ppp:
    This function is very similar to the normal Python print function.

    .. code:: python

        >>> from inform import ppp, ddd, sss, vvv
        >>> a = 1
        >>> b = 'this is a test'
        >>> c = (2, 3)
        >>> d = {'a': a, 'b': b, 'c': c}
        >>> ppp(a, b, c)
        DEBUG: <doctest README.rst[52]>, 1, __main__: 1 this is a test (2, 3)

ddd:
    This function is pretty prints all of both the unnamed and named arguments.

    .. code:: python

        >>> ddd(a, b, c=c, d=d)
        DEBUG: <doctest README.rst[53]>, 1, __main__:
            1
            'this is a test'
            c = (2, 3)
            d = {
                'a': 1,
                'b': 'this is a test',
                'c': (2, 3),
            }

    If you give named arguments, the name is prepended to its value.


vvv:
    This function prints variables from the calling scope. If no arguments are 
    given, then all the variables are printed. You can optionally give specific 
    variables on the argument list and only those variables are printed.

    .. code:: python

        >>> vvv(b, d)
        DEBUG: <doctest README.rst[54]>, 1, __main__:
            b = 'this is a test'
            d = {
                'a': 1,
                'b': 'this is a test',
                'c': (2, 3),
            }


sss:
    This function prints a stack trace, which can answer the *How did I get 
    here?* question better than a simple print function.

    .. code:: python

        >> def foo():
        ..     sss()
        ..     print('CONTINUING')

        >> foo()
        DEBUG: <doctest README.rst[93]>:2, __main__.foo():
            Traceback (most recent call last):
                ...
        CONTINUING


Color Class
"""""""""""

The Color class creates colorizers, which are used to render text in 
a particular color.  They are like the Python print function in that they take 
any number of unnamed arguments that are converted to strings and then joined 
into a single string. The string is then coded for the chosen color and 
returned. For example:

.. code-block:: python

   >> from inform import Color, display

   >> green = Color('green')
   >> red = Color('red')
   >> success = green('pass:')
   >> failure = red('FAIL:')

   >> failures = {'outrigger': True, 'signalman': False}
   >> for name, fails in failures.items():
   ..     result = failure if fails else success
   ..     display(result, name)
   FAIL: outrigger
   pass: signalman

When the messages print, the 'pass:' will be green and 'FAIL:' will be red.


.. |build status| image:: https://github.com/KenKundert/inform/actions/workflows/build.yaml/badge.svg
    :target: https://github.com/KenKundert/inform/actions/workflows/build.yaml

.. |downloads| image:: https://pepy.tech/badge/inform/month
    :target: https://pepy.tech/project/inform

.. |rtd status| image:: https://img.shields.io/readthedocs/inform.svg
   :target: https://inform.readthedocs.io/en/latest/?badge=latest

.. |coverage| image:: https://img.shields.io/coveralls/KenKundert/inform.svg
    :target: https://coveralls.io/r/KenKundert/inform

.. |pypi version| image:: https://img.shields.io/pypi/v/inform.svg
    :target: https://pypi.python.org/pypi/inform

.. |anaconda version| image:: https://anaconda.org/conda-forge/inform/badges/version.svg
    :target: https://anaconda.org/conda-forge/inform

.. |python version| image:: https://img.shields.io/pypi/pyversions/inform.svg
    :target: https://pypi.python.org/pypi/inform/




            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "inform",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "inform, logging, printing",
    "author": "Ken Kundert",
    "author_email": "inform@nurdletech.com",
    "download_url": "https://files.pythonhosted.org/packages/ff/6b/16e124fe885147d1c51bdbe52a6c71a14ec83c4073d4c2e984250110aaa3/inform-1.29.tar.gz",
    "platform": null,
    "description": "Inform \u2014 Print & Logging Utilities\n==================================\n\n|build status| |downloads| |rtd status| |coverage| |pypi version| |anaconda version| |python version|\n\n:Author: Ken Kundert\n:Version: 1.29\n:Released: 2024-04-27\n\nA package that provides specialized print functions that are used when \ncommunicating with the user. It allows you to easily print attractive, \ninformative, and consistent error messages.  For example:\n\n.. code-block:: python\n\n    >> from inform import display, warn, error\n    >> display(\n    ..     'Display is like print'\n    ..     'except that it supports logging and can be disabled.'\n    ..     sep=', ')\n    Display is like print, except that it supports logging and can be disabled.\n\n    >> warn('warnings get a header that is printed in yellow.')\n    warning: warnings get a header that is printed in yellow.\n\n    >> error('errors get a header that is printed in red.')\n    error: errors get a header that is printed in red.\n\nInform also provides logging and output control.\n\nIn addition, Inform provides a powerful generic exception that can be used \ndirectly as a general purpose exception, or can be subclassed to produce \npowerful specialized exceptions.  Inform exceptions are unique in that they keep \nall of the named and unnamed arguments so they can be used when reporting \nerrors.\n\nYou can find the documentation on `ReadTheDocs\n<https://inform.readthedocs.io>`_. You can download and install the latest\nstable version of the code from `PyPI <https://pypi.python.org>`_ using::\n\n    pip3 install --user --upgrade inform\n\nYou can find the latest development version of the source code on\n`Github <https://github.com/KenKundert/inform>`_.\n\n\nIntroduction\n------------\n\nThis package defines a collection of *print* functions that have different \nroles.  These functions are referred to as *informants* and are described below \nin the Informants section. They include include *log*, *comment*, *codicil*, \n*narrate*, *display*, *output*, *notify*, *debug*, *warn*, *error*, *fatal* and \n*panic*.\n\nWith the simplest use of the program, you simply import the informants you need \nand call them (they take the same arguments as Python's built-in *print* \nfunction):\n\n.. code-block:: python\n\n    >>> from inform import display\n    >>> display('ice', 9)\n    ice 9\n\nFor more control of the informants, you can import and instantiate the Inform \nclass yourself along with the desired informants.  This gives you the ability to \nspecify options:\n\n.. code-block:: python\n\n    >>> from inform import Inform, display, error\n    >>> Inform(logfile=False, prog_name=False)\n    <...>\n    >>> display('hello')\n    hello\n    >>> error('file not found.', culprit='data.in')\n    error: data.in: file not found.\n\nAn object of the Inform class is referred to as an informer (not to be confused \nwith the print functions, which are  referred to as informants). Once \ninstantiated, you can use the informer to change various settings, terminate the \nprogram, or return a count of the number of errors that have occurred.\n\n.. code-block:: python\n\n    >>> from inform import Inform, error\n    >>> informer = Inform(prog_name=\"prog\")\n    >>> error('file not found.', culprit='data.in')\n    prog error: data.in: file not found.\n    >>> informer.errors_accrued()\n    1\n\nYou can create your own informants:\n\n.. code-block:: python\n\n    >>> from inform import Inform, InformantFactory\n\n    >>> verbose1 = InformantFactory(output=lambda m: m.verbosity >= 1)\n    >>> verbose2 = InformantFactory(output=lambda m: m.verbosity >= 2)\n    >>> with Inform(verbosity=0):\n    ...     verbose1('First level of verbosity.')\n    ...     verbose2('Second level of verbosity.')\n\n    >>> with Inform(verbosity=1):\n    ...     verbose1('First level of verbosity.')\n    ...     verbose2('Second level of verbosity.')\n    First level of verbosity.\n\n    >>> with Inform(verbosity=2):\n    ...     verbose1('First level of verbosity.')\n    ...     verbose2('Second level of verbosity.')\n    First level of verbosity.\n    Second level of verbosity.\n\nThe argument *verbosity* is not an explicitly supported argument to Inform.  In \nthis case Inform simply saves the value and makes it available as an attribute, \nand it is this attribute that is queried by the lambda function passed to the \nInformantFactory when creating the informants.\n\n\nException\n---------\nAn exception, *Error*, is provided that takes the same arguments as an \ninformant.  This allows you to catch the exception and handle it if you like.  \nThe exception provides the *report* and *terminate* methods that processes the \nexception as an error or fatal error if you find that you can do nothing else \nwith the exception:\n\n.. code-block:: python\n\n    >>> from inform import Inform, Error\n\n    >>> Inform(prog_name='myprog')\n    <...>\n    >>> try:\n    ...     raise Error('must not be zero.', culprit='naught')\n    ... except Error as e:\n    ...     e.report()\n    myprog error: naught: must not be zero.\n\n*Error* also provides get_message() and get_culprit() methods, which return the \nmessage and the culprit. You can also cast the exception to a string to get \na string that contains both the message and the culprit formatted so that it can \nbe shown to the user.\n\nAny keyword arguments provided will be available in *e.kwargs*, but certain \nkeyword arguments are reserved by inform (see above).\n\nOne common approach to using *Error* is to pass all the arguments that make up \nthe error message as unnamed arguments and then assemble them into the message \nby providing a template.  In that way the arguments are directly available to \nthe handler if needed. For example:\n\n.. code-block:: python\n\n    >>> from difflib import get_close_matches\n    >>> from inform import Error, codicil, conjoin, fmt\n\n    >>> known_names = 'alpha beta gamma delta epsilon'.split()\n    >>> name = 'alfa'\n\n    >>> try:\n    ...     if name not in known_names:\n    ...         raise Error(name, template=\"name '{}' is not defined.\")\n    ... except Error as e:\n    ...     candidates = get_close_matches(e.args[0], known_names, 1, 0.6)\n    ...     candidates = conjoin(candidates, conj=' or ')\n    ...     e.report()\n    ...     codicil(fmt('Did you mean {candidates}?'))\n    myprog error: name 'alfa' is not defined.\n        Did you mean alpha?\n\n\nUtilities\n---------\n\nSeveral utility functions are provided for your convenience. They are often \nhelpful when creating messages.\n\nindent:\n    Indents the text.\n\nconjoin:\n    Like ''.join(), but allows you to specify a conjunction that is placed \n    between the last two elements, ex:\n\n    .. code-block:: python\n\n        >>> from inform import conjoin\n        >>> conjoin(['a', 'b', 'c'])\n        'a, b and c'\n\n        >>> conjoin(['a', 'b', 'c'], conj=' or ')\n        'a, b or c'\n\ncull:\n    Strips items from a collection that have a particular value.\n\njoin:\n    Combines the arguments in a manner very similar to an informant and returns \n    the result as a string.\n\nfmt:\n    Similar to ''.format(), but it can pull arguments from the local scope.\n\nrender:\n    Recursively convert an object to a string with reasonable formatting.  Has \n    built in support for the base Python types (None, bool, int, float, str, \n    set, tuple, list, and dict).  If you confine yourself to these types, the \n    output of render() can be read by the Python interpreter. Other types are \n    converted to string with repr().\n\nplural:\n    Produces either the singular or plural form of a word based on a count.\n\nfull_stop:\n    Adds a period to the end of the string if needed (if the last character is \n    not a period, question mark or exclamation mark).\n\ncolumns:\n    Distribute array over enough columns to fill the screen.\n\nos_error:\n    Generates clean messages for operating system errors.\n\nis_str:\n    Returns *True* if its argument is a string-like object.\n\nis_iterable:\n    Returns *True* if its argument is iterable.\n\nis_collection:\n    Returns *True* if its argument is iterable but is not a string.\n\nis_mapping:\n    Returns *True* if its argument is a mapping (are dictionary like).\n\nFor example:\n\n.. code-block:: python\n\n    >>> from inform import Inform, display, error, conjoin, cull, fmt, os_error\n\n    >>> Inform(prog_name=False)\n    <...>\n    >>> filenames = cull(['a', 'b', None, 'd'])\n    >>> filetype = 'CSV'\n    >>> display(\n    ...     fmt(\n    ...         'Reading {filetype} files: {names}.',\n    ...         names=conjoin(filenames),\n    ...     )\n    ... )\n    Reading CSV files: a, b and d.\n\n    >>> contents = {}\n    >>> for name in filenames:\n    ...     try:\n    ...         with open(name) as f:\n    ...             contents[name] = f.read()\n    ...     except IOError as e:\n    ...         error(os_error(e))\n    error: a: no such file or directory.\n    error: b: no such file or directory.\n    error: d: no such file or directory.\n\nNotice that *filetype* was not explicitly passed into *fmt()* even though it was \nexplicitly called out in the format string.  *filetype* can be left out of the \nargument list because if *fmt* does not find a named argument in its argument \nlist, it will look for a variable of the same name in the local scope.\n\nHere is an example of render():\n\n.. code-block:: python\n\n    >>> from inform import render, display\n    >>> s1='alpha string'\n    >>> s2='beta string'\n    >>> n=42\n    >>> S={s1, s2}\n    >>> L=[s1, n, S]\n    >>> d = {1:s1, 2:s2}\n    >>> D={'s': s1, 'n': n, 'S': S, 'L': L, 'd':d}\n    >>> display('D', '=', render(D, True))\n    D = {\n        'L': [\n            'alpha string',\n            42,\n            {'alpha string', 'beta string'},\n        ],\n        'S': {'alpha string', 'beta string'},\n        'd': {1: 'alpha string', 2: 'beta string'},\n        'n': 42,\n        's': 'alpha string',\n    }\n\nFinally, here is an example of full_stop and columns. It prints out the phonetic \nalphabet.\n\n.. code-block:: python\n\n    >>> from inform import columns, full_stop\n    >>> title = 'Display the NATO phonetic alphabet'\n    >>> words = \"\"\"\n    ...     Alfa Bravo Charlie Delta Echo Foxtrot Golf Hotel India Juliett Kilo\n    ...     Lima Mike November Oscar Papa Quebec Romeo Sierra Tango Uniform\n    ...     Victor Whiskey X-ray Yankee Zulu\n    ... \"\"\".split()\n    >>> display(full_stop(title), columns(words), sep='\\n')\n    Display the NATO phonetic alphabet.\n        Alfa      Echo      India     Mike      Quebec    Uniform   Yankee\n        Bravo     Foxtrot   Juliett   November  Romeo     Victor    Zulu\n        Charlie   Golf      Kilo      Oscar     Sierra    Whiskey\n        Delta     Hotel     Lima      Papa      Tango     X-ray\n\nDebugging Functions\n\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\nThe debugging functions are intended to be used when you want to print something \nout when debugging your program.  They are colorful to make it easier to find \nthem among the program's normal output, and a header is added that describes \nthe location they were called from. This makes it easier to distinguish several \ndebug message and also makes it easy to find and remove the functions once you \nare done debugging.\n\nppp:\n    This function is very similar to the normal Python print function.\n\n    .. code:: python\n\n        >>> from inform import ppp, ddd, sss, vvv\n        >>> a = 1\n        >>> b = 'this is a test'\n        >>> c = (2, 3)\n        >>> d = {'a': a, 'b': b, 'c': c}\n        >>> ppp(a, b, c)\n        DEBUG: <doctest README.rst[52]>, 1, __main__: 1 this is a test (2, 3)\n\nddd:\n    This function is pretty prints all of both the unnamed and named arguments.\n\n    .. code:: python\n\n        >>> ddd(a, b, c=c, d=d)\n        DEBUG: <doctest README.rst[53]>, 1, __main__:\n            1\n            'this is a test'\n            c = (2, 3)\n            d = {\n                'a': 1,\n                'b': 'this is a test',\n                'c': (2, 3),\n            }\n\n    If you give named arguments, the name is prepended to its value.\n\n\nvvv:\n    This function prints variables from the calling scope. If no arguments are \n    given, then all the variables are printed. You can optionally give specific \n    variables on the argument list and only those variables are printed.\n\n    .. code:: python\n\n        >>> vvv(b, d)\n        DEBUG: <doctest README.rst[54]>, 1, __main__:\n            b = 'this is a test'\n            d = {\n                'a': 1,\n                'b': 'this is a test',\n                'c': (2, 3),\n            }\n\n\nsss:\n    This function prints a stack trace, which can answer the *How did I get \n    here?* question better than a simple print function.\n\n    .. code:: python\n\n        >> def foo():\n        ..     sss()\n        ..     print('CONTINUING')\n\n        >> foo()\n        DEBUG: <doctest README.rst[93]>:2, __main__.foo():\n            Traceback (most recent call last):\n                ...\n        CONTINUING\n\n\nColor Class\n\"\"\"\"\"\"\"\"\"\"\"\n\nThe Color class creates colorizers, which are used to render text in \na particular color.  They are like the Python print function in that they take \nany number of unnamed arguments that are converted to strings and then joined \ninto a single string. The string is then coded for the chosen color and \nreturned. For example:\n\n.. code-block:: python\n\n   >> from inform import Color, display\n\n   >> green = Color('green')\n   >> red = Color('red')\n   >> success = green('pass:')\n   >> failure = red('FAIL:')\n\n   >> failures = {'outrigger': True, 'signalman': False}\n   >> for name, fails in failures.items():\n   ..     result = failure if fails else success\n   ..     display(result, name)\n   FAIL: outrigger\n   pass: signalman\n\nWhen the messages print, the 'pass:' will be green and 'FAIL:' will be red.\n\n\n.. |build status| image:: https://github.com/KenKundert/inform/actions/workflows/build.yaml/badge.svg\n    :target: https://github.com/KenKundert/inform/actions/workflows/build.yaml\n\n.. |downloads| image:: https://pepy.tech/badge/inform/month\n    :target: https://pepy.tech/project/inform\n\n.. |rtd status| image:: https://img.shields.io/readthedocs/inform.svg\n   :target: https://inform.readthedocs.io/en/latest/?badge=latest\n\n.. |coverage| image:: https://img.shields.io/coveralls/KenKundert/inform.svg\n    :target: https://coveralls.io/r/KenKundert/inform\n\n.. |pypi version| image:: https://img.shields.io/pypi/v/inform.svg\n    :target: https://pypi.python.org/pypi/inform\n\n.. |anaconda version| image:: https://anaconda.org/conda-forge/inform/badges/version.svg\n    :target: https://anaconda.org/conda-forge/inform\n\n.. |python version| image:: https://img.shields.io/pypi/pyversions/inform.svg\n    :target: https://pypi.python.org/pypi/inform/\n\n\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "print & logging utilities for communicating with user",
    "version": "1.29",
    "project_urls": {
        "changelog": "https://github.com/KenKundert/inform/blob/master/doc/releases.rst",
        "documentation": "https://inform.readthedocs.io",
        "homepage": "https://inform.readthedocs.io",
        "repository": "https://github.com/kenkundert/inform"
    },
    "split_keywords": [
        "inform",
        " logging",
        " printing"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3a89da37ad7ebc98b60e619c825577c0d87a3d64f87172e3bc196c82512d9036",
                "md5": "89915fc4ea7c7cdd1a6cacd75da782be",
                "sha256": "794abffe0f32f3ffaa9f8b3d43104936f4973a123d015b3a300e3d5ab77aa0c7"
            },
            "downloads": -1,
            "filename": "inform-1.29-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "89915fc4ea7c7cdd1a6cacd75da782be",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 39495,
            "upload_time": "2024-04-27T20:26:29",
            "upload_time_iso_8601": "2024-04-27T20:26:29.423662Z",
            "url": "https://files.pythonhosted.org/packages/3a/89/da37ad7ebc98b60e619c825577c0d87a3d64f87172e3bc196c82512d9036/inform-1.29-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ff6b16e124fe885147d1c51bdbe52a6c71a14ec83c4073d4c2e984250110aaa3",
                "md5": "d8b1a6feb203127a7b9bbd6acf6ceaa3",
                "sha256": "1a90fe0d754942b97f9cc0f691fd5c592f388f281c54015491439c5a1ee90961"
            },
            "downloads": -1,
            "filename": "inform-1.29.tar.gz",
            "has_sig": false,
            "md5_digest": "d8b1a6feb203127a7b9bbd6acf6ceaa3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 42634,
            "upload_time": "2024-04-27T20:26:32",
            "upload_time_iso_8601": "2024-04-27T20:26:32.026401Z",
            "url": "https://files.pythonhosted.org/packages/ff/6b/16e124fe885147d1c51bdbe52a6c71a14ec83c4073d4c2e984250110aaa3/inform-1.29.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-27 20:26:32",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "KenKundert",
    "github_project": "inform",
    "travis_ci": true,
    "coveralls": true,
    "github_actions": true,
    "tox": true,
    "lcname": "inform"
}
        
Elapsed time: 0.25988s