mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-16 00:59:52 +00:00
Add documentation for receiving parsed options
This commit is contained in:
parent
9ada68118d
commit
36bb148ad5
1 changed files with 19 additions and 0 deletions
|
|
@ -137,6 +137,25 @@ For information about other parameters to
|
||||||
:meth:`~flake8.options.manager.OptionManager.add_option` refer to the
|
:meth:`~flake8.options.manager.OptionManager.add_option` refer to the
|
||||||
documentation of :mod:`optparse`.
|
documentation of :mod:`optparse`.
|
||||||
|
|
||||||
|
|
||||||
|
Accessing Parsed Options
|
||||||
|
========================
|
||||||
|
|
||||||
|
When a plugin has a callable ``provide_options`` attribute, Flake8 will call
|
||||||
|
it and attempt to provide the |OptionManager| instance, the parsed options
|
||||||
|
which will be an instance of :class:`optparse.Values`, and the extra arguments
|
||||||
|
that were not parsed by the |OptionManager|. If that fails, we will just pass
|
||||||
|
the :class:`optparse.Values`. In other words, your ``provide_options``
|
||||||
|
callable will have one of the following signatures:
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
def provide_options(option_manager, options, args):
|
||||||
|
pass
|
||||||
|
# or
|
||||||
|
def provide_options(options):
|
||||||
|
pass
|
||||||
|
|
||||||
.. substitutions
|
.. substitutions
|
||||||
.. |OptionManager| replace:: :class:`~flake8.options.manager.OptionManager`
|
.. |OptionManager| replace:: :class:`~flake8.options.manager.OptionManager`
|
||||||
.. |Option| replace:: :class:`~flake8.options.manager.Option`
|
.. |Option| replace:: :class:`~flake8.options.manager.Option`
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue