mirror of
https://gerrit.googlesource.com/git-repo
synced 2026-07-15 21:27:00 +00:00
color: Replace anonymous sentinel with named class
Replace the bare `object()` sentinel used for `_CHECK_CONSOLE` with an instance of a dedicated `_CheckConsoleSentinel` class. This gives the sentinel a meaningful repr and type, making it easier to identify in debugging output and type checks compared to an opaque `<object>`. Change-Id: I916521d47ba13207e29a2412e00f3576aff8afff Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/605021 Commit-Queue: Brian Gan <brgan@google.com> Tested-by: Brian Gan <brgan@google.com> Reviewed-by: Gavin Mak <gavinmak@google.com>
This commit is contained in:
committed by
gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com
parent
3bb4871c44
commit
0398c6718e
@@ -84,9 +84,14 @@ def _Color(fg=None, bg=None, attr=None):
|
||||
|
||||
DEFAULT = None
|
||||
|
||||
|
||||
class _CheckConsoleSentinel:
|
||||
"""Sentinel for checking console coloring."""
|
||||
|
||||
|
||||
# Placholder value that indicates we need to check if the user is in an
|
||||
# interactive terminal session to determine if we turn on color or not.
|
||||
_CHECK_CONSOLE = object()
|
||||
_CHECK_CONSOLE = _CheckConsoleSentinel()
|
||||
|
||||
# https://git-scm.com/docs/git-config#Documentation/git-config.txt-colorui
|
||||
_CONFIG_TO_COLOR_SETTING = {
|
||||
|
||||
Reference in New Issue
Block a user