Left: | ||
Right: |
LEFT | RIGHT |
---|---|
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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
145 regexp = re.compile(r'\s*\[((?:\w+,)*\w+)\]$') | 145 regexp = re.compile(r'\s*\[((?:\w+,)*\w+)\]$') |
146 match = re.search(regexp, value) | 146 match = re.search(regexp, value) |
147 if match: | 147 if match: |
148 value = re.sub(regexp, r'', value) | 148 value = re.sub(regexp, r'', value) |
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 |
Sebastian Noack
2018/01/17 01:43:51
I wonder whether we should omit the parantheses wh
Vasily Kuznetsov
2018/01/18 10:46:07
If parentheses are not needed for line breaking (a
rosie
2018/01/25 16:13:48
Done.
Sebastian Noack
2018/01/25 18:15:00
Mind also doing the same change below?
rosie
2018/01/25 19:03:39
Done.
| |
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 Loading... | |
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 != ' ' |
LEFT | RIGHT |