Switch from mypy to ty for type checking#418
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.
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.
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.) |
|
Going to close this; I'd still like to switch from |
tyis iterating rapidly, but already seems better thanmypy.