Commit 0e9e292
committed
Use
Mechanical codemod that replaces `==` with `is` (and `!=` with `is not`)
on every line where both operands statically resolve to the same enum
class — as identified by `mypy_plugins.enum_identity_compare` from
home-assistant#171551.
This commit covers `homeassistant/` only (156 files, 289 sites). The
companion tests-side change is in home-assistant#171689.
Scope is intentionally narrow:
- Plain `enum.Enum` subclasses: `Enum.__eq__` is identity-based, so
`==` and `is` are mathematically equivalent.
- `homeassistant.data_entry_flow.FlowResultType`: explicitly allowlisted
StrEnum where HA's framework normalizes every consumer-facing result
to the enum instance.
NOT changed: other StrEnum/IntEnum/ReprEnum subclasses (their `__eq__`
delegates to str/int equality and accepts raw primitives at runtime),
and Flag/IntFlag (bitwise `==` is idiomatic).
`homeassistant/data_entry_flow.py:497` is the one exception left as
`!=` (with a noqa) because it runs before the legacy-string
normalization shim a few lines below.
Verified by re-running the mypy plugin against the codemodded source:
zero remaining violations on this side.is/is not for same-enum identity comparisons (homeassistant/)1 parent 298f4f8 commit 0e9e292
156 files changed
Lines changed: 295 additions & 290 deletions
File tree
- homeassistant
- auth
- components
- anthropic
- aosmith
- apple_tv
- arcam_fmj
- assist_pipeline
- auth
- bluetooth
- bthome
- comelit
- config
- conversation
- device_automation
- dlna_dmr
- dlna_dms
- elevenlabs
- elkm1
- energyzero
- fastdotcom
- fish_audio
- flume
- flux_led
- fronius
- fully_kiosk
- gardena_bluetooth
- google_air_quality
- google_generative_ai_conversation
- google_weather
- google
- growatt_server
- hassio
- heos
- homeassistant_hardware
- homee
- homekit_controller
- husqvarna_automower_ble
- integration
- intellifire
- iotty
- knx
- lcn
- lutron_caseta
- lutron
- matter
- motioneye
- mqtt
- music_assistant
- mysensors
- myuplink
- octoprint
- ollama
- onkyo
- onvif
- open_router
- openai_conversation
- opower
- otbr
- paperless_ngx
- picnic
- playstation_network
- pooldose
- powerwall
- qbittorrent
- qnap_qsw
- rabbitair
- radio_browser
- rainforest_raven
- renault
- reolink
- repairs
- ridwell
- samsungtv
- screenlogic
- sia
- simplisafe
- sleepiq
- snooz
- sonos
- ssdp
- sunricher_dali
- switchbee
- switcher_kis
- system_bridge
- telegram_bot
- tesla_fleet
- tplink
- upnp
- victron_gx
- victron_remote_monitoring
- withings
- xiaomi_ble
- xiaomi_miio
- yalexs_ble
- yeelight
- yolink
- zwave_js
- triggers
- helpers
- util
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
137 | | - | |
| 137 | + | |
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
226 | 226 | | |
227 | 227 | | |
228 | 228 | | |
229 | | - | |
| 229 | + | |
230 | 230 | | |
231 | 231 | | |
232 | 232 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | | - | |
| 92 | + | |
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
125 | | - | |
| 125 | + | |
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
369 | 369 | | |
370 | 370 | | |
371 | 371 | | |
372 | | - | |
| 372 | + | |
373 | 373 | | |
374 | 374 | | |
375 | 375 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
| 66 | + | |
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
| 81 | + | |
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
354 | 354 | | |
355 | 355 | | |
356 | 356 | | |
357 | | - | |
| 357 | + | |
358 | 358 | | |
359 | 359 | | |
360 | 360 | | |
| |||
441 | 441 | | |
442 | 442 | | |
443 | 443 | | |
444 | | - | |
| 444 | + | |
445 | 445 | | |
446 | 446 | | |
447 | 447 | | |
| |||
457 | 457 | | |
458 | 458 | | |
459 | 459 | | |
460 | | - | |
| 460 | + | |
461 | 461 | | |
462 | 462 | | |
463 | 463 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
142 | | - | |
| 142 | + | |
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
| |||
188 | 188 | | |
189 | 189 | | |
190 | 190 | | |
191 | | - | |
| 191 | + | |
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
197 | 197 | | |
198 | | - | |
| 198 | + | |
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
| |||
446 | 446 | | |
447 | 447 | | |
448 | 448 | | |
449 | | - | |
| 449 | + | |
450 | 450 | | |
451 | 451 | | |
452 | 452 | | |
| |||
506 | 506 | | |
507 | 507 | | |
508 | 508 | | |
509 | | - | |
| 509 | + | |
510 | 510 | | |
511 | 511 | | |
512 | 512 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
| 62 | + | |
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
263 | 263 | | |
264 | 264 | | |
265 | 265 | | |
266 | | - | |
| 266 | + | |
267 | 267 | | |
268 | 268 | | |
269 | 269 | | |
| |||
274 | 274 | | |
275 | 275 | | |
276 | 276 | | |
277 | | - | |
| 277 | + | |
278 | 278 | | |
279 | 279 | | |
280 | 280 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1355 | 1355 | | |
1356 | 1356 | | |
1357 | 1357 | | |
1358 | | - | |
| 1358 | + | |
1359 | 1359 | | |
1360 | 1360 | | |
1361 | 1361 | | |
| |||
0 commit comments