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

Attr support #26

Closed
wants to merge 3 commits into from
Closed

Attr support #26

wants to merge 3 commits into from

Conversation

yunstanford
Copy link
Contributor

i removed the json_schema part as we are going to use your new lib.

yunstanford and others added 2 commits June 16, 2017 22:21
@coveralls
Copy link

coveralls commented Jun 20, 2017

Coverage Status

Coverage decreased (-0.003%) to 90.582% when pulling 270a94a on yunstanford:attr_support into 416fed9 on toumorokoshi:master.

@yunstanford
Copy link
Contributor Author

I think i need to think up a edge case which can break cattrs.unstructure. :)

Copy link
Owner

@toumorokoshi toumorokoshi left a comment

Choose a reason for hiding this comment

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

Nice! If you could address a couple comments, that would be great.

We will probably have to wait until cattrs releases a compatible version, before merging this PR.

ubuild.py Outdated
# api has also been changed in master branch,
# let's install master branch
ROOT = os.path.dirname(sys.executable)
CATTR_MASTER_BRANCH = "https://github.com/Tinche/cattrs/tarball/master"
Copy link
Owner

Choose a reason for hiding this comment

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

"""
try:
res = structure(value, model)
except Exception as e:
Copy link
Owner

Choose a reason for hiding this comment

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

the specific exception should be caught here. a generic try/catch could catch other issues unrelated to the destructuring of the object.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

make senses.

basic types and attrs classes.
"""

def __init__(self):
Copy link
Owner

Choose a reason for hiding this comment

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

you don't need to add this method if it's a no-op.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i will remove

return res


# Help Functions
Copy link
Owner

Choose a reason for hiding this comment

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

can we remove this comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure.

from .interface import ObjectSerializer
from cattr import structure, unstructure
from ..exceptions import SerializationException
from cattr.vendor.typing import (
Copy link
Owner

Choose a reason for hiding this comment

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

are any of these imports used?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

haha, it has been used for to_json_schema method before, but i have removed that part.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i will clean those up

@coveralls
Copy link

Coverage Status

Coverage increased (+0.2%) to 90.808% when pulling d64cc85 on yunstanford:attr_support into 416fed9 on toumorokoshi:master.

@toumorokoshi
Copy link
Owner

Looks good, thanks! I don't want to merge it in while it relies on a cattrs library that's unavailable yet, so I'm putting in the attrs_support branch for now.

@toumorokoshi
Copy link
Owner

I've merged this code in manually. Thanks!

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.

None yet

3 participants