-
Notifications
You must be signed in to change notification settings - Fork 253
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
Adding type check for serve.py #1652
base: master
Are you sure you want to change the base?
Conversation
Hey @philippmwirth, please review this MR. Thanks. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1652 +/- ##
=======================================
Coverage 84.70% 84.70%
=======================================
Files 151 151
Lines 6446 6446
=======================================
Hits 5460 5460
Misses 986 986 ☔ View full report in Codecov by Sentry. |
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.
LGTM ❤️
Partly fixes #1635 |
Hey, thanks, very new to this open source, can you also merge it ? or do you guys follow some release timelines ? |
Hello 👋🏽 , I think in order for this PR to count for your Hacktoberfest total we'd have to merge it between Oct 1-31. I'm going to wait on @guarin for this. |
Ohh, but I am not doing it for hacktober fest, so if you can merge it then please go ahead, Thanks. |
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 a lot for the PR! There is one small thing that needs changing before we can merge it, sorry for the annoyance. I'll update the issue description to reflect that we need older type hints.
@@ -42,7 +42,7 @@ def do_OPTIONS(self) -> None: | |||
self.send_header("Access-Control-Allow-Methods", "GET, POST, OPTIONS") | |||
self.end_headers() | |||
|
|||
def send_response_only(self, code, message=None): | |||
def send_response_only(self, code: int, message: str | None = None) -> None: |
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.
Could you change this to use Optional
(can be imported with from typing import Optional
)?
def send_response_only(self, code: int, message: str | None = None) -> None: | |
def send_response_only(self, code: int, message: Optional[str] = None) -> None: |
The package is still used on some older Python versions (<3.10) which do not yet support the new X | Y
typing syntax introduced in 3.10. This is usually caught by our tests but this specific function is not tested :(
Edit: Actually, let's just add from __future__ import annotations
at the top of the file. Then Python 3.10 types are also supported on older versions.
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.
okay, will add and crate a PR
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.
No need to create a new PR, you can just update this one.
No description provided.