A dash of PEP-8
This commit is contained in:
parent
398b34fad5
commit
6cc7554cd8
11 changed files with 34 additions and 35 deletions
|
@ -52,7 +52,7 @@ def reddit(inp):
|
|||
data = data["data"]["children"]
|
||||
|
||||
# get the requested/random post
|
||||
if id_num != None:
|
||||
if id_num is not None:
|
||||
try:
|
||||
item = data[id_num]["data"]
|
||||
except IndexError:
|
||||
|
@ -64,14 +64,14 @@ def reddit(inp):
|
|||
item["title"] = text.truncate_str(item["title"], 50)
|
||||
item["link"] = short_url.format(item["id"])
|
||||
|
||||
rawtime = datetime.fromtimestamp(int(item["created_utc"]))
|
||||
item["timesince"] = timesince.timesince(rawtime)
|
||||
raw_time = datetime.fromtimestamp(int(item["created_utc"]))
|
||||
item["timesince"] = timesince.timesince(raw_time)
|
||||
|
||||
if item["over_18"]:
|
||||
item["warning"] = " \x02NSFW\x02"
|
||||
else:
|
||||
item["warning"] = ""
|
||||
|
||||
return u'\x02{title} : {subreddit}\x02 - posted by \x02{author}\x02' \
|
||||
' {timesince} ago - {ups} upvotes, {downs} downvotes -' \
|
||||
' {link}{warning}'.format(**item)
|
||||
return u"\x02{title} : {subreddit}\x02 - posted by \x02{author}\x02" \
|
||||
" {timesince} ago - {ups} upvotes, {downs} downvotes -" \
|
||||
" {link}{warning}".format(**item)
|
||||
|
|
Reference in a new issue