A bunch of minor mostly-style changes organized in several commits for ease of cherry-picking.
Use a triple-quoted string for the help message. On the one hand this should be more idiomatic, on the other hand this needs a combination of textwrap.dedent and .indent to keep it pretty, and the latter is missing in python 2. Also, the change adds a newline at the end of the help string, but the chat engine should ignore that.
Use format strings where possible (TODO: f-strings once 3.6 is the new norm ;)
Use context managers for the data files.
Add explicit elifs to chained mutually exclusive ifs. Some of these are extra redundant because there are return statements interspersed, it's a matter of personal taste whether explicit elifs aid readability.
Use advanced iterable unpacking to make head|rest and garbage|tail kind of list separations a bit more convenient.
A bunch of minor mostly-style changes organized in several commits for ease of cherry-picking.
textwrap.dedent
and.indent
to keep it pretty, and the latter is missing in python 2. Also, the change adds a newline at the end of the help string, but the chat engine should ignore that.elif
s to chained mutually exclusiveif
s. Some of these are extra redundant because there arereturn
statements interspersed, it's a matter of personal taste whether explicitelif
s aid readability.head|rest
andgarbage|tail
kind of list separations a bit more convenient.