diff options
author | mathieui <mathieui@mathieui.net> | 2018-08-15 13:13:17 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2018-08-15 13:13:17 +0200 |
commit | 6e13b8b73572f9c0ac9b5c683b98a475afbeab38 (patch) | |
tree | 7dae86588339a8cf144b2d98c9280f28646341a9 /plugins/rainbow.py | |
parent | d1b624753bb5371cf287cc9d86bb685593a99315 (diff) | |
download | poezio-6e13b8b73572f9c0ac9b5c683b98a475afbeab38.tar.gz poezio-6e13b8b73572f9c0ac9b5c683b98a475afbeab38.tar.bz2 poezio-6e13b8b73572f9c0ac9b5c683b98a475afbeab38.tar.xz poezio-6e13b8b73572f9c0ac9b5c683b98a475afbeab38.zip |
yapf -rip on plugins
Diffstat (limited to 'plugins/rainbow.py')
-rw-r--r-- | plugins/rainbow.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/plugins/rainbow.py b/plugins/rainbow.py index bb9ab8a3..4ab0b9ac 100644 --- a/plugins/rainbow.py +++ b/plugins/rainbow.py @@ -22,11 +22,15 @@ import random possible_colors = list(range(256)) # remove the colors that are almost white or almost black -for col in [16, 232, 233, 234, 235, 236, 237, 15, 231, 255, 254, 253, 252, 251]: +for col in [ + 16, 232, 233, 234, 235, 236, 237, 15, 231, 255, 254, 253, 252, 251 +]: possible_colors.remove(col) + def rand_color(): - return '\x19%s}' % (random.choice(possible_colors),) + return '\x19%s}' % (random.choice(possible_colors), ) + class Plugin(BasePlugin): def init(self): @@ -35,4 +39,9 @@ class Plugin(BasePlugin): self.api.add_event_handler('conversation_say', self.rainbowize) def rainbowize(self, msg, tab): - msg['body'] = ''.join(['%s%s' % (rand_color(),char,) for char in xhtml.clean_text(msg['body'])]) + msg['body'] = ''.join([ + '%s%s' % ( + rand_color(), + char, + ) for char in xhtml.clean_text(msg['body']) + ]) |