Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: sitescripts/templateFilters.py

Issue 29670635: Issue 5844 - Remove redundant parentheses in abpssembly (Closed) Base URL: https://hg.adblockplus.org/abpssembly/
Patch Set: Created Jan. 16, 2018, 5:58 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sitescripts/subscriptions/web/fallback.py ('k') | sitescripts/urlfixer/web/submitData.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # This file is part of the Adblock Plus web scripts, 1 # This file is part of the Adblock Plus web scripts,
2 # Copyright (C) 2006-present eyeo GmbH 2 # Copyright (C) 2006-present eyeo GmbH
3 # 3 #
4 # Adblock Plus is free software: you can redistribute it and/or modify 4 # Adblock Plus is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License version 3 as 5 # it under the terms of the GNU General Public License version 3 as
6 # published by the Free Software Foundation. 6 # published by the Free Software Foundation.
7 # 7 #
8 # Adblock Plus is distributed in the hope that it will be useful, 8 # Adblock Plus is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 return Markup(value) 116 return Markup(value)
117 117
118 118
119 def urlencode(value): 119 def urlencode(value):
120 return urllib.quote(value.encode('utf-8'), '') 120 return urllib.quote(value.encode('utf-8'), '')
121 121
122 122
123 def subscriptionSort(value, prioritizeRecommended=True): 123 def subscriptionSort(value, prioritizeRecommended=True):
124 value = value[:] # create a copy of the list 124 value = value[:] # create a copy of the list
125 if prioritizeRecommended: 125 if prioritizeRecommended:
126 value.sort(lambda a, b: ( 126 value.sort(lambda a, b:
127 cmp(a.type, b.type) or 127 cmp(a.type, b.type) or
128 cmp(a.deprecated, b.deprecated) or 128 cmp(a.deprecated, b.deprecated) or
129 cmp(b.catchall, a.catchall) or 129 cmp(b.catchall, a.catchall) or
130 cmp(b.recommendation != None, a.recommendation != None) or 130 cmp(b.recommendation != None, a.recommendation != None) or
131 cmp(a.name.lower(), b.name.lower()) 131 cmp(a.name.lower(), b.name.lower())
132 )) 132 )
133 else: 133 else:
134 value.sort(lambda a, b: ( 134 value.sort(lambda a, b:
135 cmp(a.type, b.type) or 135 cmp(a.type, b.type) or
136 cmp(a.deprecated, b.deprecated) or 136 cmp(a.deprecated, b.deprecated) or
137 cmp(a.name.lower(), b.name.lower()) 137 cmp(a.name.lower(), b.name.lower())
138 )) 138 )
139 return value 139 return value
140 140
141 141
142 def formatmime(text): 142 def formatmime(text):
143 # See http://bugs.python.org/issue5871 (not really fixed), Header() will 143 # See http://bugs.python.org/issue5871 (not really fixed), Header() will
144 # happily accept non-printable characters including newlines. Make sure to 144 # happily accept non-printable characters including newlines. Make sure to
145 # remove them. 145 # remove them.
146 text = re.sub(r'[\x00-\x1F]', '', text) 146 text = re.sub(r'[\x00-\x1F]', '', text)
147 return email.header.Header(text).encode() 147 return email.header.Header(text).encode()
148 148
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 'subscriptionSort': subscriptionSort, 199 'subscriptionSort': subscriptionSort,
200 'mime': formatmime, 200 'mime': formatmime,
201 'emailaddr': email.utils.formataddr, 201 'emailaddr': email.utils.formataddr,
202 'ljust': ljust, 202 'ljust': ljust,
203 'rjust': rjust, 203 'rjust': rjust,
204 'ltruncate': ltruncate, 204 'ltruncate': ltruncate,
205 'weekday': formatweekday, 205 'weekday': formatweekday,
206 'bytes': formatbytes, 206 'bytes': formatbytes,
207 'json': toJSON, 207 'json': toJSON,
208 } 208 }
OLDNEW
« no previous file with comments | « sitescripts/subscriptions/web/fallback.py ('k') | sitescripts/urlfixer/web/submitData.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld