Skip to content

Commit

Permalink
[docs] Fix typos and other small stuff (#3094)
Browse files Browse the repository at this point in the history
* [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 <[email protected]>
  • Loading branch information
plotski and Anonymous authored Nov 7, 2023
1 parent e76f3c3 commit 7a168a2
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions docs/source/progress.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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<Columns>`.

Expand Down Expand Up @@ -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 <https://github.com/willmcgugan/rich/blob/master/examples/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 <https://github.com/willmcgugan/rich/blob/master/examples/cp_progress.py>`_ for a minimal clone of the ``cp`` command which shows a progress bar as the file is copied.


Multiple Progress
Expand Down
6 changes: 3 additions & 3 deletions docs/source/tables.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions docs/source/text.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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*.
Expand Down
2 changes: 1 addition & 1 deletion rich/pretty.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 7a168a2

Please sign in to comment.