From d5d28da8167af292817584c60cbc084685104f0b Mon Sep 17 00:00:00 2001 From: Ask Solem Date: Mon, 6 Feb 2012 15:55:34 +0000 Subject: [PATCH 1/2] setup.py: Use setuptools if available, for 'develop' command --- setup.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index c69328d..aac0a00 100755 --- a/setup.py +++ b/setup.py @@ -1,4 +1,7 @@ -from distutils.core import setup +try: + from setuptools import setup +except ImportError: + from distutils.core import setup README = open('README').read() From 00bce8b2bc96803831d5708b224b6dd41951a9c0 Mon Sep 17 00:00:00 2001 From: Ask Solem Date: Mon, 6 Feb 2012 16:12:46 +0000 Subject: [PATCH 2/2] Allows 3 arity form of raise --- flake8/pep8.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/flake8/pep8.py b/flake8/pep8.py index 2eeee6d..37d5042 100644 --- a/flake8/pep8.py +++ b/flake8/pep8.py @@ -117,6 +117,7 @@ MAX_LINE_LENGTH = 79 INDENT_REGEX = re.compile(r'([ \t]*)') RAISE_COMMA_REGEX = re.compile(r'raise\s+\w+\s*(,)') +QUOTED_REGEX = re.compile(r"""([""'])(?:(?=(\\?))\2.)*?\1""") SELFTEST_REGEX = re.compile(r'(Okay|[EW]\d{3}):\s(.*)') ERRORCODE_REGEX = re.compile(r'[EW]\d{3}') DOCSTRING_REGEX = re.compile(r'u?r?["\']') @@ -690,7 +691,10 @@ def python_3000_raise_comma(logical_line): """ match = RAISE_COMMA_REGEX.match(logical_line) if match: - return match.start(1), "W602 deprecated form of raising exception" + rest = QUOTED_REGEX.sub("", logical_line) + # but allow three argument form of raise + if rest.count(",") == 1: + return match.start(1), "W602 deprecated form of raising exception" def python_3000_not_equal(logical_line):