Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remind: fix import streamlining gone haywire #2470

Merged
merged 1 commit into from
Jun 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions sopel/modules/remind.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from __future__ import annotations

import collections
from datetime import datetime, timezone
import datetime
import io # don't use `codecs` for loading the DB; it will split lines on some IRC formatting
import logging
import os
Expand Down Expand Up @@ -263,7 +263,7 @@ def remind_in(bot, trigger):
timezone,
trigger.nick,
trigger.sender,
datetime.fromtimestamp(timestamp, timezone.utc))
datetime.datetime.fromtimestamp(timestamp, datetime.timezone.utc))
bot.reply('Okay, will remind at %s' % human_time)
else:
bot.reply('Okay, will remind in %s secs' % duration)
Expand Down Expand Up @@ -396,15 +396,15 @@ def get_duration(self, today=None):

"""
if not today:
today = datetime.now(self.timezone)
today = datetime.datetime.now(self.timezone)
else:
today = today.astimezone(self.timezone)

year = self.year if self.year is not None else today.year
month = self.month if self.month is not None else today.month
day = self.day if self.day is not None else today.day

at_time = datetime(
at_time = datetime.datetime(
year, month, day,
self.hour, self.minute, self.second,
tzinfo=today.tzinfo)
Expand Down Expand Up @@ -495,7 +495,7 @@ def remind_at(bot, trigger):
reminder.timezone.zone,
trigger.nick,
trigger.sender,
datetime.fromtimestamp(timestamp, timezone.utc))
datetime.datetime.fromtimestamp(timestamp, datetime.timezone.utc))
bot.reply('Okay, will remind at %s' % human_time)
else:
bot.reply('Okay, will remind in %s secs' % duration)
Expand Down
2 changes: 1 addition & 1 deletion test/modules/test_modules_remind.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
13, 37, 0, 'Europe/Paris', None, None, None, 'message'
),
),
# These should not pass but we are very tolerant a the moment
# These should not pass but we are very tolerant at the moment
('1:7 message',
remind.TimeReminder(1, 7, 0, 'UTC', None, None, None, 'message')),
('13:7 message',
Expand Down