Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve types in utils.termcolors #1901

Merged
merged 6 commits into from
Mar 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions django-stubs/utils/termcolors.pyi
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
from collections.abc import Callable, Mapping, Sequence
from typing import Any
from collections.abc import Callable, Sequence
from typing import Any, Literal

color_names: Sequence
foreground: Mapping[str, str]
background: Mapping[str, str]
RESET: str
opt_dict: Mapping[str, str]
color_names: tuple[str, ...]
foreground: dict[str, str]
background: dict[str, str]
RESET: Literal["0"]
opt_dict: dict[str, str]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
opt_dict: dict[str, str]
opt_dict: # A typed dict?


def colorize(text: str | None = ..., opts: Sequence[str] = ..., **kwargs: Any) -> str: ...
def make_style(opts: tuple = ..., **kwargs: Any) -> Callable: ...
def colorize(text: str | None = ..., opts: Sequence[str] = ..., *, fg: str = ..., bg: str = ...) -> str: ...
def make_style(opts: Sequence[str] = ..., *, fg: str = ..., bg: str = ...) -> Callable[[str | None], str]: ...
Viicos marked this conversation as resolved.
Show resolved Hide resolved

NOCOLOR_PALETTE: str
DARK_PALETTE: str
Expand Down