This document describes the current stable version of Celery (4.2). For development docs, go here.

celery.utils.text

Text formatting utilities.

celery.utils.text.abbr(S, max, ellipsis=u'...')[source]

Abbreviate word.

celery.utils.text.abbrtask(S, max)[source]

Abbreviate task name.

celery.utils.text.dedent(s, n=4, sep=u'\n')[source]

Remove identation.

celery.utils.text.dedent_initial(s, n=4)[source]

Remove identation from first line of text.

celery.utils.text.ensure_sep(sep, s, n=2)[source]

Ensure text s ends in separator sep’.

celery.utils.text.fill_paragraphs(s, width, sep=u'\n')[source]

Fill paragraphs with newlines (or custom separator).

celery.utils.text.indent(t, indent=0, sep=u'\n')[source]

Indent text.

celery.utils.text.join(l, sep=u'\n')[source]

Concatenate list of strings.

celery.utils.text.pluralize(n, text, suffix=u's')[source]

Pluralize term when n is greater than one.

celery.utils.text.pretty(value, width=80, nl_width=80, sep=u'\n', **kw)[source]

Format value for printing to console.

celery.utils.text.str_to_list(s)[source]

Convert string to list.

celery.utils.text.simple_format(s, keys, pattern=<_sre.SRE_Pattern object>, expand=u'\\1')[source]

Format string, expanding abbreviations in keys’.

celery.utils.text.truncate(s, maxlen=128, suffix=u'...')[source]

Truncate text to a maximum number of characters.