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

added schema extension fixes #227

Merged
merged 1 commit into from
Oct 4, 2016

Conversation

mprager
Copy link

@mprager mprager commented Sep 30, 2016

added functionality to detect Marker type keys in schemas and replace them with updated markers or no markers at all. The extension functionality also checks for recursive subschema extensions and adds and alters only the necessary keys.

Appropriate tests were added as well.

@coveralls
Copy link

coveralls commented Sep 30, 2016

Coverage Status

Coverage decreased (-3.7%) to 91.164% when pulling 3064fbe on mprager:schema_extension_fix into 6308d04 on alecthomas:master.

@coveralls
Copy link

coveralls commented Sep 30, 2016

Coverage Status

Coverage decreased (-3.3%) to 91.494% when pulling c4e1d12 on mprager:schema_extension_fix into 6308d04 on alecthomas:master.

@coveralls
Copy link

coveralls commented Sep 30, 2016

Coverage Status

Coverage increased (+0.08%) to 94.917% when pulling e11c2c3 on mprager:schema_extension_fix into 6308d04 on alecthomas:master.

@mprager
Copy link
Author

mprager commented Sep 30, 2016

i usually just to develop in 2.7, didn't think about it, sorry about that.

Copy link
Collaborator

@tusharmakkar08 tusharmakkar08 left a comment

Choose a reason for hiding this comment

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

Hey @mprager

I have reviewed the PR. There are minor changes which are required before the merge. Please work on them and squash the commits.

Thanks

# build a map that takes the key literals to the needed objects
# literal -> Required|Optional|literal
result_key_map = dict()
for key in result:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use dict_comprehension here.

result_value = result[result_key]

# if both are dictionaries, we need to extend recursively
# create the new extended sub schema, then remote the old key and add the new one
Copy link
Collaborator

Choose a reason for hiding this comment

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

*remove

else:
result[key] = value

# recomplie and send old object
Copy link
Collaborator

Choose a reason for hiding this comment

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

*recompile

extension = {Required('a'): int}
extended = base.extend(extension)

assert len(base.schema) == 1
Copy link
Collaborator

Choose a reason for hiding this comment

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

Better use assert_equal instead of normal assert

@tusharmakkar08
Copy link
Collaborator

tusharmakkar08 commented Oct 4, 2016

Hey @mprager

Thanks for submitting PR which fixes #219 and #192 . I have added few review comments. Please have a look at them.

Regards
Tushar Makkar

@coveralls
Copy link

coveralls commented Oct 4, 2016

Coverage Status

Coverage increased (+0.07%) to 94.906% when pulling c60aa14 on mprager:schema_extension_fix into 6308d04 on alecthomas:master.

@tusharmakkar08
Copy link
Collaborator

Hey @mprager

Please squash in your commits. Let's get this merged into master then 🍰

Thanks

@coveralls
Copy link

coveralls commented Oct 4, 2016

Coverage Status

Coverage increased (+0.07%) to 94.906% when pulling 1998aaa on mprager:schema_extension_fix into 6308d04 on alecthomas:master.

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.

3 participants