From 917704ef54c3b36e8f25705ba86db5cdcf54f479 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 29 Jan 2024 10:55:46 -0800 Subject: [PATCH] [pre-commit.ci] pre-commit autoupdate (#574) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- prepare_pyinstaller_spec.py | 7 ++++--- pyflask/apis/neuroconv.py | 1 + pyflask/apis/startup.py | 1 + pyflask/app.py | 1 + pyflask/manageNeuroconv/manage_neuroconv.py | 13 +++++++------ 6 files changed, 15 insertions(+), 10 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c2883c251..7daf0f0b6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,7 +6,7 @@ repos: - id: end-of-file-fixer - id: trailing-whitespace - repo: https://github.com/psf/black - rev: 23.12.1 + rev: 24.1.1 hooks: - id: black exclude: ^docs/ diff --git a/prepare_pyinstaller_spec.py b/prepare_pyinstaller_spec.py index c9eb7a392..497ae93f4 100644 --- a/prepare_pyinstaller_spec.py +++ b/prepare_pyinstaller_spec.py @@ -3,6 +3,7 @@ This script is run automatically as a part of `npm run build:flask:spec` after the `pyi-makespec` call. """ + from pathlib import Path with open(file=Path(__file__).parent / "nwb-guide.spec", mode="r") as io: @@ -19,9 +20,9 @@ hiddenImportIdx = lines.index("hiddenimports = []\n") -lines[ - hiddenImportIdx -] = "hiddenimports = [ 'email_validator', *collect_submodules('scipy.special.cython_special'), *os.path.join(os.path.dirname(scipy.__file__), '.libs')]\n\n" +lines[hiddenImportIdx] = ( + "hiddenimports = [ 'email_validator', *collect_submodules('scipy.special.cython_special'), *os.path.join(os.path.dirname(scipy.__file__), '.libs')]\n\n" +) # Originally this was a separate `npm` command per platform to account for CLI syntax differences between ; and : diff --git a/pyflask/apis/neuroconv.py b/pyflask/apis/neuroconv.py index f93737372..00bf11e00 100644 --- a/pyflask/apis/neuroconv.py +++ b/pyflask/apis/neuroconv.py @@ -1,4 +1,5 @@ """API endpoint definitions for interacting with NeuroConv.""" + import traceback from flask_restx import Namespace, Resource, reqparse diff --git a/pyflask/apis/startup.py b/pyflask/apis/startup.py index d72ae3cdc..feb59d871 100644 --- a/pyflask/apis/startup.py +++ b/pyflask/apis/startup.py @@ -1,4 +1,5 @@ """API endpoint definitions for startup operations.""" + from flask_restx import Namespace, Resource from errorHandlers import notBadRequestException diff --git a/pyflask/app.py b/pyflask/app.py index 593509508..4b851d47e 100644 --- a/pyflask/app.py +++ b/pyflask/app.py @@ -1,4 +1,5 @@ """The primary Flask server for the Python backend.""" + import sys import json import multiprocessing diff --git a/pyflask/manageNeuroconv/manage_neuroconv.py b/pyflask/manageNeuroconv/manage_neuroconv.py index 21fceb3aa..e6d2fabc9 100644 --- a/pyflask/manageNeuroconv/manage_neuroconv.py +++ b/pyflask/manageNeuroconv/manage_neuroconv.py @@ -1,4 +1,5 @@ """Collection of utility functions used by the NeuroConv Flask API.""" + import os import json import math @@ -85,9 +86,7 @@ def coerce_schema_compliance_recursive(obj, schema): elif key in schema.get("properties", {}): prop_schema = schema["properties"][key] if prop_schema.get("type") == "number" and (value is None or value == "NaN"): - obj[ - key - ] = ( + obj[key] = ( math.nan ) # Turn None into NaN if a number is expected (JavaScript JSON.stringify turns NaN into None) elif prop_schema.get("type") == "number" and isinstance(value, int): @@ -433,9 +432,11 @@ def update_conversion_progress(**kwargs): available_options = converter.get_conversion_options_schema() options = ( { - interface: {"stub_test": info["stub_test"]} # , "iter_opts": {"report_hook": update_conversion_progress}} - if available_options.get("properties").get(interface).get("properties", {}).get("stub_test") - else {} + interface: ( + {"stub_test": info["stub_test"]} # , "iter_opts": {"report_hook": update_conversion_progress}} + if available_options.get("properties").get(interface).get("properties", {}).get("stub_test") + else {} + ) for interface in info["source_data"] } if run_stub_test