sopel-irc / sopel

:robot::speech_balloon: An easy-to-use and highly extensible IRC Bot framework. Formerly Willie.
https://sopel.chat
Other
949 stars 403 forks source link

remind: fix import streamlining gone haywire #2470

Closed dgw closed 1 year ago

dgw commented 1 year ago

"Unexpected AttributeError: 'str' object has no attribute 'utc'" begone.

Fixes a bug I introduced in #2468 by not being careful enough with my imports. Code review or not, I should've caught it. (And I was reminded to finish/open this PR by mypy --check-untyped-defs flagging these errors, so that's all the more reason to work toward #2461 in the longer term.)

Checklist

Notes

mypy --check-untyped-defs still reports errors in sopel/modules/remind.py after this patch, but they'll be fixed separately. @SnoopJ and I have been chipping away at that list over the weekend.

dgw commented 1 year ago

this would also be a good opportunity to add a test that would have caught the bug

Went for the minimum-necessary-change approach because:

  1. As discovered shortly after, mypy --check-untyped-defs (the new default behavior of make mypy, soon) flags this problem
  2. More importantly, the not-so-long-term plan is to replace this built-in plugin with an external sopel-remind package that already exists and has much better test coverage

Basically, I was lazy in favor of just getting it working again so our master-based bot unbreaks. Once the new package has optional-date support for .at, we can just drop the builtin.