-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ref(event_manager): Fix typing issues for event_manager #52974
Conversation
We want to make a lot of changes to event_manager and we need to have backend typing in place for the upcoming work. Fixes #52877
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #52974 +/- ##
==========================================
- Coverage 79.38% 77.76% -1.62%
==========================================
Files 4935 4934 -1
Lines 207336 207428 +92
Branches 35424 35443 +19
==========================================
- Hits 164586 161312 -3274
- Misses 37714 41071 +3357
- Partials 5036 5045 +9
|
src/sentry/event_manager.py
Outdated
@@ -2155,7 +2139,7 @@ def save_attachment( | |||
type=attachment.type, | |||
headers={"Content-Type": attachment.content_type}, | |||
) | |||
file.putfile(BytesIO(data), blob_size=settings.SENTRY_ATTACHMENT_BLOB_SIZE) | |||
file.putfile(BytesIO(data), blob_size=settings.SENTRY_ATTACHMENT_BLOB_SIZE) # type: ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I think this got lost from the other review but want to make sure it gets addressed)
the problem here is the type alias above -- it shouldn't be Type[Cached...]
( don't remember the name and it's offscreen) -- the type alias should probably be removed entirely at that point since it'll just be A = B
and just meaningless indirection
src/sentry/event_manager.py
Outdated
@@ -2266,7 +2250,8 @@ def _calculate_event_grouping( | |||
event.data["grouping_config"] = get_grouping_config_dict_for_project(project) | |||
hashes = event.get_hashes() | |||
|
|||
hashes.write_to_event(event.data) | |||
# Using cast to satisfy mypy | |||
hashes.write_to_event(cast(Dict[str, Any], event.data)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the types should get updated here rather than cast
-- cast
and type: ignore
should generally only be used for mypy bugs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want to make a lot of changes to event_manager and we need to have backend typing in place for the upcoming work.
Fixes #52877