From 617e1f8aab5af33bb348e14d18e4e1c8c800896f Mon Sep 17 00:00:00 2001 From: Cody Baker Date: Wed, 5 Jun 2024 13:29:33 -0400 Subject: [PATCH 1/2] rebase watermark --- src/pyflask/manageNeuroconv/manage_neuroconv.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/pyflask/manageNeuroconv/manage_neuroconv.py b/src/pyflask/manageNeuroconv/manage_neuroconv.py index 2d7825411..97d49abe1 100644 --- a/src/pyflask/manageNeuroconv/manage_neuroconv.py +++ b/src/pyflask/manageNeuroconv/manage_neuroconv.py @@ -15,7 +15,7 @@ from tqdm_publisher import TQDMProgressHandler -from .info import CONVERSION_SAVE_FOLDER_PATH, GUIDE_ROOT_FOLDER, STUB_SAVE_FOLDER_PATH +from .info import CONVERSION_SAVE_FOLDER_PATH, GUIDE_ROOT_FOLDER, STUB_SAVE_FOLDER_PATH, is_packaged, resource_path from .info.sse import format_sse progress_handler = TQDMProgressHandler() @@ -870,8 +870,9 @@ def create_file( info: dict, log_url: Optional[str] = None, ) -> dict: - import requests + + import neuroconv from tqdm_publisher import TQDMProgressSubscriber project_name = info.get("project_name") @@ -934,6 +935,14 @@ def update_conversion_progress(message): progress_bar_options=progress_bar_options, ) + # Add GUIDE watermark + package_json_file_path = resource_path("../package.json" if is_packaged() else "../package.json") + with open(file=package_json_file_path) as fp: + package_json = json.load(fp=fp) + app_version = package_json["version"] + metadata["NWBFile"]["source_script"] = f"Created using NWB GUIDE v{app_version}" + metadata["NWBFile"]["source_script_file_name"] = neuroconv.__file__ # Must be included to be valid + run_conversion_kwargs = dict( metadata=metadata, nwbfile_path=nwbfile_path, From 21aa3d00d7c2edcf94c6235b6be927b4f870f4ae Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 5 Jun 2024 17:30:28 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/pyflask/manageNeuroconv/manage_neuroconv.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/pyflask/manageNeuroconv/manage_neuroconv.py b/src/pyflask/manageNeuroconv/manage_neuroconv.py index 97d49abe1..a65185f5c 100644 --- a/src/pyflask/manageNeuroconv/manage_neuroconv.py +++ b/src/pyflask/manageNeuroconv/manage_neuroconv.py @@ -15,7 +15,13 @@ from tqdm_publisher import TQDMProgressHandler -from .info import CONVERSION_SAVE_FOLDER_PATH, GUIDE_ROOT_FOLDER, STUB_SAVE_FOLDER_PATH, is_packaged, resource_path +from .info import ( + CONVERSION_SAVE_FOLDER_PATH, + GUIDE_ROOT_FOLDER, + STUB_SAVE_FOLDER_PATH, + is_packaged, + resource_path, +) from .info.sse import format_sse progress_handler = TQDMProgressHandler() @@ -870,9 +876,8 @@ def create_file( info: dict, log_url: Optional[str] = None, ) -> dict: - import requests - import neuroconv + import requests from tqdm_publisher import TQDMProgressSubscriber project_name = info.get("project_name")