DenverCoder1 / github-readme-youtube-cards

Workflow for displaying recent YouTube videos as SVG cards in your readme
https://ytcards.demolab.com
MIT License
197 stars 46 forks source link

Use Assignment Expression (Walrus) In Conditional #158

Closed pixeebot[bot] closed 10 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)

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

vercel[bot] commented 10 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
ytcards ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 26, 2023 10:07am