Skip to content

fix: Use Optional[T] for nullable type annotation defaults#325

Open
kuishou68 wants to merge 3 commits into
OpenBMB:mainfrom
kuishou68:fix/type-annotations-optional
Open

fix: Use Optional[T] for nullable type annotation defaults#325
kuishou68 wants to merge 3 commits into
OpenBMB:mainfrom
kuishou68:fix/type-annotations-optional

Conversation

@kuishou68
Copy link
Copy Markdown
Contributor

Summary

This PR fixes incorrect type annotations where bare types (int, str) are used with None as default value. Per PEP 484, these should be Optional[T] = None.

Changes

  • kv_channels: int = Nonekv_channels: Optional[int] = None (config.py)
  • out_dim: int = Noneout_dim: Optional[int] = None (local_dit.py)
  • cache_dir: str = Nonecache_dir: Optional[str] = None (core.py)
  • prompt_wav_path: str = Noneprompt_wav_path: Optional[str] = None (core.py)
  • prompt_text: str = Noneprompt_text: Optional[str] = None (core.py)
  • reference_wav_path: str = Nonereference_wav_path: Optional[str] = None (core.py)

Files Modified

  1. src/voxcpm/modules/minicpm4/config.py — add Optional import, fix kv_channels annotation
  2. src/voxcpm/modules/locdit/local_dit.py — add Optional import, fix out_dim annotation
  3. src/voxcpm/core.py — fix cache_dir, prompt_wav_path, prompt_text, reference_wav_path annotations

Closes #324

kuishou68 added 3 commits June 1, 2026 16:55
Co-authored-by: kuishou68 <54054995+kuishou68@users.noreply.github.com>
Co-authored-by: kuishou68 <54054995+kuishou68@users.noreply.github.com>
Fix cache_dir, prompt_wav_path, prompt_text, and reference_wav_path.

Co-authored-by: kuishou68 <54054995+kuishou68@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: Incorrect type annotations — use Optional[T] instead of T for nullable defaults

1 participant