-
Notifications
You must be signed in to change notification settings - Fork 85
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
IAgent
s should return IResponse
s
#443
Conversation
I tried to use `Response` rather than `IResponse` to avoid having to write a stub for the latter. There were other complications down the line from this. It was easier to change my mind, use `stubgen` and polish up the `iweb` stub. See also #439 (comment)
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.
looks pretty good, just a couple tiny things
@@ -61,7 +60,7 @@ class FileBodyProducer: | |||
def resumeProducing(self) -> None: ... | |||
|
|||
def readBody(response: IResponse) -> Deferred[bytes]: ... | |||
|
|||
@implementer(IResponse) # type: ignore[misc] |
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.
why does this need to be ignored? Is it just because the stub doesn't reproduce all the method signatures verbatim?
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.
That's exactly it. Laziness on my part, really.
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.
I'll add a comment to explain this.
stubs/twisted/web/iweb.pyi
Outdated
def setHeader(k: AnyStr, v: AnyStr) -> None: ... | ||
def redirect(url: AnyStr) -> None: ... | ||
# returns CACHED or False. CACHED is a string constant but we treat it as | ||
# a binary object. |
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.
'binary' object? hrm?
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.
should be "opaque", thanks. Don't stub when you're tired, kids.
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.
thanks!
In #439 I tried to use
Response
rather thanIResponse
in some annotations,to avoid having to
write a type stub to cover twisted's
iweb
interface.There were other complications down the line from this, because I was now contravening the zope interfaces I was claiming to adhere to. It was easier to change my mind, use
stubgen
, and polish up the result by hand. A lot of the work had been done already in annotating the implementation classes.