Skip to content

Commit 01f3e76

Browse files
committed
fake8 whitespace; variable name replacement
1 parent c840350 commit 01f3e76

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

roundup/cgi/accept_language.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@
4747
def parse(language_header):
4848
"""parse(string_with_accept_header_content) -> languages list"""
4949

50-
if language_header is None: return []
50+
if language_header is None: return [] # noqa: E701
5151

5252
# strip whitespaces.
5353
lh = language_header.translate(*remove_ws)
5454

5555
# if nothing, return
56-
if lh == "": return []
56+
if lh == "": return [] # noqa: E701
5757

5858
# split by commas and parse the quality values.
5959
pls = [lre.findall(x) for x in lh.split(',')]
@@ -64,18 +64,18 @@ def parse(language_header):
6464
# use a heap queue to sort by quality values.
6565
# the value of each item is 1.0 complement.
6666
pq = []
67-
order=0
68-
for l in qls:
69-
order +=1
70-
if l[0] != '':
71-
heapq.heappush(pq, (0.0, order, l[0]))
67+
order = 0
68+
for lang in qls:
69+
order += 1
70+
if lang[0] != '':
71+
heapq.heappush(pq, (0.0, order, lang[0]))
7272
else:
73-
heapq.heappush(pq, (1.0-float(l[2]), order, l[1]))
73+
heapq.heappush(pq, (1.0-float(lang[2]), order, lang[1]))
7474

7575
# get the languages ordered by quality
7676
# and replace - by _
77-
return [ heapq.heappop(pq)[2].replace('-','_')
78-
for x in range(len(pq)) ]
77+
return [heapq.heappop(pq)[2].replace('-', '_') for x in range(len(pq))]
78+
7979

8080
if __name__ == "__main__":
8181
import doctest

0 commit comments

Comments
 (0)