From d0fa9f32d71c0addf14414c9725f10320bad99e0 Mon Sep 17 00:00:00 2001 From: Kian-Meng Ang Date: Mon, 28 Oct 2024 00:10:18 +0800 Subject: [PATCH] fix typos again Found via `codespell -H` --- SSGI.md | 2 +- bench/asgi_wsgi/raw-wsgi.py | 2 +- docs/cli.md | 2 +- examples/forks.py | 2 +- examples/middleware_sync.py | 2 +- src/socketify/asgi.py | 4 ++-- src/socketify/cli.py | 8 ++++---- src/socketify/helpers.py | 10 +++++----- src/socketify/loop.py | 6 +++--- src/socketify/ssgi.py | 2 +- src/socketify/wsgi.py | 8 ++++---- 11 files changed, 24 insertions(+), 24 deletions(-) diff --git a/SSGI.md b/SSGI.md index a4dfed9..be5e314 100644 --- a/SSGI.md +++ b/SSGI.md @@ -15,7 +15,7 @@ class SSGIHttpResponse: # send chunk of data, can be used to perform with less backpressure than using send # total_size is the sum of all lengths in bytes of all chunks to be sended # connection will end when total_size is met - # returns tuple(bool, bool) first bool represents if the chunk is succefully sended, the second if the connection has ended + # returns tuple(bool, bool) first bool represents if the chunk is successfully sended, the second if the connection has ended def send_chunk(self, chunk: Union[str, bytes, bytearray, memoryview], total_size: int = False) -> Awaitable: pass diff --git a/bench/asgi_wsgi/raw-wsgi.py b/bench/asgi_wsgi/raw-wsgi.py index 5bf556b..5aabaea 100644 --- a/bench/asgi_wsgi/raw-wsgi.py +++ b/bench/asgi_wsgi/raw-wsgi.py @@ -64,7 +64,7 @@ if __name__ == "__main__": # run_app() # run app on the main process too :) - # # sigint everything to gracefull shutdown + # # sigint everything to graceful shutdown # import signal # for pid in pid_list: # os.kill(pid, signal.SIGINT) diff --git a/docs/cli.md b/docs/cli.md index e9f365f..6b57945 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -30,7 +30,7 @@ Options: --ws-close-on-backpressure-limit BOOLEAN Close connections that hits maximum backpressure [default: False] --lifespan [auto|on|off] Lifespan implementation. [default: auto] --interface [auto|asgi|asgi3|wsgi|ssgi|socketify] Select ASGI (same as ASGI3), ASGI3, WSGI or SSGI as the application interface. [default: auto] - --disable-listen-log BOOLEAN Disable log when start listenning [default: False] + --disable-listen-log BOOLEAN Disable log when start listening [default: False] --version or -v Display the socketify.py version and exit. --ssl-keyfile TEXT SSL key file --ssl-certfile TEXT SSL certificate file diff --git a/examples/forks.py b/examples/forks.py index d9db962..913fb99 100644 --- a/examples/forks.py +++ b/examples/forks.py @@ -27,7 +27,7 @@ for _ in range(1, multiprocessing.cpu_count()): run_app() # run app on the main process too :) -# sigint everything to gracefull shutdown +# sigint everything to graceful shutdown import signal for pid in pid_list: os.kill(pid, signal.SIGINT) \ No newline at end of file diff --git a/examples/middleware_sync.py b/examples/middleware_sync.py index ead6a91..30e50e6 100644 --- a/examples/middleware_sync.py +++ b/examples/middleware_sync.py @@ -6,7 +6,7 @@ from socketify import App def middleware(*functions): def middleware_route(res, req): data = None - # cicle to all middlewares + # circle to all middlewares for function in functions: # call middlewares data = function(res, req, data) diff --git a/src/socketify/asgi.py b/src/socketify/asgi.py index 8446974..27b7ff3 100644 --- a/src/socketify/asgi.py +++ b/src/socketify/asgi.py @@ -688,7 +688,7 @@ class _ASGI: asgi_app = self self.is_starting = True self.is_stopped = False - self.status = 0 # 0 starting, 1 ok, 2 error, 3 stoping, 4 stopped, 5 stopped with error, 6 no lifespan + self.status = 0 # 0 starting, 1 ok, 2 error, 3 stopping, 4 stopped, 5 stopped with error, 6 no lifespan self.status_message = "" self.stop_future = self.server.loop.create_future() @@ -850,7 +850,7 @@ class ASGI: if block: run_task() # run app on the main process too :) - # sigint everything to gracefull shutdown + # sigint everything to graceful shutdown import signal for pid in pid_list: os.kill(pid, signal.SIGINT) diff --git a/src/socketify/cli.py b/src/socketify/cli.py index 5f86242..a86fbb1 100644 --- a/src/socketify/cli.py +++ b/src/socketify/cli.py @@ -28,7 +28,7 @@ Options: --ws-close-on-backpressure-limit BOOLEAN Close connections that hits maximum backpressure [default: False] --lifespan [auto|on|off] Lifespan implementation. [default: auto] --interface [auto|asgi|asgi3|wsgi|ssgi|socketify] Select ASGI (same as ASGI3), ASGI3, WSGI or SSGI as the application interface. [default: auto] - --disable-listen-log BOOLEAN Disable log when start listenning [default: False] + --disable-listen-log BOOLEAN Disable log when start listening [default: False] --version or -v Display the socketify.py version and exit. --ssl-keyfile TEXT SSL key file --ssl-certfile TEXT SSL certificate file @@ -188,10 +188,10 @@ def execute(args): elif interface == "ssgi": # if not is_ssgi(module): - # return print("SSGI is in development yet but is comming soon") + # return print("SSGI is in development yet but is coming soon") # from . import SSGI as Interface # interface = "ssgi" - return print("SSGI is in development yet but is comming soon") + return print("SSGI is in development yet but is coming soon") elif interface != "socketify": return print(f"{interface} interface is not supported yet") @@ -322,7 +322,7 @@ def execute(args): run_app() # run app on the main process too :) - # sigint everything to gracefull shutdown + # sigint everything to graceful shutdown import signal for pid in pid_list: os.kill(pid, signal.SIGINT) diff --git a/src/socketify/helpers.py b/src/socketify/helpers.py index 585d53c..b1a6d75 100644 --- a/src/socketify/helpers.py +++ b/src/socketify/helpers.py @@ -70,7 +70,7 @@ async def sendfile(res, req, filename): def send_headers(res): res.write_status(status) - # tells the broswer the last modified date + # tells the browser the last modified date res.write_header(b"Last-Modified", last_modified) # tells the browser that we support range @@ -147,7 +147,7 @@ def middleware(*functions): # we use Optional data=None at the end so you can use and middleware inside a middleware def optimized_middleware_route(res, req, data=None): - # cicle to all middlewares + # circle to all middlewares for function in syncs: # call middlewares data = function(res, req, data) @@ -156,7 +156,7 @@ def middleware(*functions): return async def wrapper(res, req, data): - # cicle to all middlewares + # circle to all middlewares for function in asyncs: # detect if is coroutine or not if inspect.iscoroutinefunction(function): @@ -182,7 +182,7 @@ def middleware(*functions): def sync_middleware(*functions): # we use Optional data=None at the end so you can use and middleware inside a middleware def middleware_route(res, req, data=None): - # cicle to all middlewares + # circle to all middlewares for function in functions: # call middlewares data = function(res, req, data) @@ -198,7 +198,7 @@ def async_middleware(*functions): # we use Optional data=None at the end so you can use and middleware inside a middleware async def middleware_route(res, req, data=None): some_async_as_run = False - # cicle to all middlewares + # circle to all middlewares for function in functions: # detect if is coroutine or not if inspect.iscoroutinefunction(function): diff --git a/src/socketify/loop.py b/src/socketify/loop.py index 4ad1d35..24b0f60 100644 --- a/src/socketify/loop.py +++ b/src/socketify/loop.py @@ -101,7 +101,7 @@ class Loop: self.loop.call_later(self.idle_relaxation_time, self._keep_alive) else: self.uv_loop.run_nowait() - # be more agressive when needed + # be more aggressive when needed self.loop.call_soon(self._keep_alive) def create_task(self, *args, **kwargs): @@ -194,7 +194,7 @@ class Loop: return self.uv_loop.get_native_loop() def _run_async_pypy(self, task, response=None): - # this garanties error 500 in case of uncaught exceptions, and can trigger the custom error handler + # this guarantees error 500 in case of uncaught exceptions, and can trigger the custom error handler # using an coroutine wrapper generates less overhead than using add_done_callback # this is an custom task/future with less overhead and that calls the first step future = self._task_factory( @@ -203,7 +203,7 @@ class Loop: return None # this future maybe already done and reused not safe to await def _run_async_cpython(self, task, response=None): - # this garanties error 500 in case of uncaught exceptions, and can trigger the custom error handler + # this guarantees error 500 in case of uncaught exceptions, and can trigger the custom error handler # using an coroutine wrapper generates less overhead than using add_done_callback # this is an custom task/future with less overhead and that calls the first step future = create_task(self.loop, task_wrapper(self.exception_handler, self.loop, response, task)) diff --git a/src/socketify/ssgi.py b/src/socketify/ssgi.py index 2372269..00b203e 100644 --- a/src/socketify/ssgi.py +++ b/src/socketify/ssgi.py @@ -25,7 +25,7 @@ class SSGIHttpResponse: # send chunk of data, can be used to perform with less backpressure than using send # total_size is the sum of all lengths in bytes of all chunks to be sended # connection will end when total_size is met - # returns tuple(bool, bool) first bool represents if the chunk is succefully sended, the second if the connection has ended + # returns tuple(bool, bool) first bool represents if the chunk is successfully sended, the second if the connection has ended def send_chunk(self, chunk: Union[bytes, bytearray, memoryview], total_size: int) -> Awaitable: return self.res.send_chunk(chunk, total_size) diff --git a/src/socketify/wsgi.py b/src/socketify/wsgi.py index 7cbd137..a32e053 100644 --- a/src/socketify/wsgi.py +++ b/src/socketify/wsgi.py @@ -444,7 +444,7 @@ def wsgi(ssl, response, info, user_data): app._data_refs[_id] = data_retry lib.uws_res_on_aborted(ssl, response, wsgi_on_data_ref_abort_handler, data_retry._ptr) lib.uws_res_on_writable(ssl, response, wsgi_on_writable_handler, data_retry._ptr) - elif result is None or (not bool(result.has_responded) and bool(result.ok)): # not reachs Content-Length + elif result is None or (not bool(result.has_responded) and bool(result.ok)): # not reaches Content-Length logging.error(AssertionError("Content-Length do not match sended content")) lib.uws_res_close( ssl, @@ -495,7 +495,7 @@ def wsgi(ssl, response, info, user_data): content_length, 0, ) - # this should be very very rare fot HTTP + # this should be very very rare for HTTP if not bool(result.ok): failed_chunks = [] # just mark the chunks @@ -522,7 +522,7 @@ def wsgi(ssl, response, info, user_data): app._data_refs[_id] = data_retry lib.uws_res_on_aborted(ssl, response, wsgi_on_data_ref_abort_handler, data_retry._ptr) lib.uws_res_on_writable(ssl, response, wsgi_on_writable_handler, data_retry._ptr) - elif result is None or (not bool(result.has_responded) and bool(result.ok)): # not reachs Content-Length + elif result is None or (not bool(result.has_responded) and bool(result.ok)): # not reaches Content-Length logging.error(AssertionError("Content-Length do not match sended content")) lib.uws_res_close( ssl, @@ -768,7 +768,7 @@ class WSGI: if block: run_task() # run app on the main process too :) - # sigint everything to gracefull shutdown + # sigint everything to graceful shutdown import signal for pid in pid_list: os.kill(pid, signal.SIGINT)