Skip to content

Commit 3df3bd9

Browse files
authored
Small docs fixes (#849)
1 parent 2d026fc commit 3df3bd9

File tree

1 file changed

+23
-22
lines changed

1 file changed

+23
-22
lines changed

DOCUMENTATION.rst

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ Some notes about this support are:
472472
in :ref:`list-append`), ``Iterable``, ``Sequence``, ``Any``, ``Union``,
473473
``Optional``, ``Type``, ``Enum``, ``PathLike``, ``UUID``, ``timedelta``,
474474
restricted types as explained in sections :ref:`restricted-numbers` and
475-
:ref:`restricted-strings` and paths and URLs as explained in sections
475+
:ref:`restricted-strings` and path and URL types as explained in sections
476476
:ref:`parsing-paths` and :ref:`parsing-urls`.
477477

478478
- ``dict``, ``Mapping``, ``MutableMapping``, ``MappingProxyType``,
@@ -1504,7 +1504,7 @@ The second option that can be configured is the support for `attribute
15041504
docstrings <https://peps.python.org/pep-0257/#what-is-a-docstring>`__ (i.e.
15051505
literal strings in the line after an attribute is defined). By default this
15061506
feature is disabled and enabling it makes the parsing slower even for classes
1507-
that don't have attribute docstrings. To enable, do as follows:
1507+
that don't have attribute docstrings. To enable this, do as follows:
15081508

15091509
.. testcode:: docstrings
15101510

@@ -1926,17 +1926,17 @@ include the ``class_path`` and ``init_args`` entries. To get a config object
19261926
with all nested subclasses instantiated, the :meth:`instantiate_classes
19271927
<.ArgumentParser.instantiate_classes>` method is used.
19281928

1929-
Additional to using a class as type hint in signatures, for low level
1929+
In addition to using a class as type hint in signatures, for low level
19301930
construction of parsers, there are also the methods :meth:`add_class_arguments
19311931
<.SignatureArguments.add_class_arguments>` and :meth:`add_subclass_arguments
19321932
<.SignatureArguments.add_subclass_arguments>`. These methods accept a ``skip``
19331933
argument that can be used to exclude parameters within subclasses. This is done
19341934
by giving its relative destination key, i.e. as ``param.init_args.subparam``. An
1935-
individual argument can also be added having as type a class, i.e.
1935+
individual argument can also be added using a class as type, i.e.
19361936
``parser.add_argument("--module", type=ModuleBase)``.
19371937

19381938
A simple example with a top-level class to instantiate, with a parameter that
1939-
expects an injected class instance, would be having some config file
1939+
expects an injected class instance, would use a config file
19401940
``config.yaml`` as:
19411941

19421942
.. code-block:: yaml
@@ -2029,8 +2029,8 @@ an alternative approach to dependency injection. This is useful to support
20292029
dependency injection of classes that require parameters that are only available
20302030
after injection. For this case, when :meth:`instantiate_classes
20312031
<.ArgumentParser.instantiate_classes>` is run, a partial function is provided,
2032-
which might accept parameters and returns the instance of the class. Two options
2033-
are possible, either using ``Callable`` or ``Protocol``. First to illustrate the
2032+
which might accept parameters and return the instance of the class. Two options
2033+
are possible: using ``Callable`` or ``Protocol``. To illustrate the
20342034
``Callable`` option, take for example the classes:
20352035

20362036
.. testcode:: callable
@@ -2342,12 +2342,12 @@ subclass support enabled. Types specified in ``subclasses_enabled`` take
23422342
precedence over those in ``subclasses_disabled``. If a function name is given to
23432343
``subclasses_enabled``, it must correspond to a function previously registered
23442344
in ``subclasses_disabled``; in this case, the effect is to unregister it. By
2345-
default, the following disable functions are registered: ``is_pure_dataclass``,
2345+
default, the following disabling functions are registered: ``is_pure_dataclass``,
23462346
``is_pydantic_model``, ``is_attrs_class``, and ``is_final_class``.
23472347

23482348
Some examples. Since ``subclasses_enabled`` takes precedence, it is possible to
2349-
keep subclass support disabled for dataclasses, but enable enable it for a
2350-
specific dataclass as follows:
2349+
keep subclass support disabled for dataclasses, but enable it for a specific
2350+
dataclass as follows:
23512351

