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

Delta Between Two Patch Sets: sitescripts/subscriptions/subscriptionParser.py

Issue 29670611: Issue 5844 - Remove redundant parentheses in sitescripts and abpsembly (Closed) Base URL: https://hg.adblockplus.org/sitescripts/
Left Patch Set: Addressed the comments in /sitescripts Created Jan. 25, 2018, 4:12 p.m.
Right Patch Set: Fixed one more case of redundant parentheses Created Jan. 25, 2018, 7:03 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « sitescripts/subscriptions/knownIssuesParser.py ('k') | sitescripts/subscriptions/web/fallback.py » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 for keyword in match.group(1).split(','): 149 for keyword in match.group(1).split(','):
150 keyword = keyword.lower() 150 keyword = keyword.lower()
151 if keyword in keywords: 151 if keyword in keywords:
152 keywords[keyword] = True 152 keywords[keyword] = True
153 else: 153 else:
154 warn('Unknown keyword %s given for attribute %s in %s' % (keyword, key, path)) 154 warn('Unknown keyword %s given for attribute %s in %s' % (keyword, key, path))
155 name, url = self.name, value 155 name, url = self.name, value
156 if key == 'variant': 156 if key == 'variant':
157 match = re.search(r'(.+?)\s+(\S+)$', value) 157 match = re.search(r'(.+?)\s+(\S+)$', value)
158 if match: 158 if match:
159 name, url = (match.group(1), match.group(2)) 159 name, url = match.group(1), match.group(2)
160 else: 160 else:
161 warn('Invalid variant format in %s, no name given?' % path) 161 warn('Invalid variant format in %s, no name given?' % path)
162 if not _validate_URL(url): 162 if not _validate_URL(url):
163 warn('Invalid list URL %s given in %s' % (url, path)) 163 warn('Invalid list URL %s given in %s' % (url, path))
164 self.variants.append([name, url, keywords['complete']]) 164 self.variants.append([name, url, keywords['complete']])
165 if keywords['recommendation']: 165 if keywords['recommendation']:
166 self._data['recommendation'] = self._data['variants'][-1 ] 166 self._data['recommendation'] = self._data['variants'][-1 ]
167 self._data['catchall'] = keywords['catchall'] 167 self._data['catchall'] = keywords['catchall']
168 168
169 elif key == 'deprecated' or key == 'unavailable': 169 elif key == 'deprecated' or key == 'unavailable':
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 def getFallbackData(): 265 def getFallbackData():
266 repo = os.path.abspath(get_config().get('subscriptions', 'repository')) 266 repo = os.path.abspath(get_config().get('subscriptions', 'repository'))
267 redirectdata = subprocess.check_output(['hg', '-R', repo, 'cat', '-r', 'defa ult', os.path.join(repo, 'redirects')]) 267 redirectdata = subprocess.check_output(['hg', '-R', repo, 'cat', '-r', 'defa ult', os.path.join(repo, 'redirects')])
268 gonedata = subprocess.check_output(['hg', '-R', repo, 'cat', '-r', 'default' , os.path.join(repo, 'gone')]) 268 gonedata = subprocess.check_output(['hg', '-R', repo, 'cat', '-r', 'default' , os.path.join(repo, 'gone')])
269 return (redirectdata, gonedata) 269 return (redirectdata, gonedata)
270 270
271 271
272 def _validate_URL(url): 272 def _validate_URL(url):
273 parse_result = urlparse(url) 273 parse_result = urlparse(url)
274 return parse_result.scheme in ('http', 'https') and parse_result.netloc != ' ' 274 return parse_result.scheme in ('http', 'https') and parse_result.netloc != ' '
LEFTRIGHT

Powered by Google App Engine
This is Rietveld