github dosisod/refurb v1.12.0
Version 1.12.0

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

Important Mypy Update Info

This is the 3rd release in the past 3 days, sorry for the spam! This version is pretty important though, since it removes the version cap on Mypy: They just released Mypy version 1.0 a few days ago, the same day that v1.11.1 (the lastest version) of Refurb came out. Since a lot of people will be upgrading Mypy in the coming days, it is important to remove this cap so that people don't get version conflicts. Now that Mypy has reached 1.0, a "stable" release, there should be less of a concern when it comes to spontaneous breakage.

With that in mind, this newest version does include one new check!

Add simplify-as-pattern-with-builtin check (FURB158)

This check looks for instances where builtin types such as int(), float(), etc. are used in as patterns (such as int() as x). Although this is totally valid, it can be more succinctly written as int(x).

Here is what that looks like side-by-side:

match data:
    case str() as name:
        print(f"Hello {name}")

Compare that to the simpler version:

match data:
    case str(name):
        print(f"Hello {name}")

Full Changelog: v1.11.1...v1.12.0

Don't miss a new refurb release

NewReleases is sending notifications on new releases.