~ubuntu-cloud-archive/ubuntu/precise/nova/trunk

« back to all changes in this revision

Viewing changes to tools/hacking.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short, Chuck Short, Adam Gandelman
  • Date: 2012-06-22 12:39:57 UTC
  • mfrom: (1.1.57)
  • Revision ID: package-import@ubuntu.com-20120622123957-hbzwg84nt9rqwg8r
Tags: 2012.2~f2~20120621.14517-0ubuntu1
[ Chuck Short ]
* New upstream version.

[ Adam Gandelman ]
* debian/rules: Temporarily disable test suite while blocking
  tests are investigated. 
* debian/patches/kombu_tests_timeout.patch: Dropped.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
import re
28
28
import sys
29
29
import tokenize
30
 
import traceback
31
30
import warnings
32
31
 
33
32
import pep8
49
48
 
50
49
 
51
50
def is_import_exception(mod):
52
 
    return mod in IMPORT_EXCEPTIONS or \
53
 
        any(mod.startswith(m + '.') for m in IMPORT_EXCEPTIONS)
 
51
    return (mod in IMPORT_EXCEPTIONS or
 
52
            any(mod.startswith(m + '.') for m in IMPORT_EXCEPTIONS))
54
53
 
55
54
 
56
55
def import_normalize(line):
62
61
           split_line[1] != "__future__" and
63
62
           (len(split_line) == 4 or
64
63
           (len(split_line) == 6 and split_line[4] == "as"))):
65
 
        mod = split_line[3]
66
64
        return "import %s.%s" % (split_line[1], split_line[3])
67
65
    else:
68
66
        return line
116
114
    """
117
115
    pos = logical_line.find(',')
118
116
    parts = logical_line.split()
119
 
    if pos > -1 and (parts[0] == "import" or
120
 
       parts[0] == "from" and parts[2] == "import") and \
121
 
       not is_import_exception(parts[1]):
 
117
    if (pos > -1 and (parts[0] == "import" or
 
118
                      parts[0] == "from" and parts[2] == "import") and
 
119
        not is_import_exception(parts[1])):
122
120
        return pos, "NOVA N301: one import per line"
123
121
 
124
122
_missingImport = set([])