Skip to content

Commit

Permalink
Fix image link (whoops)
Browse files Browse the repository at this point in the history
  • Loading branch information
David Robertson committed Dec 6, 2021
1 parent ca61ce5 commit 07dfe91
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion gatsby/content/blog/2021/12/2021-12-10-sydent-typing-2.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ All in all, the handling of `inlineCallbacks` is a situation specific to working

Twisted makes use of `zope`'s `Interface` to define a number of abstract interface classes. Speaking personally, I've not seen it used outside twisted, and I think that means it's not supported by much of the typechecking tooling. For example, I've definitely seen PyCharm struggle to realise that it's okay to pass a `Response` to a function which expects an `IResponse`! Here's a more complicated example where `PyCharm` isn't happy with me widening the type `LoggingHostnameEndpoint` to `IStreamClientEndpoint`, even though [the latter implements the former](https://github.com/matrix-org/sydent/blob/92ff7a878a25696365b10cc49e32f5cba32c5960/sydent/http/matrixfederationagent.py#L379-L380).

![Screenshot from pycharm showing a false positive warning](https://i.imgur.com/27rqjHm.png)
![Screenshot from pycharm showing a false positive warning](/blog/img/2012-12-10-pycharm-false-positive.png)


Mypy out of the box doesn't play well with a zope `Interface` (nor does any other typechecker I tried). Fortunately, the excellent [`mypy-zope`](https://github.com/Shoobx/mypy-zope) plugin helps here: it teaches mypy that any class like `Response` which `@implements(IResponse)` can be passed in place of an `IResponse`.
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 07dfe91

Please sign in to comment.