Xqt has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/811576 )
Change subject: [doc] Fix version numbers ......................................................................
[doc] Fix version numbers
Change-Id: I0e7f1e0aed68e0fa248c733bab0158aba7f8c353 --- M pywikibot/textlib.py M pywikibot/time.py M scripts/harvest_template.py 3 files changed, 22 insertions(+), 17 deletions(-)
Approvals: Xqt: Verified; Looks good to me, approved
diff --git a/pywikibot/textlib.py b/pywikibot/textlib.py index c90bbec..ee70af9 100644 --- a/pywikibot/textlib.py +++ b/pywikibot/textlib.py @@ -127,6 +127,9 @@ Be aware that this function only works for several languages, and that it returns an unchanged string if an unsupported language is given.
+ .. versionchanged:: 7.5 + always return a string even `phrase` is an int. + :param phrase: The phrase to convert to localized numerical :param lang: language code :return: The localized version diff --git a/pywikibot/time.py b/pywikibot/time.py index 29b5fea..b276ac6 100644 --- a/pywikibot/time.py +++ b/pywikibot/time.py @@ -1,6 +1,6 @@ """Time handling module.
-.. versionadded:: 7.4 +.. versionadded:: 7.5 """ # # (C) Pywikibot team, 2007-2022 @@ -25,7 +25,7 @@ 'TZoneUTC', )
-#: ..versionadded:: 7.4 +#: ..versionadded:: 7.5 MW_KEYS = types.MappingProxyType({ 's': 'seconds', 'h': 'hours', @@ -61,7 +61,7 @@ Use Site.server_time() for the current time; this is more reliable than using Timestamp.utcnow().
- .. versionchanged:: 7.4 + .. versionchanged:: 7.5 moved to :mod:`time` module """
@@ -80,7 +80,7 @@ - ISO8601 format: YYYY-MM-DD[T ]HH:MM:SS[Z|±HH[MM[SS[.ffffff]]]] - POSIX format: seconds from Unix epoch S{1,13}[.ffffff]]
- .. versionadded: 7.4 + .. versionadded: 7.5
:param ts: Timestamp, datetime.datetime or str :return: Timestamp object @@ -99,7 +99,7 @@ def _from_datetime(dt: datetime.datetime) -> 'Timestamp': """Convert a datetime.datetime timestamp to a Timestamp object.
- .. versionadded: 7.4 + .. versionadded: 7.5 """ return Timestamp(dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second, dt.microsecond, @@ -111,7 +111,7 @@
Mediwiki timestamp format: YYYYMMDDHHMMSS
- .. versionadded: 7.4 + .. versionadded: 7.5 """ RE_MW = r'\d{14}$' # noqa: N806 m = re.match(RE_MW, timestr) @@ -129,7 +129,7 @@ ISO8601 format: - YYYY-MM-DD[T ]HH:MM:SS[[.,]ffffff][Z|±HH[MM[SS[.ffffff]]]]
- .. versionadded: 7.4 + .. versionadded: 7.5 """ RE_ISO8601 = (r'(?:\d{4}-\d{2}-\d{2})(?P<sep>[T ])' # noqa: N806 r'(?:\d{2}:\d{2}:\d{2})(?P<u>[.,]\d{1,6})?' @@ -171,7 +171,7 @@
POSIX format: SECONDS[.ffffff]]
- .. versionadded: 7.4 + .. versionadded: 7.5 """ RE_POSIX = r'(?P<S>-?\d{1,13})(?:.(?P<u>\d{1,6}))?$' # noqa: N806 m = re.match(RE_POSIX, timestr) @@ -195,7 +195,7 @@ def _from_string(cls: Type['Timestamp'], timestr: str) -> 'Timestamp': """Convert a string to a Timestamp object.
- .. versionadded: 7.4 + .. versionadded: 7.5 """ handlers = [ cls._from_mw, @@ -281,14 +281,14 @@
See Note in datetime.timestamp().
- .. versionadded: 7.4 + .. versionadded: 7.5 """ return self.replace(tzinfo=datetime.timezone.utc).timestamp()
def posix_timestamp_format(self) -> str: """Convert object to a POSIX timestamp format.
- .. versionadded: 7.4 + .. versionadded: 7.5 """ return '{ts:.6f}'.format(ts=self.posix_timestamp())
diff --git a/scripts/harvest_template.py b/scripts/harvest_template.py index 6bb3ef0..ac7de77 100755 --- a/scripts/harvest_template.py +++ b/scripts/harvest_template.py @@ -93,6 +93,8 @@ .. note:: This script is a :py:obj:`ConfigParserBot <pywikibot.bot.ConfigParserBot>`. All options can be set within a settings file which is scripts.ini by default. +.. versionadded:: 7.5 + the -inverse option. """ # # (C) Pywikibot team, 2013-2022 @@ -219,7 +221,7 @@ link_text: str) -> Optional[pywikibot.ItemPage]: """Find the ItemPage target for a given link text.
- .. versionchanged:: 7.4 + .. versionchanged:: 7.5 Only follow the redirect target if redirect page has no wikibase item. """ @@ -305,7 +307,7 @@ field_item: Tuple[str, str]) -> None: """Process a single field of template fielddict.
- .. versionadded:: 7.4 + .. versionadded:: 7.5 """ field, value = field_item field = field.strip() @@ -368,7 +370,7 @@ field: str) -> Iterator[pywikibot.ItemPage]: """Handle 'wikibase-item' claim type.
- .. versionadded:: 7.4 + .. versionadded:: 7.5 """ prop, options = self.fields[field] matched = False @@ -398,7 +400,7 @@ def handle_string(value, *args) -> Iterator[str]: """Handle 'string' and 'external-id' claim type.
- .. versionadded:: 7.4 + .. versionadded:: 7.5 """ yield value.strip()
@@ -407,7 +409,7 @@ def handle_url(self, value, *args) -> Iterator[str]: """Handle 'url' claim type.
- .. versionadded:: 7.4 + .. versionadded:: 7.5 """ for match in self.linkR.finditer(value): yield match.group('url') @@ -416,7 +418,7 @@ ) -> Iterator[pywikibot.FilePage]: """Handle 'commonsMedia' claim type.
- .. versionadded:: 7.4 + .. versionadded:: 7.5 """ repo = self.current_page.site.image_repository() image = pywikibot.FilePage(repo, value)
pywikibot-commits@lists.wikimedia.org