jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/779492 )
Change subject: [IMPR] Add a -showonly option to only show claims of an ItemPage
......................................................................
[IMPR] Add a -showonly option to only show claims of an ItemPage
Change-Id: I6faee5bfb7d7f9fa420610ffa1a008b1ec2e25c3
---
M scripts/dataextend.py
1 file changed, 33 insertions(+), 25 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/dataextend.py b/scripts/dataextend.py
index a1279b5..88c62d7 100644
--- a/scripts/dataextend.py
+++ b/scripts/dataextend.py
@@ -15,10 +15,13 @@
identifiers). With a '*' after it, the identifier itself is skipped, but
those coming after it (not those coming before it) are included.
-There is currently one argument defined:
+The following parameters are supported:
--always If this is supplied, the bot will not ask for permission after
- each external link has been handled.
+-always If this is supplied, the bot will not ask for permission
+ after each external link has been handled.
+
+-showonly Only show claims for a given ItemPage. Don't try to add any
+ properties
The bot will load the corresponding pages for these identifiers, and try
to the meaning of that string for the specified type of thing (for
@@ -69,7 +72,7 @@
import pywikibot
from pywikibot.backports import List
-from pywikibot.bot import input_yn, SingleSiteBot
+from pywikibot.bot import input_yn, SingleSiteBot, suggest_help
from pywikibot.data import sparql
from pywikibot.exceptions import (
APIError,
@@ -81,7 +84,10 @@
class DataExtendBot(SingleSiteBot):
- update_options = {'restrict': ''}
+ update_options = {
+ 'restrict': '',
+ 'showonly': False,
+ }
"""The Bot."""
@@ -443,6 +449,7 @@
return result
def showclaims(self, claims):
+ pywikibot.output('Current information:')
for prop in claims:
for claim in claims[prop]:
if claim.type == 'wikibase-item':
@@ -718,10 +725,13 @@
def treat(self, item) -> None:
"""Process the ItemPage."""
- longtexts = []
item.get()
- pywikibot.output('Current information:')
claims = item.claims
+ self.showclaims(claims)
+ if self.opt.showonly:
+ return
+
+ longtexts = []
descriptions = item.descriptions
labels = item.labels
aliases = item.aliases
@@ -730,7 +740,6 @@
prop: claims[prop]
for prop in claims
}
- self.showclaims(claims)
dorestrict = True
continueafterrestrict = False
if self.opt.restrict and self.opt.restrict.endswith('+'):
@@ -15423,32 +15432,31 @@
"""
item = None
options = {}
- unknownarguments = []
+ unknown_parameters = []
local_args = pywikibot.handle_args(args)
for arg in local_args:
if arg.startswith('Q'):
item = arg
elif arg.startswith('P') or arg in ('Data', 'Wiki'):
options['restrict'] = arg
- elif arg == '-always':
- options['always'] = True
+ elif arg in ('-always', '-showonly'):
+ options[arg[1:]] = True
else:
- unknownarguments.append(arg)
+ unknown_parameters.append(arg)
- if unknownarguments:
- pywikibot.output('Unknown argument(s) found: %s'
- % (', '.join(unknownarguments)))
- elif item is None:
- pywikibot.output('No item page specified')
+ if suggest_help(unknown_parameters=unknown_parameters,
+ additional_text='No item page specified'
+ if item is None else ''):
+ return
+
+ repo = pywikibot.Site().data_repository()
+ try:
+ item = pywikibot.ItemPage(repo, item)
+ except InvalidTitleError:
+ pywikibot.exception()
else:
- repo = pywikibot.Site().data_repository()
- try:
- item = pywikibot.ItemPage(repo, item)
- except InvalidTitleError:
- pywikibot.exception()
- else:
- bot = DataExtendBot(site=repo, generator=[item], **options)
- bot.run()
+ bot = DataExtendBot(site=repo, generator=[item], **options)
+ bot.run()
if __name__ == '__main__':
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/779492
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I6faee5bfb7d7f9fa420610ffa1a008b1ec2e25c3
Gerrit-Change-Number: 779492
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Andre Engels <andreengels(a)gmail.com>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki(a)aol.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/781565 )
Change subject: [7.1.1] Fix regression of XmlDumpPageGenerator
......................................................................
[7.1.1] Fix regression of XmlDumpPageGenerator
Again use XmlDumpReplacePageGenerator instead of pg.XMLDumpPageGenerator
to allow preload filtering. This makes processing speed around 10,000
times faster.
This backports 3110a0a to stable.
Bug: T306134
Change-Id: I1107bfc5a29c9bac461274ec64d1920184e4fd05
---
M pywikibot/__metadata__.py
M scripts/replace.py
2 files changed, 4 insertions(+), 7 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/__metadata__.py b/pywikibot/__metadata__.py
index a8e7954..70cce75 100644
--- a/pywikibot/__metadata__.py
+++ b/pywikibot/__metadata__.py
@@ -11,7 +11,7 @@
__name__ = 'pywikibot'
-__version__ = '7.1.0'
+__version__ = '7.1.1'
__description__ = 'Python MediaWiki Bot Framework'
__maintainer__ = 'The Pywikibot team'
__maintainer_email__ = 'pywikibot(a)lists.wikimedia.org'
diff --git a/scripts/replace.py b/scripts/replace.py
index 2410c19..104cbf5 100755
--- a/scripts/replace.py
+++ b/scripts/replace.py
@@ -153,7 +153,7 @@
from pywikibot.backports import Dict, Generator, List, Pattern, Tuple
from pywikibot.bot import ExistingPageBot, SingleSiteBot
from pywikibot.exceptions import InvalidPageError, NoPageError
-from pywikibot.tools import chars, deprecated
+from pywikibot.tools import chars
# This is required for the text that is shown when you run this script
@@ -382,7 +382,6 @@
return _get_text_exceptions(self.fix_set.exceptions or {})
-@deprecated('pagegenerators.XMLDumpPageGenerator', since='7.1.0')
class XmlDumpReplacePageGenerator:
"""
@@ -390,8 +389,6 @@
These pages will be retrieved from a local XML dump file.
- .. deprecated:: 7.1
-
:param xmlFilename: The dump's path, either absolute or relative
:param xmlStart: Skip all articles in the dump before this one
:param replacements: A list of 2-tuples of original text (as a
@@ -1079,8 +1076,8 @@
precompile_exceptions(exceptions, regex, flags)
if xmlFilename:
- gen = pagegenerators.XmlDumpPageGenerator(
- xmlFilename, xmlStart, namespaces=genFactory.namespaces, site=site)
+ gen = XmlDumpReplacePageGenerator(xmlFilename, xmlStart,
+ replacements, exceptions, site)
elif sql_query is not None:
# Only -excepttext option is considered by the query. Other
# exceptions are taken into account by the ReplaceRobot
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/781565
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: stable
Gerrit-Change-Id: I1107bfc5a29c9bac461274ec64d1920184e4fd05
Gerrit-Change-Number: 781565
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki(a)aol.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
Xqt has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/781535 )
Change subject: [doc] Update ROADMAP.rst and CHANGELOG.md
......................................................................
[doc] Update ROADMAP.rst and CHANGELOG.md
Change-Id: I40311bb6c99c8d3acc00fe5cf8f2fe49ad3b09ee
---
M HISTORY.rst
M ROADMAP.rst
M scripts/CHANGELOG.md
3 files changed, 15 insertions(+), 2 deletions(-)
Approvals:
Xqt: Verified; Looks good to me, approved
diff --git a/HISTORY.rst b/HISTORY.rst
index 193a690..528515c 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -9,7 +9,7 @@
* Add support for guwwiki and shnwikivoyage (:phab:`T303762`, :phab:`T302799`)
* TextExtracts support was aded (:phab:`T72682`)
* Unused `get_redirect` parameter of Page.getOldVersion() has been dropped
-* Provide BasePage.get_parsed_page() a public method
+* Provide BasePage.get_parsed_page() as a public method
* Provide BuiltinNamespace.canonical_namespaces() with BuiltinNamespace IntEnum
* BuiltinNamespace got a canonical() method
* Enable nested templates with MultiTemplateMatchBuilder (:phab:`T110529`)
diff --git a/ROADMAP.rst b/ROADMAP.rst
index 135031e..792727e 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -1,7 +1,14 @@
Current release 7.2.0
^^^^^^^^^^^^^^^^^^^^^
-* Add Lexeme support for Lexicographical data (:phab:`T189321`)
+* Fix Page.revisions() with starttime (:phab:`T109181`)
+* Use stream_output for messages inside input_list_choice method (:phab:`T305940`)
+* Expand simulate query result (:phab:`T305918`)
+* Do not delete text when updating a Revision (:phab:`T304786`)
+* Re-enable scripts package version check with pwb wrapper (:phab:`T305799`)
+* Provide textlib.ignore_case() as a public method
+* Don't try to upcast timestamp from global userinfo if global account does not exists (:phab:`T305351`)
+* Add Lexeme support for Lexicographical data (:phab:`T189321`, :phab:`T305297`)
* enable all parameters of `APISite.imageusage()` with `FilePage.usingPages()`
* Don't raise `NoPageError` with `file_is_shared` (:phab:`T305182`)
* Fix URL of GoogleOCR
diff --git a/scripts/CHANGELOG.md b/scripts/CHANGELOG.md
index d94ab3f..a9f214d 100644
--- a/scripts/CHANGELOG.md
+++ b/scripts/CHANGELOG.md
@@ -3,9 +3,15 @@
## 7.2.0
*In development*
+### general
+* Archived scripts were removed
+
### checkimages
* Use `itertools.zip_longest` to find the most important image
+### dataextend
+* This new script was added. It is able to add properties, identifiers and sources to WikiBase items
+
### image
* Fix image regex (:phab:`T305226`, :phab:`T305227`)
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/781535
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I40311bb6c99c8d3acc00fe5cf8f2fe49ad3b09ee
Gerrit-Change-Number: 781535
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/780890 )
Change subject: Revert "[IMPR] use pg.XMLDumpPageGenerator in replace.py"
......................................................................
Revert "[IMPR] use pg.XMLDumpPageGenerator in replace.py"
This reverts commit e28a0df38deb727a61984fe92b2c34e886b9d08f.
due to:
Bug: T306134
Change-Id: I62c2bbdbdc286ce78f823fd3571e11a6cdd33a49
---
M scripts/replace.py
1 file changed, 3 insertions(+), 6 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/replace.py b/scripts/replace.py
index 7b748d3..104cbf5 100755
--- a/scripts/replace.py
+++ b/scripts/replace.py
@@ -153,7 +153,7 @@
from pywikibot.backports import Dict, Generator, List, Pattern, Tuple
from pywikibot.bot import ExistingPageBot, SingleSiteBot
from pywikibot.exceptions import InvalidPageError, NoPageError
-from pywikibot.tools import chars, deprecated
+from pywikibot.tools import chars
# This is required for the text that is shown when you run this script
@@ -382,7 +382,6 @@
return _get_text_exceptions(self.fix_set.exceptions or {})
-@deprecated('pagegenerators.XMLDumpPageGenerator', since='7.1.0')
class XmlDumpReplacePageGenerator:
"""
@@ -390,8 +389,6 @@
These pages will be retrieved from a local XML dump file.
- .. deprecated:: 7.1
-
:param xmlFilename: The dump's path, either absolute or relative
:param xmlStart: Skip all articles in the dump before this one
:param replacements: A list of 2-tuples of original text (as a
@@ -1079,8 +1076,8 @@
precompile_exceptions(exceptions, regex, flags)
if xmlFilename:
- gen = pagegenerators.XMLDumpPageGenerator(
- xmlFilename, xmlStart, namespaces=genFactory.namespaces, site=site)
+ gen = XmlDumpReplacePageGenerator(xmlFilename, xmlStart,
+ replacements, exceptions, site)
elif sql_query is not None:
# Only -excepttext option is considered by the query. Other
# exceptions are taken into account by the ReplaceRobot
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/780890
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I62c2bbdbdc286ce78f823fd3571e11a6cdd33a49
Gerrit-Change-Number: 780890
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki(a)aol.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged