| 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-2016 Eyeo GmbH | 2 # Copyright (C) 2006-2016 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 24 matching lines...) Expand all Loading... | |
| 35 db = _get_db() | 35 db = _get_db() |
| 36 cursor = db.cursor(MySQLdb.cursors.DictCursor) | 36 cursor = db.cursor(MySQLdb.cursors.DictCursor) |
| 37 cursor.execute('SELECT id, domain, forceinclusion FROM domains') | 37 cursor.execute('SELECT id, domain, forceinclusion FROM domains') |
| 38 | 38 |
| 39 domains = {} | 39 domains = {} |
| 40 mandatory = [] | 40 mandatory = [] |
| 41 for result in cursor: | 41 for result in cursor: |
| 42 domain = result['domain'] | 42 domain = result['domain'] |
| 43 if '.' not in domain or not re.search(r'[a-zA-Z]', domain): | 43 if '.' not in domain or not re.search(r'[a-zA-Z]', domain): |
| 44 continue | 44 continue |
| 45 if re.search('[\'\\"_,<>:;!$%&/()*+#~]|^\\.|\\.$|\\.\\.', domain): | 45 if re.search(r"['\"_,<>:;!$%&/()*+#~]|^\.|\.$|\.\.", domain): |
|
Vasily Kuznetsov
2016/05/30 10:01:41
I now get A110 on this line. It seems that convert
Sebastian Noack
2016/05/30 10:27:18
Well, there is also the fourth option to fix flake
Vasily Kuznetsov
2016/05/30 12:16:34
I agree that moving the backslashes around is not
| |
| 46 continue | 46 continue |
| 47 | 47 |
| 48 typed = _get_weighted_count(db, result['id'], STATUS_TYPED) | 48 typed = _get_weighted_count(db, result['id'], STATUS_TYPED) |
| 49 correction = _get_weighted_count(db, result['id'], STATUS_CORRECTION) | 49 correction = _get_weighted_count(db, result['id'], STATUS_CORRECTION) |
| 50 typo = _get_weighted_count(db, result['id'], STATUS_TYPO) | 50 typo = _get_weighted_count(db, result['id'], STATUS_TYPO) |
| 51 fp = _get_weighted_count(db, result['id'], STATUS_FALSE_POSITIVE) | 51 fp = _get_weighted_count(db, result['id'], STATUS_FALSE_POSITIVE) |
| 52 correctness = _calculate_correctness(typed + correction, typo + fp) | 52 correctness = _calculate_correctness(typed + correction, typo + fp) |
| 53 | 53 |
| 54 domains[domain] = correctness | 54 domains[domain] = correctness |
| 55 if result['forceinclusion']: | 55 if result['forceinclusion']: |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 93 else: | 93 else: |
| 94 return MySQLdb.connect(user=dbuser, passwd=dbpasswd, db=database, | 94 return MySQLdb.connect(user=dbuser, passwd=dbpasswd, db=database, |
| 95 use_unicode=True, charset='utf8') | 95 use_unicode=True, charset='utf8') |
| 96 | 96 |
| 97 if __name__ == '__main__': | 97 if __name__ == '__main__': |
| 98 setupStderr() | 98 setupStderr() |
| 99 | 99 |
| 100 domains = getTopDomains() | 100 domains = getTopDomains() |
| 101 for domain in domains: | 101 for domain in domains: |
| 102 print domain.encode('utf-8') | 102 print domain.encode('utf-8') |
| LEFT | RIGHT |