-
Notifications
You must be signed in to change notification settings - Fork 8
Switch from mypy to ty for type checking #418
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
base: main
Are you sure you want to change the base?
Conversation
| def validate(self, ctx: RuleContext, message: message.Message): | ||
| num_set_fields = sum(1 for field in self._fields if not _is_empty_field(message, field)) |
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.
ty wants the names of the arguments to match when over-riding from a superclass.
| def validate_item(self, ctx: RuleContext, value: typing.Any, *, for_key: bool = False): | ||
| self._validate_value(ctx, value, for_key=for_key) | ||
| self._validate_cel( | ||
| ctx, this_value=value, this_cel=_scalar_field_value_to_cel(value, self._field), for_key=for_key | ||
| ) | ||
|
|
||
| def _validate_value(self, ctx: RuleContext, val: typing.Any, *, for_key: bool = False): | ||
| def _validate_value(self, ctx: RuleContext, value: typing.Any, *, for_key: bool = False): |
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.
renamed to value here
|
I tried using it on protobuf-python (which now uses pyright), it produced a lot of false positive. I also see many issues on github, apparently it's not always completely deterministic, can crash in certain circonstances, etc |
|
@AdrienVannson Fair! I'm happy to wait for a release beyond |
|
(Going to just park this in draft for now.) |
tyis iterating rapidly, but already seems better thanmypy.