Skip to content

refactor(api): type I18nObject.to_dict with I18nObjectDict TypedDict#34680

Merged
asukaminato0721 merged 1 commit intolanggenius:mainfrom
statxc:refactor/typed-dict-i18n-object
Apr 7, 2026
Merged

refactor(api): type I18nObject.to_dict with I18nObjectDict TypedDict#34680
asukaminato0721 merged 1 commit intolanggenius:mainfrom
statxc:refactor/typed-dict-i18n-object

Conversation

@statxc
Copy link
Copy Markdown
Contributor

@statxc statxc commented Apr 7, 2026

Part of #32863 (api/core/tools/entities/, api/core/datasource/entities/)

Summary

  • Add I18nObjectDict TypedDict in tools/entities/common_entities.py, annotate I18nObject.to_dict
  • Add I18nObjectDict TypedDict in datasource/entities/common_entities.py, annotate I18nObject.to_dict

Why this change

Both I18nObject.to_dict implementations return an identical fixed-key dict (zh_Hans, en_US, pt_BR, ja_JP) but had no return type annotation (or bare -> dict). The TypedDict makes the i18n shape explicit and checkable.

Changes

  • api/core/tools/entities/common_entities.py: Define I18nObjectDict, annotate to_dict
  • api/core/datasource/entities/common_entities.py: Define I18nObjectDict, annotate to_dict

@statxc statxc requested a review from QuantumGhost as a code owner April 7, 2026 13:31
@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. refactor labels Apr 7, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 7, 2026

Pyrefly Diff

No changes detected.

@asukaminato0721 asukaminato0721 added this pull request to the merge queue Apr 7, 2026
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Apr 7, 2026
Merged via the queue into langgenius:main with commit 5aa2524 Apr 7, 2026
26 of 27 checks passed
@statxc statxc deleted the refactor/typed-dict-i18n-object branch April 8, 2026 03:08
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