jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/811377 )
Change subject: [IMPR] remove TZoneUTC ......................................................................
[IMPR] remove TZoneUTC
Use datetime.timezone.utc instead.
Change-Id: I94e186e0f8f8da27412c0d4ec89e030d378b83f9 --- M pywikibot/time.py M scripts/archivebot.py 2 files changed, 2 insertions(+), 24 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/time.py b/pywikibot/time.py index cee0acf..0a66bd9 100644 --- a/pywikibot/time.py +++ b/pywikibot/time.py @@ -19,7 +19,6 @@ 'str2timedelta', 'MW_KEYS', 'Timestamp', - 'TZoneUTC', )
@@ -351,24 +350,3 @@ .format(string))
return key, int(duration) - - -class TZoneUTC(datetime.tzinfo): - - """Class building a UTC tzinfo object.""" - - def utcoffset(self, dt) -> datetime.timedelta: - """Subclass implementation, return timedelta(0).""" - return ZERO - - def tzname(self, dt) -> str: - """Subclass implementation.""" - return 'UTC' - - def dst(self, dt) -> datetime.timedelta: - """Subclass implementation, return timedelta(0).""" - return ZERO - - def __repr__(self) -> str: - """Return a string representation.""" - return '{}()'.format(self.__class__.__name__) diff --git a/scripts/archivebot.py b/scripts/archivebot.py index e131405..4ab18e6 100755 --- a/scripts/archivebot.py +++ b/scripts/archivebot.py @@ -114,7 +114,7 @@ findmarker, to_local_digits, ) -from pywikibot.time import parse_duration, str2timedelta, MW_KEYS, TZoneUTC +from pywikibot.time import parse_duration, str2timedelta, MW_KEYS
ShouldArchive = Tuple[str, str] @@ -438,7 +438,7 @@ self.comment_params = { 'from': self.page.title(), } - self.now = datetime.datetime.utcnow().replace(tzinfo=TZoneUTC()) + self.now = datetime.datetime.now(datetime.timezone.utc) self.archives = {} self.archived_threads = 0 self.month_num2orig_names = {}
pywikibot-commits@lists.wikimedia.org