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

Ignore unnecessary dunder calls within dunder definitions #9496

Merged
merged 1 commit into from Jan 12, 2024

Conversation

charliermarsh
Copy link
Member

Closes #9486.

@charliermarsh charliermarsh added the bug Something isn't working label Jan 12, 2024
Copy link

codspeed-hq bot commented Jan 12, 2024

CodSpeed Performance Report

Merging #9496 will degrade performances by 4.33%

Comparing charlie/dunder (8aafed0) with main (7504bf3)

Summary

❌ 1 regressions
✅ 29 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark main charlie/dunder Change
parser[numpy/ctypeslib.py] 12.2 ms 12.8 ms -4.33%

Copy link
Contributor

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

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

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

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

- disnake/activity.py:479:20: PLC2801 [*] Unnecessary dunder call to `__eq__`. Use `==` operator.
- disnake/activity.py:591:20: PLC2801 [*] Unnecessary dunder call to `__eq__`. Use `==` operator.
- disnake/activity.py:695:20: PLC2801 [*] Unnecessary dunder call to `__eq__`. Use `==` operator.
- disnake/activity.py:870:20: PLC2801 [*] Unnecessary dunder call to `__eq__`. Use `==` operator.
- disnake/colour.py:68:20: PLC2801 [*] Unnecessary dunder call to `__eq__`. Use `==` operator.
- disnake/context_managers.py:60:16: PLC2801 Unnecessary dunder call to `__enter__`
- disnake/emoji.py:128:20: PLC2801 [*] Unnecessary dunder call to `__eq__`. Use `==` operator.
- disnake/ext/commands/params.py:1348:20: PLC2801 Unnecessary dunder call to `__get__`. Use `get` method.
- disnake/flags.py:154:20: PLC2801 [*] Unnecessary dunder call to `__eq__`. Use `==` operator.
- disnake/member.py:359:20: PLC2801 [*] Unnecessary dunder call to `__eq__`. Use `==` operator.
... 7 additional changes omitted for project

aiven/aiven-client (+0 -3 violations, +0 -0 fixes)

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

- aiven/client/argx.py:189:9: PLC2801 Unnecessary dunder call to `__init__`. Instantiate class directly.
- aiven/client/cli.py:141:9: PLC2801 Unnecessary dunder call to `__init__`. Instantiate class directly.
- aiven/client/client.py:34:9: PLC2801 Unnecessary dunder call to `__init__`. Instantiate class directly.

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

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

- airflow/configuration.py:1887:9: PLC2801 Unnecessary dunder call to `__init__`. Instantiate class directly.
- airflow/models/baseoperator.py:192:16: PLC2801 Unnecessary dunder call to `__get__`. Use `get` method.
- airflow/models/taskmixin.py:109:9: PLC2801 [*] Unnecessary dunder call to `__lshift__`. Use `<<` operator.
- airflow/models/taskmixin.py:114:9: PLC2801 [*] Unnecessary dunder call to `__rshift__`. Use `>>` operator.
- airflow/providers/elasticsearch/log/es_response.py:57:20: PLC2801 Unnecessary dunder call to `__getitem__`. Access item via subscript.
- airflow/providers/microsoft/psrp/hooks/psrp.py:105:9: PLC2801 Unnecessary dunder call to `__enter__`
- airflow/providers/microsoft/psrp/hooks/psrp.py:106:9: PLC2801 Unnecessary dunder call to `__enter__`
- airflow/providers_manager.py:107:9: PLC2801 Unnecessary dunder call to `__setitem__`. Use subscript assignment.
- airflow/providers_manager.py:110:17: PLC2801 Unnecessary dunder call to `__getitem__`. Access item via subscript.
- airflow/providers_manager.py:116:13: PLC2801 Unnecessary dunder call to `__setitem__`. Use subscript assignment.
... 14 additional changes omitted for project

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

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

