-
-
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
typing(models): Type event store models #77407
base: master
Are you sure you want to change the base?
Conversation
self.project_id = project_id | ||
self.event_id = event_id | ||
self._snuba_data = snuba_data or {} | ||
|
||
def __getstate__(self) -> Mapping[str, Any]: | ||
def __getstate__(self) -> dict[str, Any]: |
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.
This will allow for some .pop()
that is done later on.
@@ -99,7 +99,7 @@ def platform(self) -> str | None: | |||
column = self._get_column_name(Columns.PLATFORM) | |||
if column in self._snuba_data: | |||
return cast(str, self._snuba_data[column]) | |||
return cast(str, self.data.get("platform", None)) | |||
return self.data.get("platform") |
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.
Not needed.
template = self.project.get_option("mail:subject_template") | ||
if template: | ||
template = EventSubjectTemplate(template) | ||
elif self.group.issue_category == GroupCategory.PERFORMANCE: |
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.
self.group is not available in BaseEvent
. Moving this function to EventGroup
.
# for a long time culprit was not persisted. In those cases put | ||
# the culprit in from the group. | ||
if data.get("culprit") is None and self.group_id and self.group: | ||
data["culprit"] = self.group.culprit |
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.
self.group is not available in BaseEvent
. Moving this function to EventGroup
.
@@ -591,10 +547,10 @@ def __init__( | |||
): | |||
super().__init__(project_id, event_id, snuba_data=snuba_data) | |||
self.group_id = group_id | |||
self.groups = groups | |||
self.groups = groups or [] | |||
self.data = 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.
@asottile-sentry @wedamija I need help here. I can't figure out how to fix this error.
mypy src/sentry/eventstore/models.py
src/sentry/eventstore/models.py:549: error: Incompatible types in assignment (expression has type "Mapping[str, Any] | None", variable has type "NodeData") [assignment]
Found 1 error in 1 file (checked 1 source file)
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.
mypy doesn't understand disparate setters unfortunately -- you can work around this by making the property setter call some private method and have this call that same private method
❌ 1454 Tests Failed:
View the top 3 failed tests by shortest run time
To view individual test run time comparison to the main branch, go to the Test Analytics Dashboard |
This pull request has gone three weeks without activity. In another week, I will close it. But! If you comment or otherwise update it, I will reset the clock, and if you add the label "A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀 |
This issue has gone three weeks without activity. In another week, I will close it. But! If you comment or otherwise update it, I will reset the clock, and if you remove the label "A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀 |
This issue has gone three weeks without activity. In another week, I will close it. But! If you comment or otherwise update it, I will reset the clock, and if you remove the label "A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀 |
No description provided.