-
-
Notifications
You must be signed in to change notification settings - Fork 402
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
core: better bot-mode handling #2448
Conversation
Ditto #2447 (comment) (but since this is still a draft, it's not as annoying… yet). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nitpicking. I wonder if you could add type annotations to _record_who
as well (and run make mypy
to ensure it actually works).
Status update: Located an issue where several people are discussing the Coveralls error that the CI jobs are running into on this pull request. See lemurheavy/coveralls-public#1708 |
CI should pass again when this is rebased: lemurheavy/coveralls-public#1710 (comment) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, nice test! Only nitpicking left, and we should be good.
Running $ make mypy
mypy sopel
sopel/plugins/capabilities.py:64: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
sopel/plugins/capabilities.py:70: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
sopel/plugins/capabilities.py:71: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
sopel/plugins/capabilities.py:72: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
sopel/irc/backends.py:59: error: Invalid type: try using Literal[False] instead? [valid-type]
sopel/plugins/rules.py:1015: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
sopel/plugins/rules.py:1016: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
sopel/plugins/rules.py:1145: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
sopel/plugins/rules.py:1151: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
sopel/plugins/rules.py:1196: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
sopel/plugins/rules.py:1198: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
sopel/bot.py:56: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
sopel/modules/url.py:472: error: Incompatible types in "yield" (actual type "Tuple[str, str, Optional[str], Optional[str], bool]", expected type "URLInfo") [misc]
Found 2 errors in 2 files (checked 86 source files)
make: *** [Makefile:9: mypy] Error 1 Of the two errors in these results, The |
I remembered what I wanted to test: the WHO handling. I couldn't find any test cases that would trigger |
We shouldn't automatically send a nonstandard modechar by default. The BOT ISupport token should be all we handle out of the box; if someone wants to send a non-standard bot mode on a network that doesn't advertise the BOT token, they can configure it themselves.
Converts `User.hostmask` from a lambda to a proper function, in order to apply the intended type hints. (Setting `hostmask: str = property(...)` generated an error, of course. It was also not possible to type-hint the lambda's return value without stooping to `typing.Callable[]`, and I figured I might as well just make the thing a real function.) TODO comment added regarding user/host values that haven't populated yet and are still set to the default of `None`.
No related errors are reported by mypy, so it should be good to go.
Finally got around to squashing down the fixups. 💪 |
Description
Sending mode
+B
by default is pretty silly. As of #2088 we should have stopped doing so. Now we will.More importantly, WHO replies contain a bot flag on servers that support the bot-mode spec; it's indicated by the same character as the modechar advertised in ISupport's
BOT
token. We should track that—and you guessed it: this patch adds anis_bot
attribute toUser
objects.Checklist
make qa
(runsmake quality
andmake test
)Notes
I'm hoping to write some more tests when I have time, because this part of coretasks seems pretty under-tested. Therefore, I'm starting the patch as a draft, to collect feedback until I get to that step.