github dosisod/refurb v1.24.0
Release v1.24.0

latest releases: v2.0.0, v1.28.0, v1.27.0...
11 months ago

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

New Contributors

Full Changelog: v1.23.0...v1.24.0

Don't miss a new refurb release

NewReleases is sending notifications on new releases.