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>
diff --git a/color.py b/color.py index 4068634..53fadf0 100644 --- a/color.py +++ b/color.py
@@ -84,9 +84,14 @@ 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 = {