jenkins-bot submitted this change.

View Change


Approvals: jenkins-bot: Verified Xqt: Looks good to me, approved
[doc] Update ROADMAP.rst and fix some doc strings

Change-Id: Ic325d247650977df208d458317f93f07f833a41c
---
M ROADMAP.rst
M pywikibot/time.py
2 files changed, 26 insertions(+), 10 deletions(-)

diff --git a/ROADMAP.rst b/ROADMAP.rst
index d1dbe45..0abccf1 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -4,6 +4,8 @@
Improvements
^^^^^^^^^^^^

+* :meth:`Timestamp.nowutc()<pywikibot.time.Timestamp.nowutc>` and
+ :meth:`Timestamp.utcnow()<pywikibot.time.Timestamp.utcnow>` were added (:phab:`T337748`)
* Remove content parameter of :meth:`proofreadpage.IndexPage.page_gen` method. (:phab:`T358635`)
* Backport ``itertools.batched`` from Python 3.13 to :func:`backports.batched`
* A copy button was added to the sphinx documentation.
@@ -23,6 +25,9 @@
Bugfixes
^^^^^^^^

+* :meth:`Timestamp.now()<pywikibot.time.Timestamp.now>` and
+ :meth:`Timestamp.fromtimestamp()<pywikibot.time.Timestamp.fromtimestamp>` also returns a
+ :class:`Timestamp<pywikibot.time.Timestamp>` object with Python 3.7
* Populate :class:`pywikibot.MediaInfo`._content with expected attributes when loaded (:phab:`T357608`)
* Raise :exc:`exceptions.APIError` if the same error comes twice within :meth:`data.api.Request.submit` loop
(:phab:`T357870`)
diff --git a/pywikibot/time.py b/pywikibot/time.py
index 5df6e82..2612cd8 100644
--- a/pywikibot/time.py
+++ b/pywikibot/time.py
@@ -89,9 +89,10 @@

ts is converted to a datetime naive object representing UTC time.
String shall be compliant with:
- - Mediwiki timestamp format: YYYYMMDDHHMMSS
- - ISO8601 format: YYYY-MM-DD[T ]HH:MM:SS[Z|±HH[MM[SS[.ffffff]]]]
- - POSIX format: seconds from Unix epoch S{1,13}[.ffffff]]
+
+ - Mediwiki timestamp format: ``YYYYMMDDHHMMSS``
+ - 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.5
.. versionchanged:: 8.0
@@ -142,7 +143,7 @@
"""Convert a string in ISO8601 format to a Timestamp object.

ISO8601 format:
- - YYYY-MM-DD[T ]HH:MM:SS[[.,]ffffff][Z|±HH[MM[SS[.ffffff]]]]
+ ``YYYY-MM-DD[T ]HH:MM:SS[[.,]ffffff][Z|±HH[MM[SS[.ffffff]]]]``

.. versionadded:: 7.5
"""
@@ -184,7 +185,7 @@
def _from_posix(cls, timestr: str) -> Timestamp:
"""Convert a string in POSIX format to a Timestamp object.

- POSIX format: SECONDS[.ffffff]]
+ POSIX format: ``SECONDS[.ffffff]]``

.. versionadded:: 7.5
"""
@@ -438,9 +439,10 @@
.. note:: This method is deprecated since Python 3.12 but held
here for backward compatibility because ``utcnow`` is widely
used inside the framework to compare MediaWiki timestamps
- which are UTC-based. Neither :meth:`fromisoformatformat`
- implementations of Python < 3.11 nor :class:`Timestamp`specific
- :meth:`fromISOformat` supports timezone.
+ which are UTC-based. Neither :python:`datetime.fromisoformat()
+ <library/datetime.html#datetime.datetime.fromisoformat>`
+ implementations of Python < 3.11 nor :class:`Timestamp`
+ specific :meth:`fromISOformat` supports timezone.

.. warning::
Because naive datetime objects are treated by many datetime
@@ -486,11 +488,11 @@
"""Return the current local date and time.

This class method is for Python 3.7 to upcast the class if a
- tz is given.
+ *tz* is given.

.. versionadded:: 9.0
.. seealso::
- - :python:`datetime.fromtimestamp()
+ - :python:`datetime.now()
<library/datetime.html#datetime.datetime.now>`
"""
ts = super().now(tz)

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

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ic325d247650977df208d458317f93f07f833a41c
Gerrit-Change-Number: 1008124
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged