jenkins-bot submitted this change.

View Change


Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
Improve documentation for pywikibot.WbTime

- Mention that `site` isn't used if `calendermodel` is given

Bug: T324329
Change-Id: I24cf00e74282a94b15af93b352031c3783ad8c41
---
M pywikibot/__init__.py
1 file changed, 35 insertions(+), 14 deletions(-)

diff --git a/pywikibot/__init__.py b/pywikibot/__init__.py
index 3b5a311..97c4bd9 100644
--- a/pywikibot/__init__.py
+++ b/pywikibot/__init__.py
@@ -350,19 +350,21 @@
to minutes.

:param year: The year as a signed integer of between 1 and 16 digits.
- :param month: Month
- :param day: Day
- :param hour: Hour
- :param minute: Minute
- :param second: Second
+ :param month: Month of the timestamp, if it exists.
+ :param day: Day of the timestamp, if it exists.
+ :param hour: Hour of the timestamp, if it exists.
+ :param minute: Minute of the timestamp, if it exists.
+ :param second: Second of the timestamp, if it exists.
:param precision: The unit of the precision of the time.
:param before: Number of units after the given time it could be, if
uncertain. The unit is given by the precision.
:param after: Number of units before the given time it could be, if
uncertain. The unit is given by the precision.
:param timezone: Timezone information in minutes.
- :param calendarmodel: URI identifying the calendar model
- :param site: The Wikibase site
+ :param calendarmodel: URI identifying the calendar model.
+ :param site: The Wikibase site. If not provided, retrieves the data
+ repository from the default site from user-config.py.
+ Only used if calendarmodel is not given.
"""
if year is None:
raise ValueError('no year given')
@@ -431,14 +433,17 @@

:param datetimestr: Timestamp in a format resembling ISO 8601,
e.g. +2013-01-01T00:00:00Z
- :param precision: The unit of the precision of the time.
+ :param precision: The unit of the precision of the time. Defaults to
+ 14 (second).
:param before: Number of units after the given time it could be, if
uncertain. The unit is given by the precision.
:param after: Number of units before the given time it could be, if
uncertain. The unit is given by the precision.
:param timezone: Timezone information in minutes.
- :param calendarmodel: URI identifying the calendar model
- :param site: The Wikibase site
+ :param calendarmodel: URI identifying the calendar model.
+ :param site: The Wikibase site. If not provided, retrieves the data
+ repository from the default site from user-config.py.
+ Only used if calendarmodel is not given.
"""
match = re.match(r'([-+]?\d+)-(\d+)-(\d+)T(\d+):(\d+):(\d+)Z',
datetimestr)
@@ -459,14 +464,17 @@
Create a new WbTime object from a pywikibot.Timestamp.

:param timestamp: Timestamp
- :param precision: The unit of the precision of the time.
+ :param precision: The unit of the precision of the time. Defaults to
+ 14 (second).
:param before: Number of units after the given time it could be, if
uncertain. The unit is given by the precision.
:param after: Number of units before the given time it could be, if
uncertain. The unit is given by the precision.
:param timezone: Timezone information in minutes.
- :param calendarmodel: URI identifying the calendar model
- :param site: The Wikibase site
+ :param calendarmodel: URI identifying the calendar model.
+ :param site: The Wikibase site. If not provided, retrieves the data
+ repository from the default site from user-config.py.
+ Only used if calendarmodel is not given.
"""
return cls.fromTimestr(timestamp.isoformat(), precision=precision,
before=before, after=after,
@@ -524,7 +532,8 @@
Create a WbTime from the JSON data given by the Wikibase API.

:param data: Wikibase JSON
- :param site: The Wikibase site
+ :param site: The Wikibase site. If not provided, retrieves the data
+ repository from the default site from user-config.py.
"""
return cls.fromTimestr(data['time'], data['precision'],
data['before'], data['after'],

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

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I24cf00e74282a94b15af93b352031c3783ad8c41
Gerrit-Change-Number: 863293
Gerrit-PatchSet: 6
Gerrit-Owner: RPI2026F1 <sarkaraoyan+rpi2026f1@gmail.com>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged