celery.utils.text

Text formatting utilities.

celery.utils.text.abbr(S: str, max: int, ellipsis: str | bool = '...') str[исходный код]

Abbreviate word.

celery.utils.text.abbrtask(S: str, max: int) str[исходный код]

Abbreviate task name.

celery.utils.text.dedent(s: str, sep: str = '\n') str[исходный код]

Remove indentation.

celery.utils.text.dedent_initial(s: str, n: int = 4) str[исходный код]

Remove indentation from first line of text.

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

Ensure text s ends in separator sep“.

celery.utils.text.ensure_sep(sep: str, s: str, n: int = 2) str[исходный код]

Ensure text s ends in separator sep“.

celery.utils.text.fill_paragraphs(s: str, width: int, sep: str = '\n') str[исходный код]

Fill paragraphs with newlines (or custom separator).

celery.utils.text.indent(t: str, indent: int = 0, sep: str = '\n') str[исходный код]

Indent text.

celery.utils.text.join(l: list[str], sep: str = '\n') str[исходный код]

Concatenate list of strings.

celery.utils.text.pluralize(n: float, text: str, suffix: str = 's') str[исходный код]

Pluralize term when n is greater than one.

celery.utils.text.pretty(value: str, width: int = 80, nl_width: int = 80, sep: str = '\n', **kw: Any) str[исходный код]

Format value for printing to console.

celery.utils.text.simple_format(s: str, keys: dict[str, Union[str, Callable]], pattern: Pattern[str] = re.compile('%(\\w)'), expand: str = '\\1') str[исходный код]

Format string, expanding abbreviations in keys“.

celery.utils.text.str_to_list(s: str) list[str][исходный код]

Convert string to list.

celery.utils.text.truncate(s: str, maxlen: int = 128, suffix: str = '...') str[исходный код]

Truncate text to a maximum number of characters.

Back to Top