-
-
Notifications
You must be signed in to change notification settings - Fork 229
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
chore: reduce number of mypy warnings #1023
Conversation
…h" (default has type "None", argument has type "str")"
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
I've also noticed that the only Http method with integration tests for authentication is GET. There are no tests for POST, PUT etc |
…edError: Authentication is not configured. Use app.configure_authentication() to configure it.
…edError: Authentication is not configured. Use app.configure_authentication() to configure it.
…edError: Authentication is not configured. Use app.configure_authentication() to configure it.
I've commited failing tests for subrouter authentication. Somehow the authentication isn't being configured for subroutes? |
…multiple None by 2
NB |
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! Thank you @dave42w 😄
Hey @dave42w 👋 looks like the ci is failing |
That will be the subroute authentication tests I added that don't pass because authentication doesn't seem to be fully setup for subroutes |
We could just not include the extra tests at this point. |
This should fix CI
@sansyrox I've removed all those api changes around the authorisation (that were trying to gain consistency with the SubRouter superclass). I figure that is a bigger job that needs to be separate and have tests. So now it is just the mypy cleanups that you have already approved. |
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! Thank you @dave42w ✨
CodSpeed Performance ReportMerging #1023 will not alter performanceComparing Summary
|
Description
This PR cleans up some mypy warnings in
Summary
This PR only contains fixes to mypy warnings (using latest mypy 1.13.0)
NB The fixes for SubRouter are significant bug as auth_required was missing. I've added tests to confirm subroute get authentication but they are failing with
AuthenticationNotConfiguredError: Authentication is not configured. Use app.configure_authentication() to configure it.
see #1026NB there are no integration tests for authentication except for HTTP GET, we need them for POST, PUT etc
init.py
I've added an issue to nestd for types see sparckles/nestd#6
mutltiprocess already has an issue raised for typing. I've used the workaround in that thread.
Starting point for init.py (All complete apart from nestd)
robyn/init.py:8: error: Cannot find implementation or library stub for module named "multiprocess" [import-not-found]robyn/init.py:9: error: Cannot find implementation or library stub for module named "nestd" [import-not-found]
robyn/init.py:8: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
robyn/init.py:45: error: Incompatible default for argument "openapi_file_path" (default has type "None", argument has type "str")robyn/init.py:82: error: Need type annotation for "event_handlers" (hint: "event_handlers: dict[, ] = ...") [var-annotated]robyn/init.py:599: error: Signature of "get" incompatible with supertype "Robyn" [override]robyn/init.py:599: note: Superclass:
robyn/init.py:599: note: def get(self, endpoint: str, const: bool = ..., auth_required: bool = ..., openapi_name: str = ..., openapi_tags: list[str] = ...) -> Any
robyn/init.py:599: note: Subclass:
robyn/init.py:599: note: def get(self, endpoint: str, const: bool = ..., openapi_name: str = ..., openapi_tags: list[str] = ...) -> Any
robyn/init.py:602: error: Signature of "post" incompatible with supertype "Robyn" [override]
robyn/init.py:602: note: Superclass:
robyn/init.py:602: note: def post(self, endpoint: str, auth_required: bool = ..., openapi_name: str = ..., openapi_tags: list[str] = ...) -> Any
robyn/init.py:602: note: Subclass:
robyn/init.py:602: note: def post(self, endpoint: str, openapi_name: str = ..., openapi_tags: list[str] = ...) -> Any
robyn/init.py:605: error: Signature of "put" incompatible with supertype "Robyn" [override]
robyn/init.py:605: note: Superclass:
robyn/init.py:605: note: def put(self, endpoint: str, auth_required: bool = ..., openapi_name: str = ..., openapi_tags: list[str] = ...) -> Any
robyn/init.py:605: note: Subclass:
robyn/init.py:605: note: def put(self, endpoint: str, openapi_name: str = ..., openapi_tags: list[str] = ...) -> Any
robyn/init.py:608: error: Signature of "delete" incompatible with supertype "Robyn" [override]
robyn/init.py:608: note: Superclass:
robyn/init.py:608: note: def delete(self, endpoint: str, auth_required: bool = ..., openapi_name: str = ..., openapi_tags: list[str] = ...) -> Any
robyn/init.py:608: note: Subclass:
robyn/init.py:608: note: def delete(self, endpoint: str, openapi_name: str = ..., openapi_tags: list[str] = ...) -> Any
robyn/init.py:611: error: Signature of "patch" incompatible with supertype "Robyn" [override]
robyn/init.py:611: note: Superclass:
robyn/init.py:611: note: def patch(self, endpoint: str, auth_required: bool = ..., openapi_name: str = ..., openapi_tags: list[str] = ...) -> Any
robyn/init.py:611: note: Subclass:
robyn/init.py:611: note: def patch(self, endpoint: str, openapi_name: str = ..., openapi_tags: list[str] = ...) -> Any
robyn/init.py:614: error: Signature of "head" incompatible with supertype "Robyn" [override]
robyn/init.py:614: note: Superclass:
robyn/init.py:614: note: def head(self, endpoint: str, auth_required: bool = ..., openapi_name: str = ..., openapi_tags: list[str] = ...) -> Any
robyn/init.py:614: note: Subclass:
robyn/init.py:614: note: def head(self, endpoint: str, openapi_name: str = ..., openapi_tags: list[str] = ...) -> Any
robyn/init.py:617: error: Signature of "trace" incompatible with supertype "Robyn" [override]
robyn/init.py:617: note: Superclass:
robyn/init.py:617: note: def trace(self, endpoint: str, auth_required: bool = ..., openapi_name: str = ..., openapi_tags: list[str] = ...) -> Any
robyn/init.py:617: note: Subclass:
robyn/init.py:617: note: def trace(self, endpoint: str, openapi_name: str = ..., openapi_tags: list[str] = ...) -> Any
robyn/init.py:620: error: Signature of "options" incompatible with supertype "Robyn" [override]
robyn/init.py:620: note: Superclass:
robyn/init.py:620: note: def options(self, endpoint: str, auth_required: bool = ..., openapi_name: str = ..., openapi_tags: list[str] = ...) -> Any
robyn/init.py:620: note: Subclass:
robyn/init.py:620: note: def options(self, endpoint: str, openapi_name: str = ..., openapi_tags: list[str] = ...) -> Any
authenticate.py line 84
Fixed from
if "authorization" in request.headers:
toif request.headers.contains("authorization"):
argument_parser.py line 106
Fixed from
to
because mypy warned that os.cpu_count() can be None
dependency_injection
change from
to
to get type checking in the ini method
reloader.py
Added List to
self.built_rust_binaries: List = []
openapi.py
Fixed line 242 from
) -> (str, dict):
totuple[str, dict]:
Fixed spelling of Definition line 248
Fixed line 331 from
response_schema = {}
toresponse_schema: dict = {}
Fixed line 419 from
def get_openapi_docs_page(self) -> FileResponse:
todef get_openapi_docs_page(self) -> Response:
which meant removing FileResponse from importsSome still left
processpool.py
Fixed
from multiprocess import Process
same as in init.pyFixed line 88 from
process_pool = []
toprocess_pool: List = []