Cleanup from self-review: redundant abspath, missing DeprecationWarning, logger inconsistency, eager __eq__ - #198
Merged
Merged
Conversation
Four small improvements surfaced by an honest re-read of the past week's work: - _normalize_models_path: drop redundant os.path.abspath() — realpath() already returns an absolute path, so the extra call was dead code. - predict_peptides_dataframe: add DeprecationWarning. The method's docstring has said "Deprecated" for a while; this gives callers a runtime signal to migrate to predict_dataframe(). - mhcflurry.py: use the module-level `logger` (already defined at line 25) instead of the root `logging` module for the two "Loading MHCflurry models from ..." info messages. Pre-existing inconsistency, fixed while nearby. - _LazyPredictor.__eq__: short-circuit on identity and on non-class operands. Previously `BigMHC == some_random_object` would eagerly resolve and import torch just to answer "no"; now it returns NotImplemented without triggering the load. test_dataframe_schema_parity: adds a test asserting the DeprecationWarning fires; existing tests silence it locally so the new warning doesn't pollute unrelated assertions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Small fixes surfaced while re-reading the past week's work with a critical eye. No behavior changes visible to normal callers; one API nicety (`DeprecationWarning`).
Changes
`mhctools/mhcflurry.py`
`mhctools/base_predictor.py`
`mhctools/cli/args.py`
`tests/test_dataframe_schema_parity.py`
Test plan
No version bump needed — these are internal refinements. Will batch with the next substantive change.