Skip to content

refactor: replace bare dict with dict[str, Any] in response converter…#35212

Merged
asukaminato0721 merged 1 commit intolanggenius:mainfrom
wdeveloper16:refactor/typed-dict-generate-response-converters
Apr 14, 2026
Merged

refactor: replace bare dict with dict[str, Any] in response converter…#35212
asukaminato0721 merged 1 commit intolanggenius:mainfrom
wdeveloper16:refactor/typed-dict-generate-response-converters

Conversation

@wdeveloper16
Copy link
Copy Markdown
Contributor

What this PR does

Part of #22651 — replaces bare dict annotations with dict[str, Any] in response converter modules and miscellaneous production files.

Response converters (core/app/apps/*/generate_response_converter.py):

  • All 6 subclass converters + base class: Generator[dict | str, ...]Generator[dict[str, Any] | str, ...]
  • Adds Any to from typing import cast in agent_chat, chat, completion, and workflow converters

Other production files:

  • core/plugin/backwards_invocation/model.py: inner handle() return type Generator[dict, ...]Generator[dict[str, Any], ...]; adds from typing import Any
  • enterprise/telemetry/metric_handler.py: attrs: dictdict[str, Any]
  • controllers/console/datasets/datasets_document.py: metadata_schema: dict = cast(dict, ...)dict[str, Any] = cast(dict[str, Any], ...)
  • controllers/console/workspace/models.py: credentials: dictdict[str, Any]
  • controllers/console/auth/activate.py: data: dict | Nonedict[str, Any] | None; adds from typing import Any

Why

Bare dict is equivalent to dict[Any, Any], losing key-type information. All these dicts use string keys, so dict[str, Any] is the correct annotation and passes basedpyright strict checks.

…s and misc modules

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. refactor labels Apr 14, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Pyrefly Diff

No changes detected.

@asukaminato0721 asukaminato0721 added this pull request to the merge queue Apr 14, 2026
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Apr 14, 2026
Merged via the queue into langgenius:main with commit 7e7b27f Apr 14, 2026
28 checks passed
HanqingZ pushed a commit to HanqingZ/dify that referenced this pull request Apr 23, 2026
asukaminato0721 pushed a commit to asukaminato0721/dify that referenced this pull request Apr 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer refactor size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants