From 8c414df629c9b4b98071baac292e0eadcb14e203 Mon Sep 17 00:00:00 2001 From: Ishaan Agarwal <63185052+ishaanagw@users.noreply.github.com> Date: Sun, 22 Sep 2024 02:33:54 +0530 Subject: [PATCH 1/5] Adding type check for serve.py --- lightly/api/serve.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lightly/api/serve.py b/lightly/api/serve.py index 7dd1610df..e0d3a3278 100644 --- a/lightly/api/serve.py +++ b/lightly/api/serve.py @@ -10,7 +10,7 @@ def get_server( paths: Sequence[Path], host: str, port: int, -): +) -> ThreadingHTTPServer: """Returns an HTTP server that serves a local datasource. Args: @@ -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: super().send_response_only(code, message) self.send_header( "Cache-Control", "no-store, must-revalidate, no-cache, max-age=-1" From 72870c72a159a1352e58d84c9fad63b78bb3bac8 Mon Sep 17 00:00:00 2001 From: Ishaan Agarwal <63185052+ishaanagw@users.noreply.github.com> Date: Sun, 22 Sep 2024 02:34:33 +0530 Subject: [PATCH 2/5] Removing serve.py from exclude --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 40bbb50ef..8e4b242be 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -224,7 +224,6 @@ exclude = '''(?x)( lightly/api/api_workflow_download_dataset.py | lightly/api/bitmask.py | lightly/api/_version_checking.py | - lightly/api/serve.py | lightly/api/patch.py | lightly/api/swagger_api_client.py | lightly/api/api_workflow_collaboration.py | From cc40807682c1af97ca6aa9f9da92965645fe03f2 Mon Sep 17 00:00:00 2001 From: Ishaan Agarwal Date: Mon, 23 Sep 2024 15:54:19 +0530 Subject: [PATCH 3/5] formatting the file --- lightly/api/serve.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lightly/api/serve.py b/lightly/api/serve.py index e0d3a3278..08960efd3 100644 --- a/lightly/api/serve.py +++ b/lightly/api/serve.py @@ -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: int, message: str|None=None) -> None: + def send_response_only(self, code: int, message: str | None = None) -> None: super().send_response_only(code, message) self.send_header( "Cache-Control", "no-store, must-revalidate, no-cache, max-age=-1" From e0215b9a23d3708b7f4fde7c198aeb2af9b82c20 Mon Sep 17 00:00:00 2001 From: Ishaan Agarwal <63185052+ishaanagw@users.noreply.github.com> Date: Thu, 3 Oct 2024 17:53:44 +0530 Subject: [PATCH 4/5] Adding annotations for Python 3.10 --- lightly/api/serve.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lightly/api/serve.py b/lightly/api/serve.py index 08960efd3..bcecc13b7 100644 --- a/lightly/api/serve.py +++ b/lightly/api/serve.py @@ -2,6 +2,7 @@ from pathlib import Path from typing import Sequence from urllib import parse +from __future__ import annotations from lightly.data import _helpers From ad37b037529c6705c54483346f559541d7e71f51 Mon Sep 17 00:00:00 2001 From: Ishaan Agarwal Date: Thu, 3 Oct 2024 18:05:55 +0530 Subject: [PATCH 5/5] Adding formating for serve.py --- lightly/api/serve.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lightly/api/serve.py b/lightly/api/serve.py index bcecc13b7..51e65e863 100644 --- a/lightly/api/serve.py +++ b/lightly/api/serve.py @@ -1,8 +1,9 @@ +from __future__ import annotations + from http.server import SimpleHTTPRequestHandler, ThreadingHTTPServer from pathlib import Path from typing import Sequence from urllib import parse -from __future__ import annotations from lightly.data import _helpers