◐ Shell
clean mode source ↗

Include SHAKE algorithm names in HASHXOF repr by moreal · Pull Request #7132 · RustPython/RustPython

📝 Walkthrough

Walkthrough

PyHasherXof in crates/stdlib/src/hashlib.rs now includes Representable in its #[pyclass(...)] attribute and adds impl Representable for PyHasherXof with a custom repr_str. A minor error-handling expression in pbkdf2_hmac was compacted without behavior change.

Changes

Cohort / File(s) Summary
PyHasherXof Representable
crates/stdlib/src/hashlib.rs
Added with(Representable) to the #[pyclass(...)] for PyHasherXof and introduced impl Representable for PyHasherXof with repr_str returning "<{name} _hashlib.HASHXOF object @ {:#x}>".
pbkdf2_hmac error handling
crates/stdlib/src/hashlib.rs
Refactored lenusize conversion to a compact usize::try_from(len).map_err(...)? chain; semantics unchanged.

Sequence Diagram(s)

(none)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • youknowone

Poem

🐇
I patted bytes with a carroted grin,
Gave XOF a name and a neat hex pin,
Now traces show where the digests play,
A rabbit's nod for a tidy display 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 2
❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Merge Conflict Detection ⚠️ Warning ❌ Merge conflicts detected (3 files):

⚔️ Lib/test/test_hashlib.py (content)
⚔️ Lib/test/test_struct.py (content)
⚔️ crates/stdlib/src/hashlib.rs (content)

These conflicts must be resolved before merging into main.

Resolve conflicts locally and push changes to this branch.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding algorithm names (SHAKE) to the HASHXOF repr implementation.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
⚔️ Resolve merge conflicts (beta)
  • Auto-commit resolved conflicts to branch fix/fail-hashlib-test_blocksize_name_sha3
  • Post resolved changes as copyable diffs in a comment

No actionable comments were generated in the recent review. 🎉


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.