Skip to content
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

Add marshaling between Dynamo and Python dictionaries #9296

Merged
merged 5 commits into from
Dec 10, 2018

Conversation

aparajit-pratap
Copy link
Contributor

@aparajit-pratap aparajit-pratap commented Dec 7, 2018

Purpose

Add Dynamo Dictionary <-> Python Dictionary marshaling support.
JIRA: https://jira.autodesk.com/browse/QNTM-2990

image

Declarations

Check these if you believe they are true

  • The code base is in a better state after this PR
  • Is documented according to the standards
  • The level of testing this PR includes is appropriate
  • User facing strings, if any, are extracted into *.resx files
  • All tests pass using the self-service CI.
  • Snapshot of UI changes, if any.
  • Changes to the API follow Semantic Versioning, and are documented in the API Changes document.

I've yet to add tests and run self-service - WIP

Reviewers

@alfarok
@mjkkirschner

dict.Cast<dynamic>().ToDictionary(x => Marshal(x.Key), x => Marshal(x.Value)));
{
// Dictionary<TKey, TValue> and IronPython.Runtime.PythonDictionary both implement IDictionary
return dict.Keys.Cast<object>().ToDictionary(key => Marshal(key), key => Marshal(dict[key]));
Copy link
Member

Choose a reason for hiding this comment

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

does this work nicely for nested dictionaries?

@mjkkirschner
Copy link
Member

mjkkirschner commented Dec 7, 2018

@aparajit-pratap looks good can we add some tests? Specifically I'm curious about nested dictionaries as values? missed your comment above.

@aparajit-pratap
Copy link
Contributor Author

@mjkkirschner seems to work for lists and nested dictionaries.

@alfarok
Copy link
Contributor

alfarok commented Dec 7, 2018

@aparajit-pratap Awesome LGTM! Let me know if you need any sample graphs for testing, these might be useful.

if (val.GetType().IsValueType)
{
Assert.AreEqual(val, thisData.ValueAtKey(strKey));
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added support to compare Dictionaries directly to test API: AssertValue

@mjkkirschner mjkkirschner added the LGTM Looks good to me label Dec 10, 2018
@mjkkirschner
Copy link
Member

LGTM

@aparajit-pratap aparajit-pratap merged commit f9dab2e into DynamoDS:master Dec 10, 2018
@aparajit-pratap aparajit-pratap deleted the pythonDict branch December 10, 2018 18:33
@aparajit-pratap aparajit-pratap mentioned this pull request Dec 11, 2018
7 tasks
@johnpierson johnpierson mentioned this pull request Dec 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LGTM Looks good to me
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants