Skip to content

Commit

Permalink
Merge branch 'dev' into remove_3_8
Browse files Browse the repository at this point in the history
  • Loading branch information
CodyCBakerPhD authored Sep 6, 2024
2 parents 814907c + 68a0627 commit 9c0f83a
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 42 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
### Deprecation
* Support for Python 3.8 has been removed. [#508](https://github.com/NeurodataWithoutBorders/nwbinspector/issues/508)

### Deprecation (API)
* The `inspect_nwb` method has been removed. Please use `inspect_nwbfile` or `inspect_nwbfile_object` instead. [#505](https://github.com/NeurodataWithoutBorders/nwbinspector/pull/505)



# v0.5.2
Expand Down
4 changes: 2 additions & 2 deletions docs/user_guide/using_the_library.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Inspect a single NWBFile
------------------------

The most basic function to use when inspecting a single NWB file is the
:py:class:`~nwbinspector.nwbinspector.inspect_nwb` function.
:py:class:`~nwbinspector.nwbinspector.inspect_nwbfile` function.

.. code-block:: python
Expand Down Expand Up @@ -65,7 +65,7 @@ function.
all_results = list(inspect_all(path=file_paths_or_folder, ...))
This has the same return structure as :py:class:`~nwbinspector.nwbinspector.inspect_nwb`.
This has the same return structure as :py:class:`~nwbinspector.nwbinspector.inspect_nwbfile`.


.. note::
Expand Down
10 changes: 5 additions & 5 deletions docs/user_guide/using_the_library_advanced.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ This is a collection of tutorials illustrating some of the more advanced uses of
Yielding and Iterating
----------------------

Both the :py:class:`~nwbinspector.nwbinspector.inspect_all` and :py:class:`~nwbinspector.nwbinspector.inspect_nwb`
Both the :py:class:`~nwbinspector.nwbinspector.inspect_all` and :py:class:`~nwbinspector.nwbinspector.inspect_nwbfile`
functions return generators. That is, they do not actually run any checks on any NWBFile until the user
performs an iteration command on them. The simplest way of doing this is to cast the generator as a ``list``,
*i.e.*, ``list(inspect_nwb(...))`` which will automatically complete all checks.
*i.e.*, ``list(inspect_nwbfile(...))`` which will automatically complete all checks.

However, if a user chooses, they can harness these generators in more sophisticated ways. If you want to stop the
checks early, the following will run the inspectors until the first
:py:class:`~nwbinspector.register_checks.InspectorMessage` is returned:

.. code-block:: python
results_generator = inspect_nwb(nwbfile_path="path_to_single_nwbfile")
results_generator = inspect_nwbfile(nwbfile_path="path_to_single_nwbfile")
first_message = next(results_generator)
Expand All @@ -27,7 +27,7 @@ This will return either the first :py:class:`~nwbinspector.register_checks.Inspe

.. code-block:: python
results_generator = inspect_nwb(nwbfile_path="path_to_single_nwbfile")
results_generator = inspect_nwbfile(nwbfile_path="path_to_single_nwbfile")
try:
first_message = next(results_generator)
Expand All @@ -38,7 +38,7 @@ Of course, the generator can be treated like any other iterable as well, such as

.. code-block:: python
results_generator = inspect_nwb(nwbfile_path="path_to_single_nwbfile")
results_generator = inspect_nwbfile(nwbfile_path="path_to_single_nwbfile")
for message in results_generator:
print(message)
Expand Down
2 changes: 0 additions & 2 deletions src/nwbinspector/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
inspect_nwbfile_object,
run_checks,
)
from ._nwb_inspection import inspect_nwb # TODO: remove after 7/1/2023
from ._formatting import (
format_messages,
print_to_console,
Expand Down Expand Up @@ -40,7 +39,6 @@
"inspect_all",
"inspect_nwbfile",
"inspect_nwbfile_object",
"inspect_nwb", # TODO: remove after 7/1/2023
"run_checks",
"format_messages",
"print_to_console",
Expand Down
32 changes: 0 additions & 32 deletions src/nwbinspector/_nwb_inspection.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,38 +205,6 @@ def _pickle_inspect_nwb(
return list(inspect_nwbfile(nwbfile_path=nwbfile_path, checks=checks, skip_validate=skip_validate))


# TODO: remove after 7/1/2023
def inspect_nwb(
nwbfile_path: FilePathType,
checks: list = available_checks,
config: dict = None,
ignore: OptionalListOfStrings = None,
select: OptionalListOfStrings = None,
importance_threshold: Union[str, Importance] = Importance.BEST_PRACTICE_SUGGESTION,
driver: Optional[str] = None,
skip_validate: bool = False,
max_retries: int = 10,
) -> Iterable[InspectorMessage]:
warn(
"The API function 'inspect_nwb' has been deprecated and will be removed in a future release! "
"To remove ambiguity, please call either "
"'inspect_nwbfile' giving a path to the unopened file on a system, or "
"'inspect_nwbfile_object' passing an already open pynwb.NWBFile object.",
category=DeprecationWarning,
stacklevel=2,
)
for inspector_message in inspect_nwbfile(
nwbfile_path=nwbfile_path,
checks=checks,
config=config,
ignore=ignore,
select=select,
importance_threshold=importance_threshold,
skip_validate=skip_validate,
):
yield inspector_message


def inspect_nwbfile(
nwbfile_path: FilePathType,
driver: Optional[str] = None, # TODO: remove after 3/1/2025
Expand Down
1 change: 0 additions & 1 deletion src/nwbinspector/nwbinspector/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
)
from .._nwb_inspection import (
inspect_all,
inspect_nwb, # TODO: remove
inspect_nwbfile,
inspect_nwbfile_object,
run_checks,
Expand Down

0 comments on commit 9c0f83a

Please sign in to comment.