jenkins-bot has submitted this change and it was merged.
Change subject: [DOC] Update help doc for compat2core script
......................................................................
[DOC] Update help doc for compat2core script
maintenance folder is used by the pwb wrapper since I02ed7a5e533e
thus the folder name may be omitted.
Change-Id: I8dde07e75c9e93d2a1bf2d28e1befe0d06d15f0d
---
M scripts/maintenance/compat2core.py
1 file changed, 2 insertions(+), 2 deletions(-)
Approvals:
Mpaa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/maintenance/compat2core.py b/scripts/maintenance/compat2core.py
index de59ee0..f14d343 100755
--- a/scripts/maintenance/compat2core.py
+++ b/scripts/maintenance/compat2core.py
@@ -18,11 +18,11 @@
to convert a script and show warnings about deprecated methods:
- python pwb.py maintenance/compat2core <scriptname>
+ python pwb.py compat2core <scriptname>
to show warnings about deprecated methods:
- python pwb.py maintenance/compat2core <scriptname> -warnonly
+ python pwb.py compat2core <scriptname> -warnonly
"""
#
# (C) xqt, 2014-2015
--
To view, visit https://gerrit.wikimedia.org/r/321094
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I8dde07e75c9e93d2a1bf2d28e1befe0d06d15f0d
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: [IMPR] realign -help string to fit the option in the help context
......................................................................
[IMPR] realign -help string to fit the option in the help context
Change-Id: I0f5de7cd2678b6a1afb6b56b98e1798dab42c836
---
M scripts/listpages.py
M scripts/makecat.py
2 files changed, 55 insertions(+), 49 deletions(-)
Approvals:
Lokal Profil: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/listpages.py b/scripts/listpages.py
index 59622b1..60a39a4 100755
--- a/scripts/listpages.py
+++ b/scripts/listpages.py
@@ -8,60 +8,62 @@
These parameters are supported to specify which pages titles to print:
--format Defines the output format.
+-format Defines the output format.
- Can be a custom string according to python string.format() notation or
- can be selected by a number from following list (1 is default format):
- 1 - u'{num:4d} {page.title}'
- --> 10 PageTitle
+ Can be a custom string according to python string.format() notation
+ or can be selected by a number from following list
+ (1 is default format):
+ 1 - u'{num:4d} {page.title}'
+ --> 10 PageTitle
- 2 - u'{num:4d} {[[page.title]]}'
- --> 10 [[PageTitle]]
+ 2 - u'{num:4d} {[[page.title]]}'
+ --> 10 [[PageTitle]]
- 3 - u'{page.title}'
- --> PageTitle
+ 3 - u'{page.title}'
+ --> PageTitle
- 4 - u'{[[page.title]]}'
- --> [[PageTitle]]
+ 4 - u'{[[page.title]]}'
+ --> [[PageTitle]]
- 5 - u'{num:4d} \03{{lightred}}{page.loc_title:<40}\03{{default}}'
- --> 10 PageTitle (colorised in lightred)
+ 5 - u'{num:4d} \03{{lightred}}{page.loc_title:<40}\03{{default}}'
+ --> 10 PageTitle (colorised in lightred)
- 6 - u'{num:4d} {page.loc_title:<40} {page.can_title:<40}'
- --> 10 localised_Namespace:PageTitle canonical_Namespace:PageTitle
+ 6 - u'{num:4d} {page.loc_title:<40} {page.can_title:<40}'
+ --> 10 localised_Namespace:PageTitle
+ canonical_Namespace:PageTitle
- 7 - u'{num:4d} {page.loc_title:<40} {page.trs_title:<40}'
- --> 10 localised_Namespace:PageTitle outputlang_Namespace:PageTitle
- (*) requires "outputlang:lang" set.
+ 7 - u'{num:4d} {page.loc_title:<40} {page.trs_title:<40}'
+ --> 10 localised_Namespace:PageTitle
+ outputlang_Namespace:PageTitle
+ (*) requires "outputlang:lang" set.
- num is the sequential number of the listed page.
+ num is the sequential number of the listed page.
- An empty format is equal to -notitle and just shows the total amount
- of pages.
+ An empty format is equal to -notitle and just shows the total
+ amount of pages.
--outputlang Language for translation of namespaces.
+-outputlang Language for translation of namespaces.
--notitle Page title is not printed.
+-notitle Page title is not printed.
--get Page content is printed.
+-get Page content is printed.
--save Save Page content to a file named as page.title(as_filename=True).
- Directory can be set with -save:dir_name
- If no dir is specified, current direcory will be used.
+-save Save Page content to a file named as page.title(as_filename=True).
+ Directory can be set with -save:dir_name
+ If no dir is specified, current direcory will be used.
--encode File encoding can be specified with '-encode:name' (name must be a
- valid python encoding: utf-8, etc.).
- If not specified, it defaults to config.textfile_encoding.
+-encode File encoding can be specified with '-encode:name' (name must be
+ a valid python encoding: utf-8, etc.).
+ If not specified, it defaults to config.textfile_encoding.
--put: Save the list to the defined page of the wiki. By default it does not
- overwrite an exisiting page.
+-put: Save the list to the defined page of the wiki. By default it does
+ not overwrite an exisiting page.
--overwrite Overwrite the page if it exists. Can only by applied with -put.
+-overwrite Overwrite the page if it exists. Can only by applied with -put.
--summary: The summary text when the page is written. If it's one word just
- containing letters, dashes and underscores it uses that as a
- translation key.
-
+-summary: The summary text when the page is written. If it's one word just
+ containing letters, dashes and underscores it uses that as a
+ translation key.
Custom format can be applied to the following items extrapolated from a
page object:
diff --git a/scripts/makecat.py b/scripts/makecat.py
index 217e31b..d9ed2bf 100755
--- a/scripts/makecat.py
+++ b/scripts/makecat.py
@@ -7,18 +7,21 @@
(pages linked to and from pages already in the category),
asking the user which pages to include and which not.
-Arguments:
- -nodates automatically skip all pages that are years or dates (years
- only work AD, dates only for certain languages)
- -forward only check pages linked from pages already in the category,
- not pages linking to them. Is less precise but quite a bit
- faster.
- -exist only ask about pages that do actually exist; drop any
- titles of non-existing pages silently. If -forward is chosen,
- -exist is automatically implied.
- -keepparent do not remove parent categories of the category to be
- worked on.
- -all work on all pages (default: only main namespace)
+The following command line parameters are supported:
+
+-nodates Automatically skip all pages that are years or dates
+ (years only work AD, dates only for certain languages).
+
+-forward Only check pages linked from pages already in the category,
+ not pages linking to them. Is less precise but quite a bit faster.
+
+-exist Only ask about pages that do actually exist;
+ drop any titles of non-existing pages silently.
+ If -forward is chosen, -exist is automatically implied.
+
+-keepparent Do not remove parent categories of the category to be worked on.
+
+-all Work on all pages (default: only main namespace)
When running the bot, you will get one by one a number by pages. You can
choose:
@@ -26,6 +29,7 @@
N(o) - do not include the page or
I(gnore) - do not include the page, but if you meet it again, ask again.
X - add the page, but do not check links to and from it
+
Other possiblities:
A(dd) - add another page, which may have been one that was included before
C(heck) - check links to and from the page, but do not add the page itself
--
To view, visit https://gerrit.wikimedia.org/r/319996
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I0f5de7cd2678b6a1afb6b56b98e1798dab42c836
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Lokal Profil <lokal.profil(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: [IMPR] Simplify space replacement
......................................................................
[IMPR] Simplify space replacement
- use re.sub to replace multiple spaces by a single space instead of
using a loop
Change-Id: I68a03dbc944cdc1721d42c5489cee3b868836264
---
M pywikibot/page.py
1 file changed, 1 insertion(+), 2 deletions(-)
Approvals:
Mpaa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py
index 93c36f5..be6170b 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -4984,8 +4984,7 @@
# Replace underscores by spaces
t = t.replace(u"_", u" ")
# replace multiple spaces with a single space
- while u" " in t:
- t = t.replace(u" ", u" ")
+ t = re.sub(' {2,}', ' ', t)
# Strip spaces at both ends
t = t.strip()
# Remove left-to-right and right-to-left markers.
--
To view, visit https://gerrit.wikimedia.org/r/319992
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I68a03dbc944cdc1721d42c5489cee3b868836264
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: Expose the concept url of an ItemPage
......................................................................
Expose the concept url of an ItemPage
The siteinfo parameter was introduced in 8ef8d6bf9159e5a4cbf9ebfa2286e7599485662b
and deployed as part of 1.28/wmf.23.
This is part 1 of 3 of the commits to allow unit ItemPages
to be passed to WbQuantity.
Bug: T143594
Change-Id: Ie1e67484351e482b33d6a0faf44c388d20d462a5
---
M pywikibot/page.py
M pywikibot/site.py
2 files changed, 16 insertions(+), 0 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py
index fbab94f..93c36f5 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -3939,6 +3939,11 @@
data['sitelinks'] = self.sitelinks
return data
+ @pywikibot.site.need_version("1.28-wmf.23")
+ def concept_url(self):
+ """Return the full concept URL."""
+ return '{0}{1}'.format(self.site.concept_base_uri, self.id)
+
def getRedirectTarget(self):
"""Return the redirect target for this page."""
target = super(ItemPage, self).getRedirectTarget()
diff --git a/pywikibot/site.py b/pywikibot/site.py
index f997020..780b48b 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -7032,6 +7032,17 @@
'%r does not support entity type "property"'
% self)
+ @property
+ @need_version("1.28-wmf.23")
+ def concept_base_uri(self):
+ """
+ Return the base uri for concepts/entities.
+
+ @return: concept base uri
+ @rtype: str
+ """
+ return self.siteinfo['general']['wikibase-conceptbaseuri']
+
def _get_baserevid(self, claim, baserevid):
"""Check that claim.on_item is set and matches baserevid if used."""
if not claim.on_item:
--
To view, visit https://gerrit.wikimedia.org/r/319834
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie1e67484351e482b33d6a0faf44c388d20d462a5
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Lokal Profil <lokal.profil(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>