Skip to content

Extend mypy typing#76

Merged
behrmann merged 6 commits intovarlink:masterfrom
jelly:extend-mypy
Oct 8, 2025
Merged

Extend mypy typing#76
behrmann merged 6 commits intovarlink:masterfrom
jelly:extend-mypy

Conversation

@jelly
Copy link
Collaborator

@jelly jelly commented Oct 4, 2025

No description provided.

raise NotImplementedError

def _next_message(self):
def _next_message(self) -> None:
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think this can be typed like this, because line 81 calls next(self._next_message()) and treats the returned value as a JSON-string.

This doesn't make an awful lot of sense, since the only implementation of _next_message actually doesn't return anything. I think there might be a bug somewhere.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the abstract class and I am not sure what the best way is to handle typing this when it wouldn't return a valid type. So that will need some further investigation.

self.name = name
self.identifier = str(uuid.uuid4())
self.interface_description = None
self.interface_description: list[str] = []
Copy link
Collaborator

@behrmann behrmann Oct 8, 2025

Choose a reason for hiding this comment

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

This change might break people assuming that an uninitalised interface_description is None and after interface_description is initalised, it is a list with at least one element. This seems a bit silly, since an empty list is a perfectly fine boolean to encode this, so it doesn't need to be None, but I wonder if there is any usage of that out in the wild. The only thing I find for interface_description is None on GitHub is not varlink, so changing this is most likely safe.

@behrmann behrmann merged commit ab17fd8 into varlink:master Oct 8, 2025
8 checks passed
@jelly jelly deleted the extend-mypy branch October 8, 2025 16:08
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