Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAINT: lint: fail inventory #19490

Closed
lucascolley opened this issue Nov 7, 2023 · 1 comment
Closed

MAINT: lint: fail inventory #19490

lucascolley opened this issue Nov 7, 2023 · 1 comment
Labels
defect A clear bug or issue that prevents SciPy from being installed or used as expected
Milestone

Comments

@lucascolley
Copy link
Member

Describe your issue.

Whilst working on updates to the linter, I have found 20 errors which will fail CI if PRs touch these files. These should either be fixed or noqa'd:

F841: Local variable ... is assigned to but never used (2):

  • benchmarks/benchmarks/tests/test_go_benchmark_functions.py:49:13:
  • benchmarks/benchmarks/tests/test_go_benchmark_functions.py:59:13:

E721: Do not compare types, use isinstance() (2):

  • scipy/_lib/_bunch.py:12:12:
  • scipy/io/tests/test_idl.py:18:8:

F401: ... imported but unused (6):

  • benchmarks/benchmarks/go_benchmark_functions/go_funcs_univariate.py:10:32:
  • doc/source/tutorial/examples/newton_krylov_preconditioning.py:1:17:
  • doc/source/tutorial/examples/optimize_global_2.py:3:34:
  • doc/source/tutorial/stats/plots/qmc_plot_mc.py:2:25:
  • doc/source/tutorial/stats/plots/qmc_plot_mc.py:3:30:
  • scipy/ndimage/tests/test_datatypes.py:3:8:

E731: Do not assign a lambda expression, use a def (10):

  • benchmarks/benchmarks/go_benchmark_functions/go_funcs_Z.py:180:9:
  • benchmarks/benchmarks/go_benchmark_functions/go_funcs_Z.py:181:9:
  • benchmarks/benchmarks/go_benchmark_functions/go_funcs_Z.py:182:9:
  • benchmarks/benchmarks/go_benchmark_functions/go_funcs_Z.py:183:9:
  • benchmarks/benchmarks/integrate.py:15:5:
  • benchmarks/benchmarks/integrate.py:16:5:
  • benchmarks/benchmarks/integrate.py:390:9:
  • benchmarks/benchmarks/integrate.py:391:9:
  • doc/source/tutorial/stats/plots/qmc_plot_conv_mc.py:49:5:
  • doc/source/tutorial/stats/plots/qmc_plot_conv_mc_sobol.py:53:5:

Reproducing Code Example

ruff check . --config='tools/lint.toml' --exclude scipy/_lib/highs --exclude scipy/_lib/array_api_compat

Error message

benchmarks/benchmarks/go_benchmark_functions/go_funcs_Z.py:180:9: E731 [*] Do not assign a `lambda` expression, use a `def`
benchmarks/benchmarks/go_benchmark_functions/go_funcs_Z.py:181:9: E731 [*] Do not assign a `lambda` expression, use a `def`
benchmarks/benchmarks/go_benchmark_functions/go_funcs_Z.py:182:9: E731 [*] Do not assign a `lambda` expression, use a `def`
benchmarks/benchmarks/go_benchmark_functions/go_funcs_Z.py:183:9: E731 [*] Do not assign a `lambda` expression, use a `def`
benchmarks/benchmarks/go_benchmark_functions/go_funcs_univariate.py:10:32: F401 [*] `scipy.misc.factorial` imported but unused
benchmarks/benchmarks/integrate.py:15:5: E731 [*] Do not assign a `lambda` expression, use a `def`
benchmarks/benchmarks/integrate.py:16:5: E731 [*] Do not assign a `lambda` expression, use a `def`
benchmarks/benchmarks/optimize.py:390:9: E731 [*] Do not assign a `lambda` expression, use a `def`
benchmarks/benchmarks/optimize.py:391:9: E731 [*] Do not assign a `lambda` expression, use a `def`
benchmarks/benchmarks/tests/test_go_benchmark_functions.py:49:13: F841 [*] Local variable `val` is assigned to but never used
benchmarks/benchmarks/tests/test_go_benchmark_functions.py:59:13: F841 [*] Local variable `bounds` is assigned to but never used
doc/source/tutorial/examples/newton_krylov_preconditioning.py:1:17: F401 [*] `numpy` imported but unused
doc/source/tutorial/examples/optimize_global_2.py:3:34: F401 [*] `mpl_toolkits.mplot3d.Axes3D` imported but unused
doc/source/tutorial/stats/plots/qmc_plot_conv_mc.py:49:5: E731 [*] Do not assign a `lambda` expression, use a `def`
doc/source/tutorial/stats/plots/qmc_plot_conv_mc_sobol.py:53:5: E731 [*] Do not assign a `lambda` expression, use a `def`
doc/source/tutorial/stats/plots/qmc_plot_mc.py:2:25: F401 [*] `scipy.stats.qmc` imported but unused
doc/source/tutorial/stats/plots/qmc_plot_mc.py:3:30: F401 [*] `scipy.stats._qmc.check_random_state` imported but unused
scipy/_lib/_bunch.py:12:12: E721 Do not compare types, use `isinstance()`
scipy/io/tests/test_idl.py:18:8: E721 Do not compare types, use `isinstance()`
scipy/ndimage/tests/test_datatypes.py:3:8: F401 [*] `sys` imported but unused

SciPy/NumPy/Python version and system information

scipy @ 4d50bca5eeabe650a8dc9729f32a886a48f13ba9
@lucascolley lucascolley added the defect A clear bug or issue that prevents SciPy from being installed or used as expected label Nov 7, 2023
@lucascolley
Copy link
Member Author

Down to 0 on main now... nice!

@j-bowhay j-bowhay added this to the 1.12.0 milestone Nov 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect A clear bug or issue that prevents SciPy from being installed or used as expected
Projects
None yet
Development

No branches or pull requests

2 participants