Skip to content

Commit cb56f09

Browse files
committed
Run black
1 parent 41e1756 commit cb56f09

File tree

3 files changed

+30
-13
lines changed

3 files changed

+30
-13
lines changed

shepherd_utils/db.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,7 @@ async def save_logs(
239239
new_logs.reverse()
240240
existing_logs.extend(new_logs)
241241
await client.set(
242-
response_id,
243-
orjson.dumps(existing_logs),
244-
ex=settings.redis_ttl
242+
response_id, orjson.dumps(existing_logs), ex=settings.redis_ttl
245243
)
246244
await client.aclose()
247245
except Exception as e:

shepherd_utils/shared.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -314,9 +314,9 @@ def merge_kgraph(og_message, new_message, source, logger: logging.Logger):
314314
value["sources"],
315315
[
316316
{
317-
"resource_id": source,
318-
"resource_role": "aggregator_knowledge_source",
319-
"upstream_resource_ids": ["infores:retriever"]
317+
"resource_id": source,
318+
"resource_role": "aggregator_knowledge_source",
319+
"upstream_resource_ids": ["infores:retriever"],
320320
}
321321
],
322322
logger,

workers/merge_message/worker.py

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def add_knowledge_edge(target, result_message, aux_graph_ids, answer):
101101
{
102102
"resource_id": source,
103103
"resource_role": "primary_knowledge_source",
104-
"upstream_resource_ids": []
104+
"upstream_resource_ids": [],
105105
}
106106
],
107107
}
@@ -317,19 +317,38 @@ def merge_messages(
317317
result["message"]["knowledge_graph"] = pydantic_kgraph
318318
for result_message in [response, new_response]:
319319
if "auxiliary_graphs" in result_message["message"]:
320-
for aux_id, aux_dict in result_message["message"]["auxiliary_graphs"].items():
320+
for aux_id, aux_dict in result_message["message"][
321+
"auxiliary_graphs"
322+
].items():
321323
if aux_id in result["message"]["auxiliary_graphs"]:
322324
for key, val in aux_dict.items():
323325
if key in result["message"]["auxiliary_graphs"][aux_id]:
324-
if isinstance(result["message"]["auxiliary_graphs"][aux_id][key], list):
326+
if isinstance(
327+
result["message"]["auxiliary_graphs"][aux_id][key], list
328+
):
325329
# combine both lists and then list/set it for uniqueness
326-
result["message"]["auxiliary_graphs"][aux_id][key] = list(set(result["message"]["auxiliary_graphs"][aux_id][key] + val))
330+
result["message"]["auxiliary_graphs"][aux_id][key] = (
331+
list(
332+
set(
333+
result["message"]["auxiliary_graphs"][
334+
aux_id
335+
][key]
336+
+ val
337+
)
338+
)
339+
)
327340
else:
328-
logger.warning(f"Message had an invalid aux graph property: {key}")
341+
logger.warning(
342+
f"Message had an invalid aux graph property: {key}"
343+
)
329344
else:
330-
result["message"]["auxiliary_graphs"][aux_id][key] = copy.deepcopy(val)
345+
result["message"]["auxiliary_graphs"][aux_id][key] = (
346+
copy.deepcopy(val)
347+
)
331348
else:
332-
result["message"]["auxiliary_graphs"][aux_id] = copy.deepcopy(aux_dict)
349+
result["message"]["auxiliary_graphs"][aux_id] = copy.deepcopy(
350+
aux_dict
351+
)
333352
# The result with the direct lookup needs to be handled specially. It's the one with the lookup query graph
334353
lookup_results = [] # in case we don't have any
335354
lookup_results = (

0 commit comments

Comments
 (0)