23522352
.. testsetup:: enable_disable_subclasses
23532353

@@ -2588,7 +2588,7 @@ absolute node references would no longer work in nested subconfigs.
25882588
Environment variables
25892589
=====================
25902590

2591-
The jsonargparse parsers can also get values from environment variables. The
2591+
jsonargparse parsers can also get values from environment variables. The
25922592
parser checks existing environment variables whose name is of the form
25932593
``[PREFIX_][LEV__]*OPT``, that is, all in upper case, first a prefix (set by
25942594
``env_prefix``, or if unset the ``prog`` without extension or none if set to False)
@@ -2639,10 +2639,10 @@ variables.
26392639
Subcommands
26402640
===========
26412641

2642-
A way to define parsers in a modular way is what in argparse is known as
2642+
One way to define parsers modularly is what in argparse is known as
26432643
`subcommands <https://docs.python.org/3/library/argparse.html#subcommands>`__.
26442644
However, to promote modularity, in jsonargparse subcommands work a bit
2645-
different than in argparse. To add subcommands to a parser, the
2645+
different from argparse. To add subcommands to a parser, the
26462646
:meth:`add_subcommands <.ArgumentParser.add_subcommands>` method is used. Then an existing
26472647
parser is added as a subcommand using :func:`.add_subcommand`. In a parsed
26482648
config object the subcommand will be stored in the ``subcommand`` entry (or
@@ -2696,7 +2696,7 @@ variable ``APP_SUBCOMMAND``.
26962696

26972697
It is possible to have multiple levels of subcommands. With multiple levels
26982698
there is one basic requirement: the subcommands must be added in the order of
2699-
the levels. This is, first call :meth:`add_subcommands
2699+
the levels. That is, first call :meth:`add_subcommands
27002700
<.ArgumentParser.add_subcommands>` and :func:`add_subcommand` for the first
27012701
level. Only after do the same for the second level, and so on.
27022702

@@ -2949,12 +2949,13 @@ giving as guidance which of the subclasses accepts it. An example would be:
29492949
argcomplete
29502950
-----------
29512951

2952-
For ``argcompete`` to work, there is no need to implement completer functions or
2953-
to call :func:`argcomplete.autocomplete` since this is done automatically by
2954-
:meth:`parse_args <.ArgumentParser.parse_args>`. The only requirement to enable
2955-
tab completion is to install argcomplete either directly or by installing
2956-
jsonargparse with the ``argcomplete`` extra as explained in section
2957-
:ref:`installation`.
2952+
For ``argcomplete`` to work, there is no need to implement completer functions
2953+
or to call `argcomplete.autocomplete
2954+
<https://kislyuk.github.io/argcomplete/#argcomplete.autocomplete>`__ since this
2955+
is done automatically by :meth:`parse_args <.ArgumentParser.parse_args>`. The
2956+
only requirement to enable tab completion is to install argcomplete either
2957+
directly or by installing jsonargparse with the ``argcomplete`` extra as
2958+
explained in section :ref:`installation`.
29582959

29592960
The tab completion can be enabled `globally
29602961
<https://kislyuk.github.io/argcomplete/#global-completion>`__ for all
@@ -2989,9 +2990,9 @@ raised and the full stack trace is printed. This is done by setting the
29892990

29902991
The parsers from jsonargparse log some basic events, though by default this is
29912992
disabled. To enable, the ``logger`` argument should be set when creating an
2992-
:class:`.ArgumentParser` object. The intended use is to give as value an already
2993+
:class:`.ArgumentParser` object. The intended use is to provide an already
29932994
existing logger object which is used for the whole application. For convenience,
2994-
to enable a default logger the ``logger`` argument can also receive ``True`` or
2995+
to enable a default logger the ``logger`` argument can also be ``True`` or
29952996
a string which sets the name of the logger or a dictionary that can include the
29962997
name and the level, e.g. ``{"name": "myapp", "level": "ERROR"}``. If
29972998
`reconplogger <https://pypi.org/project/reconplogger/>`__ is installed, setting

0 commit comments

Comments
 (0)