Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-rich for openSUSE:Factory checked in at 2023-08-30 10:19:16 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-rich (Old) and /work/SRC/openSUSE:Factory/.python-rich.new.1766 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-rich" Wed Aug 30 10:19:16 2023 rev:27 rq:1106407 version:13.5.2 Changes: -------- --- /work/SRC/openSUSE:Factory/python-rich/python-rich.changes 2023-07-24 18:13:05.269607346 +0200 +++ /work/SRC/openSUSE:Factory/.python-rich.new.1766/python-rich.changes 2023-08-30 10:21:41.418732881 +0200 @@ -1,0 +2,32 @@ +Sun Aug 27 21:36:07 UTC 2023 - Arun Persaud <a...@gmx.de> + +- specfile: + * update copyright year + +- update to version 13.5.2: + * Fixed + + Fixed Text.expand_tab assertion error + +- changes from version 13.5.1: + * Fixed + + Fix tilde character (~) not included in link regex when printing + to console #3057 + +- changes from version 13.5.0: + * Fixed + + Fixed Text.expand_tabs not expanding spans. + + Fixed TimeElapsedColumn from showing negative. + + Fix for escaping strings with a trailing backslash #2987 + + Fixed exception in Markdown with partial table #3053 + + Fixed the HTML export template so that the <html> tag comes + before the <head> tag #3021 + + Fixed issue with custom classes overwriting __eq__ #2875 + + Fix rich.pretty.install breakage in iPython #3013 + * Added + + Added Text.extend_style method. + + Added Span.extend method. + * Changed + + Text.tab_size now defaults to None to indicate that + Console.tab_size should be used. + +------------------------------------------------------------------- Old: ---- rich-13.4.2.tar.gz New: ---- rich-13.5.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-rich.spec ++++++ --- /var/tmp/diff_new_pack.s6P8T9/_old 2023-08-30 10:21:42.510771860 +0200 +++ /var/tmp/diff_new_pack.s6P8T9/_new 2023-08-30 10:21:42.514772003 +0200 @@ -19,7 +19,7 @@ %{?sle15_python_module_pythons} Name: python-rich -Version: 13.4.2 +Version: 13.5.2 Release: 0 Summary: A Python library for rich text and beautiful formatting in the terminal License: MIT @@ -38,7 +38,6 @@ Requires: python-pygments >= 2.13.0 Suggests: python-ipywidgets >= 7.5.1 BuildArch: noarch - # SECTION test requirements BuildRequires: %{python_module pytest} # /SECTION ++++++ rich-13.4.2.tar.gz -> rich-13.5.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rich-13.4.2/PKG-INFO new/rich-13.5.2/PKG-INFO --- old/rich-13.4.2/PKG-INFO 1970-01-01 01:00:00.000000000 +0100 +++ new/rich-13.5.2/PKG-INFO 1970-01-01 01:00:00.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: rich -Version: 13.4.2 +Version: 13.5.2 Summary: Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal Home-page: https://github.com/Textualize/rich License: MIT diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rich-13.4.2/pyproject.toml new/rich-13.5.2/pyproject.toml --- old/rich-13.4.2/pyproject.toml 2023-06-12 15:54:56.878625200 +0200 +++ new/rich-13.5.2/pyproject.toml 2023-08-01 17:44:49.441308500 +0200 @@ -2,7 +2,7 @@ name = "rich" homepage = "https://github.com/Textualize/rich" documentation = "https://rich.readthedocs.io/en/latest/" -version = "13.4.2" +version = "13.5.2" description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal" authors = ["Will McGugan <willmcgu...@gmail.com>"] license = "MIT" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rich-13.4.2/rich/_export_format.py new/rich-13.5.2/rich/_export_format.py --- old/rich-13.4.2/rich/_export_format.py 2023-03-04 12:11:24.389585500 +0100 +++ new/rich-13.5.2/rich/_export_format.py 2023-07-29 17:56:54.098596800 +0200 @@ -1,5 +1,6 @@ CONSOLE_HTML_FORMAT = """\ <!DOCTYPE html> +<html> <head> <meta charset="UTF-8"> <style> @@ -10,7 +11,6 @@ }} </style> </head> -<html> <body> <pre style="font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace"><code>{code}</code></pre> </body> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rich-13.4.2/rich/console.py new/rich-13.5.2/rich/console.py --- old/rich-13.4.2/rich/console.py 2023-04-12 18:48:36.289296200 +0200 +++ new/rich-13.5.2/rich/console.py 2023-07-29 09:09:22.478212800 +0200 @@ -1925,7 +1925,6 @@ end (str, optional): String to write at end of print data. Defaults to "\\\\n". style (Union[str, Style], optional): A style to apply to output. Defaults to None. justify (str, optional): One of "left", "right", "center", or "full". Defaults to ``None``. - overflow (str, optional): Overflow method: "crop", "fold", or "ellipsis". Defaults to None. emoji (Optional[bool], optional): Enable emoji code, or ``None`` to use console default. Defaults to None. markup (Optional[bool], optional): Enable markup, or ``None`` to use console default. Defaults to None. highlight (Optional[bool], optional): Enable automatic highlighting, or ``None`` to use console default. Defaults to None. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rich-13.4.2/rich/highlighter.py new/rich-13.5.2/rich/highlighter.py --- old/rich-13.4.2/rich/highlighter.py 2023-05-22 21:02:35.179641700 +0200 +++ new/rich-13.5.2/rich/highlighter.py 2023-07-31 11:58:18.413841500 +0200 @@ -98,7 +98,7 @@ r"(?P<number>(?<!\w)\-?[0-9]+\.?[0-9]*(e[-+]?\d+?)?\b|0x[0-9a-fA-F]*)", r"(?P<path>\B(/[-\w._+]+)*\/)(?P<filename>[-\w._+]*)?", r"(?<![\\\w])(?P<str>b?'''.*?(?<!\\)'''|b?'.*?(?<!\\)'|b?\"\"\".*?(?<!\\)\"\"\"|b?\".*?(?<!\\)\")", - r"(?P<url>(file|https|http|ws|wss)://[-0-9a-zA-Z$_+!`(),.?/;:&=%#]*)", + r"(?P<url>(file|https|http|ws|wss)://[-0-9a-zA-Z$_+!`(),.?/;:&=%#~]*)", ), ] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rich-13.4.2/rich/markdown.py new/rich-13.5.2/rich/markdown.py --- old/rich-13.4.2/rich/markdown.py 2023-05-31 19:25:32.484368000 +0200 +++ new/rich-13.5.2/rich/markdown.py 2023-07-29 11:15:24.171676400 +0200 @@ -254,15 +254,14 @@ ) -> RenderResult: table = Table(box=box.SIMPLE_HEAVY) - assert self.header is not None - assert self.header.row is not None - for column in self.header.row.cells: - table.add_column(column.content) + if self.header is not None and self.header.row is not None: + for column in self.header.row.cells: + table.add_column(column.content) - assert self.body is not None - for row in self.body.rows: - row_content = [element.content for element in row.cells] - table.add_row(*row_content) + if self.body is not None: + for row in self.body.rows: + row_content = [element.content for element in row.cells] + table.add_row(*row_content) yield table diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rich-13.4.2/rich/markup.py new/rich-13.5.2/rich/markup.py --- old/rich-13.4.2/rich/markup.py 2022-12-23 21:35:04.687870000 +0100 +++ new/rich-13.5.2/rich/markup.py 2023-07-29 10:50:21.806271800 +0200 @@ -64,6 +64,9 @@ return f"{backslashes}{backslashes}\\{text}" markup = _escape(escape_backslashes, markup) + if markup.endswith("\\") and not markup.endswith("\\\\"): + return markup + "\\" + return markup @@ -226,7 +229,6 @@ if __name__ == "__main__": # pragma: no cover - MARKUP = [ "[red]Hello World[/red]", "[magenta]Hello [b]World[/b]", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rich-13.4.2/rich/pretty.py new/rich-13.5.2/rich/pretty.py --- old/rich-13.4.2/rich/pretty.py 2023-03-04 12:11:28.369427700 +0100 +++ new/rich-13.5.2/rich/pretty.py 2023-07-29 18:05:43.245615000 +0200 @@ -211,8 +211,11 @@ ) builtins._ = value # type: ignore[attr-defined] - if "get_ipython" in globals(): + try: ip = get_ipython() # type: ignore[name-defined] + except NameError: + sys.displayhook = display_hook + else: from IPython.core.formatters import BaseFormatter class RichFormatter(BaseFormatter): # type: ignore[misc] @@ -236,8 +239,6 @@ # replace plain text formatter with rich formatter rich_formatter = RichFormatter() ip.display_formatter.formatters["text/plain"] = rich_formatter - else: - sys.displayhook = display_hook class Pretty(JupyterMixin): @@ -708,9 +709,9 @@ last=root, ) - def iter_attrs() -> Iterable[ - Tuple[str, Any, Optional[Callable[[Any], str]]] - ]: + def iter_attrs() -> ( + Iterable[Tuple[str, Any, Optional[Callable[[Any], str]]]] + ): """Iterate over attr fields and values.""" for attr in attr_fields: if attr.repr: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rich-13.4.2/rich/progress.py new/rich-13.5.2/rich/progress.py --- old/rich-13.4.2/rich/progress.py 2023-03-04 16:43:56.659094600 +0100 +++ new/rich-13.5.2/rich/progress.py 2023-07-29 09:46:36.636906900 +0200 @@ -681,7 +681,7 @@ elapsed = task.finished_time if task.finished else task.elapsed if elapsed is None: return Text("-:--:--", style="progress.elapsed") - delta = timedelta(seconds=int(elapsed)) + delta = timedelta(seconds=max(0, int(elapsed))) return Text(str(delta), style="progress.elapsed") @@ -710,7 +710,6 @@ table_column: Optional[Column] = None, show_speed: bool = False, ) -> None: - self.text_format_no_percentage = text_format_no_percentage self.show_speed = show_speed super().__init__( @@ -1636,7 +1635,6 @@ if __name__ == "__main__": # pragma: no coverage - import random import time @@ -1689,7 +1687,6 @@ console=console, transient=False, ) as progress: - task1 = progress.add_task("[red]Downloading", total=1000) task2 = progress.add_task("[green]Processing", total=1000) task3 = progress.add_task("[yellow]Thinking", total=None) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rich-13.4.2/rich/repr.py new/rich-13.5.2/rich/repr.py --- old/rich-13.4.2/rich/repr.py 2022-12-23 21:35:04.690431400 +0100 +++ new/rich-13.5.2/rich/repr.py 2023-07-29 17:56:54.098918200 +0200 @@ -76,7 +76,7 @@ param.POSITIONAL_OR_KEYWORD, param.KEYWORD_ONLY, ): - if param.default == param.empty: + if param.default is param.empty: yield getattr(self, param.name) else: yield param.name, getattr(self, param.name), param.default diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rich-13.4.2/rich/text.py new/rich-13.5.2/rich/text.py --- old/rich-13.4.2/rich/text.py 2023-03-28 14:35:49.223324300 +0200 +++ new/rich-13.5.2/rich/text.py 2023-08-01 17:44:49.441824400 +0200 @@ -97,6 +97,21 @@ return self return Span(start, min(offset, end), style) + def extend(self, cells: int) -> "Span": + """Extend the span by the given number of cells. + + Args: + cells (int): Additional space to add to end of span. + + Returns: + Span: A span. + """ + if cells: + start, end, style = self + return Span(start, end + cells, style) + else: + return self + class Text(JupyterMixin): """Text with color / style. @@ -108,7 +123,7 @@ overflow (str, optional): Overflow method: "crop", "fold", "ellipsis". Defaults to None. no_wrap (bool, optional): Disable text wrapping, or None for default. Defaults to None. end (str, optional): Character to end text with. Defaults to "\\\\n". - tab_size (int): Number of spaces per tab, or ``None`` to use ``console.tab_size``. Defaults to 8. + tab_size (int): Number of spaces per tab, or ``None`` to use ``console.tab_size``. Defaults to None. spans (List[Span], optional). A list of predefined style spans. Defaults to None. """ @@ -133,7 +148,7 @@ overflow: Optional["OverflowMethod"] = None, no_wrap: Optional[bool] = None, end: str = "\n", - tab_size: Optional[int] = 8, + tab_size: Optional[int] = None, spans: Optional[List[Span]] = None, ) -> None: sanitized_text = strip_control_codes(text) @@ -292,7 +307,7 @@ overflow (str, optional): Overflow method: "crop", "fold", "ellipsis". Defaults to None. no_wrap (bool, optional): Disable text wrapping, or None for default. Defaults to None. end (str, optional): Character to end text with. Defaults to "\\\\n". - tab_size (int): Number of spaces per tab, or ``None`` to use ``console.tab_size``. Defaults to 8. + tab_size (int): Number of spaces per tab, or ``None`` to use ``console.tab_size``. Defaults to None. """ from .ansi import AnsiDecoder @@ -354,7 +369,7 @@ justify (str, optional): Justify method: "left", "center", "full", "right". Defaults to None. overflow (str, optional): Overflow method: "crop", "fold", "ellipsis". Defaults to None. end (str, optional): Character to end text with. Defaults to "\\\\n". - tab_size (int): Number of spaces per tab, or ``None`` to use ``console.tab_size``. Defaults to 8. + tab_size (int): Number of spaces per tab, or ``None`` to use ``console.tab_size``. Defaults to None. meta (Dict[str, Any], optional). Meta data to apply to text, or None for no meta data. Default to None Returns: @@ -549,6 +564,27 @@ style += get_style(span_style, default="") return style + def extend_style(self, spaces: int) -> None: + """Extend the Text given number of spaces where the spaces have the same style as the last character. + + Args: + spaces (int): Number of spaces to add to the Text. + """ + if spaces <= 0: + return + spans = self.spans + new_spaces = " " * spaces + if spans: + end_offset = len(self) + self._spans[:] = [ + span.extend(spaces) if span.end >= end_offset else span + for span in spans + ] + self._text.append(new_spaces) + self._length += spaces + else: + self.plain += new_spaces + def highlight_regex( self, re_highlight: str, @@ -646,7 +682,7 @@ def __rich_console__( self, console: "Console", options: "ConsoleOptions" ) -> Iterable[Segment]: - tab_size: int = console.tab_size or self.tab_size or 8 + tab_size: int = console.tab_size if self.tab_size is None else self.tab_size justify = self.justify or options.justify or DEFAULT_JUSTIFY overflow = self.overflow or options.overflow or DEFAULT_OVERFLOW @@ -781,27 +817,37 @@ """ if "\t" not in self.plain: return - pos = 0 if tab_size is None: tab_size = self.tab_size - assert tab_size is not None + if tab_size is None: + tab_size = 8 + result = self.blank_copy() - append = result.append - _style = self.style + new_text: List[Text] = [] + append = new_text.append + for line in self.split("\n", include_separator=True): - parts = line.split("\t", include_separator=True) - for part in parts: - if part.plain.endswith("\t"): - part._text = [part.plain[:-1] + " "] - append(part) - pos += len(part) - spaces = tab_size - ((pos - 1) % tab_size) - 1 - if spaces: - append(" " * spaces, _style) - pos += spaces - else: + if "\t" not in line.plain: + append(line) + else: + cell_position = 0 + parts = line.split("\t", include_separator=True) + for part in parts: + if part.plain.endswith("\t"): + part._text[-1] = part._text[-1][:-1] + " " + cell_position += part.cell_len + tab_remainder = cell_position % tab_size + if tab_remainder: + spaces = tab_size - tab_remainder + part.extend_style(spaces) + cell_position += spaces + else: + cell_position += part.cell_len append(part) + + result = Text("").join(new_text) + self._text = [result.plain] self._length = len(self.plain) self._spans[:] = result._spans @@ -932,7 +978,7 @@ self._text.append(sanitized_text) offset = len(self) text_length = len(sanitized_text) - if style is not None: + if style: self._spans.append(Span(offset, offset + text_length, style)) self._length += text_length elif isinstance(text, Text): @@ -942,7 +988,7 @@ "style must not be set when appending Text instance" ) text_length = self._length - if text.style is not None: + if text.style: self._spans.append( _Span(text_length, text_length + len(text), text.style) ) @@ -963,7 +1009,7 @@ """ _Span = Span text_length = self._length - if text.style is not None: + if text.style: self._spans.append(_Span(text_length, text_length + len(text), text.style)) self._text.append(text.plain) self._spans.extend( @@ -990,7 +1036,7 @@ offset = len(self) for content, style in tokens: append_text(content) - if style is not None: + if style: append_span(_Span(offset, offset + len(content), style)) offset += len(content) self._length = offset @@ -1088,7 +1134,6 @@ _Span = Span for span_start, span_end, style in self._spans: - lower_bound = 0 upper_bound = line_count start_line_no = (lower_bound + upper_bound) // 2