Drop redundant hacking check for xrange
xrange no longer exists in Python 3 and it is caught by the core check (as an undefined method). Change-Id: If3a579f0e6cb4883c2d560a5e12fd5c4f56297f4 Signed-off-by: Takashi Kajinami <kajinamit@oss.nttdata.com>
This commit is contained in:
committed by
Goutham Pacha Ravi
parent
b6243320e4
commit
3530f4ab98
@@ -16,7 +16,6 @@ Manila Specific Commandments
|
||||
included in translated message.
|
||||
- [M336] Must use a dict comprehension instead of a dict constructor
|
||||
with a sequence of key-value pairs.
|
||||
- [M337] Ensure to not use xrange().
|
||||
- [M338] Ensure to not use LOG.warn().
|
||||
- [M354] Use oslo_utils.uuidutils to generate UUID instead of uuid4().
|
||||
- [M359] Validate that log messages are not translated.
|
||||
|
||||
@@ -47,7 +47,6 @@ underscore_import_check_multi = re.compile(r"(.)*import (.)*_, (.)*")
|
||||
# We need this for cases where they have created their own _ function.
|
||||
custom_underscore_check = re.compile(r"(.)*_\s*=\s*(.)*")
|
||||
dict_constructor_with_list_copy_re = re.compile(r".*\bdict\((\[)?(\(|\[)")
|
||||
assert_no_xrange_re = re.compile(r"\s*xrange\s*\(")
|
||||
assert_True = re.compile(r".*assertEqual\(True, .*\)")
|
||||
no_log_warn = re.compile(r"\s*LOG.warn\(.*")
|
||||
|
||||
@@ -225,12 +224,6 @@ def dict_constructor_with_list_copy(logical_line):
|
||||
yield (0, msg)
|
||||
|
||||
|
||||
@core.flake8ext
|
||||
def no_xrange(logical_line):
|
||||
if assert_no_xrange_re.match(logical_line):
|
||||
yield (0, "M337: Do not use xrange().")
|
||||
|
||||
|
||||
@core.flake8ext
|
||||
def validate_assertTrue(logical_line):
|
||||
if re.match(assert_True, logical_line):
|
||||
|
||||
@@ -222,11 +222,6 @@ class HackingTestCase(test.TestCase):
|
||||
self.assertEqual(0, len(list(checks.dict_constructor_with_list_copy(
|
||||
" self._render_dict(xml, data_el, data.__dict__)"))))
|
||||
|
||||
def test_no_xrange(self):
|
||||
self.assertEqual(1, len(list(checks.no_xrange("xrange(45)"))))
|
||||
|
||||
self.assertEqual(0, len(list(checks.no_xrange("range(45)"))))
|
||||
|
||||
def test_validate_assertTrue(self):
|
||||
test_value = True
|
||||
self.assertEqual(0, len(list(checks.validate_assertTrue(
|
||||
|
||||
Reference in New Issue
Block a user