LEFT | RIGHT |
1 # This file is part of Adblock Plus <https://adblockplus.org/>, | 1 # This file is part of Adblock Plus <https://adblockplus.org/>, |
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 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 if line_number <= 2 and re.search(r'^\s*#.*coding[:=]', physical_line): | 372 if line_number <= 2 and re.search(r'^\s*#.*coding[:=]', physical_line): |
373 return (0, 'A303 non-default file encoding') | 373 return (0, 'A303 non-default file encoding') |
374 | 374 |
375 check_non_default_encoding.name = 'abp-non-default-encoding' | 375 check_non_default_encoding.name = 'abp-non-default-encoding' |
376 check_non_default_encoding.version = __version__ | 376 check_non_default_encoding.version = __version__ |
377 | 377 |
378 | 378 |
379 def check_quotes(logical_line, tokens, previous_logical, checker_state): | 379 def check_quotes(logical_line, tokens, previous_logical, checker_state): |
380 first_token = True | 380 first_token = True |
381 | 381 |
382 # check if in unicode_literals mode | |
383 token_strings = [t[1] for t in tokens] | 382 token_strings = [t[1] for t in tokens] |
384 future_import = token_strings[:3] == ['from', '__future__', 'import'] | 383 future_import = token_strings[:3] == ['from', '__future__', 'import'] |
385 | 384 |
386 if future_import and 'unicode_literals' in token_strings: | 385 if future_import and 'unicode_literals' in token_strings: |
387 checker_state['has_unicode_literals'] = True | 386 checker_state['has_unicode_literals'] = True |
388 | 387 |
389 for kind, token, start, end, _ in tokens: | 388 for kind, token, start, end, _ in tokens: |
390 if kind == tokenize.INDENT or kind == tokenize.DEDENT: | 389 if kind == tokenize.INDENT or kind == tokenize.DEDENT: |
391 continue | 390 continue |
392 | 391 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 if tokens[i + 1][:2] != (tokenize.OP, ':'): | 476 if tokens[i + 1][:2] != (tokenize.OP, ':'): |
478 break | 477 break |
479 | 478 |
480 return [(pos, 'A111 redundant parenthesis for {} ' | 479 return [(pos, 'A111 redundant parenthesis for {} ' |
481 'statement'.format(statement))] | 480 'statement'.format(statement))] |
482 | 481 |
483 return [] | 482 return [] |
484 | 483 |
485 check_redundant_parenthesis.name = 'abp-redundant-parenthesis' | 484 check_redundant_parenthesis.name = 'abp-redundant-parenthesis' |
486 check_redundant_parenthesis.version = __version__ | 485 check_redundant_parenthesis.version = __version__ |
LEFT | RIGHT |