Skip to content

Commit

Permalink
Merge pull request #11136 from pradyunsg/fix-upgrade-prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
pradyunsg committed May 31, 2022
1 parent ca2d9f4 commit 0799cea
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions news/11136.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix an incorrect assertion in the logging logic, that prevented the upgrade prompt from being presented.
8 changes: 5 additions & 3 deletions src/pip/_internal/utils/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
Console,
ConsoleOptions,
ConsoleRenderable,
RenderableType,
RenderResult,
RichCast,
)
from pip._vendor.rich.highlighter import NullHighlighter
from pip._vendor.rich.logging import RichHandler
Expand Down Expand Up @@ -121,7 +123,7 @@ def format(self, record: logging.LogRecord) -> str:

@dataclass
class IndentedRenderable:
renderable: ConsoleRenderable
renderable: RenderableType
indent: int

def __rich_console__(
Expand Down Expand Up @@ -156,10 +158,10 @@ def emit(self, record: logging.LogRecord) -> None:
if record.msg == "[present-rich] %s" and len(record.args) == 1:
rich_renderable = record.args[0]
assert isinstance(
rich_renderable, ConsoleRenderable
rich_renderable, (ConsoleRenderable, RichCast, str)
), f"{rich_renderable} is not rich-console-renderable"

renderable: ConsoleRenderable = IndentedRenderable(
renderable: RenderableType = IndentedRenderable(
rich_renderable, indent=get_indentation()
)
else:
Expand Down

0 comments on commit 0799cea

Please sign in to comment.