- samcli/commands/exceptions.py:28:9: PLC2801 Unnecessary dunder call to `__init__`. Instantiate class directly.
- samcli/commands/exceptions.py:47:9: PLC2801 Unnecessary dunder call to `__init__`. Instantiate class directly.
- samcli/commands/local/lib/debug_context.py:31:16: PLC2801 [*] Unnecessary dunder call to `__bool__`. Use `bool()` builtin.
- samcli/hook_packages/terraform/hooks/prepare/exceptions.py:19:9: PLC2801 Unnecessary dunder call to `__init__`. Instantiate class directly.
- samcli/hook_packages/terraform/hooks/prepare/exceptions.py:34:9: PLC2801 Unnecessary dunder call to `__init__`. Instantiate class directly.
- samcli/hook_packages/terraform/hooks/prepare/exceptions.py:392:9: PLC2801 Unnecessary dunder call to `__init__`. Instantiate class directly.
- samcli/hook_packages/terraform/hooks/prepare/exceptions.py:51:9: PLC2801 Unnecessary dunder call to `__init__`. Instantiate class directly.
- samcli/hook_packages/terraform/hooks/prepare/exceptions.py:74:9: PLC2801 Unnecessary dunder call to `__init__`. Instantiate class directly.
- samcli/lib/cookiecutter/exceptions.py:9:9: PLC2801 Unnecessary dunder call to `__init__`. Instantiate class directly.
- samcli/lib/docker/log_streamer.py:20:9: PLC2801 Unnecessary dunder call to `__init__`. Instantiate class directly.
... 5 additional changes omitted for project

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

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

- src/bokeh/embed/util.py:276:16: PLC2801 Unnecessary dunder call to `__getitem__`. Access item via subscript.
- src/bokeh/models/plots.py:909:20: PLC2801 Unnecessary dunder call to `__getattribute__`. Access attribute directly or use getattr built-in function.

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

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

- journalist_gui/journalist_gui/SecureDropUpdater.py:125:9: PLC2801 Unnecessary dunder call to `__init__`. Instantiate class directly.
- journalist_gui/journalist_gui/SecureDropUpdater.py:49:9: PLC2801 Unnecessary dunder call to `__init__`. Instantiate class directly.
- journalist_gui/journalist_gui/SecureDropUpdater.py:89:9: PLC2801 Unnecessary dunder call to `__init__`. Instantiate class directly.
- securedrop/journalist_app/sessions.py:31:9: PLC2801 Unnecessary dunder call to `__init__`. Instantiate class directly.
- securedrop/pretty_bad_protocol/_parsers.py:1774:9: PLC2801 Unnecessary dunder call to `__init__`. Instantiate class directly.
- securedrop/tests/migrations/migration_a9fe328b053a.py:50:9: PLC2801 Unnecessary dunder call to `__init__`. Instantiate class directly.
- securedrop/tests/migrations/migration_a9fe328b053a.py:72:9: PLC2801 Unnecessary dunder call to `__init__`. Instantiate class directly.
- securedrop/tests/migrations/migration_b58139cfdc8c.py:121:9: PLC2801 Unnecessary dunder call to `__init__`. Instantiate class directly.
- securedrop/tests/migrations/migration_b58139cfdc8c.py:165:9: PLC2801 Unnecessary dunder call to `__init__`. Instantiate class directly.
- securedrop/tests/migrations/migration_c5a02eb52f2d.py:19:9: PLC2801 Unnecessary dunder call to `__init__`. Instantiate class directly.
... 3 additional changes omitted for project

fronzbot/blinkpy (+0 -1 violations, +0 -0 fixes)

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

- blinkpy/sync_module.py:767:16: PLC2801 [*] Unnecessary dunder call to `__repr__`. Use `repr()` builtin.

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

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

