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

[pylint] (Re-)Implement import-private-name (C2701) #9553

Merged
merged 2 commits into from
Jan 16, 2024

Conversation

tjkuson
Copy link
Contributor

@tjkuson tjkuson commented Jan 16, 2024

Summary

#5920 with a fix for the erroneous slice in module_name. Fixes #9547.

Test Plan

Added import bbb.ccc._ddd as eee to the test fixture to ensure it no longer panics.

cargo test

Includes fix for incorrect slice in astral-sh#5920.
@tjkuson tjkuson marked this pull request as ready for review January 16, 2024 18:18
Copy link
Contributor

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

ℹ️ ecosystem check detected linter changes. (+501 -0 violations, +0 -0 fixes in 12 projects; 31 projects unchanged)

DisnakeDev/disnake (+7 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --preview

+ disnake/ext/commands/base_core.py:26:27: PLC2701 Private name import `_generated` from external module `disnake.utils`
+ disnake/ext/commands/base_core.py:26:39: PLC2701 Private name import `_overload_with_permissions` from external module `disnake.utils`
+ disnake/ext/commands/core.py:31:5: PLC2701 Private name import `_generated` from external module `disnake.utils`
+ disnake/ext/commands/core.py:32:5: PLC2701 Private name import `_overload_with_permissions` from external module `disnake.utils`
+ disnake/ext/commands/flags.py:8:27: PLC2701 Private name import `_generated` from external module `disnake.utils`
+ disnake/ext/commands/params.py:41:29: PLC2701 Private name import `_channel_type_factory` from external module `disnake.channel`
+ docs/extensions/attributetable.py:13:27: PLC2701 Private name import `_` from external module `sphinx.locale`

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

ruff check --no-cache --exit-zero --preview --select ALL

+ airflow/api/auth/backend/kerberos_auth.py:55:51: PLC2701 Private name import `_request_ctx_stack` from external module `flask`
+ airflow/io/path.py:29:52: PLC2701 Private name import `_CloudAccessor` from external module `upath.implementations.cloud`
+ airflow/metrics/otel_logger.py:30:56: PLC2701 Private name import `_internal` from external module `opentelemetry.sdk.metrics`
+ airflow/metrics/otel_logger.py:30:79: PLC2701 Private name import `_internal` from external module `opentelemetry.sdk.metrics`
+ airflow/providers/google/cloud/hooks/gcs.py:858:49: PLC2701 Private name import `_blobs_page_start` from external module `google.cloud.storage.bucket`
+ airflow/providers/google/cloud/hooks/gcs.py:858:68: PLC2701 Private name import `_item_to_blob` from external module `google.cloud.storage.bucket`
+ airflow/providers/google/common/hooks/base_google.py:39:25: PLC2701 Private name import `_cloud_sdk` from external module `google.auth`
+ airflow/providers/google/common/hooks/base_google.py:42:35: PLC2701 Private name import `_http_client` from external module `google.auth.transport`
+ airflow/providers/google/common/utils/id_token_credentials.py:149:29: PLC2701 Private name import `_cloud_sdk` from external module `google.auth`
+ airflow/providers/google/common/utils/id_token_credentials.py:175:48: PLC2701 Private name import `_metadata` from external module `google.auth.compute_engine`
... 92 additional changes omitted for project

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

ruff check --no-cache --exit-zero --preview

+ schema/make_schema.py:12:32: PLC2701 Private name import `_SAM_CLI_COMMAND_PACKAGES` from external module `samcli.cli.command`
+ tests/integration/package/test_package_command_image.py:13:45: PLC2701 Private name import `_utils` from external module `samcli.commands`
+ tests/integration/sync/test_sync_adl.py:5:49: PLC2701 Private name import `_utils` from external module `samcli.commands`
+ tests/integration/sync/test_sync_adl.py:5:67: PLC2701 Private name import `_utils` from external module `samcli.commands`
+ tests/unit/commands/_utils/custom_options/test_hook_package_id_option.py:7:68: PLC2701 Private name import `_utils` from external module `samcli.commands`
+ tests/unit/commands/_utils/custom_options/test_hook_package_id_option.py:7:84: PLC2701 Private name import `_utils` from external module `samcli.commands`
+ tests/unit/commands/_utils/custom_options/test_option_nargs.py:4:64: PLC2701 Private name import `_utils` from external module `samcli.commands`
+ tests/unit/commands/_utils/custom_options/test_replace_help_summary_option.py:4:71: PLC2701 Private name import `_utils` from external module `samcli.commands`
+ tests/unit/commands/_utils/test_cdk_support_decorators.py:4:59: PLC2701 Private name import `_utils` from external module `samcli.commands`
+ tests/unit/commands/_utils/test_click_mutex.py:3:48: PLC2701 Private name import `_utils` from external module `samcli.commands`
+ tests/unit/commands/_utils/test_command_exception_handler.py:7:5: PLC2701 Private name import `_utils` from external module `samcli.commands`
+ tests/unit/commands/_utils/test_command_exception_handler.py:8:5: PLC2701 Private name import `_utils` from external module `samcli.commands`
+ tests/unit/commands/_utils/test_command_exception_handler.py:9:5: PLC2701 Private name import `_utils` from external module `samcli.commands`
+ tests/unit/commands/_utils/test_experimental.py:10:5: PLC2701 Private name import `_utils` from external module `samcli.commands`
+ tests/unit/commands/_utils/test_experimental.py:11:5: PLC2701 Private name import `_utils` from external module `samcli.commands`
+ tests/unit/commands/_utils/test_experimental.py:12:5: PLC2701 Private name import `_utils` from external module `samcli.commands`
+ tests/unit/commands/_utils/test_experimental.py:13:5: PLC2701 Private name import `_utils` from external module `samcli.commands`
+ tests/unit/commands/_utils/test_experimental.py:14:5: PLC2701 Private name import `_utils` from external module `samcli.commands`
... 169 additional changes omitted for project

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

ruff check --no-cache --exit-zero --preview --select ALL

+ src/bokeh/sphinxext/bokeh_sampledata_xref.py:39:27: PLC2701 Private name import `_` from external module `sphinx.locale`
+ tests/unit/bokeh/command/subcommands/test_json__subcommands.py:29:31: PLC2701 Private name import `_util_subcommands`
+ tests/unit/bokeh/core/property/test_aliases.py:29:28: PLC2701 Private name import `_util_property`
+ tests/unit/bokeh/core/property/test_aliases.py:29:43: PLC2701 Private name import `_util_property`
+ tests/unit/bokeh/core/property/test_any.py:22:28: PLC2701 Private name import `_util_property`
+ tests/unit/bokeh/core/property/test_any.py:22:43: PLC2701 Private name import `_util_property`
+ tests/unit/bokeh/core/property/test_auto.py:22:28: PLC2701 Private name import `_util_property`
+ tests/unit/bokeh/core/property/test_auto.py:22:43: PLC2701 Private name import `_util_property`
+ tests/unit/bokeh/core/property/test_color__property.py:23:28: PLC2701 Private name import `_util_property`
+ tests/unit/bokeh/core/property/test_color__property.py:23:43: PLC2701 Private name import `_util_property`
... 98 additional changes omitted for project

freedomofpress/securedrop (+5 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --preview

+ securedrop/secure_tempfile.py:3:22: PLC2701 Private name import `_TemporaryFileWrapper` from external module `tempfile`
+ securedrop/tests/conftest.py:24:25: PLC2701 Private name import `_SourceScryptManager` from external module `source_user`
+ securedrop/tests/test_config.py:3:22: PLC2701 Private name import `_parse_config_from_file` from external module `sdconfig`
+ securedrop/tests/test_source_user.py:11:5: PLC2701 Private name import `_DesignationGenerator` from external module `source_user`
+ securedrop/tests/test_source_user.py:12:5: PLC2701 Private name import `_SourceScryptManager` from external module `source_user`

ibis-project/ibis (+10 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --preview

+ docs/backends/app/backend_info_app.py:14:18: PLC2701 Private name import `_` from external module `ibis`
+ docs/how-to/visualization/example_streamlit_app/example_streamlit_app.py:6:18: PLC2701 Private name import `_` from external module `ibis`
+ docs/posts/pydata-performance-part2/datafusion_ibis.py:4:18: PLC2701 Private name import `_` from external module `ibis`
+ docs/posts/pydata-performance-part2/duckdb_ibis.py:4:18: PLC2701 Private name import `_` from external module `ibis`
+ docs/posts/pydata-performance-part2/polars_ibis.py:4:18: PLC2701 Private name import `_` from external module `ibis`
+ docs/posts/pydata-performance/step0.py:4:18: PLC2701 Private name import `_` from external module `ibis`
+ docs/posts/pydata-performance/step1.py:4:18: PLC2701 Private name import `_` from external module `ibis`
+ docs/posts/pydata-performance/step2.py:4:18: PLC2701 Private name import `_` from external module `ibis`
+ docs/posts/pydata-performance/step3.py:4:18: PLC2701 Private name import `_` from external module `ibis`
+ ibis/backends/conftest.py:11:8: PLC2701 Private name import `_pytest`

milvus-io/pymilvus (+2 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --preview

+ _version_helper.py:23:5: PLC2701 Private name import `_parse_version_tag` from external module `setuptools_scm.version`
+ pymilvus/client/grpc_handler.py:11:26: PLC2701 Private name import `_cython` from external module `grpc`

pandas-dev/pandas (+27 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --preview

+ asv_bench/benchmarks/dtypes.py:10:27: PLC2701 Private name import `_testing` from external module `pandas`
+ asv_bench/benchmarks/indexing_engines.py:13:35: PLC2701 Private name import `_libs` from external module `pandas`
+ asv_bench/benchmarks/io/parsers.py:5:9: PLC2701 Private name import `_libs` from external module `pandas`
+ asv_bench/benchmarks/io/parsers.py:6:9: PLC2701 Private name import `_libs` from external module `pandas`
+ asv_bench/benchmarks/libs.py:11:5: PLC2701 Private name import `_libs` from external module `pandas`
+ asv_bench/benchmarks/libs.py:12:5: PLC2701 Private name import `_libs` from external module `pandas`
+ asv_bench/benchmarks/libs.py:13:5: PLC2701 Private name import `_libs` from external module `pandas`
+ asv_bench/benchmarks/plotting.py:25:35: PLC2701 Private name import `_core` from external module `pandas.plotting`
+ asv_bench/benchmarks/tslibs/fields.py:4:5: PLC2701 Private name import `_libs` from external module `pandas`
+ asv_bench/benchmarks/tslibs/fields.py:5:5: PLC2701 Private name import `_libs` from external module `pandas`
... 17 additional changes omitted for project

pypa/cibuildwheel (+14 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --preview

+ bin/update_pythons.py:20:34: PLC2701 Private name import `_compat` from external module `cibuildwheel`
+ bin/update_virtualenv.py:18:34: PLC2701 Private name import `_compat` from external module `cibuildwheel`
+ unit_test/build_ids_test.py:5:34: PLC2701 Private name import `_compat` from external module `cibuildwheel`
+ unit_test/main_tests/main_options_test.py:10:34: PLC2701 Private name import `_compat` from external module `cibuildwheel`
+ unit_test/main_tests/main_options_test.py:12:48: PLC2701 Private name import `_get_pinned_container_images` from external module `cibuildwheel.options`
+ unit_test/main_tests/main_options_test.py:9:35: PLC2701 Private name import `__main__` from external module `cibuildwheel`
+ unit_test/main_tests/main_platform_test.py:7:35: PLC2701 Private name import `__main__` from external module `cibuildwheel`
+ unit_test/main_tests/main_requires_python_test.py:9:35: PLC2701 Private name import `__main__` from external module `cibuildwheel`
+ unit_test/option_prepare_test.py:14:35: PLC2701 Private name import `__main__` from external module `cibuildwheel`
+ unit_test/options_test.py:10:35: PLC2701 Private name import `__main__` from external module `cibuildwheel`
... 4 additional changes omitted for project

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

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
PLC2701 501 501 0 0 0

@charliermarsh charliermarsh added rule Implementing or modifying a lint rule preview Related to preview mode features labels Jan 16, 2024
@charliermarsh
Copy link
Member

Thank you and sorry that I broke this.

@charliermarsh charliermarsh merged commit f426c0f into astral-sh:main Jan 16, 2024
17 checks passed
@tjkuson tjkuson deleted the fix-import-private-name branch January 16, 2024 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
preview Related to preview mode features rule Implementing or modifying a lint rule
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants