From ab35121864848054c23725c24818ee926cfaad71 Mon Sep 17 00:00:00 2001 From: Kian Meng Ang Date: Mon, 6 Dec 2021 15:17:01 +0800 Subject: [PATCH] Fix typos (#2329) * Fix typos * Downgrade mistune version * Fix blueprint host param Co-authored-by: Adam Hopkins Co-authored-by: Adam Hopkins --- CHANGELOG.rst | 6 +++--- examples/amending_request_object.py | 2 +- sanic/app.py | 2 +- sanic/blueprints.py | 4 ++-- sanic/headers.py | 2 +- sanic/helpers.py | 2 +- sanic/router.py | 2 +- sanic/tls.py | 2 +- sanic/utils.py | 6 +++--- scripts/release.py | 2 +- setup.py | 1 + tests/test_request_data.py | 2 +- 12 files changed, 17 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index a9940da1..5f09fd51 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -657,7 +657,7 @@ Improved Documentation Version 20.6.0 --------------- -*Released, but unintentionally ommitting PR #1880, so was replaced by 20.6.1* +*Released, but unintentionally omitting PR #1880, so was replaced by 20.6.1* Version 20.3.0 @@ -1090,7 +1090,7 @@ Version 18.12 * Fix Range header handling for static files (#1402) * Fix the logger and make it work (#1397) * Fix type pikcle->pickle in multiprocessing test - * Fix pickling blueprints Change the string passed in the "name" section of the namedtuples in Blueprint to match the name of the Blueprint module attribute name. This allows blueprints to be pickled and unpickled, without errors, which is a requirment of running Sanic in multiprocessing mode in Windows. Added a test for pickling and unpickling blueprints Added a test for pickling and unpickling sanic itself Added a test for enabling multiprocessing on an app with a blueprint (only useful to catch this bug if the tests are run on Windows). + * Fix pickling blueprints Change the string passed in the "name" section of the namedtuples in Blueprint to match the name of the Blueprint module attribute name. This allows blueprints to be pickled and unpickled, without errors, which is a requirement of running Sanic in multiprocessing mode in Windows. Added a test for pickling and unpickling blueprints Added a test for pickling and unpickling sanic itself Added a test for enabling multiprocessing on an app with a blueprint (only useful to catch this bug if the tests are run on Windows). * Fix document for logging Version 0.8 @@ -1129,7 +1129,7 @@ Version 0.8 * Content-length header on 204/304 responses (Arnulfo Solís) * Extend WebSocketProtocol arguments and add docs (Bob Olde Hampsink, yunstanford) * Update development status from pre-alpha to beta (Maksim Anisenkov) - * KeepAlive Timout log level changed to debug (Arnulfo Solís) + * KeepAlive Timeout log level changed to debug (Arnulfo Solís) * Pin pytest to 3.3.2 because of pytest-dev/pytest#3170 (Maksim Aniskenov) * Install Python 3.5 and 3.6 on docker container for tests (Shahin Azad) * Add support for blueprint groups and nesting (Elias Tarhini) diff --git a/examples/amending_request_object.py b/examples/amending_request_object.py index 7fe25bdd..366dd67d 100644 --- a/examples/amending_request_object.py +++ b/examples/amending_request_object.py @@ -23,7 +23,7 @@ def key_exist_handler(request): if hasattr(request.ctx, "num"): return text("num exist in request") - return text("num does not exist in reqeust") + return text("num does not exist in request") app.run(host="0.0.0.0", port=8000, debug=True) diff --git a/sanic/app.py b/sanic/app.py index 6861bca0..5c0a010e 100644 --- a/sanic/app.py +++ b/sanic/app.py @@ -337,7 +337,7 @@ class Sanic(BaseSanic, metaclass=TouchUpMeta): """ Method for attaching middleware to specific routes. This is mainly an internal tool for use by Blueprints to attach middleware to only its - specfic routes. But, it could be used in a more generalized fashion. + specific routes. But, it could be used in a more generalized fashion. :param middleware: the middleware to execute :param route_names: a list of the names of the endpoints diff --git a/sanic/blueprints.py b/sanic/blueprints.py index 290773fa..6a6c2e82 100644 --- a/sanic/blueprints.py +++ b/sanic/blueprints.py @@ -79,7 +79,7 @@ class Blueprint(BaseSanic): :param name: unique name of the blueprint :param url_prefix: URL to be prefixed before all route URLs - :param host: IP Address of FQDN for the sanic server to use. + :param host: IP Address or FQDN for the sanic server to use. :param version: Blueprint Version :param strict_slashes: Enforce the API urls are requested with a trailing */* @@ -112,7 +112,7 @@ class Blueprint(BaseSanic): self, name: str = None, url_prefix: Optional[str] = None, - host: Optional[str] = None, + host: Optional[Union[List[str], str]] = None, version: Optional[Union[int, str, float]] = None, strict_slashes: Optional[bool] = None, version_prefix: str = "/v", diff --git a/sanic/headers.py b/sanic/headers.py index dbb8720f..b744974c 100644 --- a/sanic/headers.py +++ b/sanic/headers.py @@ -28,7 +28,7 @@ _host_re = re.compile( # RFC's quoted-pair escapes are mostly ignored by browsers. Chrome, Firefox and # curl all have different escaping, that we try to handle as well as possible, -# even though no client espaces in a way that would allow perfect handling. +# even though no client escapes in a way that would allow perfect handling. # For more information, consult ../tests/test_requests.py diff --git a/sanic/helpers.py b/sanic/helpers.py index 87d51b53..c5c10ccc 100644 --- a/sanic/helpers.py +++ b/sanic/helpers.py @@ -144,7 +144,7 @@ def import_string(module_name, package=None): import a module or class by string path. :module_name: str with path of module or path to import and - instanciate a class + instantiate a class :returns: a module object or one instance from class if module_name is a valid path to class diff --git a/sanic/router.py b/sanic/router.py index b15c2a3e..bad471c6 100644 --- a/sanic/router.py +++ b/sanic/router.py @@ -54,7 +54,7 @@ class Router(BaseRouter): self, path: str, method: str, host: Optional[str] ) -> Tuple[Route, RouteHandler, Dict[str, Any]]: """ - Retrieve a `Route` object containg the details about how to handle + Retrieve a `Route` object containing the details about how to handle a response for a given request :param request: the incoming request object diff --git a/sanic/tls.py b/sanic/tls.py index e0f9151a..be30f4a2 100644 --- a/sanic/tls.py +++ b/sanic/tls.py @@ -175,7 +175,7 @@ def match_hostname( def selector_sni_callback( sslobj: ssl.SSLObject, server_name: str, ctx: CertSelector ) -> Optional[int]: - """Select a certificate mathing the SNI.""" + """Select a certificate matching the SNI.""" # Call server_name_callback to store the SNI on sslobj server_name_callback(sslobj, server_name, ctx) # Find a new context matching the hostname diff --git a/sanic/utils.py b/sanic/utils.py index ef91ec9d..51d94d08 100644 --- a/sanic/utils.py +++ b/sanic/utils.py @@ -48,7 +48,7 @@ def load_module_from_file_location( """Returns loaded module provided as a file path. :param args: - Coresponds to importlib.util.spec_from_file_location location + Corresponds to importlib.util.spec_from_file_location location parameters,but with this differences: - It has to be of a string or bytes type. - You can also use here environment variables @@ -58,10 +58,10 @@ def load_module_from_file_location( If location parameter is of a bytes type, then use this encoding to decode it into string. :param args: - Coresponds to the rest of importlib.util.spec_from_file_location + Corresponds to the rest of importlib.util.spec_from_file_location parameters. :param kwargs: - Coresponds to the rest of importlib.util.spec_from_file_location + Corresponds to the rest of importlib.util.spec_from_file_location parameters. For example You can: diff --git a/scripts/release.py b/scripts/release.py index 488ebe2b..e2b9b887 100755 --- a/scripts/release.py +++ b/scripts/release.py @@ -310,7 +310,7 @@ if __name__ == "__main__": cli.add_argument( "--milestone", "-ms", - help="Git Release milestone information to include in relase note", + help="Git Release milestone information to include in release note", required=False, ) cli.add_argument( diff --git a/setup.py b/setup.py index 3bc11f8e..36de0c4f 100644 --- a/setup.py +++ b/setup.py @@ -121,6 +121,7 @@ docs_require = [ "docutils", "pygments", "m2r2", + "mistune<2.0.0", ] dev_require = tests_require + [ diff --git a/tests/test_request_data.py b/tests/test_request_data.py index f5bfabda..a1b78e95 100644 --- a/tests/test_request_data.py +++ b/tests/test_request_data.py @@ -17,7 +17,7 @@ def test_custom_context(app): @app.route("/") def handler(request): - # Accessing non-existant key should fail with AttributeError + # Accessing non-existent key should fail with AttributeError try: invalid = request.ctx.missing except AttributeError as e: