Ayushjain19 has uploaded a new change for review.
https://gerrit.wikimedia.org/r/313793
Change subject: Replaced the word 'async' with 'asynchronous'
......................................................................
Replaced the word 'async' with 'asynchronous'
'async' will become proper keyword in Python 3.7
Hence, replaced it with another word 'asynchronous' wherever
'async' was used as a parameter.
Bug: T106230
Change-Id: I5f55b56f55932fb34db87b48bd1340082bd4ac49
---
M pywikibot/bot.py
M pywikibot/page.py
M scripts/archive/featured.py
M scripts/cosmetic_changes.py
4 files changed, 22 insertions(+), 22 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core
refs/changes/93/313793/1
diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index e48a797..d8b006b 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -1269,7 +1269,7 @@
Keyword args used:
- * 'async' - passed to page.save
+ * 'asynchronous' - passed to page.save
* 'summary' - passed to page.save
* 'show_diff' - show changes between oldtext and newtext (enabled)
* 'ignore_save_related_errors' - report and ignore (disabled)
@@ -1316,8 +1316,8 @@
if not self.user_confirm('Do you want to accept these changes?'):
return
- if 'async' not in kwargs and self.getOption('always'):
- kwargs['async'] = True
+ if 'asynchronous' not in kwargs and self.getOption('always'):
+ kwargs['asynchronous'] = True
ignore_save_related_errors = kwargs.pop('ignore_save_related_errors',
False)
diff --git a/pywikibot/page.py b/pywikibot/page.py
index 79aefc3..d907e30 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -1144,7 +1144,7 @@
@deprecated_args(comment='summary', sysop=None)
def save(self, summary=None, watch=None, minor=True, botflag=None,
- force=False, async=False, callback=None,
+ force=False, asynchronous=False, callback=None,
apply_cosmetic_changes=None, quiet=False, **kwargs):
"""
Save the current contents of page's text to the wiki.
@@ -1170,7 +1170,7 @@
True if user has bot status, False if not)
@param force: if True, ignore botMayEdit() setting
@type force: bool
- @param async: if True, launch a separate thread to save
+ @param asynchronous: if True, launch a separate thread to save
asynchronously
@param callback: a callable object that will be called after the
page put operation. This object must take two arguments: (1) a
@@ -1183,7 +1183,7 @@
@type apply_cosmetic_changes: bool or None
@param quiet: enable/disable successful save operation message;
defaults to False.
- In async mode, if True, it is up to the calling bot to manage the
+ In asynchronous mode, if True, it is up to the calling bot to
manage the
ouput e.g. via callback.
@type quiet: bool
"""
@@ -1196,19 +1196,19 @@
if not force and not self.botMayEdit():
raise pywikibot.OtherPageSaveError(
self, "Editing restricted by {{bots}} template")
- if async:
+ if asynchronous:
pywikibot.async_request(self._save, summary=summary, watch=watch,
minor=minor, botflag=botflag,
- async=async, callback=callback,
+ asynchronous=asynchronous,
callback=callback,
cc=apply_cosmetic_changes,
quiet=quiet, **kwargs)
else:
self._save(summary=summary, watch=watch, minor=minor,
- botflag=botflag, async=async, callback=callback,
+ botflag=botflag, asynchronous=asynchronous,
callback=callback,
cc=apply_cosmetic_changes, quiet=quiet, **kwargs)
def _save(self, summary=None, watch=None, minor=True, botflag=None,
- async=False, callback=None, cc=None, quiet=False, **kwargs):
+ asynchronous=False, callback=None, cc=None, quiet=False,
**kwargs):
"""Helper function for save()."""
err = None
link = self.title(asLink=True)
@@ -1228,7 +1228,7 @@
err = edit_err # edit_err will be deleted in the end of the scope
pywikibot.log(u"Error saving page %s (%s)\n" % (link, err),
exc_info=True)
- if not callback and not async:
+ if not callback and not asynchronous:
if isinstance(err, pywikibot.PageSaveRelatedError):
raise err
raise pywikibot.OtherPageSaveError(self, err)
@@ -1273,7 +1273,7 @@
@deprecated_args(comment='summary')
def put(self, newtext, summary=u'', watchArticle=None, minorEdit=True,
- botflag=None, force=False, async=False, callback=None, **kwargs):
+ botflag=None, force=False, asynchronous=False, callback=None,
**kwargs):
"""
Save the page with the contents of the first argument as the text.
@@ -1287,7 +1287,7 @@
"""
self.text = newtext
self.save(summary=summary, watch=watchArticle, minor=minorEdit,
- botflag=botflag, force=force, async=async, callback=callback,
+ botflag=botflag, force=force, asynchronous=asynchronous,
callback=callback,
**kwargs)
@deprecated_args(comment='summary')
@@ -1303,7 +1303,7 @@
backwards-compatibility.
"""
self.put(newtext, summary=summary, watchArticle=watchArticle,
- minorEdit=minorEdit, botflag=botflag, force=force, async=True,
+ minorEdit=minorEdit, botflag=botflag, force=force,
asynchronous=True,
callback=callback, **kwargs)
def watch(self, unwatch=False):
@@ -1342,7 +1342,7 @@
See save() method docs for all parameters.
The following parameters will be overridden by this method:
- - summary, watch, minor, force, async
+ - summary, watch, minor, force, asynchronous
Parameter botflag is False by default.
@@ -1353,7 +1353,7 @@
# ensure always get the page text and not to change it.
del self.text
self.save(summary='Pywikibot touch edit', watch='nochange',
- minor=False, botflag=botflag, force=True, async=False,
+ minor=False, botflag=botflag, force=True,
asynchronous=False,
callback=callback, apply_cosmetic_changes=False,
**kwargs)
else:
diff --git a/scripts/archive/featured.py b/scripts/archive/featured.py
index a6a661f..07633b6 100755
--- a/scripts/archive/featured.py
+++ b/scripts/archive/featured.py
@@ -223,7 +223,7 @@
def __init__(self, **kwargs):
"""Only accepts options defined in availableOptions."""
self.availableOptions.update({
- 'async': False, # True for asynchronously putting a page
+ 'asynchronous': False, # True for asynchronously putting a page
'afterpage': u"!",
'count': False, # featuredcount
'featured': False,
diff --git a/scripts/cosmetic_changes.py b/scripts/cosmetic_changes.py
index c79061d..71e0bc3 100644
--- a/scripts/cosmetic_changes.py
+++ b/scripts/cosmetic_changes.py
@@ -12,7 +12,7 @@
-always Don't prompt you for each replacement. Warning (see below)
has not to be confirmed. ATTENTION: Use this with care!
--async Put page on queue to be saved to wiki asynchronously.
+-asynchronous Put page on queue to be saved to wiki asynchronously.
-summary:XYZ Set the summary message text for the edit to XYZ, bypassing
the predefined message texts with original and replacements
@@ -61,7 +61,7 @@
def __init__(self, generator, **kwargs):
"""Constructor."""
self.availableOptions.update({
- 'async': False,
+ 'asynchronous': False,
'summary': u'Robot: Cosmetic changes',
'ignore': cosmetic_changes.CANCEL_ALL,
})
@@ -78,7 +78,7 @@
if changedText is not False:
self.put_current(new_text=changedText,
summary=self.getOption('summary'),
- async=self.getOption('async'))
+ asynchronous=self.getOption('asynchronous'))
except pywikibot.LockedPage:
pywikibot.output("Page %s is locked?!"
% self.current_page.title(asLink=True))
@@ -107,8 +107,8 @@
options['summary'] = arg[len('-summary:'):]
elif arg == '-always':
options['always'] = True
- elif arg == '-async':
- options['async'] = True
+ elif arg == '-asynchronous':
+ options['asynchronous'] = True
elif arg.startswith('-ignore:'):
ignore_mode = arg[len('-ignore:'):].lower()
if ignore_mode == 'method':
--
To view, visit https://gerrit.wikimedia.org/r/313793
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5f55b56f55932fb34db87b48bd1340082bd4ac49
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Ayushjain19 <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits