Skip to content

Commit

Permalink
fix: mistakes caught by Pyright
Browse files Browse the repository at this point in the history
Signed-off-by: Alexis Asseman <alexis@semiotic.ai>
  • Loading branch information
aasseman committed Nov 4, 2022
1 parent 1ef57d0 commit c9cb752
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions autoagora_processor/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,11 @@ def normalize_query(
logging.debug("Query before normalization: %s", query)

if isinstance(variables, (str, bytes)):
variables = json.loads(variables)
variables_map = json.loads(variables)
elif isinstance(variables, Mapping):
variables_map = variables
else:
raise RuntimeError

outputs = []
query_ast = parse(query)
Expand All @@ -159,7 +163,7 @@ def normalize_query(

for root_query in extract_root_queries(query_ast):
# Merge variable values
variables_merged = {**default_values, **variables}
variables_merged = {**default_values, **variables_map}

root_query, removed_variables = remove_values(
root_query, existing_variables=variables_merged
Expand Down Expand Up @@ -192,6 +196,7 @@ def parse_gql_logline(logline: str):

# Normalize query
schema = subgraph_schemas[subgraph]
assert schema is not None

normalized_queries = normalize_query(query, query_variables, schema)
return [
Expand Down

0 comments on commit c9cb752

Please sign in to comment.