-
-
Notifications
You must be signed in to change notification settings - Fork 458
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
Changes from 4 commits
abece73
08c563f
b1fee9b
c623884
cfbf278
c9b49a6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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] | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The available colors seem to be fixed, should we switch to:
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So that users don't actually set these variables to something else. But it's fine without it as well, I feel There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ended up keeping |
||||||||||||||
RESET: Literal["0"] | ||||||||||||||
opt_dict: dict[str, str] | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
|
||||||||||||||
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 | ||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't forget, if it's a tuple with multiple elements of the same type, you need
...
. This should fix the allowlist entry too.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, inattention from my end