Replies: 1 comment 3 replies
-
Mypy is also going to complain about such errors, but I understand where you're coming from. I could accept a PR to this end where the flag is added as a configuration option (not env variable). |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Greetings!
I work in a team that uses typeguard as a library, specifically to decorate methods with the typechecked decorator. We have recently upgraded from 2.x.x to 4.x.x and have hit a lot of snags in our testing pipeline, related to the fact that the old wrapping method was updated to a partial handling of the function.
The main issue here is that typeguard checks the types within the body as well, and if a method argument typed as str changes to an int during a loop inside the function body, for example, typeguard raises an exception. This is a bit too strict for our development needs as we would like to still use Python's duck-typing down the way.
The question for you is: could a solution be implemented for the typechecked decorator that only limits the checking to the initial passed-on arguments (that enables the above example to pass)?
A few options from the top of mind below:
@typechecked(body_check=False)
OR
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions