Skip to content

Conversation

@stephenfin
Copy link

These were spotted while working on adding type hints to debtcollector. I believe the simplified types are correct, as evidenced by me no longer needing type: ignore statements in debtcollector plus the reduced failures in the tests, but this should definitely receive the twice-over.

The `P` and `T` ParamSpec and TypeVar attributes are bound and indicate
the parameters of the *wrapper* function, not the *wrapped* function.

Signed-off-by: Stephen Finucane <stephen@that.guru>
…er.__get__

Properly handle method binding by providing overrides that will strip
the self/cls parameter when used on a method rather than a parameter.

Tests are updated to reflect this improvement.

Signed-off-by: Stephen Finucane <stephen@that.guru>
@GrahamDumpleton
Copy link
Owner

What is debtcollector and what static type checker tool are you targeting?

The type hints are the way they are because a more simplified approach doesn't work with various type checkers and results in various cases being flagged as problems when they aren't.

Would also have been helpful to see how you are using type hints in your usage of wrapt. The docs show using it in a specific way, again because of limitations in static type checkers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants