From b584dd64db2e0264f387c204ff3b82c8bf008a5e Mon Sep 17 00:00:00 2001 From: Will McGugan Date: Fri, 26 Jun 2020 11:33:53 +0100 Subject: [PATCH] type fixes --- rich/style.py | 3 +-- rich/text.py | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rich/style.py b/rich/style.py index 022366db..b54ad5d4 100644 --- a/rich/style.py +++ b/rich/style.py @@ -105,7 +105,6 @@ class Style: encircle: bool = None, overline: bool = None, link: str = None, - link_id: str = None, ): self._ansi: Optional[str] = None self._style_definition: Optional[str] = None @@ -150,7 +149,7 @@ class Style: ) ) self._link = link - self._link_id = (link_id or f"{time()}-{randint(0, 999999)}") if link else "" + self._link_id = f"{time()}-{randint(0, 999999)}" if link else "" bold = _Bit(0) dim = _Bit(1) diff --git a/rich/text.py b/rich/text.py index 59b86303..98d6704f 100644 --- a/rich/text.py +++ b/rich/text.py @@ -363,7 +363,8 @@ class Text(JupyterMixin): if style: start, end = get_span() match_style = style(plain[start:end]) if callable(style) else style - append_span(_Span(start, end, match_style)) + if match_style is not None: + append_span(_Span(start, end, match_style)) count += 1 for name in match.groupdict().keys():