Skip to content

Fix flake8 in examples #20296

@rth

Description

@rth

Now that black fixed PEP8 for most of the code base in #18948 it would be nice to stop running flak8 on the diff, and instead make,

flake8 .

work.

This requires fixing a few flake8 issues in examples/ and doc/. That would correspond to just 50 LoC diff and I think it would be worth it.

Full list of errors,

./doc/conf.py:30:1: E402 module level import not at top of file
./doc/conf.py:31:1: E402 module level import not at top of file
./doc/conf.py:92:1: E402 module level import not at top of file
./doc/conftest.py:31:5: F841 local variable 'data_home' is assigned to but never used
./examples/applications/plot_face_recognition.py:152:1: E305 expected 2 blank lines after class or function definition, found 1
./examples/applications/plot_out_of_core_classification.py:56:1: E303 too many blank lines (3)
./examples/applications/svm_gui.py:336:1: E305 expected 2 blank lines after class or function definition, found 1
./examples/applications/wikipedia_principal_eigenvector.py:219:1: E305 expected 2 blank lines after class or function definition, found 1
./examples/calibration/plot_calibration_curve.py:83:5: F841 local variable 'fig' is assigned to but never used
./examples/calibration/plot_calibration_curve.py:129:1: E305 expected 2 blank lines after class or function definition, found 1
./examples/cluster/plot_adjusted_for_chance_measures.py:33:1: E302 expected 2 blank lines, found 1
./examples/cluster/plot_adjusted_for_chance_measures.py:61:1: E305 expected 2 blank lines after class or function definition, found 1
./examples/cluster/plot_agglomerative_clustering_metrics.py:54:1: E305 expected 2 blank lines after class or function definition, found 1
./examples/cluster/plot_digits_linkage.py:38:1: E302 expected 2 blank lines, found 1
./examples/cluster/plot_digits_linkage.py:44:35: E128 continuation line under-indented for visual indent
./examples/cluster/plot_digits_linkage.py:45:35: E128 continuation line under-indented for visual indent
./examples/cluster/plot_digits_linkage.py:46:35: E124 closing bracket does not match visual indentation
./examples/cluster/plot_digits_linkage.py:55:1: E265 block comment should start with '# '
./examples/cluster/plot_digits_linkage.py:74:1: E265 block comment should start with '# '
./examples/cluster/plot_digits_linkage.py:76:1: E305 expected 2 blank lines after class or function definition, found 1
./examples/cluster/plot_kmeans_stability_low_dim_dense.py:72:1: E305 expected 2 blank lines after class or function definition, found 1
./examples/datasets/plot_digits_last_image.py:29:1: E265 block comment should start with '# '
./examples/datasets/plot_digits_last_image.py:32:1: E265 block comment should start with '# '
./examples/decomposition/plot_faces_decomposition.py:66:1: E305 expected 2 blank lines after class or function definition, found 1
./examples/decomposition/plot_ica_blind_source_separation.py:62:34: W291 trailing whitespace
./examples/decomposition/plot_ica_vs_pca.py:83:1: E305 expected 2 blank lines after class or function definition, found 1
./examples/decomposition/plot_image_denoising.py:123:1: E305 expected 2 blank lines after class or function definition, found 1
./examples/decomposition/plot_pca_3d.py:40:1: E305 expected 2 blank lines after class or function definition, found 1
./examples/ensemble/plot_adaboost_regression.py:36:27: E128 continuation line under-indented for visual indent
./examples/ensemble/plot_gradient_boosting_regularization.py:44:89: E501 line too long (99 > 88 characters)
./examples/ensemble/plot_gradient_boosting_regularization.py:73:13: E128 continuation line under-indented for visual indent
./examples/feature_selection/plot_rfe_digits.py:11:89: E501 line too long (94 > 88 characters)
./examples/gaussian_process/plot_gpc_isoprobability.py:37:1: E305 expected 2 blank lines after class or function definition, found 1
./examples/gaussian_process/plot_gpr_noisy_targets.py:43:1: E305 expected 2 blank lines after class or function definition, found 1
./examples/linear_model/plot_robust_fit.py:69:89: E501 line too long (101 > 88 characters)
./examples/manifold/plot_swissroll.py:21:1: E265 block comment should start with '# '
./examples/manifold/plot_swissroll.py:32:1: E265 block comment should start with '# '
./examples/mixture/plot_concentration_prior.py:88:1: E305 expected 2 blank lines after class or function definition, found 1
./examples/mixture/plot_gmm_covariances.py:69:1: E305 expected 2 blank lines after class or function definition, found 1
./examples/model_selection/grid_search_text_feature_extraction.py:74:1: E265 block comment should start with '# '
./examples/model_selection/plot_precision_recall.py:176:1: F811 redefinition of unused 'precision_recall_curve' from line 136
./examples/model_selection/plot_precision_recall.py:190:5: E128 continuation line under-indented for visual indent
./examples/model_selection/plot_underfitting_overfitting.py:36:1: E305 expected 2 blank lines after class or function definition, found 1
./examples/neighbors/plot_kde_1d.py:106:1: E305 expected 2 blank lines after class or function definition, found 1
./examples/neighbors/plot_species_kde.py:14:89: E501 line too long (89 > 88 characters)
./examples/preprocessing/plot_all_scaling.py:109:1: E302 expected 2 blank lines, found 1
./examples/svm/plot_custom_kernel.py:19:23: E114 indentation is not a multiple of 4 (comment)
./examples/svm/plot_custom_kernel.py:19:23: E116 unexpected indentation (comment)
./examples/svm/plot_rbf_parameters.py:108:1: E305 expected 2 blank lines after class or function definition, found 1
./examples/compose/plot_column_transformer_mixed_types.py:183:7: F541 f-string is missing placeholders
./sklearn/preprocessing/_polynomial.py:281:21: F402 import 'comb' from line 11 shadowed by loop variable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions