-
Notifications
You must be signed in to change notification settings - Fork 453
Description
First, thank you for maintaining this API wrapper!
Raising this here as this is a commercial library and makes sense for Stripe maintainers to understand the Stripe code better than typeshed maintainers. It also feels like a bug that would make more sense to be fixed here than by making complex type annotations.
The Python typeshed types for this library are raising an issue due to the stripe.Subscription.delete endpoint. Likely in one of these files in typeshed:
or
or
Here's the bug:
If I use the following correct code:
stripe.Subscription.delete("sub_1JedlQ2eZvKYlo2Cmc9TYNhw")
this is the error that is raised:
Argument 1 to "delete" has incompatible type "str"; expected "DeletableAPIResource"
I suspect it's due to some of the machinations in the @util.class_method_variant
decorator which feels like a code smell - this decorator obfuscates what's happening under the hood to allow a classmethod to be called as either an instance method or as a "classmethod with an instance as the first argument". But why would one want to overload a classmethod like that in the first place?
I suppose an approach would be to fix the type hints somehow in the files I linked above, but likely a better approach would be to remove the @util.class_method_variant
in favor of a simpler approach.
It's possible I'm missing the beauty of the decorator; perhaps it's just that I've never seen something that tries to do what it's doing before! In any case, thank you for taking a look at the issue!