PEP8, various other tweaks
This commit is contained in:
parent
6c022dac1c
commit
e12e7721da
11 changed files with 29 additions and 34 deletions
|
@ -14,8 +14,8 @@ def eval_py(code, paste_multiline=True):
|
|||
status = "Python error: "
|
||||
else:
|
||||
status = "Code executed sucessfully: "
|
||||
|
||||
|
||||
if "\n" in output and paste_multiline:
|
||||
return status + web.haste(output)
|
||||
else:
|
||||
return output
|
||||
return output
|
||||
|
|
|
@ -103,4 +103,4 @@ def quote(s):
|
|||
def unescape(s):
|
||||
if not s.strip():
|
||||
return s
|
||||
return html.fromstring(s).text_content()
|
||||
return html.fromstring(s).text_content()
|
||||
|
|
|
@ -104,8 +104,10 @@ def get_text_list(list_, last_word='or'):
|
|||
>>> get_text_list([])
|
||||
u''
|
||||
"""
|
||||
if len(list_) == 0: return ''
|
||||
if len(list_) == 1: return list_[0]
|
||||
if len(list_) == 0:
|
||||
return ''
|
||||
if len(list_) == 1:
|
||||
return list_[0]
|
||||
return '%s %s %s' % (
|
||||
# Translators: This string is used as a separator between list elements
|
||||
(', ').join([i for i in list_][:-1]),
|
||||
|
|
|
@ -10,7 +10,7 @@ paste_url = "http://paste.dmptr.com"
|
|||
def isgd(url):
|
||||
""" shortens a URL with the is.gd PAI """
|
||||
url = urlnorm.normalize(url.encode('utf-8'))
|
||||
params = urllib.urlencode({'format': 'simple', 'url': url})
|
||||
params = urllib.urlencode({'format': 'simple', 'url': url})
|
||||
return http.get("http://is.gd/create.php?%s" % params)
|
||||
|
||||
|
||||
|
@ -19,4 +19,4 @@ def haste(text):
|
|||
request = urllib2.Request(paste_url + "/documents", text)
|
||||
response = urllib2.urlopen(request)
|
||||
data = json.loads(response.read())
|
||||
return("%s/%s.txt" % (paste_url, data['key']))
|
||||
return("%s/%s.txt" % (paste_url, data['key']))
|
||||
|
|
Reference in a new issue