from collections.abc import Iterable, Iterator
from typing import Any, TypeVar

from django.db.models.base import Model
from django.utils.functional import SimpleLazyObject, _StrOrPromise, _StrPromise

_StrOrPromiseT = TypeVar("_StrOrPromiseT", bound=_StrOrPromise)
_StrOrPromiseOrNoneT = TypeVar("_StrOrPromiseOrNoneT", bound=_StrOrPromise | None)

def capfirst(x: _StrOrPromiseOrNoneT) -> _StrOrPromiseOrNoneT: ...

re_words: Any
re_chars: Any
re_tag: Any
re_newlines: Any
re_camel_case: Any

def wrap(text: _StrOrPromiseT, width: int) -> _StrOrPromiseT: ...

class Truncator(SimpleLazyObject):
    def __init__(self, text: Model | str) -> None: ...
    def add_truncation_text(self, text: str, truncate: str | None = ...) -> str: ...
    def chars(self, num: int, truncate: str | None = ..., html: bool = ...) -> str: ...
    def words(self, num: int, truncate: str | None = ..., html: bool = ...) -> str: ...

def get_valid_filename(name: _StrOrPromiseT) -> _StrOrPromiseT: ...
def get_text_list(list_: list[_StrOrPromise], last_word: _StrOrPromise = ...) -> _StrOrPromise: ...
def normalize_newlines(text: _StrOrPromiseT) -> _StrOrPromiseT: ...
def phone2numeric(phone: _StrOrPromiseT) -> _StrOrPromiseT: ...
def compress_string(s: bytes) -> bytes: ...

class StreamingBuffer:
    vals: list[bytes] = ...
    def __init__(self) -> None: ...
    def write(self, val: bytes) -> None: ...
    def read(self) -> bytes: ...
    def flush(self) -> Any: ...
    def close(self) -> Any: ...

def compress_sequence(sequence: Iterable[bytes]) -> Iterator[bytes]: ...

smart_split_re: Any

def smart_split(text: str) -> Iterator[str]: ...
def unescape_entities(text: str) -> str: ...
def unescape_string_literal(s: _StrOrPromiseT) -> _StrOrPromiseT: ...
def slugify(value: _StrOrPromiseT, allow_unicode: bool = ...) -> _StrOrPromiseT: ...
def camel_case_to_spaces(value: str) -> str: ...
def format_lazy(format_string: _StrOrPromise, *args: Any, **kwargs: Any) -> _StrPromise: ...
