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

celery.utils.text

Text formatting utilities.

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

Abbreviate word.

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

Abbreviate task name.

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

Remove identation.

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

Remove identation from first line of text.

celery.utils.text.ensure_newlines(s, n=2)

Ensure text s ends in separator sep’.

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='\n')[source]

Fill paragraphs with newlines (or custom separator).

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

Indent text.

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

Concatenate list of strings.

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

Pluralize term when n is greater than one.

celery.utils.text.pretty(value, width=80, nl_width=80, sep='\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=re.compile('%(\\w)'), expand='\\1')[source]

Format string, expanding abbreviations in keys’.

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

Truncate text to a maximum number of characters.