fix: resolve 3 remaining issues from PR #16 review#18
Merged
Conversation
- Fix NameError on malformed JSON lines by initializing stats/unsanitized_data before the JSONL loading loop instead of after it - Move dagshub/mlflow from core dependencies to optional [mlflow] extra - Remove stale RULE C FIX docstring, duplicate import re, and unused Tuple import; use builtin tuple[] instead of typing.Tuple - Add test for malformed JSON line handling in sanitize_and_extract
CI installs only the [dev] extra, not [mlflow]. Add pytest.importorskip for dagshub and mlflow so the test module is skipped gracefully when these optional dependencies are absent.
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.
Summary
Addresses the 3 remaining issues identified during the review of PR #16 (
phase-6-loss_function).NameErroron malformed JSON — movedstats,sanitized_data, andunsanitized_datainitialization before the JSONL loading loop so theexcept json.JSONDecodeErrorhandler can safely reference themdagshub/mlflowfrom coredependenciesto[project.optional-dependencies] mlflowsince they're only used byscripts/mlflow_logger.pyRULE C FIXdocstring, duplicateimport re, unusedfrom typing import Tuple; changedTuple[bool, str]totuple[bool, str]Test Coverage
test_malformed_json_line_does_not_crash— writes a JSONL file with a bad line, verifiessanitize_and_extract()handles it gracefully (parse_errors == 1, no crash)test_sanitization_manager.py+test_tokenizer.py)Files Changed
scripts/data_sanitization.pypyproject.tomltests/test_sanitization_manager.py