Skip to content

Commit

Permalink
[xdoctest][task 238] reformat example code with google style in `pyt…
Browse files Browse the repository at this point in the history
…hon/paddle/distributed/fleet/launch_utils.py` (#57060)

* [Doctest]fix No.238, test=docs_preview

* fix

* fix
  • Loading branch information
jinyouzhi authored Sep 8, 2023
1 parent e9fac90 commit 8aaceba
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions python/paddle/distributed/fleet/launch_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,11 +370,16 @@ def get_host_name_ip():

def add_arguments(argname, type, default, help, argparser, **kwargs):
"""Add argparse's argument.
Usage:
.. code-block:: python
parser = argparse.ArgumentParser()
add_argument("name", str, "Jonh", "User name.", parser)
args = parser.parse_args()
Examples:
.. code-block:: python
>>> import argparse
>>> from paddle.distributed.fleet.launch_utils import add_arguments
>>> parser = argparse.ArgumentParser()
>>> add_arguments("name", str, "Jonh", "User name.", parser)
>>> args = parser.parse_args()
"""
type = strtobool if type == bool else type
argparser.add_argument(
Expand Down

0 comments on commit 8aaceba

Please sign in to comment.