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

F841: Stabilize unpacking support #12839

Closed
wants to merge 1 commit into from

Conversation

MichaReiser
Copy link
Member

@MichaReiser MichaReiser commented Aug 12, 2024

Summary

This PR stabilizes the behavior change of F841 to support unpacking. See #8489

Open question

I'm unsure if we want to stabilize this change (in which case we should remove the implementation) because unpacking with too many values is an error.

>>> a = (1, 2)
>>> x, = a
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: too many values to unpack (expected 1)
>>> x, _ = a
>>> 

Test Plan

I reviewed the snapshot changes

@MichaReiser MichaReiser added this to the v0.6 milestone Aug 12, 2024
@MichaReiser MichaReiser added the rule Implementing or modifying a lint rule label Aug 12, 2024
Copy link
Contributor

ruff-ecosystem results

Linter (stable)

ℹ️ ecosystem check detected linter changes. (+1180 -1 violations, +0 -0 fixes in 37 projects; 17 projects unchanged)

RasaHQ/rasa (+39 -0 violations, +0 -0 fixes)

+ rasa/telemetry.py:594:30: F841 Local variable `tb` is assigned to but never used
+ rasa/telemetry.py:594:9: F841 Local variable `exc_type` is assigned to but never used
+ tests/cli/test_rasa_export.py:278:5: F841 Local variable `events` is assigned to but never used
+ tests/core/evaluation/test_marker.py:287:13: F841 Local variable `expected` is assigned to but never used
+ tests/core/evaluation/test_marker.py:307:13: F841 Local variable `expected` is assigned to but never used
+ tests/core/evaluation/test_marker.py:558:13: F841 Local variable `expected_size` is assigned to but never used
+ tests/core/evaluation/test_marker.py:583:13: F841 Local variable `expected_size` is assigned to but never used
+ tests/core/test_evaluation.py:152:23: F841 Local variable `num_stories` is assigned to but never used
+ tests/core/test_evaluation.py:319:23: F841 Local variable `num_stories` is assigned to but never used
+ tests/core/training/test_interactive.py:818:11: F841 Local variable `kwargs` is assigned to but never used
... 29 additional changes omitted for project

alteryx/featuretools (+20 -0 violations, +0 -0 fixes)

+ featuretools/computational_backends/feature_set.py:113:9: F841 Local variable `node_needs_full_dataframe` is assigned to but never used
+ featuretools/primitives/utils.py:122:9: F841 Local variable `trans_valid_inputs` is assigned to but never used
+ featuretools/primitives/utils.py:123:9: F841 Local variable `trans_return_type` is assigned to but never used
+ featuretools/primitives/utils.py:129:9: F841 Local variable `agg_valid_inputs` is assigned to but never used
+ featuretools/primitives/utils.py:130:9: F841 Local variable `agg_return_type` is assigned to but never used
+ featuretools/tests/computational_backend/test_calculate_feature_matrix.py:1562:9: F841 Local variable `client` is assigned to but never used
+ featuretools/tests/computational_backend/test_calculate_feature_matrix.py:1601:9: F841 Local variable `client` is assigned to but never used
+ featuretools/tests/primitive_tests/test_agg_feats.py:596:9: F841 Local variable `features` is assigned to but never used
+ featuretools/tests/primitive_tests/test_agg_feats.py:668:9: F841 Local variable `features` is assigned to but never used
+ featuretools/tests/primitive_tests/test_agg_feats.py:793:9: F841 Local variable `features` is assigned to but never used
... 10 additional changes omitted for project

PlasmaPy/PlasmaPy (+92 -0 violations, +0 -0 fixes)

