-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Add types for Application and Response #3247
Conversation
debug=...): | ||
logger: logging.Logger=web_logger, | ||
router: Optional[UrlDispatcher]=None, | ||
middlewares: Sequence[_Middleware]=(), |
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 it be Optional
? in case when middlewares=None
it works fine
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.
Let's keep sequence. We have no explicit test for None
, I don't want to keep the guarantee forever.
BTW 0
and 0.0
should work too but it is weird.
if body is not None and text is not None: | ||
raise ValueError("body and text are not allowed together") | ||
|
||
if headers is None: | ||
headers = CIMultiDict() | ||
elif not isinstance(headers, (CIMultiDict, CIMultiDictProxy)): | ||
headers = CIMultiDict(headers) | ||
else: | ||
headers = cast(CIMultiDict, headers) |
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.
it's ok doing like this? or I should do it in type checking scope?:
if TYPE_CHECKING:
headers = cast(CIMultiDict, headers)
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.
Let's keep the line as is
debug=...): | ||
logger: logging.Logger=web_logger, | ||
router: Optional[UrlDispatcher]=None, | ||
middlewares: Sequence[_Middleware]=(), |
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.
Let's keep sequence. We have no explicit test for None
, I don't want to keep the guarantee forever.
BTW 0
and 0.0
should work too but it is weird.
if body is not None and text is not None: | ||
raise ValueError("body and text are not allowed together") | ||
|
||
if headers is None: | ||
headers = CIMultiDict() | ||
elif not isinstance(headers, (CIMultiDict, CIMultiDictProxy)): | ||
headers = CIMultiDict(headers) | ||
else: | ||
headers = cast(CIMultiDict, headers) |
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.
Let's keep the line as is
Please make tests passing on Python 3.5 |
2faeb7b
to
0361927
Compare
Codecov Report
@@ Coverage Diff @@
## master #3247 +/- ##
=========================================
- Coverage 98.09% 97.99% -0.1%
=========================================
Files 43 43
Lines 7871 7885 +14
Branches 1354 1354
=========================================
+ Hits 7721 7727 +6
- Misses 58 65 +7
- Partials 92 93 +1
Continue to review full report at Codecov.
|
done |
thanks |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a [new issue] for related bugs. |
What do these changes do?
Add types for Application and Response
Are there changes in behavior for the user?
No
Related issue number
WIP on #1749
Checklist
CONTRIBUTORS.txt
CHANGES
folder<issue_id>.<type>
for example (588.bugfix)issue_id
change it to the pr id after creating the pr.feature
: Signifying a new feature..bugfix
: Signifying a bug fix..doc
: Signifying a documentation improvement..removal
: Signifying a deprecation or removal of public API..misc
: A ticket has been closed, but it is not of interest to users.