diff --git a/src/nwbinspector/__init__.py b/src/nwbinspector/__init__.py index b5c14b22d..682725704 100644 --- a/src/nwbinspector/__init__.py +++ b/src/nwbinspector/__init__.py @@ -1,7 +1,7 @@ from ._version import __version__ from ._registration import available_checks, register_check from ._types import Importance, Severity, InspectorMessage -from ._configuration import load_config, InspectorOutputJSONEncoder, validate_config, configure_checks +from ._configuration import load_config, validate_config, configure_checks from ._inspection import ( inspect_all, inspect_nwbfile, @@ -9,7 +9,14 @@ run_checks, ) from ._inspection import inspect_nwb # TODO: remove after 7/1/2023 -from ._formatting import format_messages, print_to_console, save_report, MessageFormatter, FormatterOptions +from ._formatting import ( + format_messages, + print_to_console, + save_report, + MessageFormatter, + FormatterOptions, + InspectorOutputJSONEncoder, +) from ._organization import organize_messages from .checks import * diff --git a/src/nwbinspector/_configuration.py b/src/nwbinspector/_configuration.py index 399cb0d7a..17daeca2e 100644 --- a/src/nwbinspector/_configuration.py +++ b/src/nwbinspector/_configuration.py @@ -19,20 +19,6 @@ INTERNAL_CONFIGS = dict(dandi=Path(__file__).parent / "internal_configs" / "dandi.inspector_config.yaml") -class InspectorOutputJSONEncoder(json.JSONEncoder): - """Custom JSONEncoder for the NWBInspector.""" - - def default(self, o): # noqa D102 - if isinstance(o, InspectorMessage): - return o.__dict__ - if isinstance(o, Enum): - return o.name - if isinstance(o, Version): - return str(o) - else: - return super().default(o) - - def validate_config(config: dict): """Validate an instance of configuration against the official schema.""" with open(file=Path(__file__).parent / "config.schema.json", mode="r") as fp: diff --git a/src/nwbinspector/_formatting.py b/src/nwbinspector/_formatting.py index 1564c4bbe..d7ef85928 100644 --- a/src/nwbinspector/_formatting.py +++ b/src/nwbinspector/_formatting.py @@ -16,6 +16,20 @@ from .utils import get_package_version, FilePathType +class InspectorOutputJSONEncoder(json.JSONEncoder): + """Custom JSONEncoder for the NWBInspector.""" + + def default(self, o): # noqa D102 + if isinstance(o, InspectorMessage): + return o.__dict__ + if isinstance(o, Enum): + return o.name + if isinstance(o, Version): + return str(o) + else: + return super().default(o) + + def _get_report_header(): """Grab basic information from system at time of report generation.""" return dict(