-
-
Notifications
You must be signed in to change notification settings - Fork 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
Use DictTuple(tuple)
for Dataset.assets
and SyftClient.datasets
instead of TupleDict(OrderedDict)
#8164
Conversation
2b34c9e
to
61003b6
Compare
@kiendang interesting. Lets discuss in the Eng channel in slack. |
8bab166
to
ce69f4c
Compare
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
538be69
to
c9f8d7d
Compare
bd3c9cb
to
06c2a0a
Compare
@kiendang great work, I had a play and found a possible bug. It seems if the keys are ints and non 0 sequential it freaks out on casting to a dict. |
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.
Great work. The feel of using this is nice when indexing with both string or int keys.
Its a little complex to understand at first read and this kind of code often can hide bugs because its so complicated but the tests definitely help. Can you fix the non zero sequential int keys issue I found and then I think we can merge it. 🙌
@madhavajay Yah keys should not be You would encounter similar error with the current p = TupleDict({1: "z", 2: "b"})
p[2]
File "/Users/kien/pysyft/packages/syft/src/syft/types/tupledict.py", line 14, in __getitem__
return list(self.values())[key]
~~~~~~~~~~~~~~~~~~~^^^^^
IndexError: list index out of range
I have a more comprehensive test suite for this but is currently blocked by #8188 (without #8188 it is very slow). Will push that once it is resolved. |
bbee1bb
to
573a6f9
Compare
so that for x = DictTuple() the static type checker correctly types x as DictTuple instead of Any
so that when printing it shows DictTuple(1, 3) instead of (1, 3)
pattern matching is only available starting with Python 3.10
6fdab63
to
a88c9c7
Compare
Description
Please include a summary of the change, the motivation, and any additional context that will help others understand your PR. If it closes one or more open issues, please tag them as described here.
Affected Dependencies
List any dependencies that are required for this change.
How has this been tested?
Checklist