From 7a168a27c5097805b3bafa495f35e3955004ff4a Mon Sep 17 00:00:00 2001 From: plotski <49732644+plotski@users.noreply.github.com> Date: Tue, 7 Nov 2023 17:37:25 +0000 Subject: [PATCH] [docs] Fix typos and other small stuff (#3094) * [docs.text] Fix typo ("follow" -> "following") * [docs.text] Fix ANSI/assemble examples * [rich.pretty] Make `python -m rich.pretty` from the examples work * [docs.progress] Fix typo ("updated" -> "setting") * [docs.progress] Fix reference to cp_progress.py * [docs.table] Fix typo ("show above" -> "shown above") * [docs.table] Add reference to "Padding" for "padding" argument --------- Co-authored-by: Anonymous --- docs/source/progress.rst | 4 ++-- docs/source/tables.rst | 6 +++--- docs/source/text.rst | 6 +++--- rich/pretty.py | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/source/progress.rst b/docs/source/progress.rst index 23693843b..272687d93 100644 --- a/docs/source/progress.rst +++ b/docs/source/progress.rst @@ -58,7 +58,7 @@ The ``total`` value associated with a task is the number of steps that must be c Updating tasks ~~~~~~~~~~~~~~ -When you call :meth:`~rich.progress.Progress.add_task` you get back a `Task ID`. Use this ID to call :meth:`~rich.progress.Progress.update` whenever you have completed some work, or any information has changed. Typically you will need to update ``completed`` every time you have completed a step. You can do this by updated ``completed`` directly or by setting ``advance`` which will add to the current ``completed`` value. +When you call :meth:`~rich.progress.Progress.add_task` you get back a `Task ID`. Use this ID to call :meth:`~rich.progress.Progress.update` whenever you have completed some work, or any information has changed. Typically you will need to update ``completed`` every time you have completed a step. You can do this by setting ``completed`` directly or by setting ``advance`` which will add to the current ``completed`` value. The :meth:`~rich.progress.Progress.update` method collects keyword arguments which are also associated with the task. Use this to supply any additional information you would like to render in the progress display. The additional arguments are stored in ``task.fields`` and may be referenced in :ref:`Column classes`. @@ -234,7 +234,7 @@ Here's an example that reads a url from the internet:: If you expect to be reading from multiple files, you can use :meth:`~rich.progress.Progress.open` or :meth:`~rich.progress.Progress.wrap_file` to add a file progress to an existing Progress instance. -See `cp_progress.py ` for a minimal clone of the ``cp`` command which shows a progress bar as the file is copied. +See `cp_progress.py `_ for a minimal clone of the ``cp`` command which shows a progress bar as the file is copied. Multiple Progress diff --git a/docs/source/tables.rst b/docs/source/tables.rst index fdc6ec043..f573dbc62 100644 --- a/docs/source/tables.rst +++ b/docs/source/tables.rst @@ -50,13 +50,13 @@ Table Options There are a number of keyword arguments on the Table constructor you can use to define how a table should look. -- ``title`` Sets the title of the table (text show above the table). -- ``caption`` Sets the table caption (text show below the table). +- ``title`` Sets the title of the table (text shown above the table). +- ``caption`` Sets the table caption (text shown below the table). - ``width`` Sets the desired width of the table (disables automatic width calculation). - ``min_width`` Sets a minimum width for the table. - ``box`` Sets one of the :ref:`appendix_box` styles for the table grid, or ``None`` for no grid. - ``safe_box`` Set to ``True`` to force the table to generate ASCII characters rather than unicode. -- ``padding`` An integer, or tuple of 1, 2, or 4 values to set the padding on cells. +- ``padding`` An integer, or tuple of 1, 2, or 4 values to set the padding on cells (see :ref:`Padding`). - ``collapse_padding`` If True the padding of neighboring cells will be merged. - ``pad_edge`` Set to False to remove padding around the edge of the table. - ``expand`` Set to True to expand the table to the full available size. diff --git a/docs/source/text.rst b/docs/source/text.rst index fd6851fb4..c5a1add82 100644 --- a/docs/source/text.rst +++ b/docs/source/text.rst @@ -28,12 +28,12 @@ Alternatively, you can construct styled text by calling :meth:`~rich.text.Text.a If you would like to use text that is already formatted with ANSI codes, call :meth:`~rich.text.Text.from_ansi` to convert it to a ``Text`` object:: - text = Text.from_ansi("\033[1mHello, World!\033[0m") + text = Text.from_ansi("\033[1;35mHello\033[0m, World!") console.print(text.spans) -Since building Text instances from parts is a common requirement, Rich offers :meth:`~rich.text.Text.assemble` which will combine strings or pairs of string and Style, and return a Text instance. The follow example is equivalent to the code above:: +Since building Text instances from parts is a common requirement, Rich offers :meth:`~rich.text.Text.assemble` which will combine strings or pairs of string and Style, and return a Text instance. The following example is equivalent to the ANSI example above:: - text = Text.assemble(("Hello", "bold magenta"), " World!") + text = Text.assemble(("Hello", "bold magenta"), ", World!") console.print(text) You can apply a style to given words in the text with :meth:`~rich.text.Text.highlight_words` or for ultimate control call :meth:`~rich.text.Text.highlight_regex` to highlight text matching a *regular expression*. diff --git a/rich/pretty.py b/rich/pretty.py index 498907f4c..5c48cfd9f 100644 --- a/rich/pretty.py +++ b/rich/pretty.py @@ -986,7 +986,7 @@ class StockKeepingUnit(NamedTuple): from rich import print - # print(Pretty(data, indent_guides=True, max_string=20)) + print(Pretty(data, indent_guides=True, max_string=20)) class Thing: def __repr__(self) -> str: