From e59ffcfa8138a0daa659a9a2786790336a2a49c4 Mon Sep 17 00:00:00 2001 From: "Q.hongtao" Date: Mon, 21 Sep 2020 16:17:00 +0800 Subject: [PATCH] Remove check V320 in PY3 Remove checks:no_direct_use_of_unicode_function, there is no unicode builtin in python3. Change-Id: Ief8c922637e562fcab20f3c97b496b950c7f36ea --- HACKING.rst | 1 - tox.ini | 1 - vitrage/hacking/checks.py | 10 ---------- vitrage/tests/unit/hacking/test_hacking.py | 13 ------------- 4 files changed, 25 deletions(-) diff --git a/HACKING.rst b/HACKING.rst index b69ad91e0..4281ddbbe 100644 --- a/HACKING.rst +++ b/HACKING.rst @@ -10,7 +10,6 @@ Vitrage Specific Commandments [V317] assertEqual(type(A), B) sentences not allowed [V318] assertEqual(A, None) or assertEqual(None, A) sentences not allowed [V319] Don't translate logs -[V320] Use six.text_type() instead of unicode() [V321] contextlib.nested is deprecated [V322] use a dict comprehension instead of a dict constructor with a sequence of key-value pairs [V323] Do not use xrange. Use range, or six.moves.range diff --git a/tox.ini b/tox.ini index 89d9e3ac7..7ed578f07 100644 --- a/tox.ini +++ b/tox.ini @@ -73,7 +73,6 @@ extension = V329 = checks:check_assert_true_false V317 = checks:assert_equal_type V319 = checks:no_translate_logs - V320 = checks:no_direct_use_of_unicode_function V327 = checks:no_mutable_default_args V321 = checks:check_no_contextlib_nested V322 = checks:dict_constructor_with_list_copy diff --git a/vitrage/hacking/checks.py b/vitrage/hacking/checks.py index 74f5af466..9fca9972f 100644 --- a/vitrage/hacking/checks.py +++ b/vitrage/hacking/checks.py @@ -70,16 +70,6 @@ def no_translate_logs(logical_line): yield (0, "V319: Don't translate logs") -@core.flake8ext -def no_direct_use_of_unicode_function(logical_line): - """Check for use of unicode() builtin - - V320 - """ - if unicode_func_re.match(logical_line): - yield(0, "V320: Use six.text_type() instead of unicode()") - - @core.flake8ext def check_no_contextlib_nested(logical_line): msg = ("V321: contextlib.nested is deprecated since Python 2.7. See " diff --git a/vitrage/tests/unit/hacking/test_hacking.py b/vitrage/tests/unit/hacking/test_hacking.py index e089234e4..9de8fb0b1 100644 --- a/vitrage/tests/unit/hacking/test_hacking.py +++ b/vitrage/tests/unit/hacking/test_hacking.py @@ -48,19 +48,6 @@ class HackingTestCase(base.BaseTest): self.assertThat(list(checks.no_translate_logs(bad)), matchers.HasLength(1)) - def test_no_direct_use_of_unicode_function(self): - self.assertThat(list(checks.no_direct_use_of_unicode_function( - "unicode('the party don't start til the unicode walks in')")), - matchers.HasLength(1)) - self.assertThat(list(checks.no_direct_use_of_unicode_function( - """unicode('something ' - 'something else""")), matchers.HasLength(1)) - self.assertThat(list(checks.no_direct_use_of_unicode_function( - "six.text_type('party over')")), IsEmpty()) - self.assertThat(list(checks.no_direct_use_of_unicode_function( - "not_actually_unicode('something completely different')")), - IsEmpty()) - def test_no_contextlib_nested(self): self.assertThat(list(checks.check_no_contextlib_nested( "with contextlib.nested(")), matchers.HasLength(1))