This release adds 2 new checks, some documentation updates, and allows for using Refurb with the new 1.7.0 release of Mypy. Thank you @bzoracler for fixing this!
Unpin Mypy v1.7.0
Mypy v1.7.0 made an internal change that broke Refurb (see #305). A workaround has since been found meaning we no longer need to pin to Mypy <1.7.0. If you are still experiencing any issues with using older/newer versions of Mypy with Refurb, please open an issue!
Add use-hexdigest-hashlib
check (FURB181)
Use .hexdigest()
to get a hex digest from a hash.
Bad:
from hashlib import sha512
hashed = sha512(b"some data").digest().hex()
Good:
from hashlib import sha512
hashed = sha512(b"some data").hexdigest()
Add simplify-hashlib-ctor
(FURB182)
You can pass data into hashlib
constructors, so instead of creating a hash object and immediately updating it, pass the data directly.
Bad:
from hashlib import sha512
h = sha512()
h.update(b"data)
Good:
from hashlib import sha512
h = sha512(b"data")
What's Changed
- Fix incorrect grammar in README by @tylerlaprade in #307
- Specify what Python version Refurb uses when version isn't set by @dosisod in #308
- Experimental/use standalone visitor by @bzoracler in #309
New Contributors
- @tylerlaprade made their first contribution in #307
- @bzoracler made their first contribution in #309
Full Changelog: v1.23.0...v1.24.0