docs update

This commit is contained in:
Will McGugan 2022-04-21 09:24:15 +01:00
parent 8a9e9a2022
commit b6a83c2dce

View file

@ -26,16 +26,6 @@ For basic usage call the :func:`~rich.progress.track` function, which accepts a
for n in track(range(n), description="Processing..."):
do_work(n)
To get a progress bar while reading from a file, you may consider using the :func:`~rich.progress.read` function, which accepts a path, or a *file-like* object. It will return a *file-like* object in *binary mode* that will update the progress information as it's being read from. Here's an example, tracking the progresses made by :func:`json.load` to load a file::
import json
from rich.progress import read
with read("data.json", description="Loading data...") as f:
data = json.load(f)
Advanced usage
--------------
@ -212,9 +202,9 @@ If the :class:`~rich.progress.Progress` class doesn't offer exactly what you nee
Reading from a file
~~~~~~~~~~~~~~~~~~~
Rich provides an easy way to generate a progress bar for reading a file. If you call :func:`~rich.progress.open` it will return a context manager which displays a progress bar while you read. This is particularly useful when you can't easily modify the code that does the reading.
Rich provides an easy way to generate a progress bar while reading a file. If you call :func:`~rich.progress.open` it will return a context manager which displays a progress bar while you read. This is particularly useful when you can't easily modify the code that does the reading.
The following example shows how we might show progress for reading a JSON file::
The following example demonstrates how we might show progress when reading a JSON file::
import json
import rich.progress