This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add type hints to
synapse.storage.databases.main.client_ips
#10972Add type hints to
synapse.storage.databases.main.client_ips
#10972Changes from 4 commits
80c73c2
cf20c86
744756d
b452f8b
7637353
519bb6b
0acd03f
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
<3
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.
client_ips
comes from the return ofget_last_client_ip_by_device
. I downgraded theDict
s toMapping
s to make mypy happy.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.
Why was mypy unhappy here, sorry---something to do with a
Dict
being mutable?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.
It's to do with the inner
JsonDict
not being the same asLastClientIpByDeviceEntry
:Argument 2 ... has incompatible type "Dict[Tuple[str, str], LastClientIpByDeviceEntry]"; expected "Dict[Tuple[str, str], Dict[str, Any]]" [arg-type]
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.
Note to self: last_seen was
int
, is now astr
?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.
Could you explain why this is safe? (Maybe I just need to chase the logic through next week?)
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 thought
data["last_seen"]
is still anint
?raw_data
used to be aDict[str, Union[str, int]]
, but is now aTypedDict
so these ought to already have the correct type.