Eval cog improvements #710
Conversation
It allows the cog to also work on Windows, because of Signals.SIGKILL not being defined on this platform
It could lead to a misleading result if it is stripped.
If the eval message is edited after less than 10 seconds, an emoji is added to the message, and if the user adds the same, the snippet is re-evaluated. This make easier to correct snipper mistakes.
The use of lambdas made the functions hard to test, this new format allows us to easily test those functions and document them.
…xt managers It can be used to test aiohttp request functions, since they are async context managers
|
5 tasks done out of 5, it is now ready for reviewing! |
This avoid recreating partials for each re-eval
It was triggering an error if the user deleted the output before re-evaluating
Makes the code a bit clearer Co-authored-by: Shirayuki Nekomata <lethienphuoc1991@gmail.com>
Co-Authored-By: Mark <kozlovmark@gmail.com>
Reads better as separate lines Co-Authored-By: Mark <kozlovmark@gmail.com>
Reduce visual clutter Co-Authored-By: Mark <kozlovmark@gmail.com>
Because of the stripping, it should still be considered as empty Co-Authored-By: Mark <kozlovmark@gmail.com>
lemonsaurus
left a comment
There was a problem hiding this comment.
Overall I think this is quite a good pull request, mostly with clean and atomic commits and making some nice improvements. The re-eval feature, which you even wrote the issue for, is particularly well implemented.
Nice work.
Two functions were created: send_eval and continue_eval, in order to facilitate testing. The corresponding tests are also changed in this commit.
Unicode literals aren't really safe compared to code points
MarkKoz
left a comment
There was a problem hiding this comment.
Thanks. The split make it look much nicer. Just several more small things.
It could have caused some errors if the user delete his own message
MarkKoz
left a comment
There was a problem hiding this comment.
This is great work. Thanks for taking the initiative to fix those bugs and, of course, add the very useful re-evaluation feature. It's a simple and intuitive design. I believe it will be much appreciate by the users (I made a change to hopefully help them know about it). 100% coverage on the test suite is impressive - I know how tedious achieving that can be, especially for larger features such as snekbox.
Author has addressed the requested changes

Now that snekbox support some external libraries (see python-discord/snekbox#51), I think this is a good time to work on some improvements :
Signals.SIGKILLnot being definedbot/cogs/snekbox.py(closes Write unit tests forbot/cogs/snekbox.py#588)