Repository navigation
MAINT: Make puzzled converter and puzzle builder helpers keyword-only - #4349
Conversation
Migrate six helpers across the puzzled converter package to keyword-only parameters to reduce the keyword-only baseline: - Require keyword-only pos_lookup and optional essential_words in pyrit.converter.puzzled.keyword_masker._rank_candidates. - Require keyword-only rng in pyrit.converter.puzzled.puzzle_builders.build_anagram and build_word_search (defaulting to None for internal random.Random). - Require keyword-only word and rng in pyrit.converter.puzzled.puzzle_builders._try_place. - Require keyword-only optional semantics in pyrit.converter.puzzled.puzzled_converter.PuzzledConverter._clue_line (defaulting to None). - Require keyword-only words in pyrit.converter.puzzled.puzzled_converter.PuzzledConverter._parse_semantic_clues. - Update internal call sites and unit test invocations. - Add signature, positional rejection, and behavior tests for all migrated helpers. - Remove all six entries for pyrit.converter.puzzled from build_scripts/keyword_only_baseline.txt. Relates to microsoft#4216
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the keyword-only helper migration.
No open issues 🎉
What changed in this PR
Migrates six puzzled-converter helpers to keyword-only parameters, advancing the baseline reduction tracked in #4216.
Changes:
- Updates helper signatures and internal callers, adding optional defaults for randomness, essential words, and semantic clues.
- Adds signature, positional-rejection, and behavior tests.
- Removes the six migrated helpers from the keyword-only baseline.
| File | Description |
|---|---|
tests/unit/converter/test_puzzled_puzzle_builders.py |
Updates calls and tests keyword-only parameters and default randomness. |
tests/unit/converter/test_puzzled_keyword_masker.py |
Tests ranking signatures and optional essential words. |
tests/unit/converter/test_puzzled_converter.py |
Tests clue-helper signatures and parsing behavior. |
pyrit/converter/puzzled/puzzled_converter.py |
Migrates clue helpers and updates converter call sites. |
pyrit/converter/puzzled/puzzle_builders.py |
Migrates builder and placement helpers; adds optional randomness sources. |
pyrit/converter/puzzled/keyword_masker.py |
Migrates ranking parameters and updates its caller. |
build_scripts/keyword_only_baseline.txt |
Removes all six migrated helper entries. |
Review effort: Balanced
|
Thanks for the contribution! This PR covers modules from #4216 that were not claimed first. Per that issue's rules, please claim one module at a time on the issue and wait for maintainer confirmation before opening a PR, so we can coordinate and avoid duplicated effort. Leaving this open for review; the modules it touches are now recorded on #4216. |
|
Madhu Sudan Sathujoda (@madhusudanpatnaik) you need to accept the CLA as explained above by the bot. I'll give you until 11/20 otherwise I'll close these PRs. |
|
The Microsoft CLA has now been accepted. Thank you for the guidance—going forward I will claim one module at a time on #4216 before opening any PR. |
Reverts the `= None` defaults and fallback branches added alongside the keyword-only conversion: rng stays injected for reproducibility, and the sole callers always pass semantics and essential_words. Also removes the inspect-based signature assertions, which duplicate build_scripts/check_keyword_only_params.py, while keeping the new behavior tests. Co-Authored-By: Claude Fable 5 <[email protected]>
MAINT: Make puzzled converter and puzzle builder helpers keyword-only
Description
Migrate six helpers across the puzzled converter package to keyword-only parameters to reduce the keyword-only baseline:
pos_lookupandessential_wordsinpyrit/converter/puzzled/keyword_masker.py:_rank_candidates.rnginpyrit/converter/puzzled/puzzle_builders.py:build_anagramandbuild_word_search.wordandrnginpyrit/converter/puzzled/puzzle_builders.py:_try_place.semanticsinpyrit/converter/puzzled/puzzled_converter.py:PuzzledConverter._clue_line.wordsinpyrit/converter/puzzled/puzzled_converter.py:PuzzledConverter._parse_semantic_clues.puzzled_converter.py,puzzle_builders.py,keyword_masker.py, and test suites._clue_line,_parse_semantic_clues, and_rank_candidates.pyrit.converter.puzzledentries frombuild_scripts/keyword_only_baseline.txt.No signatures gained defaults and no behavior changed: all parameters stay required (or keep their original optionality), matching the purely mechanical convention of earlier campaign PRs.
Relates to #4216