BlossomDNS / register

BlossomDNS - Giving Away pro-dev.app, py-dev.io, cool-web.site and pro-dev.site subdomains
https://cool-web.site/
BSD 3-Clause "New" or "Revised" License
36 stars 5 forks source link

Use Assignment Expression (Walrus) In Conditional #15

Closed pixeebot[bot] closed 9 months ago

pixeebot[bot] commented 10 months ago

This codemod updates places where two separate statements involving an assignment and conditional can be replaced with a single Assignment Expression (commonly known as the walrus operator).

Many developers use this operator in new code that they write but don't have the time to find and update every place in existing code. So we do it for you! We believe this leads to more concise and readable code.

The changes from this codemod look like this:

- x = foo()
- if x is not None:
+ if (x := foo()) is not None:
      print(x)

The walrus operator is only supported in Python 3.8 and later.

More reading * [https://docs.python.org/3/whatsnew/3.8.html#assignment-expressions](https://docs.python.org/3/whatsnew/3.8.html#assignment-expressions)

I have additional improvements ready for this repo! If you want to see them, leave the comment:

@pixeebot next

... and I will open a new PR right away!

Powered by: pixeebot (codemod ID: pixee:python/use-walrus-if)

netlify[bot] commented 10 months ago

Deploy Preview for capable-cactus-9ea0d7 ready!

Name Link
Latest commit d4206395a7648e91c47a985d32627760acb22796
Latest deploy log https://app.netlify.com/sites/capable-cactus-9ea0d7/deploys/658cb2a9c21e0a0008a4d5b3
Deploy Preview https://deploy-preview-15--capable-cactus-9ea0d7.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

pixeebot[bot] commented 10 months ago

I'm confident in this change, and the CI checks pass, too!

If you see any reason not to merge this, or you have suggestions for improvements, please let me know!

pixeebot[bot] commented 9 months ago

This change may not be a priority right now, so I'll close it. If there was something I could have done better, please let me know!

You can also customize me to make sure I'm working with you in the way you want.