Skip to content

refactor(api): remove type: ignore and FIXME comments in factories#34978

Open
zmjaction wants to merge 1 commit intolanggenius:mainfrom
zmjaction:fix/factory-type-ignore
Open

refactor(api): remove type: ignore and FIXME comments in factories#34978
zmjaction wants to merge 1 commit intolanggenius:mainfrom
zmjaction:fix/factory-type-ignore

Conversation

@zmjaction
Copy link
Copy Markdown

Remove FIXME and type: ignore in ModerationFactory and ExternalDataToolFactory.

extension_class() returns a bare type, so mypy doesn't know validate_config exists on the returned class. Using cast(type[Moderation], ...) and cast(type[ExternalDataTool], ...) fixes it without silencing th
e checker.

No runtime changes.

Fixes #34977

  • This change requires a documentation update
  • I understand that this PR may be closed in case there was no previous discussion or issues
  • I've added a test for each change that was introduced
  • I've updated the documentation accordingly

Use cast() to assert the correct extension class type instead of
silencing the type checker with type: ignore. This aligns with the
project's goal of precise type annotations and removes long-standing
FIXME comments.

- api/core/moderation/factory.py
- api/core/external_data_tool/factory.py
@zmjaction zmjaction requested a review from QuantumGhost as a code owner April 12, 2026 01:44
@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. refactor labels Apr 12, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Pyrefly Diff

No changes detected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove FIXME and type: ignore in moderation/external_data_tool factories

1 participant