Skip to content
This repository was archived by the owner on Feb 6, 2025. It is now read-only.

Commit 9e7be5a

Browse files
Refactor renamings to type_renamings (#981)
1 parent eec75c0 commit 9e7be5a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

graphql_compiler/schema_transformation/rename_query.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,18 +77,18 @@ def rename_query(
7777

7878

7979
class RenameQueryVisitor(Visitor):
80-
def __init__(self, renamings: Dict[str, str]) -> None:
80+
def __init__(self, type_renamings: Dict[str, str]) -> None:
8181
"""Create a visitor for renaming types and root vertex fields in a query AST.
8282
8383
Args:
84-
renamings: Maps type or root field names to the new value in the dict.
85-
Any name not in the dict will be unchanged
84+
type_renamings: Maps type or root field names to the new value in the dict.
85+
Any name not in the dict will be unchanged
8686
"""
87-
self.renamings = renamings
87+
self.type_renamings = type_renamings
8888
self.selection_set_level = 0
8989

9090
def _rename_name(self, node: RenameQueryNodeTypesT) -> RenameQueryNodeTypesT:
91-
"""Change the name of the input node if necessary, according to renamings.
91+
"""Change the name of the input node if necessary, according to type_renamings.
9292
9393
Args:
9494
node: represents a field in an AST, containing a .name attribute. It is not modified
@@ -98,7 +98,7 @@ def _rename_name(self, node: RenameQueryNodeTypesT) -> RenameQueryNodeTypesT:
9898
the name was not changed, the returned object is the exact same object as the input
9999
"""
100100
name_string = node.name.value
101-
new_name_string = self.renamings.get(name_string, name_string) # Default use original
101+
new_name_string = self.type_renamings.get(name_string, name_string) # Default use original
102102
if new_name_string == name_string:
103103
return node
104104
else:

0 commit comments

Comments
 (0)