Skip to content

Commit

Permalink
Update docstring of add() and download()
Browse files Browse the repository at this point in the history
It still referred to the old usage of the progress_handler parameter.
  • Loading branch information
goodmami committed Feb 3, 2021
1 parent 2d3e5ec commit 195b5f8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 28 deletions.
16 changes: 3 additions & 13 deletions wn/_add.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,10 @@ def add(
>>> wn.add('english-wordnet-2020.xml')
Added ewn:2020 (English WordNet)
The *progress_handler* parameter takes a callable that is called
after every block of rows is inserted. The handler function
should have the following signature:
The *progress_handler* parameter takes a subclass of
:class:`wn.util.ProgressHandler`. An instance of the class will be
created, used, and closed by this function.
.. code-block:: python
def progress_handler(n: int, **kwargs) -> str:
...
The *n* parameter is the number of rows last inserted into the
database. A ``status`` key on the *kwargs* indicates the current
status of adding the lexicon (``Inspecting``, ``ILI``, ``Synset``,
etc.). After inspecting the file, a ``max`` keyword on *kwargs*
indicates the total number of rows to insert.
"""
if progress_handler is None:
progress_handler = ProgressHandler
Expand Down
18 changes: 3 additions & 15 deletions wn/_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,9 @@ def download(
>>> wn.download('ewn:2020')
Added ewn:2020 (English WordNet)
The *progress_handler* parameter takes a callable that is called
after every chunk of bytes is received. The handler function
should have the following signature:
.. code-block:: python
def progress_handler(n: int, **kwargs) -> str:
...
The *n* parameter is the number of bytes received in a chunk. When
a request is sent, the handler function is called with ``max`` key
in *kwargs* mapped to the total number of bytes (taken from the
response's ``Content-Length`` header). A ``status`` key may also
indicate the current status (``Requesting``, ``Receiving``,
``Completed``).
The *progress_handler* parameter takes a subclass of
:class:`wn.util.ProgressHandler`. An instance of the class will be
created, used, and closed by this function.
"""
if is_url(project_or_url):
Expand Down

0 comments on commit 195b5f8

Please sign in to comment.