Skip to content

Improve type annotation for event parameter in batch processing functions #7923

@maxrabin

Description

@maxrabin

Description

The process_partial_response and async_process_partial_response functions have incomplete type annotations for the event parameter. Currently it's typed as dict, but since Lambda events are JSON objects, it should be typed as dict[str, Any] for better type checking.

Impact

When using strict type checkers like pyright, the current implementation causes type errors:

error: Type of "process_partial_response" is partially unknown
  Type of "process_partial_response" is "(event: dict[Unknown, Unknown], ...)" (reportUnknownVariableType)

With dict[str, Any], the type checker correctly infers the event type.

Additional Context

  • AWS Lambda events are always JSON objects, which in Python are represented as dict[str, Any]
  • This change improves type safety without breaking existing code
  • The same pattern is used elsewhere in the codebase for Lambda event parameters

Metadata

Metadata

Assignees

Labels

typingStatic typing definition related issues (mypy, pyright, etc.)

Projects

Status

Coming soon

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions