From 4369cdc0dda9f70f294d498a96f491daff8bb3ae Mon Sep 17 00:00:00 2001 From: rly Date: Thu, 11 Jul 2024 16:12:59 -0400 Subject: [PATCH] Apply black, ruff, isort --- docs/source/conf.py | 5 +++-- docs/source/conf_doc_autogen.py | 1 + src/pynwb/ndx_extracellular_channels/__init__.py | 3 ++- src/pynwb/ndx_extracellular_channels/io.py | 9 ++++++--- src/pynwb/tests/test_classes.py | 16 ++++++++-------- src/pynwb/tests/test_example_usage_all.py | 15 ++++++++------- .../tests/test_example_usage_probeinterface.py | 6 ++++-- src/spec/create_extension_spec.py | 9 +-------- 8 files changed, 33 insertions(+), 31 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index f190317..55b7755 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -45,9 +45,10 @@ # CUSTOM CONFIGURATIONS ADDED BY THE NWB TOOL FOR GENERATING FORMAT DOCS ########################################################################### -import sphinx_rtd_theme # noqa: E402 import textwrap # noqa: E402 +import sphinx_rtd_theme # noqa: E402 + # -- Options for intersphinx --------------------------------------------- intersphinx_mapping.update({ 'core': ('https://nwb-schema.readthedocs.io/en/latest/', None), @@ -61,8 +62,8 @@ def run_doc_autogen(_): # Execute the autogeneration of Sphinx format docs from the YAML sources - import sys import os + import sys conf_file_dir = os.path.dirname(os.path.abspath(__file__)) sys.path.append(conf_file_dir) # Need so that generate format docs can find the conf_doc_autogen file from conf_doc_autogen import spec_output_dir diff --git a/docs/source/conf_doc_autogen.py b/docs/source/conf_doc_autogen.py index d9edb08..f99869d 100644 --- a/docs/source/conf_doc_autogen.py +++ b/docs/source/conf_doc_autogen.py @@ -81,6 +81,7 @@ # Default type map to be used. This is the type map where dependent namespaces are stored. In the case of # NWB this is spec_default_type_map = pynwb.get_type_map() import pynwb # noqa: E402 + spec_default_type_map = pynwb.get_type_map() # Default specification classes for groups datasets and namespaces. In the case of NWB these are the NWB-specfic diff --git a/src/pynwb/ndx_extracellular_channels/__init__.py b/src/pynwb/ndx_extracellular_channels/__init__.py index d027f32..6b4c73c 100644 --- a/src/pynwb/ndx_extracellular_channels/__init__.py +++ b/src/pynwb/ndx_extracellular_channels/__init__.py @@ -1,5 +1,6 @@ import os -from pynwb import load_namespaces, get_class + +from pynwb import get_class, load_namespaces try: from importlib.resources import files diff --git a/src/pynwb/ndx_extracellular_channels/io.py b/src/pynwb/ndx_extracellular_channels/io.py index 6ee42b3..a4a2d64 100644 --- a/src/pynwb/ndx_extracellular_channels/io.py +++ b/src/pynwb/ndx_extracellular_channels/io.py @@ -1,8 +1,10 @@ from __future__ import annotations # postpone type hint evaluation + +import warnings +from typing import TYPE_CHECKING, List, Union + import ndx_extracellular_channels import numpy as np -from typing import Union, List, TYPE_CHECKING -import warnings if TYPE_CHECKING: import probeinterface @@ -83,7 +85,8 @@ def to_probeinterface(ndx_probe: ndx_extracellular_channels.Probe) -> probeinter probeinterface.Probe.device_channel_indices ndx_extracellular_channels.Probe.probe_model.contacts_table["shank_id"] -> probeinterface.Probe.shank_ids ndx_extracellular_channels.Probe.probe_model.contacts_table["plane_axes"] -> probeinterface.Probe.contact_plane_axes - ndx_extracellular_channels.Probe.probe_model.contacts_table["radius_in_um"] -> probeinterface.Probe.contact_shapes["radius"] + ndx_extracellular_channels.Probe.probe_model.contacts_table["radius_in_um"] -> + probeinterface.Probe.contact_shapes["radius"] Parameters diff --git a/src/pynwb/tests/test_classes.py b/src/pynwb/tests/test_classes.py index b44792b..6eb3c63 100644 --- a/src/pynwb/tests/test_classes.py +++ b/src/pynwb/tests/test_classes.py @@ -1,18 +1,18 @@ """Unit and integration tests for the ndx_extracellular_channels types.""" -from hdmf.common import DynamicTableRegion import numpy as np -from pynwb import NWBFile -from pynwb.testing import TestCase, NWBH5IOFlexMixin - +from hdmf.common import DynamicTableRegion from ndx_extracellular_channels import ( - ProbeInsertion, - ContactsTable, - ProbeModel, - Probe, ChannelsTable, + ContactsTable, ExtracellularSeries, + Probe, + ProbeInsertion, + ProbeModel, ) +from pynwb.testing import NWBH5IOFlexMixin, TestCase + +from pynwb import NWBFile class TestContactsTable(TestCase): diff --git a/src/pynwb/tests/test_example_usage_all.py b/src/pynwb/tests/test_example_usage_all.py index 026d2c5..ad3c087 100644 --- a/src/pynwb/tests/test_example_usage_all.py +++ b/src/pynwb/tests/test_example_usage_all.py @@ -1,18 +1,19 @@ import datetime -from hdmf.common import DynamicTableRegion -import numpy as np -from pynwb import NWBFile, NWBHDF5IO import uuid +import numpy as np +from hdmf.common import DynamicTableRegion from ndx_extracellular_channels import ( - ProbeInsertion, - ContactsTable, - ProbeModel, - Probe, ChannelsTable, + ContactsTable, ExtracellularSeries, + Probe, + ProbeInsertion, + ProbeModel, ) +from pynwb import NWBHDF5IO, NWBFile + def test_all_classes(): diff --git a/src/pynwb/tests/test_example_usage_probeinterface.py b/src/pynwb/tests/test_example_usage_probeinterface.py index e4b92d1..20b7321 100644 --- a/src/pynwb/tests/test_example_usage_probeinterface.py +++ b/src/pynwb/tests/test_example_usage_probeinterface.py @@ -1,10 +1,12 @@ import datetime +import uuid + import ndx_extracellular_channels import numpy as np import numpy.testing as npt import probeinterface + import pynwb -import uuid def test_from_probeinterface(): @@ -158,7 +160,7 @@ def test_from_probeinterface(): npt.assert_array_equal(nwbfile.devices["renamed_probe3"].probe_model.contacts_table["shape"].data[:], "circle") npt.assert_array_equal( nwbfile.devices["renamed_probe3"].probe_model.contacts_table["radius_in_um"].data[:], - probe3.to_numpy()["radius"] + probe3.to_numpy()["radius"], ) diff --git a/src/spec/create_extension_spec.py b/src/spec/create_extension_spec.py index aa51271..64700cd 100644 --- a/src/spec/create_extension_spec.py +++ b/src/spec/create_extension_spec.py @@ -1,14 +1,7 @@ # -*- coding: utf-8 -*- import os.path -from pynwb.spec import ( - NWBNamespaceBuilder, - export_spec, - NWBGroupSpec, - NWBAttributeSpec, - NWBDatasetSpec, - NWBLinkSpec, -) +from pynwb.spec import NWBAttributeSpec, NWBDatasetSpec, NWBGroupSpec, NWBLinkSpec, NWBNamespaceBuilder, export_spec def main():