summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Sassoulas <pierre.sassoulas@gmail.com>2021-12-31 14:25:01 +0100
committerPierre Sassoulas <pierre.sassoulas@gmail.com>2022-01-10 23:19:39 +0100
commit60916f9a861610a72606e54f33d86ed408b92868 (patch)
tree011517f284d4c00bf8a27f220c1878af59dcddd2
parentfb17a6e7dae15cd3a0aa35c6a0679fbe11603fc8 (diff)
downloadpylint-git-60916f9a861610a72606e54f33d86ed408b92868.tar.gz
Better capitalization in docstring, fixed number of char per line
-rwxr-xr-xdoc/exts/pylint_extensions.py6
-rwxr-xr-xdoc/exts/pylint_features.py4
-rw-r--r--doc/user_guide/message-control.rst16
-rw-r--r--examples/deprecation_checker.py9
-rw-r--r--pylint/__init__.py8
-rw-r--r--pylint/__pkginfo__.py2
-rw-r--r--pylint/checkers/classes/special_methods_checker.py10
-rw-r--r--pylint/checkers/ellipsis_checker.py15
-rw-r--r--pylint/checkers/mapreduce_checker.py6
-rw-r--r--pylint/checkers/refactoring/implicit_booleaness_checker.py11
-rw-r--r--pylint/checkers/refactoring/recommendation_checker.py6
-rw-r--r--pylint/checkers/refactoring/refactoring_checker.py80
-rw-r--r--pylint/checkers/stdlib.py1
-rw-r--r--pylint/checkers/strings.py17
-rw-r--r--pylint/checkers/threading_checker.py2
-rw-r--r--pylint/checkers/unsupported_version.py16
-rw-r--r--pylint/config/config_initialization.py4
-rw-r--r--pylint/config/configuration_mixin.py4
-rw-r--r--pylint/config/find_default_config_files.py4
-rw-r--r--pylint/config/man_help_formatter.py2
-rwxr-xr-xpylint/epylint.py6
-rw-r--r--pylint/extensions/__init__.py2
-rw-r--r--pylint/extensions/_check_docs_utils.py14
-rw-r--r--pylint/extensions/broad_try_clause.py6
-rw-r--r--pylint/extensions/check_elif.py6
-rw-r--r--pylint/extensions/code_style.py5
-rw-r--r--pylint/extensions/comparetozero.py5
-rw-r--r--pylint/extensions/comparison_placement.py6
-rw-r--r--pylint/extensions/confusing_elif.py4
-rw-r--r--pylint/extensions/docparams.py24
-rw-r--r--pylint/extensions/docstyle.py2
-rw-r--r--pylint/extensions/emptystring.py7
-rw-r--r--pylint/extensions/for_any_all.py5
-rw-r--r--pylint/extensions/typing.py7
-rw-r--r--pylint/lint/parallel.py14
-rw-r--r--pylint/message/message.py2
-rw-r--r--pylint/message/message_definition_store.py14
-rw-r--r--pylint/message/message_id_store.py18
-rw-r--r--pylint/pyreverse/dot_printer.py7
-rw-r--r--pylint/pyreverse/mermaidjs_printer.py13
-rw-r--r--pylint/pyreverse/plantuml_printer.py9
-rw-r--r--pylint/reporters/json_reporter.py4
-rw-r--r--pylint/reporters/reports_handler_mix_in.py14
-rw-r--r--pylint/testutils/__init__.py2
-rw-r--r--pylint/testutils/configuration_test.py2
-rw-r--r--pylint/testutils/decorator.py4
-rw-r--r--pylint/testutils/functional/lint_module_output_update.py4
-rw-r--r--pylint/testutils/lint_module_test.py4
-rw-r--r--pylint/testutils/output_line.py21
-rw-r--r--pylint/testutils/primer.py17
-rw-r--r--pylint/testutils/pyreverse.py1
-rw-r--r--pylint/typing.py10
-rw-r--r--pylint/utils/docs.py8
-rw-r--r--pylint/utils/file_state.py12
-rw-r--r--pylint/utils/linterstats.py52
-rw-r--r--pylint/utils/pragma_parser.py6
-rw-r--r--script/bump_changelog.py4
-rw-r--r--script/fix_documentation.py7
-rw-r--r--script/get_unused_message_id_category.py4
-rw-r--r--tests/checkers/unittest_design.py7
-rw-r--r--tests/checkers/unittest_format.py17
-rw-r--r--tests/checkers/unittest_similar.py2
-rw-r--r--tests/checkers/unittest_stdlib.py7
-rw-r--r--tests/checkers/unittest_typecheck.py2
-rw-r--r--tests/checkers/unittest_utils.py2
-rw-r--r--tests/checkers/unittest_variables.py7
-rw-r--r--tests/config/file_to_lint.py2
-rw-r--r--tests/config/test_functional_config_loading.py4
-rw-r--r--tests/config/unittest_config.py7
-rw-r--r--tests/conftest.py2
-rwxr-xr-xtests/data/ascript4
-rw-r--r--tests/data/clientmodule_test.py6
-rw-r--r--tests/data/property_pattern.py4
-rw-r--r--tests/data/suppliermodule_test.py2
-rw-r--r--tests/extensions/test_check_docs_utils.py6
-rw-r--r--tests/functional/a/abstract/abstract_abc_methods.py8
-rw-r--r--tests/functional/a/abstract/abstract_class_instantiated.py29
-rw-r--r--tests/functional/a/abstract/abstract_method.py28
-rw-r--r--tests/functional/a/access/access_attr_before_def_false_positive.py28
-rw-r--r--tests/functional/a/access/access_member_before_definition.py4
-rw-r--r--tests/functional/a/access/access_to__name__.py9
-rw-r--r--tests/functional/a/access/access_to_protected_members.py89
-rw-r--r--tests/functional/a/access/access_to_protected_members_typing.py4
-rw-r--r--tests/functional/a/anomalous_backslash_escape.py2
-rw-r--r--tests/functional/a/anomalous_unicode_escape.py2
-rw-r--r--tests/functional/a/arguments.py20
-rw-r--r--tests/functional/a/arguments_differ.py50
-rw-r--r--tests/functional/a/arguments_differ_issue5371.py6
-rw-r--r--tests/functional/a/arguments_out_of_order.py6
-rw-r--r--tests/functional/a/assert_on_tuple.py2
-rw-r--r--tests/functional/a/assign/assign_to_new_keyword.py2
-rw-r--r--tests/functional/a/assign/assigning_non_slot.py29
-rw-r--r--tests/functional/a/assign/assignment_expression.py2
-rw-r--r--tests/functional/a/assign/assignment_from_no_return.py18
-rw-r--r--tests/functional/a/assign/assignment_from_no_return_2.py31
-rw-r--r--tests/functional/a/async_functions.py2
-rw-r--r--tests/functional/b/bad_exception_context.py11
-rw-r--r--tests/functional/b/bad_inline_option.py2
-rw-r--r--tests/functional/b/bad_option_value.py3
-rw-r--r--tests/functional/b/bad_reversed_sequence.py19
-rw-r--r--tests/functional/b/bad_reversed_sequence_py37.py2
-rw-r--r--tests/functional/b/bad_reversed_sequence_py38.py4
-rw-r--r--tests/functional/b/bad_string_format_type.py2
-rw-r--r--tests/functional/b/base_init_vars.py9
-rw-r--r--tests/functional/b/builtin_module_test.py4
-rw-r--r--tests/functional/c/cellvar_escaping_loop.py17
-rw-r--r--tests/functional/c/class_attributes.py8
-rw-r--r--tests/functional/c/class_members_py30.py20
-rw-r--r--tests/functional/c/class_protocol_ellipsis.py4
-rw-r--r--tests/functional/c/class_scope.py20
-rw-r--r--tests/functional/c/classes_meth_could_be_a_function.py7
-rw-r--r--tests/functional/c/classes_protected_member_access.py6
-rw-r--r--tests/functional/c/comparison_with_callable_typing_constants.py12
-rw-r--r--tests/functional/c/condition_evals_to_constant.py4
-rw-r--r--tests/functional/c/confidence_filter.py2
-rw-r--r--tests/functional/c/consider/consider_merging_isinstance.py4
-rw-r--r--tests/functional/c/consider/consider_using_f_string.py7
-rw-r--r--tests/functional/c/consider/consider_using_with.py32
-rw-r--r--tests/functional/c/consider/consider_using_with_open.py16
-rw-r--r--tests/functional/c/control_pragmas.py2
-rw-r--r--tests/functional/c/crash_missing_module_type.py12
-rw-r--r--tests/functional/c/ctor_arguments.py6
-rw-r--r--tests/functional/d/dangerous_default_value.py35
-rw-r--r--tests/functional/d/dataclass_with_default_factory.py4
-rw-r--r--tests/functional/d/dataclass_with_field.py4
-rw-r--r--tests/functional/d/decorator_scope.py4
-rw-r--r--tests/functional/d/deprecated/deprecated_methods_py3.py2
-rw-r--r--tests/functional/d/deprecated/deprecated_methods_py36.py2
-rw-r--r--tests/functional/d/deprecated/deprecated_methods_py38.py2
-rw-r--r--tests/functional/d/disable_msg_next_line.py2
-rw-r--r--tests/functional/d/disable_ungrouped_imports.py4
-rw-r--r--tests/functional/d/disable_wrong_import_order.py6
-rw-r--r--tests/functional/d/disabled_msgid_in_pylintrc.py2
-rw-r--r--tests/functional/d/docstrings.py10
-rw-r--r--tests/functional/d/dotted_ancestor.py4
-rw-r--r--tests/functional/d/duplicate_bases.py4
-rw-r--r--tests/functional/d/duplicate_dict_literal_key.py4
-rw-r--r--tests/functional/e/e1101_9588_base_attr_aug_assign.py19
-rw-r--r--tests/functional/e/empty_docstring.py5
-rw-r--r--tests/functional/e/enum_subclasses.py4
-rw-r--r--tests/functional/e/eval_used.py4
-rw-r--r--tests/functional/e/external_classmethod_crash.py11
-rw-r--r--tests/functional/ext/check_elif/check_elif.py4
-rw-r--r--tests/functional/ext/code_style/cs_py_version_35.py2
-rw-r--r--tests/functional/ext/comparison_placement/misplaced_comparison_constant.py10
-rw-r--r--tests/functional/ext/confusing_elif/confusing_elif.py52
-rw-r--r--tests/functional/ext/docparams/docparams.py16
-rw-r--r--tests/functional/ext/docparams/missing_param_doc.py11
-rw-r--r--tests/functional/ext/docparams/parameter/missing_param_doc.py5
-rw-r--r--tests/functional/ext/docparams/parameter/missing_param_doc_required.py21
-rw-r--r--tests/functional/ext/docparams/parameter/missing_param_doc_required_Google.py129
-rw-r--r--tests/functional/ext/docparams/parameter/missing_param_doc_required_Numpy.py62
-rw-r--r--tests/functional/ext/docparams/parameter/missing_param_doc_required_Sphinx.py101
-rw-r--r--tests/functional/ext/docparams/parameter/missing_param_doc_required_min_length.py2
-rw-r--r--tests/functional/ext/docparams/parameter/missing_param_doc_required_no_doc_rgx_check_init.py8
-rw-r--r--tests/functional/ext/docparams/parameter/missing_param_doc_required_no_doc_rgx_check_none.py10
-rw-r--r--tests/functional/ext/docparams/parameter/missing_param_doc_required_no_doc_rgx_default.py2
-rw-r--r--tests/functional/ext/docparams/parameter/missing_param_doc_required_no_doc_rgx_test_all.py14
-rw-r--r--tests/functional/ext/docparams/raise/missing_raises_doc.py15
-rw-r--r--tests/functional/ext/docparams/raise/missing_raises_doc_Google.py25
-rw-r--r--tests/functional/ext/docparams/raise/missing_raises_doc_Numpy.py25
-rw-r--r--tests/functional/ext/docparams/raise/missing_raises_doc_Sphinx.py8
-rw-r--r--tests/functional/ext/docparams/return/missing_return_doc.py2
-rw-r--r--tests/functional/ext/docparams/return/missing_return_doc_Google.py55
-rw-r--r--tests/functional/ext/docparams/return/missing_return_doc_Numpy.py43
-rw-r--r--tests/functional/ext/docparams/return/missing_return_doc_Sphinx.py30
-rw-r--r--tests/functional/ext/docparams/return/missing_return_doc_required_Google.py20
-rw-r--r--tests/functional/ext/docparams/return/missing_return_doc_required_Numpy.py24
-rw-r--r--tests/functional/ext/docparams/return/missing_return_doc_required_Sphinx.py19
-rw-r--r--tests/functional/ext/docparams/useless_type_doc.py11
-rw-r--r--tests/functional/ext/docparams/yield/missing_yield_doc.py2
-rw-r--r--tests/functional/ext/docparams/yield/missing_yield_doc_Google.py3
-rw-r--r--tests/functional/ext/docparams/yield/missing_yield_doc_Numpy.py2
-rw-r--r--tests/functional/ext/docparams/yield/missing_yield_doc_Sphinx.py3
-rw-r--r--tests/functional/ext/docstyle/docstyle.py21
-rw-r--r--tests/functional/ext/empty_comment/empty_comment.py2
-rw-r--r--tests/functional/ext/for_any_all/for_any_all.py38
-rw-r--r--tests/functional/ext/mccabe/mccabe.py34
-rw-r--r--tests/functional/ext/redefined_variable_type/redefined_variable_type.py2
-rw-r--r--tests/functional/ext/while_used/while_used.py4
-rw-r--r--tests/functional/f/first_arg.py3
-rw-r--r--tests/functional/f/func_disable_linebased.py10
-rw-r--r--tests/functional/f/function_redefined.py51
-rw-r--r--tests/functional/f/future_import.py2
-rw-r--r--tests/functional/g/generic_alias/generic_alias_collections_py37_with_typing.py4
-rw-r--r--tests/functional/g/generic_alias/generic_alias_postponed_evaluation_py37.py4
-rw-r--r--tests/functional/g/generic_alias/generic_alias_side_effects.py12
-rw-r--r--tests/functional/g/genexp_in_class_scope.py2
-rw-r--r--tests/functional/g/genexpr_variable_scope.py5
-rw-r--r--tests/functional/g/globals.py16
-rw-r--r--tests/functional/i/import_error.py2
-rw-r--r--tests/functional/i/import_itself.py2
-rw-r--r--tests/functional/i/inconsistent/inconsistent_quotes.py5
-rw-r--r--tests/functional/i/inconsistent/inconsistent_returns.py30
-rw-r--r--tests/functional/i/inconsistent/inconsistent_returns_noreturn.py17
-rw-r--r--tests/functional/i/inherit_non_class.py22
-rw-r--r--tests/functional/i/init_not_called.py17
-rw-r--r--tests/functional/i/init_return_from_inner_function.py6
-rw-r--r--tests/functional/i/inner_classes.py16
-rw-r--r--tests/functional/i/invalid/b/invalid_bool_returned.py12
-rw-r--r--tests/functional/i/invalid/b/invalid_bytes_returned.py12
-rw-r--r--tests/functional/i/invalid/e/invalid_exceptions_raised.py30
-rw-r--r--tests/functional/i/invalid/g/invalid_getnewargs_ex_returned.py18
-rw-r--r--tests/functional/i/invalid/g/invalid_getnewargs_returned.py12
-rw-r--r--tests/functional/i/invalid/invalid_format_returned.py12
-rw-r--r--tests/functional/i/invalid/invalid_hash_returned.py14
-rw-r--r--tests/functional/i/invalid/invalid_index_returned.py14
-rw-r--r--tests/functional/i/invalid/invalid_name.py12
-rw-r--r--tests/functional/i/invalid/invalid_name_issue_3405.py5
-rw-r--r--tests/functional/i/invalid/invalid_name_module_level.py2
-rw-r--r--tests/functional/i/invalid/invalid_repr_returned.py12
-rw-r--r--tests/functional/i/invalid/l/invalid_length_hint_returned.py12
-rw-r--r--tests/functional/i/invalid/l/invalid_length_returned.py14
-rw-r--r--tests/functional/i/invalid/s/invalid_sequence_index.py72
-rw-r--r--tests/functional/i/invalid/s/invalid_slice_index.py32
-rw-r--r--tests/functional/i/invalid/s/invalid_str_returned.py12
-rw-r--r--tests/functional/i/iterable_context.py7
-rw-r--r--tests/functional/i/iterable_context_py3.py4
-rw-r--r--tests/functional/i/iterable_context_py36.py4
-rw-r--r--tests/functional/k/keyword_arg_before_vararg.py10
-rw-r--r--tests/functional/l/lambda_use_before_assign.py4
-rw-r--r--tests/functional/l/line_endings.py4
-rw-r--r--tests/functional/l/line_too_long.py28
-rw-r--r--tests/functional/l/logging_format_interpolation_py36.py2
-rw-r--r--tests/functional/l/logging_format_interpolation_style.py2
-rw-r--r--tests/functional/l/logging_fstring_interpolation_py36.py2
-rw-r--r--tests/functional/l/logging_fstring_interpolation_py37.py2
-rw-r--r--tests/functional/l/logging_not_lazy.py2
-rw-r--r--tests/functional/l/logging_too_few_args.py2
-rw-r--r--tests/functional/l/logging_too_many_args.py2
-rw-r--r--tests/functional/l/long_utf8_lines.py2
-rw-r--r--tests/functional/m/mapping_context.py4
-rw-r--r--tests/functional/m/member/member_checks.py21
-rw-r--r--tests/functional/m/metaclass_attr_access.py6
-rw-r--r--tests/functional/m/method_hidden.py13
-rw-r--r--tests/functional/m/misplaced_format_function.py12
-rw-r--r--tests/functional/m/missing/missing_class_docstring.py2
-rw-r--r--tests/functional/m/missing/missing_function_docstring.py4
-rw-r--r--tests/functional/m/missing/missing_function_docstring_min_length.py2
-rw-r--r--tests/functional/m/missing/missing_function_docstring_rgx.py2
-rw-r--r--tests/functional/m/missing/missing_module_docstring_disabled.py2
-rw-r--r--tests/functional/m/mixin_class_rgx.py16
-rw-r--r--tests/functional/m/monkeypatch_method.py6
-rw-r--r--tests/functional/m/multiple_statements.py2
-rw-r--r--tests/functional/n/name/name_final.py2
-rw-r--r--tests/functional/n/name/name_styles.py13
-rw-r--r--tests/functional/n/name/names_in__all__.py9
-rw-r--r--tests/functional/n/nested_func_defined_in_loop.py2
-rw-r--r--tests/functional/n/new_style_class_py_30.py11
-rw-r--r--tests/functional/n/no/no_classmethod_decorator.py17
-rw-r--r--tests/functional/n/no/no_else_break.py2
-rw-r--r--tests/functional/n/no/no_else_continue.py2
-rw-r--r--tests/functional/n/no/no_else_raise.py2
-rw-r--r--tests/functional/n/no/no_else_return.py2
-rw-r--r--tests/functional/n/no/no_member_dataclasses.py7
-rw-r--r--tests/functional/n/no/no_member_imports.py7
-rw-r--r--tests/functional/n/no/no_member_subclassed_dataclasses.py4
-rw-r--r--tests/functional/n/no/no_name_in_module.py2
-rw-r--r--tests/functional/n/no/no_self_argument.py10
-rw-r--r--tests/functional/n/no/no_self_use.py38
-rw-r--r--tests/functional/n/no/no_staticmethod_decorator.py17
-rw-r--r--tests/functional/n/no/no_warning_docstring.py12
-rw-r--r--tests/functional/n/non/non_ascii_name.py2
-rw-r--r--tests/functional/n/non/non_init_parent_called.py17
-rw-r--r--tests/functional/n/non/non_iterator_returned.py18
-rw-r--r--tests/functional/n/non/non_parent_init_called.py4
-rw-r--r--tests/functional/n/nonexistent_operator.py2
-rw-r--r--tests/functional/n/nonlocal_without_binding.py2
-rw-r--r--tests/functional/n/not_callable.py16
-rw-r--r--tests/functional/n/not_context_manager.py2
-rw-r--r--tests/functional/o/object_as_class_attribute.py17
-rw-r--r--tests/functional/o/overloaded_operator.py2
-rw-r--r--tests/functional/o/overridden_final_method_py38.py2
-rw-r--r--tests/functional/o/overridden_final_method_regression.py5
-rw-r--r--tests/functional/p/postponed_evaluation_pep585.py3
-rw-r--r--tests/functional/p/postponed_evaluation_pep585_error.py4
-rw-r--r--tests/functional/p/postponed_evaluation_pep585_py39.py2
-rw-r--r--tests/functional/p/pragma_after_backslash.py4
-rw-r--r--tests/functional/p/property_affectation_py26.py6
-rw-r--r--tests/functional/p/protected_access.py2
-rw-r--r--tests/functional/p/protected_access_special_methods_off.py9
-rw-r--r--tests/functional/p/protected_access_special_methods_on.py8
-rw-r--r--tests/functional/p/py_version_35.py2
-rw-r--r--tests/functional/r/raise/raising_bad_type.py2
-rw-r--r--tests/functional/r/raise/raising_format_tuple.py31
-rw-r--r--tests/functional/r/raise/raising_non_exception.py4
-rw-r--r--tests/functional/r/recursion/recursion_error_2667.py2
-rw-r--r--tests/functional/r/recursion/recursion_error_2906.py2
-rw-r--r--tests/functional/r/recursion/recursion_error_3152.py2
-rw-r--r--tests/functional/r/recursion/recursion_error_3159.py2
-rw-r--r--tests/functional/r/recursion/recursion_error_crash.py2
-rw-r--r--tests/functional/r/recursion/recursion_error_crash_2683.py2
-rw-r--r--tests/functional/r/recursion/recursion_error_crash_astroid_623.py2
-rw-r--r--tests/functional/r/redefined_builtin.py2
-rw-r--r--tests/functional/r/redundant_u_string_prefix.py2
-rw-r--r--tests/functional/r/redundant_unittest_assert.py13
-rw-r--r--tests/functional/r/regression/regression_3416_unused_argument_raise.py4
-rw-r--r--tests/functional/r/regression/regression_3507_typing_alias_isinstance.py7
-rw-r--r--tests/functional/r/regression/regression_4723.py4
-rw-r--r--tests/functional/r/regression/regression_4891.py8
-rw-r--r--tests/functional/r/regression/regression___file___global.py2
-rw-r--r--tests/functional/r/regression/regression_issue_4631.py4
-rw-r--r--tests/functional/r/regression/regression_issue_4633.py4
-rw-r--r--tests/functional/r/regression/regression_no_member_1078.py2
-rw-r--r--tests/functional/r/regression/regression_no_value_for_parameter.py4
-rw-r--r--tests/functional/r/regression/regression_posonly_args.py4
-rw-r--r--tests/functional/r/regression/regression_property_no_member_3269.py10
-rw-r--r--tests/functional/r/regression/regression_too_many_arguments_2335.py3
-rw-r--r--tests/functional/r/regression_02/regression_4982.py9
-rw-r--r--tests/functional/r/regression_02/regression_5030.py6
-rw-r--r--tests/functional/r/regression_02/regression_5048.py4
-rw-r--r--tests/functional/r/regression_02/regression_5244.py5
-rw-r--r--tests/functional/r/regression_02/regression_5461.py4
-rw-r--r--tests/functional/r/regression_02/regression_distutil_import_error_73.py8
-rw-r--r--tests/functional/r/regression_02/regression_node_statement.py4
-rw-r--r--tests/functional/r/regression_02/regression_node_statement_two.py1
-rw-r--r--tests/functional/r/regression_02/regression_protected_access.py11
-rw-r--r--tests/functional/r/reimport.py5
-rw-r--r--tests/functional/r/reimported.py2
-rw-r--r--tests/functional/r/renamed_import_logging_not_lazy.py2
-rw-r--r--tests/functional/r/repeated_keyword.py2
-rw-r--r--tests/functional/r/return_in_init.py6
-rw-r--r--tests/functional/r/return_outside_function.py2
-rw-r--r--tests/functional/s/self/self_cls_assignment.py16
-rw-r--r--tests/functional/s/shallow_copy_environ.py2
-rw-r--r--tests/functional/s/signature_differs.py2
-rw-r--r--tests/functional/s/simplifiable/simplifiable_condition.py4
-rw-r--r--tests/functional/s/slots_checks.py4
-rw-r--r--tests/functional/s/star/star_needs_assignment_target_py37.py6
-rw-r--r--tests/functional/s/statement_without_effect.py10
-rw-r--r--tests/functional/s/statement_without_effect_py36.py4
-rw-r--r--tests/functional/s/stop_iteration_inside_generator.py8
-rw-r--r--tests/functional/s/string/string_formatting.py65
-rw-r--r--tests/functional/s/string/string_formatting_disable.py2
-rw-r--r--tests/functional/s/string/string_formatting_error.py4
-rw-r--r--tests/functional/s/string/string_formatting_failed_inference.py5
-rw-r--r--tests/functional/s/string/string_formatting_failed_inference_py35.py5
-rw-r--r--tests/functional/s/string/string_log_formatting.py8
-rw-r--r--tests/functional/s/subclassed_final_class_py38.py2
-rw-r--r--tests/functional/s/super/super_checks.py23
-rw-r--r--tests/functional/s/super/super_init_not_called.py10
-rw-r--r--tests/functional/s/super/superfluous_parens_walrus_py38.py3
-rw-r--r--tests/functional/s/symlink/module/__init__.py2
-rw-r--r--tests/functional/s/symlink/module/symlinked_module.py4
-rw-r--r--tests/functional/s/sys_stream_regression_1004.py2
-rw-r--r--tests/functional/t/ternary.py10
-rw-r--r--tests/functional/t/too/too_few_public_methods.py6
-rw-r--r--tests/functional/t/too/too_few_public_methods_excluded.py4
-rw-r--r--tests/functional/t/too/too_many_ancestors_ignored_parents.py12
-rw-r--r--tests/functional/t/too/too_many_arguments.py2
-rw-r--r--tests/functional/t/too/too_many_boolean_expressions.py2
-rw-r--r--tests/functional/t/too/too_many_branches.py10
-rw-r--r--tests/functional/t/too/too_many_function_args.py8
-rw-r--r--tests/functional/t/too/too_many_locals.py2
-rw-r--r--tests/functional/t/too/too_many_nested_blocks.py2
-rw-r--r--tests/functional/t/too/too_many_public_methods.py48
-rw-r--r--tests/functional/t/too/too_many_return_statements.py2
-rw-r--r--tests/functional/t/trailing_whitespaces.py6
-rw-r--r--tests/functional/t/try_except_raise.py8
-rw-r--r--tests/functional/t/typedDict.py2
-rw-r--r--tests/functional/t/typing_generic.py4
-rw-r--r--tests/functional/t/typing_use.py2
-rw-r--r--tests/functional/u/unbalanced_tuple_unpacking.py36
-rw-r--r--tests/functional/u/unbalanced_tuple_unpacking_py30.py7
-rw-r--r--tests/functional/u/undefined/undefined_variable.py59
-rw-r--r--tests/functional/u/undefined/undefined_variable_classes.py2
-rw-r--r--tests/functional/u/undefined/undefined_variable_decorators.py2
-rw-r--r--tests/functional/u/undefined/undefined_variable_py30.py47
-rw-r--r--tests/functional/u/undefined/undefined_variable_py38.py12
-rw-r--r--tests/functional/u/undefined/undefined_variable_typing.py2
-rw-r--r--tests/functional/u/unexpected_keyword_arg.py33
-rw-r--r--tests/functional/u/ungrouped_imports.py2
-rw-r--r--tests/functional/u/ungrouped_imports_isort_compatible.py2
-rw-r--r--tests/functional/u/unnecessary/unnecessary_ellipsis.py29
-rw-r--r--tests/functional/u/unnecessary/unnecessary_lambda.py3
-rw-r--r--tests/functional/u/unnecessary/unnecessary_not.py9
-rw-r--r--tests/functional/u/unnecessary/unnecessary_pass.py27
-rw-r--r--tests/functional/u/unpacking.py9
-rw-r--r--tests/functional/u/unpacking_generalizations.py2
-rw-r--r--tests/functional/u/unpacking_non_sequence.py34
-rw-r--r--tests/functional/u/unrecognized_inline_option.py2
-rw-r--r--tests/functional/u/unspecified_encoding_py38.py12
-rw-r--r--tests/functional/u/unsubscriptable_object.py2
-rw-r--r--tests/functional/u/unsubscriptable_value.py10
-rw-r--r--tests/functional/u/unsubscriptable_value_py37.py6
-rw-r--r--tests/functional/u/unsupported/unsupported_assignment_operation.py6
-rw-r--r--tests/functional/u/unsupported/unsupported_delete_operation.py6
-rw-r--r--tests/functional/u/unsupported/unsupported_version_for_f_string.py2
-rw-r--r--tests/functional/u/unsupported/unsupported_version_for_final.py2
-rw-r--r--tests/functional/u/unused/unused_argument.py40
-rw-r--r--tests/functional/u/unused/unused_import.py2
-rw-r--r--tests/functional/u/unused/unused_import_class_def_keyword.py5
-rw-r--r--tests/functional/u/unused/unused_import_everything_disabled.py2
-rw-r--r--tests/functional/u/unused/unused_import_positional_only_py38.py4
-rw-r--r--tests/functional/u/unused/unused_import_py30.py8
-rw-r--r--tests/functional/u/unused/unused_module.py3
-rw-r--r--tests/functional/u/unused/unused_name_from_wilcard_import.py2
-rw-r--r--tests/functional/u/unused/unused_private_member.py14
-rw-r--r--tests/functional/u/unused/unused_typing_imports.py10
-rw-r--r--tests/functional/u/unused/unused_variable.py10
-rw-r--r--tests/functional/u/unused/unused_variable_py38.py10
-rw-r--r--tests/functional/u/use/use_maxsplit_arg.py2
-rw-r--r--tests/functional/u/use/used_before_assignment.py2
-rw-r--r--tests/functional/u/use/used_before_assignment_488.py3
-rw-r--r--tests/functional/u/use/used_before_assignment_except_handler_for_try_with_return.py5
-rw-r--r--tests/functional/u/use/used_before_assignment_issue2615.py2
-rw-r--r--tests/functional/u/use/used_before_assignment_issue85.py2
-rw-r--r--tests/functional/u/use/used_before_assignment_nonlocal.py25
-rw-r--r--tests/functional/u/use/used_before_assignment_py37.py4
-rw-r--r--tests/functional/u/use/used_before_assignment_typing.py7
-rw-r--r--tests/functional/u/useless/useless_else_on_loop.py13
-rw-r--r--tests/functional/u/useless/useless_object_inheritance.py6
-rw-r--r--tests/functional/u/useless/useless_suppression.py2
-rw-r--r--tests/functional/u/useless/useless_with_lock.py2
-rw-r--r--tests/functional/w/with_used_before_assign.py8
-rw-r--r--tests/functional/w/with_using_generator.py11
-rw-r--r--tests/functional/w/wrong_import_order.py2
-rw-r--r--tests/functional/w/wrong_import_order2.py2
-rw-r--r--tests/functional/w/wrong_import_position.py4
-rw-r--r--tests/functional/w/wrong_import_position10.py4
-rw-r--r--tests/functional/w/wrong_import_position11.py2
-rw-r--r--tests/functional/w/wrong_import_position12.py2
-rw-r--r--tests/functional/w/wrong_import_position13.py2
-rw-r--r--tests/functional/w/wrong_import_position14.py2
-rw-r--r--tests/functional/w/wrong_import_position15.py2
-rw-r--r--tests/functional/w/wrong_import_position2.py2
-rw-r--r--tests/functional/w/wrong_import_position3.py2
-rw-r--r--tests/functional/w/wrong_import_position4.py4
-rw-r--r--tests/functional/w/wrong_import_position6.py2
-rw-r--r--tests/functional/w/wrong_import_position7.py2
-rw-r--r--tests/functional/w/wrong_import_position8.py2
-rw-r--r--tests/functional/w/wrong_import_position9.py2
-rw-r--r--tests/functional/y/yield_assign.py8
-rw-r--r--tests/functional/y/yield_from_iterable.py4
-rw-r--r--tests/functional/y/yield_from_outside_func.py2
-rw-r--r--tests/functional/y/yield_outside_func.py2
-rw-r--r--tests/functional/y/yield_return_mix.py4
-rw-r--r--tests/input/__init__.py2
-rw-r--r--tests/input/func_3k_removed_stuff_py_30.py4
-rw-r--r--tests/input/func_i0011.py3
-rw-r--r--tests/input/func_i0012.py3
-rw-r--r--tests/input/func_i0013.py2
-rw-r--r--tests/input/func_i0014.py2
-rw-r--r--tests/input/func_return_yield_mix_py_33.py6
-rw-r--r--tests/input/func_w0122_py_30.py4
-rw-r--r--tests/input/func_w0401.py3
-rw-r--r--tests/input/func_w0401_disabled.py3
-rw-r--r--tests/input/func_w0401_disabled_in_func.py5
-rw-r--r--tests/input/func_w0801.py4
-rw-r--r--tests/input/not__init__.py2
-rw-r--r--tests/input/similar_lines_a.py5
-rw-r--r--tests/input/similar_lines_b.py7
-rw-r--r--tests/input/w0401_cycle.py3
-rw-r--r--tests/input/w0801_same.py4
-rw-r--r--tests/lint/unittest_expand_modules.py8
-rw-r--r--tests/primer/test_primer_external.py9
-rw-r--r--tests/primer/test_primer_stdlib.py4
-rw-r--r--tests/pyreverse/test_diagrams.py2
-rw-r--r--tests/pyreverse/test_main.py3
-rw-r--r--tests/pyreverse/test_printer_factory.py2
-rw-r--r--tests/pyreverse/test_utils.py22
-rw-r--r--tests/regrtest_data/absimp/__init__.py3
-rw-r--r--tests/regrtest_data/absimp/string.py5
-rw-r--r--tests/regrtest_data/bad_package/__init__.py2
-rw-r--r--tests/regrtest_data/bad_package/wrong.py6
-rw-r--r--tests/regrtest_data/beyond_top/__init__.py2
-rw-r--r--tests/regrtest_data/classdoc_usage.py8
-rw-r--r--tests/regrtest_data/decimal_inference.py4
-rw-r--r--tests/regrtest_data/fail_on.py4
-rw-r--r--tests/regrtest_data/fail_on_info_only.py4
-rw-r--r--tests/regrtest_data/fail_under_minus10.py4
-rw-r--r--tests/regrtest_data/fail_under_plus7_5.py4
-rw-r--r--tests/regrtest_data/func_block_disable_msg.py30
-rw-r--r--tests/regrtest_data/module_global.py3
-rw-r--r--tests/regrtest_data/numarray_import.py2
-rw-r--r--tests/regrtest_data/numarray_inf.py2
-rw-r--r--tests/regrtest_data/package/AudioTime.py2
-rw-r--r--tests/regrtest_data/package/__init__.py4
-rw-r--r--tests/regrtest_data/package/subpackage/__init__.py2
-rw-r--r--tests/regrtest_data/package/subpackage/module.py2
-rw-r--r--tests/regrtest_data/package_all/__init__.py2
-rw-r--r--tests/regrtest_data/package_all/notmissing.py2
-rw-r--r--tests/regrtest_data/wrong_import_position.py4
-rw-r--r--tests/test_epylint.py4
-rw-r--r--tests/test_import_graph.py6
-rw-r--r--tests/test_pylint_runners.py2
-rw-r--r--tests/testutils/data/init_hook.py4
-rw-r--r--tests/testutils/test_decorator.py2
-rw-r--r--tests/testutils/test_output_line.py6
-rw-r--r--tests/unittest_reporters_json.py4
-rw-r--r--tests/unittest_reporting.py11
491 files changed, 2215 insertions, 2391 deletions
diff --git a/doc/exts/pylint_extensions.py b/doc/exts/pylint_extensions.py
index 31678735d..9f9b6a9a9 100755
--- a/doc/exts/pylint_extensions.py
+++ b/doc/exts/pylint_extensions.py
@@ -2,7 +2,9 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-"""Script used to generate the extensions file before building the actual documentation."""
+"""Script used to generate the extensions file before building the actual
+documentation.
+"""
import os
import re
@@ -23,7 +25,7 @@ DEPRECATED_MODULES = ["check_docs"] # ==> docparams
def builder_inited(app):
- """Output full documentation in ReST format for all extension modules"""
+ """Output full documentation in ReST format for all extension modules."""
# PACKAGE/docs/exts/pylint_extensions.py --> PACKAGE/
base_path = os.path.dirname(
os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
diff --git a/doc/exts/pylint_features.py b/doc/exts/pylint_features.py
index a867dd05f..d7bb6c841 100755
--- a/doc/exts/pylint_features.py
+++ b/doc/exts/pylint_features.py
@@ -2,7 +2,9 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-"""Script used to generate the features file before building the actual documentation."""
+"""Script used to generate the features file before building the actual
+documentation.
+"""
import os
diff --git a/doc/user_guide/message-control.rst b/doc/user_guide/message-control.rst
index 0f735e533..f1ab58c06 100644
--- a/doc/user_guide/message-control.rst
+++ b/doc/user_guide/message-control.rst
@@ -112,7 +112,7 @@ Here's an example with all these rules in a single place:
pass
def meth1(self, arg):
- """this issues a message"""
+ """This issues a message"""
print(self)
def meth2(self, arg):
@@ -122,14 +122,14 @@ Here's an example with all these rules in a single place:
+ "foo")
def meth3(self):
- """test one line disabling"""
+ """Test one line disabling"""
# no error
print(self.bla) # pylint: disable=no-member
# error
print(self.blop)
def meth4(self):
- """test re-enabling"""
+ """Test re-enabling"""
# pylint: disable=no-member
# no error
print(self.bla)
@@ -139,7 +139,7 @@ Here's an example with all these rules in a single place:
print(self.blip)
def meth5(self):
- """test IF sub-block re-enabling"""
+ """Test IF sub-block re-enabling"""
# pylint: disable=no-member
# no error
print(self.bla)
@@ -154,7 +154,7 @@ Here's an example with all these rules in a single place:
print(self.blip)
def meth6(self):
- """test TRY/EXCEPT sub-block re-enabling"""
+ """Test TRY/EXCEPT sub-block re-enabling"""
# pylint: disable=no-member
# no error
print(self.bla)
@@ -169,7 +169,7 @@ Here's an example with all these rules in a single place:
print(self.blip)
def meth7(self):
- """test one line block opening disabling"""
+ """Test one line block opening disabling"""
if self.blop: # pylint: disable=no-member
# error
print(self.blip)
@@ -180,7 +180,7 @@ Here's an example with all these rules in a single place:
print(self.blip)
def meth8(self):
- """test late disabling"""
+ """Test late disabling"""
# error
print(self.blip)
# pylint: disable=no-member
@@ -189,7 +189,7 @@ Here's an example with all these rules in a single place:
print(self.blop)
def meth9(self):
- """test next line disabling"""
+ """Test next line disabling"""
# no error
# pylint: disable-next=no-member
print(self.bla)
diff --git a/examples/deprecation_checker.py b/examples/deprecation_checker.py
index 79a728537..d336417f4 100644
--- a/examples/deprecation_checker.py
+++ b/examples/deprecation_checker.py
@@ -1,6 +1,6 @@
-"""Example checker detecting deprecated functions/methods. Following example searches for usages of
-deprecated function `deprecated_function` and deprecated method `MyClass.deprecated_method`
-from module mymodule:
+"""Example checker detecting deprecated functions/methods. Following example searches
+for usages of deprecated function `deprecated_function` and deprecated method
+`MyClass.deprecated_method` from module mymodule:
.. code-block:: console
$ cat mymodule.py
@@ -59,7 +59,8 @@ class DeprecationChecker(DeprecatedMixin, BaseChecker):
name = "deprecated"
def deprecated_methods(self) -> Set[str]:
- """Callback method called by DeprecatedMixin for every method/function found in the code.
+ """Callback method called by DeprecatedMixin for every method/function found in
+ the code.
Returns:
collections.abc.Container of deprecated function/method names.
diff --git a/pylint/__init__.py b/pylint/__init__.py
index 16d81d903..02df46054 100644
--- a/pylint/__init__.py
+++ b/pylint/__init__.py
@@ -19,7 +19,7 @@ from pylint.__pkginfo__ import __version__
def run_pylint(argv: Optional[Sequence[str]] = None):
- """Run pylint
+ """Run pylint.
argv can be a sequence of strings normally supplied as arguments on the command line
"""
@@ -32,7 +32,7 @@ def run_pylint(argv: Optional[Sequence[str]] = None):
def run_epylint(argv: Optional[Sequence[str]] = None):
- """Run epylint
+ """Run epylint.
argv can be a list of strings normally supplied as arguments on the command line
"""
@@ -42,7 +42,7 @@ def run_epylint(argv: Optional[Sequence[str]] = None):
def run_pyreverse(argv: Optional[Sequence[str]] = None):
- """Run pyreverse
+ """Run pyreverse.
argv can be a sequence of strings normally supplied as arguments on the command line
"""
@@ -52,7 +52,7 @@ def run_pyreverse(argv: Optional[Sequence[str]] = None):
def run_symilar(argv: Optional[Sequence[str]] = None):
- """Run symilar
+ """Run symilar.
argv can be a sequence of strings normally supplied as arguments on the command line
"""
diff --git a/pylint/__pkginfo__.py b/pylint/__pkginfo__.py
index b2546d3a1..9e0f1edaa 100644
--- a/pylint/__pkginfo__.py
+++ b/pylint/__pkginfo__.py
@@ -6,7 +6,7 @@ __version__ = "2.13.0-dev0"
def get_numversion_from_version(v: str) -> Tuple:
- """Kept for compatibility reason
+ """Kept for compatibility reason.
See https://github.com/PyCQA/pylint/issues/4399
https://github.com/PyCQA/pylint/issues/4420,
diff --git a/pylint/checkers/classes/special_methods_checker.py b/pylint/checkers/classes/special_methods_checker.py
index f26823007..73c1b3cb5 100644
--- a/pylint/checkers/classes/special_methods_checker.py
+++ b/pylint/checkers/classes/special_methods_checker.py
@@ -1,7 +1,7 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-"""Special methods checker and helper function's module"""
+"""Special methods checker and helper function's module."""
import astroid
from astroid import nodes
@@ -23,8 +23,8 @@ NEXT_METHOD = "__next__"
def _safe_infer_call_result(node, caller, context=None):
"""Safely infer the return value of a function.
- Returns None if inference failed or if there is some ambiguity (more than
- one node has been inferred). Otherwise, returns inferred value.
+ Returns None if inference failed or if there is some ambiguity (more than one node
+ has been inferred). Otherwise, returns inferred value.
"""
try:
inferit = node.infer_call_result(caller, context=context)
@@ -43,9 +43,7 @@ def _safe_infer_call_result(node, caller, context=None):
class SpecialMethodsChecker(BaseChecker):
- """Checker which verifies that special methods
- are implemented correctly.
- """
+ """Checker which verifies that special methods are implemented correctly."""
__implements__ = (IAstroidChecker,)
name = "classes"
diff --git a/pylint/checkers/ellipsis_checker.py b/pylint/checkers/ellipsis_checker.py
index af8715ed5..4e0fd65af 100644
--- a/pylint/checkers/ellipsis_checker.py
+++ b/pylint/checkers/ellipsis_checker.py
@@ -1,4 +1,4 @@
-"""Ellipsis checker for Python code"""
+"""Ellipsis checker for Python code."""
from typing import TYPE_CHECKING
from astroid import nodes
@@ -27,12 +27,13 @@ class EllipsisChecker(BaseChecker):
@check_messages("unnecessary-ellipsis")
def visit_const(self, node: nodes.Const) -> None:
- """Check if the ellipsis constant is used unnecessarily.
- Emit a warning when:
- - A line consisting of an ellipsis is preceded by a docstring.
- - A statement exists in the same scope as the ellipsis.
- For example: A function consisting of an ellipsis followed by a
- return statement on the next line.
+ """Check if the ellipsis constant is used unnecessarily. Emit a warning
+ when:
+
+ - A line consisting of an ellipsis is preceded by a docstring.
+ - A statement exists in the same scope as the ellipsis.
+ For example: A function consisting of an ellipsis followed by a
+ return statement on the next line.
"""
if (
node.pytype() == "builtins.Ellipsis"
diff --git a/pylint/checkers/mapreduce_checker.py b/pylint/checkers/mapreduce_checker.py
index b1722fc9b..a4a2c605c 100644
--- a/pylint/checkers/mapreduce_checker.py
+++ b/pylint/checkers/mapreduce_checker.py
@@ -8,12 +8,12 @@ import abc
class MapReduceMixin(metaclass=abc.ABCMeta):
- """A mixin design to allow multiprocess/threaded runs of a Checker"""
+ """A mixin design to allow multiprocess/threaded runs of a Checker."""
@abc.abstractmethod
def get_map_data(self):
- """Returns mergeable/reducible data that will be examined"""
+ """Returns mergeable/reducible data that will be examined."""
@abc.abstractmethod
def reduce_map_data(self, linter, data):
- """For a given Checker, receives data for all mapped runs"""
+ """For a given Checker, receives data for all mapped runs."""
diff --git a/pylint/checkers/refactoring/implicit_booleaness_checker.py b/pylint/checkers/refactoring/implicit_booleaness_checker.py
index 6167e3e88..fbe56d352 100644
--- a/pylint/checkers/refactoring/implicit_booleaness_checker.py
+++ b/pylint/checkers/refactoring/implicit_booleaness_checker.py
@@ -127,9 +127,8 @@ class ImplicitBooleanessChecker(checkers.BaseChecker):
@utils.check_messages("use-implicit-booleaness-not-len")
def visit_unaryop(self, node: nodes.UnaryOp) -> None:
- """`not len(S)` must become `not S` regardless if the parent block
- is a test condition or something else (boolean expression)
- e.g. `if not len(S):`
+ """`not len(S)` must become `not S` regardless if the parent block is a test
+ condition or something else (boolean expression) e.g. `if not len(S):`
"""
if (
isinstance(node, nodes.UnaryOp)
@@ -145,7 +144,7 @@ class ImplicitBooleanessChecker(checkers.BaseChecker):
def _check_use_implicit_booleaness_not_comparison(
self, node: nodes.Compare
) -> None:
- """Check for left side and right side of the node for empty literals"""
+ """Check for left side and right side of the node for empty literals."""
is_left_empty_literal = utils.is_base_container(
node.left
) or utils.is_empty_dict_literal(node.left)
@@ -210,7 +209,9 @@ class ImplicitBooleanessChecker(checkers.BaseChecker):
@staticmethod
def base_classes_of_node(instance: nodes.ClassDef) -> List[str]:
- """Return all the classes names that a ClassDef inherit from including 'object'."""
+ """Return all the classes names that a ClassDef inherit from including
+ 'object'.
+ """
try:
return [instance.name] + [x.name for x in instance.ancestors()]
except TypeError:
diff --git a/pylint/checkers/refactoring/recommendation_checker.py b/pylint/checkers/refactoring/recommendation_checker.py
index 785e37fdd..c2fbe3332 100644
--- a/pylint/checkers/refactoring/recommendation_checker.py
+++ b/pylint/checkers/refactoring/recommendation_checker.py
@@ -102,7 +102,9 @@ class RecommendationChecker(checkers.BaseChecker):
self.add_message("consider-iterating-dictionary", node=node)
def _check_use_maxsplit_arg(self, node: nodes.Call) -> None:
- """Add message when accessing first or last elements of a str.split() or str.rsplit()."""
+ """Add message when accessing first or last elements of a str.split() or
+ str.rsplit().
+ """
# Check if call is split() or rsplit()
if not (
@@ -337,7 +339,7 @@ class RecommendationChecker(checkers.BaseChecker):
def _detect_replacable_format_call(self, node: nodes.Const) -> None:
"""Check whether a string is used in a call to format() or '%' and whether it
- can be replaced by an f-string
+ can be replaced by an f-string.
"""
if (
isinstance(node.parent, nodes.Attribute)
diff --git a/pylint/checkers/refactoring/refactoring_checker.py b/pylint/checkers/refactoring/refactoring_checker.py
index 2387595d3..4737a2c67 100644
--- a/pylint/checkers/refactoring/refactoring_checker.py
+++ b/pylint/checkers/refactoring/refactoring_checker.py
@@ -54,7 +54,7 @@ def _if_statement_is_always_returning(if_node, returning_node_class) -> bool:
def _is_trailing_comma(tokens: List[tokenize.TokenInfo], index: int) -> bool:
- """Check if the given token is a trailing comma
+ """Check if the given token is a trailing comma.
:param tokens: Sequence of modules tokens
:type tokens: list[tokenize.TokenInfo]
@@ -81,7 +81,7 @@ def _is_trailing_comma(tokens: List[tokenize.TokenInfo], index: int) -> bool:
return False
def get_curline_index_start():
- """Get the index denoting the start of the current line"""
+ """Get the index denoting the start of the current line."""
for subindex, token in enumerate(reversed(tokens[:index])):
# See Lib/tokenize.py and Lib/token.py in cpython for more info
if token.type == tokenize.NEWLINE:
@@ -118,8 +118,8 @@ def _is_a_return_statement(node: nodes.Call) -> bool:
def _is_part_of_with_items(node: nodes.Call) -> bool:
- """Checks if one of the node's parents is a ``nodes.With`` node and that the node itself is located
- somewhere under its ``items``.
+ """Checks if one of the node's parents is a ``nodes.With`` node and that the node
+ itself is located somewhere under its ``items``.
"""
frame = node.frame(future=True)
current = node
@@ -133,8 +133,8 @@ def _is_part_of_with_items(node: nodes.Call) -> bool:
def _will_be_released_automatically(node: nodes.Call) -> bool:
- """Checks if a call that could be used in a ``with`` statement is used in an alternative
- construct which would ensure that its __exit__ method is called.
+ """Checks if a call that could be used in a ``with`` statement is used in an
+ alternative construct which would ensure that its __exit__ method is called.
"""
callables_taking_care_of_exit = frozenset(
(
@@ -151,8 +151,8 @@ def _will_be_released_automatically(node: nodes.Call) -> bool:
class ConsiderUsingWithStack(NamedTuple):
- """Stack for objects that may potentially trigger a R1732 message
- if they are not used in a ``with`` block later on.
+ """Stack for objects that may potentially trigger a R1732 message if they are not
+ used in a ``with`` block later on.
"""
module_scope: Dict[str, nodes.NodeNG] = {}
@@ -173,17 +173,17 @@ class ConsiderUsingWithStack(NamedTuple):
return self.module_scope
def clear_all(self) -> None:
- """Convenience method to clear all stacks"""
+ """Convenience method to clear all stacks."""
for stack in self:
stack.clear()
class RefactoringChecker(checkers.BaseTokenChecker):
- """Looks for code which can be refactored
+ """Looks for code which can be refactored.
- This checker also mixes the astroid and the token approaches
- in order to create knowledge about whether an "else if" node
- is a true "else if" node, or an "elif" node.
+ This checker also mixes the astroid and the token approaches in order to create
+ knowledge about whether an "else if" node is a true "else if" node, or an "elif"
+ node.
"""
__implements__ = (interfaces.ITokenChecker, interfaces.IAstroidChecker)
@@ -486,12 +486,11 @@ class RefactoringChecker(checkers.BaseTokenChecker):
)
def _is_actual_elif(self, node):
- """Check if the given node is an actual elif
+ """Check if the given node is an actual elif.
- This is a problem we're having with the builtin ast module,
- which splits `elif` branches into a separate if statement.
- Unfortunately we need to know the exact type in certain
- cases.
+ This is a problem we're having with the builtin ast module, which splits `elif`
+ branches into a separate if statement. Unfortunately we need to know the exact
+ type in certain cases.
"""
if isinstance(node.parent, nodes.If):
orelse = node.parent.orelse
@@ -504,11 +503,10 @@ class RefactoringChecker(checkers.BaseTokenChecker):
def _check_simplifiable_if(self, node):
"""Check if the given if node can be simplified.
- The if statement can be reduced to a boolean expression
- in some cases. For instance, if there are two branches
- and both of them return a boolean value that depends on
- the result of the statement's test, then this can be reduced
- to `bool(test)` without losing any functionality.
+ The if statement can be reduced to a boolean expression in some cases. For
+ instance, if there are two branches and both of them return a boolean value that
+ depends on the result of the statement's test, then this can be reduced to
+ `bool(test)` without losing any functionality.
"""
if self._is_actual_elif(node):
@@ -909,7 +907,7 @@ class RefactoringChecker(checkers.BaseTokenChecker):
self._check_stop_iteration_inside_generator(node)
def _check_stop_iteration_inside_generator(self, node):
- """Check if an exception of type StopIteration is raised inside a generator"""
+ """Check if an exception of type StopIteration is raised inside a generator."""
frame = node.frame(future=True)
if not isinstance(frame, nodes.FunctionDef) or not frame.is_generator():
return
@@ -925,7 +923,7 @@ class RefactoringChecker(checkers.BaseTokenChecker):
@staticmethod
def _check_exception_inherit_from_stopiteration(exc):
- """Return True if the exception node in argument inherit from StopIteration"""
+ """Return True if the exception node in argument inherit from StopIteration."""
stopiteration_qname = f"{utils.EXCEPTIONS_MODULE}.StopIteration"
return any(_class.qname() == stopiteration_qname for _class in exc.mro())
@@ -1049,7 +1047,7 @@ class RefactoringChecker(checkers.BaseTokenChecker):
self.add_message("super-with-arguments", node=node)
def _check_raising_stopiteration_in_generator_next_call(self, node):
- """Check if a StopIteration exception is raised by the call to next function
+ """Check if a StopIteration exception is raised by the call to next function.
If the next value has a default value, then do not add message.
@@ -1083,7 +1081,7 @@ class RefactoringChecker(checkers.BaseTokenChecker):
self.add_message("stop-iteration-return", node=node)
def _check_nested_blocks(self, node):
- """Update and check the number of nested blocks"""
+ """Update and check the number of nested blocks."""
# only check block levels inside functions or methods
if not isinstance(node.scope(), nodes.FunctionDef):
return
@@ -1272,7 +1270,7 @@ class RefactoringChecker(checkers.BaseTokenChecker):
@staticmethod
def _apply_boolean_simplification_rules(operator, values):
- """Removes irrelevant values or returns shortcircuiting values
+ """Removes irrelevant values or returns shortcircuiting values.
This function applies the following two rules:
1) an OR expression with True in it will always be true, and the
@@ -1298,10 +1296,10 @@ class RefactoringChecker(checkers.BaseTokenChecker):
return simplified_values or [nodes.Const(operator == "and")]
def _simplify_boolean_operation(self, bool_op):
- """Attempts to simplify a boolean operation
+ """Attempts to simplify a boolean operation.
- Recursively applies simplification on the operator terms,
- and keeps track of whether reductions have been made.
+ Recursively applies simplification on the operator terms, and keeps track of
+ whether reductions have been made.
"""
children = list(bool_op.get_children())
intermediate = [
@@ -1322,8 +1320,8 @@ class RefactoringChecker(checkers.BaseTokenChecker):
def _check_simplifiable_condition(self, node):
"""Check if a boolean condition can be simplified.
- Variables will not be simplified, even in the value can be inferred,
- and expressions like '3 + 4' will remain expanded.
+ Variables will not be simplified, even in the value can be inferred, and
+ expressions like '3 + 4' will remain expanded.
"""
if not utils.is_test_condition(node):
return
@@ -1502,7 +1500,7 @@ class RefactoringChecker(checkers.BaseTokenChecker):
self.add_message("consider-using-with", node=node)
def _check_use_list_or_dict_literal(self, node: nodes.Call) -> None:
- """Check if empty list or dict is created by using the literal [] or {}"""
+ """Check if empty list or dict is created by using '[]' or '{}'."""
if node.as_string() in {"list()", "dict()"}:
inferred = utils.safe_infer(node.func)
if isinstance(inferred, nodes.ClassDef) and not node.args:
@@ -1513,6 +1511,7 @@ class RefactoringChecker(checkers.BaseTokenChecker):
def _check_consider_using_join(self, aug_assign):
"""We start with the augmented assignment and work our way upwards.
+
Names of variables for nodes if match successful:
result = '' # assign
for number in ['1', '2', '3'] # for_loop
@@ -1637,7 +1636,8 @@ class RefactoringChecker(checkers.BaseTokenChecker):
def _is_and_or_ternary(node):
"""Returns true if node is 'condition and true_value or false_value' form.
- All of: condition, true_value and false_value should not be a complex boolean expression
+ All of: condition, true_value and false_value should not be a complex boolean
+ expression
"""
return (
isinstance(node, nodes.BoolOp)
@@ -1670,7 +1670,6 @@ class RefactoringChecker(checkers.BaseTokenChecker):
Args:
node (nodes.FunctionDef): the function holding the return statements.
-
"""
# explicit return statements are those with a not None value
explicit_returns = [
@@ -1755,7 +1754,6 @@ class RefactoringChecker(checkers.BaseTokenChecker):
Returns:
bool: True if the node ends with an explicit statement, False otherwise.
-
"""
# Recursion base case
if isinstance(node, nodes.Return):
@@ -1797,7 +1795,7 @@ class RefactoringChecker(checkers.BaseTokenChecker):
@staticmethod
def _has_return_in_siblings(node: nodes.NodeNG) -> bool:
- """Returns True if there is at least one return in the node's siblings"""
+ """Returns True if there is at least one return in the node's siblings."""
next_sibling = node.next_sibling()
while next_sibling:
if isinstance(next_sibling, nodes.Return):
@@ -1827,9 +1825,9 @@ class RefactoringChecker(checkers.BaseTokenChecker):
return False
def _check_return_at_the_end(self, node):
- """Check for presence of a *single* return statement at the end of a
- function. "return" or "return None" are useless because None is the
- default return type if they are missing.
+ """Check for presence of a *single* return statement at the end of a function.
+ "return" or "return None" are useless because None is the default return type if
+ they are missing.
NOTE: produces a message only if there is a single return statement
in the function body. Otherwise _check_consistent_returns() is called!
diff --git a/pylint/checkers/stdlib.py b/pylint/checkers/stdlib.py
index 638b7f3c9..459971e5e 100644
--- a/pylint/checkers/stdlib.py
+++ b/pylint/checkers/stdlib.py
@@ -586,6 +586,7 @@ class StdlibChecker(DeprecatedMixin, BaseChecker):
def _check_datetime(self, node):
"""Check that a datetime was inferred.
+
If so, emit boolean-datetime warning.
"""
try:
diff --git a/pylint/checkers/strings.py b/pylint/checkers/strings.py
index 19668ce5b..603ed6879 100644
--- a/pylint/checkers/strings.py
+++ b/pylint/checkers/strings.py
@@ -226,8 +226,8 @@ OTHER_NODES = (
def get_access_path(key, parts):
- """Given a list of format specifiers, returns
- the final access path (e.g. a.b.c[0][1]).
+ """Given a list of format specifiers, returns the final access path (e.g.
+ a.b.c[0][1]).
"""
path = []
for is_attribute, specifier in parts:
@@ -256,8 +256,8 @@ def arg_matches_format_type(arg_type, format_type):
class StringFormatChecker(BaseChecker):
- """Checks string formatting operations to ensure that the format string
- is valid and the arguments match the format string.
+ """Checks string formatting operations to ensure that the format string is valid and
+ the arguments match the format string.
"""
__implements__ = (IAstroidChecker,)
@@ -539,8 +539,8 @@ class StringFormatChecker(BaseChecker):
self._check_new_format_specifiers(node, fields, named_arguments)
def _check_new_format_specifiers(self, node, fields, named):
- """Check attribute and index access in the format
- string ("{0.a}" and "{0[a]}").
+ """Check attribute and index access in the format string ("{0.a}" and
+ "{0[a]}").
"""
for key, specifiers in fields:
# Obtain the argument. If it can't be obtained
@@ -635,7 +635,7 @@ class StringFormatChecker(BaseChecker):
class StringConstantChecker(BaseTokenChecker):
- """Check string literals"""
+ """Check string literals."""
__implements__ = (IAstroidChecker, ITokenChecker, IRawChecker)
name = "string"
@@ -917,7 +917,7 @@ class StringConstantChecker(BaseTokenChecker):
self._detect_u_string_prefix(node)
def _detect_u_string_prefix(self, node: nodes.Const):
- """Check whether strings include a 'u' prefix like u'String'"""
+ """Check whether strings include a 'u' prefix like u'String'."""
if node.kind == "u":
self.add_message(
"redundant-u-string-prefix",
@@ -933,6 +933,7 @@ def register(linter: "PyLinter") -> None:
def str_eval(token):
"""Mostly replicate `ast.literal_eval(token)` manually to avoid any performance hit.
+
This supports f-strings, contrary to `ast.literal_eval`.
We have to support all string literal notations:
https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals
diff --git a/pylint/checkers/threading_checker.py b/pylint/checkers/threading_checker.py
index cedf46a9e..6148b8292 100644
--- a/pylint/checkers/threading_checker.py
+++ b/pylint/checkers/threading_checker.py
@@ -14,7 +14,7 @@ if TYPE_CHECKING:
class ThreadingChecker(BaseChecker):
- """Checks for threading module
+ """Checks for threading module.
- useless with lock - locking used in wrong way that has no effect (with threading.Lock():)
"""
diff --git a/pylint/checkers/unsupported_version.py b/pylint/checkers/unsupported_version.py
index ada104ab9..ec1234091 100644
--- a/pylint/checkers/unsupported_version.py
+++ b/pylint/checkers/unsupported_version.py
@@ -5,8 +5,8 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-"""Checker for features used that are not supported by all python versions
-indicated by the py-version setting.
+"""Checker for features used that are not supported by all python versions indicated by
+the py-version setting.
"""
@@ -28,8 +28,8 @@ if TYPE_CHECKING:
class UnsupportedVersionChecker(BaseChecker):
- """Checker for features that are not supported by all python versions
- indicated by the py-version setting.
+ """Checker for features that are not supported by all python versions indicated by
+ the py-version setting.
"""
__implements__ = (IAstroidChecker,)
@@ -57,18 +57,18 @@ class UnsupportedVersionChecker(BaseChecker):
@check_messages("using-f-string-in-unsupported-version")
def visit_joinedstr(self, node: nodes.JoinedStr) -> None:
- """Check f-strings"""
+ """Check f-strings."""
if not self._py36_plus:
self.add_message("using-f-string-in-unsupported-version", node=node)
@check_messages("using-final-decorator-in-unsupported-version")
def visit_decorators(self, node: nodes.Decorators) -> None:
- """Check decorators"""
+ """Check decorators."""
self._check_typing_final(node)
def _check_typing_final(self, node: nodes.Decorators) -> None:
- """Add a message when the `typing.final` decorator is used and the
- py-version is lower than 3.8
+ """Add a message when the `typing.final` decorator is used and the py- version
+ is lower than 3.8.
"""
if self._py38_plus:
return
diff --git a/pylint/config/config_initialization.py b/pylint/config/config_initialization.py
index d03822030..a006901a8 100644
--- a/pylint/config/config_initialization.py
+++ b/pylint/config/config_initialization.py
@@ -19,8 +19,8 @@ def _config_initialization(
config_file: Union[None, str, Path] = None,
verbose_mode: Optional[bool] = None,
) -> List[str]:
- """Parse all available options, read config files and command line arguments and
- set options accordingly.
+ """Parse all available options, read config files and command line arguments and set
+ options accordingly.
"""
# Read the config file. The parser is stored on linter.cfgfile_parser
diff --git a/pylint/config/configuration_mixin.py b/pylint/config/configuration_mixin.py
index a2abcb752..c5f29781d 100644
--- a/pylint/config/configuration_mixin.py
+++ b/pylint/config/configuration_mixin.py
@@ -6,8 +6,8 @@ from pylint.config.options_provider_mixin import OptionsProviderMixIn
class ConfigurationMixIn(OptionsManagerMixIn, OptionsProviderMixIn):
- """Basic mixin for simple configurations which don't need the
- manager / providers model
+ """Basic mixin for simple configurations which don't need the manager / providers
+ model.
"""
def __init__(self, *args, **kwargs):
diff --git a/pylint/config/find_default_config_files.py b/pylint/config/find_default_config_files.py
index 36fd351f0..8d1fc1885 100644
--- a/pylint/config/find_default_config_files.py
+++ b/pylint/config/find_default_config_files.py
@@ -71,7 +71,9 @@ def find_default_config_files() -> Iterator[str]:
def find_pylintrc() -> Optional[str]:
- """Search the pylint rc file and return its path if it finds it, else return None"""
+ """Search the pylint rc file and return its path if it finds it, else return
+ None.
+ """
for config_file in find_default_config_files():
if config_file.endswith("pylintrc"):
return config_file
diff --git a/pylint/config/man_help_formatter.py b/pylint/config/man_help_formatter.py
index e8e019824..c00f45468 100644
--- a/pylint/config/man_help_formatter.py
+++ b/pylint/config/man_help_formatter.py
@@ -107,7 +107,7 @@ Please report bugs on the project\'s mailing list:
return tail
def format_usage(self, usage):
- """Taken from optparse.IndentedHelpFormatter"""
+ """Taken from optparse.IndentedHelpFormatter."""
return f"Usage: {usage}\n"
diff --git a/pylint/epylint.py b/pylint/epylint.py
index 5517543a4..bbe9e096a 100755
--- a/pylint/epylint.py
+++ b/pylint/epylint.py
@@ -68,9 +68,7 @@ from typing import Optional, Sequence
def _get_env():
- """Extracts the environment PYTHONPATH and appends the current 'sys.path'
- to it.
- """
+ """Extracts the environment PYTHONPATH and appends the current 'sys.path' to it."""
env = dict(os.environ)
env["PYTHONPATH"] = os.pathsep.join(sys.path)
return env
@@ -138,7 +136,7 @@ def lint(filename, options=()):
def py_run(command_options="", return_std=False, stdout=None, stderr=None):
- """Run pylint from python
+ """Run pylint from python.
``command_options`` is a string containing ``pylint`` command line options;
``return_std`` (boolean) indicates return of created standard output
diff --git a/pylint/extensions/__init__.py b/pylint/extensions/__init__.py
index 8b5fa9132..c34836101 100644
--- a/pylint/extensions/__init__.py
+++ b/pylint/extensions/__init__.py
@@ -10,7 +10,7 @@ if TYPE_CHECKING:
def initialize(linter: "PyLinter") -> None:
- """Initialize linter with checkers in the extensions directory"""
+ """Initialize linter with checkers in the extensions directory."""
register_plugins(linter, __path__[0])
diff --git a/pylint/extensions/_check_docs_utils.py b/pylint/extensions/_check_docs_utils.py
index f6fa34724..0b7de1112 100644
--- a/pylint/extensions/_check_docs_utils.py
+++ b/pylint/extensions/_check_docs_utils.py
@@ -34,7 +34,7 @@ from pylint.checkers import utils
def space_indentation(s):
- """The number of leading spaces in a string
+ """The number of leading spaces in a string.
:param str s: input string
@@ -216,7 +216,7 @@ class Docstring:
return f"<{self.__class__.__name__}:'''{self.doc}'''>"
def matching_sections(self) -> int:
- """Returns the number of matching docstring sections"""
+ """Returns the number of matching docstring sections."""
return 0
def exceptions(self):
@@ -329,7 +329,7 @@ class SphinxDocstring(Docstring):
supports_yields = False
def matching_sections(self) -> int:
- """Returns the number of matching docstring sections"""
+ """Returns the number of matching docstring sections."""
return sum(
bool(i)
for i in (
@@ -401,8 +401,8 @@ class SphinxDocstring(Docstring):
class EpytextDocstring(SphinxDocstring):
"""Epytext is similar to Sphinx. See the docs:
- http://epydoc.sourceforge.net/epytext.html
- http://epydoc.sourceforge.net/fields.html#fields
+ http://epydoc.sourceforge.net/epytext.html
+ http://epydoc.sourceforge.net/fields.html#fields.
It's used in PyCharm:
https://www.jetbrains.com/help/pycharm/2016.1/creating-documentation-comments.html#d848203e314
@@ -536,7 +536,7 @@ class GoogleDocstring(Docstring):
supports_yields = True
def matching_sections(self) -> int:
- """Returns the number of matching docstring sections"""
+ """Returns the number of matching docstring sections."""
return sum(
bool(i)
for i in (
@@ -782,7 +782,7 @@ class NumpyDocstring(GoogleDocstring):
supports_yields = True
def match_param_docs(self) -> Tuple[Set[str], Set[str]]:
- """Matches parameter documentation section to parameter documentation rules"""
+ """Matches parameter documentation section to parameter documentation rules."""
params_with_doc = set()
params_with_type = set()
diff --git a/pylint/extensions/broad_try_clause.py b/pylint/extensions/broad_try_clause.py
index a45dc5fe6..118a027de 100644
--- a/pylint/extensions/broad_try_clause.py
+++ b/pylint/extensions/broad_try_clause.py
@@ -23,10 +23,8 @@ if TYPE_CHECKING:
class BroadTryClauseChecker(checkers.BaseChecker):
"""Checks for try clauses with too many lines.
- According to PEP 8, ``try`` clauses shall contain the absolute minimum
- amount of code. This checker enforces a maximum number of statements within
- ``try`` clauses.
-
+ According to PEP 8, ``try`` clauses shall contain the absolute minimum amount of
+ code. This checker enforces a maximum number of statements within ``try`` clauses.
"""
__implements__ = interfaces.IAstroidChecker
diff --git a/pylint/extensions/check_elif.py b/pylint/extensions/check_elif.py
index b4658577e..93575627a 100644
--- a/pylint/extensions/check_elif.py
+++ b/pylint/extensions/check_elif.py
@@ -25,7 +25,7 @@ if TYPE_CHECKING:
class ElseifUsedChecker(BaseTokenChecker):
- """Checks for use of "else if" when an "elif" could be used"""
+ """Checks for use of "else if" when an "elif" could be used."""
__implements__ = (ITokenChecker, IAstroidChecker)
name = "else_if_used"
@@ -47,7 +47,7 @@ class ElseifUsedChecker(BaseTokenChecker):
self._elifs = {}
def process_tokens(self, tokens):
- """Process tokens and look for 'if' or 'elif'"""
+ """Process tokens and look for 'if' or 'elif'."""
self._elifs = {
begin: token for _, token, begin, _, _ in tokens if token in {"elif", "if"}
}
@@ -57,7 +57,7 @@ class ElseifUsedChecker(BaseTokenChecker):
@check_messages("else-if-used")
def visit_if(self, node: nodes.If) -> None:
- """Current if node must directly follow an 'else'"""
+ """Current if node must directly follow an 'else'."""
if (
isinstance(node.parent, nodes.If)
and node.parent.orelse == [node]
diff --git a/pylint/extensions/code_style.py b/pylint/extensions/code_style.py
index 7082c991c..9f9d801c9 100644
--- a/pylint/extensions/code_style.py
+++ b/pylint/extensions/code_style.py
@@ -252,6 +252,7 @@ class CodeStyleChecker(BaseChecker):
prev_sibling: Optional[nodes.NodeNG], name: Optional[str]
) -> TypeGuard[Union[nodes.Assign, nodes.AnnAssign]]:
"""Check if previous sibling is an assignment with the same name.
+
Ignore statements which span multiple lines.
"""
if prev_sibling is None or prev_sibling.tolineno - prev_sibling.fromlineno != 0:
@@ -278,8 +279,8 @@ class CodeStyleChecker(BaseChecker):
) -> bool:
"""Return True if suggestion for assignment expr should be ignored.
- E.g., in cases where a match statement would be a better fit
- (multiple conditions).
+ E.g., in cases where a match statement would be a better fit (multiple
+ conditions).
"""
if isinstance(node.test, nodes.Compare):
next_if_node: Optional[nodes.If] = None
diff --git a/pylint/extensions/comparetozero.py b/pylint/extensions/comparetozero.py
index 592e15a5b..0a81039cb 100644
--- a/pylint/extensions/comparetozero.py
+++ b/pylint/extensions/comparetozero.py
@@ -31,9 +31,10 @@ def _is_constant_zero(node):
class CompareToZeroChecker(checkers.BaseChecker):
"""Checks for comparisons to zero.
+
Most of the time you should use the fact that integers with a value of 0 are false.
- An exception to this rule is when 0 is allowed in the program and has a
- different meaning than None!
+ An exception to this rule is when 0 is allowed in the program and has a different
+ meaning than None!
"""
__implements__ = (interfaces.IAstroidChecker,)
diff --git a/pylint/extensions/comparison_placement.py b/pylint/extensions/comparison_placement.py
index e045ebdd0..6ca5db5e7 100644
--- a/pylint/extensions/comparison_placement.py
+++ b/pylint/extensions/comparison_placement.py
@@ -1,8 +1,8 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-"""Checks for yoda comparisons (variable before constant)
-See https://en.wikipedia.org/wiki/Yoda_conditions
+"""Checks for yoda comparisons (variable before constant) See
+https://en.wikipedia.org/wiki/Yoda_conditions.
"""
@@ -21,7 +21,7 @@ COMPARISON_OPERATORS = frozenset(("==", "!=", "<", ">", "<=", ">="))
class MisplacedComparisonConstantChecker(BaseChecker):
- """Checks the placement of constants in comparisons"""
+ """Checks the placement of constants in comparisons."""
__implements__ = (IAstroidChecker,)
diff --git a/pylint/extensions/confusing_elif.py b/pylint/extensions/confusing_elif.py
index 99588d0b8..f490a54f1 100644
--- a/pylint/extensions/confusing_elif.py
+++ b/pylint/extensions/confusing_elif.py
@@ -20,7 +20,9 @@ if TYPE_CHECKING:
class ConfusingConsecutiveElifChecker(BaseChecker):
- """Checks if "elif" is used right after an indented block that finishes with "if" or "elif" itself."""
+ """Checks if "elif" is used right after an indented block that finishes with "if" or
+ "elif" itself.
+ """
__implements__ = IAstroidChecker
diff --git a/pylint/extensions/docparams.py b/pylint/extensions/docparams.py
index 7c18e6b62..ad891f45d 100644
--- a/pylint/extensions/docparams.py
+++ b/pylint/extensions/docparams.py
@@ -24,7 +24,7 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-"""Pylint plugin for checking in Sphinx, Google, or Numpy style docstrings"""
+"""Pylint plugin for checking in Sphinx, Google, or Numpy style docstrings."""
import re
from typing import TYPE_CHECKING, Optional
@@ -43,7 +43,7 @@ if TYPE_CHECKING:
class DocstringParameterChecker(BaseChecker):
- """Checker for Sphinx, Google, or Numpy style docstrings
+ """Checker for Sphinx, Google, or Numpy style docstrings.
* Check that all function, method and constructor parameters are mentioned
in the params and types part of the docstring. Constructor parameters
@@ -387,8 +387,8 @@ class DocstringParameterChecker(BaseChecker):
expected_argument_names,
warning_node,
):
- """Compare the found argument names with the expected ones and
- generate a message if there are arguments missing.
+ """Compare the found argument names with the expected ones and generate a
+ message if there are arguments missing.
:param found_argument_names: argument names found in the docstring
:type found_argument_names: set
@@ -423,8 +423,8 @@ class DocstringParameterChecker(BaseChecker):
expected_argument_names,
warning_node,
):
- """Compare the found argument names with the expected ones and
- generate a message if there are extra arguments found.
+ """Compare the found argument names with the expected ones and generate a
+ message if there are extra arguments found.
:param found_argument_names: argument names found in the docstring
:type found_argument_names: set
@@ -461,8 +461,8 @@ class DocstringParameterChecker(BaseChecker):
ignored_argument_names,
warning_node,
):
- """Compare the found argument names with the ignored ones and
- generate a message if there are ignored arguments found.
+ """Compare the found argument names with the ignored ones and generate a message
+ if there are ignored arguments found.
:param found_argument_names: argument names found in the docstring
:type found_argument_names: set
@@ -492,10 +492,10 @@ class DocstringParameterChecker(BaseChecker):
warning_node: astroid.NodeNG,
accept_no_param_doc: Optional[bool] = None,
):
- """Check that all parameters in a function, method or class constructor
- on the one hand and the parameters mentioned in the parameter
- documentation (e.g. the Sphinx tags 'param' and 'type') on the other
- hand are consistent with each other.
+ """Check that all parameters in a function, method or class constructor on the
+ one hand and the parameters mentioned in the parameter documentation (e.g. the
+ Sphinx tags 'param' and 'type') on the other hand are consistent with each
+ other.
* Undocumented parameters except 'self' are noticed.
* Undocumented parameter types except for 'self' and the ``*<args>``
diff --git a/pylint/extensions/docstyle.py b/pylint/extensions/docstyle.py
index c0fed60fe..fb3f9244f 100644
--- a/pylint/extensions/docstyle.py
+++ b/pylint/extensions/docstyle.py
@@ -24,7 +24,7 @@ if TYPE_CHECKING:
class DocStringStyleChecker(checkers.BaseChecker):
- """Checks format of docstrings based on PEP 0257"""
+ """Checks format of docstrings based on PEP 0257."""
__implements__ = IAstroidChecker
name = "docstyle"
diff --git a/pylint/extensions/emptystring.py b/pylint/extensions/emptystring.py
index 15bdd1e58..9a878bc05 100644
--- a/pylint/extensions/emptystring.py
+++ b/pylint/extensions/emptystring.py
@@ -26,9 +26,10 @@ if TYPE_CHECKING:
class CompareToEmptyStringChecker(checkers.BaseChecker):
"""Checks for comparisons to empty string.
- Most of the time you should use the fact that empty strings are false.
- An exception to this rule is when an empty string value is allowed in the program
- and has a different meaning than None!
+
+ Most of the time you should use the fact that empty strings are false. An exception
+ to this rule is when an empty string value is allowed in the program and has a
+ different meaning than None!
"""
__implements__ = (interfaces.IAstroidChecker,)
diff --git a/pylint/extensions/for_any_all.py b/pylint/extensions/for_any_all.py
index 915fae8a3..690fc7bbf 100644
--- a/pylint/extensions/for_any_all.py
+++ b/pylint/extensions/for_any_all.py
@@ -47,8 +47,9 @@ class ConsiderUsingAnyOrAllChecker(BaseChecker):
@staticmethod
def _build_suggested_string(node: nodes.For, final_return_bool: bool) -> str:
- """When a nodes.For node can be rewritten as an any/all statement, return a suggestion for that statement
- final_return_bool is the boolean literal returned after the for loop if all conditions fail
+ """When a nodes.For node can be rewritten as an any/all statement, return a
+ suggestion for that statement final_return_bool is the boolean literal returned
+ after the for loop if all conditions fail.
"""
loop_var = node.target.as_string()
loop_iter = node.iter.as_string()
diff --git a/pylint/extensions/typing.py b/pylint/extensions/typing.py
index cc68bc35e..fb5aa2b56 100644
--- a/pylint/extensions/typing.py
+++ b/pylint/extensions/typing.py
@@ -257,9 +257,10 @@ class TypingChecker(BaseChecker):
@check_messages("consider-using-alias")
def leave_module(self, node: nodes.Module) -> None:
- """After parsing of module is complete, add messages for
- 'consider-using-alias' check. Make sure results are safe
- to recommend / collision free.
+ """After parsing of module is complete, add messages for 'consider- using-alias'
+ check.
+
+ Make sure results are safe to recommend / collision free.
"""
if self._py37_plus and not self._py39_plus:
msg_future_import = self._msg_postponed_eval_hint(node)
diff --git a/pylint/lint/parallel.py b/pylint/lint/parallel.py
index b382c42ad..be44b9be6 100644
--- a/pylint/lint/parallel.py
+++ b/pylint/lint/parallel.py
@@ -50,7 +50,8 @@ def _get_new_args(message):
def _worker_initialize(
linter: bytes, arguments: Union[None, str, Sequence[str]] = None
) -> None:
- """Function called to initialize a worker for a Process within a multiprocessing Pool
+ """Function called to initialize a worker for a Process within a multiprocessing
+ Pool.
:param linter: A linter-class (PyLinter) instance pickled with dill
:param arguments: File or module name(s) to lint and to be added to sys.path
@@ -98,7 +99,7 @@ def _worker_check_single_file(
def _merge_mapreduce_data(linter, all_mapreduce_data):
- """Merges map/reduce data across workers, invoking relevant APIs on checkers"""
+ """Merges map/reduce data across workers, invoking relevant APIs on checkers."""
# First collate the data and prepare it, so we can send it to the checkers for
# validation. The intent here is to collect all the mapreduce data for all checker-
# runs across processes - that will then be passed to a static method on the
@@ -124,10 +125,11 @@ def check_parallel(
files: Iterable[FileItem],
arguments: Union[None, str, Sequence[str]] = None,
) -> None:
- """Use the given linter to lint the files with given amount of workers (jobs)
- This splits the work filestream-by-filestream. If you need to do work across
- multiple files, as in the similarity-checker, then inherit from MapReduceMixin and
- implement the map/reduce mixin functionality.
+ """Use the given linter to lint the files with given amount of workers (jobs) This
+ splits the work filestream-by-filestream.
+
+ If you need to do work across multiple files, as in the similarity- checker, then
+ inherit from MapReduceMixin and implement the map/reduce mixin functionality.
"""
# The linter is inherited by all the pool's workers, i.e. the linter
# is identical to the linter object here. This is required so that
diff --git a/pylint/message/message.py b/pylint/message/message.py
index b431d502b..8a12d84b8 100644
--- a/pylint/message/message.py
+++ b/pylint/message/message.py
@@ -32,7 +32,7 @@ _MsgBase = collections.namedtuple(
class Message(_MsgBase):
- """This class represent a message to be issued by the reporters"""
+ """This class represent a message to be issued by the reporters."""
@overload
def __new__(
diff --git a/pylint/message/message_definition_store.py b/pylint/message/message_definition_store.py
index 766cdd446..aadee0485 100644
--- a/pylint/message/message_definition_store.py
+++ b/pylint/message/message_definition_store.py
@@ -15,8 +15,8 @@ if TYPE_CHECKING:
class MessageDefinitionStore:
- """The messages store knows information about every possible message definition but has
- no particular state during analysis.
+ """The messages store knows information about every possible message definition but
+ has no particular state during analysis.
"""
def __init__(self) -> None:
@@ -51,9 +51,9 @@ class MessageDefinitionStore:
def get_message_definitions(self, msgid_or_symbol: str) -> List[MessageDefinition]:
"""Returns the Message definition for either a numeric or symbolic id.
- The cache has no limit as its size will likely stay minimal. For each message we store
- about 1000 characters, so even if we would have 1000 messages the cache would only
- take up ~= 1 Mb.
+ The cache has no limit as its size will likely stay minimal. For each message we
+ store about 1000 characters, so even if we would have 1000 messages the cache
+ would only take up ~= 1 Mb.
"""
return [
self._messages_definitions[m]
@@ -68,7 +68,7 @@ class MessageDefinitionStore:
return repr([md.symbol for md in message_definitions])
def help_message(self, msgids_or_symbols: List[str]) -> None:
- """Display help messages for the given message identifiers"""
+ """Display help messages for the given message identifiers."""
for msgids_or_symbol in msgids_or_symbols:
try:
for message_definition in self.get_message_definitions(
@@ -95,7 +95,7 @@ class MessageDefinitionStore:
def find_emittable_messages(
self,
) -> Tuple[List[MessageDefinition], List[MessageDefinition]]:
- """Finds all emittable and non-emittable messages"""
+ """Finds all emittable and non-emittable messages."""
messages = sorted(self._messages_definitions.values(), key=lambda m: m.msgid)
emittable = []
non_emittable = []
diff --git a/pylint/message/message_id_store.py b/pylint/message/message_id_store.py
index c4d1f4e8f..d975f1bb7 100644
--- a/pylint/message/message_id_store.py
+++ b/pylint/message/message_id_store.py
@@ -8,7 +8,9 @@ from pylint.exceptions import InvalidMessageError, UnknownMessageError
class MessageIdStore:
- """The MessageIdStore store MessageId and make sure that there is a 1-1 relation between msgid and symbol."""
+ """The MessageIdStore store MessageId and make sure that there is a 1-1 relation
+ between msgid and symbol.
+ """
def __init__(self) -> None:
self.__msgid_to_symbol: Dict[str, str] = {}
@@ -51,8 +53,8 @@ class MessageIdStore:
def add_msgid_and_symbol(self, msgid: str, symbol: str) -> None:
"""Add valid message id.
- There is a little duplication with add_legacy_msgid_and_symbol to avoid a function call,
- this is called a lot at initialization.
+ There is a little duplication with add_legacy_msgid_and_symbol to avoid a
+ function call, this is called a lot at initialization.
"""
self.__msgid_to_symbol[msgid] = symbol
self.__symbol_to_msgid[symbol] = msgid
@@ -62,8 +64,8 @@ class MessageIdStore:
) -> None:
"""Add valid legacy message id.
- There is a little duplication with add_msgid_and_symbol to avoid a function call,
- this is called a lot at initialization.
+ There is a little duplication with add_msgid_and_symbol to avoid a function
+ call, this is called a lot at initialization.
"""
self.__msgid_to_symbol[msgid] = symbol
self.__symbol_to_msgid[symbol] = msgid
@@ -108,9 +110,9 @@ class MessageIdStore:
def get_active_msgids(self, msgid_or_symbol: str) -> List[str]:
"""Return msgids but the input can be a symbol.
- The cache has no limit as its size will likely stay minimal. For each message we store
- about 1000 characters, so even if we would have 1000 messages the cache would only
- take up ~= 1 Mb.
+ The cache has no limit as its size will likely stay minimal. For each message we
+ store about 1000 characters, so even if we would have 1000 messages the cache
+ would only take up ~= 1 Mb.
"""
msgid: Optional[str]
if msgid_or_symbol[1:].isdigit():
diff --git a/pylint/pyreverse/dot_printer.py b/pylint/pyreverse/dot_printer.py
index fb7f3d8bc..819582e46 100644
--- a/pylint/pyreverse/dot_printer.py
+++ b/pylint/pyreverse/dot_printer.py
@@ -51,7 +51,7 @@ class DotPrinter(Printer):
super().__init__(title, layout, use_automatic_namespace)
def _open_graph(self) -> None:
- """Emit the header lines"""
+ """Emit the header lines."""
self.emit(f'digraph "{self.title}" {{')
if self.layout:
self.emit(f"rankdir={self.layout.value}")
@@ -67,7 +67,10 @@ class DotPrinter(Printer):
type_: NodeType,
properties: Optional[NodeProperties] = None,
) -> None:
- """Create a new node. Nodes can be classes, packages, participants etc."""
+ """Create a new node.
+
+ Nodes can be classes, packages, participants etc.
+ """
if properties is None:
properties = NodeProperties(label=name)
shape = SHAPES[type_]
diff --git a/pylint/pyreverse/mermaidjs_printer.py b/pylint/pyreverse/mermaidjs_printer.py
index bf12fa2ec..a725d03f4 100644
--- a/pylint/pyreverse/mermaidjs_printer.py
+++ b/pylint/pyreverse/mermaidjs_printer.py
@@ -3,7 +3,7 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-"""Class to generate files in mermaidjs format"""
+"""Class to generate files in mermaidjs format."""
from typing import Dict, Optional
from pylint.pyreverse.printer import EdgeType, NodeProperties, NodeType, Printer
@@ -11,7 +11,7 @@ from pylint.pyreverse.utils import get_annotation_label
class MermaidJSPrinter(Printer):
- """Printer for MermaidJS diagrams"""
+ """Printer for MermaidJS diagrams."""
DEFAULT_COLOR = "black"
@@ -28,7 +28,7 @@ class MermaidJSPrinter(Printer):
}
def _open_graph(self) -> None:
- """Emit the header lines"""
+ """Emit the header lines."""
self.emit("classDiagram")
self._inc_indent()
@@ -38,7 +38,10 @@ class MermaidJSPrinter(Printer):
type_: NodeType,
properties: Optional[NodeProperties] = None,
) -> None:
- """Create a new node. Nodes can be classes, packages, participants etc."""
+ """Create a new node.
+
+ Nodes can be classes, packages, participants etc.
+ """
if properties is None:
properties = NodeProperties(label=name)
stereotype = "~~Interface~~" if type_ is NodeType.INTERFACE else ""
@@ -82,7 +85,7 @@ class MermaidJSPrinter(Printer):
class HTMLMermaidJSPrinter(MermaidJSPrinter):
- """Printer for MermaidJS diagrams wrapped in a html boilerplate"""
+ """Printer for MermaidJS diagrams wrapped in a html boilerplate."""
HTML_OPEN_BOILERPLATE = """<html>
<body>
diff --git a/pylint/pyreverse/plantuml_printer.py b/pylint/pyreverse/plantuml_printer.py
index be49c51eb..2e643fe1f 100644
--- a/pylint/pyreverse/plantuml_printer.py
+++ b/pylint/pyreverse/plantuml_printer.py
@@ -11,7 +11,7 @@ from pylint.pyreverse.utils import get_annotation_label
class PlantUmlPrinter(Printer):
- """Printer for PlantUML diagrams"""
+ """Printer for PlantUML diagrams."""
DEFAULT_COLOR = "black"
@@ -28,7 +28,7 @@ class PlantUmlPrinter(Printer):
}
def _open_graph(self) -> None:
- """Emit the header lines"""
+ """Emit the header lines."""
self.emit("@startuml " + self.title)
if not self.use_automatic_namespace:
self.emit("set namespaceSeparator none")
@@ -48,7 +48,10 @@ class PlantUmlPrinter(Printer):
type_: NodeType,
properties: Optional[NodeProperties] = None,
) -> None:
- """Create a new node. Nodes can be classes, packages, participants etc."""
+ """Create a new node.
+
+ Nodes can be classes, packages, participants etc.
+ """
if properties is None:
properties = NodeProperties(label=name)
stereotype = " << interface >>" if type_ is NodeType.INTERFACE else ""
diff --git a/pylint/reporters/json_reporter.py b/pylint/reporters/json_reporter.py
index 8761979aa..5c2074773 100644
--- a/pylint/reporters/json_reporter.py
+++ b/pylint/reporters/json_reporter.py
@@ -12,7 +12,7 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-"""JSON reporter"""
+"""JSON reporter."""
import json
from typing import TYPE_CHECKING, Optional
@@ -32,7 +32,7 @@ class JSONReporter(BaseReporter):
extension = "json"
def display_messages(self, layout: Optional["Section"]) -> None:
- """Launch layouts display"""
+ """Launch layouts display."""
json_dumpable = [
{
"type": msg.category,
diff --git a/pylint/reporters/reports_handler_mix_in.py b/pylint/reporters/reports_handler_mix_in.py
index 245d2ded1..8f65397b5 100644
--- a/pylint/reporters/reports_handler_mix_in.py
+++ b/pylint/reporters/reports_handler_mix_in.py
@@ -25,8 +25,8 @@ ReportsDict = DefaultDict["BaseChecker", List[Tuple[str, str, Callable]]]
class ReportsHandlerMixIn:
- """A mix-in class containing all the reports and stats manipulation
- related methods for the main lint class
+ """A mix-in class containing all the reports and stats manipulation related methods
+ for the main lint class.
"""
def __init__(self) -> None:
@@ -34,13 +34,13 @@ class ReportsHandlerMixIn:
self._reports_state: Dict[str, bool] = {}
def report_order(self) -> MutableSequence["BaseChecker"]:
- """Return a list of reporters"""
+ """Return a list of reporters."""
return list(self._reports)
def register_report(
self, reportid: str, r_title: str, r_cb: Callable, checker: "BaseChecker"
) -> None:
- """Register a report
+ """Register a report.
:param reportid: The unique identifier for the report
:param r_title: The report's title
@@ -51,12 +51,12 @@ class ReportsHandlerMixIn:
self._reports[checker].append((reportid, r_title, r_cb))
def enable_report(self, reportid: str) -> None:
- """Enable the report of the given id"""
+ """Enable the report of the given id."""
reportid = reportid.upper()
self._reports_state[reportid] = True
def disable_report(self, reportid: str) -> None:
- """Disable the report of the given id"""
+ """Disable the report of the given id."""
reportid = reportid.upper()
self._reports_state[reportid] = False
@@ -69,7 +69,7 @@ class ReportsHandlerMixIn:
stats: LinterStats,
old_stats: Optional[LinterStats],
) -> Section:
- """Render registered reports"""
+ """Render registered reports."""
sect = Section("Report", f"{self.stats.statement} statements analysed.")
for checker in self.report_order():
for reportid, r_title, r_cb in self._reports[checker]:
diff --git a/pylint/testutils/__init__.py b/pylint/testutils/__init__.py
index 53e301da3..2b392d058 100644
--- a/pylint/testutils/__init__.py
+++ b/pylint/testutils/__init__.py
@@ -28,7 +28,7 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-"""Functional/non regression tests for pylint"""
+"""Functional/non regression tests for pylint."""
__all__ = [
"_get_tests_info",
diff --git a/pylint/testutils/configuration_test.py b/pylint/testutils/configuration_test.py
index 4e6f265bb..b699f3242 100644
--- a/pylint/testutils/configuration_test.py
+++ b/pylint/testutils/configuration_test.py
@@ -55,7 +55,7 @@ EXPECTED_CONF_REMOVE_KEY = "functional_remove"
def get_expected_configuration(
configuration_path: str, default_configuration: PylintConfiguration
) -> PylintConfiguration:
- """Get the expected parsed configuration of a configuration functional test"""
+ """Get the expected parsed configuration of a configuration functional test."""
result = copy.deepcopy(default_configuration)
config_as_json = get_expected_or_default(
configuration_path, suffix="result.json", default="{}"
diff --git a/pylint/testutils/decorator.py b/pylint/testutils/decorator.py
index 4cee70302..21ddaaa8e 100644
--- a/pylint/testutils/decorator.py
+++ b/pylint/testutils/decorator.py
@@ -12,8 +12,8 @@ from pylint.testutils.checker_test_case import CheckerTestCase
def set_config(**kwargs):
"""Decorator for setting config values on a checker.
- Passing the args and kwargs back to the test function itself
- allows this decorator to be used on parametrized test cases.
+ Passing the args and kwargs back to the test function itself allows this decorator
+ to be used on parametrized test cases.
"""
def _wrapper(fun):
diff --git a/pylint/testutils/functional/lint_module_output_update.py b/pylint/testutils/functional/lint_module_output_update.py
index 0bd46fc0b..0f76752ea 100644
--- a/pylint/testutils/functional/lint_module_output_update.py
+++ b/pylint/testutils/functional/lint_module_output_update.py
@@ -14,7 +14,9 @@ from pylint.testutils.output_line import OutputLine
class LintModuleOutputUpdate(LintModuleTest):
- """Class to be used if expected output files should be updated instead of checked."""
+ """Class to be used if expected output files should be updated instead of
+ checked.
+ """
class TestDialect(csv.excel):
"""Dialect used by the csv writer."""
diff --git a/pylint/testutils/lint_module_test.py b/pylint/testutils/lint_module_test.py
index 9bbf00d2f..e121dc481 100644
--- a/pylint/testutils/lint_module_test.py
+++ b/pylint/testutils/lint_module_test.py
@@ -259,7 +259,9 @@ class LintModuleTest:
expected_output: List[OutputLine],
actual_output: List[OutputLine],
) -> None:
- """This is a function because we want to be able to update the text in LintModuleOutputUpdate"""
+ """This is a function because we want to be able to update the text in
+ LintModuleOutputUpdate.
+ """
assert expected_output == actual_output, self.error_msg_for_unequal_output(
expected_output, actual_output
)
diff --git a/pylint/testutils/output_line.py b/pylint/testutils/output_line.py
index fe8024795..faedbacce 100644
--- a/pylint/testutils/output_line.py
+++ b/pylint/testutils/output_line.py
@@ -76,7 +76,7 @@ class OutputLine(NamedTuple):
@classmethod
def from_msg(cls, msg: Message, check_endline: bool = True) -> "OutputLine":
- """Create an OutputLine from a Pylint Message"""
+ """Create an OutputLine from a Pylint Message."""
column = cls._get_column(msg.column)
end_line = cls._get_py38_none_value(msg.end_line, check_endline)
end_column = cls._get_py38_none_value(msg.end_column, check_endline)
@@ -93,8 +93,9 @@ class OutputLine(NamedTuple):
@staticmethod
def _get_column(column: str) -> int:
- """Handle column numbers except for python < 3.8. The ast parser in those versions doesn't
- return them.
+ """Handle column numbers except for python < 3.8.
+
+ The ast parser in those versions doesn't return them.
"""
if not PY38_PLUS:
# We check the column only for the new better ast parser introduced in python 3.8
@@ -103,8 +104,8 @@ class OutputLine(NamedTuple):
@staticmethod
def _get_py38_none_value(value: T, check_endline: bool) -> Optional[T]:
- """Used to make end_line and end_column None as indicated by our version compared to
- `min_pyver_end_position`.
+ """Used to make end_line and end_column None as indicated by our version
+ compared to `min_pyver_end_position`.
"""
if not check_endline:
return None # pragma: no cover
@@ -114,8 +115,8 @@ class OutputLine(NamedTuple):
def from_csv(
cls, row: Union[Sequence[str], str], check_endline: bool = True
) -> "OutputLine":
- """Create an OutputLine from a comma separated list (the functional tests expected
- output .txt files).
+ """Create an OutputLine from a comma separated list (the functional tests
+ expected output .txt files).
"""
try:
if isinstance(row, Sequence):
@@ -165,9 +166,7 @@ class OutputLine(NamedTuple):
raise MalformedOutputLineException(row, e) from e
def to_csv(self) -> Tuple[str, str, str, str, str, str, str, str]:
- """Convert an OutputLine to a tuple of string to be written by a
- csv-writer.
- """
+ """Convert an OutputLine to a tuple of string to be written by a csv- writer."""
return (
str(self.symbol),
str(self.lineno),
@@ -181,7 +180,7 @@ class OutputLine(NamedTuple):
@staticmethod
def _value_to_optional_int(value: Optional[str]) -> Optional[int]:
- """Checks if a (stringified) value should be None or a Python integer"""
+ """Checks if a (stringified) value should be None or a Python integer."""
if value == "None" or not value:
return None
return int(value)
diff --git a/pylint/testutils/primer.py b/pylint/testutils/primer.py
index b8b33ae3e..f61848da4 100644
--- a/pylint/testutils/primer.py
+++ b/pylint/testutils/primer.py
@@ -8,7 +8,7 @@ PRIMER_DIRECTORY_PATH = Path(".pylint_primer_tests")
class PackageToLint:
- """Represents data about a package to be tested during primer tests"""
+ """Represents data about a package to be tested during primer tests."""
url: str
"""URL of the repository to clone"""
@@ -52,13 +52,13 @@ class PackageToLint:
@property
def clone_directory(self) -> Path:
- """Directory to clone repository into"""
+ """Directory to clone repository into."""
clone_name = "/".join(self.url.split("/")[-2:]).replace(".git", "")
return PRIMER_DIRECTORY_PATH / clone_name
@property
def paths_to_lint(self) -> List[str]:
- """The paths we need to lint"""
+ """The paths we need to lint."""
return [str(self.clone_directory / path) for path in self.directories]
@property
@@ -70,13 +70,12 @@ class PackageToLint:
return self.paths_to_lint + options + self.pylint_additional_args
def lazy_clone(self) -> None: # pragma: no cover
- """Concatenates the target directory and clones the file
+ """Concatenates the target directory and clones the file.
- Not expected to be tested as the primer won't work if it doesn't.
- It's tested in the continuous integration primers, only the coverage
- is not calculated on everything. If lazy clone breaks for local use
- we'll probably notice because we'll have a fatal when launching the
- primer locally.
+ Not expected to be tested as the primer won't work if it doesn't. It's tested in
+ the continuous integration primers, only the coverage is not calculated on
+ everything. If lazy clone breaks for local use we'll probably notice because
+ we'll have a fatal when launching the primer locally.
"""
logging.info("Lazy cloning %s", self.url)
if not self.clone_directory.exists():
diff --git a/pylint/testutils/pyreverse.py b/pylint/testutils/pyreverse.py
index ac72def41..34d66d217 100644
--- a/pylint/testutils/pyreverse.py
+++ b/pylint/testutils/pyreverse.py
@@ -8,6 +8,7 @@ from typing import List, Optional, Tuple
# A NamedTuple is not possible as some tests need to modify attributes during the test.
class PyreverseConfig: # pylint: disable=too-many-instance-attributes, too-many-arguments
"""Holds the configuration options for Pyreverse.
+
The default values correspond to the defaults of the options' parser.
"""
diff --git a/pylint/typing.py b/pylint/typing.py
index 402a6f716..ba26d8024 100644
--- a/pylint/typing.py
+++ b/pylint/typing.py
@@ -12,7 +12,7 @@ else:
class FileItem(NamedTuple):
- """Represents data about a file handled by pylint
+ """Represents data about a file handled by pylint.
Each file item has:
- name: full name of the module
@@ -26,7 +26,7 @@ class FileItem(NamedTuple):
class ModuleDescriptionDict(TypedDict):
- """Represents data about a checked module"""
+ """Represents data about a checked module."""
path: str
name: str
@@ -36,7 +36,7 @@ class ModuleDescriptionDict(TypedDict):
class ErrorDescriptionDict(TypedDict):
- """Represents data about errors collected during checking of a module"""
+ """Represents data about errors collected during checking of a module."""
key: Literal["fatal"]
mod: str
@@ -44,7 +44,7 @@ class ErrorDescriptionDict(TypedDict):
class MessageLocationTuple(NamedTuple):
- """Tuple with information about the location of a to-be-displayed message"""
+ """Tuple with information about the location of a to-be-displayed message."""
abspath: str
path: str
@@ -57,7 +57,7 @@ class MessageLocationTuple(NamedTuple):
class ManagedMessage(NamedTuple):
- """Tuple with information about a managed message of the linter"""
+ """Tuple with information about a managed message of the linter."""
name: Optional[str]
msgid: str
diff --git a/pylint/utils/docs.py b/pylint/utils/docs.py
index 5b46a0bc1..848a49868 100644
--- a/pylint/utils/docs.py
+++ b/pylint/utils/docs.py
@@ -1,6 +1,6 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-"""Various helper functions to create the docs of a linter object"""
+"""Various helper functions to create the docs of a linter object."""
import sys
from typing import TYPE_CHECKING, Dict, TextIO
@@ -13,7 +13,7 @@ if TYPE_CHECKING:
def _get_checkers_infos(linter: "PyLinter") -> Dict[str, Dict]:
- """Get info from a checker and handle KeyError"""
+ """Get info from a checker and handle KeyError."""
by_checker: Dict[str, Dict] = {}
for checker in linter.get_checkers():
name = checker.name
@@ -34,7 +34,7 @@ def _get_checkers_infos(linter: "PyLinter") -> Dict[str, Dict]:
def _get_checkers_documentation(linter: "PyLinter") -> str:
- """Get documentation for individual checkers"""
+ """Get documentation for individual checkers."""
result = get_rst_title("Pylint global options and switches", "-")
result += """
Pylint provides global options and switches.
@@ -73,5 +73,5 @@ Below is a list of all checkers and their features.
def print_full_documentation(linter: "PyLinter", stream: TextIO = sys.stdout) -> None:
- """Output a full documentation in ReST format"""
+ """Output a full documentation in ReST format."""
print(_get_checkers_documentation(linter)[:-1], file=stream)
diff --git a/pylint/utils/file_state.py b/pylint/utils/file_state.py
index 8527031ea..42a619f60 100644
--- a/pylint/utils/file_state.py
+++ b/pylint/utils/file_state.py
@@ -31,7 +31,7 @@ MessageStateDict = Dict[str, Dict[int, bool]]
class FileState:
- """Hold internal state specific to the currently analyzed file"""
+ """Hold internal state specific to the currently analyzed file."""
def __init__(self, modname: Optional[str] = None) -> None:
self.base_name = modname
@@ -61,8 +61,8 @@ class FileState:
node: nodes.NodeNG,
msg_state: MessageStateDict,
) -> None:
- """Recursively walk (depth first) AST to collect block level options
- line numbers.
+ """Recursively walk (depth first) AST to collect block level options line
+ numbers.
"""
for child in node.get_children():
self._collect_block_lines(msgs_store, child, msg_state)
@@ -122,7 +122,7 @@ class FileState:
del lines[lineno]
def set_msg_status(self, msg: "MessageDefinition", line: int, status: bool) -> None:
- """Set status (enabled/disable) for a given message at a given line"""
+ """Set status (enabled/disable) for a given message at a given line."""
assert line > 0
try:
self._module_msgs_state[msg.msgid][line] = status
@@ -135,8 +135,8 @@ class FileState:
"""Report an ignored message.
state_scope is either MSG_STATE_SCOPE_MODULE or MSG_STATE_SCOPE_CONFIG,
- depending on whether the message was disabled locally in the module,
- or globally.
+ depending on whether the message was disabled locally in the module, or
+ globally.
"""
if state_scope == MSG_STATE_SCOPE_MODULE:
try:
diff --git a/pylint/utils/linterstats.py b/pylint/utils/linterstats.py
index 4a05c93df..cfed34e3e 100644
--- a/pylint/utils/linterstats.py
+++ b/pylint/utils/linterstats.py
@@ -11,7 +11,7 @@ else:
class BadNames(TypedDict):
- """TypedDict to store counts of node types with bad names"""
+ """TypedDict to store counts of node types with bad names."""
argument: int
attr: int
@@ -27,7 +27,7 @@ class BadNames(TypedDict):
class CodeTypeCount(TypedDict):
- """TypedDict to store counts of lines of code types"""
+ """TypedDict to store counts of lines of code types."""
code: int
comment: int
@@ -37,14 +37,14 @@ class CodeTypeCount(TypedDict):
class DuplicatedLines(TypedDict):
- """TypedDict to store counts of lines of duplicated code"""
+ """TypedDict to store counts of lines of duplicated code."""
nb_duplicated_lines: int
percent_duplicated_lines: float
class NodeCount(TypedDict):
- """TypedDict to store counts of different types of nodes"""
+ """TypedDict to store counts of different types of nodes."""
function: int
klass: int
@@ -53,7 +53,7 @@ class NodeCount(TypedDict):
class UndocumentedNodes(TypedDict):
- """TypedDict to store counts of undocumented node types"""
+ """TypedDict to store counts of undocumented node types."""
function: int
klass: int
@@ -62,7 +62,7 @@ class UndocumentedNodes(TypedDict):
class ModuleStats(TypedDict):
- """TypedDict to store counts of types of messages and statements"""
+ """TypedDict to store counts of types of messages and statements."""
convention: int
error: int
@@ -80,7 +80,7 @@ ModuleStatsAttribute = Literal[
# pylint: disable-next=too-many-instance-attributes
class LinterStats:
- """Class used to linter stats"""
+ """Class used to linter stats."""
def __init__(
self,
@@ -155,7 +155,9 @@ class LinterStats:
{self.percent_duplicated_lines}"""
def init_single_module(self, module_name: str) -> None:
- """Use through PyLinter.set_current_module so PyLinter.current_name is consistent."""
+ """Use through PyLinter.set_current_module so PyLinter.current_name is
+ consistent.
+ """
self.by_module[module_name] = ModuleStats(
convention=0, error=0, fatal=0, info=0, refactor=0, statement=0, warning=0
)
@@ -176,13 +178,13 @@ class LinterStats:
"variable",
],
) -> int:
- """Get a bad names node count"""
+ """Get a bad names node count."""
if node_name == "class":
return self.bad_names.get("klass", 0)
return self.bad_names.get(node_name, 0)
def increase_bad_name(self, node_name: str, increase: int) -> None:
- """Increase a bad names node count"""
+ """Increase a bad names node count."""
if node_name not in {
"argument",
"attr",
@@ -220,7 +222,7 @@ class LinterStats:
self.bad_names[node_name] += increase
def reset_bad_names(self) -> None:
- """Resets the bad_names attribute"""
+ """Resets the bad_names attribute."""
self.bad_names = BadNames(
argument=0,
attr=0,
@@ -238,17 +240,17 @@ class LinterStats:
def get_code_count(
self, type_name: Literal["code", "comment", "docstring", "empty", "total"]
) -> int:
- """Get a code type count"""
+ """Get a code type count."""
return self.code_type_count.get(type_name, 0)
def reset_code_count(self) -> None:
- """Resets the code_type_count attribute"""
+ """Resets the code_type_count attribute."""
self.code_type_count = CodeTypeCount(
code=0, comment=0, docstring=0, empty=0, total=0
)
def reset_duplicated_lines(self) -> None:
- """Resets the duplicated_lines attribute"""
+ """Resets the duplicated_lines attribute."""
self.duplicated_lines = DuplicatedLines(
nb_duplicated_lines=0, percent_duplicated_lines=0.0
)
@@ -256,47 +258,47 @@ class LinterStats:
def get_node_count(
self, node_name: Literal["function", "class", "method", "module"]
) -> int:
- """Get a node count while handling some extra conditions"""
+ """Get a node count while handling some extra conditions."""
if node_name == "class":
return self.node_count.get("klass", 0)
return self.node_count.get(node_name, 0)
def reset_node_count(self) -> None:
- """Resets the node count attribute"""
+ """Resets the node count attribute."""
self.node_count = NodeCount(function=0, klass=0, method=0, module=0)
def get_undocumented(
self, node_name: Literal["function", "class", "method", "module"]
) -> float:
- """Get a undocumented node count"""
+ """Get a undocumented node count."""
if node_name == "class":
return self.undocumented["klass"]
return self.undocumented[node_name]
def reset_undocumented(self) -> None:
- """Resets the undocumented attribute"""
+ """Resets the undocumented attribute."""
self.undocumented = UndocumentedNodes(function=0, klass=0, method=0, module=0)
def get_global_message_count(self, type_name: str) -> int:
- """Get a global message count"""
+ """Get a global message count."""
return getattr(self, type_name, 0)
def get_module_message_count(self, modname: str, type_name: str) -> int:
- """Get a module message count"""
+ """Get a module message count."""
return getattr(self.by_module[modname], type_name, 0)
def increase_single_message_count(self, type_name: str, increase: int) -> None:
- """Increase the message type count of an individual message type"""
+ """Increase the message type count of an individual message type."""
setattr(self, type_name, getattr(self, type_name) + increase)
def increase_single_module_message_count(
self, modname: str, type_name: ModuleStatsAttribute, increase: int
) -> None:
- """Increase the message type count of an individual message type of a module"""
+ """Increase the message type count of an individual message type of a module."""
self.by_module[modname][type_name] += increase
def reset_message_count(self) -> None:
- """Resets the message type count of the stats object"""
+ """Resets the message type count of the stats object."""
self.convention = 0
self.error = 0
self.fatal = 0
@@ -306,7 +308,9 @@ class LinterStats:
def merge_stats(stats: List[LinterStats]):
- """Used to merge multiple stats objects into a new one when pylint is run in parallel mode"""
+ """Used to merge multiple stats objects into a new one when pylint is run in
+ parallel mode.
+ """
merged = LinterStats()
for stat in stats:
merged.bad_names["argument"] += stat.bad_names["argument"]
diff --git a/pylint/utils/pragma_parser.py b/pylint/utils/pragma_parser.py
index df506465d..1a07cf9ba 100644
--- a/pylint/utils/pragma_parser.py
+++ b/pylint/utils/pragma_parser.py
@@ -61,7 +61,7 @@ def emit_pragma_representer(action: str, messages: List[str]) -> PragmaRepresent
class PragmaParserError(Exception):
- """A class for exceptions thrown by pragma_parser module"""
+ """A class for exceptions thrown by pragma_parser module."""
def __init__(self, message: str, token: str) -> None:
""":args message: explain the reason why the exception has been thrown
@@ -73,11 +73,11 @@ class PragmaParserError(Exception):
class UnRecognizedOptionError(PragmaParserError):
- """Thrown in case the of a valid but unrecognized option"""
+ """Thrown in case the of a valid but unrecognized option."""
class InvalidPragmaError(PragmaParserError):
- """Thrown in case the pragma is invalid"""
+ """Thrown in case the pragma is invalid."""
def parse_pragma(pylint_pragma: str) -> Generator[PragmaRepresenter, None, None]:
diff --git a/script/bump_changelog.py b/script/bump_changelog.py
index 6e25719d4..af32b3cdf 100644
--- a/script/bump_changelog.py
+++ b/script/bump_changelog.py
@@ -1,7 +1,9 @@
# ORIGINAL here: https://github.com/PyCQA/astroid/blob/main/script/bump_changelog.py
# DO NOT MODIFY DIRECTLY
-"""This script permits to upgrade the changelog in astroid or pylint when releasing a version."""
+"""This script permits to upgrade the changelog in astroid or pylint when releasing a
+version.
+"""
# pylint: disable=logging-fstring-interpolation
import argparse
import enum
diff --git a/script/fix_documentation.py b/script/fix_documentation.py
index 36fd931f0..4039968f1 100644
--- a/script/fix_documentation.py
+++ b/script/fix_documentation.py
@@ -1,4 +1,7 @@
-"""Small script to fix various issues with the documentation. Used by pre-commit."""
+"""Small script to fix various issues with the documentation.
+
+Used by pre-commit.
+"""
import argparse
import re
import sys
@@ -23,7 +26,7 @@ def fix_inline_code_blocks(file_content: str) -> str:
def changelog_insert_empty_lines(file_content: str, subtitle_text: str) -> str:
- """Insert up to two empty lines before `What's New` entry in ChangeLog"""
+ """Insert up to two empty lines before `What's New` entry in ChangeLog."""
lines = file_content.split("\n")
subtitle_count = 0
for i, line in enumerate(lines):
diff --git a/script/get_unused_message_id_category.py b/script/get_unused_message_id_category.py
index 5ddcd0b3c..2741148c0 100644
--- a/script/get_unused_message_id_category.py
+++ b/script/get_unused_message_id_category.py
@@ -1,4 +1,4 @@
-"""Small script to get a new unused message id category"""
+"""Small script to get a new unused message id category."""
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
@@ -10,7 +10,7 @@ from pylint.lint.pylinter import PyLinter
def register_all_checkers_and_plugins(linter: "PyLinter") -> None:
- """Registers all checkers and plugins"""
+ """Registers all checkers and plugins."""
linter.cmdline_parser.set_conflict_handler("resolve")
initialize_checkers(linter)
initialize_extensions(linter)
diff --git a/tests/checkers/unittest_design.py b/tests/checkers/unittest_design.py
index faf8f6e9e..09d4975bf 100644
--- a/tests/checkers/unittest_design.py
+++ b/tests/checkers/unittest_design.py
@@ -24,8 +24,8 @@ class TestDesignChecker(CheckerTestCase):
max_parents=1,
)
def test_too_many_ancestors_ignored_parents_are_skipped(self) -> None:
- """Make sure that classes listed in ``ignored-parents`` aren't counted
- by the too-many-ancestors message.
+ """Make sure that classes listed in ``ignored-parents`` aren't counted by the
+ too- many-ancestors message.
"""
node = astroid.extract_node(
@@ -47,7 +47,7 @@ class TestDesignChecker(CheckerTestCase):
@set_config(exclude_too_few_public_methods="toml.*")
def test_exclude_too_few_methods_with_value(self) -> None:
- """Test exclude-too-few-public-methods option with value"""
+ """Test exclude-too-few-public-methods option with value."""
options = get_global_option(self.checker, "exclude-too-few-public-methods")
assert any(i.match("toml") for i in options)
@@ -56,6 +56,7 @@ class TestDesignChecker(CheckerTestCase):
def test_ignore_paths_with_no_value(self) -> None:
"""Test exclude-too-few-public-methods option with no value.
+
Compare against actual list to see if validator works.
"""
options = get_global_option(self.checker, "exclude-too-few-public-methods")
diff --git a/tests/checkers/unittest_format.py b/tests/checkers/unittest_format.py
index 8aa7ec0c7..6e0025a9f 100644
--- a/tests/checkers/unittest_format.py
+++ b/tests/checkers/unittest_format.py
@@ -26,7 +26,7 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-"""Check format checker helper functions"""
+"""Check format checker helper functions."""
import os
import tempfile
@@ -108,8 +108,8 @@ class TestSuperfluousParentheses(CheckerTestCase):
self.checker._check_keyword_parentheses(_tokenize_str(code), offset)
def testNoSuperfluousParensWalrusOperatorIf(self) -> None:
- """Parenthesis change the meaning of assignment in the walrus operator
- and so are not always superfluous:
+ """Parenthesis change the meaning of assignment in the walrus operator and so
+ are not always superfluous:
"""
cases = [
("if (odd := is_odd(i))\n"),
@@ -120,7 +120,7 @@ class TestSuperfluousParentheses(CheckerTestCase):
self.checker.process_tokens(_tokenize_str(code))
def testPositiveSuperfluousParensWalrusOperatorIf(self) -> None:
- """Test positive superfluous parens cases with the walrus operator"""
+ """Test positive superfluous parens cases with the walrus operator."""
cases = [
(
MessageTest("superfluous-parens", line=1, args="if"),
@@ -162,10 +162,9 @@ class TestCheckSpace(CheckerTestCase):
CHECKER_CLASS = FormatChecker
def test_encoding_token(self) -> None:
- """Make sure the encoding token doesn't change the checker's behavior
+ """Make sure the encoding token doesn't change the checker's behavior.
- _tokenize_str doesn't produce an encoding token, but
- reading a file does
+ _tokenize_str doesn't produce an encoding token, but reading a file does
"""
with self.assertNoMessages():
encoding_token = tokenize.TokenInfo(
@@ -178,8 +177,8 @@ class TestCheckSpace(CheckerTestCase):
def test_disable_global_option_end_of_line() -> None:
- """Test for issue with disabling tokenizer messages
- that extend beyond the scope of the ast tokens
+ """Test for issue with disabling tokenizer messages that extend beyond the scope of
+ the ast tokens.
"""
file_ = tempfile.NamedTemporaryFile("w", delete=False)
with file_:
diff --git a/tests/checkers/unittest_similar.py b/tests/checkers/unittest_similar.py
index 5caaac794..2f2b43115 100644
--- a/tests/checkers/unittest_similar.py
+++ b/tests/checkers/unittest_similar.py
@@ -394,7 +394,7 @@ def test_no_args() -> None:
def test_get_map_data() -> None:
- """Tests that a SimilarChecker respects the MapReduceMixin interface"""
+ """Tests that a SimilarChecker respects the MapReduceMixin interface."""
linter = PyLinter(reporter=Reporter())
# Add a parallel checker to ensure it can map and reduce
linter.register_checker(similar.SimilarChecker(linter))
diff --git a/tests/checkers/unittest_stdlib.py b/tests/checkers/unittest_stdlib.py
index 88f5c7922..cc8991b9d 100644
--- a/tests/checkers/unittest_stdlib.py
+++ b/tests/checkers/unittest_stdlib.py
@@ -43,9 +43,10 @@ class TestStdlibChecker(CheckerTestCase):
def test_deprecated_no_qname_on_unexpected_nodes(self) -> None:
"""Test that we don't crash on nodes which don't have a qname method.
- While this test might seem weird since it uses a transform, it's actually testing a crash
- that happened in production, but there was no way to retrieve the code for which this
- occurred (how an AssignAttr got to be the result of a function inference beats me...)
+ While this test might seem weird since it uses a transform, it's actually
+ testing a crash that happened in production, but there was no way to retrieve
+ the code for which this occurred (how an AssignAttr got to be the result of a
+ function inference beats me...)
"""
def infer_func(
diff --git a/tests/checkers/unittest_typecheck.py b/tests/checkers/unittest_typecheck.py
index cafb3b40f..4564a461e 100644
--- a/tests/checkers/unittest_typecheck.py
+++ b/tests/checkers/unittest_typecheck.py
@@ -46,7 +46,7 @@ needs_c_extension = pytest.mark.skipif(
class TestTypeChecker(CheckerTestCase):
- """Tests for pylint.checkers.typecheck"""
+ """Tests for pylint.checkers.typecheck."""
CHECKER_CLASS = typecheck.TypeChecker
diff --git a/tests/checkers/unittest_utils.py b/tests/checkers/unittest_utils.py
index 58ff5ed73..1b916b98a 100644
--- a/tests/checkers/unittest_utils.py
+++ b/tests/checkers/unittest_utils.py
@@ -489,7 +489,7 @@ def test_is_empty_literal() -> None:
def test_deprecation_is_inside_lambda() -> None:
- """Test that is_inside_lambda is throwing a DeprecationWarning"""
+ """Test that is_inside_lambda is throwing a DeprecationWarning."""
with pytest.warns(DeprecationWarning) as records:
utils.is_inside_lambda(nodes.NodeNG())
assert len(records) == 1
diff --git a/tests/checkers/unittest_variables.py b/tests/checkers/unittest_variables.py
index f42c3fbae..352703403 100644
--- a/tests/checkers/unittest_variables.py
+++ b/tests/checkers/unittest_variables.py
@@ -182,8 +182,7 @@ class TestVariablesCheckerWithTearDown(CheckerTestCase):
self.walk(node)
def test_nested_lambda(self) -> None:
- """Make sure variables from parent lambdas
- aren't noted as undefined
+ """Make sure variables from parent lambdas aren't noted as undefined.
https://github.com/PyCQA/pylint/issues/760
"""
@@ -197,9 +196,7 @@ class TestVariablesCheckerWithTearDown(CheckerTestCase):
@set_config(ignored_argument_names=re.compile("arg"))
def test_ignored_argument_names_no_message(self) -> None:
- """Make sure is_ignored_argument_names properly ignores
- function arguments
- """
+ """Make sure is_ignored_argument_names properly ignores function arguments."""
node = astroid.parse(
"""
def fooby(arg):
diff --git a/tests/config/file_to_lint.py b/tests/config/file_to_lint.py
index e7c395dd9..bc3f722d9 100644
--- a/tests/config/file_to_lint.py
+++ b/tests/config/file_to_lint.py
@@ -1 +1 @@
-"""Perfect module with only documentation for configuration tests"""
+"""Perfect module with only documentation for configuration tests."""
diff --git a/tests/config/test_functional_config_loading.py b/tests/config/test_functional_config_loading.py
index 1937435f7..3f571aa33 100644
--- a/tests/config/test_functional_config_loading.py
+++ b/tests/config/test_functional_config_loading.py
@@ -2,8 +2,8 @@
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
"""This launches the configuration functional tests. This permits to test configuration
-files by providing a file with the appropriate extension in the ``tests/config/functional``
-directory.
+files by providing a file with the appropriate extension in the
+``tests/config/functional`` directory.
Let's say you have a regression_list_crash.toml file to test. Then, if there is an error in the conf,
add ``regression_list_crash.out`` alongside your file with the expected output of pylint in it. Use
diff --git a/tests/config/unittest_config.py b/tests/config/unittest_config.py
index 72474abe3..80f895000 100644
--- a/tests/config/unittest_config.py
+++ b/tests/config/unittest_config.py
@@ -76,8 +76,8 @@ def test__regexp_csv_validator_invalid() -> None:
class TestPyLinterOptionSetters(CheckerTestCase):
- """Class to check the set_config decorator and get_global_option util
- for options declared in PyLinter.
+ """Class to check the set_config decorator and get_global_option util for options
+ declared in PyLinter.
"""
class Checker(BaseChecker):
@@ -89,7 +89,7 @@ class TestPyLinterOptionSetters(CheckerTestCase):
@set_config(ignore_paths=".*/tests/.*,.*\\ignore\\.*")
def test_ignore_paths_with_value(self) -> None:
- """Test ignore-paths option with value"""
+ """Test ignore-paths option with value."""
options = get_global_option(self.checker, "ignore-paths")
assert any(i.match("dir/tests/file.py") for i in options)
@@ -99,6 +99,7 @@ class TestPyLinterOptionSetters(CheckerTestCase):
def test_ignore_paths_with_no_value(self) -> None:
"""Test ignore-paths option with no value.
+
Compare against actual list to see if validator works.
"""
options = get_global_option(self.checker, "ignore-paths")
diff --git a/tests/conftest.py b/tests/conftest.py
index bdd3e4516..1f2347a1a 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -74,7 +74,7 @@ def pytest_addoption(parser) -> None:
def pytest_collection_modifyitems(config, items) -> None:
- """Convert command line options to markers"""
+ """Convert command line options to markers."""
# Add skip_primer_external mark
if not config.getoption("--primer-external"):
skip_primer_external = pytest.mark.skip(
diff --git a/tests/data/ascript b/tests/data/ascript
index f401ebc4b..729e5a61c 100755
--- a/tests/data/ascript
+++ b/tests/data/ascript
@@ -1,2 +1,4 @@
#!/usr/bin/python
-"""ttttttttttttttttttttoooooooooooooooooooooooooooooooooooooooooooooooooooooo lllllllllllooooooooooooooooooooooooooooonnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnngggggggggggggggggg"""
+"""ttttttttttttttttttttoooooooooooooooooooooooooooooooooooooooooooooooooooooo l
+llllllllllooooooooooooooooooooooooooooonnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnngggg
+gggggggggggggg."""
diff --git a/tests/data/clientmodule_test.py b/tests/data/clientmodule_test.py
index 82deaaf6f..b5e4deff7 100644
--- a/tests/data/clientmodule_test.py
+++ b/tests/data/clientmodule_test.py
@@ -1,8 +1,8 @@
-""" docstring for file clientmodule.py """
+"""docstring for file clientmodule.py."""
from data.suppliermodule_test import Interface, DoNothing, DoNothing2
class Ancestor:
- """ Ancestor method """
+ """Ancestor method."""
__implements__ = (Interface,)
cls_member = DoNothing()
@@ -12,7 +12,7 @@ class Ancestor:
self.__value = value
def get_value(self):
- """ nice docstring ;-) """
+ """nice docstring ;-)"""
return self.__value
def set_value(self, value):
diff --git a/tests/data/property_pattern.py b/tests/data/property_pattern.py
index 2828922f0..9728d8572 100644
--- a/tests/data/property_pattern.py
+++ b/tests/data/property_pattern.py
@@ -1,10 +1,10 @@
-""" docstring for file property_pattern.py """
+"""docstring for file property_pattern.py."""
class PropertyPatterns:
prop1 = property(lambda self: self._prop1*2, None, None, "property usage 1")
@property
def prop2(self):
- """property usage 2"""
+ """property usage 2."""
return self._prop2
@prop2.setter
diff --git a/tests/data/suppliermodule_test.py b/tests/data/suppliermodule_test.py
index 9c8b05d52..6e87fd619 100644
--- a/tests/data/suppliermodule_test.py
+++ b/tests/data/suppliermodule_test.py
@@ -1,4 +1,4 @@
-""" file suppliermodule.py """
+"""file suppliermodule.py."""
from typing import Optional
class Interface:
diff --git a/tests/extensions/test_check_docs_utils.py b/tests/extensions/test_check_docs_utils.py
index 0414d05a4..77b793868 100644
--- a/tests/extensions/test_check_docs_utils.py
+++ b/tests/extensions/test_check_docs_utils.py
@@ -12,8 +12,8 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-"""Unit tests for the pylint checkers in :mod:`pylint.extensions.check_docs`,
-in particular the parameter documentation checker `DocstringChecker`
+"""Unit tests for the pylint checkers in :mod:`pylint.extensions.check_docs`, in
+particular the parameter documentation checker `DocstringChecker`
"""
import astroid
import pytest
@@ -26,7 +26,7 @@ from pylint.extensions import _check_docs_utils as utils
[("abc", 0), ("", 0), (" abc", 2), ("\n abc", 0), (" \n abc", 3)],
)
def test_space_indentation(string: str, count: int) -> None:
- """Test for pylint_plugin.ParamDocChecker"""
+ """Test for pylint_plugin.ParamDocChecker."""
assert utils.space_indentation(string) == count
diff --git a/tests/functional/a/abstract/abstract_abc_methods.py b/tests/functional/a/abstract/abstract_abc_methods.py
index d63389c50..359414d21 100644
--- a/tests/functional/a/abstract/abstract_abc_methods.py
+++ b/tests/functional/a/abstract/abstract_abc_methods.py
@@ -1,17 +1,17 @@
-""" This should not warn about `prop` being abstract in Child """
+"""This should not warn about `prop` being abstract in Child."""
# pylint: disable=too-few-public-methods, useless-object-inheritance
import abc
class Parent(object):
- """Abstract Base Class """
+ """Abstract Base Class."""
__metaclass__ = abc.ABCMeta
@property
@abc.abstractmethod
def prop(self):
- """ Abstract """
+ """Abstract."""
class Child(Parent):
- """ No warning for the following. """
+ """No warning for the following."""
prop = property(lambda self: 1)
diff --git a/tests/functional/a/abstract/abstract_class_instantiated.py b/tests/functional/a/abstract/abstract_class_instantiated.py
index 85facb540..24aa59079 100644
--- a/tests/functional/a/abstract/abstract_class_instantiated.py
+++ b/tests/functional/a/abstract/abstract_class_instantiated.py
@@ -1,7 +1,5 @@
-"""Check that instantiating a class with
-`abc.ABCMeta` as metaclass fails if it defines
-abstract methods.
-"""
+"""Check that instantiating a class with `abc.ABCMeta` as metaclass fails if it defines
+abstract methods."""
# pylint: disable=too-few-public-methods, missing-docstring
# pylint: disable=abstract-method, import-error, useless-object-inheritance
@@ -16,23 +14,23 @@ class GoodClass(object, metaclass=abc.ABCMeta):
class SecondGoodClass(object, metaclass=abc.ABCMeta):
def test(self):
- """ do nothing. """
+ """do nothing."""
class ThirdGoodClass(object, metaclass=abc.ABCMeta):
- """ This should not raise the warning. """
+ """This should not raise the warning."""
def test(self):
raise NotImplementedError()
class BadClass(object, metaclass=abc.ABCMeta):
@abc.abstractmethod
def test(self):
- """ do nothing. """
+ """do nothing."""
class SecondBadClass(object, metaclass=abc.ABCMeta):
@property
@abc.abstractmethod
def test(self):
- """ do nothing. """
+ """do nothing."""
class ThirdBadClass(SecondBadClass):
pass
@@ -89,14 +87,13 @@ class SomeMetaclass(metaclass=abc.ABCMeta):
pass
class FourthGoodClass(SomeMetaclass):
- """Don't consider this abstract if some attributes are
- there, but can't be inferred.
- """
+ """Don't consider this abstract if some attributes are there, but can't be
+ inferred."""
prop = Bala # missing
def main():
- """ do nothing """
+ """do nothing."""
GoodClass()
SecondGoodClass()
ThirdGoodClass()
@@ -129,15 +126,13 @@ def main2():
class BadClassTwo(abc.ABC):
- """
- Check that instantiating a class with `abc.ABCMeta` as ancestor fails if it
- defines abstract methods.
- """
+ """Check that instantiating a class with `abc.ABCMeta` as ancestor fails if it
+ defines abstract methods."""
@abc.abstractmethod
def test(self):
pass
def main_two():
- """ do nothing """
+ """do nothing."""
BadClassTwo() # [abstract-class-instantiated]
diff --git a/tests/functional/a/abstract/abstract_method.py b/tests/functional/a/abstract/abstract_method.py
index be924469d..f1e1744e1 100644
--- a/tests/functional/a/abstract/abstract_method.py
+++ b/tests/functional/a/abstract/abstract_method.py
@@ -8,47 +8,45 @@ import abc
class Abstract(object):
def aaaa(self):
- """should be overridden in concrete class"""
+ """should be overridden in concrete class."""
raise NotImplementedError()
def bbbb(self):
- """should be overridden in concrete class"""
+ """should be overridden in concrete class."""
raise NotImplementedError()
class AbstractB(Abstract):
"""Abstract class.
- this class is checking that it does not output an error msg for
- unimplemeted methods in abstract classes
+ this class is checking that it does not output an error msg for unimplemeted methods
+ in abstract classes
"""
def cccc(self):
- """should be overridden in concrete class"""
+ """should be overridden in concrete class."""
raise NotImplementedError()
class AbstractC(AbstractB, abc.ABC):
- """
- Abstract class.
+ """Abstract class.
- Should not trigger a warning for unimplemented
- abstract methods, because of explicit abc.ABC inheritance.
+ Should not trigger a warning for unimplemented abstract methods, because of explicit
+ abc.ABC inheritance.
"""
class AbstractD(AbstractB, metaclass=abc.ABCMeta):
- """
- Abstract class.
+ """Abstract class.
- Should not trigger a warning for unimplemented
- abstract methods, because of explicit metaclass.
+ Should not trigger a warning for unimplemented abstract methods, because of explicit
+ metaclass.
"""
class Concrete(Abstract): # [abstract-method]
- """Concrete class"""
+ """Concrete class."""
def aaaa(self):
- """overridden form Abstract"""
+ """overridden form Abstract."""
class Structure(object, metaclass=abc.ABCMeta):
diff --git a/tests/functional/a/access/access_attr_before_def_false_positive.py b/tests/functional/a/access/access_attr_before_def_false_positive.py
index fbad8c377..d1d0fd8f2 100644
--- a/tests/functional/a/access/access_attr_before_def_false_positive.py
+++ b/tests/functional/a/access/access_attr_before_def_false_positive.py
@@ -1,18 +1,18 @@
# pylint: disable=invalid-name,too-many-public-methods,attribute-defined-outside-init
# pylint: disable= useless-object-inheritance,too-few-public-methods
-"""This module demonstrates a possible problem of pyLint with calling __init__ s
-from inherited classes.
+"""This module demonstrates a possible problem of pyLint with calling __init__ s from
+inherited classes.
+
Initializations done there are not considered, which results in Error E0203 for
-self.cookedq."""
+self.cookedq.
+"""
from __future__ import print_function
import telnetlib
class SeeTelnet(telnetlib.Telnet):
- """
- Extension of telnetlib.
- """
+ """Extension of telnetlib."""
def __init__(self, host=None, port=0):
"""
@@ -38,17 +38,17 @@ class SeeTelnet(telnetlib.Telnet):
maxLength = len(match)
class Base(object):
- """bla bla"""
+ """bla bla."""
dougloup_papa = None
def __init__(self):
self._var = False
class Derived(Base):
- """derived blabla"""
+ """derived blabla."""
dougloup_moi = None
def Work(self):
- """do something"""
+ """do something."""
# E0203 - Access to member '_var' before its definition
if self._var:
print("True")
@@ -67,7 +67,7 @@ class Derived(Base):
class QoSALConnection(object):
- """blabla"""
+ """blabla."""
_the_instance = None
@@ -80,18 +80,16 @@ class QoSALConnection(object):
pass
class DefinedOutsideInit(object):
- """use_attr is seen as the method defining attr because its in
- first position
- """
+ """use_attr is seen as the method defining attr because its in first position."""
def __init__(self):
self.reset()
def use_attr(self):
- """use and set members"""
+ """use and set members."""
if self.attr:
print('hop')
self.attr = 10
def reset(self):
- """reset members"""
+ """reset members."""
self.attr = 4
diff --git a/tests/functional/a/access/access_member_before_definition.py b/tests/functional/a/access/access_member_before_definition.py
index 224e6e43e..3d932a7e5 100644
--- a/tests/functional/a/access/access_member_before_definition.py
+++ b/tests/functional/a/access/access_member_before_definition.py
@@ -3,7 +3,7 @@
class Aaaa(object):
- """class with attributes defined in wrong order"""
+ """class with attributes defined in wrong order."""
def __init__(self):
var1 = self._var2 # [access-member-before-definition]
@@ -23,7 +23,7 @@ class Bbbb(object):
return attr
def catchme(self, attr):
- """no AttributeError caught"""
+ """no AttributeError caught."""
try:
return self._repo # [access-member-before-definition]
except ValueError:
diff --git a/tests/functional/a/access/access_to__name__.py b/tests/functional/a/access/access_to__name__.py
index 1a622824b..a5160f22e 100644
--- a/tests/functional/a/access/access_to__name__.py
+++ b/tests/functional/a/access/access_to__name__.py
@@ -1,17 +1,16 @@
# pylint: disable=too-few-public-methods, useless-object-inheritance
-"""test access to __name__ gives undefined member on new/old class instances
-but not on new/old class object
-"""
+"""test access to __name__ gives undefined member on new/old class instances but not on
+new/old class object."""
from __future__ import print_function
class Aaaa:
- """old class"""
+ """old class."""
def __init__(self):
print(self.__name__) # [no-member]
print(self.__class__.__name__)
class NewClass(object):
- """new class"""
+ """new class."""
def __new__(cls, *args, **kwargs):
print('new', cls.__name__)
diff --git a/tests/functional/a/access/access_to_protected_members.py b/tests/functional/a/access/access_to_protected_members.py
index 7d732dcc5..e2853d49d 100644
--- a/tests/functional/a/access/access_to_protected_members.py
+++ b/tests/functional/a/access/access_to_protected_members.py
@@ -45,46 +45,44 @@ print(INST._cls_protected) # [protected-access]
class Issue1031(object):
- """Test for GitHub issue 1031"""
+ """Test for GitHub issue 1031."""
_attr = 1
def correct_access(self):
- """Demonstrates correct access"""
+ """Demonstrates correct access."""
return type(self)._attr
def incorrect_access(self):
- """Demonstrates incorrect access"""
+ """Demonstrates incorrect access."""
if self._attr == 1:
return type(INST)._protected # [protected-access]
return None
class Issue1802(object):
- """Test for GitHub issue 1802"""
+ """Test for GitHub issue 1802."""
def __init__(self, value):
self._foo = value
self.__private = 2 * value
def __eq__(self, other):
- """Test a correct access as the access to protected member is in a special method"""
+ """Test a correct access as the access to protected member is in a special
+ method."""
if isinstance(other, self.__class__):
answer = self._foo == other._foo
return answer and self.__private == other.__private # [protected-access]
return False
def not_in_special(self, other):
- """
- Test an incorrect access as the access to protected member is not inside a special method
- """
+ """Test an incorrect access as the access to protected member is not inside a
+ special method."""
if isinstance(other, self.__class__):
return self._foo == other._foo # [protected-access]
return False
def __le__(self, other):
- """
- Test a correct access as the access to protected member
- is inside a special method even if it is deeply nested
- """
+ """Test a correct access as the access to protected member is inside a special
+ method even if it is deeply nested."""
if 2 > 1:
if isinstance(other, self.__class__):
if "answer" == "42":
@@ -92,17 +90,15 @@ class Issue1802(object):
return False
def __fake_special__(self, other):
- """
- Test an incorrect access as the access
- to protected member is not inside a licit special method
- """
+ """Test an incorrect access as the access to protected member is not inside a
+ licit special method."""
if isinstance(other, self.__class__):
return self._foo == other._foo # [protected-access]
return False
class Issue1159OtherClass(object):
- """Test for GitHub issue 1159"""
+ """Test for GitHub issue 1159."""
_foo = 0
@@ -111,7 +107,7 @@ class Issue1159OtherClass(object):
class Issue1159(object):
- """Test for GitHub issue 1159"""
+ """Test for GitHub issue 1159."""
_foo = 0
@@ -120,43 +116,33 @@ class Issue1159(object):
@classmethod
def access_cls_attr(cls):
- """
- Access to protected class members inside class methods is OK.
- """
+ """Access to protected class members inside class methods is OK."""
_ = cls._foo
@classmethod
def assign_cls_attr(cls):
- """
- Assignment to protected class members inside class methods is OK.
- """
+ """Assignment to protected class members inside class methods is OK."""
cls._foo = 1
@classmethod
def access_inst_attr(cls):
- """
- Access to protected instance members inside class methods is OK.
- """
+ """Access to protected instance members inside class methods is OK."""
instance = cls()
_ = instance._bar
@classmethod
def assign_inst_attr(cls):
- """
- Assignment to protected members inside class methods is OK.
- """
+ """Assignment to protected members inside class methods is OK."""
instance = cls()
instance._bar = 1
@classmethod
def access_other_attr(cls):
- """
- Access to protected instance members of other classes is not OK.
- """
+ """Access to protected instance members of other classes is not OK."""
instance = Issue1159OtherClass()
instance._bar = 3 # [protected-access]
@@ -164,49 +150,39 @@ class Issue1159(object):
class Issue1159Subclass(Issue1159):
- """Test for GitHub issue 1159"""
+ """Test for GitHub issue 1159."""
@classmethod
def access_inst_attr(cls):
- """
- Access to protected instance members inside class methods is OK.
- """
+ """Access to protected instance members inside class methods is OK."""
instance = cls()
_ = instance._bar
@classmethod
def assign_inst_attr(cls):
- """
- Assignment to protected instance members inside class methods is OK.
- """
+ """Assignment to protected instance members inside class methods is OK."""
instance = cls()
instance._bar = 1
@classmethod
def access_missing_member(cls):
- """
- Access to unassigned members inside class methods is not OK.
- """
+ """Access to unassigned members inside class methods is not OK."""
instance = cls()
_ = instance._baz # [no-member,protected-access]
@classmethod
def assign_missing_member(cls):
- """
- Defining attributes outside init is still not OK.
- """
+ """Defining attributes outside init is still not OK."""
instance = cls()
instance._qux = 1 # [attribute-defined-outside-init]
@classmethod
def access_other_attr(cls):
- """
- Access to protected instance members of other classes is not OK.
- """
+ """Access to protected instance members of other classes is not OK."""
instance = Issue1159OtherClass()
instance._bar = 3 # [protected-access]
@@ -214,9 +190,8 @@ class Issue1159Subclass(Issue1159):
class Issue3066:
- """Test for GitHub issue 3066
- Accessing of attributes/methods of inner and outer classes
- https://github.com/PyCQA/pylint/issues/3066"""
+ """Test for GitHub issue 3066 Accessing of attributes/methods of inner and outer
+ classes https://github.com/PyCQA/pylint/issues/3066."""
attr = 0
_attr = 1
@@ -227,7 +202,7 @@ class Issue3066:
@staticmethod
def foobar(i):
- """Test access from outer class"""
+ """Test access from outer class."""
Issue3066._attr = 2
Issue3066.Aclass._attr = "y" # [protected-access]
Issue3066.Aclass.Bclass._attr = "b" # [protected-access]
@@ -237,13 +212,13 @@ class Issue3066:
Issue3066.Aclass.Bclass._bar(i) # [protected-access]
class Aclass:
- """Inner class for GitHub issue 3066"""
+ """Inner class for GitHub issue 3066."""
_attr = "x"
@staticmethod
def foobar(i):
- """Test access from inner class"""
+ """Test access from inner class."""
Issue3066._attr = 2 # [protected-access]
Issue3066.Aclass._attr = "y"
Issue3066.Aclass.Bclass._attr = "b" # [protected-access]
@@ -257,13 +232,13 @@ class Issue3066:
"""Docstring."""
class Bclass:
- """Inner inner class for GitHub issue 3066"""
+ """Inner inner class for GitHub issue 3066."""
_attr = "a"
@staticmethod
def foobar(i):
- """Test access from inner inner class"""
+ """Test access from inner inner class."""
Issue3066._attr = 2 # [protected-access]
Issue3066.Aclass._attr = "y" # [protected-access]
Issue3066.Aclass.Bclass._attr = "b"
diff --git a/tests/functional/a/access/access_to_protected_members_typing.py b/tests/functional/a/access/access_to_protected_members_typing.py
index 4e5eee4c6..b8344a434 100644
--- a/tests/functional/a/access/access_to_protected_members_typing.py
+++ b/tests/functional/a/access/access_to_protected_members_typing.py
@@ -1,5 +1,5 @@
# pylint: disable=too-few-public-methods, invalid-name
-"""Test typing with a protected member"""
+"""Test typing with a protected member."""
from __future__ import annotations
@@ -13,7 +13,7 @@ class MyClass:
self.data = 1
def return_data(self) -> int:
- """Return data"""
+ """Return data."""
return self.data
def return_private_class(self) -> MyClass._Inner_Class:
diff --git a/tests/functional/a/anomalous_backslash_escape.py b/tests/functional/a/anomalous_backslash_escape.py
index f753dfd92..6f41d310d 100644
--- a/tests/functional/a/anomalous_backslash_escape.py
+++ b/tests/functional/a/anomalous_backslash_escape.py
@@ -1,4 +1,4 @@
-"""Test for anomalous backslash escapes in strings"""
+"""Test for anomalous backslash escapes in strings."""
BAD_ESCAPE = '\z' # [anomalous-backslash-in-string]
diff --git a/tests/functional/a/anomalous_unicode_escape.py b/tests/functional/a/anomalous_unicode_escape.py
index 7c863097b..9b754109f 100644
--- a/tests/functional/a/anomalous_unicode_escape.py
+++ b/tests/functional/a/anomalous_unicode_escape.py
@@ -1,5 +1,5 @@
# pylint:disable=pointless-string-statement, redundant-u-string-prefix
-"""Test for backslash escapes in byte vs unicode strings"""
+"""Test for backslash escapes in byte vs unicode strings."""
# Would be valid in Unicode, but probably not what you want otherwise
BAD_UNICODE = b'\u0042' # [anomalous-unicode-escape-in-string]
diff --git a/tests/functional/a/arguments.py b/tests/functional/a/arguments.py
index df9290345..eb36b2b1b 100644
--- a/tests/functional/a/arguments.py
+++ b/tests/functional/a/arguments.py
@@ -2,7 +2,7 @@
# pylint: disable=wrong-import-order, useless-object-inheritance,unnecessary-lambda, consider-using-f-string
def decorator(fun):
- """Decorator"""
+ """Decorator."""
return fun
@@ -16,7 +16,7 @@ class DemoClass(object):
@classmethod
def class_method(cls, arg):
- """class method"""
+ """class method."""
return arg + arg
def method(self, arg):
@@ -30,15 +30,15 @@ class DemoClass(object):
def function_1_arg(first_argument):
- """one argument function"""
+ """one argument function."""
return first_argument
def function_3_args(first_argument, second_argument, third_argument):
- """three arguments function"""
+ """three arguments function."""
return first_argument, second_argument, third_argument
def function_default_arg(one=1, two=2):
- """function with default value"""
+ """function with default value."""
return two, one
@@ -84,15 +84,15 @@ def method_tests():
import sys
class Text(object):
- """ Regression """
+ """Regression."""
if sys.version_info > (3,):
def __new__(cls):
- """ empty """
+ """empty."""
return object.__new__(cls)
else:
def __new__(cls):
- """ empty """
+ """empty."""
return object.__new__(cls)
Text()
@@ -125,7 +125,7 @@ class TypeCheckConstructor(object):
class Test(object):
- """ lambda needs Test instance as first argument """
+ """lambda needs Test instance as first argument."""
lam = lambda self, icon: (self, icon)
def test(self):
@@ -229,7 +229,7 @@ def mutation_decorator(fun):
def other_mutation_decorator(fun):
- """Another decorator that changes a function's signature"""
+ """Another decorator that changes a function's signature."""
def wrapper(*args, do_something=True, **kwargs):
if do_something:
return fun(*args, **kwargs)
diff --git a/tests/functional/a/arguments_differ.py b/tests/functional/a/arguments_differ.py
index d6689d920..8ddb505fc 100644
--- a/tests/functional/a/arguments_differ.py
+++ b/tests/functional/a/arguments_differ.py
@@ -66,10 +66,14 @@ class Varargs(object):
class VarargsChild(Varargs):
def has_kwargs(self, arg): # [arguments-differ]
- "Not okay to lose capabilities. Also, type has changed."
+ """Not okay to lose capabilities.
+
+ Also, type has changed.
+ """
def no_kwargs(self, arg, **kwargs): # [arguments-renamed]
- "Addition of kwargs does not violate LSP, but first argument's name has changed."
+ """Addition of kwargs does not violate LSP, but first argument's name has
+ changed."""
class Super(object):
@@ -159,9 +163,7 @@ class MyClass(SuperClass):
@staticmethod
def impl(*args, **kwargs):
- """
- Acceptable use of vararg in subclass because it does not violate LSP.
- """
+ """Acceptable use of vararg in subclass because it does not violate LSP."""
super().impl(*args, **kwargs)
@staticmethod
@@ -190,9 +192,7 @@ class Positional(object):
class PositionalChild(Positional):
def test(self, *args):
- """
- Acceptable use of vararg in subclass because it does not violate LSP.
- """
+ """Acceptable use of vararg in subclass because it does not violate LSP."""
super().test(args[0], args[1])
class Mixed(object):
@@ -204,18 +204,14 @@ class Mixed(object):
class MixedChild1(Mixed):
def mixed(self, first, *args, **kwargs):
- """
- Acceptable use of vararg in subclass because it does not violate LSP.
- """
+ """Acceptable use of vararg in subclass because it does not violate LSP."""
super().mixed(first, *args, **kwargs)
class MixedChild2(Mixed):
def mixed(self, first, *args, third, **kwargs):
- """
- Acceptable use of vararg in subclass because it does not violate LSP.
- """
+ """Acceptable use of vararg in subclass because it does not violate LSP."""
super().mixed(first, *args, third, **kwargs)
@@ -283,46 +279,46 @@ class ChildT3(ParentT3):
class AbstractFoo:
def kwonly_1(self, first, *, second, third):
- "Normal positional with two positional only params."
+ """Normal positional with two positional only params."""
def kwonly_2(self, *, first, second):
- "Two positional only parameter."
+ """Two positional only parameter."""
def kwonly_3(self, *, first, second):
- "Two positional only params."
+ """Two positional only params."""
def kwonly_4(self, *, first, second=None):
- "One positional only and another with a default."
+ """One positional only and another with a default."""
def kwonly_5(self, *, first, **kwargs):
- "Keyword only and keyword variadics."
+ """Keyword only and keyword variadics."""
def kwonly_6(self, first, second, *, third):
- "Two positional and one keyword"
+ """Two positional and one keyword."""
class Foo(AbstractFoo):
def kwonly_1(self, first, *, second): # [arguments-differ]
- "One positional and only one positional only param."
+ """One positional and only one positional only param."""
def kwonly_2(self, *, first): # [arguments-differ]
- "Only one positional parameter instead of two positional only parameters."
+ """Only one positional parameter instead of two positional only parameters."""
def kwonly_3(self, first, second): # [arguments-differ]
- "Two positional params."
+ """Two positional params."""
def kwonly_4(self, first, second): # [arguments-differ]
- "Two positional params."
+ """Two positional params."""
def kwonly_5(self, *, first): # [arguments-differ]
- "Keyword only, but no variadics."
+ """Keyword only, but no variadics."""
def kwonly_6(self, *args, **kwargs): # valid override
- "Positional and keyword variadics to pass through parent params"
+ """Positional and keyword variadics to pass through parent params."""
class Foo2(AbstractFoo):
def kwonly_6(self, first, *args, **kwargs): # valid override
- "One positional with the rest variadics to pass through parent params"
+ """One positional with the rest variadics to pass through parent params."""
diff --git a/tests/functional/a/arguments_differ_issue5371.py b/tests/functional/a/arguments_differ_issue5371.py
index a0cd39613..789da1a5d 100644
--- a/tests/functional/a/arguments_differ_issue5371.py
+++ b/tests/functional/a/arguments_differ_issue5371.py
@@ -1,10 +1,10 @@
-"""https://github.com/PyCQA/pylint/issues/5371"""
+"""https://github.com/PyCQA/pylint/issues/5371."""
from enum import Enum
class MyEnum(Enum):
- """
- Enum._generate_next_value_() in the stdlib currently lacks a
+ """Enum._generate_next_value_() in the stdlib currently lacks a.
+
@staticmethod decorator.
"""
diff --git a/tests/functional/a/arguments_out_of_order.py b/tests/functional/a/arguments_out_of_order.py
index 5538a1dba..9964ed241 100644
--- a/tests/functional/a/arguments_out_of_order.py
+++ b/tests/functional/a/arguments_out_of_order.py
@@ -2,17 +2,17 @@
def function_3_args(first_argument, second_argument, third_argument):
- """three arguments function"""
+ """three arguments function."""
return first_argument, second_argument, third_argument
def function_default_arg(one=1, two=2):
- """function with default value"""
+ """function with default value."""
return two, one
def args_out_of_order():
- """Tests for arguments-out-of-order"""
+ """Tests for arguments-out-of-order."""
first_argument = 1
second_argument = 2
third_argument = 3
diff --git a/tests/functional/a/assert_on_tuple.py b/tests/functional/a/assert_on_tuple.py
index 57dbd0907..acdfb140b 100644
--- a/tests/functional/a/assert_on_tuple.py
+++ b/tests/functional/a/assert_on_tuple.py
@@ -1,4 +1,4 @@
-'''Assert check example'''
+"""Assert check example."""
# pylint: disable=comparison-with-itself
assert (1 == 1, 2 == 2), "no error"
diff --git a/tests/functional/a/assign/assign_to_new_keyword.py b/tests/functional/a/assign/assign_to_new_keyword.py
index c5a23ca95..030913e56 100644
--- a/tests/functional/a/assign/assign_to_new_keyword.py
+++ b/tests/functional/a/assign/assign_to_new_keyword.py
@@ -1,4 +1,4 @@
-"""Tests for assign-to-new-keyword"""
+"""Tests for assign-to-new-keyword."""
# pylint: disable=missing-function-docstring, missing-class-docstring, too-few-public-methods, function-redefined
async = "foo" # [assign-to-new-keyword]
diff --git a/tests/functional/a/assign/assigning_non_slot.py b/tests/functional/a/assign/assigning_non_slot.py
index 2cd1483e0..85f256358 100644
--- a/tests/functional/a/assign/assigning_non_slot.py
+++ b/tests/functional/a/assign/assigning_non_slot.py
@@ -1,16 +1,15 @@
-""" Checks assigning attributes not found in class slots
-will trigger assigning-non-slot warning.
-"""
+"""Checks assigning attributes not found in class slots will trigger assigning- non-slot
+warning."""
# pylint: disable=too-few-public-methods, no-init, missing-docstring, import-error, useless-object-inheritance, redundant-u-string-prefix
from collections import deque
from missing import Unknown
class Empty(object):
- """ empty """
+ """empty."""
class Bad(object):
- """ missing not in slots. """
+ """missing not in slots."""
__slots__ = ['member']
@@ -18,7 +17,7 @@ class Bad(object):
self.missing = 42 # [assigning-non-slot]
class Bad2(object):
- """ missing not in slots """
+ """missing not in slots."""
__slots__ = [deque.__name__, 'member']
def __init__(self):
@@ -26,7 +25,7 @@ class Bad2(object):
self.missing = 42 # [assigning-non-slot]
class Bad3(Bad):
- """ missing not found in slots """
+ """missing not found in slots."""
__slots__ = ['component']
@@ -37,16 +36,14 @@ class Bad3(Bad):
super().__init__()
class Good(Empty):
- """ missing not in slots, but Empty doesn't
- specify __slots__.
- """
+ """missing not in slots, but Empty doesn't specify __slots__."""
__slots__ = ['a']
def __init__(self):
self.missing = 42
class Good2(object):
- """ Using __dict__ in slots will be safe. """
+ """Using __dict__ in slots will be safe."""
__slots__ = ['__dict__', 'comp']
@@ -55,7 +52,7 @@ class Good2(object):
self.missing = 5
class PropertyGood(object):
- """ Using properties is safe. """
+ """Using properties is safe."""
__slots__ = ['tmp', '_value']
@@ -72,7 +69,7 @@ class PropertyGood(object):
self.test = 42
class PropertyGood2(object):
- """ Using properties in the body of the class is safe. """
+ """Using properties in the body of the class is safe."""
__slots__ = ['_value']
def _getter(self):
@@ -90,8 +87,8 @@ class PropertyGood2(object):
class UnicodeSlots(object):
"""Using unicode objects in __slots__ is okay.
- On Python 3.3 onward, u'' is equivalent to '',
- so this test should be safe for both versions.
+ On Python 3.3 onward, u'' is equivalent to '', so this test should be safe for both
+ versions.
"""
__slots__ = (u'first', u'second')
@@ -168,7 +165,7 @@ TYPE = TypeVar('TYPE')
class Cls(Generic[TYPE]):
- """ Simple class with slots """
+ """Simple class with slots."""
__slots__ = ['value']
def __init__(self, value):
diff --git a/tests/functional/a/assign/assignment_expression.py b/tests/functional/a/assign/assignment_expression.py
index 3bfb5d488..7f9c906e6 100644
--- a/tests/functional/a/assign/assignment_expression.py
+++ b/tests/functional/a/assign/assignment_expression.py
@@ -1,4 +1,4 @@
-"""Test assignment expressions"""
+"""Test assignment expressions."""
# pylint: disable=missing-docstring,unused-argument,unused-import,invalid-name
# pylint: disable=blacklisted-name,unused-variable,pointless-statement,unused-variable
import re
diff --git a/tests/functional/a/assign/assignment_from_no_return.py b/tests/functional/a/assign/assignment_from_no_return.py
index 5415f6097..a0a5fa664 100644
--- a/tests/functional/a/assign/assignment_from_no_return.py
+++ b/tests/functional/a/assign/assignment_from_no_return.py
@@ -32,47 +32,47 @@ VALUE = some_func() # [assignment-from-no-return]
class Parent:
- """Parent class"""
+ """Parent class."""
def compute(self):
- """This isn't supported by all child classes"""
+ """This isn't supported by all child classes."""
# pylint: disable=no-self-use
raise ValueError('Not supported for this object')
def test(self):
- """Test"""
+ """Test."""
result = self.compute()
return result
class Child(Parent):
- """Child class"""
+ """Child class."""
def compute(self):
- """This is supported for this child class"""
+ """This is supported for this child class."""
return 42
# Regression test for https://github.com/PyCQA/pylint/issues/4220
class A:
- """Parent class"""
+ """Parent class."""
def f(self):
- """This returns something"""
+ """This returns something."""
return 42
class B(A):
- """Child class"""
+ """Child class."""
def __init__(self):
self.a = A()
result = self.a.f() # no error here
print(result)
def f(self):
- """This doesn't return anything"""
+ """This doesn't return anything."""
res = B().a.f() # no error here
diff --git a/tests/functional/a/assign/assignment_from_no_return_2.py b/tests/functional/a/assign/assignment_from_no_return_2.py
index f177f6a9a..710e8cacd 100644
--- a/tests/functional/a/assign/assignment_from_no_return_2.py
+++ b/tests/functional/a/assign/assignment_from_no_return_2.py
@@ -1,25 +1,24 @@
# pylint: disable=useless-return, useless-object-inheritance, condition-evals-to-constant
-"""check assignment to function call where the function doesn't return
-
- 'E1111': ('Assigning to function call which doesn\'t return',
- 'Used when an assignment is done on a function call but the \
- inferred function doesn\'t return anything.'),
- 'W1111': ('Assigning to function call which only returns None',
- 'Used when an assignment is done on a function call but the \
- inferred function returns nothing but None.'),
-
+"""check assignment to function call where the function doesn't return.
+
+'E1111': ('Assigning to function call which doesn\'t return',
+ 'Used when an assignment is done on a function call but the \
+ inferred function doesn\'t return anything.'),
+'W1111': ('Assigning to function call which only returns None',
+ 'Used when an assignment is done on a function call but the \
+ inferred function returns nothing but None.'),
"""
from __future__ import generators, print_function
def func_no_return():
- """function without return"""
+ """function without return."""
print('dougloup')
A = func_no_return() # [assignment-from-no-return]
def func_return_none():
- """function returning none"""
+ """function returning none."""
print('dougloup')
return None
@@ -34,7 +33,7 @@ A = func_implicit_return_none() # [assignment-from-none]
def func_return_none_and_smth():
- """function returning none and something else"""
+ """function returning none and something else."""
print('dougloup')
if 2 or 3:
return None
@@ -43,19 +42,19 @@ def func_return_none_and_smth():
A = func_return_none_and_smth()
def generator():
- """no problemo"""
+ """no problemo."""
yield 2
A = generator()
class Abstract(object):
- """bla bla"""
+ """bla bla."""
def abstract_method(self):
- """use to return something in concrete implementation"""
+ """use to return something in concrete implementation."""
raise NotImplementedError
def use_abstract(self):
- """should not issue E1111"""
+ """should not issue E1111."""
var = self.abstract_method()
print(var)
diff --git a/tests/functional/a/async_functions.py b/tests/functional/a/async_functions.py
index 3e634341c..195eb9f41 100644
--- a/tests/functional/a/async_functions.py
+++ b/tests/functional/a/async_functions.py
@@ -60,4 +60,4 @@ async def func(a, a, b=[]):
# +1: [empty-docstring, disallowed-name]
async def foo():
- ""
+ """"""
diff --git a/tests/functional/b/bad_exception_context.py b/tests/functional/b/bad_exception_context.py
index 2fbe2d660..170fe842a 100644
--- a/tests/functional/b/bad_exception_context.py
+++ b/tests/functional/b/bad_exception_context.py
@@ -1,4 +1,7 @@
-"""Check that raise ... from .. uses a proper exception context """
+"""Check that raise ...
+
+from .. uses a proper exception context
+"""
# pylint: disable=unreachable, import-error, multiple-imports
@@ -7,10 +10,10 @@ import socket, unknown
__revision__ = 0
class ExceptionSubclass(Exception):
- """ subclass """
+ """subclass."""
def test():
- """ docstring """
+ """docstring."""
raise IndexError from 1 # [bad-exception-context]
raise IndexError from None
raise IndexError from ZeroDivisionError
@@ -24,7 +27,7 @@ def test():
raise IndexError() from unknown
def function():
- """Function to be passed as exception"""
+ """Function to be passed as exception."""
try:
pass
diff --git a/tests/functional/b/bad_inline_option.py b/tests/functional/b/bad_inline_option.py
index ac6fc6642..2926e19bb 100644
--- a/tests/functional/b/bad_inline_option.py
+++ b/tests/functional/b/bad_inline_option.py
@@ -1,4 +1,4 @@
-"""errors-only is not usable as an inline option"""
+"""errors-only is not usable as an inline option."""
# +1: [bad-inline-option]
# pylint: disable missing-docstring
diff --git a/tests/functional/b/bad_option_value.py b/tests/functional/b/bad_option_value.py
index 073e828da..c93e07c31 100644
--- a/tests/functional/b/bad_option_value.py
+++ b/tests/functional/b/bad_option_value.py
@@ -1,4 +1,3 @@
# pylint:enable=W04044 # [bad-option-value]
-"""check unknown option
-"""
+"""check unknown option."""
__revision__ = 1
diff --git a/tests/functional/b/bad_reversed_sequence.py b/tests/functional/b/bad_reversed_sequence.py
index 3abdca25f..791d32023 100644
--- a/tests/functional/b/bad_reversed_sequence.py
+++ b/tests/functional/b/bad_reversed_sequence.py
@@ -1,4 +1,4 @@
-""" Checks that reversed() receive proper argument """
+"""Checks that reversed() receive proper argument."""
# pylint: disable=missing-docstring, useless-object-inheritance
# pylint: disable=too-few-public-methods,no-self-use
from collections import deque, OrderedDict
@@ -6,12 +6,12 @@ from enum import IntEnum
class GoodReversed(object):
- """ Implements __reversed__ """
+ """Implements __reversed__"""
def __reversed__(self):
return [1, 2, 3]
class SecondGoodReversed(object):
- """ Implements __len__ and __getitem__ """
+ """Implements __len__ and __getitem__"""
def __len__(self):
return 3
@@ -19,23 +19,22 @@ class SecondGoodReversed(object):
return index
class BadReversed(object):
- """ implements only len() """
+ """implements only len()"""
def __len__(self):
return 3
class SecondBadReversed(object):
- """ implements only __getitem__ """
+ """implements only __getitem__"""
def __getitem__(self, index):
return index
def uninferable(seq):
- """ This can't be inferred at this moment,
- make sure we don't have a false positive.
- """
+ """This can't be inferred at this moment, make sure we don't have a false
+ positive."""
return reversed(seq)
def test(path):
- """ test function """
+ """test function."""
seq = reversed() # No argument given
seq = reversed(None) # [bad-reversed-sequence]
seq = reversed([1, 2, 3])
@@ -65,7 +64,7 @@ def test_dict_ancestor_and_reversed():
def test_dont_emit_for_reversing_enums():
- """Don't emit when reversing enum classes"""
+ """Don't emit when reversing enum classes."""
class Color(IntEnum):
RED = 1
GREEN = 2
diff --git a/tests/functional/b/bad_reversed_sequence_py37.py b/tests/functional/b/bad_reversed_sequence_py37.py
index 5a0b2124c..bfa41fb6f 100644
--- a/tests/functional/b/bad_reversed_sequence_py37.py
+++ b/tests/functional/b/bad_reversed_sequence_py37.py
@@ -1,4 +1,4 @@
-""" Dictionaries are reversible starting on python 3.8"""
+"""Dictionaries are reversible starting on python 3.8."""
# pylint: disable=missing-docstring
diff --git a/tests/functional/b/bad_reversed_sequence_py38.py b/tests/functional/b/bad_reversed_sequence_py38.py
index 4651eb4f8..ae8a72fef 100644
--- a/tests/functional/b/bad_reversed_sequence_py38.py
+++ b/tests/functional/b/bad_reversed_sequence_py38.py
@@ -1,4 +1,4 @@
-""" Dictionaries are reversible starting on python 3.8"""
+"""Dictionaries are reversible starting on python 3.8."""
# pylint: disable=missing-docstring
@@ -6,7 +6,7 @@ reversed({'a': 1, 'b': 2})
class InheritDict(dict):
- """Inherits from dict"""
+ """Inherits from dict."""
reversed(InheritDict({'a': 1, 'b': 2}))
diff --git a/tests/functional/b/bad_string_format_type.py b/tests/functional/b/bad_string_format_type.py
index df39a2caa..f85a1a2d7 100644
--- a/tests/functional/b/bad_string_format_type.py
+++ b/tests/functional/b/bad_string_format_type.py
@@ -1,4 +1,4 @@
-"""Tests for bad string format type"""
+"""Tests for bad string format type."""
# pylint: disable=consider-using-f-string, pointless-statement
# Test formatting of bytes
diff --git a/tests/functional/b/base_init_vars.py b/tests/functional/b/base_init_vars.py
index b77ec2b8d..88efb946e 100644
--- a/tests/functional/b/base_init_vars.py
+++ b/tests/functional/b/base_init_vars.py
@@ -4,8 +4,7 @@
class BaseClass(object):
- """A simple base class
- """
+ """A simple base class."""
def __init__(self):
self.base_var = {}
@@ -16,16 +15,14 @@ class BaseClass(object):
"""ye"""
return with_
class MyClass(BaseClass):
- """Inherits from BaseClass
- """
+ """Inherits from BaseClass."""
def __init__(self):
BaseClass.__init__(self)
self.var = {}
def met(self):
- """Checks that base_var is not seen as defined outsite '__init__'
- """
+ """Checks that base_var is not seen as defined outsite '__init__'."""
self.var[1] = 'one'
self.base_var[1] = 'one'
return self.base_var, self.var
diff --git a/tests/functional/b/builtin_module_test.py b/tests/functional/b/builtin_module_test.py
index 9b1e7ce8e..49284e056 100644
--- a/tests/functional/b/builtin_module_test.py
+++ b/tests/functional/b/builtin_module_test.py
@@ -1,4 +1,4 @@
-"""test import from a builtin module"""
+"""test import from a builtin module."""
from __future__ import absolute_import
from math import log10
@@ -7,5 +7,5 @@ __revision__ = None
def log10_2():
- """bla bla bla"""
+ """bla bla bla."""
return log10(2)
diff --git a/tests/functional/c/cellvar_escaping_loop.py b/tests/functional/c/cellvar_escaping_loop.py
index 502ec75f1..a2d9db1b7 100644
--- a/tests/functional/c/cellvar_escaping_loop.py
+++ b/tests/functional/c/cellvar_escaping_loop.py
@@ -63,7 +63,7 @@ def good_case8():
def good_case9():
- """Ignore when the cell var is not defined in a loop"""
+ """Ignore when the cell var is not defined in a loop."""
i = 10
lst = []
for _ in range(10):
@@ -72,7 +72,7 @@ def good_case9():
def good_case10():
- """Ignore when a loop variable is showdowed by an inner function"""
+ """Ignore when a loop variable is showdowed by an inner function."""
lst = []
for i in range(10): # pylint: disable=unused-variable
def func():
@@ -87,14 +87,16 @@ def good_case10():
def good_case_issue3107():
- """Eager binding of cell variable when used in a non-trivial default argument expression.
- """
+ """Eager binding of cell variable when used in a non-trivial default argument
+ expression."""
for i in [[2], [3]]:
next(filter(lambda j, ix=i[0]: j == ix, [1, 3]))
def good_case_issue_5012():
- """Eager binding of cell variable when used as the default value of a keyword-only argument.
+ """Eager binding of cell variable when used as the default value of a keyword-only
+ argument.
+
https://github.com/PyCQA/pylint/issues/5012
"""
funs = []
@@ -199,7 +201,7 @@ def bad_case9():
def bad_case10():
- """Detect when a loop variable is the default argument for a nested function"""
+ """Detect when a loop variable is the default argument for a nested function."""
lst = []
for i in range(10):
def func():
@@ -213,7 +215,8 @@ def bad_case10():
def bad_case_issue2846():
- """Closing over variable that is used within a comprehension in the function body."""
+ """Closing over variable that is used within a comprehension in the function
+ body."""
lst_a = [
(lambda: n) # [cell-var-from-loop]
for n in range(3)
diff --git a/tests/functional/c/class_attributes.py b/tests/functional/c/class_attributes.py
index 1d41f9d7a..0c91c54ea 100644
--- a/tests/functional/c/class_attributes.py
+++ b/tests/functional/c/class_attributes.py
@@ -1,20 +1,20 @@
-"""Test that valid class attribute doesn't trigger errors"""
+"""Test that valid class attribute doesn't trigger errors."""
__revision__ = 'sponge bob'
# pylint: disable=useless-object-inheritance,missing-docstring,too-few-public-methods
class Clazz(object):
- "dummy class"
+ """dummy class."""
def __init__(self):
self.topic = 5
self._data = 45
def change_type(self, new_class):
- """Change type"""
+ """Change type."""
self.__class__ = new_class
def do_nothing(self):
- "I do nothing useful"
+ """I do nothing useful."""
return self.topic + 56
diff --git a/tests/functional/c/class_members_py30.py b/tests/functional/c/class_members_py30.py
index cb7267ce5..1b16bfee3 100644
--- a/tests/functional/c/class_members_py30.py
+++ b/tests/functional/c/class_members_py30.py
@@ -1,15 +1,15 @@
-""" Various tests for class members access. """
+"""Various tests for class members access."""
# pylint: disable=too-few-public-methods,import-error,no-init,missing-docstring, wrong-import-position,wrong-import-order, useless-object-inheritance
from missing import Missing
class MyClass(object):
- """class docstring"""
+ """class docstring."""
def __init__(self):
- """init"""
+ """init."""
self.correct = 1
def test(self):
- """test"""
+ """test."""
self.correct += 2
self.incorrect += 2 # [no-member]
del self.havenot # [no-member]
@@ -17,9 +17,7 @@ class MyClass(object):
self.nonexistent2[1] = 'hehe' # [no-member]
class XYZMixin(object):
- """access to undefined members should be ignored in mixin classes by
- default
- """
+ """access to undefined members should be ignored in mixin classes by default."""
def __init__(self):
print(self.nonexistent)
@@ -32,16 +30,16 @@ class NewClass(object):
from abc import ABCMeta
class TestMetaclass(object, metaclass=ABCMeta):
- """ Test attribute access for metaclasses. """
+ """Test attribute access for metaclasses."""
class Metaclass(type):
- """ metaclass """
+ """metaclass."""
@classmethod
def test(cls):
- """ classmethod """
+ """classmethod."""
class UsingMetaclass(object, metaclass=Metaclass):
- """ empty """
+ """empty."""
TestMetaclass.register(int)
UsingMetaclass.test()
diff --git a/tests/functional/c/class_protocol_ellipsis.py b/tests/functional/c/class_protocol_ellipsis.py
index ef5d3b34e..c3e5864dc 100644
--- a/tests/functional/c/class_protocol_ellipsis.py
+++ b/tests/functional/c/class_protocol_ellipsis.py
@@ -1,11 +1,11 @@
-""""Tests for return type checkers for protocol methods with ellipsis function body"""
+""""Tests for return type checkers for protocol methods with ellipsis function body."""
# pylint: disable=missing-class-docstring
from typing import Any, Iterator
class MyClass:
"""The "invalid-*-returned" messages shouldn't be emitted for stub functions
- Original issue: https://github.com/PyCQA/pylint/issues/4736"""
+ Original issue: https://github.com/PyCQA/pylint/issues/4736."""
def __len__(self) -> int:
...
diff --git a/tests/functional/c/class_scope.py b/tests/functional/c/class_scope.py
index a22ba721b..b441e8320 100644
--- a/tests/functional/c/class_scope.py
+++ b/tests/functional/c/class_scope.py
@@ -1,10 +1,10 @@
# pylint: disable=too-few-public-methods,no-init, useless-object-inheritance
-"""check for scope problems"""
+"""check for scope problems."""
__revision__ = None
class Well(object):
- """well"""
+ """well."""
attr = 42
get_attr = lambda arg=attr: arg * 24
# +1: [undefined-variable, used-before-assignment]
@@ -14,30 +14,30 @@ class Well(object):
bad_gen = list(attr + i for i in range(10)) # [undefined-variable]
class Data(object):
- """base hidden class"""
+ """base hidden class."""
class Sub(Data):
"""whaou, is Data found???"""
attr = Data() # [undefined-variable]
def func(self):
- """check Sub is not defined here"""
+ """check Sub is not defined here."""
return Sub(), self # [undefined-variable]
class Right:
- """right"""
+ """right."""
class Result1:
- """result one"""
+ """result one."""
OK = 0
def work(self) -> Result1:
- """good type hint"""
+ """good type hint."""
return self.Result1.OK
class Wrong:
- """wrong"""
+ """wrong."""
class Result2:
- """result two"""
+ """result two."""
OK = 0
def work(self) -> self.Result2: # [undefined-variable]
- """bad type hint"""
+ """bad type hint."""
return self.Result2.OK
diff --git a/tests/functional/c/classes_meth_could_be_a_function.py b/tests/functional/c/classes_meth_could_be_a_function.py
index 3abda55a0..ff1abebda 100644
--- a/tests/functional/c/classes_meth_could_be_a_function.py
+++ b/tests/functional/c/classes_meth_could_be_a_function.py
@@ -1,9 +1,8 @@
# pylint: disable=missing-docstring,too-few-public-methods,no-init,useless-object-inheritance
-"""
-#2479
+"""#2479.
-R0201 (formerly W0212), Method could be a function shouldn't be emitted in case
-like factory method pattern
+R0201 (formerly W0212), Method could be a function shouldn't be emitted in case like
+factory method pattern
"""
__revision__ = 1
diff --git a/tests/functional/c/classes_protected_member_access.py b/tests/functional/c/classes_protected_member_access.py
index 516efd7d4..39dfd48da 100644
--- a/tests/functional/c/classes_protected_member_access.py
+++ b/tests/functional/c/classes_protected_member_access.py
@@ -5,20 +5,20 @@ __revision__ = 1
# pylint: disable=no-classmethod-decorator, no-staticmethod-decorator, useless-object-inheritance
class A3123(object):
- """oypuee"""
+ """oypuee."""
_protected = 1
def __init__(self):
pass
def cmeth(cls, val):
- """set protected member"""
+ """set protected member."""
cls._protected = +val
cmeth = classmethod(cmeth)
def smeth(val):
- """set protected member"""
+ """set protected member."""
A3123._protected += val
smeth = staticmethod(smeth)
diff --git a/tests/functional/c/comparison_with_callable_typing_constants.py b/tests/functional/c/comparison_with_callable_typing_constants.py
index 70aa9763f..c084787ea 100644
--- a/tests/functional/c/comparison_with_callable_typing_constants.py
+++ b/tests/functional/c/comparison_with_callable_typing_constants.py
@@ -1,18 +1,16 @@
-"""Typing constants are actually implemented as functions, but they
-raise when called, so Pylint uses that to avoid false positives for
-comparison-with-callable.
-"""
+"""Typing constants are actually implemented as functions, but they raise when called,
+so Pylint uses that to avoid false positives for comparison-with- callable."""
from typing import Any, Optional
def check_any(type_) -> bool:
- """See https://github.com/PyCQA/pylint/issues/5557"""
+ """See https://github.com/PyCQA/pylint/issues/5557."""
return type_ == Any
def check_optional(type_) -> bool:
- """
- Unlike Any, Optional does not raise in its body.
+ """Unlike Any, Optional does not raise in its body.
+
It raises via its decorator: typing._SpecialForm.__call__()
"""
return type_ == Optional
diff --git a/tests/functional/c/condition_evals_to_constant.py b/tests/functional/c/condition_evals_to_constant.py
index cfd0b00f4..bab6c5865 100644
--- a/tests/functional/c/condition_evals_to_constant.py
+++ b/tests/functional/c/condition_evals_to_constant.py
@@ -1,10 +1,10 @@
-"""Test that boolean conditions simplify to a constant value"""
+"""Test that boolean conditions simplify to a constant value."""
# pylint: disable=pointless-statement
from unknown import Unknown # pylint: disable=import-error
def func(_):
- """Pointless function"""
+ """Pointless function."""
CONSTANT = 100
diff --git a/tests/functional/c/confidence_filter.py b/tests/functional/c/confidence_filter.py
index 42351998d..24f03b80d 100644
--- a/tests/functional/c/confidence_filter.py
+++ b/tests/functional/c/confidence_filter.py
@@ -3,7 +3,7 @@ from __future__ import print_function
# pylint: disable=useless-object-inheritance
class Client(object):
- """use provider class"""
+ """use provider class."""
def __init__(self):
self.set_later = 0
diff --git a/tests/functional/c/consider/consider_merging_isinstance.py b/tests/functional/c/consider/consider_merging_isinstance.py
index d3387bd5c..592502f26 100644
--- a/tests/functional/c/consider/consider_merging_isinstance.py
+++ b/tests/functional/c/consider/consider_merging_isinstance.py
@@ -1,9 +1,9 @@
-"""Checks use of consider-merging-isinstance"""
+"""Checks use of consider-merging-isinstance."""
# pylint:disable=line-too-long, simplifiable-condition
def isinstances():
- "Examples of isinstances"
+ """Examples of isinstances."""
var = range(10)
# merged
diff --git a/tests/functional/c/consider/consider_using_f_string.py b/tests/functional/c/consider/consider_using_f_string.py
index f6801989e..b27c92cad 100644
--- a/tests/functional/c/consider/consider_using_f_string.py
+++ b/tests/functional/c/consider/consider_using_f_string.py
@@ -1,4 +1,5 @@
-"""Test to see if a f-string would be possible and consider-using-f-string should be raised"""
+"""Test to see if a f-string would be possible and consider-using-f-string should be
+raised."""
# pylint: disable=unused-variable, invalid-name, missing-function-docstring, pointless-statement
# pylint: disable=expression-not-assigned, repeated-keyword, too-many-locals
@@ -55,7 +56,7 @@ def print_bad():
def statement_good():
- "String {}, {} or {}".format(*PARAM_LIST)
+ """String {}, {} or {}""".format(*PARAM_LIST)
"String {}, {}, {} or {}".format(*PARAM_LIST_SINGLE, *PARAM_LIST)
"String {Param}, {}, {} or {}".format(Param=PARAM_1, *PARAM_LIST)
"String {Param} {Param}".format(Param=PARAM_1)
@@ -74,7 +75,7 @@ def statement_good():
"%s" % "\n".join(i for i in "string")
def statement_bad():
- "String %f" % PARAM_1 # [consider-using-f-string]
+ """String %f.""" % PARAM_1 # [consider-using-f-string]
"String {}".format(PARAM_1) # [consider-using-f-string]
"String {Param_1}".format(Param_1=PARAM_1) # [consider-using-f-string]
"{} {}".format(PARAM_1, PARAM_2) # [consider-using-f-string]
diff --git a/tests/functional/c/consider/consider_using_with.py b/tests/functional/c/consider/consider_using_with.py
index 3466e15c0..993008adc 100644
--- a/tests/functional/c/consider/consider_using_with.py
+++ b/tests/functional/c/consider/consider_using_with.py
@@ -99,9 +99,8 @@ def test_lock_acquisition():
@contextlib.contextmanager
def test_lock_acquisition_in_context_manager1():
- """
- The message must not be triggered if the resource allocation is done inside a context manager.
- """
+ """The message must not be triggered if the resource allocation is done inside a
+ context manager."""
lock = threading.Lock()
lock.acquire() # must not trigger
yield
@@ -109,9 +108,8 @@ def test_lock_acquisition_in_context_manager1():
class MyLockContext:
- """
- The message must not be triggered if the resource allocation is done inside a context manager.
- """
+ """The message must not be triggered if the resource allocation is done inside a
+ context manager."""
def __init__(self):
self.lock = threading.Lock()
@@ -156,11 +154,12 @@ def test_suppress_in_exit_stack():
def test_futures():
- """
- Regression test for issue #4689.
- ThreadPoolExecutor and ProcessPoolExecutor were formerly part of the callables that raised
- the R1732 message if used outside a with block, but there are legitimate use cases where
- Executor instances are used e.g. as a persistent background worker pool throughout the program.
+ """Regression test for issue #4689.
+
+ ThreadPoolExecutor and ProcessPoolExecutor were formerly part of the callables that
+ raised the R1732 message if used outside a with block, but there are legitimate use
+ cases where Executor instances are used e.g. as a persistent background worker pool
+ throughout the program.
"""
thread_executor = ThreadPoolExecutor()
thread_executor.submit(print, 1)
@@ -218,12 +217,11 @@ with used_pool:
def test_subscript_assignment():
- """
- Regression test for issue https://github.com/PyCQA/pylint/issues/4732.
- If a context manager is assigned to a list or dict, we are not able to
- tell if / how the context manager is used later on, as it is not assigned
- to a variable or attribute directly.
- In this case we can only emit the message directly.
+ """Regression test for issue https://github.com/PyCQA/pylint/issues/4732.
+
+ If a context manager is assigned to a list or dict, we are not able to tell if / how
+ the context manager is used later on, as it is not assigned to a variable or
+ attribute directly. In this case we can only emit the message directly.
"""
job_list = [None, None]
job_list[0] = subprocess.Popen("ls") # [consider-using-with]
diff --git a/tests/functional/c/consider/consider_using_with_open.py b/tests/functional/c/consider/consider_using_with_open.py
index 7c584d8f5..ccf37c54d 100644
--- a/tests/functional/c/consider/consider_using_with_open.py
+++ b/tests/functional/c/consider/consider_using_with_open.py
@@ -1,10 +1,11 @@
# pylint: disable=missing-function-docstring, missing-module-docstring, invalid-name, import-outside-toplevel, no-self-use
# pylint: disable=missing-class-docstring, too-few-public-methods, unused-variable, multiple-statements, line-too-long
-"""
-The functional test for the standard ``open()`` function has to be moved in a separate file,
-because PyPy has to be excluded for the tests as the ``open()`` function is uninferable in PyPy.
-However, all remaining checks for consider-using-with work in PyPy, so we do not want to exclude
-PyPy from ALL functional tests.
+"""The functional test for the standard ``open()`` function has to be moved in a
+separate file, because PyPy has to be excluded for the tests as the ``open()`` function
+is uninferable in PyPy.
+
+However, all remaining checks for consider-using-with work in PyPy, so we do not want to
+exclude PyPy from ALL functional tests.
"""
from contextlib import contextmanager
from pathlib import Path
@@ -72,9 +73,8 @@ def test_suppress_on_return():
class TestControlFlow:
- """
- The message is triggered if a context manager is assigned to a variable, which name is later
- reassigned without the variable being used inside a ``with`` first.
+ """The message is triggered if a context manager is assigned to a variable, which
+ name is later reassigned without the variable being used inside a ``with`` first.
E.g. the following would trigger the message:
a = open("foo") # <-- would trigger here
diff --git a/tests/functional/c/control_pragmas.py b/tests/functional/c/control_pragmas.py
index 993f9a5dd..81ac3b780 100644
--- a/tests/functional/c/control_pragmas.py
+++ b/tests/functional/c/control_pragmas.py
@@ -2,7 +2,7 @@
def test_pragma():
- """Test that the control pragmas are not too eager to consume the entire line
+ """Test that the control pragmas are not too eager to consume the entire line.
We should stop either at:
- ; or #
diff --git a/tests/functional/c/crash_missing_module_type.py b/tests/functional/c/crash_missing_module_type.py
index 308606ff4..5dd3d45b1 100644
--- a/tests/functional/c/crash_missing_module_type.py
+++ b/tests/functional/c/crash_missing_module_type.py
@@ -1,16 +1,16 @@
-""" Test for a crash found in
-https://bitbucket.org/logilab/astroid/issue/45/attributeerror-module-object-has-no#comment-11944673
-"""
+"""Test for a crash found in
+https://bitbucket.org/logilab/astroid/issue/45/attributeerror-module-object- has-
+no#comment-11944673."""
# pylint: disable=no-init, invalid-name, too-few-public-methods, redefined-outer-name, useless-object-inheritance
def decor(trop):
- """ decorator """
+ """decorator."""
return trop
class Foo(object):
- """ Class """
+ """Class."""
@decor
def prop(self):
- """ method """
+ """method."""
return self
if __name__ == '__main__':
diff --git a/tests/functional/c/ctor_arguments.py b/tests/functional/c/ctor_arguments.py
index ee10413e3..bcd5ab7a8 100644
--- a/tests/functional/c/ctor_arguments.py
+++ b/tests/functional/c/ctor_arguments.py
@@ -7,15 +7,15 @@ Based on tests/functional/a/arguments.py
class Class1Arg(object):
def __init__(self, first_argument):
- """one argument function"""
+ """one argument function."""
class Class3Arg(object):
def __init__(self, first_argument, second_argument, third_argument):
- """three arguments function"""
+ """three arguments function."""
class ClassDefaultArg(object):
def __init__(self, one=1, two=2):
- """function with default value"""
+ """function with default value."""
class Subclass1Arg(Class1Arg):
pass
diff --git a/tests/functional/d/dangerous_default_value.py b/tests/functional/d/dangerous_default_value.py
index 161eaceed..5331751f5 100644
--- a/tests/functional/d/dangerous_default_value.py
+++ b/tests/functional/d/dangerous_default_value.py
@@ -4,15 +4,15 @@ import collections
HEHE = {}
def function1(value=[]): # [dangerous-default-value]
- """docstring"""
+ """docstring."""
return value
def function2(value=HEHE): # [dangerous-default-value]
- """docstring"""
+ """docstring."""
return value
def function3(value):
- """docstring"""
+ """docstring."""
return value
def function4(value=set()): # [dangerous-default-value]
@@ -38,19 +38,19 @@ def function8(value=list()): # [dangerous-default-value]
return value
def function9(value=[1, 2, 3, 4]): # [dangerous-default-value]
- """list with items should not output item values in error message"""
+ """list with items should not output item values in error message."""
return value
def function10(value={'a': 1, 'b': 2}): # [dangerous-default-value]
- """dictionaries with items should not output item values in error message"""
+ """dictionaries with items should not output item values in error message."""
return value
def function11(value=list([1, 2, 3])): # [dangerous-default-value]
- """list with items should not output item values in error message"""
+ """list with items should not output item values in error message."""
return value
def function12(value=dict([('a', 1), ('b', 2)])): # [dangerous-default-value]
- """dictionaries with items should not output item values in error message"""
+ """dictionaries with items should not output item values in error message."""
return value
OINK = {
@@ -59,13 +59,12 @@ OINK = {
}
def function13(value=OINK): # [dangerous-default-value]
- """dictionaries with items should not output item values in error message"""
+ """dictionaries with items should not output item values in error message."""
return value
def function14(value=dict([(1, 2), (1, 2, 3)])): # [dangerous-default-value]
"""a dictionary which will not be inferred to a syntax AST, but to an
- astroid.Instance.
- """
+ astroid.Instance."""
return value
INVALID_DICT = dict([(1, 2), (1, 2, 3)])
@@ -75,35 +74,35 @@ def function15(value=INVALID_DICT): # [dangerous-default-value]
return value
def function16(value={1}): # [dangerous-default-value]
- """set literal as default value"""
+ """set literal as default value."""
return value
def function17(value=collections.deque()): # [dangerous-default-value]
- """mutable, dangerous"""
+ """mutable, dangerous."""
return value
def function18(value=collections.ChainMap()): # [dangerous-default-value]
- """mutable, dangerous"""
+ """mutable, dangerous."""
return value
def function19(value=collections.Counter()): # [dangerous-default-value]
- """mutable, dangerous"""
+ """mutable, dangerous."""
return value
def function20(value=collections.OrderedDict()): # [dangerous-default-value]
- """mutable, dangerous"""
+ """mutable, dangerous."""
return value
def function21(value=collections.defaultdict()): # [dangerous-default-value]
- """mutable, dangerous"""
+ """mutable, dangerous."""
return value
def function22(value=collections.UserDict()): # [dangerous-default-value]
- """mutable, dangerous"""
+ """mutable, dangerous."""
return value
def function23(value=collections.UserList()): # [dangerous-default-value]
- """mutable, dangerous"""
+ """mutable, dangerous."""
return value
def function24(*, value=[]): # [dangerous-default-value]
diff --git a/tests/functional/d/dataclass_with_default_factory.py b/tests/functional/d/dataclass_with_default_factory.py
index db392d8b7..3e98a45d2 100644
--- a/tests/functional/d/dataclass_with_default_factory.py
+++ b/tests/functional/d/dataclass_with_default_factory.py
@@ -21,7 +21,7 @@ print(TEST.test[0])
@dc.dataclass # Note the use of dc instead of dataclasses
class Test2:
- """Test dataclass that uses a renamed import of dataclasses"""
+ """Test dataclass that uses a renamed import of dataclasses."""
int_prop: int = dc.field(default=10)
list_prop: list = dc.field(default_factory=list)
dict_prop: dict = dc.field(default_factory=dict)
@@ -46,5 +46,5 @@ Test2.int_prop["key"] = "value" # [unsupported-assignment-operation]
@dc.dataclass
class TEST3:
- """Test dataclass that puts call to field() in another function call"""
+ """Test dataclass that puts call to field() in another function call."""
attribute: int = cast(int, field(default_factory=dict))
diff --git a/tests/functional/d/dataclass_with_field.py b/tests/functional/d/dataclass_with_field.py
index 9a807becb..15129bfac 100644
--- a/tests/functional/d/dataclass_with_field.py
+++ b/tests/functional/d/dataclass_with_field.py
@@ -1,4 +1,4 @@
-"""Regression test for https://github.com/PyCQA/pylint/issues/4899"""
+"""Regression test for https://github.com/PyCQA/pylint/issues/4899."""
# pylint: disable=missing-docstring,too-few-public-methods
@@ -25,7 +25,7 @@ class Case:
self.items.append(item)
def find_item(self, description: str) -> Item:
- """Find an item by description"""
+ """Find an item by description."""
return next(
(item for item in self.items if item.description == description), None
diff --git a/tests/functional/d/decorator_scope.py b/tests/functional/d/decorator_scope.py
index 141c26d06..b1bbac64e 100644
--- a/tests/functional/d/decorator_scope.py
+++ b/tests/functional/d/decorator_scope.py
@@ -9,11 +9,11 @@ https://www.logilab.net/elo/ticket/5626 - name resolution bug inside classes
from __future__ import print_function
class Test(object):
- """test class"""
+ """test class."""
ident = lambda x: x
@ident(ident)
def method(self, val=ident(7), func=ident):
- """hop"""
+ """hop."""
print(self)
return func(val)
diff --git a/tests/functional/d/deprecated/deprecated_methods_py3.py b/tests/functional/d/deprecated/deprecated_methods_py3.py
index 80428c79f..e048a6a4b 100644
--- a/tests/functional/d/deprecated/deprecated_methods_py3.py
+++ b/tests/functional/d/deprecated/deprecated_methods_py3.py
@@ -1,4 +1,4 @@
-""" Functional tests for method deprecation. """
+"""Functional tests for method deprecation."""
# pylint: disable=missing-docstring, super-init-not-called, not-callable
import base64
import cgi
diff --git a/tests/functional/d/deprecated/deprecated_methods_py36.py b/tests/functional/d/deprecated/deprecated_methods_py36.py
index f416a144c..5c045165b 100644
--- a/tests/functional/d/deprecated/deprecated_methods_py36.py
+++ b/tests/functional/d/deprecated/deprecated_methods_py36.py
@@ -1,4 +1,4 @@
-""" Functional tests for method deprecation. """
+"""Functional tests for method deprecation."""
# pylint: disable=no-value-for-parameter
import unittest
from importlib.machinery import SourceFileLoader, SourcelessFileLoader
diff --git a/tests/functional/d/deprecated/deprecated_methods_py38.py b/tests/functional/d/deprecated/deprecated_methods_py38.py
index 35ec88f5a..9b44cc035 100644
--- a/tests/functional/d/deprecated/deprecated_methods_py38.py
+++ b/tests/functional/d/deprecated/deprecated_methods_py38.py
@@ -1,4 +1,4 @@
-""" Functional tests for method deprecation. """
+"""Functional tests for method deprecation."""
# pylint: disable=missing-docstring, super-init-not-called, not-callable
import base64
import inspect
diff --git a/tests/functional/d/disable_msg_next_line.py b/tests/functional/d/disable_msg_next_line.py
index f500feb1e..de9cb9e0e 100644
--- a/tests/functional/d/disable_msg_next_line.py
+++ b/tests/functional/d/disable_msg_next_line.py
@@ -1,4 +1,4 @@
-"""Test if disable-next only disables messages for the next line"""
+"""Test if disable-next only disables messages for the next line."""
# pylint: disable=missing-function-docstring
# pylint: disable-next=unused-argument, invalid-name
def function_A(arg1, arg2):
diff --git a/tests/functional/d/disable_ungrouped_imports.py b/tests/functional/d/disable_ungrouped_imports.py
index 48c06c01c..1a3cf2707 100644
--- a/tests/functional/d/disable_ungrouped_imports.py
+++ b/tests/functional/d/disable_ungrouped_imports.py
@@ -1,5 +1,5 @@
-"""Checks that disabling 'ungrouped-imports' on an import prevents subsequent
-imports from being considered ungrouped in respect to it."""
+"""Checks that disabling 'ungrouped-imports' on an import prevents subsequent imports
+from being considered ungrouped in respect to it."""
# pylint: disable=unused-import,wrong-import-position,wrong-import-order,using-constant-test
# pylint: disable=import-error
from os.path import basename
diff --git a/tests/functional/d/disable_wrong_import_order.py b/tests/functional/d/disable_wrong_import_order.py
index 1fdf83fb1..ae2f471a1 100644
--- a/tests/functional/d/disable_wrong_import_order.py
+++ b/tests/functional/d/disable_wrong_import_order.py
@@ -1,6 +1,6 @@
-"""Checks that disabling 'wrong-import-order' on an import prevents subsequent
-imports from being considered out-of-order in respect to it but does not prevent
-it from being considered for 'ungrouped-imports'."""
+"""Checks that disabling 'wrong-import-order' on an import prevents subsequent imports
+from being considered out-of-order in respect to it but does not prevent it from being
+considered for 'ungrouped-imports'."""
# pylint: disable=unused-import,import-error,no-name-in-module
from first_party.foo import bar # pylint: disable=wrong-import-order
diff --git a/tests/functional/d/disabled_msgid_in_pylintrc.py b/tests/functional/d/disabled_msgid_in_pylintrc.py
index 91cb155e1..c1b5d391f 100644
--- a/tests/functional/d/disabled_msgid_in_pylintrc.py
+++ b/tests/functional/d/disabled_msgid_in_pylintrc.py
@@ -1,4 +1,4 @@
-"""https://github.com/PyCQA/pylint/issues/4265"""
+"""https://github.com/PyCQA/pylint/issues/4265."""
try:
f = open('test', encoding="utf-8")
diff --git a/tests/functional/d/docstrings.py b/tests/functional/d/docstrings.py
index e9d137a7f..09f1f02f2 100644
--- a/tests/functional/d/docstrings.py
+++ b/tests/functional/d/docstrings.py
@@ -12,11 +12,11 @@ def function1(value):
print(value)
def function2(value):
- """docstring"""
+ """docstring."""
print(value)
def function3(value):
- """docstring"""
+ """docstring."""
print(value)
# +1: [missing-class-docstring]
@@ -41,7 +41,7 @@ class AAAA(object):
pass
def method2(self):
- """ yeah !"""
+ """yeah !"""
pass
# +1: [empty-docstring]
@@ -80,10 +80,10 @@ def function5():
pass
def function6():
- """ I am a {} docstring.""".format("good")
+ """I am a {} docstring.""".format("good")
def function7():
- """docstring"""
+ """docstring."""
def inner():
# Not documented
return 42
diff --git a/tests/functional/d/dotted_ancestor.py b/tests/functional/d/dotted_ancestor.py
index 89826179a..0b492515f 100644
--- a/tests/functional/d/dotted_ancestor.py
+++ b/tests/functional/d/dotted_ancestor.py
@@ -1,10 +1,10 @@
-"""bla"""
+"""bla."""
from ..n.non import non_init_parent_called
class Aaaa(non_init_parent_called.AAAA): # [too-few-public-methods]
- """test dotted name in ancestors"""
+ """test dotted name in ancestors."""
def __init__(self):
non_init_parent_called.AAAA.__init__(self)
diff --git a/tests/functional/d/duplicate_bases.py b/tests/functional/d/duplicate_bases.py
index 51b329a4f..197f428e1 100644
--- a/tests/functional/d/duplicate_bases.py
+++ b/tests/functional/d/duplicate_bases.py
@@ -11,8 +11,8 @@ class Alpha(str):
class NotDuplicates(Alpha, str):
- """The error should not be emitted for this case, since the
- other same base comes from the ancestors."""
+ """The error should not be emitted for this case, since the other same base comes
+ from the ancestors."""
print(Duplicates.__mro__)
diff --git a/tests/functional/d/duplicate_dict_literal_key.py b/tests/functional/d/duplicate_dict_literal_key.py
index 82e98d23e..0bfa2369b 100644
--- a/tests/functional/d/duplicate_dict_literal_key.py
+++ b/tests/functional/d/duplicate_dict_literal_key.py
@@ -1,11 +1,11 @@
-"""Check multiple key definition"""
+"""Check multiple key definition."""
# pylint: disable=pointless-statement, redundant-u-string-prefix
from enum import Enum
class MyEnum(Enum):
- """ Sample Enum for testing duplicate keys"""
+ """Sample Enum for testing duplicate keys."""
KEY = "key"
diff --git a/tests/functional/e/e1101_9588_base_attr_aug_assign.py b/tests/functional/e/e1101_9588_base_attr_aug_assign.py
index 7306840cb..87c0d860b 100644
--- a/tests/functional/e/e1101_9588_base_attr_aug_assign.py
+++ b/tests/functional/e/e1101_9588_base_attr_aug_assign.py
@@ -1,6 +1,5 @@
# pylint: disable=too-few-public-methods, useless-object-inheritance
-"""
-False positive case of E1101:
+"""False positive case of E1101:
The error is triggered when the attribute set in the base class is
modified with augmented assignment in a derived class.
@@ -10,29 +9,29 @@ https://www.logilab.org/ticket/9588
__revision__ = 0
class BaseClass(object):
- "The base class"
+ """The base class."""
def __init__(self):
- "Set an attribute."
+ """Set an attribute."""
self.e1101 = 1
class FalsePositiveClass(BaseClass):
- "The first derived class which triggers the false positive"
+ """The first derived class which triggers the false positive."""
def __init__(self):
- "Augmented assignment triggers E1101."
+ """Augmented assignment triggers E1101."""
BaseClass.__init__(self)
self.e1101 += 1
def countup(self):
- "Consequently this also triggers E1101."
+ """Consequently this also triggers E1101."""
self.e1101 += 1
class NegativeClass(BaseClass):
- "The second derived class, which does not trigger the error E1101"
+ """The second derived class, which does not trigger the error E1101."""
def __init__(self):
- "Ordinary assignment is OK."
+ """Ordinary assignment is OK."""
BaseClass.__init__(self)
self.e1101 = self.e1101 + 1
def countup(self):
- "No problem."
+ """No problem."""
self.e1101 += 1
diff --git a/tests/functional/e/empty_docstring.py b/tests/functional/e/empty_docstring.py
index 88901d883..253928cba 100644
--- a/tests/functional/e/empty_docstring.py
+++ b/tests/functional/e/empty_docstring.py
@@ -1,4 +1,4 @@
-'''''' # [empty-docstring]
+"""""" # [empty-docstring]
# pylint: disable=missing-module-docstring, missing-class-docstring, too-few-public-methods, pointless-string-statement
"""Tests for empty-docstring"""
@@ -6,5 +6,4 @@
class MyClass:
def __init__(self, my_param: int) -> None:
- '''
- '''
+ """"""
diff --git a/tests/functional/e/enum_subclasses.py b/tests/functional/e/enum_subclasses.py
index c8493da78..f4a19cdcc 100644
--- a/tests/functional/e/enum_subclasses.py
+++ b/tests/functional/e/enum_subclasses.py
@@ -3,7 +3,7 @@ from enum import Enum, IntEnum, auto
class Issue1932(IntEnum):
- """https://github.com/PyCQA/pylint/issues/1932"""
+ """https://github.com/PyCQA/pylint/issues/1932."""
FOO = 1
@@ -12,7 +12,7 @@ class Issue1932(IntEnum):
class Issue2062(Enum):
- """https://github.com/PyCQA/pylint/issues/2062"""
+ """https://github.com/PyCQA/pylint/issues/2062."""
FOO = 1
BAR = 2
diff --git a/tests/functional/e/eval_used.py b/tests/functional/e/eval_used.py
index d03dad7ca..7335fda9a 100644
--- a/tests/functional/e/eval_used.py
+++ b/tests/functional/e/eval_used.py
@@ -1,4 +1,4 @@
-"""test for eval usage"""
+"""test for eval usage."""
eval('os.listdir(".")') # [eval-used]
eval('os.listdir(".")', globals={}) # [eval-used]
@@ -6,5 +6,5 @@ eval('os.listdir(".")', globals={}) # [eval-used]
eval('os.listdir(".")', globals=globals()) # [eval-used]
def func():
- """ eval in local scope"""
+ """eval in local scope."""
eval('b = 1') # [eval-used]
diff --git a/tests/functional/e/external_classmethod_crash.py b/tests/functional/e/external_classmethod_crash.py
index 7f6b927af..84bf4309c 100644
--- a/tests/functional/e/external_classmethod_crash.py
+++ b/tests/functional/e/external_classmethod_crash.py
@@ -1,13 +1,12 @@
# pylint: disable=no-init,too-few-public-methods,unused-argument,useless-object-inheritance
-"""tagging a function as a class method cause a crash when checking for
-signature overriding
-"""
+"""tagging a function as a class method cause a crash when checking for signature
+overriding."""
def fetch_config(mainattr=None):
- """return a class method"""
+ """return a class method."""
def fetch_order(cls, attr, var):
- """a class method"""
+ """a class method."""
if attr == mainattr:
return var
return None
@@ -15,7 +14,7 @@ def fetch_config(mainattr=None):
return fetch_order
class Aaa(object):
- """hop"""
+ """hop."""
fetch_order = fetch_config('A')
__revision__ = None
diff --git a/tests/functional/ext/check_elif/check_elif.py b/tests/functional/ext/check_elif/check_elif.py
index f03c76839..9d7fdfe2c 100644
--- a/tests/functional/ext/check_elif/check_elif.py
+++ b/tests/functional/ext/check_elif/check_elif.py
@@ -1,11 +1,11 @@
# pylint: disable=no-else-raise,unsupported-membership-test,using-constant-test
-"""Checks use of "else if" triggers a refactor message"""
+"""Checks use of "else if" triggers a refactor message."""
from typing import Union, Sequence, Any, Mapping
def my_function():
- """docstring"""
+ """docstring."""
myint = 2
if myint > 5:
pass
diff --git a/tests/functional/ext/code_style/cs_py_version_35.py b/tests/functional/ext/code_style/cs_py_version_35.py
index 80f75b654..46d79847e 100644
--- a/tests/functional/ext/code_style/cs_py_version_35.py
+++ b/tests/functional/ext/code_style/cs_py_version_35.py
@@ -1,4 +1,4 @@
-"""No warnings should be emitted for features that require Python > 3.5"""
+"""No warnings should be emitted for features that require Python > 3.5."""
# pylint: disable=invalid-name
# consider-using-assignment-expr -> requires Python 3.8
diff --git a/tests/functional/ext/comparison_placement/misplaced_comparison_constant.py b/tests/functional/ext/comparison_placement/misplaced_comparison_constant.py
index 0162187bf..583460035 100644
--- a/tests/functional/ext/comparison_placement/misplaced_comparison_constant.py
+++ b/tests/functional/ext/comparison_placement/misplaced_comparison_constant.py
@@ -1,4 +1,4 @@
-"""Check that the constants are on the right side of the comparisons"""
+"""Check that the constants are on the right side of the comparisons."""
# pylint: disable=singleton-comparison, missing-docstring, too-few-public-methods, useless-object-inheritance
@@ -13,7 +13,7 @@ def dummy_return():
return 2
def bad_comparisons():
- """this is not ok"""
+ """this is not ok."""
instance = MyClass()
for i in range(10):
if 5 <= i: # [misplaced-comparison-constant]
@@ -30,13 +30,13 @@ def bad_comparisons():
pass
def good_comparison():
- """this is ok"""
+ """this is ok."""
for i in range(10):
if i == 5:
pass
def double_comparison():
- """Check that we return early for non-binary comparison"""
+ """Check that we return early for non-binary comparison."""
for i in range(10):
if i == 1 == 2:
pass
@@ -44,6 +44,6 @@ def double_comparison():
print("Between 2 and 8 inclusive")
def const_comparison():
- """Check that we return early for comparison of two constants"""
+ """Check that we return early for comparison of two constants."""
if 1 == 2:
pass
diff --git a/tests/functional/ext/confusing_elif/confusing_elif.py b/tests/functional/ext/confusing_elif/confusing_elif.py
index 002931de3..b0e566e28 100644
--- a/tests/functional/ext/confusing_elif/confusing_elif.py
+++ b/tests/functional/ext/confusing_elif/confusing_elif.py
@@ -2,11 +2,10 @@
def triggered_if_if_block_ends_with_elif(machine, old_conf, new_conf):
- """Example code that will trigger the message
+ """Example code that will trigger the message.
- Given an if-elif construct
- When the body of the if ends with an elif
- Then the message confusing-consecutive-elif must be triggered.
+ Given an if-elif construct When the body of the if ends with an elif Then the
+ message confusing-consecutive-elif must be triggered.
"""
if old_conf:
if not new_conf:
@@ -19,11 +18,11 @@ def triggered_if_if_block_ends_with_elif(machine, old_conf, new_conf):
def not_triggered_if_indented_block_ends_with_else(machine, old_conf, new_conf):
- """Example code must not trigger the message, because the inner block ends with else.
+ """Example code must not trigger the message, because the inner block ends with
+ else.
- Given an if-elif construct
- When the body of the if ends with an else
- Then no message shall be triggered.
+ Given an if-elif construct When the body of the if ends with an else Then no message
+ shall be triggered.
"""
if old_conf:
if not new_conf:
@@ -38,8 +37,7 @@ def not_triggered_if_indented_block_ends_with_else(machine, old_conf, new_conf):
def not_triggered_if_indentend_block_ends_with_call(machine, old_conf, new_conf):
- """
- Example code must not trigger the message,
+ """Example code must not trigger the message,
Given an if-elif construct
When the body of the if ends with a function call
@@ -61,10 +59,9 @@ def not_triggered_if_indentend_block_ends_with_call(machine, old_conf, new_conf)
def triggered_if_elif_block_ends_with_elif(machine, old_conf, new_conf, new_new_conf):
- """Example code that will trigger the message
+ """Example code that will trigger the message.
- Given an if-elif-elif construct
- When the body of the first elif ends with an elif
+ Given an if-elif-elif construct When the body of the first elif ends with an elif
Then the message confusing-consecutive-elif must be triggered.
"""
if old_conf:
@@ -80,11 +77,10 @@ def triggered_if_elif_block_ends_with_elif(machine, old_conf, new_conf, new_new_
def triggered_if_block_ends_with_if(machine, old_conf, new_conf, new_new_conf):
- """Example code that will trigger the message
+ """Example code that will trigger the message.
- Given an if-elif construct
- When the body of the if ends with an if
- Then the message confusing-consecutive-elif must be triggered.
+ Given an if-elif construct When the body of the if ends with an if Then the message
+ confusing-consecutive-elif must be triggered.
"""
if old_conf:
if new_new_conf:
@@ -94,12 +90,10 @@ def triggered_if_block_ends_with_if(machine, old_conf, new_conf, new_new_conf):
def not_triggered_if_indented_block_ends_with_ifexp(machine, old_conf, new_conf):
- """
- Example code must not trigger the message,
+ """Example code must not trigger the message,
- Given an if-elif construct
- When the body of the if ends with an if expression
- Then no message shall be triggered.
+ Given an if-elif construct When the body of the if ends with an if expression Then
+ no message shall be triggered.
"""
if old_conf:
if not new_conf:
@@ -110,11 +104,10 @@ def not_triggered_if_indented_block_ends_with_ifexp(machine, old_conf, new_conf)
def not_triggered_if_outer_block_does_not_have_elif(machine, old_conf, new_conf):
- """Example code must not trigger the message
+ """Example code must not trigger the message.
- Given an if construct without an elif
- When the body of the if ends with an if
- Then no message shall be triggered.
+ Given an if construct without an elif When the body of the if ends with an if Then
+ no message shall be triggered.
"""
if old_conf:
if not new_conf:
@@ -127,11 +120,10 @@ def not_triggered_if_outer_block_does_not_have_elif(machine, old_conf, new_conf)
def not_triggered_if_outer_block_continues_with_if(machine, old_conf, new_conf, new_new_conf):
- """Example code that will trigger the message
+ """Example code that will trigger the message.
- Given an if construct which continues with a new if construct
- When the body of the first if ends with an if expression
- Then no message shall be triggered.
+ Given an if construct which continues with a new if construct When the body of the
+ first if ends with an if expression Then no message shall be triggered.
"""
if old_conf:
if new_new_conf:
diff --git a/tests/functional/ext/docparams/docparams.py b/tests/functional/ext/docparams/docparams.py
index 8dbb0295a..ceb095017 100644
--- a/tests/functional/ext/docparams/docparams.py
+++ b/tests/functional/ext/docparams/docparams.py
@@ -2,40 +2,40 @@
def _private_func1(param1): # [missing-return-doc, missing-return-type-doc]
- """This is a test docstring without returns"""
+ """This is a test docstring without returns."""
return param1
def _private_func2(param1): # [missing-yield-doc, missing-yield-type-doc]
- """This is a test docstring without yields"""
+ """This is a test docstring without yields."""
yield param1
def _private_func3(param1): # [missing-raises-doc]
- """This is a test docstring without raises"""
+ """This is a test docstring without raises."""
raise Exception('Example')
def public_func1(param1): # [missing-any-param-doc]
- """This is a test docstring without params"""
+ """This is a test docstring without params."""
print(param1)
async def _async_private_func1(param1): # [missing-return-doc, missing-return-type-doc]
- """This is a test docstring without returns"""
+ """This is a test docstring without returns."""
return param1
async def _async_private_func2(param1): # [missing-yield-doc, missing-yield-type-doc]
- """This is a test docstring without yields"""
+ """This is a test docstring without yields."""
yield param1
async def _async_private_func3(param1): # [missing-raises-doc]
- """This is a test docstring without raises"""
+ """This is a test docstring without raises."""
raise Exception('Example')
async def async_public_func1(param1): # [missing-any-param-doc]
- """This is a test docstring without params"""
+ """This is a test docstring without params."""
print(param1)
diff --git a/tests/functional/ext/docparams/missing_param_doc.py b/tests/functional/ext/docparams/missing_param_doc.py
index 75f813578..b700d3339 100644
--- a/tests/functional/ext/docparams/missing_param_doc.py
+++ b/tests/functional/ext/docparams/missing_param_doc.py
@@ -1,8 +1,7 @@
#pylint: disable= missing-module-docstring
def foobar1(arg1, arg2): #[missing-any-param-doc]
- """function foobar ...
- """
+ """function foobar ..."""
print(arg1, arg2)
def foobar2(arg1, arg2): #[missing-any-param-doc]
@@ -59,7 +58,7 @@ def foobar7(arg1, arg2): #[missing-any-param-doc]
print(arg1, arg2)
def foobar8(arg1): #[missing-any-param-doc]
- """function foobar"""
+ """function foobar."""
print(arg1)
@@ -106,7 +105,7 @@ def foobar12(arg1, arg2, arg3): #[missing-param-doc, missing-type-doc]
print(arg1, arg2, arg3)
def foobar13(arg1, *args, arg3=";"):
- """Description of the function
+ """Description of the function.
Parameters
----------
@@ -120,7 +119,7 @@ def foobar13(arg1, *args, arg3=";"):
print(arg1, args, arg3)
def foobar14(arg1, *args):
- """Description of the function
+ """Description of the function.
Parameters
----------
@@ -132,7 +131,7 @@ def foobar14(arg1, *args):
print(arg1, args)
def foobar15(*args):
- """Description of the function
+ """Description of the function.
Parameters
----------
diff --git a/tests/functional/ext/docparams/parameter/missing_param_doc.py b/tests/functional/ext/docparams/parameter/missing_param_doc.py
index 6039c4b20..a2ec11203 100644
--- a/tests/functional/ext/docparams/parameter/missing_param_doc.py
+++ b/tests/functional/ext/docparams/parameter/missing_param_doc.py
@@ -5,8 +5,9 @@ with accept-no-param-doc = yes
def test_tolerate_no_param_documentation_at_all(x, y):
- """Example of a function with no parameter documentation at all
+ """Example of a function with no parameter documentation at all.
No error message is emitted.
- missing parameter documentation"""
+ missing parameter documentation
+ """
diff --git a/tests/functional/ext/docparams/parameter/missing_param_doc_required.py b/tests/functional/ext/docparams/parameter/missing_param_doc_required.py
index 072645505..11d090912 100644
--- a/tests/functional/ext/docparams/parameter/missing_param_doc_required.py
+++ b/tests/functional/ext/docparams/parameter/missing_param_doc_required.py
@@ -5,46 +5,47 @@ with accept-no-param-doc = no
def test_don_t_tolerate_no_param_documentation_at_all(x, y): # [missing-any-param-doc]
- """Example of a function with no parameter documentation at all
+ """Example of a function with no parameter documentation at all.
Missing documentation error message is emitted.
- missing parameter documentation"""
+ missing parameter documentation
+ """
def test_see_tolerate_no_param_documentation_at_all(x, y):
- """Example for the usage of "For the parameters, see"
- to suppress missing-param warnings.
+ """Example for the usage of "For the parameters, see" to suppress missing- param
+ warnings.
For the parameters, see :func:`blah`
"""
class ClassFoo:
- """Example usage of "For the parameters, see" in init docstring"""
+ """Example usage of "For the parameters, see" in init docstring."""
def __init__(self, x, y):
- """docstring foo constructor
+ """docstring foo constructor.
For the parameters, see :func:`bla`
"""
class ClassFooTwo:
- """test_see_sentence_for_constr_params_in_class
- Example usage of "For the parameters, see" in class docstring
+ """test_see_sentence_for_constr_params_in_class Example usage of "For the
+ parameters, see" in class docstring.
For the parameters, see :func:`bla`
"""
def __init__(self, x, y):
- """init"""
+ """init."""
def test_kwonlyargs_are_taken_in_account( # [missing-param-doc, missing-type-doc]
arg, *, kwonly, missing_kwonly
):
- """The docstring
+ """The docstring.
:param int arg: The argument.
:param bool kwonly: A keyword-arg.
diff --git a/tests/functional/ext/docparams/parameter/missing_param_doc_required_Google.py b/tests/functional/ext/docparams/parameter/missing_param_doc_required_Google.py
index 6e291ce83..51295dceb 100644
--- a/tests/functional/ext/docparams/parameter/missing_param_doc_required_Google.py
+++ b/tests/functional/ext/docparams/parameter/missing_param_doc_required_Google.py
@@ -11,8 +11,8 @@ https://google.github.io/styleguide/pyguide.html#doc-function-args
def test_multi_line_parameters(param: int) -> None:
- """Checks that multi line parameters lists are checked correctly
- See https://github.com/PyCQA/pylint/issues/5452
+ """Checks that multi line parameters lists are checked correctly See
+ https://github.com/PyCQA/pylint/issues/5452.
Args:
param:
@@ -24,8 +24,8 @@ def test_multi_line_parameters(param: int) -> None:
def test_missing_func_params_in_google_docstring( # [missing-param-doc, missing-type-doc]
x, y, z
):
- """Example of a function with missing Google style parameter
- documentation in the docstring
+ """Example of a function with missing Google style parameter documentation in the
+ docstring.
Args:
x: bla
@@ -36,22 +36,22 @@ def test_missing_func_params_in_google_docstring( # [missing-param-doc, missing
def test_missing_func_params_with_annotations_in_google_docstring(x: int, y: bool, z):
- """Example of a function with missing Google style parameter
- documentation in the docstring.
+ """Example of a function with missing Google style parameter documentation in the
+ docstring.
- Args:
- x: bla
- y: blah blah
- z (int): bar
+ Args:
+ x: bla
+ y: blah blah
+ z (int): bar
- some other stuff
+ some other stuff
"""
def test_missing_type_doc_google_docstring_exempt_kwonly_args(
arg1: int, arg2: int, *, value1: str, value2: str
):
- """Code to show failure in missing-type-doc
+ """Code to show failure in missing-type-doc.
Args:
arg1: First argument.
@@ -65,8 +65,8 @@ def test_missing_type_doc_google_docstring_exempt_kwonly_args(
def test_default_arg_with_annotations_in_google_docstring(
x: int, y: bool, z: int = 786
):
- """Example of a function with missing Google style parameter
- documentation in the docstring.
+ """Example of a function with missing Google style parameter documentation in the
+ docstring.
Args:
x: bla
@@ -80,8 +80,8 @@ def test_default_arg_with_annotations_in_google_docstring(
def test_missing_func_params_with_partial_annotations_in_google_docstring( # [missing-type-doc]
x, y: bool, z
):
- """Example of a function with missing Google style parameter
- documentation in the docstring.
+ """Example of a function with missing Google style parameter documentation in the
+ docstring.
Args:
x: bla
@@ -95,17 +95,19 @@ def test_missing_func_params_with_partial_annotations_in_google_docstring( # [m
def test_non_builtin_annotations_in_google_docstring(
bottomleft: Point, topright: Point
) -> float:
- """Example of a function with missing Google style parameter
- documentation in the docstring.
- Args:
- bottomleft: bottom left point of rectangle
- topright: top right point of rectangle
+ """Example of a function with missing Google style parameter documentation in the
+ docstring.
+
+ Args:
+ bottomleft: bottom left point of rectangle
+ topright: top right point of rectangle
"""
def test_non_builtin_annotations_for_returntype_in_google_docstring(bottomleft: Point, topright: Point) -> Point:
- """Example of a function with missing Google style parameter
- documentation in the docstring.
+ """Example of a function with missing Google style parameter documentation in the
+ docstring.
+
Args:
bottomleft: bottom left point of rectangle
topright: top right point of rectangle
@@ -113,15 +115,15 @@ def test_non_builtin_annotations_for_returntype_in_google_docstring(bottomleft:
def test_func_params_and_keyword_params_in_google_docstring(this, other, that=True):
- """Example of a function with Google style parameter split
- in Args and Keyword Args in the docstring
+ """Example of a function with Google style parameter split in Args and Keyword Args
+ in the docstring.
- Args:
- this (str): Printed first
- other (int): Other args
+ Args:
+ this (str): Printed first
+ other (int): Other args
- Keyword Args:
- that (bool): Printed second
+ Keyword Args:
+ that (bool): Printed second
"""
print(this, that, other)
@@ -129,15 +131,15 @@ def test_func_params_and_keyword_params_in_google_docstring(this, other, that=Tr
def test_func_params_and_wrong_keyword_params_in_google_docstring( # [missing-param-doc, missing-type-doc, differing-param-doc, differing-type-doc]
this, other, that=True
):
- """Example of a function with Google style parameter split
- in Args and Keyword Args in the docstring but with wrong keyword args
+ """Example of a function with Google style parameter split in Args and Keyword Args
+ in the docstring but with wrong keyword args.
- Args:
- this (str): Printed first
- other (int): Other args
+ Args:
+ this (str): Printed first
+ other (int): Other args
- Keyword Args:
- these (bool): Printed second
+ Keyword Args:
+ these (bool): Printed second
"""
print(this, that, other)
@@ -146,8 +148,8 @@ class Foo:
def test_missing_method_params_in_google_docstring( # [missing-param-doc, missing-type-doc]
self, x, y
):
- """Example of a class method with missing parameter documentation in
- the Google style docstring
+ """Example of a class method with missing parameter documentation in the Google
+ style docstring.
missing parameter documentation
@@ -157,8 +159,8 @@ class Foo:
def test_existing_func_params_in_google_docstring(xarg, yarg, zarg, warg):
- """Example of a function with correctly documented parameters and
- return values (Google style)
+ """Example of a function with correctly documented parameters and return values
+ (Google style)
Args:
xarg (int): bla xarg
@@ -177,8 +179,8 @@ def test_existing_func_params_in_google_docstring(xarg, yarg, zarg, warg):
def test_wrong_name_of_func_params_in_google_docstring_one( # [missing-param-doc, missing-type-doc, differing-param-doc, differing-type-doc]
xarg, yarg, zarg
):
- """Example of functions with inconsistent parameter names in the
- signature and in the Google style documentation
+ """Example of functions with inconsistent parameter names in the signature and in
+ the Google style documentation.
Args:
xarg1 (int): bla xarg
@@ -192,8 +194,8 @@ def test_wrong_name_of_func_params_in_google_docstring_one( # [missing-param-do
def test_wrong_name_of_func_params_in_google_docstring_two( # [differing-param-doc, differing-type-doc]
xarg, yarg
):
- """Example of functions with inconsistent parameter names in the
- signature and in the Google style documentation
+ """Example of functions with inconsistent parameter names in the signature and in
+ the Google style documentation.
Args:
yarg1 (float): bla yarg
@@ -204,9 +206,9 @@ def test_wrong_name_of_func_params_in_google_docstring_two( # [differing-param-
def test_see_sentence_for_func_params_in_google_docstring(xarg, yarg):
- """Example for the usage of "For the other parameters, see" to avoid
- too many repetitions, e.g. in functions or methods adhering to a
- given interface (Google style)
+ """Example for the usage of "For the other parameters, see" to avoid too many
+ repetitions, e.g. in functions or methods adhering to a given interface (Google
+ style)
Args:
yarg (float): bla yarg
@@ -217,9 +219,8 @@ def test_see_sentence_for_func_params_in_google_docstring(xarg, yarg):
class ClassFoo: # [missing-param-doc, missing-type-doc]
- """test_constr_params_in_class_google
- Example of a class with missing constructor parameter documentation
- (Google style)
+ """test_constr_params_in_class_google Example of a class with missing constructor
+ parameter documentation (Google style)
Everything is completely analogous to functions.
@@ -235,9 +236,8 @@ class ClassFoo: # [missing-param-doc, missing-type-doc]
class ClassFoo:
def __init__(self, x, y): # [missing-param-doc, missing-type-doc]
- """test_constr_params_in_init_google
- Example of a class with missing constructor parameter documentation
- (Google style)
+ """test_constr_params_in_init_google Example of a class with missing constructor
+ parameter documentation (Google style)
Args:
y: bla
@@ -247,10 +247,9 @@ class ClassFoo:
class ClassFoo: # [multiple-constructor-doc,missing-param-doc, missing-type-doc]
- """test_constr_params_in_class_and_init_google
- Example of a class with missing constructor parameter documentation
- in both the init docstring and the class docstring
- (Google style)
+ """test_constr_params_in_class_and_init_google Example of a class with missing
+ constructor parameter documentation in both the init docstring and the class
+ docstring (Google style)
Everything is completely analogous to functions.
@@ -261,7 +260,7 @@ class ClassFoo: # [multiple-constructor-doc,missing-param-doc, missing-type-doc
"""
def __init__(self, x, y): # [missing-param-doc, missing-type-doc]
- """docstring foo
+ """docstring foo.
Args:
y: bla
@@ -271,7 +270,7 @@ class ClassFoo: # [multiple-constructor-doc,missing-param-doc, missing-type-doc
def test_warns_missing_args_google(named_arg, *args): # [missing-param-doc]
- """The docstring
+ """The docstring.
Args:
named_arg (object): Returned
@@ -284,7 +283,7 @@ def test_warns_missing_args_google(named_arg, *args): # [missing-param-doc]
def test_warns_missing_kwargs_google(named_arg, **kwargs): # [missing-param-doc]
- """The docstring
+ """The docstring.
Args:
named_arg (object): Returned
@@ -297,7 +296,7 @@ def test_warns_missing_kwargs_google(named_arg, **kwargs): # [missing-param-doc
def test_finds_args_without_type_google(named_arg, *args):
- """The docstring
+ """The docstring.
Args:
named_arg (object): Returned
@@ -311,7 +310,7 @@ def test_finds_args_without_type_google(named_arg, *args):
def test_finds_kwargs_without_type_google(named_arg, **kwargs):
- """The docstring
+ """The docstring.
Args:
named_arg (object): Returned
@@ -325,7 +324,7 @@ def test_finds_kwargs_without_type_google(named_arg, **kwargs):
def test_finds_args_with_xref_type_google(named_arg, **kwargs):
- """The docstring
+ """The docstring.
Args:
named_arg (`example.value`): Returned
@@ -369,7 +368,7 @@ def test_finds_multiple_complex_types_google(
named_arg_nine,
named_arg_ten,
):
- """The google docstring
+ """The google docstring.
Args:
named_arg_one (dict(str, str)): Returned
diff --git a/tests/functional/ext/docparams/parameter/missing_param_doc_required_Numpy.py b/tests/functional/ext/docparams/parameter/missing_param_doc_required_Numpy.py
index e780ac0f5..b1b37f126 100644
--- a/tests/functional/ext/docparams/parameter/missing_param_doc_required_Numpy.py
+++ b/tests/functional/ext/docparams/parameter/missing_param_doc_required_Numpy.py
@@ -9,8 +9,8 @@ with accept-no-param-doc = no
def test_missing_func_params_in_numpy_docstring( # [missing-param-doc, missing-type-doc]
x, y, z
):
- """Example of a function with missing NumPy style parameter
- documentation in the docstring
+ """Example of a function with missing NumPy style parameter documentation in the
+ docstring.
Parameters
----------
@@ -27,8 +27,8 @@ class Foo:
def test_missing_method_params_in_numpy_docstring( # [missing-param-doc, missing-type-doc]
self, x, y
):
- """Example of a class method with missing parameter documentation in
- the Numpy style docstring
+ """Example of a class method with missing parameter documentation in the Numpy
+ style docstring.
missing parameter documentation
@@ -40,8 +40,8 @@ class Foo:
def test_existing_func_params_in_numpy_docstring(xarg, yarg, zarg, warg):
- """Example of a function with correctly documented parameters and
- return values (Numpy style)
+ """Example of a function with correctly documented parameters and return values
+ (Numpy style)
Parameters
----------
@@ -66,8 +66,8 @@ def test_existing_func_params_in_numpy_docstring(xarg, yarg, zarg, warg):
def test_wrong_name_of_func_params_in_numpy_docstring( # [missing-param-doc, missing-type-doc, differing-param-doc, differing-type-doc]
xarg, yarg, zarg
):
- """Example of functions with inconsistent parameter names in the
- signature and in the Numpy style documentation
+ """Example of functions with inconsistent parameter names in the signature and in
+ the Numpy style documentation.
Parameters
----------
@@ -85,8 +85,8 @@ def test_wrong_name_of_func_params_in_numpy_docstring( # [missing-param-doc, mi
def test_wrong_name_of_func_params_in_numpy_docstring_two( # [differing-param-doc, differing-type-doc]
xarg, yarg
):
- """Example of functions with inconsistent parameter names in the
- signature and in the Numpy style documentation
+ """Example of functions with inconsistent parameter names in the signature and in
+ the Numpy style documentation.
Parameters
----------
@@ -99,9 +99,9 @@ def test_wrong_name_of_func_params_in_numpy_docstring_two( # [differing-param-d
def test_see_sentence_for_func_params_in_numpy_docstring(xarg, yarg):
- """Example for the usage of "For the other parameters, see" to avoid
- too many repetitions, e.g. in functions or methods adhering to a
- given interface (Numpy style)
+ """Example for the usage of "For the other parameters, see" to avoid too many
+ repetitions, e.g. in functions or methods adhering to a given interface (Numpy
+ style)
Parameters
----------
@@ -114,9 +114,8 @@ def test_see_sentence_for_func_params_in_numpy_docstring(xarg, yarg):
class ClassFoo: # [missing-param-doc, missing-type-doc]
- """test_constr_params_in_class_numpy
- Example of a class with missing constructor parameter documentation
- (Numpy style)
+ """test_constr_params_in_class_numpy Example of a class with missing constructor
+ parameter documentation (Numpy style)
Everything is completely analogous to functions.
@@ -133,9 +132,8 @@ class ClassFoo: # [missing-param-doc, missing-type-doc]
class ClassFoo:
- """test_constr_params_and_attributes_in_class_numpy
- Example of a class with correct constructor parameter documentation
- and an attributes section (Numpy style)
+ """test_constr_params_and_attributes_in_class_numpy Example of a class with correct
+ constructor parameter documentation and an attributes section (Numpy style)
Parameters
----------
@@ -154,9 +152,8 @@ class ClassFoo:
class ClassFoo:
def __init__(self, x, y): # [missing-param-doc, missing-type-doc]
- """test_constr_params_in_init_numpy
- Example of a class with missing constructor parameter documentation
- (Numpy style)
+ """test_constr_params_in_init_numpy Example of a class with missing constructor
+ parameter documentation (Numpy style)
Everything is completely analogous to functions.
@@ -170,10 +167,9 @@ class ClassFoo:
class ClassFoo: # [multiple-constructor-doc, missing-param-doc, missing-type-doc]
- """test_constr_params_in_class_and_init_numpy
- Example of a class with missing constructor parameter documentation
- in both the init docstring and the class docstring
- (Numpy style)
+ """test_constr_params_in_class_and_init_numpy Example of a class with missing
+ constructor parameter documentation in both the init docstring and the class
+ docstring (Numpy style)
Everything is completely analogous to functions.
@@ -186,7 +182,7 @@ class ClassFoo: # [multiple-constructor-doc, missing-param-doc, missing-type-do
"""
def __init__(self, x, y): # [missing-param-doc, missing-type-doc]
- """docstring foo
+ """docstring foo.
Parameters
----------
@@ -198,7 +194,7 @@ class ClassFoo: # [multiple-constructor-doc, missing-param-doc, missing-type-do
def test_warns_missing_args_numpy(named_arg, *args): # [missing-param-doc]
- """The docstring
+ """The docstring.
Args
----
@@ -215,7 +211,7 @@ def test_warns_missing_args_numpy(named_arg, *args): # [missing-param-doc]
def test_warns_missing_kwargs_numpy(named_arg, **kwargs): # [missing-param-doc]
- """The docstring
+ """The docstring.
Args
----
@@ -234,7 +230,7 @@ def test_warns_missing_kwargs_numpy(named_arg, **kwargs): # [missing-param-doc]
def test_finds_args_without_type_numpy( # [missing-type-doc]
named_arg, typed_arg: bool, untyped_arg, *args
):
- """The docstring
+ """The docstring.
Args
----
@@ -257,7 +253,7 @@ def test_finds_args_without_type_numpy( # [missing-type-doc]
def test_finds_args_with_xref_type_numpy(named_arg, *args):
- """The docstring
+ """The docstring.
Args
----
@@ -276,7 +272,7 @@ def test_finds_args_with_xref_type_numpy(named_arg, *args):
def test_finds_kwargs_without_type_numpy(named_arg, **kwargs):
- """The docstring
+ """The docstring.
Args
----
@@ -304,7 +300,7 @@ def my_func(
named_arg_seven,
named_arg_eight,
):
- """The docstring
+ """The docstring.
Args
----
diff --git a/tests/functional/ext/docparams/parameter/missing_param_doc_required_Sphinx.py b/tests/functional/ext/docparams/parameter/missing_param_doc_required_Sphinx.py
index 942de6e6e..9c6955a60 100644
--- a/tests/functional/ext/docparams/parameter/missing_param_doc_required_Sphinx.py
+++ b/tests/functional/ext/docparams/parameter/missing_param_doc_required_Sphinx.py
@@ -8,8 +8,8 @@ with accept-no-param-doc = no"""
def test_missing_func_params_in_sphinx_docstring( # [missing-param-doc, missing-type-doc]
x, y, z
):
- """Example of a function with missing Sphinx parameter documentation in
- the docstring
+ """Example of a function with missing Sphinx parameter documentation in the
+ docstring.
:param x: bla
@@ -22,8 +22,8 @@ class Foo:
def test_missing_method_params_in_sphinx_docstring( # [missing-param-doc, missing-type-doc]
self, x, y
):
- """Example of a class method with missing parameter documentation in
- the Sphinx style docstring
+ """Example of a class method with missing parameter documentation in the Sphinx
+ style docstring.
missing parameter documentation
@@ -33,8 +33,8 @@ class Foo:
def test_existing_func_params_in_sphinx_docstring(xarg, yarg, zarg, warg):
- """Example of a function with correctly documented parameters and
- return values (Sphinx style)
+ """Example of a function with correctly documented parameters and return values
+ (Sphinx style)
:param xarg: bla xarg
:type xarg: int
@@ -55,8 +55,8 @@ def test_existing_func_params_in_sphinx_docstring(xarg, yarg, zarg, warg):
def test_wrong_name_of_func_params_in_sphinx_docstring( # [missing-param-doc, missing-type-doc, differing-param-doc, differing-type-doc]
xarg, yarg, zarg
):
- """Example of functions with inconsistent parameter names in the
- signature and in the Sphinx style documentation
+ """Example of functions with inconsistent parameter names in the signature and in
+ the Sphinx style documentation.
:param xarg1: bla xarg
:type xarg: int
@@ -72,8 +72,8 @@ def test_wrong_name_of_func_params_in_sphinx_docstring( # [missing-param-doc, m
def test_wrong_name_of_func_params_in_sphinx_docstring_two( # [differing-param-doc, differing-type-doc]
xarg, yarg, zarg
):
- """Example of functions with inconsistent parameter names in the
- signature and in the Sphinx style documentation
+ """Example of functions with inconsistent parameter names in the signature and in
+ the Sphinx style documentation.
:param yarg1: bla yarg
:type yarg1: float
@@ -84,9 +84,9 @@ def test_wrong_name_of_func_params_in_sphinx_docstring_two( # [differing-param-
def test_see_sentence_for_func_params_in_sphinx_docstring(xarg, yarg) -> None:
- """Example for the usage of "For the other parameters, see" to avoid
- too many repetitions, e.g. in functions or methods adhering to a
- given interface (Sphinx style)
+ """Example for the usage of "For the other parameters, see" to avoid too many
+ repetitions, e.g. in functions or methods adhering to a given interface (Sphinx
+ style)
:param yarg: bla yarg
:type yarg: float
@@ -97,9 +97,8 @@ def test_see_sentence_for_func_params_in_sphinx_docstring(xarg, yarg) -> None:
class ClassFoo: # [missing-param-doc, missing-type-doc]
- """test_constr_params_in_class_sphinx
- Example of a class with missing constructor parameter documentation
- (Sphinx style)
+ """test_constr_params_in_class_sphinx Example of a class with missing constructor
+ parameter documentation (Sphinx style)
Everything is completely analogous to functions.
@@ -114,9 +113,8 @@ class ClassFoo: # [missing-param-doc, missing-type-doc]
class ClassFoo:
def __init__(self, x, y): # [missing-param-doc, missing-type-doc]
- """test_constr_params_in_init_sphinx
- Example of a class with missing constructor parameter documentation
- (Sphinx style)
+ """test_constr_params_in_init_sphinx Example of a class with missing constructor
+ parameter documentation (Sphinx style)
Everything is completely analogous to functions.
@@ -129,10 +127,9 @@ class ClassFoo:
class ClassFoo: # [multiple-constructor-doc, missing-param-doc, missing-type-doc]
- """test_constr_params_in_class_and_init_sphinx
- Example of a class with missing constructor parameter documentation
- in both the init docstring and the class docstring
- (Sphinx style)
+ """test_constr_params_in_class_and_init_sphinx Example of a class with missing
+ constructor parameter documentation in both the init docstring and the class
+ docstring (Sphinx style)
Everything is completely analogous to functions.
@@ -142,7 +139,7 @@ class ClassFoo: # [multiple-constructor-doc, missing-param-doc, missing-type-do
"""
def __init__(self, x, y): # [missing-param-doc, missing-type-doc]
- """docstring foo
+ """docstring foo.
:param y: bla
@@ -154,7 +151,7 @@ class ClassFoo: # [multiple-constructor-doc, missing-param-doc, missing-type-do
def test_warns_missing_args_sphinx( # [missing-param-doc, inconsistent-return-statements]
named_arg, *args
):
- """The docstring
+ """The docstring.
:param named_arg: Returned
:type named_arg: object
@@ -169,7 +166,7 @@ def test_warns_missing_args_sphinx( # [missing-param-doc, inconsistent-return-s
def test_warns_missing_kwargs_sphinx( # [missing-param-doc, inconsistent-return-statements]
named_arg, **kwargs
):
- """The docstring
+ """The docstring.
:param named_arg: Returned
:type named_arg: object
@@ -184,7 +181,7 @@ def test_warns_missing_kwargs_sphinx( # [missing-param-doc, inconsistent-return
def test_finds_args_without_type_sphinx( # [missing-param-doc, inconsistent-return-statements]
named_arg, *args
):
- """The docstring
+ """The docstring.
:param named_arg: Returned
:type named_arg: object
@@ -201,7 +198,7 @@ def test_finds_args_without_type_sphinx( # [missing-param-doc, inconsistent-ret
def test_finds_kwargs_without_type_sphinx( # [missing-param-doc, inconsistent-return-statements]
named_arg, **kwargs
):
- """The docstring
+ """The docstring.
:param named_arg: Returned
:type named_arg: object
@@ -254,10 +251,8 @@ def test_finds_kwargs_without_type_sphinx( # [inconsistent-return-statements]
class Foo:
- """test_finds_missing_raises_from_setter_sphinx
- Example of a setter having missing raises documentation in
- the Sphinx style docstring of the property
- """
+ """test_finds_missing_raises_from_setter_sphinx Example of a setter having missing
+ raises documentation in the Sphinx style docstring of the property."""
@property
def foo(self): # [missing-raises-doc]
@@ -273,10 +268,8 @@ class Foo:
class Foo:
- """test_finds_missing_raises_in_setter_sphinx
- Example of a setter having missing raises documentation in
- its own Sphinx style docstring
- """
+ """test_finds_missing_raises_in_setter_sphinx Example of a setter having missing
+ raises documentation in its own Sphinx style docstring."""
@property
def foo(self):
@@ -298,10 +291,8 @@ class Foo:
class Foo:
- """test_finds_property_return_type_sphinx
- Example of a property having return documentation in
- a Sphinx style docstring
- """
+ """test_finds_property_return_type_sphinx Example of a property having return
+ documentation in a Sphinx style docstring."""
@property
def foo(self):
@@ -313,10 +304,8 @@ class Foo:
class Foo:
- """test_finds_annotation_property_return_type_sphinx
- Example of a property having missing return documentation in
- a Sphinx style docstring
- """
+ """test_finds_annotation_property_return_type_sphinx Example of a property having
+ missing return documentation in a Sphinx style docstring."""
@property
def foo(self) -> int:
@@ -332,8 +321,8 @@ class Foo:
def test_useless_docs_ignored_argument_names_sphinx( # [useless-type-doc, useless-param-doc]
self, arg, _, _ignored
):
- """Example of a method documenting the return type that an
- implementation should return.
+ """Example of a method documenting the return type that an implementation should
+ return.
:param arg: An argument.
:type arg: int
@@ -347,7 +336,7 @@ class Foo:
def test_finds_multiple_types_sphinx_one(named_arg):
- """The Sphinx docstring
+ """The Sphinx docstring.
:param named_arg: Returned
:type named_arg: dict(str, str)
@@ -359,7 +348,7 @@ def test_finds_multiple_types_sphinx_one(named_arg):
def test_finds_multiple_types_sphinx_two(named_arg):
- """The Sphinx docstring
+ """The Sphinx docstring.
:param named_arg: Returned
:type named_arg: dict[str, str]
@@ -371,7 +360,7 @@ def test_finds_multiple_types_sphinx_two(named_arg):
def test_finds_multiple_types_sphinx_three(named_arg):
- """The Sphinx docstring
+ """The Sphinx docstring.
:param named_arg: Returned
:type named_arg: int or str
@@ -383,7 +372,7 @@ def test_finds_multiple_types_sphinx_three(named_arg):
def test_finds_multiple_types_sphinx_four(named_arg):
- """The Sphinx docstring
+ """The Sphinx docstring.
:param named_arg: Returned
:type named_arg: tuple(int or str)
@@ -395,7 +384,7 @@ def test_finds_multiple_types_sphinx_four(named_arg):
def test_finds_multiple_types_sphinx_five(named_arg):
- """The Sphinx docstring
+ """The Sphinx docstring.
:param named_arg: Returned
:type named_arg: tuple(int) or list(int)
@@ -407,7 +396,7 @@ def test_finds_multiple_types_sphinx_five(named_arg):
def test_finds_multiple_types_sphinx_six(named_arg):
- """The Sphinx docstring
+ """The Sphinx docstring.
:param named_arg: Returned
:type named_arg: tuple(int or str) or list(int or str)
@@ -419,7 +408,7 @@ def test_finds_multiple_types_sphinx_six(named_arg):
def test_finds_compact_container_types_sphinx_one(named_arg):
- """The Sphinx docstring
+ """The Sphinx docstring.
:param dict(str,str) named_arg: Returned
@@ -430,7 +419,7 @@ def test_finds_compact_container_types_sphinx_one(named_arg):
def test_finds_compact_container_types_sphinx_two(named_arg):
- """The Sphinx docstring
+ """The Sphinx docstring.
:param dict[str,str] named_arg: Returned
@@ -441,7 +430,7 @@ def test_finds_compact_container_types_sphinx_two(named_arg):
def test_finds_compact_container_types_sphinx_three(named_arg):
- """The Sphinx docstring
+ """The Sphinx docstring.
:param tuple(int) named_arg: Returned
@@ -452,7 +441,7 @@ def test_finds_compact_container_types_sphinx_three(named_arg):
def test_finds_compact_container_types_sphinx_four(named_arg):
- """The Sphinx docstring
+ """The Sphinx docstring.
:param list[tokenize.TokenInfo] named_arg: Returned
diff --git a/tests/functional/ext/docparams/parameter/missing_param_doc_required_min_length.py b/tests/functional/ext/docparams/parameter/missing_param_doc_required_min_length.py
index 765bb2d6c..e848c54fa 100644
--- a/tests/functional/ext/docparams/parameter/missing_param_doc_required_min_length.py
+++ b/tests/functional/ext/docparams/parameter/missing_param_doc_required_min_length.py
@@ -6,4 +6,4 @@ with accept-no-param-doc = no and docstring-min-length = 3
# Example of a function that is less than 'docstring-min-length' config option
# No error message is emitted.
def test_skip_docstring_min_length(x, y):
- """function is too short and is missing parameter documentation"""
+ """function is too short and is missing parameter documentation."""
diff --git a/tests/functional/ext/docparams/parameter/missing_param_doc_required_no_doc_rgx_check_init.py b/tests/functional/ext/docparams/parameter/missing_param_doc_required_no_doc_rgx_check_init.py
index 1d6d2c70b..60a81733b 100644
--- a/tests/functional/ext/docparams/parameter/missing_param_doc_required_no_doc_rgx_check_init.py
+++ b/tests/functional/ext/docparams/parameter/missing_param_doc_required_no_doc_rgx_check_init.py
@@ -8,11 +8,7 @@ with accept-no-param-doc = no and no-docstring-rgx = ^(?!__init__$)_
# Check that __init__ is checked correctly, but other private methods aren't
class MyClass:
def __init__(self, my_param: int) -> None: # [missing-param-doc]
- """
- My init docstring
- """
+ """My init docstring."""
def _private_method(self, my_param: int) -> None:
- """
- My private method
- """
+ """My private method."""
diff --git a/tests/functional/ext/docparams/parameter/missing_param_doc_required_no_doc_rgx_check_none.py b/tests/functional/ext/docparams/parameter/missing_param_doc_required_no_doc_rgx_check_none.py
index ca6eb2f7e..115c44e34 100644
--- a/tests/functional/ext/docparams/parameter/missing_param_doc_required_no_doc_rgx_check_none.py
+++ b/tests/functional/ext/docparams/parameter/missing_param_doc_required_no_doc_rgx_check_none.py
@@ -5,12 +5,8 @@ with accept-no-param-doc = no and no-docstring-rgx = ""
class MyClass:
- """test_no_docstring_rgx
- Function that matches "check no functions" 'no-docstring-rgx' config option
- No error message is emitted.
- """
+ """test_no_docstring_rgx Function that matches "check no functions" 'no- docstring-
+ rgx' config option No error message is emitted."""
def __init__(self, my_param: int) -> None:
- """
- My init docstring
- """
+ """My init docstring."""
diff --git a/tests/functional/ext/docparams/parameter/missing_param_doc_required_no_doc_rgx_default.py b/tests/functional/ext/docparams/parameter/missing_param_doc_required_no_doc_rgx_default.py
index 1d2daa1a1..bb7224c61 100644
--- a/tests/functional/ext/docparams/parameter/missing_param_doc_required_no_doc_rgx_default.py
+++ b/tests/functional/ext/docparams/parameter/missing_param_doc_required_no_doc_rgx_default.py
@@ -5,7 +5,7 @@ with accept-no-param-doc = no and the default value of no-docstring-rgx
def _test_skip_no_docstring_rgx(x, y):
- """Example of a function that matches the default 'no-docstring-rgx' config option
+ """Example of a function that matches the default 'no-docstring-rgx' config option.
No error message is emitted.
"""
diff --git a/tests/functional/ext/docparams/parameter/missing_param_doc_required_no_doc_rgx_test_all.py b/tests/functional/ext/docparams/parameter/missing_param_doc_required_no_doc_rgx_test_all.py
index 829119a09..25f5b2b4f 100644
--- a/tests/functional/ext/docparams/parameter/missing_param_doc_required_no_doc_rgx_test_all.py
+++ b/tests/functional/ext/docparams/parameter/missing_param_doc_required_no_doc_rgx_test_all.py
@@ -6,14 +6,12 @@ with accept-no-param-doc = no and no-docstring-rgx = ^$
class MyClass:
- """test_all_docstring_rgx
- Function that matches "check all functions" 'no-docstring-rgx' config option
- No error message is emitted.
- """
+ """test_all_docstring_rgx Function that matches "check all functions" 'no-
+ docstring-rgx' config option No error message is emitted."""
def __init__(self, my_param: int) -> None:
- """
- My init docstring
+ """My init docstring.
+
:param my_param: My first param
"""
@@ -23,6 +21,4 @@ class MyClass:
# An error message is emitted.
class MyClass:
def __init__(self, my_param: int) -> None: # [missing-param-doc]
- """
- My init docstring
- """
+ """My init docstring."""
diff --git a/tests/functional/ext/docparams/raise/missing_raises_doc.py b/tests/functional/ext/docparams/raise/missing_raises_doc.py
index 6ba112bd5..fcdca136c 100644
--- a/tests/functional/ext/docparams/raise/missing_raises_doc.py
+++ b/tests/functional/ext/docparams/raise/missing_raises_doc.py
@@ -1,4 +1,4 @@
-"""Tests for missing-raises-doc and missing-raises-type-doc"""
+"""Tests for missing-raises-doc and missing-raises-type-doc."""
# pylint: disable=function-redefined, invalid-name, undefined-variable, missing-function-docstring
# pylint: disable=unused-argument, import-error, unused-variable, no-member, try-except-raise
import collections
@@ -26,8 +26,7 @@ def test_ignores_raise_uninferable(self):
def test_ignores_returns_from_inner_functions(self): # [missing-raises-doc]
- """This is a docstring.
- We do NOT expect a warning about the OSError in inner_func!
+ """This is a docstring. We do NOT expect a warning about the OSError in inner_func!
:raises NameError: Never
"""
@@ -43,7 +42,7 @@ def test_ignores_returns_from_inner_functions(self): # [missing-raises-doc]
def test_ignores_returns_use_only_names():
- """This is a docstring
+ """This is a docstring.
:raises NameError: Never
"""
@@ -55,13 +54,13 @@ def test_ignores_returns_use_only_names():
def test_ignores_returns_use_only_exception_instances():
- """This is a docstring
+ """This is a docstring.
:raises MyException: Never
"""
class MyException(Exception):
- """A docstring"""
+ """A docstring."""
def inner_func():
return MyException
@@ -70,7 +69,7 @@ def test_ignores_returns_use_only_exception_instances():
def test_no_crash_when_inferring_handlers():
- """raises
+ """raises.
:raise U: pass
"""
@@ -81,7 +80,7 @@ def test_no_crash_when_inferring_handlers():
def test_no_crash_when_cant_find_exception():
- """raises
+ """raises.
:raise U: pass
"""
diff --git a/tests/functional/ext/docparams/raise/missing_raises_doc_Google.py b/tests/functional/ext/docparams/raise/missing_raises_doc_Google.py
index 22dbcadaa..6491fbc2c 100644
--- a/tests/functional/ext/docparams/raise/missing_raises_doc_Google.py
+++ b/tests/functional/ext/docparams/raise/missing_raises_doc_Google.py
@@ -1,4 +1,5 @@
-"""Tests for missing-raises-doc and missing-raises-type-doc for Google style docstrings"""
+"""Tests for missing-raises-doc and missing-raises-type-doc for Google style
+docstrings."""
# pylint: disable=function-redefined, invalid-name, undefined-variable, missing-function-docstring
# pylint: disable=unused-argument, import-outside-toplevel, import-error, try-except-raise, too-few-public-methods
@@ -47,9 +48,8 @@ def test_find_valid_missing_google_attr_raises(self): # [missing-raises-doc]
def test_find_invalid_missing_google_attr_raises(self):
- """This is a google docstring.
- pylint allows this to pass since the comparison between Raises and
- raise are based on the class name, not the qualified name.
+ """This is a google docstring. pylint allows this to pass since the comparison
+ between Raises and raise are based on the class name, not the qualified name.
Raises:
bogusmodule.error: Sometimes
@@ -60,9 +60,8 @@ def test_find_invalid_missing_google_attr_raises(self):
def test_google_raises_local_reference(self):
- """This is a google docstring.
- pylint allows this to pass since the comparison between Raises and
- raise are based on the class name, not the qualified name.
+ """This is a google docstring. pylint allows this to pass since the comparison
+ between Raises and raise are based on the class name, not the qualified name.
Raises:
.LocalException: Always
@@ -139,10 +138,8 @@ def test_ignores_caught_google_raises(self):
class Foo:
- """test_finds_missing_raises_from_setter_google
- Example of a setter having missing raises documentation in
- the Google style docstring of the property
- """
+ """test_finds_missing_raises_from_setter_google Example of a setter having missing
+ raises documentation in the Google style docstring of the property."""
@property
def foo_method(self): # [missing-raises-doc]
@@ -164,10 +161,8 @@ class Foo:
class Foo:
- """test_finds_missing_raises_from_setter_google_2
- Example of a setter having missing raises documentation in
- its own Google style docstring of the property.
- """
+ """test_finds_missing_raises_from_setter_google_2 Example of a setter having missing
+ raises documentation in its own Google style docstring of the property."""
@property
def foo_method(self):
diff --git a/tests/functional/ext/docparams/raise/missing_raises_doc_Numpy.py b/tests/functional/ext/docparams/raise/missing_raises_doc_Numpy.py
index 8cf8e041f..30f6c8e8e 100644
--- a/tests/functional/ext/docparams/raise/missing_raises_doc_Numpy.py
+++ b/tests/functional/ext/docparams/raise/missing_raises_doc_Numpy.py
@@ -1,4 +1,4 @@
-"""Tests for missing-raises-doc and missing-raises-type-doc for Numpy style docstrings
+"""Tests for missing-raises-doc and missing-raises-type-doc for Numpy style docstrings.
Styleguide:
https://numpydoc.readthedocs.io/en/latest/format.html#docstring-standard
@@ -122,9 +122,8 @@ def test_find_valid_missing_numpy_attr_raises(self): # [missing-raises-doc]
def test_find_invalid_missing_numpy_attr_raises(self):
- """This is a numpy docstring.
- pylint allows this to pass since the comparison between Raises and
- raise are based on the class name, not the qualified name.
+ """This is a numpy docstring. pylint allows this to pass since the comparison
+ between Raises and raise are based on the class name, not the qualified name.
Raises
------
@@ -137,10 +136,8 @@ def test_find_invalid_missing_numpy_attr_raises(self):
class Foo:
- """test_finds_missing_raises_from_setter_numpy
- Example of a setter having missing raises documentation in
- the Numpy style docstring of the property
- """
+ """test_finds_missing_raises_from_setter_numpy Example of a setter having missing
+ raises documentation in the Numpy style docstring of the property."""
@property
def foo(self): # [missing-raises-doc]
@@ -164,10 +161,8 @@ class Foo:
class Foo:
- """test_finds_missing_raises_from_setter_numpy_2
- Example of a setter having missing raises documentation in
- its own Numpy style docstring of the property
- """
+ """test_finds_missing_raises_from_setter_numpy_2 Example of a setter having missing
+ raises documentation in its own Numpy style docstring of the property."""
@property
def foo(self):
@@ -197,10 +192,8 @@ class Foo:
class Foo:
- """test_finds_property_return_type_numpy
- Example of a property having return documentation in
- a numpy style docstring
- """
+ """test_finds_property_return_type_numpy Example of a property having return
+ documentation in a numpy style docstring."""
@property
def foo(self):
diff --git a/tests/functional/ext/docparams/raise/missing_raises_doc_Sphinx.py b/tests/functional/ext/docparams/raise/missing_raises_doc_Sphinx.py
index 91a603b71..fde229778 100644
--- a/tests/functional/ext/docparams/raise/missing_raises_doc_Sphinx.py
+++ b/tests/functional/ext/docparams/raise/missing_raises_doc_Sphinx.py
@@ -1,4 +1,5 @@
-"""Tests for missing-raises-doc and missing-raises-type-doc for Sphinx style docstrings"""
+"""Tests for missing-raises-doc and missing-raises-type-doc for Sphinx style
+docstrings."""
# pylint: disable=function-redefined, invalid-name, undefined-variable, missing-function-docstring
# pylint: disable=unused-argument, try-except-raise, import-outside-toplevel
# pylint: disable=missing-class-docstring, too-few-public-methods
@@ -141,9 +142,8 @@ def test_find_valid_missing_sphinx_attr_raises(self): # [missing-raises-doc]
def test_find_invalid_missing_sphinx_attr_raises(self):
- """This is a sphinx docstring.
- pylint allows this to pass since the comparison between Raises and
- raise are based on the class name, not the qualified name.
+ """This is a sphinx docstring. pylint allows this to pass since the comparison
+ between Raises and raise are based on the class name, not the qualified name.
:raises bogusmodule.error: Sometimes
"""
diff --git a/tests/functional/ext/docparams/return/missing_return_doc.py b/tests/functional/ext/docparams/return/missing_return_doc.py
index f376b8087..b6d10dbd0 100644
--- a/tests/functional/ext/docparams/return/missing_return_doc.py
+++ b/tests/functional/ext/docparams/return/missing_return_doc.py
@@ -1,4 +1,4 @@
-"""Tests for missing-return-doc and missing-return-type-doc"""
+"""Tests for missing-return-doc and missing-return-type-doc."""
# pylint: disable=function-redefined, invalid-name, undefined-variable, missing-function-docstring
# pylint: disable=unused-argument
diff --git a/tests/functional/ext/docparams/return/missing_return_doc_Google.py b/tests/functional/ext/docparams/return/missing_return_doc_Google.py
index 498dbf119..2bd10437b 100644
--- a/tests/functional/ext/docparams/return/missing_return_doc_Google.py
+++ b/tests/functional/ext/docparams/return/missing_return_doc_Google.py
@@ -1,11 +1,12 @@
-"""Tests for missing-return-doc and missing-return-type-doc for Google style docstrings"""
+"""Tests for missing-return-doc and missing-return-type-doc for Google style
+docstrings."""
# pylint: disable=function-redefined, invalid-name, undefined-variable, missing-function-docstring
# pylint: disable=unused-argument, too-few-public-methods, unnecessary-pass
import abc
def my_func(self):
- """find_google_returns
+ """find_google_returns.
Returns:
bool: Always False
@@ -14,7 +15,7 @@ def my_func(self):
def my_func(self, doc_type):
- """ignores_google_return_none
+ """ignores_google_return_none.
Args:
doc_type (str): Google
@@ -23,7 +24,7 @@ def my_func(self, doc_type):
def my_func(self):
- """finds_google_return_custom_class
+ """finds_google_return_custom_class.
Returns:
mymodule.Class: An object
@@ -32,7 +33,7 @@ def my_func(self):
def my_func(self):
- """finds_google_return_list_of_custom_class
+ """finds_google_return_list_of_custom_class.
Returns:
list(:class:`mymodule.Class`): An object
@@ -41,7 +42,7 @@ def my_func(self):
def my_func(self): # [redundant-returns-doc]
- """warns_google_redundant_return_doc
+ """warns_google_redundant_return_doc.
Returns:
One
@@ -50,7 +51,7 @@ def my_func(self): # [redundant-returns-doc]
def my_func(self): # [redundant-returns-doc]
- """warns_google_redundant_rtype_doc
+ """warns_google_redundant_rtype_doc.
Returns:
int:
@@ -59,7 +60,7 @@ def my_func(self): # [redundant-returns-doc]
def my_func(self): # [redundant-returns-doc]
- """warns_google_redundant_return_doc_yield
+ """warns_google_redundant_return_doc_yield.
Returns:
int: One
@@ -68,7 +69,7 @@ def my_func(self): # [redundant-returns-doc]
def my_func(self):
- """ignores_google_redundant_return_doc_multiple_returns
+ """ignores_google_redundant_return_doc_multiple_returns.
Returns:
int or None: One, or sometimes None.
@@ -79,10 +80,8 @@ def my_func(self):
class Foo:
- """test_finds_property_return_type_google
- Example of a property having return documentation in
- a Google style docstring
- """
+ """test_finds_property_return_type_google Example of a property having return
+ documentation in a Google style docstring."""
@property
def foo_method(self):
@@ -96,10 +95,8 @@ class Foo:
class Foo:
- """test_finds_annotation_property_return_type_google
- Example of a property having return documentation in
- a Google style docstring
- """
+ """test_finds_annotation_property_return_type_google Example of a property having
+ return documentation in a Google style docstring."""
@property
def foo_method(self) -> int:
@@ -113,10 +110,8 @@ class Foo:
class Foo:
- """test_ignores_return_in_abstract_method_google
- Example of an abstract method documenting the return type that an
- implementation should return.
- """
+ """test_ignores_return_in_abstract_method_google Example of an abstract method
+ documenting the return type that an implementation should return."""
@abc.abstractmethod
def foo_method(self):
@@ -129,10 +124,8 @@ class Foo:
class Foo:
- """test_ignores_return_in_abstract_method_google_2
- Example of a method documenting the return type that an
- implementation should return.
- """
+ """test_ignores_return_in_abstract_method_google_2 Example of a method documenting
+ the return type that an implementation should return."""
def foo_method(self, arg):
"""docstring ...
@@ -144,10 +137,8 @@ class Foo:
class Foo:
- """test_ignores_ignored_argument_names_google
- Example of a method documenting the return type that an
- implementation should return.
- """
+ """test_ignores_ignored_argument_names_google Example of a method documenting the
+ return type that an implementation should return."""
def foo_method(self, arg, _):
"""docstring ...
@@ -159,10 +150,8 @@ class Foo:
class Foo:
- """test_useless_docs_ignored_argument_names_google
- Example of a method documenting the return type that an
- implementation should return.
- """
+ """test_useless_docs_ignored_argument_names_google Example of a method documenting
+ the return type that an implementation should return."""
def foo_method(self, arg, _, _ignored): # [useless-type-doc, useless-param-doc]
"""docstring ...
diff --git a/tests/functional/ext/docparams/return/missing_return_doc_Numpy.py b/tests/functional/ext/docparams/return/missing_return_doc_Numpy.py
index 47f6f4ae0..5835275d9 100644
--- a/tests/functional/ext/docparams/return/missing_return_doc_Numpy.py
+++ b/tests/functional/ext/docparams/return/missing_return_doc_Numpy.py
@@ -1,11 +1,12 @@
-"""Tests for missing-return-doc and missing-return-type-doc for Numpy style docstrings"""
+"""Tests for missing-return-doc and missing-return-type-doc for Numpy style
+docstrings."""
# pylint: disable=function-redefined, invalid-name, undefined-variable, missing-function-docstring
# pylint: disable=unused-argument, too-few-public-methods, disallowed-name
import abc
def my_func(self):
- """find_numpy_returns
+ """find_numpy_returns.
Returns
-------
@@ -16,7 +17,7 @@ def my_func(self):
def my_func(self):
- """find_numpy_returns_with_of
+ """find_numpy_returns_with_of.
Returns
-------
@@ -27,7 +28,7 @@ def my_func(self):
def my_func(self, doc_type):
- """ignores_numpy_return_none
+ """ignores_numpy_return_none.
Arguments
---------
@@ -38,7 +39,7 @@ def my_func(self, doc_type):
def my_func(self):
- """finds_numpy_return_custom_class
+ """finds_numpy_return_custom_class.
Returns
-------
@@ -49,7 +50,7 @@ def my_func(self):
def my_func(self):
- """finds_numpy_return_list_of_custom_class
+ """finds_numpy_return_list_of_custom_class.
Returns
-------
@@ -60,7 +61,7 @@ def my_func(self):
def my_func(self): # [redundant-returns-doc]
- """warns_numpy_redundant_return_doc
+ """warns_numpy_redundant_return_doc.
Returns
-------
@@ -71,7 +72,7 @@ def my_func(self): # [redundant-returns-doc]
def my_func(self): # [redundant-returns-doc]
- """warns_numpy_redundant_rtype_doc
+ """warns_numpy_redundant_rtype_doc.
Returns
-------
@@ -81,7 +82,7 @@ def my_func(self): # [redundant-returns-doc]
def my_func(self):
- """ignores_numpy_redundant_return_doc_multiple_returns
+ """ignores_numpy_redundant_return_doc_multiple_returns.
Returns
-------
@@ -96,7 +97,7 @@ def my_func(self):
def my_func(self): # [redundant-returns-doc]
- """warns_numpy_redundant_return_doc_yield
+ """warns_numpy_redundant_return_doc_yield.
Returns
-------
@@ -107,9 +108,8 @@ def my_func(self): # [redundant-returns-doc]
class Foo:
- """test_ignores_return_in_abstract_method_numpy
- Example of an abstract method documenting the return type that an
- implementation should return."""
+ """test_ignores_return_in_abstract_method_numpy Example of an abstract method
+ documenting the return type that an implementation should return."""
@abc.abstractmethod
def foo(self):
@@ -124,9 +124,8 @@ class Foo:
class Foo:
- """test_ignores_return_in_abstract_method_numpy_2
- Example of a method documenting the return type that an
- implementation should return."""
+ """test_ignores_return_in_abstract_method_numpy_2 Example of a method documenting
+ the return type that an implementation should return."""
def foo(self, arg):
"""docstring ...
@@ -140,10 +139,8 @@ class Foo:
class Foo:
- """test_ignores_ignored_argument_names_numpy
- Example of a method documenting the return type that an
- implementation should return.
- """
+ """test_ignores_ignored_argument_names_numpy Example of a method documenting the
+ return type that an implementation should return."""
def foo(self, arg, _):
"""docstring ...
@@ -156,10 +153,8 @@ class Foo:
class Foo:
- """test_useless_docs_ignored_argument_names_numpy
- Example of a method documenting the return type that an
- implementation should return.
- """
+ """test_useless_docs_ignored_argument_names_numpy Example of a method documenting
+ the return type that an implementation should return."""
def foo(self, arg, _, _ignored): # [useless-type-doc, useless-param-doc]
"""docstring ...
diff --git a/tests/functional/ext/docparams/return/missing_return_doc_Sphinx.py b/tests/functional/ext/docparams/return/missing_return_doc_Sphinx.py
index 41b0ce1ae..e493f1722 100644
--- a/tests/functional/ext/docparams/return/missing_return_doc_Sphinx.py
+++ b/tests/functional/ext/docparams/return/missing_return_doc_Sphinx.py
@@ -1,4 +1,5 @@
-"""Tests for missing-return-doc and missing-return-type-doc for Sphinx style docstrings"""
+"""Tests for missing-return-doc and missing-return-type-doc for Sphinx style
+docstrings."""
# pylint: disable=function-redefined, invalid-name, undefined-variable, missing-function-docstring
# pylint: disable=unused-argument, disallowed-name, too-few-public-methods, missing-class-docstring
# pylint: disable=unnecessary-pass
@@ -6,7 +7,7 @@ import abc
def my_func(self):
- """find_sphinx_returns
+ """find_sphinx_returns.
:return: Always False
:rtype: bool
@@ -15,7 +16,7 @@ def my_func(self):
def my_func(self, doc_type):
- """ignores_sphinx_return_none
+ """ignores_sphinx_return_none.
:param doc_type: Sphinx
:type doc_type: str
@@ -24,7 +25,7 @@ def my_func(self, doc_type):
def my_func(self):
- """finds_sphinx_return_custom_class
+ """finds_sphinx_return_custom_class.
:returns: An object
:rtype: :class:`mymodule.Class`
@@ -33,7 +34,7 @@ def my_func(self):
def my_func(self):
- """finds_sphinx_return_list_of_custom_class
+ """finds_sphinx_return_list_of_custom_class.
:returns: An object
:rtype: list(:class:`mymodule.Class`)
@@ -42,7 +43,7 @@ def my_func(self):
def my_func(self): # [redundant-returns-doc]
- """warns_sphinx_redundant_return_doc
+ """warns_sphinx_redundant_return_doc.
:returns: One
"""
@@ -50,7 +51,7 @@ def my_func(self): # [redundant-returns-doc]
def my_func(self): # [redundant-returns-doc]
- """warns_sphinx_redundant_rtype_doc
+ """warns_sphinx_redundant_rtype_doc.
:rtype: int
"""
@@ -58,7 +59,7 @@ def my_func(self): # [redundant-returns-doc]
def my_func(self):
- """ignores_sphinx_redundant_return_doc_multiple_returns
+ """ignores_sphinx_redundant_return_doc_multiple_returns.
:returns: One
:rtype: int
@@ -72,7 +73,7 @@ def my_func(self):
def my_func_with_yield(self):
- """ignore_sphinx_redundant_return_doc_yield
+ """ignore_sphinx_redundant_return_doc_yield.
:returns: One
:rtype: generator
@@ -82,10 +83,8 @@ def my_func_with_yield(self):
class Foo:
- """test_ignores_return_in_abstract_method_sphinx
- Example of an abstract method documenting the return type that an
- implementation should return.
- """
+ """test_ignores_return_in_abstract_method_sphinx Example of an abstract method
+ documenting the return type that an implementation should return."""
@abc.abstractmethod
def foo(self):
@@ -99,9 +98,8 @@ class Foo:
class Foo:
def test_ignores_ignored_argument_names_sphinx(self, arg, _):
- """Example of a method documenting the return type that an
- implementation should return.
-
+ """Example of a method documenting the return type that an implementation should
+ return.
:param arg: An argument.
:type arg: int
diff --git a/tests/functional/ext/docparams/return/missing_return_doc_required_Google.py b/tests/functional/ext/docparams/return/missing_return_doc_required_Google.py
index 37546b34f..7e3f9dd44 100644
--- a/tests/functional/ext/docparams/return/missing_return_doc_required_Google.py
+++ b/tests/functional/ext/docparams/return/missing_return_doc_required_Google.py
@@ -5,7 +5,7 @@ with accept-no-returns-doc = no"""
def my_func(self): # [missing-return-type-doc]
- """Warn partial google returns
+ """Warn partial google returns.
Returns:
Always False
@@ -14,7 +14,7 @@ def my_func(self): # [missing-return-type-doc]
def my_func(self): # [missing-return-doc]
- """warn_partial_google_returns_type
+ """warn_partial_google_returns_type.
Returns:
bool:
@@ -23,7 +23,7 @@ def my_func(self): # [missing-return-doc]
def my_func(self, doc_type): # [missing-return-doc, missing-return-type-doc]
- """warn_missing_google_returns
+ """warn_missing_google_returns.
Parameters:
doc_type (str): Google
@@ -32,7 +32,7 @@ def my_func(self, doc_type): # [missing-return-doc, missing-return-type-doc]
def my_func(self): # [missing-return-doc]
- """warns_google_return_list_of_custom_class_without_description
+ """warns_google_return_list_of_custom_class_without_description.
Returns:
list(:class:`mymodule.Class`):
@@ -41,10 +41,8 @@ def my_func(self): # [missing-return-doc]
class Foo:
- """test_finds_missing_property_return_type_google
- Example of a property having return documentation in
- a Google style docstring
- """
+ """test_finds_missing_property_return_type_google Example of a property having
+ return documentation in a Google style docstring."""
@property
def foo_method(self): # [missing-return-type-doc]
@@ -58,10 +56,8 @@ class Foo:
class Foo:
- """test_ignores_non_property_return_type_google
- Example of a class function trying to use `type` as return
- documentation in a Google style docstring
- """
+ """test_ignores_non_property_return_type_google Example of a class function trying
+ to use `type` as return documentation in a Google style docstring."""
def foo_method(self): # [missing-return-doc, missing-return-type-doc]
"""int: docstring ...
diff --git a/tests/functional/ext/docparams/return/missing_return_doc_required_Numpy.py b/tests/functional/ext/docparams/return/missing_return_doc_required_Numpy.py
index 8cc59f0ac..871d6455e 100644
--- a/tests/functional/ext/docparams/return/missing_return_doc_required_Numpy.py
+++ b/tests/functional/ext/docparams/return/missing_return_doc_required_Numpy.py
@@ -5,7 +5,7 @@ with accept-no-returns-doc = no"""
def my_func(self, doc_type): # [missing-return-doc]
- """warn_partial_numpy_returns_type
+ """warn_partial_numpy_returns_type.
Arguments
---------
@@ -20,7 +20,7 @@ def my_func(self, doc_type): # [missing-return-doc]
def my_func(self, doc_type): # [missing-return-doc, missing-return-type-doc]
- """warn_missing_numpy_returns
+ """warn_missing_numpy_returns.
Arguments
---------
@@ -31,7 +31,7 @@ def my_func(self, doc_type): # [missing-return-doc, missing-return-type-doc]
def my_func(self): # [missing-return-doc]
- """warns_numpy_return_list_of_custom_class_without_description
+ """warns_numpy_return_list_of_custom_class_without_description.
Returns
-------
@@ -41,10 +41,8 @@ def my_func(self): # [missing-return-doc]
class Foo:
- """test_finds_missing_property_return_type_numpy
- Example of a property having return documentation in
- a numpy style docstring
- """
+ """test_finds_missing_property_return_type_numpy Example of a property having return
+ documentation in a numpy style docstring."""
@property
def foo_prop(self): # [missing-return-type-doc]
@@ -60,10 +58,8 @@ class Foo:
class Foo:
- """test_ignores_non_property_return_type_numpy
- Example of a class function trying to use `type` as return
- documentation in a numpy style docstring
- """
+ """test_ignores_non_property_return_type_numpy Example of a class function trying to
+ use `type` as return documentation in a numpy style docstring."""
def foo_method(self): # [missing-return-doc, missing-return-type-doc]
"""int: docstring ...
@@ -79,10 +75,8 @@ class Foo:
class Foo:
- """test_non_property_annotation_return_type_numpy
- Example of a class function trying to use `type` as return
- documentation in a numpy style docstring
- """
+ """test_non_property_annotation_return_type_numpy Example of a class function trying
+ to use `type` as return documentation in a numpy style docstring."""
def foo_method(self) -> int: # [missing-return-doc]
"""int: docstring ...
diff --git a/tests/functional/ext/docparams/return/missing_return_doc_required_Sphinx.py b/tests/functional/ext/docparams/return/missing_return_doc_required_Sphinx.py
index 50ae7033b..81de6689b 100644
--- a/tests/functional/ext/docparams/return/missing_return_doc_required_Sphinx.py
+++ b/tests/functional/ext/docparams/return/missing_return_doc_required_Sphinx.py
@@ -6,7 +6,7 @@ with accept-no-returns-doc = no"""
def my_func(self): # [missing-return-type-doc]
- """Warn partial sphinx returns
+ """Warn partial sphinx returns.
:returns: Always False
"""
@@ -14,7 +14,7 @@ def my_func(self): # [missing-return-type-doc]
def my_func(self) -> bool:
- """Sphinx missing return type with annotations
+ """Sphinx missing return type with annotations.
:returns: Always False
"""
@@ -22,7 +22,7 @@ def my_func(self) -> bool:
def my_func(self): # [missing-return-doc]
- """Warn partial sphinx returns type
+ """Warn partial sphinx returns type.
:rtype: bool
"""
@@ -41,7 +41,7 @@ def warn_missing_sphinx_returns( # [missing-return-type-doc, missing-return-doc
def my_func(self): # [missing-return-doc]
- """warns_sphinx_return_list_of_custom_class_without_description
+ """warns_sphinx_return_list_of_custom_class_without_description.
:rtype: list(:class:`mymodule.Class`)
"""
@@ -49,10 +49,8 @@ def my_func(self): # [missing-return-doc]
class Foo:
- """test_finds_missing_property_return_type_sphinx
- Example of a property having missing return documentation in
- a Sphinx style docstring
- """
+ """test_finds_missing_property_return_type_sphinx Example of a property having
+ missing return documentation in a Sphinx style docstring."""
@property
def foo(self): # [missing-return-type-doc]
@@ -65,9 +63,8 @@ class Foo:
class Foo:
- """Example of a class function trying to use `type` as return
- documentation in a Sphinx style docstring
- """
+ """Example of a class function trying to use `type` as return documentation in a
+ Sphinx style docstring."""
def test_ignores_non_property_return_type_sphinx( # [missing-return-doc, missing-return-type-doc]
self,
diff --git a/tests/functional/ext/docparams/useless_type_doc.py b/tests/functional/ext/docparams/useless_type_doc.py
index 110a7a5f5..ceb6d7149 100644
--- a/tests/functional/ext/docparams/useless_type_doc.py
+++ b/tests/functional/ext/docparams/useless_type_doc.py
@@ -1,9 +1,9 @@
#pylint: disable = missing-any-param-doc
-"""demonstrate FP with useless-type-doc"""
+"""demonstrate FP with useless-type-doc."""
def function(public_param: int, _some_private_param: bool = False) -> None:
- """does things
+ """does things.
Args:
public_param: an ordinary parameter
@@ -32,12 +32,11 @@ def smart_function(public_param: int, _some_private_param: bool = False) -> None
# +1: [useless-type-doc,useless-param-doc]
def function_useless_doc(public_param: int, _some_private_param: bool = False) -> None:
- """does things
+ """does things.
Args:
public_param: an ordinary parameter
_some_private_param (bool): private param
-
"""
for _ in range(public_param):
...
@@ -48,7 +47,7 @@ def function_useless_doc(public_param: int, _some_private_param: bool = False) -
def test(_new: str) -> str:
- """foobar
+ """foobar.
:return: comment
"""
@@ -65,7 +64,7 @@ def smarter_test(_new: str) -> str:
# +1: [useless-type-doc,useless-param-doc]
def test_two(_new: str) -> str:
- """foobar
+ """foobar.
:param str _new:
:return: comment
diff --git a/tests/functional/ext/docparams/yield/missing_yield_doc.py b/tests/functional/ext/docparams/yield/missing_yield_doc.py
index 331b7f9bf..23f268404 100644
--- a/tests/functional/ext/docparams/yield/missing_yield_doc.py
+++ b/tests/functional/ext/docparams/yield/missing_yield_doc.py
@@ -1,4 +1,4 @@
-"""Tests for missing-yield-doc and missing-yield-type-doc"""
+"""Tests for missing-yield-doc and missing-yield-type-doc."""
# pylint: disable=missing-function-docstring, unused-argument, function-redefined
# Ignore no docstring
diff --git a/tests/functional/ext/docparams/yield/missing_yield_doc_Google.py b/tests/functional/ext/docparams/yield/missing_yield_doc_Google.py
index 9ebfbb30b..224691620 100644
--- a/tests/functional/ext/docparams/yield/missing_yield_doc_Google.py
+++ b/tests/functional/ext/docparams/yield/missing_yield_doc_Google.py
@@ -1,4 +1,5 @@
-"""Tests for missing-yield-doc and missing-yield-type-doc for Google style docstrings"""
+"""Tests for missing-yield-doc and missing-yield-type-doc for Google style
+docstrings."""
# pylint: disable=missing-function-docstring, unused-argument, function-redefined
# pylint: disable=invalid-name, undefined-variable
import typing
diff --git a/tests/functional/ext/docparams/yield/missing_yield_doc_Numpy.py b/tests/functional/ext/docparams/yield/missing_yield_doc_Numpy.py
index ed827550b..b9cc03d1c 100644
--- a/tests/functional/ext/docparams/yield/missing_yield_doc_Numpy.py
+++ b/tests/functional/ext/docparams/yield/missing_yield_doc_Numpy.py
@@ -1,4 +1,4 @@
-"""Tests for missing-yield-doc and missing-yield-type-doc for Numpy style docstrings"""
+"""Tests for missing-yield-doc and missing-yield-type-doc for Numpy style docstrings."""
# pylint: disable=missing-function-docstring, unused-argument, function-redefined
# pylint: disable=invalid-name, undefined-variable
diff --git a/tests/functional/ext/docparams/yield/missing_yield_doc_Sphinx.py b/tests/functional/ext/docparams/yield/missing_yield_doc_Sphinx.py
index 850c8b128..74408edcf 100644
--- a/tests/functional/ext/docparams/yield/missing_yield_doc_Sphinx.py
+++ b/tests/functional/ext/docparams/yield/missing_yield_doc_Sphinx.py
@@ -1,4 +1,5 @@
-"""Tests for missing-yield-doc and missing-yield-type-doc for Sphinx style docstrings"""
+"""Tests for missing-yield-doc and missing-yield-type-doc for Sphinx style
+docstrings."""
# pylint: disable=missing-function-docstring, unused-argument, function-redefined
# pylint: disable=invalid-name, undefined-variable
import typing
diff --git a/tests/functional/ext/docstyle/docstyle.py b/tests/functional/ext/docstyle/docstyle.py
index a5b6161b0..886add162 100644
--- a/tests/functional/ext/docstyle/docstyle.py
+++ b/tests/functional/ext/docstyle/docstyle.py
@@ -1,38 +1,33 @@
-"""Checks of Dosctrings 'docstring-first-line-empty' 'bad-docstring-quotes'"""
+"""Checks of Dosctrings 'docstring-first-line-empty' 'bad-docstring-quotes'."""
def check_messages(*messages): # [docstring-first-line-empty]
- """
- docstring"""
+ """docstring."""
return messages
def function2():
- """Test Ok"""
+ """Test Ok."""
class FFFF: # [docstring-first-line-empty]
- """
- Test Docstring First Line Empty
- """
+ """Test Docstring First Line Empty."""
def method1(self): # [docstring-first-line-empty, bad-docstring-quotes]
- '''
- Test Triple Single Quotes docstring
- '''
+ """Test Triple Single Quotes docstring."""
def method2(self): # [bad-docstring-quotes]
- "bad docstring 1"
+ """bad docstring 1."""
def method3(self): # [bad-docstring-quotes]
- 'bad docstring 2'
+ """bad docstring 2."""
def method4(self): # [bad-docstring-quotes]
' """bad docstring 3 '
@check_messages("bad-open-mode", "redundant-unittest-assert", "deprecated-module")
def method5(self):
- """Test OK 1 with decorators"""
+ """Test OK 1 with decorators."""
def method6(self):
r"""Test OK 2 with raw string"""
diff --git a/tests/functional/ext/empty_comment/empty_comment.py b/tests/functional/ext/empty_comment/empty_comment.py
index 6adaa4fc1..36d74c925 100644
--- a/tests/functional/ext/empty_comment/empty_comment.py
+++ b/tests/functional/ext/empty_comment/empty_comment.py
@@ -1,4 +1,4 @@
-"""empty-comment test-case"""
+"""empty-comment test-case."""
# +1:[empty-comment]
A = 5 #
# +1:[empty-comment]
diff --git a/tests/functional/ext/for_any_all/for_any_all.py b/tests/functional/ext/for_any_all/for_any_all.py
index 8b4c7275c..d14ba79ae 100644
--- a/tests/functional/ext/for_any_all/for_any_all.py
+++ b/tests/functional/ext/for_any_all/for_any_all.py
@@ -1,49 +1,49 @@
-"""Functional test"""
+"""Functional test."""
def any_even(items):
- """Return True if the list contains any even numbers"""
+ """Return True if the list contains any even numbers."""
for item in items: # [consider-using-any-or-all]
if item % 2 == 0:
return True
return False
def all_even(items):
- """Return True if the list contains all even numbers"""
+ """Return True if the list contains all even numbers."""
for item in items: # [consider-using-any-or-all]
if not item % 2 == 0:
return False
return True
def any_uneven(items):
- """Return True if the list contains any uneven numbers"""
+ """Return True if the list contains any uneven numbers."""
for item in items: # [consider-using-any-or-all]
if not item % 2 == 0:
return True
return False
def all_uneven(items):
- """Return True if the list contains all uneven numbers"""
+ """Return True if the list contains all uneven numbers."""
for item in items: # [consider-using-any-or-all]
if item % 2 == 0:
return False
return True
def is_from_string(item):
- """Return True if one of parents of item is a string"""
+ """Return True if one of parents of item is a string."""
for parent in item.parents(): # [consider-using-any-or-all]
if isinstance(parent, str):
return True
return False
def is_not_from_string(item):
- """Return True if one of parents of item isn't a string"""
+ """Return True if one of parents of item isn't a string."""
for parent in item.parents(): # [consider-using-any-or-all]
if not isinstance(parent, str):
return True
return False
def nested_check(items):
- """Tests that for loops at deeper levels are picked up"""
+ """Tests that for loops at deeper levels are picked up."""
if items and len(items) > 5:
print(items)
for item in items: # [consider-using-any-or-all]
@@ -54,14 +54,14 @@ def nested_check(items):
return items[3] > 5
def words_contains_word(words):
- """Return whether words contains 'word'"""
+ """Return whether words contains 'word'."""
for word in words: # [consider-using-any-or-all]
if word == "word":
return True
return False
def complicated_condition_check(items):
- """Case where we expect not any statement with a more complicated condition"""
+ """Case where we expect not any statement with a more complicated condition."""
for item in items: # [consider-using-any-or-all]
if item % 2 == 0 and (item % 3 == 0 or item > 15):
return False
@@ -78,14 +78,14 @@ def is_from_decorator1(node):
return False
def is_from_decorator2(items):
- """Case where we expect an all statement because of negation in the condition"""
+ """Case where we expect an all statement because of negation in the condition."""
for item in items: # [consider-using-any-or-all]
if not(item % 2 == 0 and (item % 3 == 0 or item > 15)):
return False
return True
def is_from_decorator3(node):
- """Case where we expect a not all statement because of negation in the condition"""
+ """Case where we expect a not all statement because of negation in the condition."""
for ancestor in node: # [consider-using-any-or-all]
if not (
ancestor.name in ("Exception", "BaseException")
@@ -95,13 +95,13 @@ def is_from_decorator3(node):
return False
def no_suggestion_if_not_if():
- """Do not emit if the for loop does not have the pattern we are looking for"""
+ """Do not emit if the for loop does not have the pattern we are looking for."""
for val in range(1):
var = val
return var
def no_suggestion_if_not_bool(item):
- """Do not emit if the if-statement does not return a bool"""
+ """Do not emit if the if-statement does not return a bool."""
for parent in item.parents():
if isinstance(parent, str):
return "True"
@@ -126,9 +126,8 @@ def print_items3(items):
return items
def print_items4(items):
- """Do not emit if there is more logic which can cause side effects
- or become less readable in a list comprehension.
- """
+ """Do not emit if there is more logic which can cause side effects or become less
+ readable in a list comprehension."""
for item in items:
if isinstance(item, str):
print(item)
@@ -136,7 +135,10 @@ def print_items4(items):
return True
def is_from_decorator(node):
- """Do not emit if the if has an else condition. Generally implies more complicated logic."""
+ """Do not emit if the if has an else condition.
+
+ Generally implies more complicated logic.
+ """
for parent in node.node_ancestors():
if isinstance(parent, str): # pylint: disable=no-else-return
return True
diff --git a/tests/functional/ext/mccabe/mccabe.py b/tests/functional/ext/mccabe/mccabe.py
index b5a257b1f..58c0ee8d8 100644
--- a/tests/functional/ext/mccabe/mccabe.py
+++ b/tests/functional/ext/mccabe/mccabe.py
@@ -3,23 +3,23 @@
# pylint: disable=redefined-outer-name,useless-object-inheritance,using-constant-test,unused-argument
# pylint: disable=broad-except, not-context-manager, no-method-argument, no-self-use, unspecified-encoding
-"""Checks use of "too-complex" check"""
+"""Checks use of "too-complex" check."""
def f1(): # [too-complex]
- """McCabe rating: 1"""
+ """McCabe rating: 1."""
pass
def f2(n): # [too-complex]
- """McCabe rating: 1"""
+ """McCabe rating: 1."""
k = n + 4
s = k + n
return s
def f3(n): # [too-complex]
- """McCabe rating: 3"""
+ """McCabe rating: 3."""
if n > 3:
return "bigger than three"
elif n > 4:
@@ -29,13 +29,13 @@ def f3(n): # [too-complex]
def f4(): # [too-complex]
- """McCabe rating: 2"""
+ """McCabe rating: 2."""
for i in range(10):
print(i)
def f5(mylist): # [too-complex]
- """McCabe rating: 2"""
+ """McCabe rating: 2."""
for i in mylist:
print(i)
else:
@@ -43,7 +43,7 @@ def f5(mylist): # [too-complex]
def f6(n): # [too-complex]
- """McCabe rating: 2"""
+ """McCabe rating: 2."""
if n > 4:
return f(n - 1)
else:
@@ -51,13 +51,13 @@ def f6(n): # [too-complex]
def f7(): # [too-complex]
- """McCabe rating: 3"""
+ """McCabe rating: 3."""
def b():
- """McCabe rating: 2"""
+ """McCabe rating: 2."""
def c():
- """McCabe rating: 1"""
+ """McCabe rating: 1."""
pass
c()
@@ -66,7 +66,7 @@ def f7(): # [too-complex]
def f8(): # [too-complex]
- """McCabe rating: 4"""
+ """McCabe rating: 4."""
try:
print(1)
except TypeA:
@@ -78,7 +78,7 @@ def f8(): # [too-complex]
def f9(): # [too-complex]
- """McCabe rating: 9"""
+ """McCabe rating: 9."""
myint = 2
if myint > 5:
pass
@@ -104,7 +104,7 @@ def f9(): # [too-complex]
def f10(): # [too-complex]
- """McCabe rating: 11"""
+ """McCabe rating: 11."""
myint = 2
if myint == 5:
return myint
@@ -131,16 +131,16 @@ def f10(): # [too-complex]
class MyClass1(object):
- """Class of example to test mccabe"""
+ """Class of example to test mccabe."""
_name = "MyClass" # To force a tail.node=None
def method1(): # [too-complex]
- """McCabe rating: 1"""
+ """McCabe rating: 1."""
pass
def method2(self, param1): # [too-complex, too-many-branches]
- """McCabe rating: 18"""
+ """McCabe rating: 18."""
if not param1:
pass
pass
@@ -205,7 +205,7 @@ for count in range(10): # [too-complex]
def method3(self): # [too-complex]
- """McCabe rating: 2"""
+ """McCabe rating: 2."""
try:
if True:
pass
diff --git a/tests/functional/ext/redefined_variable_type/redefined_variable_type.py b/tests/functional/ext/redefined_variable_type/redefined_variable_type.py
index aa89383d9..5e61a047a 100644
--- a/tests/functional/ext/redefined_variable_type/redefined_variable_type.py
+++ b/tests/functional/ext/redefined_variable_type/redefined_variable_type.py
@@ -1,4 +1,4 @@
-"""Checks variable types aren't redefined within a method or a function"""
+"""Checks variable types aren't redefined within a method or a function."""
# pylint: disable=too-few-public-methods,missing-docstring,unused-variable,invalid-name, useless-object-inheritance
diff --git a/tests/functional/ext/while_used/while_used.py b/tests/functional/ext/while_used/while_used.py
index 848da0d51..b5824777e 100644
--- a/tests/functional/ext/while_used/while_used.py
+++ b/tests/functional/ext/while_used/while_used.py
@@ -1,10 +1,10 @@
-"""Functional test"""
+"""Functional test."""
while True: # [while-used]
print("asdf")
def fff():
- "zxcv"
+ """zxcv."""
i = 0
while i < 10: # [while-used]
i += 1
diff --git a/tests/functional/f/first_arg.py b/tests/functional/f/first_arg.py
index 0b5c0804b..e5d9d0d59 100644
--- a/tests/functional/f/first_arg.py
+++ b/tests/functional/f/first_arg.py
@@ -1,6 +1,5 @@
# pylint: disable=missing-docstring, no-init, useless-object-inheritance
-"""check for methods first arguments
-"""
+"""check for methods first arguments."""
__revision__ = 0
diff --git a/tests/functional/f/func_disable_linebased.py b/tests/functional/f/func_disable_linebased.py
index bb4ad232c..d8fb633e7 100644
--- a/tests/functional/f/func_disable_linebased.py
+++ b/tests/functional/f/func_disable_linebased.py
@@ -1,12 +1,12 @@
# This is a very very very very very very very very very very very very very very very very very very very very very long line. # [line-too-long]
# pylint: disable=line-too-long
# This is a very very very very very very very very very very very very very very very very very very very very very long line.
-"""Make sure enable/disable pragmas work for messages that are applied to lines and not syntax nodes.
+"""Make sure enable/disable pragmas work for messages that are applied to lines and not
+syntax nodes.
-A disable pragma for a message that applies to nodes is applied to the whole
-block if it comes before the first statement (excluding the docstring). For
-line-based messages, this behavior needs to be altered to really only apply to
-the enclosed lines.
+A disable pragma for a message that applies to nodes is applied to the whole block if it
+comes before the first statement (excluding the docstring). For line-based messages,
+this behavior needs to be altered to really only apply to the enclosed lines.
"""
# pylint: enable=line-too-long
diff --git a/tests/functional/f/function_redefined.py b/tests/functional/f/function_redefined.py
index a70ccf9c4..afe0a5140 100644
--- a/tests/functional/f/function_redefined.py
+++ b/tests/functional/f/function_redefined.py
@@ -6,83 +6,82 @@ from typing import Callable
__revision__ = ''
class AAAA(object):
- """docstring"""
+ """docstring."""
def __init__(self):
pass
def method1(self):
- """docstring"""
+ """docstring."""
def method2(self):
- """docstring"""
+ """docstring."""
def method2(self): # [function-redefined]
- """docstring"""
+ """docstring."""
class AAAA(object): # [function-redefined]
- """docstring"""
+ """docstring."""
def __init__(self):
pass
def yeah(self):
- """hehehe"""
+ """hehehe."""
def yoo(self):
- """yoo"""
+ """yoo."""
def func1():
- """docstring"""
+ """docstring."""
def func2():
- """docstring"""
+ """docstring."""
def func2(): # [function-redefined]
- """docstring"""
+ """docstring."""
__revision__ = 1 # [redefined-outer-name]
return __revision__
if __revision__:
def exclusive_func():
- "docstring"
+ """docstring."""
else:
def exclusive_func():
- "docstring"
+ """docstring."""
try:
def exclusive_func2():
- "docstring"
+ """docstring."""
except TypeError:
def exclusive_func2():
- "docstring"
+ """docstring."""
else:
def exclusive_func2(): # [function-redefined]
- "this one redefine the one defined line 42"
+ """this one redefine the one defined line 42."""
def with_inner_function_1():
- """docstring"""
+ """docstring."""
def callback():
- """callback docstring"""
+ """callback docstring."""
pass
return callback
def with_inner_function_2():
- """docstring"""
+ """docstring."""
def callback():
- """does not redefine callback returned by with_inner_function_1"""
+ """does not redefine callback returned by with_inner_function_1."""
pass
return callback
def some_func():
- """Don't emit if we defined a variable with the same name as a
- __future__ directive.
- """
+ """Don't emit if we defined a variable with the same name as a __future__
+ directive."""
division = 2
return division
def dummy_func():
- """First dummy function"""
+ """First dummy function."""
pass
def dummy_func():
- """Second dummy function, don't emit function-redefined message
- because of the dummy name"""
+ """Second dummy function, don't emit function-redefined message because of the dummy
+ name."""
pass
from math import ceil
@@ -99,7 +98,7 @@ def _():
# pylint: disable=too-few-public-methods
class ObjectProxy:
- """ABC"""
+ """ABC."""
# We actually *redefine* these attributes, but these shouldn't
# be considered actual redefinitions. Issue #2451
diff --git a/tests/functional/f/future_import.py b/tests/functional/f/future_import.py
index e4d3785a1..cd60bd77f 100644
--- a/tests/functional/f/future_import.py
+++ b/tests/functional/f/future_import.py
@@ -1,3 +1,3 @@
-"""a docstring"""
+"""a docstring."""
from __future__ import generators
diff --git a/tests/functional/g/generic_alias/generic_alias_collections_py37_with_typing.py b/tests/functional/g/generic_alias/generic_alias_collections_py37_with_typing.py
index 5319f13b6..59a6aabbe 100644
--- a/tests/functional/g/generic_alias/generic_alias_collections_py37_with_typing.py
+++ b/tests/functional/g/generic_alias/generic_alias_collections_py37_with_typing.py
@@ -1,7 +1,7 @@
"""Test generic alias support for stdlib types (added in PY39).
-Raise [unsubscriptable-object] error for PY37 and PY38.
-Make sure `import typing` doesn't change anything.
+Raise [unsubscriptable-object] error for PY37 and PY38. Make sure `import typing`
+doesn't change anything.
"""
# flake8: noqa
# pylint: disable=missing-docstring,pointless-statement,unused-import
diff --git a/tests/functional/g/generic_alias/generic_alias_postponed_evaluation_py37.py b/tests/functional/g/generic_alias/generic_alias_postponed_evaluation_py37.py
index 5ded73b3d..55c2e76b3 100644
--- a/tests/functional/g/generic_alias/generic_alias_postponed_evaluation_py37.py
+++ b/tests/functional/g/generic_alias/generic_alias_postponed_evaluation_py37.py
@@ -1,7 +1,7 @@
"""Test generic alias support for stdlib types (added in PY39).
-In type annotation context, they can be used with postponed evaluation enabled,
-starting with PY37.
+In type annotation context, they can be used with postponed evaluation enabled, starting
+with PY37.
"""
# flake8: noqa
# pylint: disable=missing-docstring,pointless-statement
diff --git a/tests/functional/g/generic_alias/generic_alias_side_effects.py b/tests/functional/g/generic_alias/generic_alias_side_effects.py
index ea7d7a9ce..e2d6bbebb 100644
--- a/tests/functional/g/generic_alias/generic_alias_side_effects.py
+++ b/tests/functional/g/generic_alias/generic_alias_side_effects.py
@@ -8,7 +8,7 @@ from typing import Generic, TypeVar
TYPE = TypeVar('TYPE')
class Cls(Generic[TYPE]):
- """ Simple class with slots """
+ """Simple class with slots."""
__slots__ = ['value']
def __init__(self, value):
@@ -33,23 +33,23 @@ def function8(value=list()): # [dangerous-default-value]
return value
def function17(value=collections.deque()): # [dangerous-default-value]
- """mutable, dangerous"""
+ """mutable, dangerous."""
return value
def function18(value=collections.ChainMap()): # [dangerous-default-value]
- """mutable, dangerous"""
+ """mutable, dangerous."""
return value
def function19(value=collections.Counter()): # [dangerous-default-value]
- """mutable, dangerous"""
+ """mutable, dangerous."""
return value
def function20(value=collections.OrderedDict()): # [dangerous-default-value]
- """mutable, dangerous"""
+ """mutable, dangerous."""
return value
def function21(value=collections.defaultdict()): # [dangerous-default-value]
- """mutable, dangerous"""
+ """mutable, dangerous."""
return value
diff --git a/tests/functional/g/genexp_in_class_scope.py b/tests/functional/g/genexp_in_class_scope.py
index 056963813..f21b14a47 100644
--- a/tests/functional/g/genexp_in_class_scope.py
+++ b/tests/functional/g/genexp_in_class_scope.py
@@ -1,6 +1,6 @@
# pylint: disable=no-init,too-few-public-methods, missing-docstring
# pylint: disable=useless-object-inheritance
-"""Class scope must be handled correctly in genexps"""
+"""Class scope must be handled correctly in genexps."""
class MyClass(object):
var1 = []
var2 = list(value*2 for value in var1)
diff --git a/tests/functional/g/genexpr_variable_scope.py b/tests/functional/g/genexpr_variable_scope.py
index a00d72d32..28bd77ff9 100644
--- a/tests/functional/g/genexpr_variable_scope.py
+++ b/tests/functional/g/genexpr_variable_scope.py
@@ -1,5 +1,4 @@
-"""test name defined in generator expression are not available
-outside the genexpr scope
-"""
+"""test name defined in generator expression are not available outside the genexpr
+scope."""
from __future__ import print_function
print(n) # [undefined-variable]
diff --git a/tests/functional/g/globals.py b/tests/functional/g/globals.py
index 56c852d8a..a1f686d6f 100644
--- a/tests/functional/g/globals.py
+++ b/tests/functional/g/globals.py
@@ -17,25 +17,25 @@ def fix_contant(value):
def other():
- """global behaviour test"""
+ """global behaviour test."""
global HOP # [global-variable-not-assigned]
print(HOP) # [undefined-variable]
def define_constant():
- """ok but somevar is not defined at the module scope"""
+ """ok but somevar is not defined at the module scope."""
global SOMEVAR # [global-variable-undefined]
SOMEVAR = 2
def global_with_import():
- """should only warn for global-statement"""
+ """should only warn for global-statement."""
global sys # [global-statement]
import sys # pylint: disable=import-outside-toplevel
def global_no_assign():
- """Not assigning anything to the global makes 'global' superfluous"""
+ """Not assigning anything to the global makes 'global' superfluous."""
global CONSTANT # [global-variable-not-assigned]
print(CONSTANT)
@@ -48,14 +48,14 @@ def global_del():
def global_operator_assign():
- """Operator assigns should only throw a global statement error"""
+ """Operator assigns should only throw a global statement error."""
global CONSTANT # [global-statement]
print(CONSTANT)
CONSTANT += 1
def global_function_assign():
- """Function assigns should only throw a global statement error"""
+ """Function assigns should only throw a global statement error."""
global CONSTANT # [global-statement]
def CONSTANT():
@@ -65,7 +65,7 @@ def global_function_assign():
def override_func():
- """Overriding a function should only throw a global statement error"""
+ """Overriding a function should only throw a global statement error."""
global FUNC # [global-statement]
def FUNC():
@@ -74,7 +74,7 @@ def override_func():
FUNC()
def func():
- """Overriding a global with an import should only throw a global statement error"""
+ """Overriding a global with an import should only throw a global statement error."""
global sys # [global-statement]
import sys
diff --git a/tests/functional/i/import_error.py b/tests/functional/i/import_error.py
index a2183fcfb..83239211b 100644
--- a/tests/functional/i/import_error.py
+++ b/tests/functional/i/import_error.py
@@ -1,4 +1,4 @@
-""" Test that import errors are detected. """
+"""Test that import errors are detected."""
# pylint: disable=invalid-name, unused-import, bare-except, broad-except, wrong-import-order, wrong-import-position
import totally_missing # [import-error]
diff --git a/tests/functional/i/import_itself.py b/tests/functional/i/import_itself.py
index 1f4928f3e..a5a156f64 100644
--- a/tests/functional/i/import_itself.py
+++ b/tests/functional/i/import_itself.py
@@ -1,4 +1,4 @@
-"""test module importing itself"""
+"""test module importing itself."""
# pylint: disable=using-constant-test
from __future__ import print_function
from . import import_itself # [import-self]
diff --git a/tests/functional/i/inconsistent/inconsistent_quotes.py b/tests/functional/i/inconsistent/inconsistent_quotes.py
index 76553f98b..69d312083 100644
--- a/tests/functional/i/inconsistent/inconsistent_quotes.py
+++ b/tests/functional/i/inconsistent/inconsistent_quotes.py
@@ -10,7 +10,6 @@ FOURTH_STRING = "yet another double-quoted string"
FIFTH_STRING = 'single-quoted string with an unescaped "double quote"'
def function_with_docstring():
- '''This is a multi-line docstring that should not raise a warning even though the
+ """This is a multi-line docstring that should not raise a warning even though the
delimiter it uses for quotes is not the delimiter used in the majority of the
- module.
- '''
+ module."""
diff --git a/tests/functional/i/inconsistent/inconsistent_returns.py b/tests/functional/i/inconsistent/inconsistent_returns.py
index 08dde253e..d4b4d99ec 100644
--- a/tests/functional/i/inconsistent/inconsistent_returns.py
+++ b/tests/functional/i/inconsistent/inconsistent_returns.py
@@ -1,6 +1,6 @@
#pylint: disable=missing-docstring, no-else-return, no-else-break, invalid-name, unused-variable, superfluous-parens, try-except-raise
#pylint: disable=disallowed-name
-"""Testing inconsistent returns"""
+"""Testing inconsistent returns."""
import math
import sys
@@ -101,7 +101,7 @@ def explicit_returns7(arg):
return 'above 0'
def bug_1772():
- """Don't check inconsistent return statements inside while loop"""
+ """Don't check inconsistent return statements inside while loop."""
counter = 1
while True:
counter += 1
@@ -265,8 +265,8 @@ def bug_1794_inner_func_in_if_counter_example_3(var): # [inconsistent-return-sta
return
def bug_3468(bar): # [inconsistent-return-statements]
- """
- In case of AttributeError the function returns implicitly None.
+ """In case of AttributeError the function returns implicitly None.
+
There are one explicit return and one implicit.
"""
try:
@@ -275,10 +275,8 @@ def bug_3468(bar): # [inconsistent-return-statements]
pass
def bug_3468_variant(bar): # [inconsistent-return-statements]
- """
- In case of AttributeError the function returns implicitly None
- There are one explicit return and one implicit.
- """
+ """In case of AttributeError the function returns implicitly None There are one
+ explicit return and one implicit."""
try:
return bar.baz
except AttributeError:
@@ -289,8 +287,8 @@ def bug_3468_variant(bar): # [inconsistent-return-statements]
raise
def bug_3468_counter_example(bar):
- """
- In case of AttributeError the function returns explicitly None.
+ """In case of AttributeError the function returns explicitly None.
+
Thus all returns are explicit.
"""
try:
@@ -300,8 +298,8 @@ def bug_3468_counter_example(bar):
return None
def bug_3468_counter_example_2(bar):
- """
- In case of AttributeError the function returns explicitly None.
+ """In case of AttributeError the function returns explicitly None.
+
Thus all returns are explicit.
"""
try:
@@ -338,18 +336,14 @@ def bug_pylint_3873_2():
# https://github.com/PyCQA/pylint/issues/4019
def bug_pylint_4019(x):
- """
- assert False is equivalent to a return
- """
+ """assert False is equivalent to a return."""
if x == 1:
return 42
assert False
def bug_pylint_4019_wrong(x): # [inconsistent-return-statements]
- """
- assert True is not equivalent to a return
- """
+ """assert True is not equivalent to a return."""
if x == 1:
return 42
assert True
diff --git a/tests/functional/i/inconsistent/inconsistent_returns_noreturn.py b/tests/functional/i/inconsistent/inconsistent_returns_noreturn.py
index 768d6e658..490f4ea2d 100644
--- a/tests/functional/i/inconsistent/inconsistent_returns_noreturn.py
+++ b/tests/functional/i/inconsistent/inconsistent_returns_noreturn.py
@@ -17,10 +17,8 @@ def parser_error_name(msg) -> NoReturn: # pylint: disable=unused-argument
sys.exit(3)
def bug_pylint_4122(s):
- """
- Every returns is consistent because parser_error has type hints
- indicating it never returns
- """
+ """Every returns is consistent because parser_error has type hints indicating it
+ never returns."""
try:
n = int(s)
if n < 1:
@@ -30,9 +28,8 @@ def bug_pylint_4122(s):
parser_error('parser error')
def bug_pylint_4122_wrong(s): # [inconsistent-return-statements]
- """
- Every returns is not consistent because parser_error_nortype has no type hints
- """
+ """Every returns is not consistent because parser_error_nortype has no type
+ hints."""
try:
n = int(s)
if n < 1:
@@ -42,10 +39,8 @@ def bug_pylint_4122_wrong(s): # [inconsistent-return-statements]
parser_error_nortype('parser error')
def bug_pylint_4122_bis(s):
- """
- Every returns is consistent because parser_error has type hints
- indicating it never returns
- """
+ """Every returns is consistent because parser_error has type hints indicating it
+ never returns."""
try:
n = int(s)
if n < 1:
diff --git a/tests/functional/i/inherit_non_class.py b/tests/functional/i/inherit_non_class.py
index 7454744d9..6d47b7e1f 100644
--- a/tests/functional/i/inherit_non_class.py
+++ b/tests/functional/i/inherit_non_class.py
@@ -1,5 +1,4 @@
-"""Test that inheriting from something which is not
-a class emits a warning. """
+"""Test that inheriting from something which is not a class emits a warning."""
# pylint: disable=no-init, import-error, invalid-name, using-constant-test, useless-object-inheritance
# pylint: disable=missing-docstring, too-few-public-methods
@@ -12,26 +11,26 @@ else:
Ambiguous = int
class Empty(object):
- """ Empty class. """
+ """Empty class."""
def return_class():
- """ Return a class. """
+ """Return a class."""
return Good3
class Bad(1): # [inherit-non-class]
- """ Can't inherit from instance. """
+ """Can't inherit from instance."""
class Bad1(lambda abc: 42): # [inherit-non-class]
- """ Can't inherit from lambda. """
+ """Can't inherit from lambda."""
class Bad2(object()): # [inherit-non-class]
- """ Can't inherit from an instance of object. """
+ """Can't inherit from an instance of object."""
class Bad3(return_class): # [inherit-non-class]
- """ Can't inherit from function. """
+ """Can't inherit from function."""
class Bad4(Empty()): # [inherit-non-class]
- """ Can't inherit from instance. """
+ """Can't inherit from instance."""
class Good(object):
pass
@@ -52,10 +51,9 @@ class Good5(Good4, int, object):
pass
class Good6(Ambiguous):
- """ Inherits from something ambiguous.
+ """Inherits from something ambiguous.
- This could emit a warning when we will have
- flow detection.
+ This could emit a warning when we will have flow detection.
"""
class Unknown(Missing):
diff --git a/tests/functional/i/init_not_called.py b/tests/functional/i/init_not_called.py
index 8f646eb26..5eb39794a 100644
--- a/tests/functional/i/init_not_called.py
+++ b/tests/functional/i/init_not_called.py
@@ -1,43 +1,42 @@
# pylint: disable=too-few-public-methods,import-error,missing-docstring,wrong-import-position,useless-super-delegation, useless-object-inheritance, unnecessary-pass
-"""test for __init__ not called
-"""
+"""test for __init__ not called."""
from __future__ import print_function
class AAAA:
- """ancestor 1"""
+ """ancestor 1."""
def __init__(self):
print('init', self)
class BBBB:
- """ancestor 2"""
+ """ancestor 2."""
def __init__(self):
print('init', self)
class CCCC:
- """ancestor 3"""
+ """ancestor 3."""
class ZZZZ(AAAA, BBBB, CCCC):
- """derived class"""
+ """derived class."""
def __init__(self): # [super-init-not-called]
AAAA.__init__(self)
class NewStyleA(object):
- """new style class"""
+ """new style class."""
def __init__(self):
super().__init__()
print('init', self)
class NewStyleB(NewStyleA):
- """derived new style class"""
+ """derived new style class."""
def __init__(self):
super().__init__()
class NoInit(object):
- """No __init__ defined"""
+ """No __init__ defined."""
class Init(NoInit):
"""Don't complain for not calling the super __init__"""
diff --git a/tests/functional/i/init_return_from_inner_function.py b/tests/functional/i/init_return_from_inner_function.py
index 065a1ad70..f7a6cd975 100644
--- a/tests/functional/i/init_return_from_inner_function.py
+++ b/tests/functional/i/init_return_from_inner_function.py
@@ -1,12 +1,12 @@
# pylint: disable=too-few-public-methods, useless-object-inheritance
-"""#10075"""
+"""#10075."""
__revision__ = 1
class Aaa(object):
- """docstring"""
+ """docstring."""
def __init__(self):
def inner_function(arg):
- """inner docstring"""
+ """inner docstring."""
return arg + 4
self.func = inner_function
diff --git a/tests/functional/i/inner_classes.py b/tests/functional/i/inner_classes.py
index 7ce8101f0..55af6e414 100644
--- a/tests/functional/i/inner_classes.py
+++ b/tests/functional/i/inner_classes.py
@@ -1,33 +1,33 @@
# pylint: disable=too-few-public-methods, useless-object-inheritance, unnecessary-pass
-"""Backend Base Classes for the schwelm user DB"""
+"""Backend Base Classes for the schwelm user DB."""
__revision__ = "alpha"
class Aaa(object):
- """docstring"""
+ """docstring."""
def __init__(self):
self.__setattr__('a', 'b')
def one_public(self):
- """docstring"""
+ """docstring."""
pass
def another_public(self):
- """docstring"""
+ """docstring."""
pass
class Bbb(Aaa):
- """docstring"""
+ """docstring."""
pass
class Ccc(Aaa):
- """docstring"""
+ """docstring."""
class Ddd(Aaa):
- """docstring"""
+ """docstring."""
pass
class Eee(Ddd):
- """docstring"""
+ """docstring."""
pass
diff --git a/tests/functional/i/invalid/b/invalid_bool_returned.py b/tests/functional/i/invalid/b/invalid_bool_returned.py
index 0e68ed263..a58f08f62 100644
--- a/tests/functional/i/invalid/b/invalid_bool_returned.py
+++ b/tests/functional/i/invalid/b/invalid_bool_returned.py
@@ -1,4 +1,4 @@
-"""Check invalid value returned by __bool__ """
+"""Check invalid value returned by __bool__"""
# pylint: disable=too-few-public-methods,missing-docstring,no-self-use,import-error, useless-object-inheritance
import six
@@ -31,32 +31,32 @@ class ThirdGoodBool(object):
class FirstBadBool(object):
- """ __bool__ returns an integer """
+ """__bool__ returns an integer."""
def __bool__(self): # [invalid-bool-returned]
return 1
class SecondBadBool(object):
- """ __bool__ returns str """
+ """__bool__ returns str."""
def __bool__(self): # [invalid-bool-returned]
return "True"
class ThirdBadBool(object):
- """ __bool__ returns node which does not have 'value' in AST """
+ """__bool__ returns node which does not have 'value' in AST."""
def __bool__(self): # [invalid-bool-returned]
return lambda: 3
class AmbigousBool(object):
- """ Uninferable return value """
+ """Uninferable return value."""
__bool__ = lambda self: Missing
class AnotherAmbiguousBool(object):
- """Potential uninferable return value"""
+ """Potential uninferable return value."""
def __bool__(self):
return bool(Missing)
diff --git a/tests/functional/i/invalid/b/invalid_bytes_returned.py b/tests/functional/i/invalid/b/invalid_bytes_returned.py
index 703fea278..1c9c9ae66 100644
--- a/tests/functional/i/invalid/b/invalid_bytes_returned.py
+++ b/tests/functional/i/invalid/b/invalid_bytes_returned.py
@@ -1,4 +1,4 @@
-"""Check invalid value returned by __bytes__ """
+"""Check invalid value returned by __bytes__"""
# pylint: disable=too-few-public-methods,missing-docstring,no-self-use,import-error, useless-object-inheritance
import six
@@ -31,34 +31,34 @@ class ThirdGoodBytes(object):
class FirstBadBytes(object):
- """ __bytes__ returns bytes """
+ """__bytes__ returns bytes."""
def __bytes__(self): # [invalid-bytes-returned]
return "123"
class SecondBadBytes(object):
- """ __bytes__ returns int """
+ """__bytes__ returns int."""
def __bytes__(self): # [invalid-bytes-returned]
return 1
class ThirdBadBytes(object):
- """ __bytes__ returns node which does not have 'value' in AST """
+ """__bytes__ returns node which does not have 'value' in AST."""
def __bytes__(self): # [invalid-bytes-returned]
return lambda: b"some bytes"
class AmbiguousBytes(object):
- """ Uninferable return value """
+ """Uninferable return value."""
__bytes__ = lambda self: Missing
class AnotherAmbiguousBytes(object):
- """Potential uninferable return value"""
+ """Potential uninferable return value."""
def __bytes__(self):
return bytes(Missing)
diff --git a/tests/functional/i/invalid/e/invalid_exceptions_raised.py b/tests/functional/i/invalid/e/invalid_exceptions_raised.py
index 475326545..f90d15d4d 100644
--- a/tests/functional/i/invalid/e/invalid_exceptions_raised.py
+++ b/tests/functional/i/invalid/e/invalid_exceptions_raised.py
@@ -1,5 +1,5 @@
# pylint:disable=too-few-public-methods,no-init,import-error,missing-docstring, not-callable, useless-object-inheritance,import-outside-toplevel
-"""test pb with exceptions and old/new style classes"""
+"""test pb with exceptions and old/new style classes."""
class ValidException(Exception):
@@ -13,7 +13,7 @@ class NewStyleClass(object):
def good_case():
- """raise"""
+ """raise."""
raise ValidException('hop')
def good_case1():
@@ -32,47 +32,47 @@ def good_case3():
raise io.BlockingIOError
def bad_case0():
- """raise"""
+ """raise."""
# +2:<3.0:[nonstandard-exception]
# +1:>=3.0:[raising-non-exception]
raise OldStyleClass('hop')
def bad_case1():
- """raise"""
+ """raise."""
raise NewStyleClass() # [raising-non-exception]
def bad_case2():
- """raise"""
+ """raise."""
# +2:<3.0:[nonstandard-exception]
# +1:>=3.0:[raising-non-exception]
raise OldStyleClass('hop')
def bad_case3():
- """raise"""
+ """raise."""
raise NewStyleClass # [raising-non-exception]
def bad_case4():
- """raise"""
+ """raise."""
raise NotImplemented('hop') # [notimplemented-raised]
def bad_case5():
- """raise"""
+ """raise."""
raise 1 # [raising-bad-type]
def bad_case6():
- """raise"""
+ """raise."""
raise None # [raising-bad-type]
def bad_case7():
- """raise list"""
+ """raise list."""
raise list # [raising-non-exception]
def bad_case8():
- """raise tuple"""
+ """raise tuple."""
raise tuple # [raising-non-exception]
def bad_case9():
- """raise dict"""
+ """raise dict."""
raise dict # [raising-non-exception]
def unknown_bases():
@@ -84,7 +84,7 @@ def unknown_bases():
def exception_instance_regression():
- """Exceptions have a particular class type"""
+ """Exceptions have a particular class type."""
try:
int("9a")
except ValueError as exc:
@@ -93,7 +93,7 @@ def exception_instance_regression():
def reusing_same_name_picks_the_latest_raised_value():
class Error(Exception):
- """some error"""
+ """some error."""
exceptions = tuple([ValueError, TypeError])
try:
@@ -106,5 +106,5 @@ def reusing_same_name_picks_the_latest_raised_value():
def bad_case10():
- """raise string"""
+ """raise string."""
raise "string" # [raising-bad-type]
diff --git a/tests/functional/i/invalid/g/invalid_getnewargs_ex_returned.py b/tests/functional/i/invalid/g/invalid_getnewargs_ex_returned.py
index ad94b8805..266f2d594 100644
--- a/tests/functional/i/invalid/g/invalid_getnewargs_ex_returned.py
+++ b/tests/functional/i/invalid/g/invalid_getnewargs_ex_returned.py
@@ -1,4 +1,4 @@
-"""Check invalid value returned by __getnewargs_ex__ """
+"""Check invalid value returned by __getnewargs_ex__"""
# pylint: disable=too-few-public-methods,missing-docstring,no-self-use,import-error, useless-object-inheritance, use-dict-literal
import six
@@ -31,55 +31,55 @@ class ThirdGoodGetNewArgsEx(object):
class FirstBadGetNewArgsEx(object):
- """ __getnewargs_ex__ returns an integer """
+ """__getnewargs_ex__ returns an integer."""
def __getnewargs_ex__(self): # [invalid-getnewargs-ex-returned]
return 1
class SecondBadGetNewArgsEx(object):
- """ __getnewargs_ex__ returns tuple with incorrect arg length"""
+ """__getnewargs_ex__ returns tuple with incorrect arg length."""
def __getnewargs_ex__(self): # [invalid-getnewargs-ex-returned]
return (tuple(1), dict(x="y"), 1)
class ThirdBadGetNewArgsEx(object):
- """ __getnewargs_ex__ returns tuple with wrong type for first arg """
+ """__getnewargs_ex__ returns tuple with wrong type for first arg."""
def __getnewargs_ex__(self): # [invalid-getnewargs-ex-returned]
return (dict(x="y"), dict(x="y"))
class FourthBadGetNewArgsEx(object):
- """ __getnewargs_ex__ returns tuple with wrong type for second arg """
+ """__getnewargs_ex__ returns tuple with wrong type for second arg."""
def __getnewargs_ex__(self): # [invalid-getnewargs-ex-returned]
return ((1, ), (1, ))
class FifthBadGetNewArgsEx(object):
- """ __getnewargs_ex__ returns tuple with wrong type for both args """
+ """__getnewargs_ex__ returns tuple with wrong type for both args."""
def __getnewargs_ex__(self): # [invalid-getnewargs-ex-returned]
return ({'x': 'y'}, (2,))
class SixthBadGetNewArgsEx(object):
- """ __getnewargs_ex__ returns node which does not have 'value' in AST """
+ """__getnewargs_ex__ returns node which does not have 'value' in AST."""
def __getnewargs_ex__(self): # [invalid-getnewargs-ex-returned]
return lambda: (1, 2)
class AmbigousGetNewArgsEx(object):
- """ Uninferable return value """
+ """Uninferable return value."""
__getnewargs_ex__ = lambda self: Missing
class AnotherAmbiguousGetNewArgsEx(object):
- """Potential uninferable return value"""
+ """Potential uninferable return value."""
def __getnewargs_ex__(self):
return tuple(Missing)
diff --git a/tests/functional/i/invalid/g/invalid_getnewargs_returned.py b/tests/functional/i/invalid/g/invalid_getnewargs_returned.py
index ee5305fe8..a638602ce 100644
--- a/tests/functional/i/invalid/g/invalid_getnewargs_returned.py
+++ b/tests/functional/i/invalid/g/invalid_getnewargs_returned.py
@@ -1,4 +1,4 @@
-"""Check invalid value returned by __getnewargs__ """
+"""Check invalid value returned by __getnewargs__"""
# pylint: disable=too-few-public-methods,missing-docstring,no-self-use,import-error, useless-object-inheritance
import six
@@ -31,32 +31,32 @@ class ThirdGoodGetNewArgs(object):
class FirstBadGetNewArgs(object):
- """ __getnewargs__ returns an integer """
+ """__getnewargs__ returns an integer."""
def __getnewargs__(self): # [invalid-getnewargs-returned]
return 1
class SecondBadGetNewArgs(object):
- """ __getnewargs__ returns str """
+ """__getnewargs__ returns str."""
def __getnewargs__(self): # [invalid-getnewargs-returned]
return "(1, 2, 3)"
class ThirdBadGetNewArgs(object):
- """ __getnewargs__ returns node which does not have 'value' in AST """
+ """__getnewargs__ returns node which does not have 'value' in AST."""
def __getnewargs__(self): # [invalid-getnewargs-returned]
return lambda: tuple(1, 2)
class AmbigousGetNewArgs(object):
- """ Uninferable return value """
+ """Uninferable return value."""
__getnewargs__ = lambda self: Missing
class AnotherAmbiguousGetNewArgs(object):
- """Potential uninferable return value"""
+ """Potential uninferable return value."""
def __getnewargs__(self):
return tuple(Missing)
diff --git a/tests/functional/i/invalid/invalid_format_returned.py b/tests/functional/i/invalid/invalid_format_returned.py
index ec428b4b3..6f5bdccf6 100644
--- a/tests/functional/i/invalid/invalid_format_returned.py
+++ b/tests/functional/i/invalid/invalid_format_returned.py
@@ -1,4 +1,4 @@
-"""Check invalid value returned by __format__ """
+"""Check invalid value returned by __format__"""
# pylint: disable=too-few-public-methods,missing-docstring,no-self-use,import-error, useless-object-inheritance
import six
@@ -31,34 +31,34 @@ class ThirdGoodFormat(object):
class FirstBadFormat(object):
- """ __format__ returns bytes """
+ """__format__ returns bytes."""
def __format__(self, format_spec): # [invalid-format-returned]
return b"123"
class SecondBadFormat(object):
- """ __format__ returns int """
+ """__format__ returns int."""
def __format__(self, format_spec): # [invalid-format-returned]
return 1
class ThirdBadFormat(object):
- """ __format__ returns node which does not have 'value' in AST """
+ """__format__ returns node which does not have 'value' in AST."""
def __format__(self, format_spec): # [invalid-format-returned]
return lambda: "some format"
class AmbiguousFormat(object):
- """ Uninferable return value """
+ """Uninferable return value."""
__format__ = lambda self, format_spec: Missing
class AnotherAmbiguousFormat(object):
- """Potential uninferable return value"""
+ """Potential uninferable return value."""
def __format__(self, format_spec):
return str(Missing)
diff --git a/tests/functional/i/invalid/invalid_hash_returned.py b/tests/functional/i/invalid/invalid_hash_returned.py
index 47f63e99b..2996ecbeb 100644
--- a/tests/functional/i/invalid/invalid_hash_returned.py
+++ b/tests/functional/i/invalid/invalid_hash_returned.py
@@ -1,4 +1,4 @@
-"""Check invalid value returned by __hash__ """
+"""Check invalid value returned by __hash__"""
# pylint: disable=too-few-public-methods,missing-docstring,no-self-use,import-error, useless-object-inheritance
import six
@@ -31,41 +31,41 @@ class ThirdGoodHash(object):
class FirstBadHash(object):
- """ __hash__ returns a dict """
+ """__hash__ returns a dict."""
def __hash__(self): # [invalid-hash-returned]
return {}
class SecondBadHash(object):
- """ __hash__ returns str """
+ """__hash__ returns str."""
def __hash__(self): # [invalid-hash-returned]
return "True"
class ThirdBadHash(object):
- """ __hash__ returns a float"""
+ """__hash__ returns a float."""
def __hash__(self): # [invalid-hash-returned]
return 1.11
class FourthBadHash(object):
- """ __hash__ returns node which does not have 'value' in AST """
+ """__hash__ returns node which does not have 'value' in AST."""
def __hash__(self): # [invalid-hash-returned]
return lambda: 3
class AmbigousHash(object):
- """ Uninferable return value """
+ """Uninferable return value."""
__hash__ = lambda self: Missing
class AnotherAmbiguousHash(object):
- """Potential uninferable return value"""
+ """Potential uninferable return value."""
def __hash__(self):
return hash(Missing)
diff --git a/tests/functional/i/invalid/invalid_index_returned.py b/tests/functional/i/invalid/invalid_index_returned.py
index c48d9a837..791ed1c44 100644
--- a/tests/functional/i/invalid/invalid_index_returned.py
+++ b/tests/functional/i/invalid/invalid_index_returned.py
@@ -1,4 +1,4 @@
-"""Check invalid value returned by __index__ """
+"""Check invalid value returned by __index__"""
# pylint: disable=too-few-public-methods,missing-docstring,no-self-use,import-error, useless-object-inheritance
import six
@@ -31,41 +31,41 @@ class ThirdGoodIndex(object):
class FirstBadIndex(object):
- """ __index__ returns a dict """
+ """__index__ returns a dict."""
def __index__(self): # [invalid-index-returned]
return {'1': '1'}
class SecondBadIndex(object):
- """ __index__ returns str """
+ """__index__ returns str."""
def __index__(self): # [invalid-index-returned]
return "42"
class ThirdBadIndex(object):
- """ __index__ returns a float"""
+ """__index__ returns a float."""
def __index__(self): # [invalid-index-returned]
return 1.11
class FourthBadIndex(object):
- """ __index__ returns node which does not have 'value' in AST """
+ """__index__ returns node which does not have 'value' in AST."""
def __index__(self): # [invalid-index-returned]
return lambda: 3
class AmbigousIndex(object):
- """ Uninferable return value """
+ """Uninferable return value."""
__index__ = lambda self: Missing
class AnotherAmbiguousIndex(object):
- """Potential uninferable return value"""
+ """Potential uninferable return value."""
def __index__(self):
return int(Missing)
diff --git a/tests/functional/i/invalid/invalid_name.py b/tests/functional/i/invalid/invalid_name.py
index 527064c44..974dbf999 100644
--- a/tests/functional/i/invalid/invalid_name.py
+++ b/tests/functional/i/invalid/invalid_name.py
@@ -1,4 +1,4 @@
-""" Tests for invalid-name checker. """
+"""Tests for invalid-name checker."""
# pylint: disable=unused-import, wrong-import-position, import-outside-toplevel, missing-class-docstring,missing-function-docstring
# pylint: disable=too-few-public-methods
@@ -22,7 +22,7 @@ except ImportError:
python = 24
def test():
- """ Shouldn't emit an invalid-name here. """
+ """Shouldn't emit an invalid-name here."""
try:
import re
except ImportError:
@@ -47,11 +47,11 @@ for i in range(10):
def dummy_decorator(aaabc, bbbcd):
- """Some"""
+ """Some."""
def real_decorator(fff):
- """pieces of"""
+ """pieces of."""
def wrapper(*args, **kwargs):
- """docstring"""
+ """docstring."""
print(aaabc, bbbcd)
fff(*args, **kwargs)
return wrapper
@@ -65,7 +65,7 @@ def dummy_decorator(aaabc, bbbcd):
])
def a_very_very_very_long_function_name_WithCamelCase_to_make_it_sad(): # Should be line 65
- """Docstring"""
+ """Docstring."""
print('LOL')
a_very_very_very_long_function_name_WithCamelCase_to_make_it_sad()
diff --git a/tests/functional/i/invalid/invalid_name_issue_3405.py b/tests/functional/i/invalid/invalid_name_issue_3405.py
index 9b0dd37cd..30e895673 100644
--- a/tests/functional/i/invalid/invalid_name_issue_3405.py
+++ b/tests/functional/i/invalid/invalid_name_issue_3405.py
@@ -1,4 +1,4 @@
-""" Regression test for https://github.com/PyCQA/pylint/issues/3405. """
+"""Regression test for https://github.com/PyCQA/pylint/issues/3405."""
import dataclasses
from typing import ClassVar
@@ -6,6 +6,7 @@ from typing import ClassVar
@dataclasses.dataclass
class Foo:
- """ClassVar attribute should be matched against class-attribute-rgx, not attr-rgx"""
+ """ClassVar attribute should be matched against class-attribute-rgx, not attr-
+ rgx."""
# class-attribute-rgx='^y$'
x: ClassVar[int] = 0 # [invalid-name]
diff --git a/tests/functional/i/invalid/invalid_name_module_level.py b/tests/functional/i/invalid/invalid_name_module_level.py
index 355969f39..6e1606baa 100644
--- a/tests/functional/i/invalid/invalid_name_module_level.py
+++ b/tests/functional/i/invalid/invalid_name_module_level.py
@@ -1,4 +1,4 @@
-"""Tests for invalid name for names declared at module level"""
+"""Tests for invalid name for names declared at module level."""
# pylint: disable=missing-class-docstring, too-few-public-methods, missing-function-docstring
import collections
diff --git a/tests/functional/i/invalid/invalid_repr_returned.py b/tests/functional/i/invalid/invalid_repr_returned.py
index 3bbd7828d..fa6b9e050 100644
--- a/tests/functional/i/invalid/invalid_repr_returned.py
+++ b/tests/functional/i/invalid/invalid_repr_returned.py
@@ -1,4 +1,4 @@
-"""Check invalid value returned by __repr__ """
+"""Check invalid value returned by __repr__"""
# pylint: disable=too-few-public-methods,missing-docstring,no-self-use,import-error, useless-object-inheritance
import six
@@ -31,34 +31,34 @@ class ThirdGoodRepr(object):
class FirstBadRepr(object):
- """ __repr__ returns bytes """
+ """__repr__ returns bytes."""
def __repr__(self): # [invalid-repr-returned]
return b"123"
class SecondBadRepr(object):
- """ __repr__ returns int """
+ """__repr__ returns int."""
def __repr__(self): # [invalid-repr-returned]
return 1
class ThirdBadRepr(object):
- """ __repr__ returns node which does not have 'value' in AST """
+ """__repr__ returns node which does not have 'value' in AST."""
def __repr__(self): # [invalid-repr-returned]
return lambda: "some repr"
class AmbiguousRepr(object):
- """ Uninferable return value """
+ """Uninferable return value."""
__repr__ = lambda self: Missing
class AnotherAmbiguousRepr(object):
- """Potential uninferable return value"""
+ """Potential uninferable return value."""
def __repr__(self):
return str(Missing)
diff --git a/tests/functional/i/invalid/l/invalid_length_hint_returned.py b/tests/functional/i/invalid/l/invalid_length_hint_returned.py
index 7696bc9fd..fb6283b70 100644
--- a/tests/functional/i/invalid/l/invalid_length_hint_returned.py
+++ b/tests/functional/i/invalid/l/invalid_length_hint_returned.py
@@ -1,4 +1,4 @@
-"""Check invalid value returned by __length_hint__ """
+"""Check invalid value returned by __length_hint__"""
# pylint: disable=too-few-public-methods,missing-docstring,no-self-use,import-error, useless-object-inheritance
import sys
@@ -33,32 +33,32 @@ class ThirdGoodLengthHint(object):
class FirstBadLengthHint(object):
- """ __length_hint__ returns a negative integer """
+ """__length_hint__ returns a negative integer."""
def __length_hint__(self): # [invalid-length-hint-returned]
return -1
class SecondBadLengthHint(object):
- """ __length_hint__ returns non-int """
+ """__length_hint__ returns non-int."""
def __length_hint__(self): # [invalid-length-hint-returned]
return 3.0
class ThirdBadLengthHint(object):
- """ __length_hint__ returns node which does not have 'value' in AST """
+ """__length_hint__ returns node which does not have 'value' in AST."""
def __length_hint__(self): # [invalid-length-hint-returned]
return lambda: 3
class AmbigousLengthHint(object):
- """ Uninferable return value """
+ """Uninferable return value."""
__length_hint__ = lambda self: Missing
class AnotherAmbiguousLengthHint(object):
- """Potential uninferable return value"""
+ """Potential uninferable return value."""
def __length_hint__(self):
return int(Missing)
diff --git a/tests/functional/i/invalid/l/invalid_length_returned.py b/tests/functional/i/invalid/l/invalid_length_returned.py
index 99af28d1c..6b38611bf 100644
--- a/tests/functional/i/invalid/l/invalid_length_returned.py
+++ b/tests/functional/i/invalid/l/invalid_length_returned.py
@@ -1,4 +1,4 @@
-"""Check invalid value returned by __len__ """
+"""Check invalid value returned by __len__"""
# pylint: disable=too-few-public-methods,missing-docstring,no-self-use,import-error, useless-object-inheritance
import sys
@@ -33,39 +33,39 @@ class ThirdGoodLen(object):
class FirstBadLen(object):
- """ __len__ returns a negative integer """
+ """__len__ returns a negative integer."""
def __len__(self): # [invalid-length-returned]
return -1
class SecondBadLen(object):
- """ __len__ returns non-int """
+ """__len__ returns non-int."""
def __len__(self): # [invalid-length-returned]
return 3.0
class ThirdBadLen(object):
- """ __len__ returns node which does not have 'value' in AST """
+ """__len__ returns node which does not have 'value' in AST."""
def __len__(self): # [invalid-length-returned]
return lambda: 3
class NonRegression(object):
- """ __len__ returns nothing """
+ """__len__ returns nothing."""
def __len__(self): # [invalid-length-returned]
print(3.0)
class AmbigousLen(object):
- """ Uninferable return value """
+ """Uninferable return value."""
__len__ = lambda self: Missing
class AnotherAmbiguousLen(object):
- """Potential uninferable return value"""
+ """Potential uninferable return value."""
def __len__(self):
return int(Missing)
diff --git a/tests/functional/i/invalid/s/invalid_sequence_index.py b/tests/functional/i/invalid/s/invalid_sequence_index.py
index 36a0fae22..b954fc70c 100644
--- a/tests/functional/i/invalid/s/invalid_sequence_index.py
+++ b/tests/functional/i/invalid/s/invalid_sequence_index.py
@@ -1,4 +1,4 @@
-"""Errors for invalid sequence indices"""
+"""Errors for invalid sequence indices."""
# pylint: disable=too-few-public-methods, no-self-use, import-error, missing-docstring, useless-object-inheritance, unnecessary-pass
import six
from unknown import Unknown
@@ -9,134 +9,134 @@ TESTSTR = '123'
# getitem tests with bad indices
def function1():
- """list index is a function"""
+ """list index is a function."""
return TESTLIST[id] # [invalid-sequence-index]
def function2():
- """list index is None"""
+ """list index is None."""
return TESTLIST[None] # [invalid-sequence-index]
def function3():
- """list index is a float expression"""
+ """list index is a float expression."""
return TESTLIST[float(0)] # [invalid-sequence-index]
def function4():
- """list index is a str constant"""
+ """list index is a str constant."""
return TESTLIST['0'] # [invalid-sequence-index]
def function5():
"""list index does not implement __index__"""
class NonIndexType(object):
- """Class without __index__ method"""
+ """Class without __index__ method."""
pass
return TESTLIST[NonIndexType()] # [invalid-sequence-index]
def function6():
- """Tuple index is None"""
+ """Tuple index is None."""
return TESTTUPLE[None] # [invalid-sequence-index]
def function7():
- """String index is None"""
+ """String index is None."""
return TESTSTR[None] # [invalid-sequence-index]
def function8():
- """Index of subclass of tuple is None"""
+ """Index of subclass of tuple is None."""
class TupleTest(tuple):
- """Subclass of tuple"""
+ """Subclass of tuple."""
pass
return TupleTest()[None] # [invalid-sequence-index]
# getitem tests with good indices
def function9():
- """list index is an int constant"""
+ """list index is an int constant."""
return TESTLIST[0] # no error
def function10():
- """list index is an integer expression"""
+ """list index is an integer expression."""
return TESTLIST[int(0.0)] # no error
def function11():
- """list index is a slice"""
+ """list index is a slice."""
return TESTLIST[slice(1, 2, 3)] # no error
def function12():
"""list index implements __index__"""
class IndexType(object):
- """Class with __index__ method"""
+ """Class with __index__ method."""
def __index__(self):
- """Allow objects of this class to be used as slice indices"""
+ """Allow objects of this class to be used as slice indices."""
return 0
return TESTLIST[IndexType()] # no error
def function13():
- """list index implements __index__ in a superclass"""
+ """list index implements __index__ in a superclass."""
class IndexType(object):
- """Class with __index__ method"""
+ """Class with __index__ method."""
def __index__(self):
- """Allow objects of this class to be used as slice indices"""
+ """Allow objects of this class to be used as slice indices."""
return 0
class IndexSubType(IndexType):
- """Class with __index__ in parent"""
+ """Class with __index__ in parent."""
pass
return TESTLIST[IndexSubType()] # no error
def function14():
- """Tuple index is an int constant"""
+ """Tuple index is an int constant."""
return TESTTUPLE[0]
def function15():
- """String index is an int constant"""
+ """String index is an int constant."""
return TESTSTR[0]
def function16():
- """Index of subclass of tuple is an int constant"""
+ """Index of subclass of tuple is an int constant."""
class TupleTest(tuple):
- """Subclass of tuple"""
+ """Subclass of tuple."""
pass
return TupleTest()[0] # no error
def function17():
- """Index of subclass of tuple with custom __getitem__ is None"""
+ """Index of subclass of tuple with custom __getitem__ is None."""
class TupleTest(tuple):
"""Subclass of tuple with custom __getitem__"""
def __getitem__(self, index):
- """Allow non-integer indices"""
+ """Allow non-integer indices."""
return 0
return TupleTest()[None] # no error
def function18():
- """Index of subclass of tuple with __getitem__ in superclass is None"""
+ """Index of subclass of tuple with __getitem__ in superclass is None."""
class TupleTest(tuple):
"""Subclass of tuple with custom __getitem__"""
def __getitem__(self, index):
- """Allow non-integer indices"""
+ """Allow non-integer indices."""
return 0
class SubTupleTest(TupleTest):
- """Subclass of a subclass of tuple"""
+ """Subclass of a subclass of tuple."""
pass
return SubTupleTest()[None] # no error
# Test with set and delete statements
def function19():
- """Set with None and integer indices"""
+ """Set with None and integer indices."""
TESTLIST[None] = 0 # [invalid-sequence-index]
TESTLIST[0] = 0 # no error
def function20():
- """Delete with None and integer indices"""
+ """Delete with None and integer indices."""
del TESTLIST[None] # [invalid-sequence-index]
del TESTLIST[0] # no error
def function21():
- """Set and delete on a subclass of list"""
+ """Set and delete on a subclass of list."""
class ListTest(list):
- """Inherit all list get/set/del handlers"""
+ """Inherit all list get/set/del handlers."""
pass
test = ListTest()
@@ -151,7 +151,7 @@ def function21():
def function22():
"""Get, set, and delete on a subclass of list that overrides __setitem__"""
class ListTest(list):
- """Override setitem but not get or del"""
+ """Override setitem but not get or del."""
def __setitem__(self, key, value):
pass
test = ListTest()
@@ -169,7 +169,7 @@ def function22():
def function23():
"""Get, set, and delete on a subclass of list that overrides __delitem__"""
class ListTest(list):
- """Override delitem but not get or set"""
+ """Override delitem but not get or set."""
def __delitem__(self, key):
pass
test = ListTest()
@@ -187,7 +187,7 @@ def function23():
def function24():
"""Get, set, and delete on a subclass of list that overrides __getitem__"""
class ListTest(list):
- """Override gelitem but not del or set"""
+ """Override gelitem but not del or set."""
def __getitem__(self, key):
pass
test = ListTest()
@@ -204,7 +204,7 @@ def function24():
# Teest ExtSlice usage
def function25():
- """Extended slice used with a list"""
+ """Extended slice used with a list."""
return TESTLIST[..., 0] # [invalid-sequence-index]
def function26():
diff --git a/tests/functional/i/invalid/s/invalid_slice_index.py b/tests/functional/i/invalid/s/invalid_slice_index.py
index 1eb2fda9c..2cabd6cc9 100644
--- a/tests/functional/i/invalid/s/invalid_slice_index.py
+++ b/tests/functional/i/invalid/s/invalid_slice_index.py
@@ -1,4 +1,4 @@
-"""Errors for invalid slice indices"""
+"""Errors for invalid slice indices."""
# pylint: disable=too-few-public-methods, no-self-use,missing-docstring,expression-not-assigned, useless-object-inheritance, unnecessary-pass
@@ -6,62 +6,62 @@ TESTLIST = [1, 2, 3]
# Invalid indices
def function1():
- """functions used as indices"""
+ """functions used as indices."""
return TESTLIST[id:id:] # [invalid-slice-index,invalid-slice-index]
def function2():
- """strings used as indices"""
+ """strings used as indices."""
return TESTLIST['0':'1':] # [invalid-slice-index,invalid-slice-index]
def function3():
- """class without __index__ used as index"""
+ """class without __index__ used as index."""
class NoIndexTest(object):
- """Class with no __index__ method"""
+ """Class with no __index__ method."""
pass
return TESTLIST[NoIndexTest()::] # [invalid-slice-index]
# Valid indices
def function4():
- """integers used as indices"""
+ """integers used as indices."""
return TESTLIST[0:0:0] # no error
def function5():
- """None used as indices"""
+ """None used as indices."""
return TESTLIST[None:None:None] # no error
def function6():
- """class with __index__ used as index"""
+ """class with __index__ used as index."""
class IndexTest(object):
- """Class with __index__ method"""
+ """Class with __index__ method."""
def __index__(self):
- """Allow objects of this class to be used as slice indices"""
+ """Allow objects of this class to be used as slice indices."""
return 0
return TESTLIST[IndexTest():None:None] # no error
def function7():
- """class with __index__ in superclass used as index"""
+ """class with __index__ in superclass used as index."""
class IndexType(object):
- """Class with __index__ method"""
+ """Class with __index__ method."""
def __index__(self):
- """Allow objects of this class to be used as slice indices"""
+ """Allow objects of this class to be used as slice indices."""
return 0
class IndexSubType(IndexType):
- """Class with __index__ in parent"""
+ """Class with __index__ in parent."""
pass
return TESTLIST[IndexSubType():None:None] # no error
def function8():
- """slice object used as index"""
+ """slice object used as index."""
return TESTLIST[slice(1, 2, 3)] # no error
def function9():
- """Use a custom class that knows how to handle string slices"""
+ """Use a custom class that knows how to handle string slices."""
class StringSlice:
def __getitem__(self, item):
return item
diff --git a/tests/functional/i/invalid/s/invalid_str_returned.py b/tests/functional/i/invalid/s/invalid_str_returned.py
index 00ef22046..d5b3f21af 100644
--- a/tests/functional/i/invalid/s/invalid_str_returned.py
+++ b/tests/functional/i/invalid/s/invalid_str_returned.py
@@ -1,4 +1,4 @@
-"""Check invalid value returned by __str__ """
+"""Check invalid value returned by __str__"""
# pylint: disable=too-few-public-methods,missing-docstring,no-self-use,import-error, useless-object-inheritance
import six
@@ -31,34 +31,34 @@ class ThirdGoodStr(object):
class FirstBadStr(object):
- """ __str__ returns bytes """
+ """__str__ returns bytes."""
def __str__(self): # [invalid-str-returned]
return b"123"
class SecondBadStr(object):
- """ __str__ returns int """
+ """__str__ returns int."""
def __str__(self): # [invalid-str-returned]
return 1
class ThirdBadStr(object):
- """ __str__ returns node which does not have 'value' in AST """
+ """__str__ returns node which does not have 'value' in AST."""
def __str__(self): # [invalid-str-returned]
return lambda: "some str"
class AmbiguousStr(object):
- """ Uninferable return value """
+ """Uninferable return value."""
__str__ = lambda self: Missing
class AnotherAmbiguousStr(object):
- """Potential uninferable return value"""
+ """Potential uninferable return value."""
def __str__(self):
return str(Missing)
diff --git a/tests/functional/i/iterable_context.py b/tests/functional/i/iterable_context.py
index 2754d179f..33c713bfb 100644
--- a/tests/functional/i/iterable_context.py
+++ b/tests/functional/i/iterable_context.py
@@ -1,7 +1,4 @@
-"""
-Checks that primitive values are not used in an
-iterating/mapping context.
-"""
+"""Checks that primitive values are not used in an iterating/mapping context."""
# pylint: disable=missing-docstring,invalid-name,too-few-public-methods,no-init,no-self-use,import-error,unused-argument,bad-mcs-method-argument,wrong-import-position,no-else-return, useless-object-inheritance, unnecessary-comprehension,redundant-u-string-prefix
from __future__ import print_function
@@ -73,7 +70,7 @@ class B(object):
return 1
class C(object):
- "old-style iterator"
+ """old-style iterator."""
def __getitem__(self, k):
if k > 10:
raise IndexError
diff --git a/tests/functional/i/iterable_context_py3.py b/tests/functional/i/iterable_context_py3.py
index 34047eda0..35b8357b3 100644
--- a/tests/functional/i/iterable_context_py3.py
+++ b/tests/functional/i/iterable_context_py3.py
@@ -1,6 +1,4 @@
-"""
-Checks that iterable metaclasses are recognized by pylint.
-"""
+"""Checks that iterable metaclasses are recognized by pylint."""
# pylint: disable=missing-docstring,too-few-public-methods,no-init,no-self-use,unused-argument,bad-mcs-method-argument
# pylint: disable=wrong-import-position
# metaclasses as iterables
diff --git a/tests/functional/i/iterable_context_py36.py b/tests/functional/i/iterable_context_py36.py
index d50d3da98..78d6cda4a 100644
--- a/tests/functional/i/iterable_context_py36.py
+++ b/tests/functional/i/iterable_context_py36.py
@@ -16,14 +16,14 @@ class AIter:
async def some_iter_func(number):
- """ emits 1 number per second """
+ """emits 1 number per second."""
for i in range(1, number):
yield i
await asyncio.sleep(1)
async def count_to(number):
- """ counts to n in async manner"""
+ """counts to n in async manner."""
async for i in some_iter_func(number):
print(i)
diff --git a/tests/functional/k/keyword_arg_before_vararg.py b/tests/functional/k/keyword_arg_before_vararg.py
index 119287410..acd6f9e17 100644
--- a/tests/functional/k/keyword_arg_before_vararg.py
+++ b/tests/functional/k/keyword_arg_before_vararg.py
@@ -3,26 +3,26 @@ from __future__ import absolute_import, print_function
# pylint: disable=unused-argument, useless-object-inheritance, unnecessary-pass
def check_kwargs_before_args(param1, param2=2, *args): # [keyword-arg-before-vararg]
- """docstring"""
+ """docstring."""
pass
check_kwargs_before_args(5)
# pylint: disable=too-few-public-methods, invalid-name
class AAAA(object):
- """class AAAA"""
+ """class AAAA."""
def func_in_class(self, param1, param2=2, *args): # [keyword-arg-before-vararg]
- "method in class AAAA"
+ """method in class AAAA."""
pass
@staticmethod
def static_method_in_class(param1, param2=3, *args): # [keyword-arg-before-vararg]
- "static method in class AAAA"
+ """static method in class AAAA."""
pass
@classmethod
def class_method_in_class(cls, param1, param2=4, *args): # [keyword-arg-before-vararg]
- "class method in class AAAA"
+ """class method in class AAAA."""
pass
some_var = AAAA()
diff --git a/tests/functional/l/lambda_use_before_assign.py b/tests/functional/l/lambda_use_before_assign.py
index af2775cae..ae0d2360b 100644
--- a/tests/functional/l/lambda_use_before_assign.py
+++ b/tests/functional/l/lambda_use_before_assign.py
@@ -1,8 +1,8 @@
-"""https://www.logilab.net/elo/ticket/18862"""
+"""https://www.logilab.net/elo/ticket/18862."""
from __future__ import print_function
__revision__ = 1
def function():
- """hop"""
+ """hop."""
ggg = lambda: xxx
xxx = 1
print(ggg())
diff --git a/tests/functional/l/line_endings.py b/tests/functional/l/line_endings.py
index 0b6e795e3..4f4b071d6 100644
--- a/tests/functional/l/line_endings.py
+++ b/tests/functional/l/line_endings.py
@@ -1,3 +1,3 @@
-"mixing line endings are not welcome"
+"""mixing line endings are not welcome."""
# +1: [unexpected-line-ending-format, mixed-line-endings]
-CONST = 1
+CONST = 1
diff --git a/tests/functional/l/line_too_long.py b/tests/functional/l/line_too_long.py
index 1be460375..161c94968 100644
--- a/tests/functional/l/line_too_long.py
+++ b/tests/functional/l/line_too_long.py
@@ -2,7 +2,8 @@
# +1: [line-too-long]
#####################################################################################################
# +1: [line-too-long]
-""" that one is too long tooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo loooooong"""
+"""that one is too long
+tooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo loooooong."""
# The next line is exactly 80 characters long.
A = "--------------------------------------------------------------------------"
@@ -31,26 +32,28 @@ def function():
# +3: [line-too-long]
"""This is a docstring.
- That contains a very, very long line that exceeds the 100 characters limit by a good margin. So good?
+ That contains a very, very long line that exceeds the 100 characters limit by a good
+ margin. So good?
"""
pass
# Don't crash when the line is in a docstring
def func_with_long(parameter):
- """
- # pylint: disable=line-too-long
- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccccccccccccccccccccccccccccccccc
- """
+ """# pylint: disable=line-too-long aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+ bbbbbbbbbbbbbbbbbbbbbbbbbbbbccccccccccccccccccccccccccccccccccccccccccccccc
+ ccccc."""
return parameter
# No line-too-long message should be emitted as the disable comment stands for all the multiline
def issue_2957():
- """
- This is a very very very long line within a docstring that should trigger a pylint C0301 error line-too-long
+ """This is a very very very long line within a docstring that should trigger a
+ pylint C0301 error line-too-long.
- Even spread on multiple lines, the disable command is still effective on very very very, maybe too much long docstring
+ Even spread on multiple lines, the disable command is still effective on very very
+ very, maybe too much long docstring
"""#pylint: disable=line-too-long
return True
@@ -58,10 +61,11 @@ def issue_2957():
def issue_2957_bis():
# +3: [line-too-long]
# +4: [line-too-long]
- """
- This is a very very very long line within a docstring that should trigger a pylint C0301 error line-too-long
+ """This is a very very very long line within a docstring that should trigger a
+ pylint C0301 error line-too-long.
- Even spread on multiple lines, the disable command is still effective on very very very, maybe too much long docstring
+ Even spread on multiple lines, the disable command is still effective on very very
+ very, maybe too much long docstring
"""
return True
diff --git a/tests/functional/l/logging_format_interpolation_py36.py b/tests/functional/l/logging_format_interpolation_py36.py
index 2601c5bfc..3c88fb0f2 100644
--- a/tests/functional/l/logging_format_interpolation_py36.py
+++ b/tests/functional/l/logging_format_interpolation_py36.py
@@ -1,4 +1,4 @@
-"""Test logging-fstring-interpolation for Python 3.6"""
+"""Test logging-fstring-interpolation for Python 3.6."""
import logging as renamed_logging
diff --git a/tests/functional/l/logging_format_interpolation_style.py b/tests/functional/l/logging_format_interpolation_style.py
index f568de5fd..3e8ed1062 100644
--- a/tests/functional/l/logging_format_interpolation_style.py
+++ b/tests/functional/l/logging_format_interpolation_style.py
@@ -1,4 +1,4 @@
-"""Tests for logging-format-interpolation with logging-format-style=new"""
+"""Tests for logging-format-interpolation with logging-format-style=new."""
import logging
diff --git a/tests/functional/l/logging_fstring_interpolation_py36.py b/tests/functional/l/logging_fstring_interpolation_py36.py
index 5aebb7dd2..815595dbf 100644
--- a/tests/functional/l/logging_fstring_interpolation_py36.py
+++ b/tests/functional/l/logging_fstring_interpolation_py36.py
@@ -1,4 +1,4 @@
-"""Test logging-fstring-interpolation for Python 3.6"""
+"""Test logging-fstring-interpolation for Python 3.6."""
# pylint: disable=invalid-name
from datetime import datetime
diff --git a/tests/functional/l/logging_fstring_interpolation_py37.py b/tests/functional/l/logging_fstring_interpolation_py37.py
index 963b2ce8c..f304739f4 100644
--- a/tests/functional/l/logging_fstring_interpolation_py37.py
+++ b/tests/functional/l/logging_fstring_interpolation_py37.py
@@ -1,4 +1,4 @@
-"""Tests for logging-fstring-interpolation with f-strings"""
+"""Tests for logging-fstring-interpolation with f-strings."""
import logging
VAR = "string"
diff --git a/tests/functional/l/logging_not_lazy.py b/tests/functional/l/logging_not_lazy.py
index ab1ce008c..d41f534cc 100644
--- a/tests/functional/l/logging_not_lazy.py
+++ b/tests/functional/l/logging_not_lazy.py
@@ -1,4 +1,4 @@
-"""Tests for logging-not-lazy"""
+"""Tests for logging-not-lazy."""
# pylint: disable=missing-docstring,no-member,deprecated-method,invalid-name, consider-using-f-string
# Muck up the names in an effort to confuse...
diff --git a/tests/functional/l/logging_too_few_args.py b/tests/functional/l/logging_too_few_args.py
index fc0061986..6fc6a5117 100644
--- a/tests/functional/l/logging_too_few_args.py
+++ b/tests/functional/l/logging_too_few_args.py
@@ -1,4 +1,4 @@
-"""Tests for logging-too-few-args"""
+"""Tests for logging-too-few-args."""
import logging
diff --git a/tests/functional/l/logging_too_many_args.py b/tests/functional/l/logging_too_many_args.py
index 3aff250f7..acd7b72d0 100644
--- a/tests/functional/l/logging_too_many_args.py
+++ b/tests/functional/l/logging_too_many_args.py
@@ -1,4 +1,4 @@
-"""Tests for logging-too-many-args"""
+"""Tests for logging-too-many-args."""
import logging
logging.error("constant string", 1, 2) # [logging-too-many-args]
diff --git a/tests/functional/l/long_utf8_lines.py b/tests/functional/l/long_utf8_lines.py
index 138e4e299..21550c2e7 100644
--- a/tests/functional/l/long_utf8_lines.py
+++ b/tests/functional/l/long_utf8_lines.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-"""this utf-8 doc string have some non ASCII characters like 'é', or '¢»ß'"""
+"""this utf-8 doc string have some non ASCII characters like 'é', or '¢»ß'."""
### check also comments with some more non ASCII characters like 'é' or '¢»ß'
__revision__ = 1100
diff --git a/tests/functional/m/mapping_context.py b/tests/functional/m/mapping_context.py
index 6b3a13573..3b2a16cc1 100644
--- a/tests/functional/m/mapping_context.py
+++ b/tests/functional/m/mapping_context.py
@@ -1,6 +1,4 @@
-"""
-Checks that only valid values are used in a mapping context.
-"""
+"""Checks that only valid values are used in a mapping context."""
# pylint: disable=missing-docstring,invalid-name,too-few-public-methods,no-self-use,import-error,wrong-import-position, useless-object-inheritance
from __future__ import print_function
diff --git a/tests/functional/m/member/member_checks.py b/tests/functional/m/member/member_checks.py
index c1b6a22fb..5b2f772e1 100644
--- a/tests/functional/m/member/member_checks.py
+++ b/tests/functional/m/member/member_checks.py
@@ -2,20 +2,20 @@
# pylint: disable=using-constant-test,expression-not-assigned, assigning-non-slot, unused-variable,pointless-statement, wrong-import-order, wrong-import-position,import-outside-toplevel
from __future__ import print_function
class Provider(object):
- """provide some attributes and method"""
+ """provide some attributes and method."""
cattr = 4
def __init__(self):
self.attr = 4
def method(self, val):
- """impressive method"""
+ """impressive method."""
return self.attr * val
def hophop(self):
- """hop method"""
+ """hop method."""
print('hop hop hop', self)
class Client(object):
- """use provider class"""
+ """use provider class."""
def __init__(self):
self._prov = Provider()
@@ -28,24 +28,24 @@ class Client(object):
self.set_later = value
def use_method(self):
- """use provider's method"""
+ """use provider's method."""
self._prov.hophop()
self._prov.hophophop() # [no-member]
def use_attr(self):
- """use provider's attr"""
+ """use provider's attr."""
print(self._prov.attr)
print(self._prov.attribute) # [no-member]
def debug(self):
- """print debug information"""
+ """print debug information."""
print(self.__class__.__name__)
print(self.__doc__)
print(self.__dict__)
print(self.__module__)
def test_bt_types(self):
- """test access to unexistant member of builtin types"""
+ """test access to unexistant member of builtin types."""
lis = []
lis.apppend(self) # [no-member]
dic = {}
@@ -136,8 +136,7 @@ type('').portocala # [no-member]
def socket_false_positive():
- """Test a regression
- Version used:
+ """Test a regression Version used:
- Pylint 0.10.0
- Logilab common 0.15.0
@@ -154,7 +153,7 @@ def socket_false_positive():
def no_conjugate_member(magic_flag):
- """should not raise E1101 on something.conjugate"""
+ """should not raise E1101 on something.conjugate."""
if magic_flag:
something = 1.0
else:
diff --git a/tests/functional/m/metaclass_attr_access.py b/tests/functional/m/metaclass_attr_access.py
index 50f9712fa..084eb074b 100644
--- a/tests/functional/m/metaclass_attr_access.py
+++ b/tests/functional/m/metaclass_attr_access.py
@@ -1,11 +1,11 @@
# pylint: disable=too-few-public-methods, useless-object-inheritance
-"""test attribute access on metaclass"""
+"""test attribute access on metaclass."""
from __future__ import print_function
class Meta(type):
- """the meta class"""
+ """the meta class."""
def __init__(cls, name, bases, dictionary):
super(Meta, cls).__init__(name, bases, dictionary)
print(cls, cls._meta_args)
@@ -13,7 +13,7 @@ class Meta(type):
class Test(object):
- """metaclassed class"""
+ """metaclassed class."""
__metaclass__ = Meta
_meta_args = ('foo', 'bar')
diff --git a/tests/functional/m/method_hidden.py b/tests/functional/m/method_hidden.py
index e31bc16c4..a6742e5ca 100644
--- a/tests/functional/m/method_hidden.py
+++ b/tests/functional/m/method_hidden.py
@@ -1,22 +1,21 @@
# pylint: disable=too-few-public-methods, useless-object-inheritance,missing-docstring
# pylint: disable=unused-private-member
-"""check method hiding ancestor attribute
-"""
+"""check method hiding ancestor attribute."""
from __future__ import print_function
class Abcd(object):
- """dummy"""
+ """dummy."""
def __init__(self):
self.abcd = 1
class Cdef(Abcd):
- """dummy"""
+ """dummy."""
def abcd(self): # [method-hidden]
- """test"""
+ """test."""
print(self)
@@ -31,7 +30,7 @@ class Dabc(AbcdMixin, Abcd):
class CustomProperty:
- """dummy"""
+ """dummy."""
def __init__(self, _):
pass
@@ -46,7 +45,7 @@ class CustomProperty:
class Ddef:
- """dummy"""
+ """dummy."""
def __init__(self):
self.five = "five"
diff --git a/tests/functional/m/misplaced_format_function.py b/tests/functional/m/misplaced_format_function.py
index 679f59858..b43f81708 100644
--- a/tests/functional/m/misplaced_format_function.py
+++ b/tests/functional/m/misplaced_format_function.py
@@ -14,27 +14,27 @@ a = 'value: {}'
a.format(123)
def foo(arg):
- """The World is Yours"""
+ """The World is Yours."""
return arg.format(123) # we don't know if arg is str or not, don't raise error.
def goo(arg):
- """The World is Yours"""
+ """The World is Yours."""
TextWriter.format(arg)
def bar(arg, TextWriter):
- """The World is Yours"""
+ """The World is Yours."""
TextWriter().format(arg)
def foobar(arg, TextWriter):
- """The World is Yours"""
+ """The World is Yours."""
TextWriter.format(arg)
def barfoo(arg):
- """The World is Yours"""
+ """The World is Yours."""
TextWriter().format(arg)
def _display(self, layout):
- """launch layouts display"""
+ """launch layouts display."""
print(file=self.out)
TextWriter().format(layout, self.out)
diff --git a/tests/functional/m/missing/missing_class_docstring.py b/tests/functional/m/missing/missing_class_docstring.py
index 3c440411a..0ef8987a8 100644
--- a/tests/functional/m/missing/missing_class_docstring.py
+++ b/tests/functional/m/missing/missing_class_docstring.py
@@ -1,4 +1,4 @@
-"""Tests for missing-class-docstring"""
+"""Tests for missing-class-docstring."""
# pylint: disable=too-few-public-methods
diff --git a/tests/functional/m/missing/missing_function_docstring.py b/tests/functional/m/missing/missing_function_docstring.py
index f5361187d..5b7f118eb 100644
--- a/tests/functional/m/missing/missing_function_docstring.py
+++ b/tests/functional/m/missing/missing_function_docstring.py
@@ -1,4 +1,4 @@
-"""Tests for missing-function-docstring"""
+"""Tests for missing-function-docstring."""
# pylint: disable=unused-argument, missing-class-docstring, too-few-public-methods, unused-variable
@@ -7,7 +7,7 @@ def func(tion): # [missing-function-docstring]
def func_two(tion):
- """Documented"""
+ """Documented."""
def inner(fun):
# Not documented
diff --git a/tests/functional/m/missing/missing_function_docstring_min_length.py b/tests/functional/m/missing/missing_function_docstring_min_length.py
index 88370c0cf..606da6d39 100644
--- a/tests/functional/m/missing/missing_function_docstring_min_length.py
+++ b/tests/functional/m/missing/missing_function_docstring_min_length.py
@@ -1,4 +1,4 @@
-"""Tests for missing-function-docstring and the min-length option"""
+"""Tests for missing-function-docstring and the min-length option."""
# pylint: disable=unused-argument, unnecessary-pass, bare-except
diff --git a/tests/functional/m/missing/missing_function_docstring_rgx.py b/tests/functional/m/missing/missing_function_docstring_rgx.py
index 3c910d1a9..0d0a5c9c2 100644
--- a/tests/functional/m/missing/missing_function_docstring_rgx.py
+++ b/tests/functional/m/missing/missing_function_docstring_rgx.py
@@ -1,4 +1,4 @@
-"""Tests for missing-function-docstring and the no-docstring-rgx option"""
+"""Tests for missing-function-docstring and the no-docstring-rgx option."""
# pylint: disable=unused-argument, missing-class-docstring, too-few-public-methods
diff --git a/tests/functional/m/missing/missing_module_docstring_disabled.py b/tests/functional/m/missing/missing_module_docstring_disabled.py
index d4d9edf3f..ca955476e 100644
--- a/tests/functional/m/missing/missing_module_docstring_disabled.py
+++ b/tests/functional/m/missing/missing_module_docstring_disabled.py
@@ -2,4 +2,4 @@
class Documented:
- "Something."
+ """Something."""
diff --git a/tests/functional/m/mixin_class_rgx.py b/tests/functional/m/mixin_class_rgx.py
index 1f6ea21e6..c736e0f08 100644
--- a/tests/functional/m/mixin_class_rgx.py
+++ b/tests/functional/m/mixin_class_rgx.py
@@ -1,4 +1,4 @@
-"""Tests for the mixin-class-rgx option"""
+"""Tests for the mixin-class-rgx option."""
# pylint: disable=too-few-public-methods
@@ -6,21 +6,21 @@
class AsyncManagerMixedin:
- """Class that does not match the option pattern"""
+ """Class that does not match the option pattern."""
def __aenter__(self):
pass
class AsyncManagerMixin:
- """Class that does match the option pattern"""
+ """Class that does match the option pattern."""
def __aenter__(self):
pass
async def check_not_async_context_manager():
- """Function calling the classes for not-async-context-manager"""
+ """Function calling the classes for not-async-context-manager."""
async with AsyncManagerMixedin: # [not-async-context-manager]
pass
async with AsyncManagerMixin():
@@ -31,7 +31,7 @@ async def check_not_async_context_manager():
class OutsideInitMixedin:
- """Class that does not match the option pattern"""
+ """Class that does not match the option pattern."""
def set_attribute(self):
"""Set an attribute outside of __init__"""
@@ -39,7 +39,7 @@ class OutsideInitMixedin:
class OutsideInitMixin:
- """Class that does match the option pattern"""
+ """Class that does match the option pattern."""
def set_attribute(self):
"""Set an attribute outside of __init__"""
@@ -50,11 +50,11 @@ class OutsideInitMixin:
class NoMemberMixedin:
- """Class that does not match the option pattern"""
+ """Class that does not match the option pattern."""
MY_CLASS = OutsideInitMixedin().method() # [no-member]
class NoMemberMixin:
- """Class that does match the option pattern"""
+ """Class that does match the option pattern."""
MY_OTHER_CLASS = NoMemberMixin().method()
diff --git a/tests/functional/m/monkeypatch_method.py b/tests/functional/m/monkeypatch_method.py
index e8bd03aa7..16ffedac6 100644
--- a/tests/functional/m/monkeypatch_method.py
+++ b/tests/functional/m/monkeypatch_method.py
@@ -1,14 +1,14 @@
# pylint: disable=missing-docstring,too-few-public-methods, useless-object-inheritance
-'''Test that a function is considered a method when looked up through a class.'''
+"""Test that a function is considered a method when looked up through a class."""
class Clazz(object):
- 'test class'
+ """test class."""
def __init__(self, value):
self.value = value
def func(arg1, arg2):
- 'function that will be used as a method'
+ """function that will be used as a method."""
return arg1.value + arg2
Clazz.method = func
diff --git a/tests/functional/m/multiple_statements.py b/tests/functional/m/multiple_statements.py
index 5b55eac42..575d041e0 100644
--- a/tests/functional/m/multiple_statements.py
+++ b/tests/functional/m/multiple_statements.py
@@ -1,4 +1,4 @@
-"""Tests for multiple-statements"""
+"""Tests for multiple-statements."""
# pylint: disable=using-constant-test, missing-class-docstring, missing-function-docstring, bare-except
# pylint: disable=unused-argument, function-redefined
diff --git a/tests/functional/n/name/name_final.py b/tests/functional/n/name/name_final.py
index 60b92ce18..ed54664a3 100644
--- a/tests/functional/n/name/name_final.py
+++ b/tests/functional/n/name/name_final.py
@@ -1,5 +1,5 @@
# pylint: disable=missing-docstring,too-few-public-methods
-"""Test typing.Final"""
+"""Test typing.Final."""
import typing
from typing import Final
diff --git a/tests/functional/n/name/name_styles.py b/tests/functional/n/name/name_styles.py
index 27e6e1044..a0b0f4420 100644
--- a/tests/functional/n/name/name_styles.py
+++ b/tests/functional/n/name/name_styles.py
@@ -102,9 +102,8 @@ def test_globals():
class FooClass(object):
"""A test case for property names.
- Since by default, the regex for attributes is the same as the one
- for method names, we check the warning messages to contain the
- string 'attribute'.
+ Since by default, the regex for attributes is the same as the one for method names,
+ we check the warning messages to contain the string 'attribute'.
"""
@property
def PROPERTY_NAME(self): # [invalid-name]
@@ -123,18 +122,18 @@ class FooClass(object):
pass
def _nice_and_long_descriptive_private_method_name(self):
- """private method with long name"""
+ """private method with long name."""
pass
def good_public_function_name(good_arg_name):
- """This is a perfect public function"""
+ """This is a perfect public function."""
good_variable_name = 1
return good_variable_name + good_arg_name
def _private_scope_function_with_long_descriptive_name():
- """Private scope function are cool with long descriptive names"""
+ """Private scope function are cool with long descriptive names."""
return 12
LONG_CONSTANT_NAME_IN_PUBLIC_SCOPE_ARE_OKAY = True
@@ -143,7 +142,7 @@ good_name_for_funcs = lambda: None
good_name_for_lists = [1, 2, 3]
class _AnExceptionalExceptionThatOccursVeryVeryRarely(Exception):
- """A very exceptional exception with a nice descriptive name"""
+ """A very exceptional exception with a nice descriptive name."""
pass
class FooEnum(Enum):
diff --git a/tests/functional/n/name/names_in__all__.py b/tests/functional/n/name/names_in__all__.py
index c5d17cd80..1f9283edb 100644
--- a/tests/functional/n/name/names_in__all__.py
+++ b/tests/functional/n/name/names_in__all__.py
@@ -31,19 +31,18 @@ class Dummy(object):
DUMMY = Dummy()
def function():
- """Function docstring
- """
+ """Function docstring."""
pass
function()
class Klass(object):
- """A klass which contains a function"""
+ """A klass which contains a function."""
def func(self):
- """A klass method"""
+ """A klass method."""
inner = None
print(inner)
class InnerKlass(object):
- """An inner klass"""
+ """An inner klass."""
pass
diff --git a/tests/functional/n/nested_func_defined_in_loop.py b/tests/functional/n/nested_func_defined_in_loop.py
index 39d2889a4..f655af1e7 100644
--- a/tests/functional/n/nested_func_defined_in_loop.py
+++ b/tests/functional/n/nested_func_defined_in_loop.py
@@ -1,7 +1,7 @@
"""Check a nested function defined in a loop."""
def example(args):
- """The check"""
+ """The check."""
for i in args:
def nested():
print(i) # [cell-var-from-loop]
diff --git a/tests/functional/n/new_style_class_py_30.py b/tests/functional/n/new_style_class_py_30.py
index b70c6e097..82aaaaf66 100644
--- a/tests/functional/n/new_style_class_py_30.py
+++ b/tests/functional/n/new_style_class_py_30.py
@@ -1,4 +1,5 @@
-"""check builtin data descriptors such as mode and name attributes on a file are correctly handled
+"""check builtin data descriptors such as mode and name attributes on a file are
+correctly handled.
bug notified by Pierre Rouleau on 2005-04-24
"""
@@ -7,9 +8,9 @@ __revision__ = None
class File(file): # pylint: disable=undefined-variable
- """ Testing new-style class inheritance from file"""
+ """Testing new-style class inheritance from file."""
def __init__(self, name, mode="r", buffering=-1, verbose=False):
- """Constructor"""
+ """Constructor."""
self.was_modified = False
self.verbose = verbose
super(File, self).__init__(name, mode, buffering) # [super-with-arguments]
@@ -17,12 +18,12 @@ class File(file): # pylint: disable=undefined-variable
print(f"File {self.name} is opened. The mode is: {self.mode}")
def write(self, a_string):
- """ Write a string to the file."""
+ """Write a string to the file."""
super(File, self).write(a_string) # [super-with-arguments]
self.was_modified = True
def writelines(self, sequence):
- """ Write a sequence of strings to the file. """
+ """Write a sequence of strings to the file."""
super(File, self).writelines(sequence) # [super-with-arguments]
self.was_modified = True
diff --git a/tests/functional/n/no/no_classmethod_decorator.py b/tests/functional/n/no/no_classmethod_decorator.py
index 66cc0b3c0..6972b4a34 100644
--- a/tests/functional/n/no/no_classmethod_decorator.py
+++ b/tests/functional/n/no/no_classmethod_decorator.py
@@ -1,16 +1,15 @@
-"""Checks class methods are declared with a decorator if within the class
-scope and if classmethod's argument is a member of the class
-"""
+"""Checks class methods are declared with a decorator if within the class scope and if
+classmethod's argument is a member of the class."""
# pylint: disable=too-few-public-methods, using-constant-test, no-self-argument, useless-object-inheritance
class MyClass(object):
- """Some class"""
+ """Some class."""
def __init__(self):
pass
def cmethod(cls):
- """class method-to-be"""
+ """class method-to-be."""
cmethod = classmethod(cmethod) # [no-classmethod-decorator]
if True:
@@ -18,18 +17,18 @@ class MyClass(object):
@classmethod
def my_second_method(cls):
- """correct class method definition"""
+ """correct class method definition."""
def other_method(cls):
- """some method"""
+ """some method."""
cmethod2 = classmethod(other_method) # [no-classmethod-decorator]
def helloworld():
- """says hello"""
+ """says hello."""
MyClass.new_class_method = classmethod(helloworld)
class MyOtherClass(object):
- """Some other class"""
+ """Some other class."""
_make = classmethod(tuple.__new__)
diff --git a/tests/functional/n/no/no_else_break.py b/tests/functional/n/no/no_else_break.py
index cf23f313a..5d5b66c66 100644
--- a/tests/functional/n/no/no_else_break.py
+++ b/tests/functional/n/no/no_else_break.py
@@ -1,4 +1,4 @@
-""" Test that superfluous else return are detected. """
+"""Test that superfluous else return are detected."""
# pylint:disable=invalid-name,missing-docstring,unused-variable
diff --git a/tests/functional/n/no/no_else_continue.py b/tests/functional/n/no/no_else_continue.py
index 37f70f121..58c2d40af 100644
--- a/tests/functional/n/no/no_else_continue.py
+++ b/tests/functional/n/no/no_else_continue.py
@@ -1,4 +1,4 @@
-""" Test that superfluous else return are detected. """
+"""Test that superfluous else return are detected."""
# pylint:disable=invalid-name,missing-docstring,unused-variable
diff --git a/tests/functional/n/no/no_else_raise.py b/tests/functional/n/no/no_else_raise.py
index ae807fae3..fcc8c720f 100644
--- a/tests/functional/n/no/no_else_raise.py
+++ b/tests/functional/n/no/no_else_raise.py
@@ -1,4 +1,4 @@
-""" Test that superfluous else return are detected. """
+"""Test that superfluous else return are detected."""
# pylint:disable=invalid-name,missing-docstring,unused-variable,raise-missing-from
diff --git a/tests/functional/n/no/no_else_return.py b/tests/functional/n/no/no_else_return.py
index 0a87551fa..5dbec96f1 100644
--- a/tests/functional/n/no/no_else_return.py
+++ b/tests/functional/n/no/no_else_return.py
@@ -1,4 +1,4 @@
-""" Test that superfluous else return are detected. """
+"""Test that superfluous else return are detected."""
# pylint:disable=invalid-name,missing-docstring,unused-variable
diff --git a/tests/functional/n/no/no_member_dataclasses.py b/tests/functional/n/no/no_member_dataclasses.py
index 972da9ad9..d7a29187e 100644
--- a/tests/functional/n/no/no_member_dataclasses.py
+++ b/tests/functional/n/no/no_member_dataclasses.py
@@ -1,5 +1,4 @@
-"""Test various regressions for dataclasses and no-member.
-"""
+"""Test various regressions for dataclasses and no-member."""
# pylint: disable=missing-docstring, too-few-public-methods
from abc import ABCMeta, abstractmethod
from dataclasses import asdict, dataclass, field
@@ -13,8 +12,8 @@ class DeploymentState(metaclass=ABCMeta):
@abstractmethod
def to_dict(self) -> Dict:
- """
- Serializes given DeploymentState instance to Dict.
+ """Serializes given DeploymentState instance to Dict.
+
:return:
"""
diff --git a/tests/functional/n/no/no_member_imports.py b/tests/functional/n/no/no_member_imports.py
index ead6d9335..252bb9a1a 100644
--- a/tests/functional/n/no/no_member_imports.py
+++ b/tests/functional/n/no/no_member_imports.py
@@ -1,4 +1,4 @@
-"""Tests for no-member on imported modules"""
+"""Tests for no-member on imported modules."""
# pylint: disable=import-outside-toplevel, pointless-statement, missing-function-docstring
# pylint: disable=deprecated-module
@@ -11,9 +11,8 @@ def test_no_member_in_getattr():
def test_no_member_in_getattr_ignored() -> None:
- """Make sure that a module attribute access check is omitted with a
- module that is configured to be ignored.
- """
+ """Make sure that a module attribute access check is omitted with a module that is
+ configured to be ignored."""
import argparse
argparse.THIS_does_not_EXIST
diff --git a/tests/functional/n/no/no_member_subclassed_dataclasses.py b/tests/functional/n/no/no_member_subclassed_dataclasses.py
index 918abc5db..3f79a9b17 100644
--- a/tests/functional/n/no/no_member_subclassed_dataclasses.py
+++ b/tests/functional/n/no/no_member_subclassed_dataclasses.py
@@ -8,8 +8,8 @@ class DeploymentState(metaclass=ABCMeta):
@abstractmethod
def to_dict(self) -> Dict:
- """
- Serializes given DeploymentState instance to Dict.
+ """Serializes given DeploymentState instance to Dict.
+
:return:
"""
diff --git a/tests/functional/n/no/no_name_in_module.py b/tests/functional/n/no/no_name_in_module.py
index 34e8af569..48ea2575b 100644
--- a/tests/functional/n/no/no_name_in_module.py
+++ b/tests/functional/n/no/no_name_in_module.py
@@ -1,6 +1,6 @@
# pylint: disable=wildcard-import,unused-import,invalid-name,import-error
# pylint: disable=bare-except,broad-except,wrong-import-order,ungrouped-imports,wrong-import-position
-"""check nonexistent names imported are reported"""
+"""check nonexistent names imported are reported."""
from __future__ import print_function
import collections.tutu # [no-name-in-module]
from collections import toto # [no-name-in-module]
diff --git a/tests/functional/n/no/no_self_argument.py b/tests/functional/n/no/no_self_argument.py
index 38f6040b5..32e8e8095 100644
--- a/tests/functional/n/no/no_self_argument.py
+++ b/tests/functional/n/no/no_self_argument.py
@@ -1,18 +1,18 @@
-"""Check for method without self as first argument"""
+"""Check for method without self as first argument."""
# pylint: disable=useless-object-inheritance
from __future__ import print_function
class NoSelfArgument(object):
- """dummy class"""
+ """dummy class."""
def __init__(truc): # [no-self-argument]
- """method without self"""
+ """method without self."""
print(1)
def abdc(yoo): # [no-self-argument]
- """another test"""
+ """another test."""
print(yoo)
def edf(self):
- """just another method"""
+ """just another method."""
print('yapudju in', self)
diff --git a/tests/functional/n/no/no_self_use.py b/tests/functional/n/no/no_self_use.py
index 8311da0f0..d2510e4c6 100644
--- a/tests/functional/n/no/no_self_use.py
+++ b/tests/functional/n/no/no_self_use.py
@@ -1,69 +1,68 @@
# pylint: disable=too-few-public-methods,missing-docstring, useless-object-inheritance
-"""test detection of method which could be a function"""
+"""test detection of method which could be a function."""
from __future__ import print_function
class Toto(object):
- """bla bal abl"""
+ """bla bal abl."""
def __init__(self):
self.aaa = 2
def regular_method(self):
- """this method is a real method since it access to self"""
+ """this method is a real method since it access to self."""
self.function_method()
def function_method(self): # [no-self-use]
- """this method isn' a real method since it doesn't need self"""
+ """this method isn' a real method since it doesn't need self."""
print('hello')
async def async_regular_method(self):
- """this async method is a real method since it accesses self"""
+ """this async method is a real method since it accesses self."""
await self.async_function_method()
async def async_function_method(self): # [no-self-use]
- """this async method isn't a real method since it doesn't need self"""
+ """this async method isn't a real method since it doesn't need self."""
print('hello')
class Base(object):
- """an abstract class"""
+ """an abstract class."""
def __init__(self):
self.aaa = 2
def check(self, arg):
- """an abstract method, could not be a function"""
+ """an abstract method, could not be a function."""
raise NotImplementedError
class Sub(Base):
- """a concrete class"""
+ """a concrete class."""
def check(self, arg):
- """a concrete method, could not be a function since it need
- polymorphism benefits
- """
+ """a concrete method, could not be a function since it need polymorphism
+ benefits."""
return arg == 0
class Super(object):
- """same as before without abstract"""
+ """same as before without abstract."""
attr = 1
def method(self):
- """regular"""
+ """regular."""
print(self.attr)
class Sub1(Super):
- """override method with need for self"""
+ """override method with need for self."""
def method(self):
- """no i can not be a function"""
+ """no i can not be a function."""
print(42)
def __len__(self):
- """no i can not be a function"""
+ """no i can not be a function."""
return 42
def __cmp__(self, other):
- """no i can not be a function"""
+ """no i can not be a function."""
print(42)
def __copy__(self):
@@ -79,7 +78,6 @@ class Prop(object):
def count(self):
"""Don't emit no-self-use for properties.
- They can't be functions and they can be part of an
- API specification.
+ They can't be functions and they can be part of an API specification.
"""
return 42
diff --git a/tests/functional/n/no/no_staticmethod_decorator.py b/tests/functional/n/no/no_staticmethod_decorator.py
index d0e0effa4..2041d0ec8 100644
--- a/tests/functional/n/no/no_staticmethod_decorator.py
+++ b/tests/functional/n/no/no_staticmethod_decorator.py
@@ -1,16 +1,15 @@
-"""Checks static methods are declared with a decorator if within the class
-scope and if static method's argument is a member of the class
-"""
+"""Checks static methods are declared with a decorator if within the class scope and if
+static method's argument is a member of the class."""
# pylint: disable=too-few-public-methods, using-constant-test, no-method-argument, useless-object-inheritance
class MyClass(object):
- """Some class"""
+ """Some class."""
def __init__(self):
pass
def smethod():
- """static method-to-be"""
+ """static method-to-be."""
smethod = staticmethod(smethod) # [no-staticmethod-decorator]
if True:
@@ -18,18 +17,18 @@ class MyClass(object):
@staticmethod
def my_second_method():
- """correct static method definition"""
+ """correct static method definition."""
def other_method():
- """some method"""
+ """some method."""
smethod2 = staticmethod(other_method) # [no-staticmethod-decorator]
def helloworld():
- """says hello"""
+ """says hello."""
MyClass.new_static_method = staticmethod(helloworld)
class MyOtherClass(object):
- """Some other class"""
+ """Some other class."""
_make = staticmethod(tuple.__new__)
diff --git a/tests/functional/n/no/no_warning_docstring.py b/tests/functional/n/no/no_warning_docstring.py
index 315eeeaab..d2539d61b 100644
--- a/tests/functional/n/no/no_warning_docstring.py
+++ b/tests/functional/n/no/no_warning_docstring.py
@@ -1,23 +1,23 @@
-''' Test for inheritance '''
+"""Test for inheritance."""
from __future__ import print_function
__revision__ = 1
# pylint: disable=too-few-public-methods, using-constant-test, useless-object-inheritance
class AAAA(object):
- ''' class AAAA '''
+ """class AAAA."""
def __init__(self):
pass
def method1(self):
- ''' method 1 '''
+ """method 1."""
print(self)
def method2(self):
- ''' method 2 '''
+ """method 2."""
print(self)
class BBBB(AAAA):
- ''' class BBBB '''
+ """class BBBB."""
def __init__(self):
AAAA.__init__(self)
@@ -27,7 +27,7 @@ class BBBB(AAAA):
AAAA.method1(self)
class CCCC(BBBB):
- ''' class CCCC '''
+ """class CCCC."""
def __init__(self):
BBBB.__init__(self)
diff --git a/tests/functional/n/non/non_ascii_name.py b/tests/functional/n/non/non_ascii_name.py
index 276a23f75..cb2466542 100644
--- a/tests/functional/n/non/non_ascii_name.py
+++ b/tests/functional/n/non/non_ascii_name.py
@@ -1,4 +1,4 @@
-""" Tests for non-ascii-name checker. """
+"""Tests for non-ascii-name checker."""
áéíóú = 4444 # [non-ascii-name]
diff --git a/tests/functional/n/non/non_init_parent_called.py b/tests/functional/n/non/non_init_parent_called.py
index 97489accf..afd803e94 100644
--- a/tests/functional/n/non/non_init_parent_called.py
+++ b/tests/functional/n/non/non_init_parent_called.py
@@ -1,27 +1,26 @@
# pylint: disable=protected-access,import-self,too-few-public-methods,line-too-long
# pylint: disable=wrong-import-order, useless-object-inheritance,
-"""test for call to __init__ from a non ancestor class
-"""
+"""test for call to __init__ from a non ancestor class."""
from __future__ import print_function
from . import non_init_parent_called
import nonexistant # [import-error]
__revision__ = '$Id: non_init_parent_called.py,v 1.2 2004-09-29 08:35:13 syt Exp $'
class AAAA(object):
- """ancestor 1"""
+ """ancestor 1."""
def __init__(self):
print('init', self)
BBBBMixin.__init__(self) # [non-parent-init-called]
class BBBBMixin(object):
- """ancestor 2"""
+ """ancestor 2."""
def __init__(self):
print('init', self)
class CCC(BBBBMixin, non_init_parent_called.AAAA, non_init_parent_called.BBBB, nonexistant.AClass): # [no-member]
- """mix different things, some inferable some not"""
+ """mix different things, some inferable some not."""
def __init__(self):
BBBBMixin.__init__(self)
non_init_parent_called.AAAA.__init__(self)
@@ -29,7 +28,7 @@ class CCC(BBBBMixin, non_init_parent_called.AAAA, non_init_parent_called.BBBB, n
nonexistant.AClass.__init__(self)
class DDDD(AAAA):
- """call superclass constructor in disjunct branches"""
+ """call superclass constructor in disjunct branches."""
def __init__(self, value):
if value:
AAAA.__init__(self)
@@ -37,15 +36,13 @@ class DDDD(AAAA):
AAAA.__init__(self)
class Super(dict):
- """ test late binding super() call """
+ """test late binding super() call."""
def __init__(self):
base = super()
base.__init__()
class Super2(dict):
- """ Using the same idiom as Super, but without calling
- the __init__ method.
- """
+ """Using the same idiom as Super, but without calling the __init__ method."""
def __init__(self): # [super-init-not-called]
base = super()
base.__woohoo__() # [no-member]
diff --git a/tests/functional/n/non/non_iterator_returned.py b/tests/functional/n/non/non_iterator_returned.py
index 294e6da01..38a8c1de3 100644
--- a/tests/functional/n/non/non_iterator_returned.py
+++ b/tests/functional/n/non/non_iterator_returned.py
@@ -1,10 +1,10 @@
-"""Check non-iterators returned by __iter__ """
+"""Check non-iterators returned by __iter__"""
# pylint: disable=too-few-public-methods, missing-docstring, no-self-use, useless-object-inheritance, consider-using-with
class FirstGoodIterator(object):
- """ yields in iterator. """
+ """yields in iterator."""
def __iter__(self):
for index in range(10):
@@ -12,13 +12,13 @@ class FirstGoodIterator(object):
class SecondGoodIterator(object):
- """ __iter__ and next """
+ """__iter__ and next."""
def __iter__(self):
return self
def __next__(self):
- """ Infinite iterator, but still an iterator """
+ """Infinite iterator, but still an iterator."""
return 1
def next(self):
@@ -27,14 +27,14 @@ class SecondGoodIterator(object):
class ThirdGoodIterator(object):
- """ Returns other iterator, not the current instance """
+ """Returns other iterator, not the current instance."""
def __iter__(self):
return SecondGoodIterator()
class FourthGoodIterator(object):
- """ __iter__ returns iter(...) """
+ """__iter__ returns iter(...)"""
def __iter__(self):
return iter(range(10))
@@ -74,21 +74,21 @@ class FileBasedIterator(object):
class FirstBadIterator(object):
- """ __iter__ returns a list """
+ """__iter__ returns a list."""
def __iter__(self): # [non-iterator-returned]
return []
class SecondBadIterator(object):
- """ __iter__ without next """
+ """__iter__ without next."""
def __iter__(self): # [non-iterator-returned]
return self
class ThirdBadIterator(object):
- """ __iter__ returns an instance of another non-iterator """
+ """__iter__ returns an instance of another non-iterator."""
def __iter__(self): # [non-iterator-returned]
return SecondBadIterator()
diff --git a/tests/functional/n/non/non_parent_init_called.py b/tests/functional/n/non/non_parent_init_called.py
index 157adeb2a..d07a71e5b 100644
--- a/tests/functional/n/non/non_parent_init_called.py
+++ b/tests/functional/n/non/non_parent_init_called.py
@@ -1,5 +1,5 @@
-"""This used to raise a non-parent-init-called on Pylint 1.3
-See issue https://bitbucket.org/logilab/pylint/issue/308/ for reference"""
+"""This used to raise a non-parent-init-called on Pylint 1.3 See issue
+https://bitbucket.org/logilab/pylint/issue/308/ for reference."""
# pylint: disable=abstract-method, unused-argument
from tracemalloc import Sequence
diff --git a/tests/functional/n/nonexistent_operator.py b/tests/functional/n/nonexistent_operator.py
index f05a64947..935921f81 100644
--- a/tests/functional/n/nonexistent_operator.py
+++ b/tests/functional/n/nonexistent_operator.py
@@ -1,4 +1,4 @@
-"""check operator use"""
+"""check operator use."""
# pylint: disable=invalid-name, pointless-statement
a = 1
a += 5
diff --git a/tests/functional/n/nonlocal_without_binding.py b/tests/functional/n/nonlocal_without_binding.py
index 22887bcee..73ac31a2f 100644
--- a/tests/functional/n/nonlocal_without_binding.py
+++ b/tests/functional/n/nonlocal_without_binding.py
@@ -1,4 +1,4 @@
-""" Checks that reversed() receive proper argument """
+"""Checks that reversed() receive proper argument."""
# pylint: disable=missing-docstring,invalid-name,unused-variable, useless-object-inheritance
# pylint: disable=too-few-public-methods,no-self-use
diff --git a/tests/functional/n/not_callable.py b/tests/functional/n/not_callable.py
index 31d364b88..c34a5bd2c 100644
--- a/tests/functional/n/not_callable.py
+++ b/tests/functional/n/not_callable.py
@@ -11,10 +11,10 @@ def correct():
REVISION = correct()
class Correct(object):
- """callable object"""
+ """callable object."""
class MetaCorrect(object):
- """callable object"""
+ """callable object."""
def __call__(self):
return self
@@ -35,32 +35,32 @@ INCORRECT = INT() # [not-callable]
# getter, but it doesn't infer properly when having a getter
# and a setter.
class MyProperty(property):
- """ test subclasses """
+ """test subclasses."""
class PropertyTest(object):
- """ class """
+ """class."""
def __init__(self):
self.attr = 4
@property
def test(self):
- """ Get the attribute """
+ """Get the attribute."""
return self.attr
@test.setter
def test(self, value):
- """ Set the attribute """
+ """Set the attribute."""
self.attr = value
@MyProperty
def custom(self):
- """ Get the attribute """
+ """Get the attribute."""
return self.attr
@custom.setter
def custom(self, value):
- """ Set the attribute """
+ """Set the attribute."""
self.attr = value
PROP = PropertyTest()
diff --git a/tests/functional/n/not_context_manager.py b/tests/functional/n/not_context_manager.py
index a59f5a200..89df8083a 100644
--- a/tests/functional/n/not_context_manager.py
+++ b/tests/functional/n/not_context_manager.py
@@ -1,4 +1,4 @@
-"""Tests that onjects used in a with statement implement context manager protocol"""
+"""Tests that onjects used in a with statement implement context manager protocol."""
# pylint: disable=too-few-public-methods, invalid-name, import-error, missing-docstring
# pylint: disable=no-init,wrong-import-position, useless-object-inheritance
diff --git a/tests/functional/o/object_as_class_attribute.py b/tests/functional/o/object_as_class_attribute.py
index 2ac729b36..9d0ff423b 100644
--- a/tests/functional/o/object_as_class_attribute.py
+++ b/tests/functional/o/object_as_class_attribute.py
@@ -1,18 +1,19 @@
# pylint: disable=too-few-public-methods,useless-object-inheritance
"""Test case for the problem described below :
- - A class extends 'object'
- - This class defines its own __init__()
- * pylint will therefore check that baseclasses' init()
- are called
- - If this class defines an 'object' attribute, then pylint
- will use this new definition when trying to retrieve
- object.__init__()
+
+- A class extends 'object'
+- This class defines its own __init__()
+ * pylint will therefore check that baseclasses' init()
+ are called
+- If this class defines an 'object' attribute, then pylint
+ will use this new definition when trying to retrieve
+ object.__init__()
"""
__revision__ = None
class Statement(object):
- """ ... """
+ """..."""
def __init__(self):
pass
object = None
diff --git a/tests/functional/o/overloaded_operator.py b/tests/functional/o/overloaded_operator.py
index c14fb651f..600a47fe8 100644
--- a/tests/functional/o/overloaded_operator.py
+++ b/tests/functional/o/overloaded_operator.py
@@ -1,5 +1,5 @@
# pylint: disable=missing-docstring,too-few-public-methods,useless-object-inheritance
-"""#3291"""
+"""#3291."""
from __future__ import print_function
class Myarray(object):
diff --git a/tests/functional/o/overridden_final_method_py38.py b/tests/functional/o/overridden_final_method_py38.py
index d7b27b6e9..c2920c52a 100644
--- a/tests/functional/o/overridden_final_method_py38.py
+++ b/tests/functional/o/overridden_final_method_py38.py
@@ -1,5 +1,5 @@
"""Since Python version 3.8, a method decorated with typing.final cannot be
-overridden"""
+overridden."""
# pylint: disable=no-init, useless-object-inheritance, missing-docstring, too-few-public-methods
diff --git a/tests/functional/o/overridden_final_method_regression.py b/tests/functional/o/overridden_final_method_regression.py
index a1f72b380..462d7e01a 100644
--- a/tests/functional/o/overridden_final_method_regression.py
+++ b/tests/functional/o/overridden_final_method_regression.py
@@ -1,6 +1,7 @@
-"""Test a crash regression for the overridden-final-method checker on uninferable decorators"""
+"""Test a crash regression for the overridden-final-method checker on uninferable
+decorators."""
@unknown_decorator # [undefined-variable]
def crash_test():
- """A docstring"""
+ """A docstring."""
diff --git a/tests/functional/p/postponed_evaluation_pep585.py b/tests/functional/p/postponed_evaluation_pep585.py
index 889155a0f..f6280efe1 100644
--- a/tests/functional/p/postponed_evaluation_pep585.py
+++ b/tests/functional/p/postponed_evaluation_pep585.py
@@ -1,7 +1,6 @@
"""Test PEP 585 in combination with postponed evaluation PEP 563.
-This check requires Python 3.7 or 3.8!
-Testing with 3.8 only, to support TypedDict.
+This check requires Python 3.7 or 3.8! Testing with 3.8 only, to support TypedDict.
"""
# pylint: disable=missing-docstring,unused-argument,unused-import,too-few-public-methods,invalid-name,inherit-non-class,unsupported-binary-operation,wrong-import-position,ungrouped-imports,unused-variable
from __future__ import annotations
diff --git a/tests/functional/p/postponed_evaluation_pep585_error.py b/tests/functional/p/postponed_evaluation_pep585_error.py
index 71f09dc4c..61cda6346 100644
--- a/tests/functional/p/postponed_evaluation_pep585_error.py
+++ b/tests/functional/p/postponed_evaluation_pep585_error.py
@@ -1,7 +1,7 @@
"""Test PEP 585 without postponed evaluation. Everything should fail.
-This check requires Python 3.7 or Python 3.8!
-Testing with 3.8 only, to support TypedDict.
+This check requires Python 3.7 or Python 3.8! Testing with 3.8 only, to support
+TypedDict.
"""
# pylint: disable=missing-docstring,unused-argument,unused-import,too-few-public-methods,invalid-name,inherit-non-class,unsupported-binary-operation,unused-variable,line-too-long
import collections
diff --git a/tests/functional/p/postponed_evaluation_pep585_py39.py b/tests/functional/p/postponed_evaluation_pep585_py39.py
index 98201a6d8..5c2c36a81 100644
--- a/tests/functional/p/postponed_evaluation_pep585_py39.py
+++ b/tests/functional/p/postponed_evaluation_pep585_py39.py
@@ -1,4 +1,4 @@
-"""Test PEP 585 works as expected, starting with Python 3.9"""
+"""Test PEP 585 works as expected, starting with Python 3.9."""
# pylint: disable=missing-docstring,unused-argument,unused-import,too-few-public-methods,invalid-name,inherit-non-class,unsupported-binary-operation,wrong-import-position,ungrouped-imports,unused-variable
import collections
import dataclasses
diff --git a/tests/functional/p/pragma_after_backslash.py b/tests/functional/p/pragma_after_backslash.py
index 4de44bd7d..931e8f5b8 100644
--- a/tests/functional/p/pragma_after_backslash.py
+++ b/tests/functional/p/pragma_after_backslash.py
@@ -2,9 +2,9 @@
# pylint: disable=too-few-public-methods
class Foo:
- """block-disable test"""
+ """block-disable test."""
def meth3(self):
- """test one line disabling"""
+ """test one line disabling."""
print(self.bla) \
# pylint: disable=no-member
diff --git a/tests/functional/p/property_affectation_py26.py b/tests/functional/p/property_affectation_py26.py
index 323cf2d05..3ac257099 100644
--- a/tests/functional/p/property_affectation_py26.py
+++ b/tests/functional/p/property_affectation_py26.py
@@ -1,7 +1,5 @@
# pylint: disable=too-few-public-methods, useless-object-inheritance
-"""
-Simple test case for an annoying behavior in pylint.
-"""
+"""Simple test case for an annoying behavior in pylint."""
__revision__ = 'pouet'
@@ -13,7 +11,7 @@ class Test(object):
@property
def myattr(self):
- """Getter for myattr"""
+ """Getter for myattr."""
return self._thing
@myattr.setter
diff --git a/tests/functional/p/protected_access.py b/tests/functional/p/protected_access.py
index 39769fe76..e3fb34426 100644
--- a/tests/functional/p/protected_access.py
+++ b/tests/functional/p/protected_access.py
@@ -1,4 +1,4 @@
-"""Tests for protected_access"""
+"""Tests for protected_access."""
# pylint: disable=missing-class-docstring, too-few-public-methods, pointless-statement
# pylint: disable=missing-function-docstring, invalid-metaclass, no-member
# pylint: disable=no-self-argument, no-self-use, undefined-variable, unused-variable
diff --git a/tests/functional/p/protected_access_special_methods_off.py b/tests/functional/p/protected_access_special_methods_off.py
index 8747b425e..7788de8ea 100644
--- a/tests/functional/p/protected_access_special_methods_off.py
+++ b/tests/functional/p/protected_access_special_methods_off.py
@@ -1,13 +1,12 @@
-"""Test that when check-protected-access-in-special-methods is False (default)
-no protected-access message emission for single underscore prefixed names
-inside special methods occur
-"""
+"""Test that when check-protected-access-in-special-methods is False (default) no
+protected-access message emission for single underscore prefixed names inside special
+methods occur."""
# pylint: disable=missing-class-docstring, invalid-name, unused-variable
# pylint: disable=too-few-public-methods
class Protected:
- """A class"""
+ """A class."""
def __init__(self):
self._protected = 42
diff --git a/tests/functional/p/protected_access_special_methods_on.py b/tests/functional/p/protected_access_special_methods_on.py
index 84488f442..81a82cc03 100644
--- a/tests/functional/p/protected_access_special_methods_on.py
+++ b/tests/functional/p/protected_access_special_methods_on.py
@@ -1,13 +1,11 @@
-"""Test that check-protected-access-in-special-methods can be used to
-trigger protected-access message emission for single underscore prefixed names
-inside special methods.
-"""
+"""Test that check-protected-access-in-special-methods can be used to trigger protected-
+access message emission for single underscore prefixed names inside special methods."""
# pylint: disable=missing-class-docstring, invalid-name, unused-variable
# pylint: disable=too-few-public-methods
class Protected:
- """A class"""
+ """A class."""
def __init__(self):
self._protected = 42
diff --git a/tests/functional/p/py_version_35.py b/tests/functional/p/py_version_35.py
index 277250183..3dc118646 100644
--- a/tests/functional/p/py_version_35.py
+++ b/tests/functional/p/py_version_35.py
@@ -1,4 +1,4 @@
-"""No warnings should be emitted for features that require Python > 3.5"""
+"""No warnings should be emitted for features that require Python > 3.5."""
# pylint: disable=invalid-name
# consider-using-f-string -> requires Python 3.6
diff --git a/tests/functional/r/raise/raising_bad_type.py b/tests/functional/r/raise/raising_bad_type.py
index cef109d47..229963e8d 100644
--- a/tests/functional/r/raise/raising_bad_type.py
+++ b/tests/functional/r/raise/raising_bad_type.py
@@ -1,3 +1,3 @@
-"""Tests for raising-bad-type"""
+"""Tests for raising-bad-type."""
raise (ZeroDivisionError, None) # [raising-bad-type]
diff --git a/tests/functional/r/raise/raising_format_tuple.py b/tests/functional/r/raise/raising_format_tuple.py
index 268d834f4..4ab9b4f89 100644
--- a/tests/functional/r/raise/raising_format_tuple.py
+++ b/tests/functional/r/raise/raising_format_tuple.py
@@ -1,52 +1,51 @@
-'''
-Complain about multi-argument exception constructors where the first argument
-contains a percent sign, thus suggesting a % string formatting was intended
-instead. The same holds for a string containing {...} suggesting str.format()
-was intended.
-'''
+"""Complain about multi-argument exception constructors where the first argument
+contains a percent sign, thus suggesting a % string formatting was intended instead.
+
+The same holds for a string containing {...} suggesting str.format() was intended.
+"""
# pylint: disable=redundant-u-string-prefix, consider-using-f-string
def bad_percent(arg):
- '''Raising a percent-formatted string and an argument'''
+ """Raising a percent-formatted string and an argument."""
raise KeyError('Bad key: %r', arg) # [raising-format-tuple]
def good_percent(arg):
- '''Instead of passing multiple arguments, format the message'''
+ """Instead of passing multiple arguments, format the message."""
raise KeyError('Bad key: %r' % arg)
def bad_multiarg(name, value):
- '''Raising a formatted string and multiple additional arguments'''
+ """Raising a formatted string and multiple additional arguments."""
raise ValueError('%s measures %.2f', name, value) # [raising-format-tuple]
def good_multiarg(name, value):
- '''The arguments have to be written as a tuple for formatting'''
+ """The arguments have to be written as a tuple for formatting."""
raise ValueError('%s measures %.2f' % (name, value))
def bad_braces(arg):
- '''Curly braces as placeholders'''
+ """Curly braces as placeholders."""
raise KeyError('Bad key: {:r}', arg) # [raising-format-tuple]
def good_braces(arg):
- '''Call str.format() instead'''
+ """Call str.format() instead."""
raise KeyError('Bad key: {:r}'.format(arg))
def bad_multistring(arg):
- '''Multiple adjacent string literals'''
+ """Multiple adjacent string literals."""
raise AssertionError( # [raising-format-tuple]
'Long message about %s '
"split over several adjacent literals", arg)
def bad_triplequote(arg):
- '''String literals with triple quotes'''
+ """String literals with triple quotes."""
raise AssertionError( # [raising-format-tuple]
'''Long message about %s
split over several adjacent literals''', arg)
def bad_unicode(arg):
- '''Unicode string literal'''
+ """Unicode string literal."""
raise ValueError(u'Bad %s', arg) # [raising-format-tuple]
def raise_something_without_name(arg):
- '''Regression test for nodes without .node attribute'''
+ """Regression test for nodes without .node attribute."""
import standard_exceptions # pylint: disable=import-error,import-outside-toplevel
raise standard_exceptions.MyException(u'An %s', arg) # [raising-format-tuple]
diff --git a/tests/functional/r/raise/raising_non_exception.py b/tests/functional/r/raise/raising_non_exception.py
index 7961c5220..eca006575 100644
--- a/tests/functional/r/raise/raising_non_exception.py
+++ b/tests/functional/r/raise/raising_non_exception.py
@@ -1,7 +1,7 @@
"""The following code should emit a raising-non-exception.
-Previously, it didn't, due to a bug in the check for bad-exception-context,
-which prevented further checking on the Raise node.
+Previously, it didn't, due to a bug in the check for bad-exception- context, which
+prevented further checking on the Raise node.
"""
# pylint: disable=import-error, too-few-public-methods, useless-object-inheritance
diff --git a/tests/functional/r/recursion/recursion_error_2667.py b/tests/functional/r/recursion/recursion_error_2667.py
index 585cf7f2f..2ab6c3d6f 100644
--- a/tests/functional/r/recursion/recursion_error_2667.py
+++ b/tests/functional/r/recursion/recursion_error_2667.py
@@ -1,4 +1,4 @@
-"""Add regression test for https://github.com/PyCQA/pylint/issues/2667"""
+"""Add regression test for https://github.com/PyCQA/pylint/issues/2667."""
# pylint: disable=missing-docstring, too-few-public-methods
class MyClass:
diff --git a/tests/functional/r/recursion/recursion_error_2906.py b/tests/functional/r/recursion/recursion_error_2906.py
index 6b4b08d5f..c6bc206f5 100644
--- a/tests/functional/r/recursion/recursion_error_2906.py
+++ b/tests/functional/r/recursion/recursion_error_2906.py
@@ -1,4 +1,4 @@
-"""Recursion error for https://github.com/PyCQA/pylint/issues/2906"""
+"""Recursion error for https://github.com/PyCQA/pylint/issues/2906."""
# pylint: disable=disallowed-name,global-statement,invalid-name,missing-docstring
lst = []
diff --git a/tests/functional/r/recursion/recursion_error_3152.py b/tests/functional/r/recursion/recursion_error_3152.py
index 97ec190e8..be7b719c3 100644
--- a/tests/functional/r/recursion/recursion_error_3152.py
+++ b/tests/functional/r/recursion/recursion_error_3152.py
@@ -1,4 +1,4 @@
-"""Check that we do not crash with a recursion error"""
+"""Check that we do not crash with a recursion error."""
import setuptools
diff --git a/tests/functional/r/recursion/recursion_error_3159.py b/tests/functional/r/recursion/recursion_error_3159.py
index 086cce769..f1293a996 100644
--- a/tests/functional/r/recursion/recursion_error_3159.py
+++ b/tests/functional/r/recursion/recursion_error_3159.py
@@ -1,4 +1,4 @@
-"""Check that we do not crash with a recursion error
+"""Check that we do not crash with a recursion error.
https://github.com/PyCQA/pylint/issues/3159
"""
diff --git a/tests/functional/r/recursion/recursion_error_crash.py b/tests/functional/r/recursion/recursion_error_crash.py
index 208bc2e7a..4ed62b089 100644
--- a/tests/functional/r/recursion/recursion_error_crash.py
+++ b/tests/functional/r/recursion/recursion_error_crash.py
@@ -1,4 +1,4 @@
-"""Test that a recursion error does not happen
+"""Test that a recursion error does not happen.
https://github.com/PyCQA/pylint/issues/2463
"""
diff --git a/tests/functional/r/recursion/recursion_error_crash_2683.py b/tests/functional/r/recursion/recursion_error_crash_2683.py
index 05978a355..25959bc1d 100644
--- a/tests/functional/r/recursion/recursion_error_crash_2683.py
+++ b/tests/functional/r/recursion/recursion_error_crash_2683.py
@@ -1,4 +1,4 @@
-"""Test for https://github.com/PyCQA/pylint/issues/2683"""
+"""Test for https://github.com/PyCQA/pylint/issues/2683."""
# pylint: disable=missing-docstring,too-few-public-methods
class Cls:
diff --git a/tests/functional/r/recursion/recursion_error_crash_astroid_623.py b/tests/functional/r/recursion/recursion_error_crash_astroid_623.py
index 662da6145..256b9b989 100644
--- a/tests/functional/r/recursion/recursion_error_crash_astroid_623.py
+++ b/tests/functional/r/recursion/recursion_error_crash_astroid_623.py
@@ -1,4 +1,4 @@
-"""Test that a recursion error does not happen
+"""Test that a recursion error does not happen.
https://github.com/PyCQA/astroid/issues/623
"""
diff --git a/tests/functional/r/redefined_builtin.py b/tests/functional/r/redefined_builtin.py
index 47d4e35ba..c5f6cc891 100644
--- a/tests/functional/r/redefined_builtin.py
+++ b/tests/functional/r/redefined_builtin.py
@@ -23,5 +23,5 @@ from os import open
# Test non-default redefining-builtins-modules setting in function
def test():
- """Function importing a function"""
+ """Function importing a function."""
from os import open
diff --git a/tests/functional/r/redundant_u_string_prefix.py b/tests/functional/r/redundant_u_string_prefix.py
index 7ffbabd09..e8aa10afe 100644
--- a/tests/functional/r/redundant_u_string_prefix.py
+++ b/tests/functional/r/redundant_u_string_prefix.py
@@ -1,4 +1,4 @@
-""""Checks for redundant u-prefixes for strings"""
+""""Checks for redundant u-prefixes for strings."""
# pylint: disable=missing-function-docstring
def print_good():
diff --git a/tests/functional/r/redundant_unittest_assert.py b/tests/functional/r/redundant_unittest_assert.py
index b7efffc4e..039596861 100644
--- a/tests/functional/r/redundant_unittest_assert.py
+++ b/tests/functional/r/redundant_unittest_assert.py
@@ -1,9 +1,8 @@
# pylint: disable=missing-docstring,too-few-public-methods
-"""
-https://www.logilab.org/ticket/355
-If you are using assertTrue or assertFalse and the first argument is a
-constant(like a string), then the assert will always be true. Therefore,
-it should emit a warning message.
+"""https://www.logilab.org/ticket/355 If you are using assertTrue or assertFalse and the
+first argument is a constant(like a string), then the assert will always be true.
+
+Therefore, it should emit a warning message.
"""
import unittest
@@ -11,7 +10,7 @@ import unittest
@unittest.skip("don't run this")
class Tests(unittest.TestCase):
def test_something(self):
- ''' Simple test '''
+ """Simple test."""
some_var = 'It should be assertEqual'
# +1:[redundant-unittest-assert]
self.assertTrue('I meant assertEqual not assertTrue', some_var)
@@ -32,7 +31,7 @@ class Tests(unittest.TestCase):
@unittest.skip("don't run this")
class RegressionWithArgs(unittest.TestCase):
- '''Don't fail if the bound method doesn't have arguments.'''
+ """Don't fail if the bound method doesn't have arguments."""
def test(self):
self.run()
diff --git a/tests/functional/r/regression/regression_3416_unused_argument_raise.py b/tests/functional/r/regression/regression_3416_unused_argument_raise.py
index 9bc761701..c2d77de67 100644
--- a/tests/functional/r/regression/regression_3416_unused_argument_raise.py
+++ b/tests/functional/r/regression/regression_3416_unused_argument_raise.py
@@ -1,4 +1,4 @@
-"""Test that we emit unused-argument when a function uses `raise
+"""Test that we emit unused-argument when a function uses `raise.
https://github.com/PyCQA/pylint/issues/3416
"""
@@ -7,7 +7,7 @@ https://github.com/PyCQA/pylint/issues/3416
# +1: [unused-argument, unused-argument, unused-argument]
def fun(arg_a, arg_b, arg_c) -> None:
- """Routine docstring"""
+ """Routine docstring."""
try:
pass
except Exception:
diff --git a/tests/functional/r/regression/regression_3507_typing_alias_isinstance.py b/tests/functional/r/regression/regression_3507_typing_alias_isinstance.py
index 4dba85545..b02a26e15 100644
--- a/tests/functional/r/regression/regression_3507_typing_alias_isinstance.py
+++ b/tests/functional/r/regression/regression_3507_typing_alias_isinstance.py
@@ -1,8 +1,5 @@
-"""
-https://github.com/PyCQA/pylint/issues/3507
-False-positive 'isinstance-second-argument-not-valid-type'
-for typing aliases in 'isinstance' calls.
-"""
+"""https://github.com/PyCQA/pylint/issues/3507 False-positive 'isinstance- second-
+argument-not-valid-type' for typing aliases in 'isinstance' calls."""
import collections
import collections.abc
import typing
diff --git a/tests/functional/r/regression/regression_4723.py b/tests/functional/r/regression/regression_4723.py
index 012825db0..52b56bea4 100644
--- a/tests/functional/r/regression/regression_4723.py
+++ b/tests/functional/r/regression/regression_4723.py
@@ -1,5 +1,7 @@
"""Latest version of astroid (2.6.3) causes RuntimeError:
-generator raised StopIteration #4723"""
+
+generator raised StopIteration #4723
+"""
# pylint: disable=invalid-name,missing-docstring,too-few-public-methods
import contextlib
diff --git a/tests/functional/r/regression/regression_4891.py b/tests/functional/r/regression/regression_4891.py
index 34945e812..3a9f52525 100644
--- a/tests/functional/r/regression/regression_4891.py
+++ b/tests/functional/r/regression/regression_4891.py
@@ -3,14 +3,10 @@
import copy
class MyData:
- '''
- class docstring
- '''
+ """class docstring."""
def __init__(self):
self.data = {}
def process(self):
- '''
- another method is responsible for putting "static_key"
- '''
+ """another method is responsible for putting "static_key"."""
copy.copy(self.data['static_key'])
diff --git a/tests/functional/r/regression/regression___file___global.py b/tests/functional/r/regression/regression___file___global.py
index 9ad2eed02..12a8e708b 100644
--- a/tests/functional/r/regression/regression___file___global.py
+++ b/tests/functional/r/regression/regression___file___global.py
@@ -1,4 +1,4 @@
-"""test no crash on __file__ global"""
+"""test no crash on __file__ global."""
def func():
"""override __file__"""
diff --git a/tests/functional/r/regression/regression_issue_4631.py b/tests/functional/r/regression/regression_issue_4631.py
index 195c38611..4b8d8d1b6 100644
--- a/tests/functional/r/regression/regression_issue_4631.py
+++ b/tests/functional/r/regression/regression_issue_4631.py
@@ -1,8 +1,6 @@
# pylint: disable=missing-function-docstring
-"""
-Regression tests for StopIteration raised when using limit-inference-results=0
-"""
+"""Regression tests for StopIteration raised when using limit-inference- results=0."""
def get_youtube_link(song_name: str, song_artists):
diff --git a/tests/functional/r/regression/regression_issue_4633.py b/tests/functional/r/regression/regression_issue_4633.py
index bd9502acd..2897525f4 100644
--- a/tests/functional/r/regression/regression_issue_4633.py
+++ b/tests/functional/r/regression/regression_issue_4633.py
@@ -1,8 +1,6 @@
# pylint: disable=missing-docstring,too-few-public-methods,no-self-use
-"""
-Regression tests for https://github.com/PyCQA/pylint/issues/4633
-"""
+"""Regression tests for https://github.com/PyCQA/pylint/issues/4633."""
from queue import Queue
from unittest.mock import MagicMock
diff --git a/tests/functional/r/regression/regression_no_member_1078.py b/tests/functional/r/regression/regression_no_member_1078.py
index b7be27d3c..347f55a47 100644
--- a/tests/functional/r/regression/regression_no_member_1078.py
+++ b/tests/functional/r/regression/regression_no_member_1078.py
@@ -1,4 +1,4 @@
-"""Make sure no-member is not emitted when modifying __doc__ via augmented assignment
+"""Make sure no-member is not emitted when modifying __doc__ via augmented assignment.
https://github.com/PyCQA/pylint/issues/1078
"""
diff --git a/tests/functional/r/regression/regression_no_value_for_parameter.py b/tests/functional/r/regression/regression_no_value_for_parameter.py
index d9675e614..6efd544d9 100644
--- a/tests/functional/r/regression/regression_no_value_for_parameter.py
+++ b/tests/functional/r/regression/regression_no_value_for_parameter.py
@@ -23,12 +23,12 @@ def func(*, key=None):
def varargs_good(*parts):
- """All good"""
+ """All good."""
return os.path.join(*parts)
def varargs_no_expr(*parts):
- """False positives below this line"""
+ """False positives below this line."""
ret = os.path.join(*parts)
if ret:
return ret
diff --git a/tests/functional/r/regression/regression_posonly_args.py b/tests/functional/r/regression/regression_posonly_args.py
index 750b1f951..ab17c7f18 100644
--- a/tests/functional/r/regression/regression_posonly_args.py
+++ b/tests/functional/r/regression/regression_posonly_args.py
@@ -1,7 +1,7 @@
"""Test linting.
-This is only intended to test pylint support for python 3.8's
-positional-only arguments (PEP 570).
+This is only intended to test pylint support for python 3.8's positional-only arguments
+(PEP 570).
"""
diff --git a/tests/functional/r/regression/regression_property_no_member_3269.py b/tests/functional/r/regression/regression_property_no_member_3269.py
index 5fa85b6ea..311b6adbb 100644
--- a/tests/functional/r/regression/regression_property_no_member_3269.py
+++ b/tests/functional/r/regression/regression_property_no_member_3269.py
@@ -1,21 +1,21 @@
-"""Calling a super property"""
+"""Calling a super property."""
# pylint: disable=too-few-public-methods,invalid-name
class A:
- """A parent class"""
+ """A parent class."""
@property
def test(self):
- """A property"""
+ """A property."""
return "test"
class B:
- """A child class"""
+ """A child class."""
@property
def test(self):
- """Overriding implementation of prop which calls the parent"""
+ """Overriding implementation of prop which calls the parent."""
return A.test.fget(self) + " overridden"
diff --git a/tests/functional/r/regression/regression_too_many_arguments_2335.py b/tests/functional/r/regression/regression_too_many_arguments_2335.py
index d2759adfe..754e5bda4 100644
--- a/tests/functional/r/regression/regression_too_many_arguments_2335.py
+++ b/tests/functional/r/regression/regression_too_many_arguments_2335.py
@@ -1,4 +1,5 @@
-"""Test that `abc.ABCMeta.__new__` does not trigger too-many-function-arguments when referred
+"""Test that `abc.ABCMeta.__new__` does not trigger too-many-function-arguments when
+referred.
https://github.com/PyCQA/pylint/issues/2335
"""
diff --git a/tests/functional/r/regression_02/regression_4982.py b/tests/functional/r/regression_02/regression_4982.py
index a6cef6f9e..959e18f08 100644
--- a/tests/functional/r/regression_02/regression_4982.py
+++ b/tests/functional/r/regression_02/regression_4982.py
@@ -1,11 +1,12 @@
-"""Regression test for a crash reported in https://github.com/PyCQA/pylint/issues/4982"""
+"""Regression test for a crash reported in
+https://github.com/PyCQA/pylint/issues/4982."""
# pylint: disable=too-few-public-methods
class Base:
- """A class"""
+ """A class."""
@classmethod
def get_first_subclass(cls):
- """Return the first subclass of this class"""
+ """Return the first subclass of this class."""
for subklass in cls.__subclasses__():
return subklass
return object
@@ -15,4 +16,4 @@ subclass = Base.get_first_subclass()
class Another(subclass):
- """Create a class from the __subclasses__ attribute of another class"""
+ """Create a class from the __subclasses__ attribute of another class."""
diff --git a/tests/functional/r/regression_02/regression_5030.py b/tests/functional/r/regression_02/regression_5030.py
index 8aa22f879..d2e682a9b 100644
--- a/tests/functional/r/regression_02/regression_5030.py
+++ b/tests/functional/r/regression_02/regression_5030.py
@@ -1,5 +1,7 @@
"""Regression in astroid on ClassDef inference with two test cases.
-Fixed in https://github.com/PyCQA/astroid/pull/1181"""
+
+Fixed in https://github.com/PyCQA/astroid/pull/1181
+"""
from typing import Tuple, Type
from typing import Dict, List, Any
@@ -7,7 +9,7 @@ from dataclasses import dataclass, field
# https://github.com/PyCQA/pylint/issues/5030
def is_type_list(f_type: Type) -> bool:
- """just here to show the issue"""
+ """just here to show the issue."""
return f_type == list
assert not is_type_list(Tuple)
diff --git a/tests/functional/r/regression_02/regression_5048.py b/tests/functional/r/regression_02/regression_5048.py
index 5656759af..0b228f1d1 100644
--- a/tests/functional/r/regression_02/regression_5048.py
+++ b/tests/functional/r/regression_02/regression_5048.py
@@ -1,5 +1,5 @@
-"""Crash regression in astroid on Compare node inference
-Fixed in https://github.com/PyCQA/astroid/pull/1185"""
+"""Crash regression in astroid on Compare node inference Fixed in
+https://github.com/PyCQA/astroid/pull/1185."""
# pylint: disable=missing-docstring
diff --git a/tests/functional/r/regression_02/regression_5244.py b/tests/functional/r/regression_02/regression_5244.py
index ee5450679..ac88ac6cc 100644
--- a/tests/functional/r/regression_02/regression_5244.py
+++ b/tests/functional/r/regression_02/regression_5244.py
@@ -1,6 +1,5 @@
-"""Test for the regression on inference of self referential __len__
-Reported in https://github.com/PyCQA/pylint/issues/5244
-"""
+"""Test for the regression on inference of self referential __len__ Reported in
+https://github.com/PyCQA/pylint/issues/5244."""
# pylint: disable=missing-class-docstring, missing-function-docstring, no-self-use
diff --git a/tests/functional/r/regression_02/regression_5461.py b/tests/functional/r/regression_02/regression_5461.py
index 39daf7b9b..993ac5133 100644
--- a/tests/functional/r/regression_02/regression_5461.py
+++ b/tests/functional/r/regression_02/regression_5461.py
@@ -1,5 +1,5 @@
-"""Regression test for issue 5461
-Crash on list comprehension with it used `type` as variable name
+"""Regression test for issue 5461 Crash on list comprehension with it used `type` as
+variable name.
See: https://github.com/PyCQA/pylint/issues/5461
"""
diff --git a/tests/functional/r/regression_02/regression_distutil_import_error_73.py b/tests/functional/r/regression_02/regression_distutil_import_error_73.py
index 751a4980f..db0be9f58 100644
--- a/tests/functional/r/regression_02/regression_distutil_import_error_73.py
+++ b/tests/functional/r/regression_02/regression_distutil_import_error_73.py
@@ -1,9 +1,7 @@
-"""
-Regression test to check that distutils can be imported
-See https://github.com/PyCQA/pylint/issues/73
+"""Regression test to check that distutils can be imported See
+https://github.com/PyCQA/pylint/issues/73.
-See also:
-https://github.com/PyCQA/pylint/issues/2955
+See also: https://github.com/PyCQA/pylint/issues/2955
https://github.com/PyCQA/astroid/pull/1321
"""
diff --git a/tests/functional/r/regression_02/regression_node_statement.py b/tests/functional/r/regression_02/regression_node_statement.py
index bd982480b..aec54fcec 100644
--- a/tests/functional/r/regression_02/regression_node_statement.py
+++ b/tests/functional/r/regression_02/regression_node_statement.py
@@ -1,6 +1,8 @@
"""Test to see we don't crash on this code in pandas.
+
See: https://github.com/pandas-dev/pandas/blob/master/pandas/core/arrays/sparse/array.py
-Code written by Guido van Rossum here: https://github.com/python/typing/issues/684"""
+Code written by Guido van Rossum here: https://github.com/python/typing/issues/684
+"""
# pylint: disable=no-member, redefined-builtin, invalid-name, missing-class-docstring
from typing import TYPE_CHECKING
diff --git a/tests/functional/r/regression_02/regression_node_statement_two.py b/tests/functional/r/regression_02/regression_node_statement_two.py
index e2db94791..7b0b64a1f 100644
--- a/tests/functional/r/regression_02/regression_node_statement_two.py
+++ b/tests/functional/r/regression_02/regression_node_statement_two.py
@@ -1,4 +1,5 @@
"""Test to see we don't crash on this code in pandas.
+
See: https://github.com/pandas-dev/pandas/blob/master/pandas/core/indexes/period.py
Reported in https://github.com/PyCQA/pylint/issues/5382
"""
diff --git a/tests/functional/r/regression_02/regression_protected_access.py b/tests/functional/r/regression_02/regression_protected_access.py
index df36f6795..1787007ba 100644
--- a/tests/functional/r/regression_02/regression_protected_access.py
+++ b/tests/functional/r/regression_02/regression_protected_access.py
@@ -1,19 +1,18 @@
-"""Test for the regression on (outer)-class traversal for private methods
-MyClass does not have an outerclass which previously crashed the protected-access check
-"""
+"""Test for the regression on (outer)-class traversal for private methods MyClass does
+not have an outerclass which previously crashed the protected- access check."""
# pylint: disable=too-few-public-methods
class MyClass:
- """Test class"""
+ """Test class."""
@staticmethod
def _a_private_method():
- """Private method that references the class itself"""
+ """Private method that references the class itself."""
return MySecondClass.MyClass._a_private_method() # [protected-access]
class MySecondClass:
- """Class that uses MyClass"""
+ """Class that uses MyClass."""
MyClass = MyClass
diff --git a/tests/functional/r/reimport.py b/tests/functional/r/reimport.py
index defe51959..92a677686 100644
--- a/tests/functional/r/reimport.py
+++ b/tests/functional/r/reimport.py
@@ -1,5 +1,4 @@
-"""check reimport
-"""
+"""check reimport."""
from __future__ import absolute_import, print_function
# pylint: disable=using-constant-test,ungrouped-imports,wrong-import-position,import-outside-toplevel
@@ -17,7 +16,7 @@ if __revision__:
print(join, exists)
def func(yooo):
- """reimport in different scope"""
+ """reimport in different scope."""
import os as ass # [reimported]
ass.remove(yooo)
import re # [reimported]
diff --git a/tests/functional/r/reimported.py b/tests/functional/r/reimported.py
index 03b07c4d6..9302f2141 100644
--- a/tests/functional/r/reimported.py
+++ b/tests/functional/r/reimported.py
@@ -30,7 +30,7 @@ import sys # [reimported] #pylint: disable=ungrouped-imports,wrong-import-orde
__revision__ = 0
def no_reimport():
- """docstring"""
+ """docstring."""
import os #pylint: disable=import-outside-toplevel
print(os)
diff --git a/tests/functional/r/renamed_import_logging_not_lazy.py b/tests/functional/r/renamed_import_logging_not_lazy.py
index 5eb23bf95..64cef6d11 100644
--- a/tests/functional/r/renamed_import_logging_not_lazy.py
+++ b/tests/functional/r/renamed_import_logging_not_lazy.py
@@ -6,7 +6,7 @@ import logging as renamed_logging
class Logger:
- """Fake logger"""
+ """Fake logger."""
logger = renamed_logging.getLogger(__name__)
diff --git a/tests/functional/r/repeated_keyword.py b/tests/functional/r/repeated_keyword.py
index 786c53bab..177105301 100644
--- a/tests/functional/r/repeated_keyword.py
+++ b/tests/functional/r/repeated_keyword.py
@@ -1,4 +1,4 @@
-"""Check that a keyword is not repeated in a function call
+"""Check that a keyword is not repeated in a function call.
This is somehow related to redundant-keyword, but it's not the same.
"""
diff --git a/tests/functional/r/return_in_init.py b/tests/functional/r/return_in_init.py
index bf0aa064f..c0aaaf2b9 100644
--- a/tests/functional/r/return_in_init.py
+++ b/tests/functional/r/return_in_init.py
@@ -6,20 +6,20 @@ class MyClass(object):
return 1
class MyClass2(object):
- """dummy class"""
+ """dummy class."""
def __init__(self):
return
class MyClass3(object):
- """dummy class"""
+ """dummy class."""
def __init__(self):
return None
class MyClass5(object):
- """dummy class"""
+ """dummy class."""
def __init__(self):
self.callable = lambda: (yield None)
diff --git a/tests/functional/r/return_outside_function.py b/tests/functional/r/return_outside_function.py
index 93ec22e53..3978801b1 100644
--- a/tests/functional/r/return_outside_function.py
+++ b/tests/functional/r/return_outside_function.py
@@ -1,2 +1,2 @@
-"""This is grammatically correct, but it's still a SyntaxError"""
+"""This is grammatically correct, but it's still a SyntaxError."""
return # [return-outside-function]
diff --git a/tests/functional/s/self/self_cls_assignment.py b/tests/functional/s/self/self_cls_assignment.py
index e69dafd59..86672bfe2 100644
--- a/tests/functional/s/self/self_cls_assignment.py
+++ b/tests/functional/s/self/self_cls_assignment.py
@@ -3,43 +3,43 @@ from __future__ import print_function
# pylint: disable=too-few-public-methods, useless-object-inheritance
class Foo(object):
- """Class with methods that check for self/cls assignment"""
+ """Class with methods that check for self/cls assignment."""
# pylint: disable=no-self-argument,no-self-use
def self_foo(bar_):
- """Instance method, should warn for bar"""
+ """Instance method, should warn for bar."""
bar_ = 10 # [self-cls-assignment]
# pylint: disable=no-self-use
def self_foofoo(self, lala):
- """Instance method, should warn for self"""
+ """Instance method, should warn for self."""
self = lala # [self-cls-assignment]
self, var = lala, 1 # [self-cls-assignment]
print(var)
@classmethod
def cls_foo(cls):
- """Class method, should warn for cls"""
+ """Class method, should warn for cls."""
cls = 'tada' # [self-cls-assignment]
# pylint: disable=unused-argument
@staticmethod
def static_foo(lala):
- """Static method, no warnings"""
+ """Static method, no warnings."""
lala = 10
# pylint: disable=unused-argument
def free_foo(bar_, lala):
- """Free function, no warnings"""
+ """Free function, no warnings."""
bar_ = lala
class TestNonLocal:
- """Test class for nonlocal assignment of self"""
+ """Test class for nonlocal assignment of self."""
def function(self, param):
- """This function uses nonlocal to reassign self"""
+ """This function uses nonlocal to reassign self."""
def _set_param(param):
nonlocal self
diff --git a/tests/functional/s/shallow_copy_environ.py b/tests/functional/s/shallow_copy_environ.py
index ee931d71a..9f45219b5 100644
--- a/tests/functional/s/shallow_copy_environ.py
+++ b/tests/functional/s/shallow_copy_environ.py
@@ -1,4 +1,4 @@
-"""Tests for shallow-copy-environ"""
+"""Tests for shallow-copy-environ."""
# pylint: disable=wrong-import-position, reimported, ungrouped-imports, import-error, wrong-import-order
import copy
diff --git a/tests/functional/s/signature_differs.py b/tests/functional/s/signature_differs.py
index f4f80caf2..e74ee6e4f 100644
--- a/tests/functional/s/signature_differs.py
+++ b/tests/functional/s/signature_differs.py
@@ -28,5 +28,5 @@ class Ghij(Abcd):
self.aaa = aaa
def abcd(self, *args, **kwargs):
- """Test that a method with variadics does not trigger the warning"""
+ """Test that a method with variadics does not trigger the warning."""
return super().abcd(*args, **kwargs)
diff --git a/tests/functional/s/simplifiable/simplifiable_condition.py b/tests/functional/s/simplifiable/simplifiable_condition.py
index 32bf36aca..3642b4ecf 100644
--- a/tests/functional/s/simplifiable/simplifiable_condition.py
+++ b/tests/functional/s/simplifiable/simplifiable_condition.py
@@ -1,9 +1,9 @@
-"""Test that boolean conditions can be simplified"""
+"""Test that boolean conditions can be simplified."""
# pylint: disable=pointless-statement
def func(_):
- """Pointless function"""
+ """Pointless function."""
CONSTANT = 100
diff --git a/tests/functional/s/slots_checks.py b/tests/functional/s/slots_checks.py
index 79912b65c..f97a12ebb 100644
--- a/tests/functional/s/slots_checks.py
+++ b/tests/functional/s/slots_checks.py
@@ -1,4 +1,4 @@
-""" Checks that classes uses valid __slots__ """
+"""Checks that classes uses valid __slots__"""
# pylint: disable=too-few-public-methods, missing-docstring, useless-object-inheritance
# pylint: disable=using-constant-test, wrong-import-position, no-else-return, line-too-long, unused-private-member
@@ -13,7 +13,7 @@ def func():
class NotIterable(object):
def __iter_(self):
- """ do nothing """
+ """do nothing."""
class Good(object):
__slots__ = ()
diff --git a/tests/functional/s/star/star_needs_assignment_target_py37.py b/tests/functional/s/star/star_needs_assignment_target_py37.py
index fb5eea86a..250d3793f 100644
--- a/tests/functional/s/star/star_needs_assignment_target_py37.py
+++ b/tests/functional/s/star/star_needs_assignment_target_py37.py
@@ -1,7 +1,5 @@
-"""
-Test PEP 0448 -- Additional Unpacking Generalizations
-https://www.python.org/dev/peps/pep-0448/
-"""
+"""Test PEP 0448 -- Additional Unpacking Generalizations
+https://www.python.org/dev/peps/pep-0448/"""
# pylint: disable=superfluous-parens, unnecessary-comprehension
diff --git a/tests/functional/s/statement_without_effect.py b/tests/functional/s/statement_without_effect.py
index 31fc7250f..02b754edb 100644
--- a/tests/functional/s/statement_without_effect.py
+++ b/tests/functional/s/statement_without_effect.py
@@ -23,7 +23,7 @@ __revision__.lower(); # [unnecessary-semicolon]
list() and tuple() # [expression-not-assigned]
def to_be():
- """return 42"""
+ """return 42."""
return "42"
ANSWER = to_be() # ok
@@ -36,7 +36,7 @@ GOOD_ATTRIBUTE_DOCSTRING = 42
"""Module level attribute docstring is fine. """
class ClassLevelAttributeTest(object):
- """ test attribute docstrings. """
+ """test attribute docstrings."""
good_attribute_docstring = 24
""" class level attribute docstring is fine either. """
@@ -59,17 +59,17 @@ class ClassLevelAttributeTest(object):
self.val = val
def test(self):
- """ invalid attribute docstrings here. """
+ """invalid attribute docstrings here."""
self.val = 42
# +1:[pointless-string-statement]
""" this is an invalid attribute docstring. """
def ellipsis():
- """Test that an Ellipsis as a body does not trigger the error"""
+ """Test that an Ellipsis as a body does not trigger the error."""
...
class EllipsisBody:
- """Test that an Ellipsis as a body does not trigger the error"""
+ """Test that an Ellipsis as a body does not trigger the error."""
...
diff --git a/tests/functional/s/statement_without_effect_py36.py b/tests/functional/s/statement_without_effect_py36.py
index 59745ce2b..789443e83 100644
--- a/tests/functional/s/statement_without_effect_py36.py
+++ b/tests/functional/s/statement_without_effect_py36.py
@@ -3,7 +3,7 @@
class ClassLevelAttributeTest(object):
- """ test attribute docstrings. """
+ """test attribute docstrings."""
some_variable: int = 42
"""Data docstring"""
@@ -12,7 +12,7 @@ class ClassLevelAttributeTest(object):
"""Data docstring"""
def func(self):
- """Some Empty Docstring"""
+ """Some Empty Docstring."""
# +1: [pointless-string-statement]
"""useless"""
diff --git a/tests/functional/s/stop_iteration_inside_generator.py b/tests/functional/s/stop_iteration_inside_generator.py
index 822f63369..e41630c42 100644
--- a/tests/functional/s/stop_iteration_inside_generator.py
+++ b/tests/functional/s/stop_iteration_inside_generator.py
@@ -1,13 +1,9 @@
-"""
-Test that no StopIteration is raised inside a generator
-"""
+"""Test that no StopIteration is raised inside a generator."""
# pylint: disable=missing-docstring,invalid-name,import-error, try-except-raise, wrong-import-position,not-callable,raise-missing-from
import asyncio
class RebornStopIteration(StopIteration):
- """
- A class inheriting from StopIteration exception
- """
+ """A class inheriting from StopIteration exception."""
# This one is ok
def gen_ok():
diff --git a/tests/functional/s/string/string_formatting.py b/tests/functional/s/string/string_formatting.py
index b72e9f676..3c18fc37a 100644
--- a/tests/functional/s/string/string_formatting.py
+++ b/tests/functional/s/string/string_formatting.py
@@ -1,4 +1,4 @@
-"""Test for Python 3 string formatting error"""
+"""Test for Python 3 string formatting error."""
# pylint: disable=too-few-public-methods, import-error, unused-argument, line-too-long,
# pylint: disable=useless-object-inheritance, consider-using-f-string
@@ -9,35 +9,35 @@ from missing import Missing
class Custom(object):
- """ Has a __getattr__ """
+ """Has a __getattr__"""
def __getattr__(self, _):
return self
class Test(object):
- """ test format attribute access """
+ """test format attribute access."""
custom = Custom()
ids = [1, 2, 3, [4, 5, 6]]
class Getitem(object):
- """ test custom getitem for lookup access """
+ """test custom getitem for lookup access."""
def __getitem__(self, index):
return 42
class ReturnYes(object):
- """ can't be properly inferred """
+ """can't be properly inferred."""
missing = Missing()
def log(message, message_type="error"):
- """ Test """
+ """Test."""
return message
def print_good():
- """ Good format strings """
+ """Good format strings."""
"{0} {1}".format(1, 2)
"{0!r:20}".format("Hello")
"{!r:20}".format("Hello")
@@ -64,7 +64,7 @@ def print_good():
def pprint_bad():
- """Test string format """
+ """Test string format."""
"{{}}".format(1) # [format-string-without-interpolation]
"{} {".format() # [bad-format-string]
"{} }".format() # [bad-format-string]
@@ -105,18 +105,14 @@ def pprint_bad():
def good_issue288(*args, **kwargs):
- """ Test that using kwargs does not emit a false
- positive.
- """
+ """Test that using kwargs does not emit a false positive."""
'Hello John Doe {0[0]}'.format(args)
'Hello {0[name]}'.format(kwargs)
def good_issue287():
- """ Test that the string format checker skips
- format nodes which don't have a string as a parent
- (but a subscript, name etc).
- """
+ """Test that the string format checker skips format nodes which don't have a string
+ as a parent (but a subscript, name etc)."""
name = 'qwerty'
ret = {'comment': ''}
ret['comment'] = 'MySQL grant {0} is set to be revoked'
@@ -125,7 +121,7 @@ def good_issue287():
def nested_issue294():
- """ Test nested format fields. """
+ """Test nested format fields."""
'{0:>{1}}'.format(42, 24)
'{0:{a[1]}} {a}'.format(1, a=[1, 2])
'{:>{}}'.format(42, 24)
@@ -136,41 +132,34 @@ def nested_issue294():
def issue310():
- """ Test a regression using duplicate manual position arguments. """
+ """Test a regression using duplicate manual position arguments."""
'{0} {1} {0}'.format(1, 2)
'{0} {1} {0}'.format(1) # [too-few-format-args]
def issue322():
- """ Test a regression using mixed manual position arguments
- and attribute access arguments.
- """
+ """Test a regression using mixed manual position arguments and attribute access
+ arguments."""
'{0}{1[FOO]}'.format(123, {'FOO': 456})
'{0}{1[FOO]}'.format(123, {'FOO': 456}, 321) # [too-many-format-args]
'{0}{1[FOO]}'.format(123) # [too-few-format-args]
def issue338():
- """
- Check that using a namedtuple subclass doesn't crash when
- trying to infer EmptyNodes (resulted after mocking the
- members of namedtuples).
- """
+ """Check that using a namedtuple subclass doesn't crash when trying to infer
+ EmptyNodes (resulted after mocking the members of namedtuples)."""
from collections import namedtuple # pylint: disable=import-outside-toplevel
class Crash(namedtuple("C", "foo bar")):
- """ Looking for attributes in __str__ will crash,
- because EmptyNodes can't be inferred.
- """
+ """Looking for attributes in __str__ will crash, because EmptyNodes can't be
+ inferred."""
def __str__(self):
return "{0.foo}: {0.bar}".format(self)
return Crash
def issue351():
- """
- Check that the format method can be assigned to a variable, ie:
- """
+ """Check that the format method can be assigned to a variable, ie:"""
fmt = 'test {} {}'.format
fmt('arg1') # [too-few-format-args]
fmt('arg1', 'arg2')
@@ -178,11 +167,9 @@ def issue351():
def issue373():
- """
- Ignore any object coming from an argument.
- """
+ """Ignore any object coming from an argument."""
class SomeClass(object):
- """ empty docstring. """
+ """empty docstring."""
def __init__(self, opts=None):
self.opts = opts
@@ -198,10 +185,8 @@ def issue373():
def issue_463():
- """
- Mix positional arguments, `{0}`, with positional
- arguments with attribute access, `{0.__x__}`.
- """
+ """Mix positional arguments, `{0}`, with positional arguments with attribute access,
+ `{0.__x__}`."""
data = "{0.__class__.__name__}: {0}".format(42)
data2 = "{0[0]}: {0}".format([1])
return (data, data2)
@@ -214,7 +199,7 @@ def avoid_empty_attribute():
def invalid_format_index_on_inference_ambiguity():
- """Test inference bug for invalid-format-index"""
+ """Test inference bug for invalid-format-index."""
if len(sys.argv) > 1:
options = [["Woof!"]]
else:
diff --git a/tests/functional/s/string/string_formatting_disable.py b/tests/functional/s/string/string_formatting_disable.py
index 88f3dcf03..acf50d8fa 100644
--- a/tests/functional/s/string/string_formatting_disable.py
+++ b/tests/functional/s/string/string_formatting_disable.py
@@ -1 +1 @@
-"a {} {".format(1) # [bad-format-string]
+"""a {} {""".format(1) # [bad-format-string]
diff --git a/tests/functional/s/string/string_formatting_error.py b/tests/functional/s/string/string_formatting_error.py
index 681fedd56..dbc043f01 100644
--- a/tests/functional/s/string/string_formatting_error.py
+++ b/tests/functional/s/string/string_formatting_error.py
@@ -1,4 +1,4 @@
-"""test string format error"""
+"""test string format error."""
# pylint: disable=unsupported-binary-operation,line-too-long, consider-using-f-string
from __future__ import print_function
@@ -6,7 +6,7 @@ PARG_1 = PARG_2 = PARG_3 = 1
def pprint():
- """Test string format"""
+ """Test string format."""
print("%s %s" % {'PARG_1': 1, 'PARG_2': 2}) # [too-few-format-args]
print("%s" % (PARG_1, PARG_2)) # [too-many-format-args]
print("%(PARG_1)d %d" % {'PARG_1': 1, 'PARG_2': 2}) # [mixed-format-string]
diff --git a/tests/functional/s/string/string_formatting_failed_inference.py b/tests/functional/s/string/string_formatting_failed_inference.py
index e47ca5baa..d5251978f 100644
--- a/tests/functional/s/string/string_formatting_failed_inference.py
+++ b/tests/functional/s/string/string_formatting_failed_inference.py
@@ -1,4 +1,7 @@
-""" Testing string format with a failed inference. This should not crash. """
+"""Testing string format with a failed inference.
+
+This should not crash.
+"""
# pylint: disable=using-constant-test, consider-using-f-string
import collections
"{dict[0]}".format(dict=collections.defaultdict(int))
diff --git a/tests/functional/s/string/string_formatting_failed_inference_py35.py b/tests/functional/s/string/string_formatting_failed_inference_py35.py
index f4d3ef34e..c2f630990 100644
--- a/tests/functional/s/string/string_formatting_failed_inference_py35.py
+++ b/tests/functional/s/string/string_formatting_failed_inference_py35.py
@@ -1,4 +1,7 @@
-""" Testing string format with a failed inference. This should not crash. """
+"""Testing string format with a failed inference.
+
+This should not crash.
+"""
# pylint: disable=using-constant-test, consider-using-f-string
import collections
"{dict[0]}".format(dict=collections.defaultdict(int))
diff --git a/tests/functional/s/string/string_log_formatting.py b/tests/functional/s/string/string_log_formatting.py
index 3bed980f7..ac9dc62a9 100644
--- a/tests/functional/s/string/string_log_formatting.py
+++ b/tests/functional/s/string/string_log_formatting.py
@@ -1,14 +1,10 @@
-"""
-Test checking of log format strings
-"""
+"""Test checking of log format strings."""
import logging
def pprint():
- """
- Test string format in logging statements.
- """
+ """Test string format in logging statements."""
# These should all emit lint errors:
logging.info(0, '') # [logging-too-many-args]
diff --git a/tests/functional/s/subclassed_final_class_py38.py b/tests/functional/s/subclassed_final_class_py38.py
index 7f0671e75..55ea65b7a 100644
--- a/tests/functional/s/subclassed_final_class_py38.py
+++ b/tests/functional/s/subclassed_final_class_py38.py
@@ -1,5 +1,5 @@
"""Since Python version 3.8, a class decorated with typing.final cannot be
-subclassed """
+subclassed."""
# pylint: disable=no-init, useless-object-inheritance, missing-docstring, too-few-public-methods
diff --git a/tests/functional/s/super/super_checks.py b/tests/functional/s/super/super_checks.py
index 277feae7e..5dcffc6a3 100644
--- a/tests/functional/s/super/super_checks.py
+++ b/tests/functional/s/super/super_checks.py
@@ -4,44 +4,44 @@
from unknown import Missing
class Aaaa:
- """old style"""
+ """old style."""
def hop(self):
- """hop"""
+ """hop."""
super(Aaaa, self).hop() # >=3.0:[no-member]
def __init__(self):
super(Aaaa, self).__init__()
class NewAaaa(object):
- """old style"""
+ """old style."""
def hop(self):
- """hop"""
+ """hop."""
super(NewAaaa, self).hop() # [no-member]
def __init__(self):
super(Aaaa, self).__init__() # [bad-super-call]
class Py3kAaaa(NewAaaa):
- """new style"""
+ """new style."""
def __init__(self):
super().__init__() # <3.0:[missing-super-argument]
class Py3kWrongSuper(Py3kAaaa):
- """new style"""
+ """new style."""
def __init__(self):
super(NewAaaa, self).__init__() # [bad-super-call]
class WrongNameRegression(Py3kAaaa):
- """ test a regression with the message """
+ """test a regression with the message."""
def __init__(self):
super(Missing, self).__init__() # [bad-super-call]
class Getattr(object):
- """ crash """
+ """crash."""
name = NewAaaa
class CrashSuper(object):
- """ test a crash with this checker """
+ """test a crash with this checker."""
def __init__(self):
super(Getattr.name, self).__init__() # [bad-super-call]
@@ -50,6 +50,7 @@ class Empty(object):
class SuperDifferentScope(object):
"""Don'emit bad-super-call when the super call is in another scope.
+
For reference, see https://bitbucket.org/logilab/pylint/issue/403.
"""
@staticmethod
@@ -115,11 +116,11 @@ except AttributeError:
class SuperWithType(object):
- """type(self) may lead to recursion loop in derived classes"""
+ """type(self) may lead to recursion loop in derived classes."""
def __init__(self):
super(type(self), self).__init__() # [bad-super-call]
class SuperWithSelfClass(object):
- """self.__class__ may lead to recursion loop in derived classes"""
+ """self.__class__ may lead to recursion loop in derived classes."""
def __init__(self):
super(self.__class__, self).__init__() # [bad-super-call]
diff --git a/tests/functional/s/super/super_init_not_called.py b/tests/functional/s/super/super_init_not_called.py
index 5f2bf9ee8..708765203 100644
--- a/tests/functional/s/super/super_init_not_called.py
+++ b/tests/functional/s/super/super_init_not_called.py
@@ -1,13 +1,15 @@
-"""This should not emit a super-init-not-called warning. It previously did this, because
-``next(node.infer())`` was used in that checker's logic and the first inferred node
-was an Uninferable object, leading to this false positive."""
+"""This should not emit a super-init-not-called warning.
+
+It previously did this, because ``next(node.infer())`` was used in that checker's logic
+and the first inferred node was an Uninferable object, leading to this false positive.
+"""
# pylint: disable=too-few-public-methods
import ctypes
class Foo(ctypes.BigEndianStructure):
- """A class"""
+ """A class."""
def __init__(self):
ctypes.BigEndianStructure.__init__(self)
diff --git a/tests/functional/s/super/superfluous_parens_walrus_py38.py b/tests/functional/s/super/superfluous_parens_walrus_py38.py
index cf155954e..c7e877d4b 100644
--- a/tests/functional/s/super/superfluous_parens_walrus_py38.py
+++ b/tests/functional/s/super/superfluous_parens_walrus_py38.py
@@ -1,4 +1,5 @@
-"""Test the superfluous-parens warning with python 3.8 functionality (walrus operator)"""
+"""Test the superfluous-parens warning with python 3.8 functionality (walrus
+operator)"""
# pylint: disable=missing-function-docstring, invalid-name, missing-class-docstring, import-error
import numpy
diff --git a/tests/functional/s/symlink/module/__init__.py b/tests/functional/s/symlink/module/__init__.py
index cc8f6e411..6bfd62b63 100644
--- a/tests/functional/s/symlink/module/__init__.py
+++ b/tests/functional/s/symlink/module/__init__.py
@@ -1,3 +1,3 @@
-"""Example taken from issue #1470"""
+"""Example taken from issue #1470."""
from symlinked_module import func
diff --git a/tests/functional/s/symlink/module/symlinked_module.py b/tests/functional/s/symlink/module/symlinked_module.py
index c28a97a30..8f3f32b84 100644
--- a/tests/functional/s/symlink/module/symlinked_module.py
+++ b/tests/functional/s/symlink/module/symlinked_module.py
@@ -1,6 +1,6 @@
-"""Example taken from issue #1470"""
+"""Example taken from issue #1470."""
def func():
- """Both module should be parsed without problem"""
+ """Both module should be parsed without problem."""
return 1
diff --git a/tests/functional/s/sys_stream_regression_1004.py b/tests/functional/s/sys_stream_regression_1004.py
index c0391859d..6697e9d30 100644
--- a/tests/functional/s/sys_stream_regression_1004.py
+++ b/tests/functional/s/sys_stream_regression_1004.py
@@ -1,4 +1,4 @@
-'''Regression for issue https://github.com/PyCQA/pylint/issues/1004'''
+"""Regression for issue https://github.com/PyCQA/pylint/issues/1004."""
# pylint: disable=missing-docstring, pointless-statement
import sys
diff --git a/tests/functional/t/ternary.py b/tests/functional/t/ternary.py
index 58171942f..d4e431276 100644
--- a/tests/functional/t/ternary.py
+++ b/tests/functional/t/ternary.py
@@ -1,4 +1,4 @@
-"""Test for old ternary constructs"""
+"""Test for old ternary constructs."""
from UNINFERABLE import condition, true_value, false_value, some_callable # pylint: disable=import-error
SOME_VALUE1 = true_value if condition else false_value
@@ -6,12 +6,12 @@ SOME_VALUE2 = condition and true_value or false_value # [consider-using-ternary
SOME_VALUE3 = condition
def func1():
- """Ternary return value correct"""
+ """Ternary return value correct."""
return true_value if condition else false_value
def func2():
- """Ternary return value incorrect"""
+ """Ternary return value incorrect."""
return condition and true_value or false_value # [consider-using-ternary]
@@ -28,12 +28,12 @@ IS_LEAP_YEAR = YEAR % 4 == 0 and YEAR % 100 != 0 or YEAR % 400 == 0
def func4():
- """"Using a Name as a condition but still emits"""
+ """"Using a Name as a condition but still emits."""
truth_value = 42
return condition and truth_value or false_value # [consider-using-ternary]
def func5():
- """"Using a Name that infers to False as a condition does not emit"""
+ """"Using a Name that infers to False as a condition does not emit."""
falsy_value = False
return condition and falsy_value or false_value # [simplify-boolean-expression]
diff --git a/tests/functional/t/too/too_few_public_methods.py b/tests/functional/t/too/too_few_public_methods.py
index 5ba528f79..6a237f12e 100644
--- a/tests/functional/t/too/too_few_public_methods.py
+++ b/tests/functional/t/too/too_few_public_methods.py
@@ -19,13 +19,13 @@ class Aaaa(object): # [too-few-public-methods]
# Don't emit for these cases.
class Klass(object):
- """docstring"""
+ """docstring."""
def meth1(self):
- """first"""
+ """first."""
def meth2(self):
- """second"""
+ """second."""
class EnoughPublicMethods(Klass):
diff --git a/tests/functional/t/too/too_few_public_methods_excluded.py b/tests/functional/t/too/too_few_public_methods_excluded.py
index 2ee8f1c4a..eeff51d5e 100644
--- a/tests/functional/t/too/too_few_public_methods_excluded.py
+++ b/tests/functional/t/too/too_few_public_methods_excluded.py
@@ -9,5 +9,5 @@ class MyJsonEncoder(JSONEncoder):
...
class InheritedInModule(Control):
- """This class inherits from a class that doesn't have enough methods,
- and its parent is excluded via config, so it doesn't raise."""
+ """This class inherits from a class that doesn't have enough methods, and its parent
+ is excluded via config, so it doesn't raise."""
diff --git a/tests/functional/t/too/too_many_ancestors_ignored_parents.py b/tests/functional/t/too/too_many_ancestors_ignored_parents.py
index 93598d941..a6dcbe372 100644
--- a/tests/functional/t/too/too_many_ancestors_ignored_parents.py
+++ b/tests/functional/t/too/too_many_ancestors_ignored_parents.py
@@ -22,19 +22,19 @@
# of parents.
class F:
- """0 parents"""
+ """0 parents."""
class E(F):
- """1 parent"""
+ """1 parent."""
class D:
- """0 parents"""
+ """0 parents."""
class B(D, E):
- """3 parents"""
+ """3 parents."""
class C:
- """0 parents"""
+ """0 parents."""
class A(B, C): # [too-many-ancestors]
- """5 parents"""
+ """5 parents."""
diff --git a/tests/functional/t/too/too_many_arguments.py b/tests/functional/t/too/too_many_arguments.py
index 689745e27..54166ea7f 100644
--- a/tests/functional/t/too/too_many_arguments.py
+++ b/tests/functional/t/too/too_many_arguments.py
@@ -26,7 +26,7 @@ def root_function(first, second, third):
def func_call():
- """Test we don't emit a FP for https://github.com/PyCQA/pylint/issues/2588"""
+ """Test we don't emit a FP for https://github.com/PyCQA/pylint/issues/2588."""
partial_func = partial(root_function, 1, 2, 3)
partial_func()
return root_function(1, 2, 3)
diff --git a/tests/functional/t/too/too_many_boolean_expressions.py b/tests/functional/t/too/too_many_boolean_expressions.py
index e8753859c..f6b9191a6 100644
--- a/tests/functional/t/too/too_many_boolean_expressions.py
+++ b/tests/functional/t/too/too_many_boolean_expressions.py
@@ -1,4 +1,4 @@
-"""Checks for if statements containing too many boolean expressions"""
+"""Checks for if statements containing too many boolean expressions."""
# pylint: disable=invalid-name, comparison-with-itself, chained-comparison, condition-evals-to-constant
diff --git a/tests/functional/t/too/too_many_branches.py b/tests/functional/t/too/too_many_branches.py
index 7b0b068ad..de19d25e8 100644
--- a/tests/functional/t/too/too_many_branches.py
+++ b/tests/functional/t/too/too_many_branches.py
@@ -1,7 +1,7 @@
-""" Test for too many branches. """
+"""Test for too many branches."""
# pylint: disable=using-constant-test
def wrong(): # [too-many-branches]
- """ Has too many branches. """
+ """Has too many branches."""
if 1:
pass
elif 1:
@@ -30,11 +30,9 @@ def wrong(): # [too-many-branches]
pass
def good():
- """ Too many branches only if we take
- into consideration the nested functions.
- """
+ """Too many branches only if we take into consideration the nested functions."""
def nested_1():
- """ empty """
+ """empty."""
if 1:
pass
elif 2:
diff --git a/tests/functional/t/too/too_many_function_args.py b/tests/functional/t/too/too_many_function_args.py
index c5ca4f78e..4316297eb 100644
--- a/tests/functional/t/too/too_many_function_args.py
+++ b/tests/functional/t/too/too_many_function_args.py
@@ -1,18 +1,18 @@
-"""https://github.com/PyCQA/pylint/issues/3675"""
+"""https://github.com/PyCQA/pylint/issues/3675."""
def noop(x): # pylint: disable=invalid-name
- """Return value unchanged"""
+ """Return value unchanged."""
return x
def add(x, y): # pylint: disable=invalid-name
- """Add two values"""
+ """Add two values."""
return x + y
def main(param):
- """Should not emit too-many-function-args"""
+ """Should not emit too-many-function-args."""
tmp = noop # matched first
if param == 0:
tmp = add
diff --git a/tests/functional/t/too/too_many_locals.py b/tests/functional/t/too/too_many_locals.py
index ac38a9e01..9b05ac473 100644
--- a/tests/functional/t/too/too_many_locals.py
+++ b/tests/functional/t/too/too_many_locals.py
@@ -10,7 +10,7 @@ def function(arg1, arg2, arg3, arg4, arg5): # [too-many-locals]
def too_many_locals_function(): # [too-many-locals]
- """pylint will complains about too many local variables"""
+ """pylint will complains about too many local variables."""
args0 = 0
args1 = args0 * 1
args2 = args1 * 2
diff --git a/tests/functional/t/too/too_many_nested_blocks.py b/tests/functional/t/too/too_many_nested_blocks.py
index e7c007957..7ef28809a 100644
--- a/tests/functional/t/too/too_many_nested_blocks.py
+++ b/tests/functional/t/too/too_many_nested_blocks.py
@@ -1,4 +1,4 @@
-"""Checks the maximum block level is smaller than 6 in function definitions"""
+"""Checks the maximum block level is smaller than 6 in function definitions."""
#pylint: disable=using-constant-test, missing-docstring, too-many-return-statements,no-else-return
diff --git a/tests/functional/t/too/too_many_public_methods.py b/tests/functional/t/too/too_many_public_methods.py
index 11b4b367d..3c1058304 100644
--- a/tests/functional/t/too/too_many_public_methods.py
+++ b/tests/functional/t/too/too_many_public_methods.py
@@ -6,74 +6,74 @@ class Aaaa(object): # [too-many-public-methods]
pass
def meth1(self):
- """hehehe"""
+ """hehehe."""
def meth2(self):
- """hehehe"""
+ """hehehe."""
def meth3(self):
- """hehehe"""
+ """hehehe."""
def meth4(self):
- """hehehe"""
+ """hehehe."""
def meth5(self):
- """hehehe"""
+ """hehehe."""
def meth6(self):
- """hehehe"""
+ """hehehe."""
def meth7(self):
- """hehehe"""
+ """hehehe."""
def meth8(self):
- """hehehe"""
+ """hehehe."""
def meth9(self):
- """hehehe"""
+ """hehehe."""
def meth10(self):
- """hehehe"""
+ """hehehe."""
def meth11(self):
- """hehehe"""
+ """hehehe."""
def meth12(self):
- """hehehe"""
+ """hehehe."""
def meth13(self):
- """hehehe"""
+ """hehehe."""
def meth14(self):
- """hehehe"""
+ """hehehe."""
def meth15(self):
- """hehehe"""
+ """hehehe."""
def meth16(self):
- """hehehe"""
+ """hehehe."""
def meth17(self):
- """hehehe"""
+ """hehehe."""
def meth18(self):
- """hehehe"""
+ """hehehe."""
def meth19(self):
- """hehehe"""
+ """hehehe."""
def meth20(self):
- """hehehe"""
+ """hehehe."""
def meth21(self):
- """hehehe"""
+ """hehehe."""
def _dontcount(self):
- """not public"""
+ """not public."""
class BBB(Aaaa):
"""Don't emit for methods defined in the parent."""
def meth1(self):
- """trop"""
+ """trop."""
def meth2(self):
- """tzop"""
+ """tzop."""
diff --git a/tests/functional/t/too/too_many_return_statements.py b/tests/functional/t/too/too_many_return_statements.py
index b9f35a2ad..e04faef97 100644
--- a/tests/functional/t/too/too_many_return_statements.py
+++ b/tests/functional/t/too/too_many_return_statements.py
@@ -25,7 +25,7 @@ def stupid_function(arg): # [too-many-return-statements]
def many_yield(text):
- """Not a problem"""
+ """Not a problem."""
if text:
yield f" line 1: {text}\n"
yield " line 2\n"
diff --git a/tests/functional/t/trailing_whitespaces.py b/tests/functional/t/trailing_whitespaces.py
index 48de809c6..0e7a11633 100644
--- a/tests/functional/t/trailing_whitespaces.py
+++ b/tests/functional/t/trailing_whitespaces.py
@@ -6,6 +6,6 @@ from __future__ import print_function
print('some trailing whitespace')
# +1: [trailing-whitespace]
print('trailing whitespace does not count towards the line length limit')
-print('windows line ends are ok')
-# +1: [trailing-whitespace]
-print('but trailing whitespace on win is not')
+print('windows line ends are ok')
+# +1: [trailing-whitespace]
+print('but trailing whitespace on win is not')
diff --git a/tests/functional/t/try_except_raise.py b/tests/functional/t/try_except_raise.py
index 006a29bf9..fbf86c983 100644
--- a/tests/functional/t/try_except_raise.py
+++ b/tests/functional/t/try_except_raise.py
@@ -25,15 +25,15 @@ except:
class AAAException(Exception):
- """AAAException"""
+ """AAAException."""
pass
class BBBException(AAAException):
- """BBBException"""
+ """BBBException."""
pass
def ccc():
- """try-except-raise test function"""
+ """try-except-raise test function."""
try:
raise BBBException("asdf")
@@ -44,7 +44,7 @@ def ccc():
def ddd():
- """try-except-raise test function"""
+ """try-except-raise test function."""
try:
raise BBBException("asdf")
diff --git a/tests/functional/t/typedDict.py b/tests/functional/t/typedDict.py
index 3ce96b256..d1d8837d9 100644
--- a/tests/functional/t/typedDict.py
+++ b/tests/functional/t/typedDict.py
@@ -1,4 +1,4 @@
-"""Test typing.TypedDict"""
+"""Test typing.TypedDict."""
# pylint: disable=invalid-name,missing-class-docstring,pointless-statement
import typing
from typing import TypedDict
diff --git a/tests/functional/t/typing_generic.py b/tests/functional/t/typing_generic.py
index 191d9982d..8e0bab0af 100644
--- a/tests/functional/t/typing_generic.py
+++ b/tests/functional/t/typing_generic.py
@@ -8,10 +8,10 @@ from typing import Generic, TypeVar
T = TypeVar("T")
class Base(Generic[T], metaclass=ABCMeta):
- """Base"""
+ """Base."""
class Impl(Base[str]):
- """Impl"""
+ """Impl."""
# https://github.com/PyCQA/astroid/issues/942
diff --git a/tests/functional/t/typing_use.py b/tests/functional/t/typing_use.py
index b92a08722..ab7f6209c 100644
--- a/tests/functional/t/typing_use.py
+++ b/tests/functional/t/typing_use.py
@@ -19,7 +19,7 @@ def double_with_docstring(arg):
def double_with_docstring(arg): # [function-redefined]
- """Redefined function implementation"""
+ """Redefined function implementation."""
return 2 * arg
diff --git a/tests/functional/u/unbalanced_tuple_unpacking.py b/tests/functional/u/unbalanced_tuple_unpacking.py
index 4deb6ce37..b8baaa66c 100644
--- a/tests/functional/u/unbalanced_tuple_unpacking.py
+++ b/tests/functional/u/unbalanced_tuple_unpacking.py
@@ -1,4 +1,4 @@
-"""Check possible unbalanced tuple unpacking """
+"""Check possible unbalanced tuple unpacking."""
from __future__ import absolute_import
from typing import NamedTuple
from functional.u.unpacking import unpack
@@ -26,33 +26,33 @@ def do_stuff3():
return first + second
def do_stuff4():
- """ This is right """
+ """This is right."""
first, second = 1, 2
return first + second
def do_stuff5():
- """ This is also right """
+ """This is also right."""
first, second = (1, 2)
return first + second
def do_stuff6():
- """ This is right """
+ """This is right."""
(first, second) = (1, 2)
return first + second
def temp():
- """ This is not weird """
+ """This is not weird."""
if True:
return [1, 2]
return [2, 3, 4]
def do_stuff7():
- """ This is not right, but we're not sure """
+ """This is not right, but we're not sure."""
first, second = temp()
return first + second
def temp2():
- """ This is weird, but correct """
+ """This is weird, but correct."""
if True:
return (1, 2)
@@ -61,20 +61,20 @@ def temp2():
return (4, 5)
def do_stuff8():
- """ This is correct """
+ """This is correct."""
first, second = temp2()
return first + second
def do_stuff9():
- """ This is not correct """
+ """This is not correct."""
first, second = unpack() # [unbalanced-tuple-unpacking]
return first + second
class UnbalancedUnpacking(object):
- """ Test unbalanced tuple unpacking in instance attributes. """
+ """Test unbalanced tuple unpacking in instance attributes."""
# pylint: disable=attribute-defined-outside-init, invalid-name, too-few-public-methods
def test(self):
- """ unpacking in instance attributes """
+ """unpacking in instance attributes."""
# we're not sure if temp() returns two or three values
# so we shouldn't emit an error
self.a, self.b = temp()
@@ -83,16 +83,14 @@ class UnbalancedUnpacking(object):
def issue329(*args):
- """ Don't emit unbalanced tuple unpacking if the
- rhs of the assignment is a variable-length argument,
- because we don't know the actual length of the tuple.
- """
+ """Don't emit unbalanced tuple unpacking if the rhs of the assignment is a variable-
+ length argument, because we don't know the actual length of the tuple."""
first, second, third = args
return first, second, third
def test_decimal():
- """Test a false positive with decimal.Decimal.as_tuple
+ """Test a false positive with decimal.Decimal.as_tuple.
See astroid https://bitbucket.org/logilab/astroid/issues/92/
"""
@@ -115,16 +113,16 @@ class MyClass(NamedTuple):
third: float = 1.0
def my_sum(self):
- """Unpack 3 variables"""
+ """Unpack 3 variables."""
first, second, third = self
return first + second + third
def sum_unpack_3_into_4(self):
- """Attempt to unpack 3 variables into 4"""
+ """Attempt to unpack 3 variables into 4."""
first, second, third, fourth = self # [unbalanced-tuple-unpacking]
return first + second + third + fourth
def sum_unpack_3_into_2(self):
- """Attempt to unpack 3 variables into 2"""
+ """Attempt to unpack 3 variables into 2."""
first, second = self # [unbalanced-tuple-unpacking]
return first + second
diff --git a/tests/functional/u/unbalanced_tuple_unpacking_py30.py b/tests/functional/u/unbalanced_tuple_unpacking_py30.py
index 68f5fb79a..382af7c6f 100644
--- a/tests/functional/u/unbalanced_tuple_unpacking_py30.py
+++ b/tests/functional/u/unbalanced_tuple_unpacking_py30.py
@@ -1,11 +1,10 @@
-""" Test that using starred nodes in unpacking
-does not trigger a false positive on Python 3.
-"""
+"""Test that using starred nodes in unpacking does not trigger a false positive on
+Python 3."""
__revision__ = 1
def test():
- """ Test that starred expressions don't give false positives. """
+ """Test that starred expressions don't give false positives."""
first, second, *last = (1, 2, 3, 4)
*last, = (1, 2)
return (first, second, last)
diff --git a/tests/functional/u/undefined/undefined_variable.py b/tests/functional/u/undefined/undefined_variable.py
index 6ce9aaa6e..28230fa0d 100644
--- a/tests/functional/u/undefined/undefined_variable.py
+++ b/tests/functional/u/undefined/undefined_variable.py
@@ -14,7 +14,7 @@ if DEFINED != 1:
def in_method(var):
- """method doc"""
+ """method doc."""
var = nomoreknown # [undefined-variable]
assert var
@@ -25,7 +25,7 @@ DEFINED[__revision__] = OTHER = 'move this is astroid test'
OTHER += '$'
def bad_default(var, default=unknown2): # [undefined-variable]
- """function with default arg's value set to an nonexistent name"""
+ """function with default arg's value set to an nonexistent name."""
print(var, default)
print(xxxx) # [undefined-variable]
augvar += 1 # [undefined-variable]
@@ -60,7 +60,7 @@ except ValueError:
print(PLOUF)
def if_branch_test(something):
- """hop"""
+ """hop."""
if something == 0:
if xxx == 1: # [used-before-assignment]
pass
@@ -89,48 +89,46 @@ def main():
# Test shared scope.
def test_arguments(arg=TestClass): # [used-before-assignment]
- """ TestClass isn't defined yet. """
+ """TestClass isn't defined yet."""
return arg
class TestClass(Ancestor): # [used-before-assignment]
- """ contains another class, which uses an undefined ancestor. """
+ """contains another class, which uses an undefined ancestor."""
class MissingAncestor(Ancestor1): # [used-before-assignment]
- """ no op """
+ """no op."""
def test1(self):
- """ It should trigger here, because the two classes
- have the same scope.
- """
+ """It should trigger here, because the two classes have the same scope."""
class UsingBeforeDefinition(Empty): # [used-before-assignment]
- """ uses Empty before definition """
+ """uses Empty before definition."""
class Empty(object):
- """ no op """
+ """no op."""
return UsingBeforeDefinition
def test(self):
- """ Ancestor isn't defined yet, but we don't care. """
+ """Ancestor isn't defined yet, but we don't care."""
class MissingAncestor1(Ancestor):
- """ no op """
+ """no op."""
return MissingAncestor1
class Self(object):
- """ Detect when using the same name inside the class scope. """
+ """Detect when using the same name inside the class scope."""
obj = Self # [undefined-variable]
class Self1(object):
- """ No error should be raised here. """
+ """No error should be raised here."""
def test(self):
- """ empty """
+ """empty."""
return Self1
class Ancestor(object):
- """ No op """
+ """No op."""
class Ancestor1(object):
- """ No op """
+ """No op."""
NANA = BAT # [undefined-variable]
del BAT
@@ -147,7 +145,7 @@ class KeywordArgument(object):
"""enabled is undefined at this point, but it is used before assignment."""
def test2(self, is_disabled=disabled): # [undefined-variable]
- """disabled is undefined"""
+ """disabled is undefined."""
enabled = True
@@ -343,33 +341,33 @@ else:
# Tests for annotation of variables and potentially undefinition
def value_and_type_assignment():
- """The variable assigned a value and type"""
+ """The variable assigned a value and type."""
variable: int = 2
print(variable)
def only_type_assignment():
- """The variable never gets assigned a value"""
+ """The variable never gets assigned a value."""
variable: int
print(variable) # [undefined-variable]
def both_type_and_value_assignment():
- """The variable first gets a type and subsequently a value"""
+ """The variable first gets a type and subsequently a value."""
variable: int
variable = 1
print(variable)
def value_assignment_after_access():
- """The variable gets a value after it has been accessed"""
+ """The variable gets a value after it has been accessed."""
variable: int
print(variable) # [undefined-variable]
variable = 1
def value_assignment_from_iterator():
- """The variables gets a value from an iterator"""
+ """The variables gets a value from an iterator."""
variable: int
for variable in (1, 2):
print(variable)
@@ -379,7 +377,7 @@ GLOBAL_VAR: int
GLOBAL_VAR_TWO: int
def global_var_mixed_assignment():
- """One global variable never gets assigned a value"""
+ """One global variable never gets assigned a value."""
global GLOBAL_VAR
print(GLOBAL_VAR) # [undefined-variable]
global GLOBAL_VAR_TWO
@@ -393,14 +391,17 @@ GLOBAL_VAR_TWO: int
def assignment_in_comprehension():
- """A previously typed variables gets used in a comprehension. Don't crash!"""
+ """A previously typed variables gets used in a comprehension.
+
+ Don't crash!
+ """
some_list: List[int]
some_list = [1, 2, 3]
some_list = [i * 2 for i in some_list]
def decorator_returning_function():
- """A decorator that returns a wrapper function with decoupled typing"""
+ """A decorator that returns a wrapper function with decoupled typing."""
def wrapper_with_decoupled_typing():
print(var)
@@ -410,7 +411,7 @@ def decorator_returning_function():
def decorator_returning_incorrect_function():
- """A decorator that returns a wrapper function with decoupled typing"""
+ """A decorator that returns a wrapper function with decoupled typing."""
def wrapper_with_type_and_no_value():
print(var) # [undefined-variable]
@@ -419,7 +420,7 @@ def decorator_returning_incorrect_function():
def typing_and_value_assignment_with_tuple_assignment():
- """The typed variables get assigned with a tuple assignment"""
+ """The typed variables get assigned with a tuple assignment."""
var_one: int
var_two: int
var_one, var_two = 1, 1
diff --git a/tests/functional/u/undefined/undefined_variable_classes.py b/tests/functional/u/undefined/undefined_variable_classes.py
index 364e24942..d427b5ba7 100644
--- a/tests/functional/u/undefined/undefined_variable_classes.py
+++ b/tests/functional/u/undefined/undefined_variable_classes.py
@@ -1,4 +1,4 @@
-"""Tests for undefined-variable related to classes"""
+"""Tests for undefined-variable related to classes."""
# pylint: disable=missing-function-docstring, missing-class-docstring, too-few-public-methods
# Test that list comprehensions in base classes are scoped correctly
diff --git a/tests/functional/u/undefined/undefined_variable_decorators.py b/tests/functional/u/undefined/undefined_variable_decorators.py
index 359737289..99cf14b43 100644
--- a/tests/functional/u/undefined/undefined_variable_decorators.py
+++ b/tests/functional/u/undefined/undefined_variable_decorators.py
@@ -1,4 +1,4 @@
-"""Tests for undefined-variable related to decorators"""
+"""Tests for undefined-variable related to decorators."""
# pylint: disable=missing-function-docstring, missing-class-docstring, too-few-public-methods
# pylint: disable=unnecessary-comprehension
diff --git a/tests/functional/u/undefined/undefined_variable_py30.py b/tests/functional/u/undefined/undefined_variable_py30.py
index b9b64ec5e..60f22a678 100644
--- a/tests/functional/u/undefined/undefined_variable_py30.py
+++ b/tests/functional/u/undefined/undefined_variable_py30.py
@@ -1,82 +1,81 @@
-"""Test warnings about access to undefined variables
-for various Python 3 constructs. """
+"""Test warnings about access to undefined variables for various Python 3 constructs."""
# pylint: disable=too-few-public-methods, no-init, no-self-use, import-error
# pylint: disable=wrong-import-position, invalid-metaclass, useless-object-inheritance
class Undefined:
- """ test various annotation problems. """
+ """test various annotation problems."""
def test(self)->Undefined: # [undefined-variable]
- """ used Undefined, which is Undefined in this scope. """
+ """used Undefined, which is Undefined in this scope."""
Undefined = True
def test1(self)->Undefined:
- """ This Undefined exists at local scope. """
+ """This Undefined exists at local scope."""
def test2(self):
- """ This should not emit. """
+ """This should not emit."""
def func()->Undefined:
- """ empty """
+ """empty."""
return 2
return func
class Undefined1:
- """ Other annotation problems. """
+ """Other annotation problems."""
Undef = 42
ABC = 42
class InnerScope:
- """ Test inner scope definition. """
+ """Test inner scope definition."""
def test_undefined(self)->Undef: # [undefined-variable]
- """ Looking at a higher scope is impossible. """
+ """Looking at a higher scope is impossible."""
def test1(self)->ABC: # [undefined-variable]
- """ Triggers undefined-variable. """
+ """Triggers undefined-variable."""
class FalsePositive342(object):
# pylint: disable=line-too-long
- """ Fix some false positives found in
- https://bitbucket.org/logilab/pylint/issue/342/spurious-undefined-variable-for-class
- """
+ """Fix some false positives found in
+ https://bitbucket.org/logilab/pylint/issue/342/spurious-undefined-variable- for-
+ class."""
top = 42
def test_good(self, bac: top):
- """ top is defined at this moment. """
+ """top is defined at this moment."""
def test_bad(self, bac: trop): # [undefined-variable]
- """ trop is undefined at this moment. """
+ """trop is undefined at this moment."""
def test_bad1(self, *args: trop1): # [undefined-variable]
- """ trop1 is undefined at this moment. """
+ """trop1 is undefined at this moment."""
def test_bad2(self, **bac: trop2): # [undefined-variable]
- """ trop2 is undefined at this moment. """
+ """trop2 is undefined at this moment."""
import abc
from abc import ABCMeta
class Bad(metaclass=ABCMet): # [undefined-variable]
- """ Notice the typo """
+ """Notice the typo."""
class SecondBad(metaclass=ab.ABCMeta): # [undefined-variable]
- """ Notice the `ab` module. """
+ """Notice the `ab` module."""
class Good(metaclass=int):
- """ int is not a proper metaclass, but it is defined. """
+ """int is not a proper metaclass, but it is defined."""
class SecondGood(metaclass=Good):
- """ empty """
+ """empty."""
class ThirdGood(metaclass=ABCMeta):
- """ empty """
+ """empty."""
class FourthGood(ThirdGood):
- """ This should not trigger anything. """
+ """This should not trigger anything."""
class FifthGood(metaclass=abc.Metaclass):
"""Metaclasses can come from imported modules."""
diff --git a/tests/functional/u/undefined/undefined_variable_py38.py b/tests/functional/u/undefined/undefined_variable_py38.py
index 4ecc25133..9dc34ae0e 100644
--- a/tests/functional/u/undefined/undefined_variable_py38.py
+++ b/tests/functional/u/undefined/undefined_variable_py38.py
@@ -1,11 +1,11 @@
-"""Tests for undefined variable with assignment expressions"""
+"""Tests for undefined variable with assignment expressions."""
# pylint: disable=using-constant-test, expression-not-assigned
# Tests for annotation of variables and potentially undefinition
def typing_and_assignment_expression():
- """The variable gets assigned in an assignment expression"""
+ """The variable gets assigned in an assignment expression."""
var: int
if (var := 1 ** 2):
print(var)
@@ -19,7 +19,7 @@ def typing_and_self_referencing_assignment_expression():
def typed_assignment_in_function_default(param: str = (typed_default := "walrus")) -> None:
- """An annotated assignment expression in a default parameter should not emit"""
+ """An annotated assignment expression in a default parameter should not emit."""
return param
@@ -27,7 +27,7 @@ print(typed_default)
def assignment_in_function_default(param = (default := "walrus")) -> None:
- """An assignment expression in a default parameter should not emit"""
+ """An assignment expression in a default parameter should not emit."""
return param
@@ -35,7 +35,7 @@ print(default)
def no_assignment_in_function_default(param: str = "walrus") -> None:
- """No annotated assignment expression should emit"""
+ """No annotated assignment expression should emit."""
return param
@@ -43,7 +43,7 @@ print(no_default) # [undefined-variable]
def no_parameters_in_function_default() -> None:
- """Regression tests for functions without any parameters"""
+ """Regression tests for functions without any parameters."""
return
diff --git a/tests/functional/u/undefined/undefined_variable_typing.py b/tests/functional/u/undefined/undefined_variable_typing.py
index aa24362d3..a20c3255b 100644
--- a/tests/functional/u/undefined/undefined_variable_typing.py
+++ b/tests/functional/u/undefined/undefined_variable_typing.py
@@ -1,4 +1,4 @@
-"""Tests for undefined-variable related to typing"""
+"""Tests for undefined-variable related to typing."""
# pylint: disable=invalid-name, import-error
# Ensure attribute lookups in type comments are accounted for.
diff --git a/tests/functional/u/unexpected_keyword_arg.py b/tests/functional/u/unexpected_keyword_arg.py
index e7b648899..958decc95 100644
--- a/tests/functional/u/unexpected_keyword_arg.py
+++ b/tests/functional/u/unexpected_keyword_arg.py
@@ -1,9 +1,9 @@
-"""Tests for unexpected-keyword-arg"""
+"""Tests for unexpected-keyword-arg."""
# pylint: disable=undefined-variable, too-few-public-methods, missing-function-docstring, missing-class-docstring
def non_param_decorator(func):
- """Decorator without a parameter"""
+ """Decorator without a parameter."""
def new_func():
func()
@@ -12,7 +12,7 @@ def non_param_decorator(func):
def param_decorator(func):
- """Decorator with a parameter"""
+ """Decorator with a parameter."""
def new_func(internal_arg=3):
func(junk=internal_arg)
@@ -22,6 +22,7 @@ def param_decorator(func):
def kwargs_decorator(func):
"""Decorator with kwargs.
+
The if ... else makes the double decoration with param_decorator valid.
"""
@@ -36,7 +37,10 @@ def kwargs_decorator(func):
@non_param_decorator
def do_something(junk=None):
- """A decorated function. This should not be passed a keyword argument"""
+ """A decorated function.
+
+ This should not be passed a keyword argument
+ """
print(junk)
@@ -45,7 +49,10 @@ do_something(internal_arg=2) # [unexpected-keyword-arg]
@param_decorator
def do_something_decorated(junk=None):
- """A decorated function. This should be passed a keyword argument"""
+ """A decorated function.
+
+ This should be passed a keyword argument
+ """
print(junk)
@@ -54,7 +61,10 @@ do_something_decorated(internal_arg=2)
@kwargs_decorator
def do_something_decorated_too(junk=None):
- """A decorated function. This should be passed a keyword argument"""
+ """A decorated function.
+
+ This should be passed a keyword argument
+ """
print(junk)
@@ -64,8 +74,10 @@ do_something_decorated_too(internal_arg=2)
@non_param_decorator
@kwargs_decorator
def do_something_double_decorated(junk=None):
- """A decorated function. This should not be passed a keyword argument.
- non_param_decorator will raise an exception if a keyword argument is passed.
+ """A decorated function.
+
+ This should not be passed a keyword argument. non_param_decorator will raise an
+ exception if a keyword argument is passed.
"""
print(junk)
@@ -76,7 +88,10 @@ do_something_double_decorated(internal_arg=2) # [unexpected-keyword-arg]
@param_decorator
@kwargs_decorator
def do_something_double_decorated_correct(junk=None):
- """A decorated function. This should be passed a keyword argument"""
+ """A decorated function.
+
+ This should be passed a keyword argument
+ """
print(junk)
diff --git a/tests/functional/u/ungrouped_imports.py b/tests/functional/u/ungrouped_imports.py
index ace3a8e3f..c202cd3b7 100644
--- a/tests/functional/u/ungrouped_imports.py
+++ b/tests/functional/u/ungrouped_imports.py
@@ -1,4 +1,4 @@
-"""Checks import order rule"""
+"""Checks import order rule."""
# pylint: disable=unused-import,wrong-import-position,wrong-import-order,using-constant-test
# pylint: disable=import-error
import six
diff --git a/tests/functional/u/ungrouped_imports_isort_compatible.py b/tests/functional/u/ungrouped_imports_isort_compatible.py
index 2e64ed402..b9ad1bf7d 100644
--- a/tests/functional/u/ungrouped_imports_isort_compatible.py
+++ b/tests/functional/u/ungrouped_imports_isort_compatible.py
@@ -1,4 +1,4 @@
-"""Checks import order rule with imports that isort could generate"""
+"""Checks import order rule with imports that isort could generate."""
# pylint: disable=unused-import
import astroid
import isort
diff --git a/tests/functional/u/unnecessary/unnecessary_ellipsis.py b/tests/functional/u/unnecessary/unnecessary_ellipsis.py
index b5a61e349..af46f4f5e 100644
--- a/tests/functional/u/unnecessary/unnecessary_ellipsis.py
+++ b/tests/functional/u/unnecessary/unnecessary_ellipsis.py
@@ -1,4 +1,4 @@
-"""Emit a warning when the ellipsis constant is used and can be avoided"""
+"""Emit a warning when the ellipsis constant is used and can be avoided."""
# pylint: disable=missing-docstring, too-few-public-methods
@@ -24,12 +24,12 @@ if "X" is type(...):
...
def docstring_only():
- '''In Python, stubbed functions often have a body that contains just a
- single `...` constant, indicating that the function doesn't do
- anything. However, a stubbed function can also have just a
- docstring, and function with a docstring and no body also does
- nothing.
- '''
+ """In Python, stubbed functions often have a body that contains just a single `...`
+ constant, indicating that the function doesn't do anything.
+
+ However, a stubbed function can also have just a docstring, and function with a
+ docstring and no body also does nothing.
+ """
# This function has no docstring, so it needs a `...` constant.
@@ -38,21 +38,20 @@ def ellipsis_only():
def docstring_and_ellipsis():
- '''This function doesn't do anything, but it has a docstring, so its
- `...` constant is useless clutter.
+ """This function doesn't do anything, but it has a docstring, so its `...` constant
+ is useless clutter.
NEW CHECK: unnecessary-ellipsis
This would check for stubs with both docstrings and `...`
constants, suggesting the removal of the useless `...`
constants
- '''
+ """
... # [unnecessary-ellipsis]
class DocstringOnly:
- '''The same goes for class stubs: docstring, or `...`, but not both.
- '''
+ """The same goes for class stubs: docstring, or `...`, but not both."""
# No problem
@@ -61,8 +60,10 @@ class EllipsisOnly:
class DocstringAndEllipsis:
- '''Whoops! Mark this one as bad too.
- '''
+ """Whoops!
+
+ Mark this one as bad too.
+ """
... # [unnecessary-ellipsis]
diff --git a/tests/functional/u/unnecessary/unnecessary_lambda.py b/tests/functional/u/unnecessary/unnecessary_lambda.py
index 91f6bf86d..f15ffa382 100644
--- a/tests/functional/u/unnecessary/unnecessary_lambda.py
+++ b/tests/functional/u/unnecessary/unnecessary_lambda.py
@@ -1,6 +1,5 @@
# pylint: disable=undefined-variable, use-list-literal
-"""test suspicious lambda expressions
-"""
+"""test suspicious lambda expressions."""
__revision__ = ''
diff --git a/tests/functional/u/unnecessary/unnecessary_not.py b/tests/functional/u/unnecessary/unnecessary_not.py
index 97acecd73..923eab7bc 100644
--- a/tests/functional/u/unnecessary/unnecessary_not.py
+++ b/tests/functional/u/unnecessary/unnecessary_not.py
@@ -1,10 +1,9 @@
-"""Check exceeding negations in boolean expressions trigger warnings"""
+"""Check exceeding negations in boolean expressions trigger warnings."""
# pylint: disable=singleton-comparison,too-many-branches,too-few-public-methods,undefined-variable
# pylint: disable=literal-comparison, comparison-with-itself, useless-object-inheritance
def unneeded_not():
- """This is not ok
- """
+ """This is not ok."""
bool_var = True
someint = 2
if not not bool_var: # [unneeded-not]
@@ -38,7 +37,7 @@ def unneeded_not():
def tolerated_statements():
- """This is ok"""
+ """This is ok."""
bool_var = True
someint = 2
if not(bool_var == False and someint == 1):
@@ -58,6 +57,6 @@ def tolerated_statements():
class Klass(object):
- """This is also ok"""
+ """This is also ok."""
def __ne__(self, other):
return not self == other
diff --git a/tests/functional/u/unnecessary/unnecessary_pass.py b/tests/functional/u/unnecessary/unnecessary_pass.py
index c2733096a..37253a30d 100644
--- a/tests/functional/u/unnecessary/unnecessary_pass.py
+++ b/tests/functional/u/unnecessary/unnecessary_pass.py
@@ -7,12 +7,12 @@ except ValueError:
pass # [unnecessary-pass]
def docstring_only():
- '''In Python, stubbed functions often have a body that contains just a
- single `pass` statement, indicating that the function doesn't do
- anything. However, a stubbed function can also have just a
- docstring, and function with a docstring and no body also does
- nothing.
- '''
+ """In Python, stubbed functions often have a body that contains just a single `pass`
+ statement, indicating that the function doesn't do anything.
+
+ However, a stubbed function can also have just a docstring, and function with a
+ docstring and no body also does nothing.
+ """
# This function has no docstring, so it needs a `pass` statement.
@@ -21,21 +21,20 @@ def pass_only():
def docstring_and_pass():
- '''This function doesn't do anything, but it has a docstring, so its
- `pass` statement is useless clutter.
+ """This function doesn't do anything, but it has a docstring, so its `pass`
+ statement is useless clutter.
NEW CHECK: useless-pass
This would check for stubs with both docstrings and `pass`
statements, suggesting the removal of the useless `pass`
statements
- '''
+ """
pass # [unnecessary-pass]
class DocstringOnly:
- '''The same goes for class stubs: docstring, or `pass`, but not both.
- '''
+ """The same goes for class stubs: docstring, or `pass`, but not both."""
# No problem
@@ -44,6 +43,8 @@ class PassOnly:
class DocstringAndPass:
- '''Whoops! Mark this one as bad too.
- '''
+ """Whoops!
+
+ Mark this one as bad too.
+ """
pass # [unnecessary-pass]
diff --git a/tests/functional/u/unpacking.py b/tests/functional/u/unpacking.py
index 59d9abbe4..0f451727b 100644
--- a/tests/functional/u/unpacking.py
+++ b/tests/functional/u/unpacking.py
@@ -1,11 +1,10 @@
-""" Code for checking the display of the module
-for unbalanced-tuple-unpacking and unpacking-non-sequence
-"""
+"""Code for checking the display of the module for unbalanced-tuple-unpacking and
+unpacking-non-sequence."""
def unpack():
- """ Return something"""
+ """Return something."""
return (1, 2, 3)
def nonseq():
- """ Return non sequence """
+ """Return non sequence."""
return 1
diff --git a/tests/functional/u/unpacking_generalizations.py b/tests/functional/u/unpacking_generalizations.py
index 1c5fb16b8..97cf7cedf 100644
--- a/tests/functional/u/unpacking_generalizations.py
+++ b/tests/functional/u/unpacking_generalizations.py
@@ -1,4 +1,4 @@
-"""Various tests for unpacking generalizations added in Python 3.5"""
+"""Various tests for unpacking generalizations added in Python 3.5."""
# pylint: disable=missing-docstring, invalid-name
diff --git a/tests/functional/u/unpacking_non_sequence.py b/tests/functional/u/unpacking_non_sequence.py
index e9c23b388..087b0b4dd 100644
--- a/tests/functional/u/unpacking_non_sequence.py
+++ b/tests/functional/u/unpacking_non_sequence.py
@@ -1,4 +1,4 @@
-"""Check unpacking non-sequences in assignments. """
+"""Check unpacking non-sequences in assignments."""
# pylint: disable=too-few-public-methods, invalid-name, attribute-defined-outside-init, unused-variable
# pylint: disable=using-constant-test, no-init, missing-docstring, wrong-import-order,wrong-import-position,no-else-return, useless-object-inheritance
@@ -11,7 +11,7 @@ __revision__ = 0
# Working
class Seq(object):
- """ sequence """
+ """sequence."""
def __init__(self):
self.items = range(2)
@@ -22,40 +22,40 @@ class Seq(object):
return len(self.items)
class Iter(object):
- """ Iterator """
+ """Iterator."""
def __iter__(self):
for number in range(2):
yield number
def good_unpacking():
- """ returns should be unpackable """
+ """returns should be unpackable."""
if True:
return [1, 2]
else:
return (3, 4)
def good_unpacking2():
- """ returns should be unpackable """
+ """returns should be unpackable."""
return good_unpacking()
class MetaIter(type):
- "metaclass that makes classes that use it iterables"
+ """metaclass that makes classes that use it iterables."""
def __iter__(cls):
return iter((1, 2))
class IterClass(metaclass=MetaIter):
- "class that is iterable (and unpackable)"
+ """class that is iterable (and unpackable)"""
class AbstrClass(object):
- "abstract class"
+ """abstract class."""
pair = None
def setup_pair(self):
- "abstract method"
+ """abstract method."""
raise NotImplementedError
def __init__(self):
- "error should not be emitted because setup_pair is abstract"
+ """error should not be emitted because setup_pair is abstract."""
self.setup_pair()
x, y = self.pair
@@ -73,7 +73,7 @@ a, b = IterClass
# Not working
class NonSeq(object):
- """ does nothing """
+ """does nothing."""
a, b = NonSeq() # [unpacking-non-sequence]
a, b = ValueError # [unpacking-non-sequence]
@@ -84,10 +84,10 @@ a, b = nonseq() # [unpacking-non-sequence]
a, b = nonseq_func # [unpacking-non-sequence]
class ClassUnpacking(object):
- """ Check unpacking as instance attributes. """
+ """Check unpacking as instance attributes."""
def test(self):
- """ test unpacking in instance attributes. """
+ """test unpacking in instance attributes."""
self.a, self.b = 1, 2
self.a, self.b = {1: 2, 2: 3}
@@ -101,21 +101,21 @@ class ClassUnpacking(object):
self.a, c = nonseq_func # [unpacking-non-sequence]
class TestBase(object):
- 'base class with `test` method implementation'
+ """base class with `test` method implementation."""
@staticmethod
def test(data):
- 'default implementation'
+ """default implementation."""
return data
class Test(TestBase):
- 'child class that overrides `test` method'
+ """child class that overrides `test` method."""
def __init__(self):
# no error should be emitted here as `test` is overridden in this class
(self.aaa, self.bbb, self.ccc) = self.test(None)
@staticmethod
def test(data):
- 'overridden implementation'
+ """overridden implementation."""
return (1, 2, 3)
diff --git a/tests/functional/u/unrecognized_inline_option.py b/tests/functional/u/unrecognized_inline_option.py
index 3163b1ea6..e65d4dd0b 100644
--- a/tests/functional/u/unrecognized_inline_option.py
+++ b/tests/functional/u/unrecognized_inline_option.py
@@ -1,3 +1,3 @@
# +1: [unrecognized-inline-option]
# pylint:bouboule=1
-"""Check unknown option"""
+"""Check unknown option."""
diff --git a/tests/functional/u/unspecified_encoding_py38.py b/tests/functional/u/unspecified_encoding_py38.py
index 306f94e69..35b9436f8 100644
--- a/tests/functional/u/unspecified_encoding_py38.py
+++ b/tests/functional/u/unspecified_encoding_py38.py
@@ -1,4 +1,4 @@
-"""Warnings for using open() without specifying an encoding"""
+"""Warnings for using open() without specifying an encoding."""
# pylint: disable=consider-using-with, too-few-public-methods
import dataclasses
import io
@@ -96,7 +96,7 @@ open(FILENAME, mode=MODE)
# -- Functions
def return_mode_function():
- """Return a mode for open call"""
+ """Return a mode for open call."""
return "wb"
open(FILENAME, mode=return_mode_function())
@@ -104,7 +104,7 @@ open(FILENAME, mode=return_mode_function())
# -- Classes
class IOData:
- """Class that returns mode strings"""
+ """Class that returns mode strings."""
mode = "wb"
@@ -113,12 +113,12 @@ class IOData:
@staticmethod
def my_mode_method():
- """Returns a pre-defined mode"""
+ """Returns a pre-defined mode."""
return "wb"
@staticmethod
def my_mode_method_returner(mode: str) -> str:
- """Returns the supplied mode"""
+ """Returns the supplied mode."""
return mode
@@ -133,7 +133,7 @@ open(FILENAME, mode=IOData)
# -- Dataclasses
@dataclasses.dataclass
class IOArgs:
- """Dataclass storing information about how to open a file"""
+ """Dataclass storing information about how to open a file."""
encoding: Optional[str]
mode: str
diff --git a/tests/functional/u/unsubscriptable_object.py b/tests/functional/u/unsubscriptable_object.py
index 0b7da78b3..b7a66ca37 100644
--- a/tests/functional/u/unsubscriptable_object.py
+++ b/tests/functional/u/unsubscriptable_object.py
@@ -1,4 +1,4 @@
-"""Tests for unscubscriptable-object"""
+"""Tests for unscubscriptable-object."""
# Test for typing.NamedTuple
# See: https://github.com/PyCQA/pylint/issues/1295
diff --git a/tests/functional/u/unsubscriptable_value.py b/tests/functional/u/unsubscriptable_value.py
index 6a97cc4c8..bc1033a4e 100644
--- a/tests/functional/u/unsubscriptable_value.py
+++ b/tests/functional/u/unsubscriptable_value.py
@@ -1,7 +1,5 @@
-"""
-Checks that value used in a subscript supports subscription
-(i.e. defines __getitem__ method).
-"""
+"""Checks that value used in a subscript supports subscription (i.e. defines __getitem__
+method)."""
# pylint: disable=missing-docstring,pointless-statement,expression-not-assigned,wrong-import-position, unnecessary-comprehension
# pylint: disable=too-few-public-methods,import-error,invalid-name,wrong-import-order, useless-object-inheritance, redundant-u-string-prefix
import six
@@ -115,13 +113,13 @@ class ClassMixin(object):
def return_an_int(param):
- """Returns an int"""
+ """Returns an int."""
if param == 0:
return 1
return 0
def test_one(param):
- """Should complain about var_one[0], but doesn't"""
+ """Should complain about var_one[0], but doesn't."""
var_one = return_an_int(param)
return var_one[0] # [unsubscriptable-object]
diff --git a/tests/functional/u/unsubscriptable_value_py37.py b/tests/functional/u/unsubscriptable_value_py37.py
index acbbe6bdd..8281e9d2f 100644
--- a/tests/functional/u/unsubscriptable_value_py37.py
+++ b/tests/functional/u/unsubscriptable_value_py37.py
@@ -1,8 +1,6 @@
# pylint: disable=missing-class-docstring,too-few-public-methods,pointless-statement,expression-not-assigned
-"""
-Checks that class used in a subscript supports subscription
-(i.e. defines __class_getitem__ method).
-"""
+"""Checks that class used in a subscript supports subscription (i.e. defines
+__class_getitem__ method)."""
import typing
diff --git a/tests/functional/u/unsupported/unsupported_assignment_operation.py b/tests/functional/u/unsupported/unsupported_assignment_operation.py
index c0b58668a..9af9209c1 100644
--- a/tests/functional/u/unsupported/unsupported_assignment_operation.py
+++ b/tests/functional/u/unsupported/unsupported_assignment_operation.py
@@ -1,7 +1,5 @@
-"""
-Checks that value used in a subscript support assignments
-(i.e. defines __setitem__ method).
-"""
+"""Checks that value used in a subscript support assignments (i.e. defines __setitem__
+method)."""
# pylint: disable=missing-docstring,pointless-statement,expression-not-assigned,wrong-import-position,unnecessary-comprehension
# pylint: disable=too-few-public-methods,import-error,invalid-name,wrong-import-order, useless-object-inheritance
import six
diff --git a/tests/functional/u/unsupported/unsupported_delete_operation.py b/tests/functional/u/unsupported/unsupported_delete_operation.py
index 3c2882a64..8a852fee1 100644
--- a/tests/functional/u/unsupported/unsupported_delete_operation.py
+++ b/tests/functional/u/unsupported/unsupported_delete_operation.py
@@ -1,7 +1,5 @@
-"""
-Checks that value used in a subscript support deletion
-(i.e. defines __delitem__ method).
-"""
+"""Checks that value used in a subscript support deletion (i.e. defines __delitem__
+method)."""
# pylint: disable=missing-docstring,pointless-statement,expression-not-assigned,wrong-import-position,unnecessary-comprehension
# pylint: disable=too-few-public-methods,import-error,invalid-name,wrong-import-order, useless-object-inheritance
import six
diff --git a/tests/functional/u/unsupported/unsupported_version_for_f_string.py b/tests/functional/u/unsupported/unsupported_version_for_f_string.py
index c7ae5e385..459228569 100644
--- a/tests/functional/u/unsupported/unsupported_version_for_f_string.py
+++ b/tests/functional/u/unsupported/unsupported_version_for_f_string.py
@@ -1,4 +1,4 @@
-"""Tests for the use of f-strings whenever the py-version is set < 3.6"""
+"""Tests for the use of f-strings whenever the py-version is set < 3.6."""
# pylint: disable=f-string-without-interpolation
VAR = f"a simple f-string" # [using-f-string-in-unsupported-version]
diff --git a/tests/functional/u/unsupported/unsupported_version_for_final.py b/tests/functional/u/unsupported/unsupported_version_for_final.py
index efc433dd4..cc9225551 100644
--- a/tests/functional/u/unsupported/unsupported_version_for_final.py
+++ b/tests/functional/u/unsupported/unsupported_version_for_final.py
@@ -1,4 +1,4 @@
-"""Tests for the use of typing.final whenever the py-version is set < 3.8"""
+"""Tests for the use of typing.final whenever the py-version is set < 3.8."""
# pylint: disable=missing-class-docstring, no-member, too-few-public-methods, missing-function-docstring, no-name-in-module, reimported
import typing
diff --git a/tests/functional/u/unused/unused_argument.py b/tests/functional/u/unused/unused_argument.py
index a3fd4e6ab..6e8b72d5a 100644
--- a/tests/functional/u/unused/unused_argument.py
+++ b/tests/functional/u/unused/unused_argument.py
@@ -18,33 +18,31 @@ def test_prefixed_with_unused(first, unused_second):
class Base(object):
- "parent"
+ """parent."""
def inherited(self, aaa, aab, aac):
- "abstract method"
+ """abstract method."""
raise NotImplementedError
class Sub(Base):
- "child 1"
+ """child 1."""
def inherited(self, aaa, aab, aac):
- "overridden method, though don't use every argument"
+ """overridden method, though don't use every argument."""
return aaa
def newmethod(self, aax, aay): # [unused-argument]
- "another method, warning for aay desired"
+ """another method, warning for aay desired."""
return self, aax
class Sub2(Base):
- "child 1"
+ """child 1."""
def inherited(self, aaa, aab, aac):
- "overridden method, use every argument"
+ """overridden method, use every argument."""
return aaa + aab + aac
def metadata_from_dict(key):
- """
- Should not raise unused-argument message because key is
- used inside comprehension dict
- """
+ """Should not raise unused-argument message because key is used inside comprehension
+ dict."""
return {key: str(value) for key, value in key.items()}
# pylint: disable=too-few-public-methods, misplaced-future,wrong-import-position
@@ -52,38 +50,40 @@ from __future__ import print_function
def function(arg=1): # [unused-argument]
- """ignore arg"""
+ """ignore arg."""
class AAAA(object):
- """dummy class"""
+ """dummy class."""
def method(self, arg): # [unused-argument]
- """dummy method"""
+ """dummy method."""
print(self)
def __init__(self, *unused_args, **unused_kwargs):
pass
@classmethod
def selected(cls, *args, **kwargs): # [unused-argument, unused-argument]
- """called by the registry when the vobject has been selected.
- """
+ """called by the registry when the vobject has been selected."""
return cls
def using_inner_function(self, etype, size=1):
- """return a fake result set for a particular entity type"""
+ """return a fake result set for a particular entity type."""
rset = AAAA([('A',)]*size, f'{etype} X',
description=[(etype,)]*size)
def inner(row, col=0, etype=etype, req=self, rset=rset):
- """inner using all its argument"""
+ """inner using all its argument."""
# pylint: disable=maybe-no-member
return req.vreg.etype_class(etype)(req, rset, row, col)
# pylint: disable = attribute-defined-outside-init
rset.get_entity = inner
class BBBB(object):
- """dummy class"""
+ """dummy class."""
def __init__(self, arg): # [unused-argument]
- """Constructor with an extra parameter. Should raise a warning"""
+ """Constructor with an extra parameter.
+
+ Should raise a warning
+ """
self.spam = 1
diff --git a/tests/functional/u/unused/unused_import.py b/tests/functional/u/unused/unused_import.py
index bd624dc76..bd48108ac 100644
--- a/tests/functional/u/unused/unused_import.py
+++ b/tests/functional/u/unused/unused_import.py
@@ -1,4 +1,4 @@
-"""unused import"""
+"""unused import."""
# pylint: disable=undefined-all-variable, import-error, too-few-public-methods, missing-docstring,wrong-import-position, useless-object-inheritance, multiple-imports
import xml.etree # [unused-import]
import xml.sax # [unused-import]
diff --git a/tests/functional/u/unused/unused_import_class_def_keyword.py b/tests/functional/u/unused/unused_import_class_def_keyword.py
index 0d6b59987..9ebd07dc5 100644
--- a/tests/functional/u/unused/unused_import_class_def_keyword.py
+++ b/tests/functional/u/unused/unused_import_class_def_keyword.py
@@ -1,7 +1,6 @@
-"""
-Test false-positive for unused-import on class keyword arguments
+"""Test false-positive for unused-import on class keyword arguments.
- https://github.com/PyCQA/pylint/issues/3202
+https://github.com/PyCQA/pylint/issues/3202
"""
# pylint: disable=missing-docstring,too-few-public-methods,invalid-name,import-error
diff --git a/tests/functional/u/unused/unused_import_everything_disabled.py b/tests/functional/u/unused/unused_import_everything_disabled.py
index 7d6cce74c..9814dcf6e 100644
--- a/tests/functional/u/unused/unused_import_everything_disabled.py
+++ b/tests/functional/u/unused/unused_import_everything_disabled.py
@@ -1,4 +1,4 @@
-"""Test that unused-import is not emitted here when everything else is disabled
+"""Test that unused-import is not emitted here when everything else is disabled.
https://github.com/PyCQA/pylint/issues/3445
"""
diff --git a/tests/functional/u/unused/unused_import_positional_only_py38.py b/tests/functional/u/unused/unused_import_positional_only_py38.py
index 693a377d9..bfffa2247 100644
--- a/tests/functional/u/unused/unused_import_positional_only_py38.py
+++ b/tests/functional/u/unused/unused_import_positional_only_py38.py
@@ -1,4 +1,4 @@
-"""Test that positional only argument annotations are properly marked as consumed
+"""Test that positional only argument annotations are properly marked as consumed.
https://github.com/PyCQA/pylint/issues/3462
"""
@@ -6,5 +6,5 @@ from typing import AnyStr, Set
def func(arg: AnyStr, /, arg2: Set[str]):
- """Uses positional only arguments"""
+ """Uses positional only arguments."""
return arg, arg2
diff --git a/tests/functional/u/unused/unused_import_py30.py b/tests/functional/u/unused/unused_import_py30.py
index 95fed2055..c810fba31 100644
--- a/tests/functional/u/unused/unused_import_py30.py
+++ b/tests/functional/u/unused/unused_import_py30.py
@@ -1,4 +1,4 @@
-"""check unused import for metaclasses"""
+"""check unused import for metaclasses."""
# pylint: disable=too-few-public-methods,wrong-import-position,ungrouped-imports
__revision__ = 1
import abc
@@ -7,13 +7,13 @@ from abc import ABCMeta
from abc import ABCMeta as SomethingElse # [reimported]
class Meta(metaclass=abc.ABCMeta):
- """ Test """
+ """Test."""
def __init__(self):
self.data = sys.executable
self.test = abc
class Meta2(metaclass=ABCMeta):
- """ Test """
+ """Test."""
class Meta3(metaclass=SomethingElse):
- """ test """
+ """test."""
diff --git a/tests/functional/u/unused/unused_module.py b/tests/functional/u/unused/unused_module.py
index 99e70ff6e..7a685d3a5 100644
--- a/tests/functional/u/unused/unused_module.py
+++ b/tests/functional/u/unused/unused_module.py
@@ -1,4 +1,5 @@
"""Regression test for unused-module.
+
Reported in https://bitbucket.org/logilab/pylint/issue/78/
"""
@@ -8,6 +9,6 @@ path += ["stuff"]
def func():
- """A function"""
+ """A function."""
other = 1
return len(other)
diff --git a/tests/functional/u/unused/unused_name_from_wilcard_import.py b/tests/functional/u/unused/unused_name_from_wilcard_import.py
index 54658b855..8434c2c82 100644
--- a/tests/functional/u/unused/unused_name_from_wilcard_import.py
+++ b/tests/functional/u/unused/unused_name_from_wilcard_import.py
@@ -1,4 +1,4 @@
-"""check unused import from a wildcard import"""
+"""check unused import from a wildcard import."""
# pylint: disable=line-too-long
from .unused_argument_py3 import * # [unused-wildcard-import, wildcard-import]
from .unused_global_variable1 import * # [unused-wildcard-import, wildcard-import]
diff --git a/tests/functional/u/unused/unused_private_member.py b/tests/functional/u/unused/unused_private_member.py
index fc42ea8fb..843229d64 100644
--- a/tests/functional/u/unused/unused_private_member.py
+++ b/tests/functional/u/unused/unused_private_member.py
@@ -69,7 +69,7 @@ class MyCls:
class Bla:
- """Regression test for issue 4638"""
+ """Regression test for issue 4638."""
def __init__(self):
type(self).__a()
@@ -90,7 +90,7 @@ class Bla:
class Klass:
- """Regression test for 4644"""
+ """Regression test for 4644."""
__seventyseven = 77
__ninetyone = 91
@@ -107,7 +107,7 @@ print(k.ninetyfive)
# https://github.com/PyCQA/pylint/issues/4657
# Mutation of class member with cls should not fire a false-positive
class FalsePositive4657:
- """False positivie tests for 4657"""
+ """False positivie tests for 4657."""
__attr_a = None
__attr_b = 'b'
@@ -167,14 +167,14 @@ class FalsePositive4668:
# https://github.com/PyCQA/pylint/issues/4673
# Nested functions shouldn't cause a false positive if they are properly used
class FalsePositive4673:
- """ The testing class """
+ """The testing class."""
def __init__(self, in_thing):
self.thing = False
self.do_thing(in_thing)
def do_thing(self, in_thing):
- """ Checks the false-positive condition, sets a property. """
+ """Checks the false-positive condition, sets a property."""
def __false_positive(in_thing):
print(in_thing)
@@ -185,7 +185,7 @@ class FalsePositive4673:
self.thing = True
def undo_thing(self):
- """ Unsets a property. """
+ """Unsets a property."""
self.thing = False
def complicated_example(self, flag):
@@ -281,7 +281,7 @@ class FalsePositive4849:
class Pony:
- """https://github.com/PyCQA/pylint/issues/4837"""
+ """https://github.com/PyCQA/pylint/issues/4837."""
__defaults = {}
__defaults_set = False
diff --git a/tests/functional/u/unused/unused_typing_imports.py b/tests/functional/u/unused/unused_typing_imports.py
index 7de4e411b..d5a86eb56 100644
--- a/tests/functional/u/unused/unused_typing_imports.py
+++ b/tests/functional/u/unused/unused_typing_imports.py
@@ -1,8 +1,8 @@
# pylint: disable=missing-docstring
-"""Regression test for https://github.com/PyCQA/pylint/issues/1168
+"""Regression test for https://github.com/PyCQA/pylint/issues/1168.
-The problem was that we weren't handling keyword-only arguments annotations,
-which means we were never processing them.
+The problem was that we weren't handling keyword-only arguments annotations, which means
+we were never processing them.
"""
import re
@@ -64,13 +64,13 @@ def function(arg1, # type: Iterable
arg2 # type: List
):
# type: (...) -> Sequence
- """docstring"""
+ """docstring."""
print(arg1, arg2)
def magic(alpha, beta, gamma):
# type: (str, Optional[str], Optional[datetime]) -> Any
- """going strong"""
+ """going strong."""
return alpha, beta, gamma
diff --git a/tests/functional/u/unused/unused_variable.py b/tests/functional/u/unused/unused_variable.py
index d5afd8f2b..c9b222cbc 100644
--- a/tests/functional/u/unused/unused_variable.py
+++ b/tests/functional/u/unused/unused_variable.py
@@ -72,7 +72,7 @@ PATH = OS = collections = deque = None
def function(matches):
- """"yo"""
+ """"yo."""
aaaa = 1 # [unused-variable]
index = -1
for match in matches:
@@ -81,7 +81,7 @@ def function(matches):
from astroid import nodes
def visit_if(self, node: nodes.If) -> None:
- """increments the branches counter"""
+ """increments the branches counter."""
branches = 1
# don't double count If nodes coming from some 'elif'
if node.orelse and len(node.orelse) > 1:
@@ -91,9 +91,7 @@ def visit_if(self, node: nodes.If) -> None:
def test_global():
- """ Test various assignments of global
- variables through imports.
- """
+ """Test various assignments of global variables through imports."""
global PATH, OS, collections, deque # [global-variable-not-assigned, global-variable-not-assigned]
from os import path as PATH
import os as OS
@@ -159,7 +157,7 @@ def func4():
def main(lst):
- """https://github.com/PyCQA/astroid/pull/1111#issuecomment-890367609"""
+ """https://github.com/PyCQA/astroid/pull/1111#issuecomment-890367609."""
try:
raise ValueError
except ValueError as e: # [unused-variable]
diff --git a/tests/functional/u/unused/unused_variable_py38.py b/tests/functional/u/unused/unused_variable_py38.py
index 7151bb9a8..fb1328108 100644
--- a/tests/functional/u/unused/unused_variable_py38.py
+++ b/tests/functional/u/unused/unused_variable_py38.py
@@ -1,24 +1,24 @@
-"""Tests for the unused-variable message in assignment expressions"""
+"""Tests for the unused-variable message in assignment expressions."""
def typed_assignment_in_function_default( # [unused-variable]
param: str = (typed_default := "walrus"), # [unused-variable]
) -> None:
- """An unused annotated assignment expression in a default parameter should emit"""
+ """An unused annotated assignment expression in a default parameter should emit."""
return param
def assignment_in_function_default( # [unused-variable]
param=(default := "walrus"), # [unused-variable]
) -> None:
- """An unused assignment expression in a default parameter should emit"""
+ """An unused assignment expression in a default parameter should emit."""
return param
def assignment_used_in_function_scope( # [unused-variable]
param=(function_default := "walrus"),
) -> None:
- """An used assignment expression in a default parameter should not emit"""
+ """An used assignment expression in a default parameter should not emit."""
print(function_default)
return param
@@ -26,7 +26,7 @@ def assignment_used_in_function_scope( # [unused-variable]
def assignment_used_in_global_scope( # [unused-variable]
param=(global_default := "walrus"),
) -> None:
- """An used assignment expression in a default parameter should not emit"""
+ """An used assignment expression in a default parameter should not emit."""
return param
print(global_default)
diff --git a/tests/functional/u/use/use_maxsplit_arg.py b/tests/functional/u/use/use_maxsplit_arg.py
index 396da3adc..d5f8860ca 100644
--- a/tests/functional/u/use/use_maxsplit_arg.py
+++ b/tests/functional/u/use/use_maxsplit_arg.py
@@ -1,4 +1,4 @@
-"""Emit a message for accessing first/last element of string.split"""
+"""Emit a message for accessing first/last element of string.split."""
# pylint: disable=line-too-long,missing-docstring,unsubscriptable-object,too-few-public-methods,invalid-name,redefined-builtin
# Test subscripting .split()
diff --git a/tests/functional/u/use/used_before_assignment.py b/tests/functional/u/use/used_before_assignment.py
index 5b469041e..8a64665a4 100644
--- a/tests/functional/u/use/used_before_assignment.py
+++ b/tests/functional/u/use/used_before_assignment.py
@@ -1,4 +1,4 @@
-"""pylint doesn't see the NameError in this module"""
+"""pylint doesn't see the NameError in this module."""
# pylint: disable=consider-using-f-string, missing-function-docstring
__revision__ = None
diff --git a/tests/functional/u/use/used_before_assignment_488.py b/tests/functional/u/use/used_before_assignment_488.py
index efc133c2b..8c1d8757f 100644
--- a/tests/functional/u/use/used_before_assignment_488.py
+++ b/tests/functional/u/use/used_before_assignment_488.py
@@ -1,6 +1,7 @@
# pylint: disable=missing-docstring
def func():
- """Test that a variable defined in a finally clause does not trigger a false positive"""
+ """Test that a variable defined in a finally clause does not trigger a false
+ positive."""
try:
variable = 1
yield variable
diff --git a/tests/functional/u/use/used_before_assignment_except_handler_for_try_with_return.py b/tests/functional/u/use/used_before_assignment_except_handler_for_try_with_return.py
index 3afd9375a..a3732b8d4 100644
--- a/tests/functional/u/use/used_before_assignment_except_handler_for_try_with_return.py
+++ b/tests/functional/u/use/used_before_assignment_except_handler_for_try_with_return.py
@@ -1,5 +1,6 @@
-"""Tests for used-before-assignment with assignments in except handlers after
-try blocks with return statements.
+"""Tests for used-before-assignment with assignments in except handlers after try blocks
+with return statements.
+
See: https://github.com/PyCQA/pylint/issues/5500.
"""
# pylint: disable=inconsistent-return-statements
diff --git a/tests/functional/u/use/used_before_assignment_issue2615.py b/tests/functional/u/use/used_before_assignment_issue2615.py
index bce073bf3..88858f590 100644
--- a/tests/functional/u/use/used_before_assignment_issue2615.py
+++ b/tests/functional/u/use/used_before_assignment_issue2615.py
@@ -1,4 +1,4 @@
-"""https://github.com/PyCQA/pylint/issues/2615"""
+"""https://github.com/PyCQA/pylint/issues/2615."""
def main():
"""When evaluating except blocks, assume try statements fail."""
try:
diff --git a/tests/functional/u/use/used_before_assignment_issue85.py b/tests/functional/u/use/used_before_assignment_issue85.py
index 58d8e38d8..3e8cd3381 100644
--- a/tests/functional/u/use/used_before_assignment_issue85.py
+++ b/tests/functional/u/use/used_before_assignment_issue85.py
@@ -1,4 +1,4 @@
-"""https://github.com/PyCQA/pylint/issues/85"""
+"""https://github.com/PyCQA/pylint/issues/85."""
def main():
"""When evaluating finally blocks, assume try statements fail."""
try:
diff --git a/tests/functional/u/use/used_before_assignment_nonlocal.py b/tests/functional/u/use/used_before_assignment_nonlocal.py
index 5cbdd510c..8f3fd9206 100644
--- a/tests/functional/u/use/used_before_assignment_nonlocal.py
+++ b/tests/functional/u/use/used_before_assignment_nonlocal.py
@@ -1,10 +1,10 @@
-"""Check for nonlocal and used-before-assignment"""
+"""Check for nonlocal and used-before-assignment."""
# pylint: disable=missing-docstring, unused-variable, no-init, too-few-public-methods
__revision__ = 0
def test_ok():
- """ uses nonlocal """
+ """uses nonlocal."""
cnt = 1
def wrap():
nonlocal cnt
@@ -12,14 +12,14 @@ def test_ok():
wrap()
def test_fail():
- """ doesn't use nonlocal """
+ """doesn't use nonlocal."""
cnt = 1
def wrap():
cnt = cnt + 1 # [used-before-assignment]
wrap()
def test_fail2():
- """ use nonlocal, but for other variable """
+ """use nonlocal, but for other variable."""
cnt = 1
count = 1
def wrap():
@@ -28,30 +28,29 @@ def test_fail2():
wrap()
def test_fail3(arg: test_fail4): # [used-before-assignment]
- """ Depends on `test_fail4`, in argument annotation. """
+ """Depends on `test_fail4`, in argument annotation."""
return arg
# +1: [used-before-assignment, used-before-assignment]
def test_fail4(*args: test_fail5, **kwargs: undefined):
- """ Depends on `test_fail5` and `undefined` in
- variable and named arguments annotations.
- """
+ """Depends on `test_fail5` and `undefined` in variable and named arguments
+ annotations."""
return args, kwargs
def test_fail5()->undefined1: # [used-before-assignment]
- """ Depends on `undefined1` in function return annotation. """
+ """Depends on `undefined1` in function return annotation."""
def undefined():
- """ no op """
+ """no op."""
def undefined1():
- """ no op """
+ """no op."""
def nonlocal_in_ifexp():
- """bar"""
+ """bar."""
bug2 = True
def on_click(event):
- """on_click"""
+ """on_click."""
if event:
nonlocal bug2
bug2 = not bug2
diff --git a/tests/functional/u/use/used_before_assignment_py37.py b/tests/functional/u/use/used_before_assignment_py37.py
index e17c345a9..540c50d1a 100644
--- a/tests/functional/u/use/used_before_assignment_py37.py
+++ b/tests/functional/u/use/used_before_assignment_py37.py
@@ -1,11 +1,11 @@
-"""Tests for used-before-assignment with functions added in python 3.7"""
+"""Tests for used-before-assignment with functions added in python 3.7."""
# pylint: disable=missing-function-docstring
from __future__ import annotations
from typing import List
class MyClass:
- """With the future import only default values can't refer to the base class"""
+ """With the future import only default values can't refer to the base class."""
def correct_typing_method(self, other: MyClass) -> bool:
return self == other
diff --git a/tests/functional/u/use/used_before_assignment_typing.py b/tests/functional/u/use/used_before_assignment_typing.py
index 33d81356e..725c85fab 100644
--- a/tests/functional/u/use/used_before_assignment_typing.py
+++ b/tests/functional/u/use/used_before_assignment_typing.py
@@ -1,4 +1,4 @@
-"""Tests for used-before-assignment for typing related issues"""
+"""Tests for used-before-assignment for typing related issues."""
# pylint: disable=missing-function-docstring
@@ -6,7 +6,8 @@ from typing import List, Optional
class MyClass:
- """Type annotation or default values for first level methods can't refer to their own class"""
+ """Type annotation or default values for first level methods can't refer to their
+ own class."""
def incorrect_typing_method(
self, other: MyClass # [used-before-assignment]
@@ -35,6 +36,7 @@ class MyClass:
class MySecondClass:
"""Class to test self referential variable typing.
+
This regressed, reported in: https://github.com/PyCQA/pylint/issues/5342
"""
@@ -65,6 +67,7 @@ class MyOtherClass:
class MyThirdClass:
"""Class to test self referential variable typing within conditionals.
+
This regressed, reported in: https://github.com/PyCQA/pylint/issues/5499
"""
diff --git a/tests/functional/u/useless/useless_else_on_loop.py b/tests/functional/u/useless/useless_else_on_loop.py
index c7d901663..bb7fbe078 100644
--- a/tests/functional/u/useless/useless_else_on_loop.py
+++ b/tests/functional/u/useless/useless_else_on_loop.py
@@ -44,7 +44,7 @@ else: # [useless-else-on-loop]
def test_return_for2():
- """no false positive for break in else
+ """no false positive for break in else.
https://bitbucket.org/logilab/pylint/issue/117/useless-else-on-loop-false-positives
"""
@@ -59,8 +59,7 @@ def test_return_for2():
def test_break_in_orelse_deep():
- """no false positive for break in else deeply nested
- """
+ """no false positive for break in else deeply nested."""
for _ in range(10):
if 1 < 2:
for _ in range(3):
@@ -74,9 +73,8 @@ def test_break_in_orelse_deep():
def test_break_in_orelse_deep2():
- """should rise a useless-else-on-loop message, as the break statement is only
- for the inner for loop
- """
+ """should rise a useless-else-on-loop message, as the break statement is only for
+ the inner for loop."""
for _ in range(10):
if 1 < 2:
for _ in range(3):
@@ -90,8 +88,7 @@ def test_break_in_orelse_deep2():
def test_break_in_orelse_deep3():
- """no false positive for break deeply nested in else
- """
+ """no false positive for break deeply nested in else."""
for _ in range(10):
for _ in range(3):
pass
diff --git a/tests/functional/u/useless/useless_object_inheritance.py b/tests/functional/u/useless/useless_object_inheritance.py
index 562c81f6a..ae97306e3 100644
--- a/tests/functional/u/useless/useless_object_inheritance.py
+++ b/tests/functional/u/useless/useless_object_inheritance.py
@@ -1,6 +1,8 @@
"""Check if a class inherits from object.
-In python3 every class implicitly inherits from object, therefore give refactoring message to
- remove object from bases"""
+
+In python3 every class implicitly inherits from object, therefore give refactoring
+message to remove object from bases
+"""
# pylint: disable=no-init, invalid-name, missing-docstring, too-few-public-methods
# pylint: disable=inconsistent-mro
import abc
diff --git a/tests/functional/u/useless/useless_suppression.py b/tests/functional/u/useless/useless_suppression.py
index 7ca3f74ce..353ecb690 100644
--- a/tests/functional/u/useless/useless_suppression.py
+++ b/tests/functional/u/useless/useless_suppression.py
@@ -1,4 +1,4 @@
-"""Tests for useless suppressions"""
+"""Tests for useless suppressions."""
# pylint: enable=useless-suppression, line-too-long
# pylint: disable=unused-import, wrong-import-order
diff --git a/tests/functional/u/useless/useless_with_lock.py b/tests/functional/u/useless/useless_with_lock.py
index 19d664084..33c03681d 100644
--- a/tests/functional/u/useless/useless_with_lock.py
+++ b/tests/functional/u/useless/useless_with_lock.py
@@ -1,4 +1,4 @@
-"""Tests for the useless-with-lock message"""
+"""Tests for the useless-with-lock message."""
# pylint: disable=missing-docstring
import threading
from threading import Lock, RLock, Condition, Semaphore, BoundedSemaphore
diff --git a/tests/functional/w/with_used_before_assign.py b/tests/functional/w/with_used_before_assign.py
index ebe7d3093..3dbdd13da 100644
--- a/tests/functional/w/with_used_before_assign.py
+++ b/tests/functional/w/with_used_before_assign.py
@@ -1,12 +1,10 @@
-"""
-Regression test for
-https://bitbucket.org/logilab/pylint/issue/128/attributeerror-when-parsing
-"""
+"""Regression test for https://bitbucket.org/logilab/pylint/issue/128/attributeerror-
+when-parsing."""
from __future__ import with_statement
def do_nothing():
- """ empty """
+ """empty."""
with open("", encoding="utf-8") as ctx.obj: # [undefined-variable]
context.do() # [used-before-assignment]
context = None
diff --git a/tests/functional/w/with_using_generator.py b/tests/functional/w/with_using_generator.py
index 187bdcfea..b4f1f3c86 100644
--- a/tests/functional/w/with_using_generator.py
+++ b/tests/functional/w/with_using_generator.py
@@ -1,15 +1,18 @@
-""" Testing with statements that use generators. This should not crash. """
+"""Testing with statements that use generators.
+
+This should not crash.
+"""
# pylint: disable=useless-object-inheritance
class Base(object):
- """ Base class. """
+ """Base class."""
val = 0
def gen(self):
- """ A generator. """
+ """A generator."""
yield self.val
def fun(self):
- """ With statement using a generator. """
+ """With statement using a generator."""
with self.gen(): # [not-context-manager]
pass
diff --git a/tests/functional/w/wrong_import_order.py b/tests/functional/w/wrong_import_order.py
index ed0615b0c..5ff46fcbd 100644
--- a/tests/functional/w/wrong_import_order.py
+++ b/tests/functional/w/wrong_import_order.py
@@ -1,4 +1,4 @@
-"""Checks import order rule"""
+"""Checks import order rule."""
# pylint: disable=unused-import,ungrouped-imports,import-error,no-name-in-module,relative-beyond-top-level
from __future__ import absolute_import
try:
diff --git a/tests/functional/w/wrong_import_order2.py b/tests/functional/w/wrong_import_order2.py
index 7157512dd..e621f36d1 100644
--- a/tests/functional/w/wrong_import_order2.py
+++ b/tests/functional/w/wrong_import_order2.py
@@ -1,4 +1,4 @@
-"""Checks import order rule in a right case"""
+"""Checks import order rule in a right case."""
# pylint: disable=unused-import,ungrouped-imports,import-error,no-name-in-module
diff --git a/tests/functional/w/wrong_import_position.py b/tests/functional/w/wrong_import_position.py
index c06f9da1f..e57af161e 100644
--- a/tests/functional/w/wrong_import_position.py
+++ b/tests/functional/w/wrong_import_position.py
@@ -1,4 +1,4 @@
-"""Checks import order rule"""
+"""Checks import order rule."""
# pylint: disable=unused-import,ungrouped-imports,wrong-import-order
# pylint: disable=import-error, too-few-public-methods, missing-docstring,using-constant-test, useless-object-inheritance
import os.path
@@ -9,7 +9,7 @@ try:
import sys
except ImportError:
class Myclass(object):
- """docstring"""
+ """docstring."""
if sys.version_info[0] >= 3:
from collections import OrderedDict
diff --git a/tests/functional/w/wrong_import_position10.py b/tests/functional/w/wrong_import_position10.py
index f4a868039..86bcc6e79 100644
--- a/tests/functional/w/wrong_import_position10.py
+++ b/tests/functional/w/wrong_import_position10.py
@@ -1,4 +1,4 @@
-"""Checks import position rule"""
+"""Checks import position rule."""
# pylint: disable=unused-import
import os
@@ -6,7 +6,7 @@ try:
import ast
except ImportError:
def method(items):
- """docstring"""
+ """docstring."""
value = 0
for item in items:
value += item
diff --git a/tests/functional/w/wrong_import_position11.py b/tests/functional/w/wrong_import_position11.py
index 9af72c0e5..afd2b3265 100644
--- a/tests/functional/w/wrong_import_position11.py
+++ b/tests/functional/w/wrong_import_position11.py
@@ -1,4 +1,4 @@
-"""Checks import position rule"""
+"""Checks import position rule."""
# pylint: disable=unused-import,pointless-string-statement
A = 1
import os # [wrong-import-position]
diff --git a/tests/functional/w/wrong_import_position12.py b/tests/functional/w/wrong_import_position12.py
index 300968c40..1adcb82b7 100644
--- a/tests/functional/w/wrong_import_position12.py
+++ b/tests/functional/w/wrong_import_position12.py
@@ -1,4 +1,4 @@
-"""Checks import position rule"""
+"""Checks import position rule."""
# pylint: disable=unused-import,pointless-string-statement
"Two string"
diff --git a/tests/functional/w/wrong_import_position13.py b/tests/functional/w/wrong_import_position13.py
index 6b3d03463..235ff2621 100644
--- a/tests/functional/w/wrong_import_position13.py
+++ b/tests/functional/w/wrong_import_position13.py
@@ -1,4 +1,4 @@
-"""Checks import position rule"""
+"""Checks import position rule."""
# pylint: disable=unused-import,no-name-in-module
A = 1
from sys import x # [wrong-import-position]
diff --git a/tests/functional/w/wrong_import_position14.py b/tests/functional/w/wrong_import_position14.py
index f5c9a03e5..22abc4a63 100644
--- a/tests/functional/w/wrong_import_position14.py
+++ b/tests/functional/w/wrong_import_position14.py
@@ -1,4 +1,4 @@
-"""Checks import position rule"""
+"""Checks import position rule."""
# pylint: disable=unused-import,undefined-variable,import-error
if x:
import os
diff --git a/tests/functional/w/wrong_import_position15.py b/tests/functional/w/wrong_import_position15.py
index 58a19b66c..b15546349 100644
--- a/tests/functional/w/wrong_import_position15.py
+++ b/tests/functional/w/wrong_import_position15.py
@@ -1,4 +1,4 @@
-"""Checks import position rule with pep-0008"""
+"""Checks import position rule with pep-0008."""
# pylint: disable=unused-import
__author__ = 'some author'
diff --git a/tests/functional/w/wrong_import_position2.py b/tests/functional/w/wrong_import_position2.py
index d7441b465..0b1d990f9 100644
--- a/tests/functional/w/wrong_import_position2.py
+++ b/tests/functional/w/wrong_import_position2.py
@@ -1,4 +1,4 @@
-"""Checks import order rule with nested non_import sentence"""
+"""Checks import order rule with nested non_import sentence."""
# pylint: disable=unused-import,ungrouped-imports,import-error,no-name-in-module,relative-beyond-top-level
try:
from sys import argv
diff --git a/tests/functional/w/wrong_import_position3.py b/tests/functional/w/wrong_import_position3.py
index a1808a8fd..12b3abf34 100644
--- a/tests/functional/w/wrong_import_position3.py
+++ b/tests/functional/w/wrong_import_position3.py
@@ -1,3 +1,3 @@
-"""Checks import position rule"""
+"""Checks import position rule."""
# pylint: disable=unused-import,ungrouped-imports,import-error,no-name-in-module,relative-beyond-top-level
import os
diff --git a/tests/functional/w/wrong_import_position4.py b/tests/functional/w/wrong_import_position4.py
index 96f39ce8d..3fbafcb7d 100644
--- a/tests/functional/w/wrong_import_position4.py
+++ b/tests/functional/w/wrong_import_position4.py
@@ -1,5 +1,5 @@
-"""Checks import position rule"""
+"""Checks import position rule."""
# pylint: disable=unused-import,ungrouped-imports,import-error,no-name-in-module,relative-beyond-top-level,unused-variable,import-outside-toplevel
def method1():
- """Method 1"""
+ """Method 1."""
import x
diff --git a/tests/functional/w/wrong_import_position6.py b/tests/functional/w/wrong_import_position6.py
index e719d2cb9..2fdd65497 100644
--- a/tests/functional/w/wrong_import_position6.py
+++ b/tests/functional/w/wrong_import_position6.py
@@ -1,4 +1,4 @@
-"""Checks import position rule"""
+"""Checks import position rule."""
# pylint: disable=unused-import,ungrouped-imports,import-error,no-name-in-module,relative-beyond-top-level,undefined-variable
import y
diff --git a/tests/functional/w/wrong_import_position7.py b/tests/functional/w/wrong_import_position7.py
index 58a79b84b..7c32a6104 100644
--- a/tests/functional/w/wrong_import_position7.py
+++ b/tests/functional/w/wrong_import_position7.py
@@ -1,4 +1,4 @@
-"""Checks import position rule"""
+"""Checks import position rule."""
# pylint: disable=unused-import,ungrouped-imports,import-error,no-name-in-module,relative-beyond-top-level
try:
import x
diff --git a/tests/functional/w/wrong_import_position8.py b/tests/functional/w/wrong_import_position8.py
index 531d9ca5f..77be4ca65 100644
--- a/tests/functional/w/wrong_import_position8.py
+++ b/tests/functional/w/wrong_import_position8.py
@@ -1,4 +1,4 @@
-"""Checks import position rule"""
+"""Checks import position rule."""
# pylint: disable=unused-import,ungrouped-imports,import-error,no-name-in-module,relative-beyond-top-level,undefined-variable
if x:
import os
diff --git a/tests/functional/w/wrong_import_position9.py b/tests/functional/w/wrong_import_position9.py
index 232c453cc..058b3eaa0 100644
--- a/tests/functional/w/wrong_import_position9.py
+++ b/tests/functional/w/wrong_import_position9.py
@@ -1,4 +1,4 @@
-"""Checks import position rule"""
+"""Checks import position rule."""
# pylint: disable=unused-import,ungrouped-imports,import-error,no-name-in-module,relative-beyond-top-level
import y
try:
diff --git a/tests/functional/y/yield_assign.py b/tests/functional/y/yield_assign.py
index 6a5ae00b2..1591e0424 100644
--- a/tests/functional/y/yield_assign.py
+++ b/tests/functional/y/yield_assign.py
@@ -1,21 +1,21 @@
-"""https://www.logilab.org/ticket/8771"""
+"""https://www.logilab.org/ticket/8771."""
from __future__ import print_function
def generator():
- """yield as assignment"""
+ """yield as assignment."""
yield 45
xxxx = yield 123
print(xxxx)
def generator_fp1(seq):
- """W0631 false positive"""
+ """W0631 false positive."""
for val in seq:
pass
for val in seq:
yield val
def generator_fp2():
- """E0601 false positive"""
+ """E0601 false positive."""
xxxx = 12
yield xxxx
diff --git a/tests/functional/y/yield_from_iterable.py b/tests/functional/y/yield_from_iterable.py
index 7803936d5..b1edcb52d 100644
--- a/tests/functional/y/yield_from_iterable.py
+++ b/tests/functional/y/yield_from_iterable.py
@@ -1,6 +1,4 @@
-"""
-Check that `yield from`-statement takes an iterable.
-"""
+"""Check that `yield from`-statement takes an iterable."""
# pylint: disable=missing-docstring
def to_ten():
diff --git a/tests/functional/y/yield_from_outside_func.py b/tests/functional/y/yield_from_outside_func.py
index 6c539db58..d6693f52d 100644
--- a/tests/functional/y/yield_from_outside_func.py
+++ b/tests/functional/y/yield_from_outside_func.py
@@ -1,4 +1,4 @@
-"""This is grammatically correct, but it's still a SyntaxError"""
+"""This is grammatically correct, but it's still a SyntaxError."""
yield from [1, 2] # [yield-outside-function]
LAMBDA_WITH_YIELD = lambda: (yield from [1, 2])
diff --git a/tests/functional/y/yield_outside_func.py b/tests/functional/y/yield_outside_func.py
index 726a8e13e..d40a007c6 100644
--- a/tests/functional/y/yield_outside_func.py
+++ b/tests/functional/y/yield_outside_func.py
@@ -1,4 +1,4 @@
-"""This is grammatically correct, but it's still a SyntaxError"""
+"""This is grammatically correct, but it's still a SyntaxError."""
yield 1 # [yield-outside-function]
LAMBDA_WITH_YIELD = lambda: (yield)
diff --git a/tests/functional/y/yield_return_mix.py b/tests/functional/y/yield_return_mix.py
index 8e050f0f0..f536b0ce4 100644
--- a/tests/functional/y/yield_return_mix.py
+++ b/tests/functional/y/yield_return_mix.py
@@ -1,8 +1,8 @@
-""" module doc """
+"""module doc."""
# pylint: disable=useless-return
__revision__ = None
def somegen():
- """this kind of mix is OK"""
+ """this kind of mix is OK."""
yield 1
return
diff --git a/tests/input/__init__.py b/tests/input/__init__.py
index 60e92b76c..a05279e31 100644
--- a/tests/input/__init__.py
+++ b/tests/input/__init__.py
@@ -1 +1 @@
-"""test"""
+"""test."""
diff --git a/tests/input/func_3k_removed_stuff_py_30.py b/tests/input/func_3k_removed_stuff_py_30.py
index d844c5603..35ffade82 100644
--- a/tests/input/func_3k_removed_stuff_py_30.py
+++ b/tests/input/func_3k_removed_stuff_py_30.py
@@ -1,4 +1,4 @@
-"""test relative import"""
+"""test relative import."""
from __future__ import print_function
import func_w0401
@@ -6,7 +6,7 @@ __revision__ = filter(None, map(str, (1, 2, 3)))
def function():
- """something"""
+ """something."""
print(func_w0401)
unic = u"unicode"
low = unic.looower
diff --git a/tests/input/func_i0011.py b/tests/input/func_i0011.py
index a4ef215bc..9f9fa5c53 100644
--- a/tests/input/func_i0011.py
+++ b/tests/input/func_i0011.py
@@ -1,4 +1,3 @@
# pylint:disable=W0404
-"""check warning on local disabling
-"""
+"""check warning on local disabling."""
__revision__ = 1
diff --git a/tests/input/func_i0012.py b/tests/input/func_i0012.py
index 9b6fbe79f..3c59a046f 100644
--- a/tests/input/func_i0012.py
+++ b/tests/input/func_i0012.py
@@ -1,4 +1,3 @@
# pylint:enable=W0404
-"""check warning on local enabling
-"""
+"""check warning on local enabling."""
__revision__ = 1
diff --git a/tests/input/func_i0013.py b/tests/input/func_i0013.py
index 0a3f83367..581ec68ed 100644
--- a/tests/input/func_i0013.py
+++ b/tests/input/func_i0013.py
@@ -1,5 +1,5 @@
# pylint: skip-file
-"""disable-all is usable as an inline option"""
+"""disable-all is usable as an inline option."""
# no warning should be issued
try:
diff --git a/tests/input/func_i0014.py b/tests/input/func_i0014.py
index 63ff37c9f..0504e8b3f 100644
--- a/tests/input/func_i0014.py
+++ b/tests/input/func_i0014.py
@@ -1,5 +1,5 @@
# pylint: disable-all
-"""disable-all is usable as an inline option"""
+"""disable-all is usable as an inline option."""
# no warning should be issued
try:
diff --git a/tests/input/func_return_yield_mix_py_33.py b/tests/input/func_return_yield_mix_py_33.py
index b120b80ac..8aeda1901 100644
--- a/tests/input/func_return_yield_mix_py_33.py
+++ b/tests/input/func_return_yield_mix_py_33.py
@@ -1,14 +1,14 @@
-"""pylint should detect yield and return mix inside generators"""
+"""pylint should detect yield and return mix inside generators."""
# pylint: disable=using-constant-test, inconsistent-return-statements
def somegen():
- """this is a bad generator"""
+ """this is a bad generator."""
if True:
return 1
else:
yield 2
def moregen():
- """this is another bad generator"""
+ """this is another bad generator."""
if True:
yield 1
else:
diff --git a/tests/input/func_w0122_py_30.py b/tests/input/func_w0122_py_30.py
index 6b8669130..d5ede6508 100644
--- a/tests/input/func_w0122_py_30.py
+++ b/tests/input/func_w0122_py_30.py
@@ -1,4 +1,4 @@
-"""test global statement"""
+"""test global statement."""
__revision__ = 0
@@ -8,5 +8,5 @@ exec 'a = 1' in {}
exec 'a = 1' in globals()
def func():
- """exec in local scope"""
+ """exec in local scope."""
exec 'b = 1'
diff --git a/tests/input/func_w0401.py b/tests/input/func_w0401.py
index f8fae2447..f4c3ab7de 100644
--- a/tests/input/func_w0401.py
+++ b/tests/input/func_w0401.py
@@ -1,5 +1,4 @@
-"""test cyclic import
-"""
+"""test cyclic import."""
from __future__ import print_function
diff --git a/tests/input/func_w0401_disabled.py b/tests/input/func_w0401_disabled.py
index 955188f08..60e41117e 100644
--- a/tests/input/func_w0401_disabled.py
+++ b/tests/input/func_w0401_disabled.py
@@ -1,5 +1,4 @@
-"""test cyclic import
-"""
+"""test cyclic import."""
from __future__ import print_function
diff --git a/tests/input/func_w0401_disabled_in_func.py b/tests/input/func_w0401_disabled_in_func.py
index c0013d831..4186ff5df 100644
--- a/tests/input/func_w0401_disabled_in_func.py
+++ b/tests/input/func_w0401_disabled_in_func.py
@@ -1,11 +1,10 @@
-"""Test disabling of cyclic import check inside a function
-"""
+"""Test disabling of cyclic import check inside a function."""
# pylint: disable=import-outside-toplevel
from __future__ import print_function
def func():
- """Test disabling of cyclic import check inside a function"""
+ """Test disabling of cyclic import check inside a function."""
from . import w0401_cycle # pylint: disable=cyclic-import
if w0401_cycle:
print(w0401_cycle)
diff --git a/tests/input/func_w0801.py b/tests/input/func_w0801.py
index 45b57b441..4e9d13a2f 100644
--- a/tests/input/func_w0801.py
+++ b/tests/input/func_w0801.py
@@ -1,6 +1,4 @@
-"""test code similarities
-by default docstring are not considered
-"""
+"""test code similarities by default docstring are not considered."""
__revision__ = 'id'
A = 2
B = 3
diff --git a/tests/input/not__init__.py b/tests/input/not__init__.py
index 60e92b76c..a05279e31 100644
--- a/tests/input/not__init__.py
+++ b/tests/input/not__init__.py
@@ -1 +1 @@
-"""test"""
+"""test."""
diff --git a/tests/input/similar_lines_a.py b/tests/input/similar_lines_a.py
index 65a72a79d..4f5cd7ac5 100644
--- a/tests/input/similar_lines_a.py
+++ b/tests/input/similar_lines_a.py
@@ -1,6 +1,7 @@
-""" A file designed to have lines of similarity when compared to similar_lines_b
+"""A file designed to have lines of similarity when compared to similar_lines_b.
-We use lorm-ipsum to generate 'random' code. """
+We use lorm-ipsum to generate 'random' code.
+"""
# Copyright (c) 2020 Frank Harrison <frank@doublethefish.com>
diff --git a/tests/input/similar_lines_b.py b/tests/input/similar_lines_b.py
index 21634883d..996ca2db9 100644
--- a/tests/input/similar_lines_b.py
+++ b/tests/input/similar_lines_b.py
@@ -1,7 +1,8 @@
-""" The sister file of similar_lines_a, another file designed to have lines of
-similarity when compared to its sister file
+"""The sister file of similar_lines_a, another file designed to have lines of similarity
+when compared to its sister file.
-As with the sister file, we use lorm-ipsum to generate 'random' code. """
+As with the sister file, we use lorm-ipsum to generate 'random' code.
+"""
# Copyright (c) 2020 Frank Harrison <frank@doublethefish.com>
diff --git a/tests/input/w0401_cycle.py b/tests/input/w0401_cycle.py
index 37be7c562..d4fe48c9d 100644
--- a/tests/input/w0401_cycle.py
+++ b/tests/input/w0401_cycle.py
@@ -1,5 +1,4 @@
-"""w0401 dependency
-"""
+"""w0401 dependency."""
from __future__ import print_function
diff --git a/tests/input/w0801_same.py b/tests/input/w0801_same.py
index 45b57b441..4e9d13a2f 100644
--- a/tests/input/w0801_same.py
+++ b/tests/input/w0801_same.py
@@ -1,6 +1,4 @@
-"""test code similarities
-by default docstring are not considered
-"""
+"""test code similarities by default docstring are not considered."""
__revision__ = 'id'
A = 2
B = 3
diff --git a/tests/lint/unittest_expand_modules.py b/tests/lint/unittest_expand_modules.py
index 4d2cc812e..bb00a67ac 100644
--- a/tests/lint/unittest_expand_modules.py
+++ b/tests/lint/unittest_expand_modules.py
@@ -78,10 +78,10 @@ init_of_package = {
class TestExpandModules(CheckerTestCase):
- """Test the expand_modules function while allowing options to be set"""
+ """Test the expand_modules function while allowing options to be set."""
class Checker(BaseChecker):
- """This dummy checker is needed to allow options to be set"""
+ """This dummy checker is needed to allow options to be set."""
name = "checker"
msgs: Dict[str, Tuple[str, ...]] = {}
@@ -107,7 +107,7 @@ class TestExpandModules(CheckerTestCase):
)
@set_config(ignore_paths="")
def test_expand_modules(self, files_or_modules, expected):
- """Test expand_modules with the default value of ignore-paths"""
+ """Test expand_modules with the default value of ignore-paths."""
ignore_list, ignore_list_re = [], []
modules, errors = expand_modules(
files_or_modules,
@@ -133,7 +133,7 @@ class TestExpandModules(CheckerTestCase):
)
@set_config(ignore_paths=".*/lint/.*")
def test_expand_modules_with_ignore(self, files_or_modules, expected):
- """Test expand_modules with a non-default value of ignore-paths"""
+ """Test expand_modules with a non-default value of ignore-paths."""
ignore_list, ignore_list_re = [], []
modules, errors = expand_modules(
files_or_modules,
diff --git a/tests/primer/test_primer_external.py b/tests/primer/test_primer_external.py
index 12206b0fc..30cee8822 100644
--- a/tests/primer/test_primer_external.py
+++ b/tests/primer/test_primer_external.py
@@ -68,12 +68,11 @@ class TestPrimer:
@staticmethod
def _primer_test(package: PackageToLint, caplog: LogCaptureFixture) -> None:
- """Runs pylint over external packages to check for crashes and fatal messages
+ """Runs pylint over external packages to check for crashes and fatal messages.
- We only check for crashes (bit-encoded exit code 32) and fatal messages
- (bit-encoded exit code 1). We assume that these external repositories do not
- have any fatal errors in their code so that any fatal errors are pylint false
- positives
+ We only check for crashes (bit-encoded exit code 32) and fatal messages (bit-
+ encoded exit code 1). We assume that these external repositories do not have any
+ fatal errors in their code so that any fatal errors are pylint false positives
"""
caplog.set_level(logging.INFO)
package.lazy_clone()
diff --git a/tests/primer/test_primer_stdlib.py b/tests/primer/test_primer_stdlib.py
index 96c847bc8..72f5cdfab 100644
--- a/tests/primer/test_primer_stdlib.py
+++ b/tests/primer/test_primer_stdlib.py
@@ -46,7 +46,9 @@ MODULES_NAMES = [m[1] for m in MODULES_TO_CHECK]
def test_primer_stdlib_no_crash(
test_module_location: str, test_module_name: str, capsys: CaptureFixture
) -> None:
- """Test that pylint does not produce any crashes or fatal errors on stdlib modules"""
+ """Test that pylint does not produce any crashes or fatal errors on stdlib
+ modules.
+ """
__tracebackhide__ = True # pylint: disable=unused-variable
os.chdir(test_module_location)
with _patch_stdout(io.StringIO()):
diff --git a/tests/pyreverse/test_diagrams.py b/tests/pyreverse/test_diagrams.py
index db8a4e645..b307a37d8 100644
--- a/tests/pyreverse/test_diagrams.py
+++ b/tests/pyreverse/test_diagrams.py
@@ -5,7 +5,7 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-"""Unit test for the diagrams modules"""
+"""Unit test for the diagrams modules."""
from typing import Callable
from pylint.pyreverse.diadefslib import DefaultDiadefGenerator, DiadefsHandler
diff --git a/tests/pyreverse/test_main.py b/tests/pyreverse/test_main.py
index 792bcbb8b..a40121d49 100644
--- a/tests/pyreverse/test_main.py
+++ b/tests/pyreverse/test_main.py
@@ -1,4 +1,4 @@
-"""Unittest for the main module"""
+"""Unittest for the main module."""
import os
import sys
from typing import Iterator
@@ -25,6 +25,7 @@ def setup_path(request) -> Iterator:
@pytest.mark.usefixtures("setup_path")
def test_project_root_in_sys_path():
"""Test the context manager adds the project root directory to sys.path.
+
This should happen when pyreverse is run from any directory
"""
with fix_import_path([TEST_DATA_DIR]):
diff --git a/tests/pyreverse/test_printer_factory.py b/tests/pyreverse/test_printer_factory.py
index f39b90dad..73a5e2670 100644
--- a/tests/pyreverse/test_printer_factory.py
+++ b/tests/pyreverse/test_printer_factory.py
@@ -3,7 +3,7 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
-"""Unit tests for pylint.pyreverse.printer_factory"""
+"""Unit tests for pylint.pyreverse.printer_factory."""
import pytest
diff --git a/tests/pyreverse/test_utils.py b/tests/pyreverse/test_utils.py
index 94ee858e0..e126966af 100644
--- a/tests/pyreverse/test_utils.py
+++ b/tests/pyreverse/test_utils.py
@@ -8,7 +8,7 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# For details: https://github.com/PyCQA/pylint/blob/master/LICENSE
-"""Tests for pylint.pyreverse.utils"""
+"""Tests for pylint.pyreverse.utils."""
from typing import Any
from unittest.mock import patch
@@ -48,7 +48,7 @@ def test_get_visibility(names, expected):
],
)
def test_get_annotation_annassign(assign, label):
- """AnnAssign"""
+ """AnnAssign."""
node = astroid.extract_node(assign)
got = get_annotation(node.value).name
assert isinstance(node, nodes.AnnAssign)
@@ -67,7 +67,7 @@ def test_get_annotation_annassign(assign, label):
],
)
def test_get_annotation_assignattr(init_method, label):
- """AssignAttr"""
+ """AssignAttr."""
assign = fr"""
class A:
{init_method}
@@ -84,8 +84,8 @@ def test_get_annotation_assignattr(init_method, label):
@patch("pylint.pyreverse.utils.get_annotation")
@patch("astroid.node_classes.NodeNG.infer", side_effect=astroid.InferenceError)
def test_infer_node_1(mock_infer: Any, mock_get_annotation: Any) -> None:
- """Return set() when astroid.InferenceError is raised and an annotation has
- not been returned
+ """Return set() when astroid.InferenceError is raised and an annotation has not been
+ returned.
"""
mock_get_annotation.return_value = None
node = astroid.extract_node("a: str = 'mystr'")
@@ -97,8 +97,8 @@ def test_infer_node_1(mock_infer: Any, mock_get_annotation: Any) -> None:
@patch("pylint.pyreverse.utils.get_annotation")
@patch("astroid.node_classes.NodeNG.infer")
def test_infer_node_2(mock_infer: Any, mock_get_annotation: Any) -> None:
- """Return set(node.infer()) when InferenceError is not raised and an
- annotation has not been returned
+ """Return set(node.infer()) when InferenceError is not raised and an annotation has
+ not been returned.
"""
mock_get_annotation.return_value = None
node = astroid.extract_node("a: str = 'mystr'")
@@ -108,8 +108,8 @@ def test_infer_node_2(mock_infer: Any, mock_get_annotation: Any) -> None:
def test_infer_node_3() -> None:
- """Return a set containing a nodes.ClassDef object when the attribute
- has a type annotation
+ """Return a set containing a nodes.ClassDef object when the attribute has a type
+ annotation.
"""
node = astroid.extract_node(
"""
@@ -127,9 +127,7 @@ def test_infer_node_3() -> None:
def test_infer_node_4() -> None:
- """Verify the label for an argument with a typehint of the type
- nodes.Subscript
- """
+ """Verify the label for an argument with a typehint of the type nodes.Subscript."""
node = astroid.extract_node(
"""
class MyClass:
diff --git a/tests/regrtest_data/absimp/__init__.py b/tests/regrtest_data/absimp/__init__.py
index fdabe9f78..9c0a68431 100644
--- a/tests/regrtest_data/absimp/__init__.py
+++ b/tests/regrtest_data/absimp/__init__.py
@@ -1,4 +1,3 @@
-"""a package with absolute import activated
-"""
+"""a package with absolute import activated."""
from __future__ import absolute_import
diff --git a/tests/regrtest_data/absimp/string.py b/tests/regrtest_data/absimp/string.py
index 9a60e26ab..cf891ec51 100644
--- a/tests/regrtest_data/absimp/string.py
+++ b/tests/regrtest_data/absimp/string.py
@@ -1,7 +1,4 @@
-"""
-https://www.logilab.org/ticket/70495
-https://www.logilab.org/ticket/70565
-"""
+"""https://www.logilab.org/ticket/70495 https://www.logilab.org/ticket/70565."""
from __future__ import absolute_import, print_function
import string
print(string)
diff --git a/tests/regrtest_data/bad_package/__init__.py b/tests/regrtest_data/bad_package/__init__.py
index 16c3a1562..e5a695b74 100644
--- a/tests/regrtest_data/bad_package/__init__.py
+++ b/tests/regrtest_data/bad_package/__init__.py
@@ -1,2 +1,2 @@
import missing
-raise missing.Missing..
+raise missing.Missing..
diff --git a/tests/regrtest_data/bad_package/wrong.py b/tests/regrtest_data/bad_package/wrong.py
index 2d2d78f98..f43e3d3ee 100644
--- a/tests/regrtest_data/bad_package/wrong.py
+++ b/tests/regrtest_data/bad_package/wrong.py
@@ -1,5 +1,3 @@
-"""
-Test that pylint doesn't crash when a relative import
-depends on the local __init__, which contains an expected syntax error.
-"""
+"""Test that pylint doesn't crash when a relative import depends on the local __init__,
+which contains an expected syntax error."""
from . import missing
diff --git a/tests/regrtest_data/beyond_top/__init__.py b/tests/regrtest_data/beyond_top/__init__.py
index 788cf4510..889f25dbf 100644
--- a/tests/regrtest_data/beyond_top/__init__.py
+++ b/tests/regrtest_data/beyond_top/__init__.py
@@ -3,4 +3,4 @@ from . import data
try:
from ... import Lala
except ImportError:
- pass
+ pass
diff --git a/tests/regrtest_data/classdoc_usage.py b/tests/regrtest_data/classdoc_usage.py
index 2d9df51cd..4d30d36e7 100644
--- a/tests/regrtest_data/classdoc_usage.py
+++ b/tests/regrtest_data/classdoc_usage.py
@@ -4,14 +4,14 @@ __revision__ = None
# pylint: disable=useless-object-inheritance
class SomeClass(object):
- """cds"""
+ """Cds."""
doc = __doc__
def __init__(self):
- """only to make pylint happier"""
+ """only to make pylint happier."""
def please(self):
- """public method 1/2"""
+ """public method 1/2."""
def besilent(self):
- """public method 2/2"""
+ """public method 2/2."""
diff --git a/tests/regrtest_data/decimal_inference.py b/tests/regrtest_data/decimal_inference.py
index 00c913040..a220bfab2 100644
--- a/tests/regrtest_data/decimal_inference.py
+++ b/tests/regrtest_data/decimal_inference.py
@@ -1,5 +1,5 @@
-"""hum E1011 on .prec member is justifiable since Context instance are built
-using setattr/locals :(
+"""hum E1011 on .prec member is justifiable since Context instance are built using
+setattr/locals :(
2007/02/17 update: .prec attribute is now detected by astroid :o)
"""
diff --git a/tests/regrtest_data/fail_on.py b/tests/regrtest_data/fail_on.py
index 6f22e5013..26fe8f599 100644
--- a/tests/regrtest_data/fail_on.py
+++ b/tests/regrtest_data/fail_on.py
@@ -1,6 +1,4 @@
-"""
- Pylint score: -1.67
-"""
+"""Pylint score: -1.67."""
import nonexistent
# pylint: disable=broad-except
diff --git a/tests/regrtest_data/fail_on_info_only.py b/tests/regrtest_data/fail_on_info_only.py
index c6baffed0..4d69870cc 100644
--- a/tests/regrtest_data/fail_on_info_only.py
+++ b/tests/regrtest_data/fail_on_info_only.py
@@ -1,6 +1,4 @@
-"""
- Pylint score: -1.67
-"""
+"""Pylint score: -1.67."""
# pylint: disable=broad-except
def loop():
diff --git a/tests/regrtest_data/fail_under_minus10.py b/tests/regrtest_data/fail_under_minus10.py
index 5ce3785ba..34adf5260 100644
--- a/tests/regrtest_data/fail_under_minus10.py
+++ b/tests/regrtest_data/fail_under_minus10.py
@@ -1,6 +1,4 @@
-"""
- Pylint score: -10
-"""
+"""Pylint score: -10."""
import nonexistent
diff --git a/tests/regrtest_data/fail_under_plus7_5.py b/tests/regrtest_data/fail_under_plus7_5.py
index fea27f4ec..83b217dba 100644
--- a/tests/regrtest_data/fail_under_plus7_5.py
+++ b/tests/regrtest_data/fail_under_plus7_5.py
@@ -1,6 +1,4 @@
-""""
- pylint score: +7.50
-"""
+"""" pylint score: +7.50."""
import os
diff --git a/tests/regrtest_data/func_block_disable_msg.py b/tests/regrtest_data/func_block_disable_msg.py
index 8a94ab4f3..3fbbc2587 100644
--- a/tests/regrtest_data/func_block_disable_msg.py
+++ b/tests/regrtest_data/func_block_disable_msg.py
@@ -1,32 +1,32 @@
# pylint: disable=C0302,bare-except, useless-object-inheritance
-"""pylint option block-disable"""
+"""pylint option block-disable."""
from __future__ import print_function
class Foo(object):
- """block-disable test"""
+ """block-disable test."""
def __init__(self):
self._test = "42"
def meth1(self, arg):
- """this issues a message"""
+ """this issues a message."""
print(self)
def meth2(self, arg):
- """and this one not"""
+ """and this one not."""
# pylint: disable=W0613
print(self._test\
+ "foo")
def meth3(self):
- """test one line disabling"""
+ """test one line disabling."""
# no error
print(self.bla) # pylint: disable=E1101
# error
print(self.blop)
def meth4(self):
- """test re-enabling"""
+ """test re-enabling."""
# pylint: disable=E1101
# no error
print(self.bla)
@@ -36,7 +36,7 @@ class Foo(object):
print(self.blip)
def meth5(self):
- """test IF sub-block re-enabling"""
+ """test IF sub-block re-enabling."""
# pylint: disable=E1101
# no error
print(self.bla)
@@ -51,7 +51,7 @@ class Foo(object):
print(self.blip)
def meth6(self):
- """test TRY/EXCEPT sub-block re-enabling"""
+ """test TRY/EXCEPT sub-block re-enabling."""
# pylint: disable=E1101
# no error
print(self.bla)
@@ -66,7 +66,7 @@ class Foo(object):
print(self.blip)
def meth7(self):
- """test one line block opening disabling"""
+ """test one line block opening disabling."""
if self.blop: # pylint: disable=E1101
# error
print(self.blip)
@@ -78,7 +78,7 @@ class Foo(object):
def meth8(self):
- """test late disabling"""
+ """test late disabling."""
# error
print(self.blip)
# pylint: disable=E1101
@@ -87,7 +87,7 @@ class Foo(object):
print(self.blop)
def meth9(self):
- """test re-enabling right after a block with whitespace"""
+ """test re-enabling right after a block with whitespace."""
eris = 5
if eris: # pylint: disable=using-constant-test
@@ -102,7 +102,7 @@ class Foo(object):
print(self.blip)
def meth10(self):
- """Test double disable"""
+ """Test double disable."""
# pylint: disable=E1101
# no error
print(self.bla)
@@ -111,8 +111,7 @@ class Foo(object):
class ClassLevelMessage(object):
- """shouldn't display to much attributes/not enough methods messages
- """
+ """shouldn't display to much attributes/not enough methods messages."""
# pylint: disable=R0902,R0903
def __init__(self):
@@ -128,8 +127,7 @@ class ClassLevelMessage(object):
self.attr0 = 1
def too_complex_but_thats_ok(self, attr1, attr2):
- """THIS Method has too much branches and returns but i don't care
- """
+ """THIS Method has too much branches and returns but i don't care."""
# pylint: disable=R0912,R0911
try:
attr3 = attr1+attr2
diff --git a/tests/regrtest_data/module_global.py b/tests/regrtest_data/module_global.py
index 107d65289..ac66b73db 100644
--- a/tests/regrtest_data/module_global.py
+++ b/tests/regrtest_data/module_global.py
@@ -1,6 +1,5 @@
# pylint: disable=W0603,W0601,W0604,E0602,W0104
-"""was causing infinite recursion
-"""
+"""was causing infinite recursion."""
__revision__ = 1
global GLOBAL_VAR
diff --git a/tests/regrtest_data/numarray_import.py b/tests/regrtest_data/numarray_import.py
index e89757f19..878abc245 100644
--- a/tests/regrtest_data/numarray_import.py
+++ b/tests/regrtest_data/numarray_import.py
@@ -1,4 +1,4 @@
-"""#10077"""
+"""#10077."""
__revision__ = 1
diff --git a/tests/regrtest_data/numarray_inf.py b/tests/regrtest_data/numarray_inf.py
index 4ea22a9c6..7a129de37 100644
--- a/tests/regrtest_data/numarray_inf.py
+++ b/tests/regrtest_data/numarray_inf.py
@@ -1,4 +1,4 @@
-"""#3216"""
+"""#3216."""
import numarray as na
import numarray.random_array as nar
diff --git a/tests/regrtest_data/package/AudioTime.py b/tests/regrtest_data/package/AudioTime.py
index ef65143c1..32b32bdd5 100644
--- a/tests/regrtest_data/package/AudioTime.py
+++ b/tests/regrtest_data/package/AudioTime.py
@@ -1,3 +1,3 @@
-"""test preceded by the AudioTime class in __init__.py"""
+"""test preceded by the AudioTime class in __init__.py."""
__revision__ = 0
diff --git a/tests/regrtest_data/package/__init__.py b/tests/regrtest_data/package/__init__.py
index 10cc40f6c..604c8ad4c 100644
--- a/tests/regrtest_data/package/__init__.py
+++ b/tests/regrtest_data/package/__init__.py
@@ -1,6 +1,6 @@
# pylint: disable=R0903
-"""package's __init__ file"""
+"""package's __init__ file."""
from . import subpackage
@@ -10,6 +10,6 @@ __revision__ = 0
__path__ += "folder"
class AudioTime:
- """test precedence over the AudioTime submodule"""
+ """test precedence over the AudioTime submodule."""
DECIMAL = 3
diff --git a/tests/regrtest_data/package/subpackage/__init__.py b/tests/regrtest_data/package/subpackage/__init__.py
index dc4782e6c..1e6dcbd4a 100644
--- a/tests/regrtest_data/package/subpackage/__init__.py
+++ b/tests/regrtest_data/package/subpackage/__init__.py
@@ -1 +1 @@
-"""package.subpackage"""
+"""package.subpackage."""
diff --git a/tests/regrtest_data/package/subpackage/module.py b/tests/regrtest_data/package/subpackage/module.py
index 4b7244ba0..2d6a39fd3 100644
--- a/tests/regrtest_data/package/subpackage/module.py
+++ b/tests/regrtest_data/package/subpackage/module.py
@@ -1 +1 @@
-"""package.subpackage.module"""
+"""package.subpackage.module."""
diff --git a/tests/regrtest_data/package_all/__init__.py b/tests/regrtest_data/package_all/__init__.py
index 4e3696bec..60fbb0ad5 100644
--- a/tests/regrtest_data/package_all/__init__.py
+++ b/tests/regrtest_data/package_all/__init__.py
@@ -1,3 +1,3 @@
-""" Check for E0603 for missing submodule found in __all__ """
+"""Check for E0603 for missing submodule found in __all__"""
__revision__ = 1
__all__ = ['notmissing', 'missing']
diff --git a/tests/regrtest_data/package_all/notmissing.py b/tests/regrtest_data/package_all/notmissing.py
index 7cf85430a..a8f6858f0 100644
--- a/tests/regrtest_data/package_all/notmissing.py
+++ b/tests/regrtest_data/package_all/notmissing.py
@@ -1,2 +1,2 @@
-""" empty """
+"""empty."""
__revision__ = 1
diff --git a/tests/regrtest_data/wrong_import_position.py b/tests/regrtest_data/wrong_import_position.py
index 9e2d099e0..63a2ec36a 100644
--- a/tests/regrtest_data/wrong_import_position.py
+++ b/tests/regrtest_data/wrong_import_position.py
@@ -1,6 +1,4 @@
-"""Test that wrong-import-position is properly reset when
-other errors are disabled.
-"""
+"""Test that wrong-import-position is properly reset when other errors are disabled."""
# pylint: disable=unused-import, too-few-public-methods
diff --git a/tests/test_epylint.py b/tests/test_epylint.py
index 4f2d2aad0..a24f73152 100644
--- a/tests/test_epylint.py
+++ b/tests/test_epylint.py
@@ -1,4 +1,4 @@
-"""Test for issue https://github.com/PyCQA/pylint/issues/4286"""
+"""Test for issue https://github.com/PyCQA/pylint/issues/4286."""
# pylint: disable=redefined-outer-name
from pathlib import PosixPath
@@ -9,7 +9,7 @@ from pylint import epylint as lint
@pytest.fixture()
def example_path(tmp_path: PosixPath) -> PosixPath:
- content = """class IvrAudioApp:
+ content = """Class IvrAudioApp:
def run(self):
self.hassan()
diff --git a/tests/test_import_graph.py b/tests/test_import_graph.py
index 6035601bf..bede4c903 100644
--- a/tests/test_import_graph.py
+++ b/tests/test_import_graph.py
@@ -47,7 +47,7 @@ POSSIBLE_DOT_FILENAMES = ["foo.dot", "foo.gv", "tests/regrtest_data/foo.dot"]
@pytest.mark.parametrize("dest", POSSIBLE_DOT_FILENAMES, indirect=True)
def test_dependencies_graph(dest: str) -> None:
- """DOC files are correctly generated, and the graphname is the basename"""
+ """DOC files are correctly generated, and the graphname is the basename."""
imports._dependencies_graph(dest, {"labas": {"hoho", "yep"}, "hoho": {"yep"}})
with open(dest, encoding="utf-8") as stream:
assert (
@@ -73,7 +73,9 @@ URL="." node[shape="box"]
any(shutil.which(x) for x in ("dot", "gv")), reason="dot or gv is installed"
)
def test_missing_graphviz(filename: str) -> None:
- """Raises if graphviz is not installed, and defaults to png if no extension given"""
+ """Raises if graphviz is not installed, and defaults to png if no extension
+ given.
+ """
with pytest.raises(RuntimeError, match=r"Cannot generate `graph\.png`.*"):
imports._dependencies_graph(filename, {"a": {"b", "c"}, "b": {"c"}})
diff --git a/tests/test_pylint_runners.py b/tests/test_pylint_runners.py
index 88113cb2c..e4b20c0a8 100644
--- a/tests/test_pylint_runners.py
+++ b/tests/test_pylint_runners.py
@@ -27,7 +27,7 @@ def test_runner(runner: Callable, tmpdir: LocalPath) -> None:
"runner", [run_epylint, run_pylint, run_pyreverse, run_symilar]
)
def test_runner_with_arguments(runner: Callable, tmpdir: LocalPath) -> None:
- """Check the runners with arguments as parameter instead of sys.argv"""
+ """Check the runners with arguments as parameter instead of sys.argv."""
filepath = os.path.abspath(__file__)
testargs = [filepath]
with tmpdir.as_cwd():
diff --git a/tests/testutils/data/init_hook.py b/tests/testutils/data/init_hook.py
index f16492d3a..f28633ea8 100644
--- a/tests/testutils/data/init_hook.py
+++ b/tests/testutils/data/init_hook.py
@@ -1,3 +1,3 @@
-"""This file should never be tested as the init-hook in the configuration
-file prevents the test runner from getting here.
+"""This file should never be tested as the init-hook in the configuration file prevents
+the test runner from getting here.
"""
diff --git a/tests/testutils/test_decorator.py b/tests/testutils/test_decorator.py
index 0bd1fb119..4ab9d04f0 100644
--- a/tests/testutils/test_decorator.py
+++ b/tests/testutils/test_decorator.py
@@ -8,7 +8,7 @@ from pylint.testutils.decorator import set_config_directly
def test_deprecation_of_set_config_directly() -> None:
- """Test that the deprecation of set_config_directly works as expected"""
+ """Test that the deprecation of set_config_directly works as expected."""
with pytest.warns(DeprecationWarning) as records:
set_config_directly()
diff --git a/tests/testutils/test_output_line.py b/tests/testutils/test_output_line.py
index eafb3eb53..bfb879cd1 100644
--- a/tests/testutils/test_output_line.py
+++ b/tests/testutils/test_output_line.py
@@ -89,8 +89,8 @@ def test_output_line_from_message(message: Callable) -> None:
@pytest.mark.parametrize("confidence", [HIGH, INFERENCE])
def test_output_line_to_csv(confidence: Confidence, message: Callable) -> None:
- """Test that the OutputLine NamedTuple is instantiated correctly with from_msg
- and then converted to csv.
+ """Test that the OutputLine NamedTuple is instantiated correctly with from_msg and
+ then converted to csv.
"""
output_line = OutputLine.from_msg(message(confidence), True)
csv = output_line.to_csv()
@@ -142,6 +142,7 @@ def test_output_line_from_csv_deprecated(
confidence: Optional[str], expected_confidence: str
) -> None:
"""Test that the OutputLine NamedTuple is instantiated correctly with from_csv.
+
Test OutputLine's of length 5 or 6.
"""
if confidence:
@@ -174,6 +175,7 @@ def test_output_line_from_csv_deprecated(
def test_output_line_from_csv() -> None:
"""Test that the OutputLine NamedTuple is instantiated correctly with from_csv.
+
Test OutputLine of length 8.
"""
proper_csv = [
diff --git a/tests/unittest_reporters_json.py b/tests/unittest_reporters_json.py
index a1b76fe10..be7aadaba 100644
--- a/tests/unittest_reporters_json.py
+++ b/tests/unittest_reporters_json.py
@@ -28,7 +28,7 @@ expected_score_message = "Expected score message"
def test_simple_json_output_no_score() -> None:
- """Test JSON reporter with no score"""
+ """Test JSON reporter with no score."""
message = {
"msg": "line-too-long",
"line": 1,
@@ -57,7 +57,7 @@ def test_simple_json_output_no_score() -> None:
def test_simple_json_output_no_score_with_end_line() -> None:
- """Test JSON reporter with no score with end_line and end_column"""
+ """Test JSON reporter with no score with end_line and end_column."""
message = {
"msg": "line-too-long",
"line": 1,
diff --git a/tests/unittest_reporting.py b/tests/unittest_reporting.py
index 1ee947759..b414c1c26 100644
--- a/tests/unittest_reporting.py
+++ b/tests/unittest_reporting.py
@@ -58,7 +58,7 @@ def test_template_option(linter):
def test_template_option_default(linter) -> None:
- """Test the default msg-template setting"""
+ """Test the default msg-template setting."""
output = StringIO()
linter.reporter.out = output
linter.open()
@@ -72,7 +72,7 @@ def test_template_option_default(linter) -> None:
def test_template_option_end_line(linter) -> None:
- """Test the msg-template option with end_line and end_column"""
+ """Test the msg-template option with end_line and end_column."""
output = StringIO()
linter.reporter.out = output
linter.set_option(
@@ -93,8 +93,9 @@ def test_template_option_end_line(linter) -> None:
def test_template_option_non_existing(linter) -> None:
"""Test the msg-template option with non-existent options.
- This makes sure that this option remains backwards compatible as new
- parameters do not break on previous versions
+
+ This makes sure that this option remains backwards compatible as new parameters do
+ not break on previous versions
"""
output = StringIO()
linter.reporter.out = output
@@ -125,7 +126,7 @@ def test_template_option_non_existing(linter) -> None:
def test_deprecation_set_output(recwarn):
- """TODO remove in 3.0"""
+ """TODO remove in 3.0."""
reporter = BaseReporter()
# noinspection PyDeprecation
reporter.set_output(sys.stdout)