mirror of
https://github.com/graphql-python/graphene.git
synced 2024-11-25 11:03:58 +03:00
* Make UUID compatible * Fix typo * black code formatting
This commit is contained in:
parent
bcbb66c025
commit
d0cfee5641
|
@ -1,5 +1,5 @@
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
import six
|
||||||
from uuid import UUID as _UUID
|
from uuid import UUID as _UUID
|
||||||
|
|
||||||
from graphql.language import ast
|
from graphql.language import ast
|
||||||
|
@ -12,8 +12,9 @@ class UUID(Scalar):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def serialize(uuid):
|
def serialize(uuid):
|
||||||
if isinstance(uuid, str):
|
if isinstance(uuid, six.string_types):
|
||||||
uuid = _UUID(uuid)
|
uuid = _UUID(uuid)
|
||||||
|
|
||||||
assert isinstance(uuid, _UUID), "Expected UUID instance, received {}".format(
|
assert isinstance(uuid, _UUID), "Expected UUID instance, received {}".format(
|
||||||
uuid
|
uuid
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user