Skip to content

Commit 6201d0b

Browse files
committed
Use new dict merge syntax
1 parent a642c59 commit 6201d0b

File tree

6 files changed

+8
-8
lines changed

6 files changed

+8
-8
lines changed

src/graphql/pyutils/merge_kwargs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99

1010
def merge_kwargs(base_dict: T, **kwargs: Any) -> T:
1111
"""Return arbitrary typed dictionary with some keyword args merged in."""
12-
return cast("T", {**cast("dict", base_dict), **kwargs})
12+
return cast("T", cast("dict", base_dict) | kwargs)

src/graphql/type/introspection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -702,4 +702,4 @@ def is_introspection_type(type_: GraphQLNamedType) -> bool:
702702

703703

704704
# register the introspection types to avoid redefinition
705-
GraphQLNamedType.reserved_types.update(introspection_types) # type: ignore
705+
GraphQLNamedType.reserved_types |= introspection_types # type: ignore

src/graphql/type/scalars.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,4 +322,4 @@ def is_specified_scalar_type(type_: GraphQLNamedType) -> TypeGuard[GraphQLScalar
322322

323323

324324
# register the scalar types to avoid redefinition
325-
GraphQLNamedType.reserved_types.update(specified_scalar_types) # type: ignore
325+
GraphQLNamedType.reserved_types |= specified_scalar_types # type: ignore

src/graphql/utilities/extend_schema.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,9 +245,9 @@ def extend_schema_args(
245245
operation_types[operation_type] = self.replace_named_type(original_type)
246246
# Then, incorporate schema definition and all schema extensions.
247247
if schema_def:
248-
operation_types.update(self.get_operation_types([schema_def]))
248+
operation_types |= self.get_operation_types([schema_def])
249249
if schema_extensions:
250-
operation_types.update(self.get_operation_types(schema_extensions))
250+
operation_types |= self.get_operation_types(schema_extensions)
251251

252252
# Then produce and return the kwargs for a Schema with these types.
253253
get_operation = operation_types.get
@@ -372,7 +372,7 @@ def extend_enum_type(self, type_: GraphQLEnumType) -> GraphQLEnumType:
372372
return GraphQLEnumType(
373373
**merge_kwargs(
374374
kwargs,
375-
values={**kwargs["values"], **self.build_enum_value_map(extensions)},
375+
values=kwargs["values"] | self.build_enum_value_map(extensions),
376376
extension_ast_nodes=kwargs["extension_ast_nodes"] + extensions,
377377
)
378378
)

tests/execution/test_defer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ async def complete(
195195

196196

197197
def modified_args(args: dict[str, Any], **modifications: Any) -> dict[str, Any]:
198-
return {**args, **modifications}
198+
return args | modifications
199199

200200

201201
def describe_execute_defer_directive():

tests/execution/test_stream.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ async def locked_next():
145145

146146

147147
def modified_args(args: dict[str, Any], **modifications: Any) -> dict[str, Any]:
148-
return {**args, **modifications}
148+
return args | modifications
149149

150150

151151
def describe_execute_stream_directive():

0 commit comments

Comments
 (0)