+ src/plasmapy/analysis/fit_functions.py:898:22: F841 Local variable `b` is assigned to but never used
+ src/plasmapy/analysis/nullpoint.py:1384:17: F841 Local variable `eigen_vectors` is assigned to but never used
+ src/plasmapy/analysis/nullpoint.py:1384:5: F841 Local variable `eigen_vals` is assigned to but never used
+ src/plasmapy/analysis/nullpoint.py:461:5: F841 Local variable `ax` is assigned to but never used
+ src/plasmapy/analysis/nullpoint.py:462:5: F841 Local variable `ay` is assigned to but never used
+ src/plasmapy/analysis/nullpoint.py:463:5: F841 Local variable `az` is assigned to but never used
+ src/plasmapy/analysis/time_series/conditional_averaging.py:154:25: F841 Local variable `_` is assigned to but never used
+ src/plasmapy/diagnostics/charged_particle_radiography/synthetic_radiography.py:1230:12: F841 Local variable `y` is assigned to but never used
+ src/plasmapy/diagnostics/charged_particle_radiography/synthetic_radiography.py:1230:9: F841 Local variable `x` is assigned to but never used
+ src/plasmapy/diagnostics/langmuir.py:580:5: F841 Local variable `_` is assigned to but never used
... 82 additional changes omitted for project

