Skip to content

Add typing for event_manager #52877

@armenzg

Description

@armenzg

Currently, we're not checking backend types for it. We're planning to improve the performance of the save_event code, thus, we should add typing before we keep making more changes.

After removing it from pyproject.toml we get the following:

make backend-typing
--> Running Python typing checks
mypy
src/sentry/event_manager.py:48: error: Module "sentry.attachments" does not explicitly export attribute "MissingAttachmentChunks"  [attr-defined]
src/sentry/event_manager.py:58: error: Module "sentry.eventtypes" does not explicitly export attribute "CspEvent"  [attr-defined]
src/sentry/event_manager.py:58: error: Module "sentry.eventtypes" does not explicitly export attribute "DefaultEvent"  [attr-defined]
src/sentry/event_manager.py:58: error: Module "sentry.eventtypes" does not explicitly export attribute "ErrorEvent"  [attr-defined]
src/sentry/event_manager.py:58: error: Module "sentry.eventtypes" does not explicitly export attribute "ExpectCTEvent"  [attr-defined]
src/sentry/event_manager.py:58: error: Module "sentry.eventtypes" does not explicitly export attribute "ExpectStapleEvent"  [attr-defined]
src/sentry/event_manager.py:58: error: Module "sentry.eventtypes" does not explicitly export attribute "HpkpEvent"  [attr-defined]
src/sentry/event_manager.py:58: error: Module "sentry.eventtypes" does not explicitly export attribute "TransactionEvent"  [attr-defined]
src/sentry/event_manager.py:1252: error: Module has no attribute "incr_multi"  [attr-defined]
src/sentry/event_manager.py:1255: error: Module has no attribute "record_multi"  [attr-defined]
src/sentry/event_manager.py:1258: error: Module has no attribute "record_frequency_multi"  [attr-defined]
src/sentry/event_manager.py:1930: error: Module has no attribute "refund"  [attr-defined]
src/sentry/event_manager.py:1967: error: Module has no attribute "refund"  [attr-defined]
src/sentry/event_manager.py:2091: error: Module has no attribute "refund"  [attr-defined]
src/sentry/event_manager.py:2158: error: Argument 1 to "BytesIO" has incompatible type "Callable[[CachedAttachment], Any]"; expected "Buffer"  [arg-type]
src/sentry/event_manager.py:2269: error: Argument 1 to "write_to_event" of "CalculatedHashes" has incompatible type "NodeData"; expected "Dict[str, Any]"  [arg-type]
Found 16 errors in 1 files (checked 4918 source files)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions