mypy
mypy copied to clipboard
Add `__match_args__` to node types
Closes #13243.
For the most part, in order to determine which fields where worth pattern matching against, I looked at what was being displayed in the StrConv
class (defined in mypy/strconv.py
). I might've missed some fields, but for the most part all of the important ones are there.
In addition, to make pattern matching feel more natural, I re-arranged the fields to better align with how they look in the source code. For example, when matching against OpExpr
, you would do:
match o:
case OpExpr(IntExpr(1), "+", IntExpr(2)):
pass
instead of:
match o:
case OpExpr("+", IntExpr(1), IntExpr(2)):
pass
Also, deleted an old semantic analyzer-related field (imported_names
, line 481). Didn't seem to be in use anymore.
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
@sobolevn , do you know someone who would be able to review this PR? Thanks!
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
@JukkaL @ilevkivskyi can you please take a look? 🙏
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