fixed mypy types
CI Pipeline / Test (pull_request) Successful in 2m23s
CI Pipeline / Build and Publish (./Dockerfile.model, ${{ vars.docker_repo_url }}/${{ gitea.repository }}/model) (pull_request) Successful in 7m3s
CI Pipeline / Build and Publish (./Dockerfile.web_ui, ${{ vars.docker_repo_url }}/${{ gitea.repository }}/web_ui) (pull_request) Successful in 6m13s
CI Pipeline / Test (pull_request) Successful in 2m23s
CI Pipeline / Build and Publish (./Dockerfile.model, ${{ vars.docker_repo_url }}/${{ gitea.repository }}/model) (pull_request) Successful in 7m3s
CI Pipeline / Build and Publish (./Dockerfile.web_ui, ${{ vars.docker_repo_url }}/${{ gitea.repository }}/web_ui) (pull_request) Successful in 6m13s
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
from importlib import import_module
|
||||
from types import ModuleType
|
||||
|
||||
from torch.nn import Module
|
||||
|
||||
|
||||
def get_class(path: str) -> ModuleType:
|
||||
def get_class(path: str) -> Module:
|
||||
parts = path.split('.')
|
||||
module_path = '.'.join(parts[:-1])
|
||||
class_name = parts[-1]
|
||||
|
||||
@@ -5,8 +5,8 @@ from pathlib import Path
|
||||
|
||||
import torch
|
||||
from minio import Minio
|
||||
from src.models import VisualCommunicationModel
|
||||
|
||||
from model.src.models import VisualCommunicationModel
|
||||
from shared.data_store import get_model
|
||||
|
||||
from .get_model_name import get_model_name
|
||||
|
||||
+2
-2
@@ -13,11 +13,11 @@ from ignite.handlers.param_scheduler import create_lr_scheduler_with_warmup
|
||||
from ignite.handlers.tensorboard_logger import TensorboardLogger
|
||||
from ignite.handlers.tqdm_logger import ProgressBar
|
||||
from ignite.metrics import Average, Loss, RunningAverage
|
||||
from src.utils import VCDADataset, get_class
|
||||
from torch import nn
|
||||
from torch.optim.lr_scheduler import ExponentialLR
|
||||
from torch.utils.data import DataLoader
|
||||
|
||||
from model.src.utils import VCDADataset, get_class
|
||||
from shared.data_store import connect_minio
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ val_metrics = {
|
||||
}
|
||||
evaluator = create_supervised_evaluator(
|
||||
model=model,
|
||||
metrics=val_metrics,
|
||||
metrics=val_metrics, # type: ignore
|
||||
device=device,
|
||||
)
|
||||
ProgressBar(desc='Val', ncols=80).attach(evaluator)
|
||||
|
||||
@@ -11,7 +11,7 @@ from dotenv import load_dotenv
|
||||
from pymongo.collection import Collection
|
||||
|
||||
from shared.data_store import connect_minio, put
|
||||
from shared.database import VisualCommunication, connect
|
||||
from shared.database import VisualCommunication, connect_mongodb
|
||||
from shared.utils import check_env, setup_logging
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ if __name__ == '__main__':
|
||||
# connect to minIO
|
||||
minio_client = connect_minio()
|
||||
# connect to MongoDB
|
||||
collection, db, client = connect()
|
||||
collection, db, client = connect_mongodb()
|
||||
# list documents in mongoDB
|
||||
id_list = list_mongo_document_ids(collection)
|
||||
for doc_id in id_list:
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
"""Database module content."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from .classes.dataset import Dataset
|
||||
from .classes.exceptions import NoDocumentFoundException
|
||||
from .classes.visual_communication import VisualCommunication
|
||||
from .utils.connect import connect
|
||||
from .utils.connect_mongodb import connect_mongodb
|
||||
from .utils.count_documents import count_documents
|
||||
from .utils.get_visual_communication import get_visual_communication
|
||||
from .utils.list_names import list_names
|
||||
|
||||
@@ -20,10 +20,12 @@ def save_dataset(
|
||||
|
||||
if __name__ == '__main__':
|
||||
from dotenv import load_dotenv
|
||||
|
||||
load_dotenv('local.env')
|
||||
from shared.database import list_names, connect
|
||||
from shared.database import connect_mongodb, list_names
|
||||
|
||||
# connect to database
|
||||
collection, db, client = connect()
|
||||
collection, db, client = connect_mongodb()
|
||||
print(client.server_info())
|
||||
|
||||
name_list = list_names(collection=collection, only_with_annotation=True)
|
||||
|
||||
@@ -5,7 +5,7 @@ from pathlib import Path
|
||||
from dotenv import load_dotenv
|
||||
|
||||
from shared.data_store import connect_minio
|
||||
from shared.database import connect as connect_mongo
|
||||
from shared.database import connect_mongodb
|
||||
from shared.database.classes import VisualCommunication
|
||||
from shared.utils import check_env, setup_logging
|
||||
|
||||
@@ -21,7 +21,7 @@ if __name__ == '__main__':
|
||||
# connect to minIO
|
||||
minio_client = connect_minio()
|
||||
# connect to MongoDB
|
||||
collection, db, client = connect_mongo()
|
||||
collection, db, client = connect_mongodb()
|
||||
# get list of image paths
|
||||
test_dir = Path(__file__).parent
|
||||
img_dir = test_dir / 'imgs'
|
||||
|
||||
@@ -5,7 +5,7 @@ from pathlib import Path
|
||||
from dotenv import load_dotenv
|
||||
|
||||
from shared.data_store import connect_minio
|
||||
from shared.database import connect, get_visual_communication
|
||||
from shared.database import connect_mongodb, get_visual_communication
|
||||
from shared.utils import check_env, setup_logging
|
||||
|
||||
if __name__ == '__main__':
|
||||
@@ -20,7 +20,7 @@ if __name__ == '__main__':
|
||||
# connect to minIO
|
||||
minio_client = connect_minio()
|
||||
# connect to MongoDB
|
||||
collection, db, client = connect()
|
||||
collection, db, client = connect_mongodb()
|
||||
# get visual communication
|
||||
vis_com = get_visual_communication(collection)
|
||||
print(repr(vis_com))
|
||||
|
||||
@@ -6,7 +6,7 @@ from dotenv import load_dotenv
|
||||
from pymongo.errors import DuplicateKeyError
|
||||
|
||||
from shared.data_store import connect_minio
|
||||
from shared.database import connect as connect_mongo
|
||||
from shared.database import connect_mongodb
|
||||
from shared.database.classes import VisualCommunication
|
||||
from shared.utils import check_env, setup_logging
|
||||
|
||||
@@ -22,7 +22,7 @@ if __name__ == '__main__':
|
||||
# connect to minIO
|
||||
minio_client = connect_minio()
|
||||
# connect to MongoDB
|
||||
collection, db, client = connect_mongo()
|
||||
collection, db, client = connect_mongodb()
|
||||
# get list of image paths
|
||||
test_dir = Path(__file__).parent
|
||||
img_dir = test_dir / 'imgs'
|
||||
|
||||
@@ -6,8 +6,7 @@ from dotenv import load_dotenv
|
||||
from pymongo.errors import DuplicateKeyError
|
||||
|
||||
from shared.data_store import connect_minio
|
||||
from shared.database import VisualCommunication
|
||||
from shared.database import connect as connect_mongo
|
||||
from shared.database import VisualCommunication, connect_mongodb
|
||||
from shared.utils import check_env, setup_logging
|
||||
|
||||
if __name__ == '__main__':
|
||||
@@ -22,7 +21,7 @@ if __name__ == '__main__':
|
||||
# connect to minIO
|
||||
minio_client = connect_minio()
|
||||
# connect to MongoDB
|
||||
collection, db, client = connect_mongo()
|
||||
collection, db, client = connect_mongodb()
|
||||
# get list of image paths
|
||||
ext_img_dir = Path('/Volumes/BW-PSSD/Mixed Methods/')
|
||||
assert ext_img_dir.exists()
|
||||
|
||||
@@ -5,8 +5,7 @@ from pathlib import Path
|
||||
from dotenv import load_dotenv
|
||||
|
||||
from shared.data_store import connect_minio
|
||||
from shared.database import connect as connect_mongo
|
||||
from shared.database import upsert_prediction
|
||||
from shared.database import connect_mongodb, upsert_prediction
|
||||
from shared.database.classes import VisualCommunication
|
||||
from shared.utils import check_env, setup_logging
|
||||
|
||||
@@ -22,7 +21,7 @@ if __name__ == '__main__':
|
||||
# connect to minIO
|
||||
minio_client = connect_minio()
|
||||
# connect to MongoDB
|
||||
collection, db, client = connect_mongo()
|
||||
collection, db, client = connect_mongodb()
|
||||
# get list of image paths
|
||||
test_dir = Path(__file__).parent
|
||||
img_dir = test_dir / 'imgs'
|
||||
|
||||
@@ -5,8 +5,7 @@ from pathlib import Path
|
||||
|
||||
from dotenv import load_dotenv
|
||||
|
||||
from shared.database import connect
|
||||
from shared.database import count_documents
|
||||
from shared.database import connect_mongodb, count_documents
|
||||
|
||||
if __name__ == '__main__':
|
||||
# prepare env vars
|
||||
@@ -15,7 +14,7 @@ if __name__ == '__main__':
|
||||
load_dotenv(env_path)
|
||||
os.environ['MONGO_HOST'] = 'localhost'
|
||||
# connect to database
|
||||
collection, db, client = connect()
|
||||
collection, db, client = connect_mongodb()
|
||||
# get visual communication
|
||||
num_docs = count_documents(
|
||||
collection=collection,
|
||||
|
||||
@@ -5,8 +5,7 @@ from pathlib import Path
|
||||
|
||||
from dotenv import load_dotenv
|
||||
|
||||
from shared.database import connect
|
||||
from shared.database import count_documents
|
||||
from shared.database import connect_mongodb, count_documents
|
||||
|
||||
if __name__ == '__main__':
|
||||
# prepare env vars
|
||||
@@ -15,7 +14,7 @@ if __name__ == '__main__':
|
||||
load_dotenv(env_path)
|
||||
os.environ['MONGO_HOST'] = 'localhost'
|
||||
# connect to database
|
||||
collection, db, client = connect()
|
||||
collection, db, client = connect_mongodb()
|
||||
# get visual communication
|
||||
num_docs = count_documents(
|
||||
collection=collection,
|
||||
|
||||
+2
-2
@@ -5,7 +5,7 @@ from __future__ import annotations
|
||||
import os
|
||||
|
||||
from shared.data_store import connect_minio
|
||||
from shared.database import connect
|
||||
from shared.database import connect_mongodb
|
||||
from shared.utils import check_env, setup_logging
|
||||
|
||||
from .app import init_app
|
||||
@@ -17,7 +17,7 @@ check_env()
|
||||
setup_logging()
|
||||
|
||||
# connect to database
|
||||
collection, db, client = connect()
|
||||
collection, db, client = connect_mongodb()
|
||||
|
||||
# connect to minio
|
||||
minio_client = connect_minio()
|
||||
|
||||
Reference in New Issue
Block a user