- ibis/common/bases.py:198:13: PLC2801 Unnecessary dunder call to `__setattr__`. Mutate attribute directly or use setattr built-in function.
- ibis/common/bases.py:212:13: PLC2801 Unnecessary dunder call to `__setattr__`. Mutate attribute directly or use setattr built-in function.
- ibis/common/bases.py:239:13: PLC2801 Unnecessary dunder call to `__setattr__`. Mutate attribute directly or use setattr built-in function.
- ibis/common/bases.py:241:9: PLC2801 Unnecessary dunder call to `__setattr__`. Mutate attribute directly or use setattr built-in function.
- ibis/common/bases.py:245:13: PLC2801 Unnecessary dunder call to `__setattr__`. Mutate attribute directly or use setattr built-in function.
- ibis/common/bases.py:247:9: PLC2801 Unnecessary dunder call to `__setattr__`. Mutate attribute directly or use setattr built-in function.
- ibis/common/caching.py:39:9: PLC2801 Unnecessary dunder call to `__setattr__`. Mutate attribute directly or use setattr built-in function.
- ibis/common/collections.py:229:43: PLC2801 [*] Unnecessary dunder call to `__ge__`. Use `>=` operator.
- ibis/common/collections.py:240:43: PLC2801 [*] Unnecessary dunder call to `__le__`. Use `<=` operator.
- ibis/common/collections.py:295:9: PLC2801 Unnecessary dunder call to `__setattr__`. Mutate attribute directly or use setattr built-in function.
... 11 additional changes omitted for project

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

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

- pymilvus/client/abstract.py:179:16: PLC2801 [*] Unnecessary dunder call to `__str__`. Use `str()` builtin.
- pymilvus/client/abstract.py:282:16: PLC2801 [*] Unnecessary dunder call to `__str__`. Use `str()` builtin.
- pymilvus/client/abstract.py:360:16: PLC2801 [*] Unnecessary dunder call to `__str__`. Use `str()` builtin.
- pymilvus/client/abstract.py:627:35: PLC2801 [*] Unnecessary dunder call to `__len__`. Use `len()` builtin.
- pymilvus/client/abstract.py:627:69: PLC2801 [*] Unnecessary dunder call to `__len__`. Use `len()` builtin.
- pymilvus/client/abstract.py:632:20: PLC2801 [*] Unnecessary dunder call to `__len__`. Use `len()` builtin.
- pymilvus/client/abstract.py:639:30: PLC2801 [*] Unnecessary dunder call to `__len__`. Use `len()` builtin.
- pymilvus/client/abstract.py:641:20: PLC2801 Unnecessary dunder call to `__getitem__`. Access item via subscript.
- pymilvus/client/abstract.py:648:34: PLC2801 Unnecessary dunder call to `__getitem__`. Access item via subscript.
- pymilvus/client/ts_utils.py:22:16: PLC2801 [*] Unnecessary dunder call to `__repr__`. Use `repr()` builtin.
... 1 additional changes omitted for project

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

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

- pandas/_config/config.py:227:9: PLC2801 Unnecessary dunder call to `__setattr__`. Mutate attribute directly or use setattr built-in function.
- pandas/_config/config.py:228:9: PLC2801 Unnecessary dunder call to `__setattr__`. Mutate attribute directly or use setattr built-in function.
- pandas/_config/config.py:231:18: PLC2801 Unnecessary dunder call to `__getattribute__`. Access attribute directly or use getattr built-in function.
- pandas/_config/config.py:243:18: PLC2801 Unnecessary dunder call to `__getattribute__`. Access attribute directly or use getattr built-in function.
- pandas/_config/config.py:248:17: PLC2801 Unnecessary dunder call to `__getattribute__`. Access attribute directly or use getattr built-in function.
- pandas/conftest.py:598:20: PLC2801 Unnecessary dunder call to `__getitem__`. Access item via subscript.
- pandas/core/_numba/extensions.py:188:9: PLC2801 Unnecessary dunder call to `__init__`. Instantiate class directly.
- pandas/core/_numba/extensions.py:199:9: PLC2801 Unnecessary dunder call to `__init__`. Instantiate class directly.
- pandas/core/_numba/extensions.py:563:9: PLC2801 Unnecessary dunder call to `__init__`. Instantiate class directly.
- pandas/core/accessor.py:229:9: PLC2801 Unnecessary dunder call to `__setattr__`. Mutate attribute directly or use setattr built-in function.
- pandas/core/arrays/arrow/extension_types.py:26:9: PLC2801 Unnecessary dunder call to `__init__`. Instantiate class directly.
... 41 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
PLC2801 229 0 229 0 0

@charliermarsh charliermarsh merged commit 957a1f3 into main Jan 12, 2024
16 of 17 checks passed
@charliermarsh charliermarsh deleted the charlie/dunder branch January 12, 2024 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant