Format everything to pep8 guidelines
This commit is contained in:
parent
cd4b65de3d
commit
99fe34a0b1
33 changed files with 142 additions and 107 deletions
|
@ -13,23 +13,29 @@ control = {'bold': '\x02', 'color': '\x03', 'italic': '\x09',
|
|||
def color(color):
|
||||
return control['color'] + colors[color]
|
||||
|
||||
|
||||
def bold():
|
||||
return control['bold']
|
||||
|
||||
|
||||
def italic():
|
||||
return control['italic']
|
||||
|
||||
|
||||
def strike():
|
||||
return control['strikethrough']
|
||||
|
||||
|
||||
def reset():
|
||||
return control['reset']
|
||||
|
||||
|
||||
def underline(other=False):
|
||||
if other:
|
||||
return control['underline2']
|
||||
else:
|
||||
return control['underline']
|
||||
|
||||
|
||||
def reverse():
|
||||
return control['reverse']
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import http, web
|
||||
import http
|
||||
import web
|
||||
|
||||
|
||||
def eval_py(code, paste_multiline=True):
|
||||
|
|
|
@ -1,34 +1,36 @@
|
|||
def raw(format_string):
|
||||
"""Replace based irc formatting"""
|
||||
stuff = {}
|
||||
stuff['col'] = {'[white]':'\x030',
|
||||
'[black]':'\x031',
|
||||
'[dblue]':'\x032',
|
||||
'[dgreen]':'\x033',
|
||||
'[dred]':'\x034',
|
||||
'[brown]':'\x035',
|
||||
'[purple]':'\x036',
|
||||
'[gold]':'\x037',
|
||||
'[yellow]':'\x038',
|
||||
'[green]':'\x039',
|
||||
'[cyan]':'\x0310',
|
||||
'[lblue]':'\x0311',
|
||||
'[blue]':'\x0312',
|
||||
'[pink]':'\x0313',
|
||||
'[gray]':'\x0314',
|
||||
'[lgray]':'\x0315',
|
||||
'[err]':'\x034\x02'
|
||||
'[/err]':'\x030\x02'}
|
||||
stuff['style'] = {'[b]':'\x02',
|
||||
'[clear]':'\x0f'}
|
||||
stuff['sym'] = {'[point]':'\x07'}
|
||||
stuff['text'] = {'[url]':'http://'}
|
||||
stuff['col'] = {'[white]': '\x030',
|
||||
'[black]': '\x031',
|
||||
'[dblue]': '\x032',
|
||||
'[dgreen]': '\x033',
|
||||
'[dred]': '\x034',
|
||||
'[brown]': '\x035',
|
||||
'[purple]': '\x036',
|
||||
'[gold]': '\x037',
|
||||
'[yellow]': '\x038',
|
||||
'[green]': '\x039',
|
||||
'[cyan]': '\x0310',
|
||||
'[lblue]': '\x0311',
|
||||
'[blue]': '\x0312',
|
||||
'[pink]': '\x0313',
|
||||
'[gray]': '\x0314',
|
||||
'[lgray]': '\x0315',
|
||||
'[err]': '\x034\x02'
|
||||
'[/err]': '\x030\x02'}
|
||||
stuff['style'] = {'[b]': '\x02',
|
||||
'[clear]': '\x0f'}
|
||||
stuff['sym'] = {'[point]': '\x07'}
|
||||
stuff['text'] = {'[url]': 'http://'}
|
||||
final = {}
|
||||
for x in stuff:
|
||||
final.update(stuff[x])
|
||||
for x in final:
|
||||
format_string = format_string.replace(x,final[x])
|
||||
format_string = format_string.replace(x, final[x])
|
||||
return format_string
|
||||
|
||||
|
||||
def err(format_string):
|
||||
"""Format the string with standard error styling"""
|
||||
return "\x034\x02{}\x0f".format(format_string)
|
||||
return "\x034\x02{}\x0f".format(format_string)
|
||||
|
|
|
@ -184,7 +184,7 @@ def truncate_str(content, length=100, suffix='...'):
|
|||
# Expression to match some_token and some_token="with spaces" (and similarly
|
||||
# for single-quoted strings).
|
||||
|
||||
split_re = re.compile(r"""((?:[^\s'"]*(?:(?:"(?:[^"\\]|\\.)*" | '(?:[""" \
|
||||
split_re = re.compile(r"""((?:[^\s'"]*(?:(?:"(?:[^"\\]|\\.)*" | '(?:["""
|
||||
r"""^'\\]|\\.)*')[^\s'"]*)+) | \S+)""", re.VERBOSE)
|
||||
|
||||
|
||||
|
|
|
@ -48,4 +48,4 @@ class TextGenerator(object):
|
|||
return strings
|
||||
|
||||
def get_template(self, template):
|
||||
return self.templates[template]
|
||||
return self.templates[template]
|
||||
|
|
Reference in a new issue