Repository navigation
R23-T030: Refactor simple_keyword_cypher to separate I/O from logic - #121
Open
mohammedsohail0301-dot wants to merge 1 commit into
Open
mohammedsohail0301-dot wants to merge 1 commit into
mohammedsohail0301-dot wants to merge 1 commit into
Conversation
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 of Changes
Task R23-T030: Refactor
ciphers/simple_keyword_cypher.pyto separate I/O from cipher logicThis pull request completes Task R23-T030 (10 of 10) by restructuring
ciphers/simple_keyword_cypher.pyusing tests as a safety net.1. Goal and Architectural Improvements
main():process_cipher(message, key, option)with complete doctests.main()to pure sequential I/O delegation (input()process_cipher()print()).create_cipher_map(key)(previously had 0).encipher,decipher, andremove_duplicatesunchanged and passing.2. Complexity & Coverage Evidence (
work/R23-T030/REFACTOR.md)main()complexity reduced from 2 to 1 (-50%).3. Verification & Test Evidence
uvx ruff check ciphers/simple_keyword_cypher.py: Passed (0 errors).uvx ruff format --check ciphers/simple_keyword_cypher.py: Passed (1 file already formatted).python3 -m doctest -v ciphers/simple_keyword_cypher.py: All 15 doctests passed.pytest --cov: All tests passed with 82% coverage.python3 scripts/validate_filenames.py: Passed cleanly.4. Submission Checklist
input()inmain()into pure functionprocess_cipher.create_cipher_mapgained doctests (7 new tests).REFACTOR.mddocuments before/after cyclomatic complexity and coverage.encipher,decipher, andremove_duplicatesremain unchanged and passing.student/E26B07F0850/R23-T030-upstreamprepared with only code changes.