/
vshmidt
/
pytorch
Обзор
Документация
Войти
/
vshmidt
/
pytorch
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
tools/test/docstring_linter_testdata/python_code.py.txt.json
57 строк
5 KB
Tom Ritchford
docstring_linter: Fix #151692 and other issues (#156596)
25 авг 2025, 19:04
25 авг 2025, 19:04
83283ce
Код
Авторство
О чём код?
[ { "char": 0, "code": "DOCSTRING_LINTER", "description": null, "line": 17, "name": "No docstring found for class 'LongWithoutDocstring' (6 lines)", "original": null, "path": "tools/test/docstring_linter_testdata/python_code.py.txt", "replacement": null, "severity": "error" }, { "char": 0, "code": "DOCSTRING_LINTER", "description": null, "line": 24, "name": "docstring found for class 'LongWithShortDocstring' (6 lines) was too short (10 characters, needed 16)", "original": null, "path": "tools/test/docstring_linter_testdata/python_code.py.txt", "replacement": null, "severity": "error" }, { "char": 0, "code": "DOCSTRING_LINTER", "description": null, "line": 54, "name": "No docstring found for function 'long_without_docstring' (7 lines)", "original": null, "path": "tools/test/docstring_linter_testdata/python_code.py.txt", "replacement": null, "severity": "error" }, { "char": 4, "code": "DOCSTRING_LINTER", "description": null, "line": 71, "name": "No docstring found for function 'needs_docs' (12 lines). If the method overrides a method on a parent class, adding the `@typing_extensions.override` decorator will make this error go away.", "original": null, "path": "tools/test/docstring_linter_testdata/python_code.py.txt", "replacement": null, "severity": "error" }, { "char": null, "code": "DOCSTRING_LINTER", "description": null, "line": null, "name": "Suggested fixes for docstring_linter", "original": "class ShortWithDocstring:\n \"\"\"This docstring, while short, is enough\"\"\"\n pass\n\n\nclass Short:\n pass\n\n\nclass LongWithDocstring:\n \"\"\"This docstring, while short, is enough\"\"\"\n\n def short1(self):\n pass\n\n\nclass LongWithoutDocstring:\n # A comment isn't a docstring\n\n def short1(self):\n pass\n\n\nclass LongWithShortDocstring:\n \"\"\"TODO\"\"\"\n\n def short1(self):\n pass\n\n\nclass _Protected:\n \"\"\"TODO\"\"\"\n\n def short1(self):\n pass\n\n\ndef short():\n #\n #\n #\n pass\n\n\ndef long():\n \"\"\"This docstring, while short, is enough\"\"\"\n #\n #\n #\n #\n pass\n\n\ndef long_without_docstring():\n #\n #\n #\n #\n pass\n\n\nclass ImpossibleCombo(\n set,\n tuple,\n int,\n):\n # We could have comments\n # before the doc comment\n \"\"\"This docstring, while short, is enough\"\"\"\n\n def needs_docs(self):\n def not_short():\n class Long:\n a = 1\n b = 1\n c = 1\n d = 1\n e = 1\n\n class Short:\n pass\n\n\n@override # Won't work!\nclass NotDocstring:\n def short1(self):\n pass\n\n \"\"\"This is not a docstring\"\"\"\n\n @override\n def long_with_override(self):\n #\n #\n #\n #\n pass\n\n def short2(self):\n pass\n\n def short3(self):\n pass\n\n\n\ndef long_with_omit(): # noqa: docstring_linter\n #\n #\n #\n #\n pass\n", "path": "tools/test/docstring_linter_testdata/python_code.py.txt", "replacement": "class ShortWithDocstring:\n \"\"\"This docstring, while short, is enough\"\"\"\n pass\n\n\nclass Short:\n pass\n\n\nclass LongWithDocstring:\n \"\"\"This docstring, while short, is enough\"\"\"\n\n def short1(self):\n pass\n\n\nclass LongWithoutDocstring:\n # A comment isn't a docstring\n\n def short1(self):\n pass\n\n\nclass LongWithShortDocstring:\n \"\"\"TODO\"\"\"\n\n def short1(self):\n pass\n\n\nclass _Protected:\n \"\"\"TODO\"\"\"\n\n def short1(self):\n pass\n\n\ndef short():\n #\n #\n #\n pass\n\n\ndef long():\n \"\"\"This docstring, while short, is enough\"\"\"\n #\n #\n #\n #\n pass\n\n\ndef long_without_docstring():\n #\n #\n #\n #\n pass\n\n\nclass ImpossibleCombo(\n set,\n tuple,\n int,\n):\n # We could have comments\n # before the doc comment\n \"\"\"This docstring, while short, is enough\"\"\"\n\n def needs_docs(self):\n def not_short():\n class Long:\n a = 1\n b = 1\n c = 1\n d = 1\n e = 1\n\n class Short:\n pass\n\n\n@override # Won't work!\nclass NotDocstring:\n def short1(self):\n pass\n\n \"\"\"This is not a docstring\"\"\"\n\n @override\n def long_with_override(self):\n #\n #\n #\n #\n pass\n\n def short2(self):\n pass\n\n def short3(self):\n pass\n\n\n\ndef long_with_omit(): # noqa: docstring_linter\n #\n #\n #\n #\n pass\n", "severity": "error" } ]