Skip to content

chore: remove unused private functions#143

Open
KenyaOtsuka wants to merge 3 commits into
KamitaniLab:devfrom
KenyaOtsuka:chore/remove-unused-private-methods
Open

chore: remove unused private functions#143
KenyaOtsuka wants to merge 3 commits into
KamitaniLab:devfrom
KenyaOtsuka:chore/remove-unused-private-methods

Conversation

@KenyaOtsuka

Copy link
Copy Markdown

Summary

Remove private functions with no callers anywhere in the codebase.

Function File Notes
__get_xyz bdpy/mri/fmriprep.py No callers; unused dead code
__load_mri bdpy/mri/fmriprep.py No callers; unused dead code
DecodedFeatures.__init_db bdpy/dataform/features.py No callers; raises NotImplementedError
_apply_to_features bdpy/recon/torch/task/inversion.py No callers
_removesuffix bdpy/dl/torch/dataset.py No callers; unused str.removesuffix wrapper

fmriprep.__load_mri and fmriprep.__get_xyz were flagged as dead code to be removed separately in #138.

Checks

Environment: Python 3.11.15, Linux x86_64 (glibc 2.39), numpy 2.4.6, scipy 1.17.1, h5py 3.16.0, hdf5storage 0.2.2

  • uv run pytest: 135 passed, 1 pre-existing failure in tests/ml/test_learning.py (external dep fastl2lir, unrelated to this PR)
  • uv run ruff check: pre-existing errors only; no new errors introduced
  • uv run mypy bdpy: pre-existing errors only; no new errors introduced

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Removes multiple private/unreferenced helper functions across MRI, dataform, and torch-related modules to reduce dead code and simplify maintenance.

Changes:

  • Deleted unused private MRI helpers (__get_xyz, __load_mri) from bdpy/mri/fmriprep.py.
  • Deleted an unused dataset string helper (_removesuffix) and an unused feature helper (_apply_to_features).
  • Removed an unimplemented/unused DecodedFeatures.__init_db stub.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
bdpy/recon/torch/task/inversion.py Removes unused _apply_to_features helper (now leaves an unused Callable import).
bdpy/mri/fmriprep.py Removes unused private MRI-loading/xyz helper functions.
bdpy/dl/torch/dataset.py Removes unused _removesuffix compatibility wrapper.
bdpy/dataform/features.py Removes unused/unimplemented DecodedFeatures.__init_db stub.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -14,12 +14,6 @@
_FeatureType = Dict[str, torch.Tensor]
@KenyaOtsuka

Copy link
Copy Markdown
Author

@ganow @HirokiYasuda03

If any of these should be kept or removed gradually with a deprecation warning over a few releases rather than deleted outright, please let me know.

@KenyaOtsuka
KenyaOtsuka marked this pull request as ready for review July 21, 2026 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants