Skip to content

Fix walrus operator in if-statement test not visible after branch#2493

Open
Adist319 wants to merge 1 commit intofacebook:mainfrom
Adist319:fix-walrus-if-statement-2382
Open

Fix walrus operator in if-statement test not visible after branch#2493
Adist319 wants to merge 1 commit intofacebook:mainfrom
Adist319:fix-walrus-if-statement-2382

Conversation

@Adist319
Copy link
Contributor

@Adist319 Adist319 commented Feb 22, 2026

Summary

  • Fix false unbound-name errors for variables assigned via walrus operator (:=) in if-statement test conditions
  • Process the first if test expression before start_fork() so walrus-defined names are in the base flow and visible after the if-statement
  • Mirrors the existing fix for ternary expressions in expr.rs (commit eaac26f)

Test Cases Added

  • test_walrus_in_if_basic — basic if (x := a) > 0: pass; return x
  • test_walrus_in_if_both_branches — walrus visible in both if and else
  • test_walrus_in_if_with_narrowing — walrus with is not None narrowing
  • test_walrus_in_elif — correctly reports x may be uninitialized (elif is conditional)
  • test_walrus_in_if_no_else — walrus visible after if with no else clause
  • Updated test_walrus_on_first_branch_of_if to reflect correct behavior
  • Updated test_false_and_walrus with bug = annotation for known BoolOp laxness false negative

Fixes #2382

The walrus operator (:=) in if-statement test conditions caused false
unbound-name errors for variables used after the if-statement. For example,
`if (x := a) > 0: pass; return x` incorrectly reported `x` as possibly
uninitialized.

The root cause was that the test expression was processed inside
start_branch(), so walrus assignments were only visible in that branch
and not in the base flow. The fix moves ensure_expr(test) for the first
if-test to before start_fork(), mirroring the existing pattern used by
ternary expressions (Expr::If in expr.rs).

Fixes facebook#2382
@meta-cla meta-cla bot added the cla signed label Feb 22, 2026
@github-actions
Copy link

Diff from mypy_primer, showing the effect of this PR on open source code:

