-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
braintree: Replace usages of Any
#11679
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This comment has been minimized.
This comment has been minimized.
payment_methods: list[ | ||
CreditCard | ||
| Address | ||
| PayPalAccount | ||
| ApplePayCard | ||
| AndroidPayCard | ||
| AmexExpressCheckoutCard | ||
| EuropeBankAccount | ||
| VenmoAccount | ||
| UsBankAccount | ||
| VisaCheckoutCard | ||
| MasterpassCard | ||
| SamsungPayCard | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
payment_methods: list[ | |
CreditCard | |
| Address | |
| PayPalAccount | |
| ApplePayCard | |
| AndroidPayCard | |
| AmexExpressCheckoutCard | |
| EuropeBankAccount | |
| VenmoAccount | |
| UsBankAccount | |
| VisaCheckoutCard | |
| MasterpassCard | |
| SamsungPayCard | |
] | |
payment_methods: list[Resource] |
Since you'd have to use isinstance
anyway for most usage, and indidual types are already available in their own separate lists, it makes sense to simplify this definition
This comment has been minimized.
This comment has been minimized.
Conflicts now (as expected). |
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks sensible.
Based on #11678 so please merge that first
Works towards #9550 .
The biggest point of interest in this PR, is how braintree does its dynamic values. Any subclass of
AttributeGetter
expect aattributes
dict that is used to create all the fields. This means, however, that whilst some fields are never indicated as being potentiallyNone
, they could still raiseAttributeError
if missing or optional from the initial attributes.This also means that if an attribute is to be used as-is without any special manipulation, then it will be missed by stugben and stubtest.
I've added a relevant comment in
stubs/braintree/braintree/attribute_getter.pyi