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.
Improved push typing #11409
Improved push typing #11409
Changes from 4 commits
56b921e
e9991bf
fb1fbc1
08f12e4
d404a4c
073bdb8
ec27056
6f8c5d5
c8387bd
388803d
2904f49
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.
The
total=False
isn't great in my opinion, but it's currently necessary as many code path iteratively construct these dicts. Maybe reworking that could be done as a next step?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.
Can we keep them as normal dicts while we're building them, and then cast? Or just use local variables and then build it at the end? e.g.:
Not sure if that works
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.
That would require changing how these functions iteratively build the struct, while i think that's a good idea in general, i don't know how possible that is, certainly as i remember some of them building these up across multiple functions, passing intermediate results.
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.
Yup, I also believe that's the case. I'll take another look and see if I can resolve at least some easy cases here.
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 looked again and with the current code structure doing anything like this doesn't really make sense as for the reasons @ShadowJonathan mentioned.
The thing we could do is creating None value fields instead of structures with missing fields (so adding a bunch of Optionals instead of
total=False
). I currently have no opinion if this is better or worse.Anything else would require more restructuring of the code, which I think is better done seperately?
Edit: another idea would be segmenting these types into more granular ones like "EmailReason" and EmailReasonWithRoomName. I'm not convinced by this either. really.
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.
Thanks for looking into it. I think restructuring this may be the right answer eventually but you're right that it's not for here and now.