1111 GraphQLScalarType ,
1212 is_input_type
1313)
14- from ..utils .is_nullish import is_nullish
1514from ..utils .is_valid_value import is_valid_value
1615from ..utils .type_from_ast import type_from_ast
1716from ..utils .value_from_ast import value_from_ast
@@ -56,10 +55,10 @@ def get_argument_values(arg_defs, arg_asts, variables):
5655 variables
5756 )
5857
59- if is_nullish ( value ) :
58+ if value is None :
6059 value = arg_def .default_value
6160
62- if not is_nullish ( value ) :
61+ if value is not None :
6362 result [name ] = value
6463
6564 return result
@@ -81,14 +80,14 @@ def get_variable_value(schema, definition_ast, input):
8180 )
8281
8382 if is_valid_value (type , input ):
84- if is_nullish ( input ) :
83+ if input is None :
8584 default_value = definition_ast .default_value
8685 if default_value :
8786 return value_from_ast (default_value , type )
8887
8988 return coerce_value (type , input )
9089
91- if is_nullish ( input ) :
90+ if input is None :
9291 raise GraphQLError (
9392 'Variable "${}" of required type "{}" was not provided.' .format (
9493 variable .name .value ,
@@ -115,7 +114,7 @@ def coerce_value(type, value):
115114 # We only call this function after calling isValidValue.
116115 return coerce_value (type .of_type , value )
117116
118- if is_nullish ( value ) :
117+ if value is None :
119118 return None
120119
121120 if isinstance (type , GraphQLList ):
@@ -130,19 +129,15 @@ def coerce_value(type, value):
130129 obj = {}
131130 for field_name , field in fields .items ():
132131 field_value = coerce_value (field .type , value [field_name ])
133- if is_nullish ( field_value ) :
132+ if field_value is None :
134133 field_value = field .default_value
135134
136- if not is_nullish ( field_value ) :
135+ if field_value is not None :
137136 obj [field_name ] = field_value
138137
139138 return obj
140139
141140 assert isinstance (type , (GraphQLScalarType , GraphQLEnumType )), \
142141 'Must be input type'
143142
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