apache/airflow (+82 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --no-preview --select ALL

+ airflow/cli/commands/celery_command.py:201:27: F841 Local variable `stdout` is assigned to but never used
+ airflow/cli/commands/celery_command.py:201:35: F841 Local variable `stderr` is assigned to but never used
+ airflow/cli/commands/celery_command.py:201:43: F841 Local variable `log_file` is assigned to but never used
+ airflow/configuration.py:1619:22: F841 Local variable `source` is assigned to but never used
+ airflow/configuration.py:686:25: F841 Local variable `should_continue` is assigned to but never used
+ airflow/providers/celery/cli/celery_command.py:217:27: F841 Local variable `stdout` is assigned to but never used
+ airflow/providers/celery/cli/celery_command.py:217:35: F841 Local variable `stderr` is assigned to but never used
+ airflow/providers/celery/cli/celery_command.py:217:43: F841 Local variable `log_file` is assigned to but never used
+ airflow/providers/cncf/kubernetes/executors/kubernetes_executor.py:399:26: F841 Local variable `command` is assigned to but never used
+ airflow/providers/cncf/kubernetes/executors/kubernetes_executor.py:399:35: F841 Local variable `kube_executor_config` is assigned to but never used
... 72 additional changes omitted for project

apache/superset (+11 -1 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --no-preview --select ALL

+ superset/commands/report/alert.py:155:13: F841 Local variable `executor` is assigned to but never used
+ tests/integration_tests/core_tests.py:307:21: F841 Local variable `tests` is assigned to but never used
+ tests/integration_tests/core_tests.py:770:27: ARG002 Unused method argument: `key`
- tests/integration_tests/core_tests.py:770:27: ARG002 Unused method argument: `key`
+ tests/integration_tests/dict_import_export_tests.py:166:9: F841 Local variable `table` is assigned to but never used
+ tests/integration_tests/dict_import_export_tests.py:171:9: F841 Local variable `table_over` is assigned to but never used
+ tests/integration_tests/dict_import_export_tests.py:195:9: F841 Local variable `table` is assigned to but never used
+ tests/integration_tests/dict_import_export_tests.py:200:9: F841 Local variable `table_over` is assigned to but never used
... 5 additional changes omitted for rule F841
... 4 additional changes omitted for project

aws/aws-sam-cli (+46 -0 violations, +0 -0 fixes)

+ tests/integration/init/test_init_command.py:1005:13: F841 Local variable `stdout_data` is assigned to but never used
+ tests/integration/init/test_init_command.py:1045:17: F841 Local variable `stdout_data` is assigned to but never used
+ tests/integration/init/test_init_command.py:1080:17: F841 Local variable `stdout_data` is assigned to but never used
+ tests/integration/init/test_init_command.py:118:17: F841 Local variable `stdout_data` is assigned to but never used
+ tests/integration/init/test_init_command.py:150:17: F841 Local variable `stdout_data` is assigned to but never used
+ tests/integration/init/test_init_command.py:182:17: F841 Local variable `stdout_data` is assigned to but never used
+ tests/integration/init/test_init_command.py:214:17: F841 Local variable `stdout_data` is assigned to but never used
+ tests/integration/init/test_init_command.py:248:17: F841 Local variable `stdout_data` is assigned to but never used
+ tests/integration/init/test_init_command.py:282:17: F841 Local variable `stdout_data` is assigned to but never used
+ tests/integration/init/test_init_command.py:316:17: F841 Local variable `stdout_data` is assigned to but never used
... 36 additional changes omitted for project

binary-husky/gpt_academic (+44 -0 violations, +0 -0 fixes)

+ crazy_functions/Conversation_To_File.py:78:9: F841 Local variable `html` is assigned to but never used
+ crazy_functions/agent_fns/python_comment_agent.py:151:9: F841 Local variable `begin` is assigned to but never used
+ crazy_functions/crazy_utils.py:105:21: F841 Local variable `p_ratio` is assigned to but never used
+ crazy_functions/crazy_utils.py:251:21: F841 Local variable `p_ratio` is assigned to but never used
+ crazy_functions/crazy_utils.py:588:13: F841 Local variable `stdout` is assigned to but never used
+ crazy_functions/crazy_utils.py:588:21: F841 Local variable `stderr` is assigned to but never used
+ crazy_functions/game_fns/game_interactive_story.py:97:13: F841 Local variable `image_url` is assigned to but never used
+ crazy_functions/latex_fns/latex_toolbox.py:603:17: F841 Local variable `stderr` is assigned to but never used
+ crazy_functions/latex_fns/latex_toolbox.py:603:9: F841 Local variable `stdout` is assigned to but never used
+ crazy_functions/pdf_fns/parse_pdf_via_doc2x.py:145:33: F841 Local variable `project_folder` is assigned to but never used
... 34 additional changes omitted for project

bokeh/bokeh (+25 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --no-preview --select ALL

+ src/bokeh/sphinxext/bokeh_model.py:121:34: F841 Local variable `arglist` is assigned to but never used
+ src/bokeh/sphinxext/bokeh_model.py:121:43: F841 Local variable `retann` is assigned to but never used
+ src/bokeh/sphinxext/bokeh_model.py:121:9: F841 Local variable `name_prefix` is assigned to but never used
+ src/bokeh/sphinxext/bokeh_options.py:108:36: F841 Local variable `arglist` is assigned to but never used
+ src/bokeh/sphinxext/bokeh_options.py:108:45: F841 Local variable `retann` is assigned to but never used
+ src/bokeh/sphinxext/bokeh_options.py:108:9: F841 Local variable `name_prefix` is assigned to but never used
+ src/bokeh/sphinxext/bokeh_plot.py:254:15: F841 Local variable `lineno` is assigned to but never used
+ src/bokeh/sphinxext/bokeh_settings.py:84:32: F841 Local variable `arglist` is assigned to but never used
+ src/bokeh/sphinxext/bokeh_settings.py:84:41: F841 Local variable `retann` is assigned to but never used
+ src/bokeh/sphinxext/bokeh_settings.py:84:9: F841 Local variable `name_prefix` is assigned to but never used
... 15 additional changes omitted for project

... Truncated remaining completed project reports due to GitHub comment length restrictions

Changes by rule (2 rules affected)

code total + violation - violation + fix - fix
F841 1179 1179 0 0 0
ARG002 2 1 1 0 0

Linter (preview)

✅ ecosystem check detected no linter changes.

@MichaReiser MichaReiser added the needs-decision Awaiting a decision from a maintainer label Aug 12, 2024
@AlexWaygood AlexWaygood changed the title F841: Stabalize unpacking support F841: Stabilize unpacking support Aug 12, 2024
@AlexWaygood
Copy link
Member

unpacking with too many values is an error

I'm not sure I understand how that's relevant to the behaviour being stabilised here. But I'm not sure we should stabilise this change while discussion in #8884 is still unresolved

@MichaReiser
Copy link
Member Author

Thanks. Yeah, what's mentioned in the issue is what I was concerned about. I'm starting to get to the conclusion that these should be separate rules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-decision Awaiting a decision from a maintainer rule Implementing or modifying a lint rule
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants