Skip to content

Commit

Permalink
reorganize-function-placement
Browse files Browse the repository at this point in the history
  • Loading branch information
DamianCzajkowski committed Apr 10, 2024
1 parent bee71e8 commit 4f96aab
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions ariadne_graphql_proxy/query_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,26 +149,6 @@ def filter_operation_node(
),
)

def extract_variables(
self,
value: VariableNode | ListValueNode | ObjectValueNode,
context: QueryFilterContext,
):
if isinstance(value, VariableNode):
context.variables.add(value.name.value)
elif isinstance(value, ObjectValueNode):
for field in value.fields:
self.extract_variables(field.value, context) # type: ignore
elif isinstance(value, ListValueNode):
for item in value.values:
self.extract_variables(item, context) # type: ignore

def update_context_variables(
self, field_node: FieldNode, context: QueryFilterContext
):
for argument in field_node.arguments:
self.extract_variables(argument.value, context) # type: ignore

def filter_field_node(
self,
field_node: FieldNode,
Expand Down Expand Up @@ -408,3 +388,23 @@ def get_type_fields_dependencies(
return self.dependencies[schema_id][type_name]

return None

def update_context_variables(
self, field_node: FieldNode, context: QueryFilterContext
):
for argument in field_node.arguments:
self.extract_variables(argument.value, context) # type: ignore

def extract_variables(
self,
value: VariableNode | ListValueNode | ObjectValueNode,
context: QueryFilterContext,
):
if isinstance(value, VariableNode):
context.variables.add(value.name.value)
elif isinstance(value, ObjectValueNode):
for field in value.fields:
self.extract_variables(field.value, context) # type: ignore
elif isinstance(value, ListValueNode):
for item in value.values:
self.extract_variables(item, context) # type: ignore

0 comments on commit 4f96aab

Please sign in to comment.