11
11
GraphQLScalarType ,
12
12
is_input_type
13
13
)
14
- from ..utils .is_nullish import is_nullish
15
14
from ..utils .is_valid_value import is_valid_value
16
15
from ..utils .type_from_ast import type_from_ast
17
16
from ..utils .value_from_ast import value_from_ast
@@ -56,10 +55,10 @@ def get_argument_values(arg_defs, arg_asts, variables):
56
55
variables
57
56
)
58
57
59
- if is_nullish ( value ) :
58
+ if value is None :
60
59
value = arg_def .default_value
61
60
62
- if not is_nullish ( value ) :
61
+ if value is not None :
63
62
result [name ] = value
64
63
65
64
return result
@@ -81,14 +80,14 @@ def get_variable_value(schema, definition_ast, input):
81
80
)
82
81
83
82
if is_valid_value (type , input ):
84
- if is_nullish ( input ) :
83
+ if input is None :
85
84
default_value = definition_ast .default_value
86
85
if default_value :
87
86
return value_from_ast (default_value , type )
88
87
89
88
return coerce_value (type , input )
90
89
91
- if is_nullish ( input ) :
90
+ if input is None :
92
91
raise GraphQLError (
93
92
'Variable "${}" of required type "{}" was not provided.' .format (
94
93
variable .name .value ,
@@ -115,7 +114,7 @@ def coerce_value(type, value):
115
114
# We only call this function after calling isValidValue.
116
115
return coerce_value (type .of_type , value )
117
116
118
- if is_nullish ( value ) :
117
+ if value is None :
119
118
return None
120
119
121
120
if isinstance (type , GraphQLList ):
@@ -130,19 +129,15 @@ def coerce_value(type, value):
130
129
obj = {}
131
130
for field_name , field in fields .items ():
132
131
field_value = coerce_value (field .type , value [field_name ])
133
- if is_nullish ( field_value ) :
132
+ if field_value is None :
134
133
field_value = field .default_value
135
134
136
- if not is_nullish ( field_value ) :
135
+ if field_value is not None :
137
136
obj [field_name ] = field_value
138
137
139
138
return obj
140
139
141
140
assert isinstance (type , (GraphQLScalarType , GraphQLEnumType )), \
142
141
'Must be input type'
143
142
144
- parsed = type .parse_value (value )
145
- if not is_nullish (parsed ):
146
- return parsed
147
-
148
- return None
143
+ return type .parse_value (value )
0 commit comments