##// END OF EJS Templates
check-code: disallow use of dict(key=value) construction...
Augie Fackler -
r20688:a61ed1c2 default
parent child Browse files
Show More
@@ -200,6 +200,8 pypats = [
200 200 'use "import foo.bar" on its own line instead.'),
201 201 (r'(?<!def)\s+(cmp)\(', "cmp is not available in Python 3+"),
202 202 (r'\breduce\s*\(.*', "reduce is not available in Python 3+"),
203 (r'dict\(.*=', 'dict() is different in Py2 and 3 and is slower than {}',
204 'dict-from-generator'),
203 205 (r'\.has_key\b', "dict.has_key is not available in Python 3+"),
204 206 (r'\s<>\s', '<> operator is not available in Python 3+, use !='),
205 207 (r'^\s*\t', "don't use tabs"),
@@ -30,7 +30,8 class remotestore(basestore.basestore):
30 30 % (source, util.hidepassword(self.url)))
31 31
32 32 def exists(self, hashes):
33 return dict((h, s == 0) for (h, s) in self._stat(hashes).iteritems())
33 return dict((h, s == 0) for (h, s) in # dict-from-generator
34 self._stat(hashes).iteritems())
34 35
35 36 def sendfile(self, filename, hash):
36 37 self.ui.debug('remotestore: sendfile(%s, %s)\n' % (filename, hash))
@@ -97,4 +98,3 class remotestore(basestore.basestore):
97 98 def batch(self):
98 99 '''Support for remote batching.'''
99 100 return remotebatch(self)
100
@@ -123,6 +123,7
123 123 $ cat > python3-compat.py << EOF
124 124 > foo <> bar
125 125 > reduce(lambda a, b: a + b, [1, 2, 3, 4])
126 > dict(key=value)
126 127 > EOF
127 128 $ "$check_code" python3-compat.py
128 129 python3-compat.py:1:
@@ -131,6 +132,9
131 132 python3-compat.py:2:
132 133 > reduce(lambda a, b: a + b, [1, 2, 3, 4])
133 134 reduce is not available in Python 3+
135 python3-compat.py:3:
136 > dict(key=value)
137 dict() is different in Py2 and 3 and is slower than {}
134 138 [1]
135 139
136 140 $ cat > is-op.py <<EOF
General Comments 0
You need to be logged in to leave comments. Login now