Skip to content

Hackweek: Added Makefile entry to fetch schema; eliminate type errors - #1198

Merged
dbennett-sentry merged 9 commits into
wip/jsonschema-mypyfrom
dbennett/event-typing-1
Aug 4, 2020
Merged

Hackweek: Added Makefile entry to fetch schema; eliminate type errors#1198
dbennett-sentry merged 9 commits into
wip/jsonschema-mypyfrom
dbennett/event-typing-1

Conversation

@dbennett-sentry

Copy link
Copy Markdown
Contributor

No description provided.

@dbennett-sentry
dbennett-sentry requested a review from a team August 4, 2020 19:04

@fpacifici fpacifici left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool

Comment thread snuba/datasets/events_processor_base.py Outdated
# deprecated unwrapped event message == insert
action_type = ProcessorAction.INSERT
try:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

intentional ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope.

self.extract_custom(processed, event, metadata)

sdk = data.get("sdk", None) or {}
sdk = data.get("sdk", None) or {} # type: ignore

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was the issue here ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"sdk" does not exists on the data object.

@fpacifici fpacifici changed the title Added Makefile entry to fetch schema; eliminate type errors Hackweek: Added Makefile entry to fetch schema; eliminate type errors Aug 4, 2020
# Properties we get from the "data" dict, which is the actual event body.

received = _collapse_uint32(int(data["received"]))
received = _collapse_uint32(data["received"])

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The extra int here is probably a bug as int(None) fails, _collapse_uint32(None) returns None, and the subsequent code checks for None

EventData = JSONSchema["schema/event.schema.json"]


class Event(TypedDict):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this class is duplicate of InsertEvent below. We should have only one.

@dbennett-sentry
dbennett-sentry merged commit 0bfb660 into wip/jsonschema-mypy Aug 4, 2020
@dbennett-sentry
dbennett-sentry deleted the dbennett/event-typing-1 branch August 4, 2020 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants