Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Make single letter variables "l" into "link" #569

Closed
wants to merge 2 commits into from

2 participants

@vinnydiehl

It was no problem. See discussion here.

Vinny Diehl added some commits
Vinny Diehl Make single letter variables "l" into "link"
This avoids ambiguity with 1, and is recommended in PEP-8. See #566.
8f10a3e
Vinny Diehl Trim EOL whitespace in Link model d7c0e60
@spladug
Owner

Thanks for the pull request. I'm going to close this as I don't think we want to make git blame less useful in the process of minor readability improvements at this time.

@spladug spladug closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 5, 2012
  1. Make single letter variables "l" into "link"

    Vinny Diehl authored
    This avoids ambiguity with 1, and is recommended in PEP-8. See #566.
  2. Trim EOL whitespace in Link model

    Vinny Diehl authored
This page is out of date. Refresh to see the latest.
Showing with 13 additions and 12 deletions.
  1. +13 −12 r2/r2/models/link.py
View
25 r2/r2/models/link.py
@@ -92,7 +92,7 @@ def _by_url(cls, url, sr):
link_id36s = lbu._values()
links = Link._byID36(link_id36s, data=True, return_dict=False)
- links = [l for l in links if not l._deleted]
+ links = [link for link in links if not link._deleted]
if links and sr:
for link in links:
@@ -227,7 +227,7 @@ def keep_item(self, wrapped):
if is_api and not c.obey_over18:
return True
- # hide NSFW links from non-logged users and under 18 logged users
+ # hide NSFW links from non-logged users and under 18 logged users
# if they're not explicitly visiting an NSFW subreddit or a multireddit
if (((not c.user_is_loggedin and c.site != wrapped.subreddit)
or (c.user_is_loggedin and not c.over18))
@@ -732,12 +732,12 @@ def add_props(cls, user, wrapped):
from r2.lib.pages import WrappedUser
#fetch parent links
- links = Link._byID(set(l.link_id for l in wrapped), data=True,
+ links = Link._byID(set(link.link_id for link in wrapped), data=True,
return_dict=True, stale=True)
# fetch authors
- authors = Account._byID(set(l.author_id for l in links.values()), data=True,
- return_dict=True, stale=True)
+ authors = Account._byID(set(link.author_id for link in links.values()),
+ data=True, return_dict=True, stale=True)
#get srs for comments that don't have them (old comments)
for cm in wrapped:
@@ -1119,15 +1119,16 @@ def add_props(cls, user, wrapped):
m_subreddits = Subreddit._byID(sr_ids, data=True, return_dict=True)
# load the links and their subreddits (if comment-as-message)
- links = Link._byID(set(l.link_id for l in wrapped if l.was_comment),
- data=True,
- return_dict=True)
+ links = Link._byID(
+ set(link.link_id for link in wrapped if link.was_comment),
+ data=True, return_dict=True)
# subreddits of the links (for comment-as-message)
- l_subreddits = Subreddit._byID(set(l.sr_id for l in links.values()),
- data=True, return_dict=True)
+ l_subreddits = Subreddit._byID(
+ set(link.sr_id for link in links.values()),
+ data=True, return_dict=True)
- parents = Comment._byID(set(l.parent_id for l in wrapped
- if l.parent_id and l.was_comment),
+ parents = Comment._byID(set(link.parent_id for link in wrapped
+ if link.parent_id and link.was_comment),
data=True, return_dict=True)
# load the unread list to determine message newness
Something went wrong with that request. Please try again.