Skip to content

Conversation

@stefanvanburen
Copy link
Member

@stefanvanburen stefanvanburen commented Aug 26, 2025

This is largely teaching mypy about the gen/ path, removing those type-ignore comments on the imports, and then fixing up the aftermath.

There's also a bit of type narrowing, minor 'Pythonic' tweaks, and tweaking the types-protobuf dependency (and fixing those lints), so that we can eventually get better types 😄.

This is largely teaching mypy about the gen/ path, removing those
`type-ignore` comments on the imports, and then fixing up the aftermath.

There's also a bit of type narrowing, minor 'Pythonic' tweaks, and
unpinning the types-protobuf dependency (and fixing those lints), so
that we can eventually get better types 😄.
@stefanvanburen stefanvanburen force-pushed the svanburen/improve-typing branch from d5e5b7a to ee8b056 Compare August 26, 2025 13:56
field.has_presence and not for_items
)
self._required = field_level.required
type_case = field_level.WhichOneof("type")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

already set above

Comment on lines +1085 to +1086
rules: list[Rules] = self._factory.get(self._field.message_type)
if not rules:
Copy link
Member Author

@stefanvanburen stefanvanburen Aug 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

noticed we weren't exiting early here, since self._factory.get is never returning None. Switched to check if we have any rules in the list. Should be slightly faster.

@stefanvanburen stefanvanburen marked this pull request as ready for review August 26, 2025 19:00
@stefanvanburen stefanvanburen merged commit 9df411b into main Aug 26, 2025
23 checks passed
@stefanvanburen stefanvanburen deleted the svanburen/improve-typing branch August 26, 2025 19:13


def make_timestamp(msg: message.Message) -> celtypes.TimestampType:
def make_timestamp(msg: duration_pb2.Duration) -> celtypes.TimestampType:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be a timestamp_pb2.Timestamp?

stefanvanburen added a commit that referenced this pull request Aug 26, 2025
stefanvanburen added a commit that referenced this pull request Aug 26, 2025
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.

4 participants