Skip to content

Commit

Permalink
make write_network_to_db return net metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
jthurner committed Feb 12, 2024
1 parent d6ceeac commit 28be19c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pandahub/lib/PandaHub.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import importlib
import json
import logging
import pymongo
import traceback
import warnings
from inspect import signature, _empty
Expand Down Expand Up @@ -385,7 +386,7 @@ def _get_project_document(self, filter_dict: dict) -> Optional[dict]:
else:
return project_doc

def _get_project_database(self):
def _get_project_database(self) -> pymongo.mongo_client:
return self.mongo_client[str(self.active_project["_id"])]

def _get_global_database(self):
Expand Down Expand Up @@ -1068,6 +1069,7 @@ def write_network_to_db(
if metadata is not None:
net_dict.update(metadata)
db["_networks"].insert_one(net_dict)
return net_dict

def _write_net_collections_to_db(self, db, collections):
for element, element_data in collections.items():
Expand Down Expand Up @@ -1725,6 +1727,7 @@ def get_variant_filter(self, variants):
"$or": [
{"var_type": "base", "not_in_var": {"$nin": variants}},
{
# redundant?
"var_type": {"$in": ["change", "addition"]},
"variant": {"$in": variants},
},
Expand All @@ -1737,6 +1740,7 @@ def get_variant_filter(self, variants):
return {
"$or": [
{"var_type": "base", "not_in_var": {"$ne": variants}},
# var type redundant
{"var_type": {"$in": ["change", "addition"]}, "variant": variants},
]
}
Expand Down

0 comments on commit 28be19c

Please sign in to comment.