jenkins-bot submitted this change.

View Change

Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
[doctest] Solve doctest for OptionHandler

Change-Id: I20f1730c957dec7b939a22560c099ba435fbcfee
---
M pywikibot/bot.py
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index 7a966ab..a49ef20 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -1025,10 +1025,11 @@
"""Class to get and set options.

How to use options of OptionHandler and its BaseBot subclasses:
- First define an available_options class attribute to define all
- available options:
+ First define an available_options class attribute for your own
+ option handler to define all available options:

- available_options = {'foo': 'bar', 'bar': 42, 'baz': False}
+ >>> default_options = {'foo': 'bar', 'bar': 42, 'baz': False}
+ >>> class MyHandler(OptionHandler): available_options = default_options

Or you may update the predefined setting in the class initializer.
BaseBot predefines a 'always' options and sets it to False:
@@ -1038,7 +1039,7 @@
Now you can instantiate an OptionHandler or BaseBot class passing
options other than default values:

- >>> bot = OptionHandler(baz=True)
+ >>> bot = MyHandler(baz=True)

You can access bot options either as keyword item or attribute:


To view, visit change 667184. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I20f1730c957dec7b939a22560c099ba435fbcfee
Gerrit-Change-Number: 667184
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged