diff --git a/src/pydocstyle/checker.py b/src/pydocstyle/checker.py index 5f7847d5..294a8ce2 100644 --- a/src/pydocstyle/checker.py +++ b/src/pydocstyle/checker.py @@ -385,23 +385,6 @@ def check_backslashes(self, definition, docstring): and not docstring.startswith(('r', 'ur'))): return violations.D301() - @check_for(Definition) - def check_unicode_docstring(self, definition, docstring): - r'''D302: Use u""" for docstrings with Unicode. - - For Unicode docstrings, use u"""Unicode triple-quoted strings""". - - ''' - if 'unicode_literals' in definition.module.future_imports: - return - - # Just check that docstring is unicode, check_triple_double_quotes - # ensures the correct quotes. - if docstring and sys.version_info[0] <= 2: - if not is_ascii(docstring) and not docstring.startswith( - ('u', 'ur')): - return violations.D302() - @staticmethod def _check_ends_with(docstring, chars, violation): """First line ends with one of `chars`. @@ -453,13 +436,7 @@ def check_imperative_mood(self, function, docstring): # def context if check_word in IMPERATIVE_BLACKLIST: return violations.D401b(first_word) - try: - correct_forms = IMPERATIVE_VERBS.get(stem(check_word)) - except UnicodeDecodeError: - # This is raised when the docstring contains unicode - # characters in the first word, but is not a unicode - # string. In which case D302 will be reported. Ignoring. - return + correct_forms = IMPERATIVE_VERBS.get(stem(check_word)) if correct_forms and check_word not in correct_forms: best = max( diff --git a/src/pydocstyle/violations.py b/src/pydocstyle/violations.py index 44ff1949..f9f02f1e 100644 --- a/src/pydocstyle/violations.py +++ b/src/pydocstyle/violations.py @@ -214,7 +214,7 @@ def to_rst(cls) -> str: D300 = D3xx.create_error('D300', 'Use """triple double quotes"""', 'found {0}-quotes') D301 = D3xx.create_error('D301', 'Use r""" if any backslashes in a docstring') -D302 = D3xx.create_error('D302', 'Use u""" for Unicode docstrings') +D302 = D3xx.create_error('D302', 'Deprecated: Use u""" for Unicode docstrings') D4xx = ErrorRegistry.create_group('D4', 'Docstring Content Issues') D400 = D4xx.create_error('D400', 'First line should end with a period', diff --git a/src/tests/test_cases/test.py b/src/tests/test_cases/test.py index 3df3aba3..3d671e59 100644 --- a/src/tests/test_cases/test.py +++ b/src/tests/test_cases/test.py @@ -279,16 +279,6 @@ def exceptions_of_D301(): """ -if sys.version_info[0] <= 2: - @expect('D302: Use u""" for Unicode docstrings') - def unicode_unmarked(): - """Юникод.""" - - @expect('D302: Use u""" for Unicode docstrings') - def first_word_has_unicode_byte(): - """あy.""" - - @expect("D400: First line should end with a period (not 'y')") @expect("D415: First line should end with a period, question mark, " "or exclamation point (not 'y')")