trio (https://github.com/python-trio/trio)
+ ERROR src/trio/_socket.py:440:46-76: Expected `P` to be a ParamSpec value in function `_SocketType._nonblocking_helper` [bad-argument-type]
- ERROR src/trio/_socket.py:440:16-76: Returned type `TypeVar[T]` is not assignable to declared return type `T` [bad-return]
- ERROR src/trio/_socket.py:440:56-58: Argument `(socket, ParamSpec(P)) -> T` is not assignable to parameter `fn` with type `(socket, ParamSpec(ParamSpec[P])) -> TypeVar[T]` in function `_SocketType._nonblocking_helper` [bad-argument-type]
- ERROR src/trio/_socket.py:988:13-63: Type variable `P` is not in scope [invalid-type-var]
- ERROR src/trio/_socket.py:989:16-22: Expected a type form, got instance of `ParamSpecArgs` [not-a-type]
- ERROR src/trio/_socket.py:990:19-27: Expected a type form, got instance of `ParamSpecKwargs` [not-a-type]
- ERROR src/trio/_socket.py:991:10-11: Type variable `T` is not in scope [invalid-type-var]
- ERROR src/trio/_socket.py:1014:22-51: Unexpected ParamSpec type: `ParamSpec[P]` [invalid-param-spec]
- ERROR src/trio/_socket.py:1019:26-55: Unexpected ParamSpec type: `ParamSpec[P]` [invalid-param-spec]
+ ERROR src/trio/_socket.py:1276:13-23: Argument `object` is not assignable to parameter `data` with type `Buffer` in function `_SocketType._nonblocking_helper` [bad-argument-type]
+ ERROR src/trio/_socket.py:1276:13-23: Argument `object` is not assignable to parameter `address` with type `Buffer | str | tuple[Any, ...]` in function `_SocketType._nonblocking_helper` [bad-argument-type]
- ERROR src/trio/_socket.py:1273:16-1277:10: Returned type `TypeVar[T]` is not assignable to declared return type `int` [bad-return]
- ERROR src/trio/_socket.py:1304:20-1311:14: Returned type `TypeVar[T]` is not assignable to declared return type `int` [bad-return]
- ERROR src/trio/_socket.py:1306:17-46: Argument `(self: socket, buffers: Iterable[Buffer], ancdata: Iterable[tuple[int, int, Buffer]] = ..., flags: int = 0, address: Buffer | str | tuple[Any, ...] | None = None, /) -> int` is not assignable to parameter `fn` with type `(socket, ParamSpec(ParamSpec[P])) -> TypeVar[T]` in function `_SocketType._nonblocking_helper` [bad-argument-type]
- ERROR src/trio/testing/_raises_group.py:243:91-112: `stringified_exception` is uninitialized [unbound-name]
- ERROR src/trio/testing/_raises_group.py:244:42-63: `stringified_exception` is uninitialized [unbound-name]

psycopg (https://github.com/psycopg/psycopg)
- ERROR docs/lib/ticket_role.py:32:19-22: `cfg` is uninitialized [unbound-name]
- ERROR psycopg/psycopg/_adapters_map.py:188:23-26: `fmt` may be uninitialized [unbound-name]
- ERROR psycopg/psycopg/_connection_base.py:257:12-18: `status` may be uninitialized [unbound-name]
- ERROR psycopg/psycopg/_connection_base.py:267:45-51: `status` may be uninitialized [unbound-name]
- ERROR psycopg/psycopg/_conninfo_attempts.py:62:8-22: `prefer_standby` may be uninitialized [unbound-name]
- ERROR psycopg/psycopg/_conninfo_attempts.py:103:15-19: `port` may be uninitialized [unbound-name]
- ERROR psycopg/psycopg/_conninfo_attempts_async.py:60:8-22: `prefer_standby` may be uninitialized [unbound-name]
- ERROR psycopg/psycopg/_conninfo_attempts_async.py:103:19-23: `port` may be uninitialized [unbound-name]
- ERROR psycopg/psycopg/_copy_base.py:94:27-33: `result` may be uninitialized [unbound-name]
- ERROR psycopg/psycopg/_copy_base.py:94:38-44: `result` may be uninitialized [unbound-name]
- ERROR psycopg/psycopg/_dns.py:147:16-24: `ports_in` may be uninitialized [unbound-name]
- ERROR psycopg/psycopg/_dns.py:151:64-72: `ports_in` may be uninitialized [unbound-name]
- ERROR psycopg/psycopg/_dns.py:156:41-49: `ports_in` may be uninitialized [unbound-name]
- ERROR psycopg/psycopg/_py_transformer.py:356:47-57: `loader_cls` may be uninitialized [unbound-name]
- ERROR psycopg/psycopg/_typeinfo.py:175:14-18: `info` is uninitialized [unbound-name]
- ERROR psycopg/psycopg/connection.py:447:18-26: `pipeline` may be uninitialized [unbound-name]
- ERROR psycopg/psycopg/connection.py:448:23-31: `pipeline` may be uninitialized [unbound-name]
- ERROR psycopg/psycopg/connection.py:450:16-24: `pipeline` may be uninitialized [unbound-name]
- ERROR psycopg/psycopg/connection.py:452:28-36: `pipeline` may be uninitialized [unbound-name]
- ERROR psycopg/psycopg/connection_async.py:482:24-32: `pipeline` may be uninitialized [unbound-name]
- ERROR psycopg/psycopg/connection_async.py:483:23-31: `pipeline` may be uninitialized [unbound-name]
- ERROR psycopg/psycopg/connection_async.py:485:16-24: `pipeline` may be uninitialized [unbound-name]
- ERROR psycopg/psycopg/connection_async.py:487:28-36: `pipeline` may be uninitialized [unbound-name]
- ERROR psycopg/psycopg/dbapi20.py:77:45-49: `sobj` may be uninitialized [unbound-name]
- ERROR psycopg/psycopg/generators.py:331:12-18: `result` is uninitialized [unbound-name]
- ERROR psycopg/psycopg/pq/_pq_ctypes.py:36:36-44: `libcname` may be uninitialized [unbound-name]
- ERROR psycopg/psycopg/pq/misc.py:174:25-31: `sparts` may be uninitialized [unbound-name]
- ERROR psycopg/psycopg/pq/pq_ctypes.py:663:16-18: `rv` is uninitialized [unbound-name]
- ERROR psycopg/psycopg/pq/pq_ctypes.py:670:16-18: `rv` is uninitialized [unbound-name]
- ERROR psycopg/psycopg/types/array.py:177:68-70: `ad` may be uninitialized [unbound-name]
- ERROR psycopg/psycopg/types/array.py:178:39-41: `ad` may be uninitialized [unbound-name]
- ERROR psycopg/psycopg/types/array.py:418:26-27: `t` may be uninitialized [unbound-name]
- ERROR psycopg/psycopg/types/composite.py:417:22-24: `ad` may be uninitialized [unbound-name]
- ERROR psycopg/psycopg/types/datetime.py:241:14-16: `ds` is uninitialized [unbound-name]
- ERROR psycopg/psycopg/types/datetime.py:243:14-16: `ds` is uninitialized [unbound-name]
- ERROR psycopg/psycopg/types/datetime.py:243:37-39: `ds` is uninitialized [unbound-name]
- ERROR psycopg/psycopg/types/datetime.py:244:46-48: `ds` is uninitialized [unbound-name]
- ERROR psycopg/psycopg/types/datetime.py:246:59-61: `ds` is uninitialized [unbound-name]
- ERROR psycopg/psycopg/types/datetime.py:411:14-16: `ds` is uninitialized [unbound-name]
- ERROR psycopg/psycopg/types/datetime.py:413:14-16: `ds` is uninitialized [unbound-name]
- ERROR psycopg/psycopg/types/datetime.py:414:46-48: `ds` is uninitialized [unbound-name]
- ERROR psycopg/psycopg/types/datetime.py:415:14-16: `ds` is uninitialized [unbound-name]
- ERROR psycopg/psycopg/types/datetime.py:416:47-49: `ds` is uninitialized [unbound-name]
- ERROR psycopg/psycopg/types/datetime.py:419:59-61: `ds` is uninitialized [unbound-name]
- ERROR psycopg/psycopg/types/hstore.py:137:21-22: `v` may be uninitialized [unbound-name]
- ERROR psycopg/psycopg/types/json.py:120:19-23: `name` may be uninitialized [unbound-name]
- ERROR psycopg/psycopg/types/json.py:122:12-15: `key` may be uninitialized [unbound-name]
- ERROR psycopg/psycopg/types/json.py:123:28-31: `key` may be uninitialized [unbound-name]
- ERROR psycopg/psycopg/types/json.py:140:19-23: `name` may be uninitialized [unbound-name]
- ERROR psycopg/psycopg/types/json.py:142:12-15: `key` may be uninitialized [unbound-name]
- ERROR psycopg/psycopg/types/json.py:143:28-31: `key` may be uninitialized [unbound-name]
- ERROR psycopg/psycopg/types/json.py:192:45-49: `sobj` may be uninitialized [unbound-name]
- ERROR psycopg/psycopg/types/numeric.py:70:12-17: `value` may be uninitialized [unbound-name]
- ERROR psycopg/psycopg/types/numeric.py:71:34-39: `value` may be uninitialized [unbound-name]
- ERROR psycopg/psycopg/types/numeric.py:73:16-21: `value` may be uninitialized [unbound-name]
- ERROR psycopg/psycopg/types/numeric.py:73:46-51: `value` may be uninitialized [unbound-name]
- ERROR psycopg/psycopg/types/range.py:228:18-29: `other_value` is uninitialized [unbound-name]
- ERROR psycopg/psycopg/types/range.py:480:22-26: `item` may be uninitialized [unbound-name]
- ERROR psycopg/psycopg/types/range.py:518:17-21: `head` is uninitialized [unbound-name]
- ERROR psycopg/psycopg/types/range.py:519:17-21: `head` is uninitialized [unbound-name]
- ERROR psycopg/psycopg/types/range.py:522:8-12: `head` is uninitialized [unbound-name]
- ERROR psycopg/psycopg/types/range.py:530:8-12: `head` is uninitialized [unbound-name]
- ERROR psycopg_pool/psycopg_pool/sched.py:82:16-20: `task` may be uninitialized [unbound-name]
- ERROR psycopg_pool/psycopg_pool/sched.py:83:24-28: `task` may be uninitialized [unbound-name]
- ERROR psycopg_pool/psycopg_pool/sched.py:86:21-25: `task` may be uninitialized [unbound-name]
- ERROR psycopg_pool/psycopg_pool/sched.py:90:25-29: `task` may be uninitialized [unbound-name]
- ERROR psycopg_pool/psycopg_pool/sched_async.py:85:16-20: `task` may be uninitialized [unbound-name]
- ERROR psycopg_pool/psycopg_pool/sched_async.py:86:24-28: `task` may be uninitialized [unbound-name]
- ERROR psycopg_pool/psycopg_pool/sched_async.py:89:27-31: `task` may be uninitialized [unbound-name]
- ERROR psycopg_pool/psycopg_pool/sched_async.py:93:25-29: `task` may be uninitialized [unbound-name]
- ERROR tests/conftest.py:73:5-10: `cache` is uninitialized [unbound-name]
- ERROR tests/fix_crdb.py:47:12-15: `msg` may be uninitialized [unbound-name]
- ERROR tests/fix_db.py:299:18-25: `cmdcopy` may be uninitialized [unbound-name]
- ERROR tests/fix_faker.py:163:38-39: `r` may be uninitialized [unbound-name]
- ERROR tests/fix_faker.py:187:38-39: `r` may be uninitialized [unbound-name]
- ERROR tests/fix_faker.py:576:28-29: `r` is uninitialized [unbound-name]
- ERROR tests/scripts/copytest.py:142:12-16: `args` may be uninitialized [unbound-name]
- ERROR tests/test_adapt.py:452:35-38: `obj` may be uninitialized [unbound-name]
- ERROR tests/test_adapt.py:458:28-31: `obj` may be uninitialized [unbound-name]
- ERROR tests/test_rows.py:155:8-15: `factory` may be uninitialized [unbound-name]
- ERROR tests/test_rows.py:156:19-26: `factory` may be uninitialized [unbound-name]
- ERROR tests/test_rows.py:157:8-15: `factory` may be uninitialized [unbound-name]
- ERROR tests/test_rows.py:158:19-26: `factory` may be uninitialized [unbound-name]
- ERROR tests/test_rows.py:160:12-19: `factory` may be uninitialized [unbound-name]
- ERROR tests/types/test_numeric.py:493:23-26: `val` is uninitialized [unbound-name]
- ERROR tests/types/test_numeric.py:495:36-39: `val` is uninitialized [unbound-name]
- ERROR tools/async_to_sync.py:75:31-34: `opt` is uninitialized [unbound-name]
- ERROR tools/async_to_sync.py:92:12-15: `opt` is uninitialized [unbound-name]
- ERROR tools/async_to_sync.py:646:15-18: `opt` may be uninitialized [unbound-name]
- ERROR tools/async_to_sync.py:652:12-15: `opt` may be uninitialized [unbound-name]
- ERROR tools/ci/copy_to_binary.py:28:37-43: `target` is uninitialized [unbound-name]
- ERROR tools/ci/copy_to_binary.py:29:17-23: `target` is uninitialized [unbound-name]
- ERROR tools/ci/copy_to_binary.py:29:44-50: `target` is uninitialized [unbound-name]
- ERROR tools/ci/copy_to_binary.py:30:17-23: `target` is uninitialized [unbound-name]
- ERROR tools/ci/copy_to_binary.py:30:52-58: `target` is uninitialized [unbound-name]
- ERROR tools/ci/copy_to_binary.py:31:38-44: `target` is uninitialized [unbound-name]
- ERROR tools/ci/copy_to_binary.py:32:38-44: `target` is uninitialized [unbound-name]
- ERROR tools/ci/copy_to_binary.py:33:59-65: `target` is uninitialized [unbound-name]
- ERROR tools/ci/copy_to_binary.py:34:49-55: `target` is uninitialized [unbound-name]
- ERROR tools/ci/copy_to_binary.py:35:45-51: `target` is uninitialized [unbound-name]
- ERROR tools/update_backer.py:39:26-33: `website` may be uninitialized [unbound-name]

cki-lib (https://gitlab.com/cki-project/cki-lib)
- ERROR cki_lib/certs.py:27:66-81: `not_valid_after` may be uninitialized [unbound-name]
- ERROR cki_lib/inttests/cluster.py:162:12-18: `exists` may be uninitialized [unbound-name]
- ERROR cki_lib/yaml.py:146:30-36: `schema` may be uninitialized [unbound-name]

hydpy (https://github.com/hydpy-dev/hydpy)
- ERROR hydpy/core/filetools.py:212:16-26: `projectdir` may be uninitialized [unbound-name]
- ERROR hydpy/core/parametertools.py:2440:25-33: `relevant` may be uninitialized [unbound-name]
- ERROR hydpy/cythons/modelutils.py:2999:46-52: `module` may be uninitialized [unbound-name]
- ERROR hydpy/exe/commandtools.py:523:14-17: `nmb` is uninitialized [unbound-name]
- ERROR hydpy/models/sw1d_network.py:1188:9-1218:47: Pyrefly detected conflicting types while breaking a dependency cycle: `None` is not assignable to `Never`. Adding explicit type annotations might possibly help. [bad-assignment]

Tanjun (https://github.com/FasterSpeeding/Tanjun)
- ERROR tanjun/permissions.py:153:16-27: `permissions` is uninitialized [unbound-name]
- ERROR tanjun/permissions.py:155:59-70: `permissions` is uninitialized [unbound-name]
- ERROR tanjun/permissions.py:246:16-27: `permissions` is uninitialized [unbound-name]
- ERROR tanjun/permissions.py:253:59-70: `permissions` is uninitialized [unbound-name]

core (https://github.com/home-assistant/core)
- ERROR homeassistant/auth/auth_store.py:487:28-38: `token_type` may be uninitialized [unbound-name]
- ERROR homeassistant/auth/mfa_modules/notify.py:127:41-45: `data` may be uninitialized [unbound-name]
- ERROR homeassistant/auth/mfa_modules/totp.py:105:27-31: `data` may be uninitialized [unbound-name]
- ERROR homeassistant/auth/permissions/__init__.py:47:16-27: `entity_func` may be uninitialized [unbound-name]
- ERROR homeassistant/auth/providers/__init__.py:191:5-14: `processed` may be uninitialized [unbound-name]
- ERROR homeassistant/auth/providers/homeassistant.py:110:56-60: `data` may be uninitialized [unbound-name]
- ERROR homeassistant/auth/providers/homeassistant.py:111:22-26: `data` may be uninitialized [unbound-name]
- ERROR homeassistant/bootstrap.py:381:8-21: `recovery_mode` may be uninitialized [unbound-name]
- ERROR homeassistant/components/alexa/capabilities.py:650:20-34: `hue_saturation` may be uninitialized [unbound-name]
- ERROR homeassistant/components/alexa/capabilities.py:651:27-41: `hue_saturation` may be uninitialized [unbound-name]
- ERROR homeassistant/components/alexa/capabilities.py:652:27-37: `brightness` may be uninitialized [unbound-name]
- ERROR homeassistant/components/alexa/flash_briefings.py:103:32-35: `uid` may be uninitialized [unbound-name]
- ERROR homeassistant/components/alexa/handlers.py:185:8-14: `domain` may be uninitialized [unbound-name]
- ERROR homeassistant/components/alexa/handlers.py:187:10-16: `domain` may be uninitialized [unbound-name]
- ERROR homeassistant/components/alexa/handlers.py:189:10-16: `domain` may be uninitialized [unbound-name]
- ERROR homeassistant/components/alexa/handlers.py:191:10-16: `domain` may be uninitialized [unbound-name]
- ERROR homeassistant/components/alexa/handlers.py:193:10-16: `domain` may be uninitialized [unbound-name]
- ERROR homeassistant/components/alexa/handlers.py:195:10-16: `domain` may be uninitialized [unbound-name]
- ERROR homeassistant/components/alexa/handlers.py:202:10-16: `domain` may be uninitialized [unbound-name]
- ERROR homeassistant/components/alexa/handlers.py:204:10-16: `domain` may be uninitialized [unbound-name]
- ERROR homeassistant/components/alexa/handlers.py:214:9-15: `domain` may be uninitialized [unbound-name]
- ERROR homeassistant/components/alexa/handlers.py:1546:49-75: No matching overload found for function `max` called with arguments: (Literal[0], float | Unknown) [no-matching-overload]
- ERROR homeassistant/components/alexa/handlers.py:1582:51-77: No matching overload found for function `max` called with arguments: (Literal[0], float | Unknown) [no-matching-overload]
- ERROR homeassistant/components/alexa/handlers.py:1654:49-75: No matching overload found for function `max` called with arguments: (Literal[0], float | Unknown) [no-matching-overload]
- ERROR homeassistant/components/alexa/logbook.py:43:38-47: `entity_id` may be uninitialized [unbound-name]
- ERROR homeassistant/components/api/__init__.py:444:37-55: `response_requested` may be uninitialized [unbound-name]
- ERROR homeassistant/components/api/__init__.py:452:12-30: `response_requested` may be uninitialized [unbound-name]
- ERROR homeassistant/components/arwn/sensor.py:154:35-40: `store` may be uninitialized [unbound-name]
- ERROR homeassistant/components/arwn/sensor.py:157:17-22: `store` may be uninitialized [unbound-name]
- ERROR homeassistant/components/arwn/sensor.py:168:17-22: `store` may be uninitialized [unbound-name]
- ERROR homeassistant/components/august/lock.py:106:45-58: `lock_activity` may be uninitialized [unbound-name]
- ERROR homeassistant/components/aws/__init__.py:97:30-34: `conf` may be uninitialized [unbound-name]
- ERROR homeassistant/components/aws/__init__.py:102:76-80: `conf` may be uninitialized [unbound-name]
- ERROR homeassistant/components/backup/config.py:540:26-36: `cron_event` may be uninitialized [unbound-name]
- ERROR homeassistant/components/backup/manager.py:675:25-34: `backup_id` may be uninitialized [unbound-name]
- ERROR homeassistant/components/buienradar/__init__.py:33:12-21: `unload_ok` may be uninitialized [unbound-name]
- ERROR homeassistant/components/buienradar/camera.py:133:63-76: `last_modified` may be uninitialized [unbound-name]
- ERROR homeassistant/components/citybikes/sensor.py:184:44-63: `<` is not supported between `None` and `float` [unsupported-operation]
- ERROR homeassistant/components/cloud/http_api.py:492:46-59: `documentation` may be uninitialized [unbound-name]
- ERROR homeassistant/components/cloud/http_api.py:732:18-31: `language_info` is uninitialized [unbound-name]
- ERROR homeassistant/components/cloud/prefs.py:131:23-28: `prefs` may be uninitialized [unbound-name]
- ERROR homeassistant/components/cloud/tts.py:270:15-21: `gender` may be uninitialized [unbound-name]
- ERROR homeassistant/components/compensation/sensor.py:76:55-59: `name` may be uninitialized [unbound-name]
- ERROR homeassistant/components/compensation/sensor.py:148:12-21: `new_state` is uninitialized [unbound-name]
- ERROR homeassistant/components/compensation/sensor.py:153:12-21: `new_state` is uninitialized [unbound-name]
- ERROR homeassistant/components/compensation/sensor.py:161:53-62: `new_state` is uninitialized [unbound-name]
- ERROR homeassistant/components/compensation/sensor.py:166:29-38: `new_state` is uninitialized [unbound-name]
- ERROR homeassistant/components/compensation/sensor.py:171:28-37: `new_state` is uninitialized [unbound-name]
- ERROR homeassistant/components/compensation/sensor.py:176:21-30: `new_state` is uninitialized [unbound-name]
- ERROR homeassistant/components/compensation/sensor.py:178:29-38: `new_state` is uninitialized [unbound-name]
- ERROR homeassistant/components/compensation/sensor.py:178:67-76: `new_state` is uninitialized [unbound-name]
- ERROR homeassistant/components/config/config_entries.py:565:30-41: `disabled_by` may be uninitialized [unbound-name]
- ERROR homeassistant/components/config/entity_registry.py:285:47-59: `entity_entry` may be uninitialized [unbound-name]
- ERROR homeassistant/components/config/entity_registry.py:288:36-48: `entity_entry` may be uninitialized [unbound-name]
- ERROR homeassistant/components/configurator/__init__.py:84:18-26: `instance` may be uninitialized [unbound-name]
- ERROR homeassistant/components/configurator/__init__.py:91:39-47: `instance` may be uninitialized [unbound-name]
- ERROR homeassistant/components/deconz/siren.py:66:22-30: `duration` may be uninitialized [unbound-name]
- ERROR homeassistant/components/delijn/sensor.py:117:17-30: `first_passage` may be uninitialized [unbound-name]
- ERROR homeassistant/components/device_tracker/legacy.py:559:47-56: `track_new` may be uninitialized [unbound-name]
- ERROR homeassistant/components/device_tracker/legacy.py:655:12-18: `device` may be uninitialized [unbound-name]
- ERROR homeassistant/components/device_tracker/legacy.py:656:19-25: `device` may be uninitialized [unbound-name]
- ERROR homeassistant/components/device_tracker/legacy.py:666:16-22: `device` may be uninitialized [unbound-name]
- ERROR homeassistant/components/device_tracker/legacy.py:667:17-23: `device` may be uninitialized [unbound-name]
- ERROR homeassistant/components/doods/image_processing.py:176:71-87: `label_confidence` may be uninitialized [unbound-name]
- ERROR homeassistant/components/doods/image_processing.py:177:43-59: `label_confidence` may be uninitialized [unbound-name]
- ERROR homeassistant/components/dsmr/sensor.py:983:42-47: `value` is uninitialized [unbound-name]
- ERROR homeassistant/components/dsmr/sensor.py:983:42-47: Argument `float | int | str` is not assignable to parameter `value` with type `str` in function `DSMREntity.translate_tariff` [bad-argument-type]
- ERROR homeassistant/components/dsmr/sensor.py:986:33-38: `value` is uninitialized [unbound-name]
- ERROR homeassistant/components/ecovacs/entity.py:143:18-22: `name` may be uninitialized [unbound-name]
- ERROR homeassistant/components/ecovacs/sensor.py:410:35-40: `value` may be uninitialized [unbound-name]
- ERROR homeassistant/components/ecovacs/sensor.py:420:39-44: `value` may be uninitialized [unbound-name]
- ERROR homeassistant/components/elvia/config_flow.py:58:20-31: `meter_count` is uninitialized [unbound-name]
- ERROR homeassistant/components/energy/validate.py:159:9-14: `issue` may be uninitialized [unbound-name]
- ERROR homeassistant/components/eq3btsmart/climate.py:179:16-20: `mode` is uninitialized [unbound-name]
- ERROR homeassistant/components/eq3btsmart/climate.py:180:48-52: `mode` is uninitialized [unbound-name]
- ERROR homeassistant/components/eq3btsmart/climate.py:191:36-47: `temperature` is uninitialized [unbound-name]
- ERROR homeassistant/components/eq3btsmart/climate.py:196:58-69: `temperature` is uninitialized [unbound-name]
- ERROR homeassistant/components/esphome/entity.py:440:27-36: `has_state` may be uninitialized [unbound-name]
- ERROR homeassistant/components/esphome/sensor.py:106:23-28: `state` is uninitialized [unbound-name]
- ERROR homeassistant/components/esphome/sensor.py:131:21-26: `state` is uninitialized [unbound-name]
- ERROR homeassistant/components/evohome/climate.py:260:32-37: `until` may be uninitialized [unbound-name]
- ERROR homeassistant/components/evohome/climate.py:260:42-47: `until` may be uninitialized [unbound-name]
- ERROR homeassistant/components/feedreader/event.py:90:35-46: `description` may be uninitialized [unbound-name]
- ERROR homeassistant/components/feedreader/event.py:91:29-34: `title` may be uninitialized [unbound-name]
- ERROR homeassistant/components/feedreader/event.py:93:31-38: `content` may be uninitialized [unbound-name]
- ERROR homeassistant/components/file_upload/__init__.py:147:39-47: `filename` is uninitialized [unbound-name]
+ ERROR homeassistant/components/file_upload/__init__.py:147:39-47: `filename` may be uninitialized [unbound-name]
- ERROR homeassistant/components/fints/sensor.py:97:55-67: `account_name` may be uninitialized [unbound-name]
- ERROR homeassistant/components/flux_led/light.py:291:40-50: `brightness` may be uninitialized [unbound-name]
- ERROR homeassistant/components/forecast_solar/coordinator.py:56:22-35: `inverter_size` may be uninitialized [unbound-name]
- ERROR homeassistant/components/forked_daapd/media_player.py:619:16-19: `url` may be uninitialized [unbound-name]
- ERROR homeassistant/components/fritz/config_flow.py:186:16-20: `uuid` may be uninitialized [unbound-name]
- ERROR homeassistant/components/fritz/config_flow.py:187:78-82: `uuid` may be uninitialized [unbound-name]
- ERROR homeassistant/components/fritz/config_flow.py:295:12-17: `error` may be uninitialized [unbound-name]
- ERROR homeassistant/components/fritz/config_flow.py:296:56-61: `error` may be uninitialized [unbound-name]
- ERROR homeassistant/components/fronius/sensor.py:862:35-44: `meter_uid` may be uninitialized [unbound-name]
- ERROR homeassistant/components/fronius/sensor.py:868:35-44: `meter_uid` may be uninitialized [unbound-name]
- ERROR homeassistant/components/frontend/__init__.py:612:18-28: `theme_data` may be uninitialized [unbound-name]
- ERROR homeassistant/components/frontend/__init__.py:613:23-33: `theme_data` may be uninitialized [unbound-name]
- ERROR homeassistant/components/frontend/__init__.py:795:16-19: `tpl` may be uninitialized [unbound-name]
- ERROR homeassistant/components/gdacs/geo_location.py:155:55-65: `event_name` may be uninitialized [unbound-name]
- ERROR homeassistant/components/generic/config_flow.py:180:15-18: `url` may be uninitialized [unbound-name]
- ERROR homeassistant/components/generic/config_flow.py:266:25-38: `stream_source` may be uninitialized [unbound-name]
- ERROR homeassistant/components/generic/config_flow.py:268:62-75: `stream_source` may be uninitialized [unbound-name]
- ERROR homeassistant/components/go2rtc/__init__.py:370:40-53: `stream_source` may be uninitialized [unbound-name]
- ERROR homeassistant/components/go2rtc/__init__.py:379:20-33: `stream_source` may be uninitialized [unbound-name]
- ERROR homeassistant/components/go2rtc/__init__.py:380:49-62: `stream_source` may be uninitialized [unbound-name]
- ERROR homeassistant/components/go2rtc/__init__.py:381:13-26: `stream_source` may be uninitialized [unbound-name]
- ERROR homeassistant/components/go2rtc/__init__.py:403:13-26: `stream_source` may be uninitialized [unbound-name]
- ERROR homeassistant/components/go2rtc/__init__.py:408:21-34: `stream_source` may be uninitialized [unbound-name]
- ERROR homeassistant/components/google/calendar.py:160:20-26: `search` may be uninitialized [unbound-name]
- ERROR homeassistant/components/google/calendar.py:170:13-19: `search` may be uninitialized [unbound-name]
- ERROR homeassistant/components/google_assistant/helpers.py:77:8-20: `entity_entry` may be uninitialized [unbound-name]
- ERROR homeassistant/components/google_assistant/helpers.py:77:25-37: `entity_entry` may be uninitialized [unbound-name]
- ERROR homeassistant/components/google_assistant/helpers.py:78:19-31: `entity_entry` may be uninitialized [unbound-name]
- ERROR homeassistant/components/google_assistant/helpers.py:89:12-24: `entity_entry` may be uninitialized [unbound-name]
- ERROR homeassistant/components/google_assistant/http.py:334:47-51: `data` may be uninitialized [unbound-name]
- ERROR homeassistant/components/google_assistant/http.py:336:17-21: `data` may be uninitialized [unbound-name]
- ERROR homeassistant/components/google_assistant/http.py:343:42-46: `data` may be uninitialized [unbound-name]
- ERROR homeassistant/components/google_assistant/http.py:345:22-26: `data` may be uninitialized [unbound-name]
- ERROR homeassistant/components/google_assistant/trait.py:1696:36-45: `arm_level` may be uninitialized [unbound-name]
- ERROR homeassistant/components/google_assistant/trait.py:1700:45-54: `arm_level` may be uninitialized [unbound-name]
- ERROR homeassistant/components/google_cloud/tts.py:63:8-16: `key_file` may be uninitialized [unbound-name]
- ERROR homeassistant/components/google_cloud/tts.py:65:13-21: `key_file` may be uninitialized [unbound-name]
- ERROR homeassistant/components/google_generative_ai_conversation/config_flow.py:344:53-71: `suggested_llm_apis` may be uninitialized [unbound-name]
- ERROR homeassistant/components/google_mail/notify.py:83:20-28: `to_addrs` may be uninitialized [unbound-name]
- ERROR homeassistant/components/group/entity.py:494:12-21: `component` may be uninitialized [unbound-name]
- ERROR homeassistant/components/habitica/services.py:715:12-33: `remove_checklist_item` may be uninitialized [unbound-name]
- ERROR homeassistant/components/habitica/services.py:716:12-32: `score_checklist_item` may be uninitialized [unbound-name]
- ERROR homeassistant/components/habitica/services.py:717:12-34: `unscore_checklist_item` may be uninitialized [unbound-name]
- ERROR homeassistant/components/habitica/services.py:773:8-21: `add_reminders` may be uninitialized [unbound-name]
- ERROR homeassistant/components/habitica/services.py:773:25-40: `remove_reminder` may be uninitialized [unbound-name]
- ERROR homeassistant/components/habitica/services.py:773:44-59: `clear_reminders` may be uninitialized [unbound-name]
- ERROR homeassistant/components/hardkernel/hardware.py:30:12-17: `board` is uninitialized [unbound-name]
- ERROR homeassistant/components/hardkernel/hardware.py:40:33-38: `board` is uninitialized [unbound-name]
- ERROR homeassistant/components/hardkernel/hardware.py:42:23-28: `board` is uninitialized [unbound-name]
- ERROR homeassistant/components/hardkernel/hardware.py:47:34-39: `board` is uninitialized [unbound-name]
- ERROR homeassistant/components/hardkernel/hardware.py:47:77-82: `board` is uninitialized [unbound-name]
- ERROR homeassistant/components/hassio/ingress.py:272:38-50: `forward_host` may be uninitialized [unbound-name]
- ERROR homeassistant/components/hdmi_cec/__init__.py:287:27-31: `addr` may be uninitialized [unbound-name]
- ERROR homeassistant/components/hdmi_cec/__init__.py:288:36-40: `addr` may be uninitialized [unbound-name]
- ERROR homeassistant/components/hdmi_cec/__init__.py:289:36-40: `addr` may be uninitialized [unbound-name]
- ERROR homeassistant/components/hdmi_cec/__init__.py:290:67-71: `addr` may be uninitialized [unbound-name]
- ERROR homeassistant/components/history/websocket_api.py:426:12-22: `start_time` may be uninitialized [unbound-name]
- ERROR homeassistant/components/history/websocket_api.py:426:26-36: `start_time` may be uninitialized [unbound-name]
- ERROR homeassistant/components/history/websocket_api.py:437:23-33: `start_time` may be uninitialized [unbound-name]
- ERROR homeassistant/components/history/websocket_api.py:457:35-45: `start_time` may be uninitialized [unbound-name]
- ERROR homeassistant/components/history/websocket_api.py:460:60-70: `start_time` may be uninitialized [unbound-name]
- ERROR homeassistant/components/history/websocket_api.py:469:13-23: `start_time` may be uninitialized [unbound-name]
- ERROR homeassistant/components/history/websocket_api.py:533:9-19: `start_time` may be uninitialized [unbound-name]
- ERROR homeassistant/components/history/websocket_api.py:579:29-39: `start_time` may be uninitialized [unbound-name]
- ERROR homeassistant/components/holiday/config_flow.py:176:69-77: `province` may be uninitialized [unbound-name]
- ERROR homeassistant/components/holiday/config_flow.py:207:69-77: `province` may be uninitialized [unbound-name]
- ERROR homeassistant/components/home_connect/entity.py:156:45-56: `retry_after` may be uninitialized [unbound-name]
- ERROR homeassistant/components/homeassistant/exposed_entities.py:162:29-46: `assistant_options` is uninitialized [unbound-name]
- ERROR homeassistant/components/homeassistant/exposed_entities.py:294:12-26: `exposed_entity` may be uninitialized [unbound-name]
- ERROR homeassistant/components/homeassistant/scene.py:326:22-34: `scene_config` is uninitialized [unbound-name]
- ERROR homeassistant/components/homeassistant/triggers/time.py:176:16-24: `has_date` may be uninitialized [unbound-name]
- ERROR homeassistant/components/homeassistant/triggers/time.py:201:18-26: `has_time` may be uninitialized [unbound-name]
- ERROR homeassistant/components/homeassistant/triggers/time.py:248:12-18: `remove` may be uninitialized [unbound-name]
- ERROR homeassistant/components/homeassistant/triggers/time.py:249:45-51: `remove` may be uninitialized [unbound-name]
- ERROR homeassistant/components/homeassistant_green/hardware.py:26:12-17: `board` is uninitialized [unbound-name]
- ERROR homeassistant/components/homeassistant_green/hardware.py:36:33-38: `board` is uninitialized [unbound-name]
- ERROR homeassistant/components/homeassistant_yellow/hardware.py:26:12-17: `board` is uninitialized [unbound-name]
- ERROR homeassistant/components/homeassistant_yellow/hardware.py:36:33-38: `board` is uninitialized [unbound-name]
- ERROR homeassistant/components/homee/cover.py:41:12-22: `open_close` may be uninitialized [unbound-name]
- ERROR homeassistant/components/homekit/__init__.py:1232:18-28: `entry_data` is uninitialized [unbound-name]
+ ERROR homeassistant/components/homekit/__init__.py:1232:18-28: `entry_data` may be uninitialized [unbound-name]
- ERROR homeassistant/components/homekit/type_cameras.py:366:26-38: `input_source` may be uninitialized [unbound-name]
- ERROR homeassistant/components/homekit_controller/device_trigger.py:256:12-18: `source` may be uninitialized [unbound-name]
- ERROR homeassistant/components/homematic/sensor.py:322:37-48: `entity_desc` may be uninitialized [unbound-name]
- ERROR homeassistant/components/html5/notify.py:528:28-35: `targets` may be uninitialized [unbound-name]
- ERROR homeassistant/components/http/auth.py:82:44-50: `secret` may be uninitialized [unbound-name]
- ERROR homeassistant/components/http/auth.py:130:26-30: `data` may be uninitialized [unbound-name]
- ERROR homeassistant/components/http/auth.py:131:47-51: `data` may be uninitialized [unbound-name]
- ERROR homeassistant/components/http/auth.py:140:9-13: `data` may be uninitialized [unbound-name]
- ERROR homeassistant/components/http/auth.py:141:32-36: `data` may be uninitialized [unbound-name]
- ERROR homeassistant/components/http/security_filter.py:53:16-24: `unquoted` may be uninitialized [unbound-name]
- ERROR homeassistant/components/huawei_lte/__init__.py:485:73-76: `url` may be uninitialized [unbound-name]
- ERROR homeassistant/components/huawei_lte/sensor.py:812:38-43: `items` may be uninitialized [unbound-name]
- ERROR homeassistant/components/huawei_lte/sensor.py:814:28-33: `items` may be uninitialized [unbound-name]
- ERROR homeassistant/components/imap/coordinator.py:156:48-56: `date_str` is uninitialized [unbound-name]
- ERROR homeassistant/components/imap/coordinator.py:159:77-85: `date_str` is uninitialized [unbound-name]
- ERROR homeassistant/components/imap/coordinator.py:288:37-47: `message_id` may be uninitialized [unbound-name]
- ERROR homeassistant/components/imap/coordinator.py:312:25-35: `message_id` may be uninitialized [unbound-name]
- ERROR homeassistant/components/imap/coordinator.py:343:17-27: `message_id` may be uninitialized [unbound-name]
- ERROR homeassistant/components/immich/services.py:66:12-24: `target_album` may be uninitialized [unbound-name]
- ERROR homeassistant/components/immich/services.py:68:17-29: `target_album` may be uninitialized [unbound-name]
- ERROR homeassistant/components/incomfort/config_flow.py:190:24-38: `is_reconfigure` may be uninitialized [unbound-name]
- ERROR homeassistant/components/incomfort/config_flow.py:194:20-34: `is_reconfigure` may be uninitialized [unbound-name]
- ERROR homeassistant/components/influxdb/sensor.py:245:21-26: `value` may be uninitialized [unbound-name]
- ERROR homeassistant/components/influxdb/sensor.py:248:23-28: `value` may be uninitialized [unbound-name]
- ERROR homeassistant/components/insteon/entity.py:73:19-30: `description` may be uninitialized [unbound-name]
- ERROR homeassistant/components/insteon/entity.py:73:63-72: `extension` may be uninitialized [unbound-name]
- ERROR homeassistant/components/integration/sensor.py:268:21-32: `unit_prefix` may be uninitialized [unbound-name]
- ERROR homeassistant/components/ios/__init__.py:264:29-38: `conf_user` may be uninitialized [unbound-name]
- ERROR homeassistant/components/ios/notify.py:97:23-30: `targets` may be uninitialized [unbound-name]
- ERROR homeassistant/components/ios/notify.py:99:78-85: `targets` may be uninitialized [unbound-name]
- ERROR homeassistant/components/islamic_prayer_times/__init__.py:89:12-21: `unload_ok` may be uninitialized [unbound-name]
- ERROR homeassistant/components/iss/__init__.py:77:12-21: `unload_ok` may be uninitialized [unbound-name]
- ERROR homeassistant/components/knx/config_flow.py:482:30-36: `_local` may be uninitialized [unbound-name]
- ERROR homeassistant/components/knx/config_flow.py:759:60-67: `host_ia` may be uninitialized [unbound-name]
- ERROR homeassistant/components/knx/config_flow.py:848:30-36: `_local` may be uninitialized [unbound-name]
- ERROR homeassistant/components/knx/light.py:458:17-27: `color_temp` may be uninitialized [unbound-name]
- ERROR homeassistant/components/knx/light.py:459:17-20: `rgb` may be uninitialized [unbound-name]
- ERROR homeassistant/components/knx/light.py:460:17-21: `rgbw` may be uninitialized [unbound-name]
- ERROR homeassistant/components/knx/light.py:461:17-25: `hs_color` may be uninitialized [unbound-name]
- ERROR homeassistant/components/knx/light.py:462:17-25: `xy_color` may be uninitialized [unbound-name]
- ERROR homeassistant/components/knx/light.py:489:12-16: `rgbw` may be uninitialized [unbound-name]
- ERROR homeassistant/components/knx/light.py:490:29-33: `rgbw` may be uninitialized [unbound-name]
- ERROR homeassistant/components/knx/light.py:490:39-43: `rgbw` may be uninitialized [unbound-name]
- ERROR homeassistant/components/knx/light.py:492:12-15: `rgb` may be uninitialized [unbound-name]
- ERROR homeassistant/components/knx/light.py:493:29-32: `rgb` may be uninitialized [unbound-name]
- ERROR homeassistant/components/knx/light.py:496:12-22: `color_temp` may be uninitialized [unbound-name]
- ERROR homeassistant/components/knx/light.py:499:55-65: `color_temp` may be uninitialized [unbound-name]
- ERROR homeassistant/components/knx/light.py:514:12-20: `xy_color` may be uninitialized [unbound-name]
- ERROR homeassistant/components/knx/light.py:516:32-40: `xy_color` may be uninitialized [unbound-name]
- ERROR homeassistant/components/knx/light.py:520:12-20: `hs_color` may be uninitialized [unbound-name]
- ERROR homeassistant/components/knx/light.py:522:25-33: `hs_color` may be uninitialized [unbound-name]
- ERROR homeassistant/components/knx/light.py:523:25-33: `hs_color` may be uninitialized [unbound-name]
- ERROR homeassistant/components/kodi/media_player.py:93:59-62: `uid` may be uninitialized [unbound-name]

... (truncated 336 lines) ...

koda-validate (https://github.com/keithasaurus/koda-validate)
- ERROR koda_validate/dataclasses.py:173:47-54: `coerced` is uninitialized [unbound-name]
- ERROR koda_validate/dataclasses.py:224:47-54: `coerced` is uninitialized [unbound-name]
- ERROR koda_validate/dictionary.py:113:47-54: `coerced` is uninitialized [unbound-name]
- ERROR koda_validate/dictionary.py:169:47-54: `coerced` is uninitialized [unbound-name]
- ERROR koda_validate/list.py:48:42-49: `coerced` is uninitialized [unbound-name]
- ERROR koda_validate/list.py:85:42-49: `coerced` is uninitialized [unbound-name]
- ERROR koda_validate/namedtuple.py:166:47-54: `coerced` is uninitialized [unbound-name]
- ERROR koda_validate/namedtuple.py:217:47-54: `coerced` is uninitialized [unbound-name]
- ERROR koda_validate/set.py:45:41-48: `coerced` is uninitialized [unbound-name]
- ERROR koda_validate/set.py:88:41-48: `coerced` is uninitialized [unbound-name]
- ERROR koda_validate/signature.py:207:42-48: `result` is uninitialized [unbound-name]
- ERROR koda_validate/signature.py:219:42-57: `var_args_result` is uninitialized [unbound-name]
- ERROR koda_validate/signature.py:236:50-59: `kw_result` is uninitialized [unbound-name]
- ERROR koda_validate/signature.py:243:46-59: `kwargs_result` is uninitialized [unbound-name]
- ERROR koda_validate/signature.py:252:46-56: `ret_result` is uninitialized [unbound-name]
- ERROR koda_validate/signature.py:278:42-48: `result` is uninitialized [unbound-name]
- ERROR koda_validate/signature.py:286:42-57: `var_args_result` is uninitialized [unbound-name]
- ERROR koda_validate/signature.py:301:50-59: `kw_result` is uninitialized [unbound-name]
- ERROR koda_validate/signature.py:306:40-53: `kwargs_result` is uninitialized [unbound-name]
- ERROR koda_validate/signature.py:315:46-56: `ret_result` is uninitialized [unbound-name]
- ERROR koda_validate/tuple.py:294:48-55: `coerced` is uninitialized [unbound-name]
- ERROR koda_validate/tuple.py:335:48-55: `coerced` is uninitialized [unbound-name]
- ERROR koda_validate/tuple.py:415:48-55: `coerced` is uninitialized [unbound-name]
- ERROR koda_validate/tuple.py:459:48-55: `coerced` is uninitialized [unbound-name]
- ERROR koda_validate/typeddict.py:167:47-54: `coerced` is uninitialized [unbound-name]
- ERROR koda_validate/typeddict.py:209:47-54: `coerced` is uninitialized [unbound-name]

mkosi (https://github.com/systemd/mkosi)
- ERROR mkosi/bootloader.py:747:67-91: `want_bootctl_auto_enroll` may be uninitialized [unbound-name]
- ERROR mkosi/bootloader.py:749:51-75: `want_bootctl_auto_enroll` may be uninitialized [unbound-name]
- ERROR mkosi/config.py:5066:44-45: `s` may be uninitialized [unbound-name]
- ERROR mkosi/config.py:5069:31-32: `s` may be uninitialized [unbound-name]
- ERROR mkosi/config.py:5071:87-88: `s` may be uninitialized [unbound-name]
- ERROR mkosi/config.py:5075:28-29: `s` may be uninitialized [unbound-name]
- ERROR mkosi/config.py:5077:88-89: `s` may be uninitialized [unbound-name]
- ERROR mkosi/config.py:5082:29-30: `s` may be uninitialized [unbound-name]
- ERROR mkosi/config.py:5082:39-40: `s` may be uninitialized [unbound-name]
- ERROR mkosi/config.py:5082:66-67: `s` may be uninitialized [unbound-name]
- ERROR mkosi/kmod.py:57:24-32: `negative` may be uninitialized [unbound-name]
- ERROR mkosi/qemu.py:764:9-10: `p` may be uninitialized [unbound-name]
- ERROR mkosi/qemu.py:780:13-14: `p` may be uninitialized [unbound-name]
- ERROR mkosi/run.py:652:18-19: `p` is uninitialized [unbound-name]
- ERROR mkosi/run.py:653:42-43: `p` is uninitialized [unbound-name]
- ERROR mkosi/run.py:653:57-58: `p` is uninitialized [unbound-name]

dd-trace-py (https://github.com/DataDog/dd-trace-py)
- ERROR ddtrace/debugging/_exception/replay.py:318:63-74: `snapshot_id` may be uninitialized [unbound-name]
- ERROR ddtrace/internal/logger.py:89:35-39: `part` may be uninitialized [unbound-name]
- ERROR ddtrace/profiling/_gevent.py:93:17-26: `origin_id` may be uninitialized [unbound-name]
- ERROR ddtrace/profiling/_gevent.py:96:16-25: `target_id` may be uninitialized [unbound-name]
- ERROR ddtrace/profiling/_gevent.py:101:39-48: `target_id` may be uninitialized [unbound-name]
- ERROR scripts/gen_gitlab_config.py:616:19-32: `template_path` is uninitialized [unbound-name]
- ERROR tests/conftest.py:355:23-27: `path` may be uninitialized [unbound-name]

pandera (https://github.com/pandera-dev/pandera)
- ERROR pandera/backends/ibis/base.py:173:16-31: `positional_join` may be uninitialized [unbound-name]

werkzeug (https://github.com/pallets/werkzeug)
- ERROR src/werkzeug/datastructures/cache_control.py:117:16-21: `value` may be uninitialized [unbound-name]

yarl (https://github.com/aio-libs/yarl)
- ERROR yarl/_url.py:536:16-19: `ret` may be uninitialized [unbound-name]
- ERROR yarl/_url.py:646:35-41: `netloc` may be uninitialized [unbound-name]
- ERROR yarl/_url.py:827:24-27: `raw` may be uninitialized [unbound-name]
- ERROR yarl/_url.py:827:41-44: `raw` may be uninitialized [unbound-name]
- ERROR yarl/_url.py:827:50-53: `raw` may be uninitialized [unbound-name]
- ERROR yarl/_url.py:828:20-23: `raw` may be uninitialized [unbound-name]
- ERROR yarl/_url.py:828:44-47: `raw` may be uninitialized [unbound-name]
- ERROR yarl/_url.py:828:56-59: `raw` may be uninitialized [unbound-name]
- ERROR yarl/_url.py:1375:41-47: `netloc` may be uninitialized [unbound-name]
- ERROR yarl/_url.py:1416:41-47: `netloc` may be uninitialized [unbound-name]
- ERROR yarl/_url.py:1466:27-36: `join_path` may be uninitialized [unbound-name]
- ERROR yarl/_url.py:1467:30-39: `join_path` may be uninitialized [unbound-name]
- ERROR yarl/_url.py:1490:46-50: `host` may be uninitialized [unbound-name]

setuptools (https://github.com/pypa/setuptools)
- ERROR setuptools/_vendor/wheel/_commands/convert.py:241:43-48: `match` may be uninitialized [unbound-name]
- ERROR setuptools/_vendor/wheel/_commands/convert.py:242:36-41: `match` may be uninitialized [unbound-name]
- ERROR setuptools/_vendor/wheel/_commands/convert.py:243:33-38: `match` may be uninitialized [unbound-name]
- ERROR setuptools/_vendor/wheel/_commands/convert.py:247:32-37: `match` may be uninitialized [unbound-name]
- ERROR setuptools/_vendor/wheel/_commands/convert.py:248:37-42: `match` may be uninitialized [unbound-name]

strawberry (https://github.com/strawberry-graphql/strawberry)
- ERROR strawberry/annotation.py:142:34-42: `resolved` may be uninitialized [unbound-name]
- ERROR strawberry/annotation.py:146:56-64: `resolved` may be uninitialized [unbound-name]
- ERROR strawberry/annotation.py:147:28-36: `resolved` may be uninitialized [unbound-name]
- ERROR strawberry/annotation.py:152:39-47: `resolved` may be uninitialized [unbound-name]
- ERROR strawberry/annotation.py:154:32-40: `resolved` may be uninitialized [unbound-name]
- ERROR strawberry/annotation.py:156:28-36: `resolved` may be uninitialized [unbound-name]
- ERROR strawberry/annotation.py:159:50-58: `resolved` may be uninitialized [unbound-name]
- ERROR strawberry/annotation.py:161:16-24: `resolved` may be uninitialized [unbound-name]
- ERROR strawberry/utils/inspect.py:94:38-44: `origin` may be uninitialized [unbound-name]
- ERROR strawberry/utils/inspect.py:97:36-42: `origin` may be uninitialized [unbound-name]
- ERROR strawberry/utils/inspect.py:108:34-40: `origin` may be uninitialized [unbound-name]

mitmproxy (https://github.com/mitmproxy/mitmproxy)
- ERROR mitmproxy/flowfilter.py:313:35-42: `content` may be uninitialized [unbound-name]

bokeh (https://github.com/bokeh/bokeh)
- ERROR src/bokeh/core/property/container.py:227:14-26: `has_bad_keys` is uninitialized [unbound-name]
- ERROR src/bokeh/core/property/container.py:229:14-32: `has_bad_key_values` is uninitialized [unbound-name]

static-frame (https://github.com/static-frame/static-frame)
- ERROR static_frame/core/loc_map.py:186:12-20: `is_array` may be uninitialized [unbound-name]

prefect (https://github.com/PrefectHQ/prefect)
- ERROR src/prefect/cli/deploy/_core.py:437:26-39: `trigger_specs` may be uninitialized [unbound-name]
- ERROR src/prefect/context.py:984:68-76: `settings` may be uninitialized [unbound-name]
- ERROR src/prefect/telemetry/run_telemetry.py:148:16-27: `traceparent` may be uninitialized [unbound-name]
- ERROR src/integrations/prefect-dask/prefect_dask/client.py:45:45-55: `parameters` may be uninitialized [unbound-name]
- ERROR src/integrations/prefect-dask/prefect_dask/client.py:48:29-39: `parameters` may be uninitialized [unbound-name]
- ERROR src/integrations/prefect-gcp/prefect_gcp/workers/cloud_run_v2.py:835:51-66: `ready_condition` may be uninitialized [unbound-name]

async-utils (https://github.com/mikeshardmind/async-utils)
- ERROR src/async_utils/task_cache.py:107:16-19: `sig` may be uninitialized [unbound-name]
- ERROR src/async_utils/waterfall.py:162:24-28: `loop` may be uninitialized [unbound-name]
- ERROR src/async_utils/waterfall.py:171:17-21: `loop` may be uninitialized [unbound-name]

jax (https://github.com/google/jax)
+ ERROR jax/_src/dtypes.py:971:49-51: `dt` may be uninitialized [unbound-name]
- ERROR jax/_src/pallas/mosaic_gpu/lowering.py:2077:6-16: `new_layout` may be uninitialized [unbound-name]
- ERROR jax/_src/pallas/mosaic_gpu/lowering.py:2082:65-75: `new_layout` may be uninitialized [unbound-name]
- ERROR jax/experimental/mosaic/gpu/core.py:272:10-32: `is_multi_device_module` may be uninitialized [unbound-name]
- ERROR jax/experimental/mosaic/gpu/fragmented_array.py:480:10-18: `bitwidth` is uninitialized [unbound-name]
- ERROR jax/experimental/mosaic/gpu/launch_context.py:798:12-20: `tma_desc` may be uninitialized [unbound-name]
- ERROR jax/experimental/mosaic/gpu/utils.py:1726:10-20: `x_bitwidth` is uninitialized [unbound-name]
- ERROR jax/experimental/mosaic/gpu/utils.py:1727:14-24: `x_bitwidth` is uninitialized [unbound-name]
- ERROR jax/experimental/mosaic/gpu/utils.py:1728:19-29: `x_bitwidth` is uninitialized [unbound-name]
- ERROR jax/experimental/mosaic/gpu/utils.py:1754:30-41: `result_type` may be uninitialized [unbound-name]
- ERROR jax/experimental/mosaic/gpu/utils.py:1762:21-32: `result_type` may be uninitialized [unbound-name]
- ERROR jax/experimental/mosaic/gpu/wgmma.py:193:6-15: `a_in_regs` may be uninitialized [unbound-name]
- ERROR jax/experimental/mosaic/gpu/wgmma.py:217:6-15: `a_in_regs` may be uninitialized [unbound-name]
- ERROR jax/experimental/mosaic/gpu/wgmma.py:272:8-17: `a_in_regs` may be uninitialized [unbound-name]
- ERROR jax/experimental/mosaic/gpu/wgmma.py:383:8-17: `a_in_regs` may be uninitialized [unbound-name]
- ERROR jax/experimental/mosaic/gpu/wgmma.py:412:6-15: `a_in_regs` may be uninitialized [unbound-name]
- ERROR jax/experimental/mosaic/gpu/wgmma.py:447:6-15: `a_in_regs` may be uninitialized [unbound-name]
- ERROR jax/experimental/mosaic/gpu/wgmma.py:454:10-19: `a_in_regs` may be uninitialized [unbound-name]
- ERROR jax/experimental/multihost_utils.py:292:6-23: `is_prng_key_array` may be uninitialized [unbound-name]
- ERROR jax/experimental/multihost_utils.py:447:8-25: `is_prng_key_array` may be uninitialized [unbound-name]
- ERROR jax/experimental/pallas/ops/gpu/all_gather_mgpu.py:84:43-54: `output_size` is uninitialized [unbound-name]
- ERROR jax/experimental/pallas/ops/gpu/reduce_scatter_mgpu.py:99:43-54: `output_size` is uninitialized [unbound-name]

bidict (https://github.com/jab/bidict)
- ERROR bidict/_base.py:555:46-59: `should_invert` may be uninitialized [unbound-name]

sphinx (https://github.com/sphinx-doc/sphinx)
- ERROR sphinx/__init__.py:45:13-16: `ret` may be uninitialized [unbound-name]

aiohttp (https://github.com/aio-libs/aiohttp)
- ERROR aiohttp/web_urldispatcher.py:1086:16-25: `index_key` may be uninitialized [unbound-name]

scrapy (https://github.com/scrapy/scrapy)
- ERROR scrapy/logformatter.py:125:23-28: `level` may be uninitialized [unbound-name]
- ERROR scrapy/logformatter.py:126:38-43: `level` may be uninitialized [unbound-name]
- ERROR scrapy/logformatter.py:128:22-27: `level` may be uninitialized [unbound-name]

pwndbg (https://github.com/pwndbg/pwndbg)
- ERROR pwndbg/aglib/disasm/mips.py:244:21-28: `address` may be uninitialized [unbound-name]
- ERROR pwndbg/aglib/disasm/riscv.py:183:21-28: `address` may be uninitialized [unbound-name]
- ERROR pwndbg/aglib/disasm/riscv.py:197:21-28: `address` may be uninitialized [unbound-name]
- ERROR pwndbg/aglib/disasm/riscv.py:284:13-19: `target` may be uninitialized [unbound-name]
- ERROR pwndbg/aglib/disasm/x86.py:316:16-24: `seg_base` may be uninitialized [unbound-name]
+ ERROR pwndbg/aglib/kernel/paging.py:106:27-31: Argument `Page` is not assignable to parameter `object` with type `Never` in function `list.append` [bad-argument-type]
+ ERROR pwndbg/aglib/kernel/paging.py:107:16-22: Returned type `list[Never]` is not assignable to declared return type `list[Page]` [bad-return]

cwltool (https://github.com/common-workflow-language/cwltool)
- ERROR cwltool/checker.py:64:39-47: `_srctype` may be uninitialized [unbound-name]
- ERROR cwltool/checker.py:66:39-47: `_srctype` may be uninitialized [unbound-name]
- ERROR cwltool/checker.py:71:37-45: `_srctype` may be uninitialized [unbound-name]
- ERROR cwltool/checker.py:79:46-54: `_srctype` may be uninitialized [unbound-name]

@meta-codesync
Copy link

meta-codesync bot commented Feb 23, 2026

@yangdanny97 has imported this pull request. If you are a Meta employee, you can view this in D94092244.

@github-actions
Copy link

Primer Diff Classification

❌ 4 regression(s) | ✅ 21 improvement(s) | ❓ 1 needs review | 26 project(s) total

❌ Regression (4)

pandera (-1)

Looking at the code, positional_join is assigned using the walrus operator on line 142 within an if condition: if (positional_join := check_obj.get_backend().name in POSITIONAL_JOIN_BACKENDS):. However, this variable is then referenced on line 173: if not positional_join:. The issue is that if the condition on line 142 evaluates to False, the walrus operator assignment never executes, leaving positional_join unbound when it's referenced later. This is a genuine scoping bug - the variable should be assigned before the conditional or the reference should be restructured. The error was correctly identifying a real bug where the code could fail with NameError at runtime.

setuptools (-5)

Looking at the code in WininstFileSource.__init__(), there's a genuine bug in the control flow. On line 239, the walrus operator match := egg_info_re.match(filename) assigns the result to match, but if the regex doesn't match, match becomes None. However, lines 241-248 unconditionally access match.group('name'), match.group('ver'), etc. without checking if match is None first. This would cause a runtime AttributeError if no egg-info file is found in the zip. The removed errors were correctly identifying that match could be uninitialized (None) when accessed. This is a real bug that pyrefly was properly catching.

prefect (-6)

These are genuine bugs where variables assigned with walrus operators in conditional expressions can be accessed when unbound. In _core.py, trigger_specs is only assigned if _gather_deployment_trigger_definitions() returns a truthy value (line 324), but is unconditionally accessed on line 437. This would cause a NameError at runtime. Removing detection of real unbound variable bugs represents a loss of capability.

pwndbg (+2, -5)

Both new errors contain Never types, which is a strong indicator of type inference failures rather than real bugs. The first error claims Page (a concrete class being constructed) is not assignable to parameter object with type Never - this suggests pyrefly failed to infer the correct type for the list's element type. The second error claims the return type is list[Never] instead of list[Page] - again indicating inference failure. Looking at the code, line 104 creates Page objects with concrete arguments, and line 106 appends them to a result list that should be list[Page]. The removed unbound-name errors about address being uninitialized were likely false positives - in disassembly code, variables like address are typically assigned in loops or conditional blocks that the type checker cannot fully analyze.

✅ Improvement (21)

trio (+2, -13)

The new errors correctly identify improper ParamSpec usage in the _nonblocking_helper method signature. Looking at line 440 and 1276, pyrefly is now properly validating that P (a ParamSpec) is being used correctly. The removed errors were false positives - the previous type checker was incorrectly reporting issues with valid ParamSpec usage, TypeVar returns, and scope problems. The code is actually correct: P is properly defined as ParamSpec("P") on line 34 within a TYPE_CHECKING block, and the function signature correctly uses *args: P.args and **kwargs: P.kwargs on lines 989-990. The new errors indicate pyrefly has improved its ParamSpec validation to catch genuine type annotation issues while removing the false positive noise.

psycopg (-101)

These are false positive removals. The errors claimed variables like cfg and fmt were unbound, but they are actually properly bound by walrus operators (:=) in conditional expressions. In the first example, cfg is assigned via if (cfg := inliner.document.settings.env.app.config).ticket_url is None: on line 19, making it available on line 32. In the second example, fmt is assigned via if not self._own_loaders[(fmt := loader.format)]: on line 184, making it available on line 188. The walrus operator (introduced in Python 3.8) assigns values within expressions and makes those variables available in the enclosing scope. Pyrefly was incorrectly failing to recognize this scoping behavior and flagging properly bound variables as unbound. Removing these false positives means pyrefly now correctly understands walrus operator variable binding.

cki-lib (-3)

Without access to the source code, I cannot verify whether these unbound-name errors were genuine bugs or false positives. However, the pattern suggests pyrefly may have had overly conservative control flow analysis that flagged variables as potentially unbound even when all execution paths properly initialize them. The removal of these errors likely indicates improved control flow analysis that can better track variable initialization through complex conditional logic, exception handling, or loop constructs. This would be an improvement in reducing false positive noise.

hydpy (-5)

These are genuine unbound variable errors where variables may be used before assignment in certain code paths. In filetools.py line 212, projectdir is only assigned in the walrus operator on line 204 but could be uninitialized if that condition fails. In parametertools.py line 2440, relevant is used in a condition but may not be assigned if self.relevant is None and the mask doesn't have a relevant attribute. In modelutils.py line 2999, module may be uninitialized in some code paths. In commandtools.py line 523, nmb is used without being assigned. The sw1d_network.py error appears to be a type inference issue during dependency cycle resolution. These are real bugs that would cause runtime NameError exceptions.

Tanjun (-4)

These were false positive errors. Looking at the code, the permissions variable is initialized on line 149 via the walrus operator: if (permissions := _calculate_role_permissions(roles, member)) & permissions.ADMINISTRATOR:. This assignment happens unconditionally before any usage of permissions on lines 153 and 155. The walrus operator := assigns the result of _calculate_role_permissions(roles, member) to permissions as part of the conditional expression. Since this assignment occurs before the variable is used, there is no actual unbound name error. Pyrefly was incorrectly failing to recognize that the walrus operator creates a binding that persists beyond the conditional expression. This is a well-understood Python feature that mypy and pyright handle correctly.

core (+2, -555)

The 2 new errors are false positives where pyrefly fails to understand walrus operator assignments in conditional expressions. In both cases, the variables are guaranteed to be initialized when used due to the conditional logic structure. The 555 removed errors represent pyrefly fixing many similar false positives in variable initialization tracking across the codebase. This is a net improvement despite the 2 remaining false positives.

koda-validate (-26)

These were false positives. The walrus operator := in (coerced := self.coerce(val)).is_just initializes the coerced variable before the condition is evaluated. The else block only executes when coerced.is_just is truthy, guaranteeing that coerced contains a valid Maybe object. This is a standard Python 3.8+ pattern that mypy/pyright handle correctly. Pyrefly was incorrectly failing to track variable initialization through walrus operators.

mkosi (-16)

The removed errors were false positives. Pyrefly was incorrectly analyzing the walrus operator pattern if var := expression: and failing to recognize that the assignment happens before the variable is used as the condition. The walrus operator guarantees that want_bootctl_auto_enroll is always initialized (either True or False) before any subsequent use. This is a standard Python pattern since 3.8 that mypy/pyright handle correctly.

dd-trace-py (-7)

These are false positives from pyrefly's control flow analysis. In the first case, snapshot_id is guaranteed to be initialized either from the walrus operator assignment or the subsequent assignment on line 315. In the second case, part is initialized by the walrus operator (part := parts.pop(0)) before being used on line 89. Pyrefly failed to track that these variables are properly initialized before use, creating noise where no real bugs exist.

werkzeug (-1)

This is a false positive removal. The error claimed value may be uninitialized at line 117, but examining the code shows this is incorrect. On line 108, there's a walrus operator assignment: if (value := self[key]) is None:. This assignment initializes value with the result of self[key]. The control flow then goes: if value is None, return empty (line 109); otherwise continue to the type conversion block (lines 111-115) and finally return value (line 117). The variable value is guaranteed to be initialized by the walrus operator before any path reaches line 117. Pyrefly was incorrectly flagging valid code - removing this false positive is an improvement in the type checker's control flow analysis.

yarl (-13)

These were false positive unbound-name errors. In the first case (line 536), ret is guaranteed to be assigned because the if condition on line 531 checks ret := self._cache.get("hash") and only enters the None branch if the assignment succeeded, meaning ret is always bound before the return. In the second case (line 646), both scheme and netloc are guaranteed to be assigned in the preceding lines (639-640) before being used. Pyrefly was incorrectly flagging these as potentially uninitialized when the control flow analysis should show they are always bound. Removing these false positives improves the type checker's accuracy.

strawberry (-11)

These were false positives. The walrus operator if (resolved := self.__resolve_cache__) is None: on line 136 guarantees that resolved is assigned in both branches - either to the cached value (if not None) or to self._resolve() (if None). This is a standard Python pattern that type checkers should understand. Pyrefly was incorrectly flagging resolved as potentially uninitialized at lines 142 and 146, when it's actually guaranteed to be bound by the walrus operator assignment.

mitmproxy (-1)

This is a false positive removal. The code uses the walrus operator correctly: if (f.response and (content := f.response.get_content(strict=False)) is not None): on lines 309-312. The walrus operator := both assigns the result of f.response.get_content(strict=False) to content AND returns that value for the is not None check. When the condition is True (meaning content is not None), execution enters the if block where line 313 uses content. The variable is guaranteed to be bound at that point. This is a standard Python 3.8+ pattern that pyrefly was incorrectly flagging as unbound.

bokeh (-2)

Looking at line 225, both has_bad_keys and has_bad_key_values are assigned using walrus operators within the if condition: if (has_bad_keys := any(bad_keys)) & (has_bad_key_values := any(bad_value_keys)):. The walrus operator (:=) assigns values to these variables when the if expression is evaluated, making them available for use in the subsequent elif branches on lines 227 and 229. This is valid Python code - the variables are properly initialized before being used. Pyrefly was incorrectly flagging these as uninitialized when they are actually assigned via walrus operators in the preceding if statement.

static-frame (-1)

This error correctly identifies a real bug in the code. The walrus operator := on line 180 only assigns is_array when the condition key.__class__ is np.ndarray is True. When the condition is False, is_array is never assigned, but line 186 references it unconditionally with if is_array or is_list:. This would cause a NameError: name 'is_array' is not defined at runtime when the key is not a numpy array. The fix would be to either use regular assignment is_array = key.__class__ is np.ndarray or explicitly assign is_array = False in the else branch. Removing this error detection means pyrefly is no longer catching a genuine runtime bug.

async-utils (-3)

These are false positive unbound-name errors that pyrefly incorrectly flagged. In task_cache.py line 107, sig is guaranteed to be initialized because it's assigned on line 96 within the same method before being returned on line 107. In waterfall.py lines 162 and 171, loop is guaranteed to be initialized because it's assigned on line 132 (with a fallback assignment on line 133) before being used on lines 162 and 171. The control flow analysis shows these variables are always initialized before use, making the original errors false positives. Removing these incorrect unbound-name warnings improves pyrefly's accuracy.

jax (+1, -21)

The new error correctly identifies a genuine bug where variable dt is referenced but not defined in scope on line 971. The error message tries to format with dt but this variable doesn't exist in this code path - it should likely use x instead. The removed errors appear to be similar unbound variable issues that pyrefly previously missed but now correctly detects. This represents pyrefly getting better at catching real Python scoping bugs.

bidict (-1)

The error claims should_invert may be uninitialized, but this is incorrect. On line 552, the walrus operator := assigns isinstance(self, GeneratedBidictInverse) to should_invert before evaluating the conditional. The walrus operator guarantees that the assignment happens first, so should_invert is always initialized by the time line 555 executes. This is a false positive - pyrefly is failing to understand the initialization semantics of the walrus operator.

sphinx (-1)

The error correctly identifies a real bug. The walrus operator ret := subprocess.run(...).stdout on line 36 only binds ret if the stdout is truthy (non-empty). If the git command fails or returns empty output, ret remains unbound, but line 45 unconditionally tries to del ret, which would raise a NameError at runtime. This is a genuine control flow issue where a variable may not be initialized before use.

scrapy (-3)

These are false positive unbound-name errors. Looking at the code flow: line 123 uses a walrus operator if (level := getattr(exception, "log_level", None)) is None: which assigns to level regardless of whether the condition is true or false. If the condition is true (getattr returns None), level is assigned None and then reassigned on line 124. If the condition is false, level is assigned the non-None value from getattr. Either way, level is definitely bound before lines 125-128. Pyrefly's control flow analysis failed to recognize that walrus operator assignments initialize variables even when the condition fails. This is a classic false positive pattern that modern type checkers handle correctly.

cwltool (-4)

These are false positive unbound-name errors. Looking at the control flow in the check_types function, _srctype is guaranteed to be initialized before use:

  1. Line 39: _srctype := _get_type(srctype) - walrus operator assigns _srctype in the if condition
  2. Line 60: _srctype = srctype - assigns _srctype in the else branch

The if-else structure (lines 37-61) ensures that _srctype is always assigned before the match statement (line 62) where it's used. The variable is properly initialized in both branches of the conditional. Pyrefly's control flow analysis appears to be incorrectly flagging this as potentially unbound when the code structure guarantees initialization.

❓ Needs Review (1)

aiohttp (-1)

LLM classification failed: Could not parse LLM response as JSON: Looking at this error, I need to analyze the code flow in the _get_resource_index_key method to determine if index_key can actually be uninitialized.

Let me trace through the method:

def _get_resource_index_key(self, resource: AbstractResource) -> str:
    """Return a key to index the resource in the resource index."""
    if "{" in (index_key := resource.canonical):
        # strip at the first { to allow for variables, and than
        # rpartition at / to allow for variable parts in the path
        # For example if the canonical path is `/core/locations{tail:.*}`
        # the index key will be `/core` since index is based on the
        # url parts split by `/`
        index_key = index_key.partition("{")[0].rpartition("/")[0]
    return index_key.rstrip("/") or "/"

The key insight is the walrus operator assignment: if "{" in (index_key := resource.canonical):. This assignment happens regardless of whether the condition is true or false. The walrus operator := assigns resource.canonical to index_key as part of evaluating the condition.

So the execution flow is:

  1. index_key gets assigned resource.canonical
  2. The condition "{" in index_key is evaluated
  3. If true: index_key is reassigned to the processed value
  4. If false: index_key retains the value from step 1
  5. In either case, index_key is defined when we reach the return statement

This is a false positive - the variable index_key is always initialized by the walrus operator before the return statement is reached. The type checker is incorrectly flagging this as potentially uninitialized, likely because it doesn't properly understand the semantics of the walrus operator in conditional expressions.

{"spec_check": "No specific typing spec rule applies here - this is about variable initialization analysis, not type checking per se", "runtime_behavior": "No runtime error would occur - index_key is always assigned by the walrus operator before being used", "mypy_pyright": "Mypy and pyright would not flag this - they correctly understand walrus operator semantics", "reason": "This is a false positive. The walrus operator := in if \"{\" in (index_key := resource.canonical): assigns resource.canonical to index_key regardless of whether the condition is true or false. The variable is always initialized before the return statement. Pyrefly is incorrectly analyzing the control flow and missing that the walrus operator performs assignment as part of condition evaluation.", "verdict": "improvement"}. Non-trivial change (0 added, 1 removed).


Classification by primer-classifier (1 heuristic, 25 LLM)

migeed-z added a commit that referenced this pull request Feb 24, 2026
…ifier

Split LLM classification into two passes to fix verdict-reasoning
contradictions (4/26 in PR #2493). Pass 1 produces reasoning and
PR attribution without a verdict. Pass 2 reads the reasoning and
assigns the verdict. This separates code analysis (hard) from
labeling (easy), eliminating cases where the LLM commits to a
verdict early and writes contradictory reasoning.

Also adds --pyrefly-diff CLI flag to include the pyrefly PR code
diff in each LLM call, enabling per-project attribution of which
code change caused errors to appear or disappear.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

unbound name when using walrus operator within a ternary expression

1 participant