From 272499e34977df494072ce352e6a139caab12047 Mon Sep 17 00:00:00 2001 From: Art Kay Date: Wed, 24 Sep 2025 23:39:04 -0400 Subject: [PATCH] Fix a number of typos --- chalice/api/__init__.py | 2 +- chalice/cli/factory.py | 2 +- chalice/compat.py | 4 ++-- chalice/deploy/packager.py | 10 +++++----- chalice/deploy/planner.py | 2 +- chalice/deploy/swagger.py | 2 +- chalice/local.py | 10 +++++----- chalice/utils.py | 2 +- docs/source/api.rst | 4 ++-- docs/source/faq.rst | 2 +- docs/source/topics/cd.rst | 2 +- docs/source/topics/packaging.rst | 2 +- docs/source/topics/testing.rst | 2 +- docs/source/upgrading.rst | 4 ++-- scripts/gh-page-docs | 2 +- tests/aws/test_websockets.py | 6 +++--- tests/functional/test_awsclient.py | 2 +- tests/functional/test_local.py | 2 +- tests/functional/test_package.py | 6 +++--- tests/unit/deploy/test_deployer.py | 8 ++++---- tests/unit/deploy/test_swagger.py | 4 ++-- tests/unit/test_app.py | 6 +++--- tests/unit/test_local.py | 4 ++-- 23 files changed, 45 insertions(+), 45 deletions(-) diff --git a/chalice/api/__init__.py b/chalice/api/__init__.py index 98da4bd2e..5eb13cc76 100644 --- a/chalice/api/__init__.py +++ b/chalice/api/__init__.py @@ -1,4 +1,4 @@ -"""Control plane APIs for programatically building/deploying Chalice apps. +"""Control plane APIs for programmatically building/deploying Chalice apps. The eventual goal is to expose this as a public API that other tools can use in their own integrations with Chalice, but this will need time for the APIs diff --git a/chalice/cli/factory.py b/chalice/cli/factory.py index 58fc9ae76..49c581062 100644 --- a/chalice/cli/factory.py +++ b/chalice/cli/factory.py @@ -286,7 +286,7 @@ def load_chalice_app( validate_feature_flags: Optional[bool] = True, ) -> Chalice: # validate_features indicates that we should validate that - # any expiremental features used have the appropriate feature flags. + # any experimental features used have the appropriate feature flags. if self.project_dir not in sys.path: sys.path.insert(0, self.project_dir) # The vendor directory has its contents copied up to the top level of diff --git a/chalice/compat.py b/chalice/compat.py index 188f63dd8..a4ff1cbac 100644 --- a/chalice/compat.py +++ b/chalice/compat.py @@ -80,7 +80,7 @@ def raise_compile_error(*args, **kwargs): # type: ignore ) # On windows the C compiling story is much more complex than on posix as - # there are many different C compilers that setuptools and disutils will + # there are many different C compilers that setuptools and distutils will # try and find using a combination of known filepaths, registry entries, # and environment variables. Since there is no simple environment variable # we can replace when starting the subprocess that builds the package; @@ -108,7 +108,7 @@ def raise_compile_error(*args, **kwargs): # type: ignore # inject _SETUPTOOLS_SHIM rather than the usual SETUPTOOLS_SHIM in pip. # This lets us apply our patches in the same process that will compile # the c extensions before the setup.py file has been executed. - # The actual patches used are decribed in the comment above + # The actual patches used are described in the comment above # _SETUPTOOLS_SHIM. pip_no_compile_c_shim = ( 'import pip;' diff --git a/chalice/deploy/packager.py b/chalice/deploy/packager.py index 018291282..3e3f819d7 100644 --- a/chalice/deploy/packager.py +++ b/chalice/deploy/packager.py @@ -122,7 +122,7 @@ def deployment_package_filename( # based on a hash of the requirements file. # This is done so that we only "pip install -r requirements.txt" # when we know there's new dependencies we need to install. - # The python version these depedencies were downloaded for is appended + # The python version these dependencies were downloaded for is appended # to the end of the filename since the the dependencies may not change # but if the python version changes then the dependencies need to be # re-downloaded since they will not be compatible. @@ -617,8 +617,8 @@ def _has_at_least_one_package(self, filename: str) -> bool: def _download_all_dependencies( self, requirements_filename: str, directory: str ) -> Set[Package]: - # Download dependencies prefering wheel files but falling back to - # raw source dependences to get the transitive closure over + # Download dependencies preferring wheel files but falling back to + # raw source dependencies to get the transitive closure over # the dependency graph. Return the set of all package objects # which will serve as the master list of dependencies needed to deploy # successfully. @@ -714,7 +714,7 @@ def _download_dependencies( # - lambda incompatible wheel files # Pip will give us a wheel when it can, but some distributions do not # ship with wheels at all in which case we will have an sdist for it. - # In some cases a platform specific wheel file may be availble so pip + # In some cases a platform specific wheel file may be available so pip # will have downloaded that, if our platform does not match the # platform lambda runs on (linux_x86_64/manylinux) then the downloaded # wheel file may not be compatible with lambda. Pure python wheels @@ -1131,7 +1131,7 @@ def download_all_dependencies( # When downloading all dependencies we expect to get an rc of 0 back # since we are casting a wide net here letting pip have options about # what to download. If a package is not found it is likely because it - # does not exist and was mispelled. In this case we raise an error with + # does not exist and was misspelled. In this case we raise an error with # the package name. Otherwise a nonzero rc results in a generic # download error where we pass along the stderr. if rc != 0: diff --git a/chalice/deploy/planner.py b/chalice/deploy/planner.py index 986e16091..a22072584 100644 --- a/chalice/deploy/planner.py +++ b/chalice/deploy/planner.py @@ -1448,7 +1448,7 @@ def __eq__(self, other): class PlanEncoder(json.JSONEncoder): - # pylint false positive overriden below + # pylint false positive overridden below # https://github.com/PyCQA/pylint/issues/414 def default(self, o): # pylint: disable=E0202 # type: (Any) -> Any diff --git a/chalice/deploy/swagger.py b/chalice/deploy/swagger.py index 9e78042a6..98590bde1 100644 --- a/chalice/deploy/swagger.py +++ b/chalice/deploy/swagger.py @@ -154,7 +154,7 @@ def _generate_route_method(self, view): if view.api_key_required: # When this happens we also have to add the relevant portions # to the security definitions. We have to someone indicate - # this because this neeeds to be added to the global config + # this because this needs to be added to the global config # file. current.setdefault('security', []).append({'api_key': []}) if view.authorizer: diff --git a/chalice/local.py b/chalice/local.py index 0c13f31ac..c4a126dc6 100644 --- a/chalice/local.py +++ b/chalice/local.py @@ -94,10 +94,10 @@ def __init__(self, target_arn: str) -> None: self._arn = target_arn def _resource_match(self, resource: str) -> bool: - # Arn matching supports two special case characetrs that are not + # Arn matching supports two special case characters that are not # escapable. * represents a glob which translates to a non-greedy # match of any number of characters. ? which is any single character. - # These are easy to translate to a regex using .*? and . respectivly. + # These are easy to translate to a regex using .*? and . respectively. escaped_resource = re.escape(resource) resource_regex = escaped_resource.replace(r'\?', '.').replace( r'\*', '.*?') @@ -279,7 +279,7 @@ def __init__(self, function_name: str, memory_size: int, # documentation: # Information about the client application and device when invoked # through the AWS Mobile SDK, it can be null. - # Chalice local doens't need to set these since they are specifically + # Chalice local does't need to set these since they are specifically # for the mobile SDK. self.identity = None self.client_context = None @@ -330,7 +330,7 @@ def authorize(self, # users to test their code local with a different cognito # authorization flow. warnings.warn( - '%s for machine-to-machine communicaiton is not ' + '%s for machine-to-machine communication is not ' 'supported in local mode. All requests made against ' 'a route will be authorized to allow local testing.' % authorizer.__class__.__name__ @@ -680,7 +680,7 @@ class ThreadedHTTPServer(ThreadingMixIn, HTTPServer): for reuse. In the single threaded model this causes Chalice local to become unresponsive to all clients other than that browser socket. Even sending a header requesting that the client close the connection is not good enough, - the browswer will simply open another one and sit on it. + the browser will simply open another one and sit on it. """ daemon_threads = True diff --git a/chalice/utils.py b/chalice/utils.py index 8fdae547c..3e654a931 100644 --- a/chalice/utils.py +++ b/chalice/utils.py @@ -58,7 +58,7 @@ def remove_stage_from_deployed_values(key: str, filename: str) -> None: with open(filename, 'r') as f: final_values = json.load(f) except IOError: - # If there is no file to delete from, then this funciton is a noop. + # If there is no file to delete from, then this function is a noop. return try: diff --git a/docs/source/api.rst b/docs/source/api.rst index b9ca7613b..7557b3cb8 100644 --- a/docs/source/api.rst +++ b/docs/source/api.rst @@ -1628,7 +1628,7 @@ Websockets .. class:: WebsocketEvent() - Event object event that is passed as the sole arugment to any handler + Event object event that is passed as the sole argument to any handler function decorated with one of the three websocket related handlers: ``on_ws_connect``, ``on_ws_disconnect``, ``on_ws_message``. @@ -1812,7 +1812,7 @@ Testing .. attribute:: headers - A dictionary of HTTP headers in the resopnse. + A dictionary of HTTP headers in the response. .. attribute:: status_code diff --git a/docs/source/faq.rst b/docs/source/faq.rst index 64e3b3b7b..897f927c7 100644 --- a/docs/source/faq.rst +++ b/docs/source/faq.rst @@ -29,7 +29,7 @@ APIs, and decorators to connect various AWS event sources to Lambda functions. It then can integrate with AWS SAM by offloading the deployment to AWS CloudFormation. -**Q: How does Chalice compare to other similiar frameworks?** +**Q: How does Chalice compare to other similar frameworks?** The biggest difference between Chalice and other frameworks is that Chalice is focused on using a familiar, decorator-based API to write serverless diff --git a/docs/source/topics/cd.rst b/docs/source/topics/cd.rst index e59157924..2c501371f 100644 --- a/docs/source/topics/cd.rst +++ b/docs/source/topics/cd.rst @@ -243,7 +243,7 @@ Now we're ready to deploy our CloudFormation template using the AWS CLI. Be sure to replace the ``GithubOwner`` and ``GithubRepoName`` with your own values for your GitHub repository. You'll also need to specify the ``GithubRepoSecretId`` and ``GithubRepoSecretJSONKey`` if you used values -other than the default vaues of ``GithubRepoAccess`` and ``OAuthToken`` when +other than the default values of ``GithubRepoAccess`` and ``OAuthToken`` when creating your secret in Secrets Manager. :: diff --git a/docs/source/topics/packaging.rst b/docs/source/topics/packaging.rst index c1a32e917..c5a9f98a1 100644 --- a/docs/source/topics/packaging.rst +++ b/docs/source/topics/packaging.rst @@ -157,7 +157,7 @@ Environment Variables As part of the packaging and deployment process, Chalice will import your ``app.py`` file. This will result in any top level module code being -executed. This can sometimes have undesireable behavior. +executed. This can sometimes have undesirable behavior. When running any Chalice CLI commands, a ``AWS_CHALICE_CLI_MODE`` environment variable is set. You can check if this env var is set in your ``app.py`` if you have code that you don't want to run whenever your app is packaged diff --git a/docs/source/topics/testing.rst b/docs/source/topics/testing.rst index fe38c6970..0f14a6d82 100644 --- a/docs/source/topics/testing.rst +++ b/docs/source/topics/testing.rst @@ -354,7 +354,7 @@ To test this, we'll combine the botocore stubber and the Chalice test client: In the testcase above, we first tell the stubber what API call we're expecting, along with the parameters we'll send and the response we expect back from the Rekognition service. Next we use the ``with stub:`` line to activate our stubs. -This also ensures that when our test exits that we'll deactive the stubs for +This also ensures that when our test exits that we'll deactivate the stubs for this client. Now we the ``client.lambda_.invoke`` method is called, our stubbed client will return the preconfigured response data instead of making an actual API call to the Rekognition service. diff --git a/docs/source/upgrading.rst b/docs/source/upgrading.rst index 9ddac0c89..a0704b9f4 100644 --- a/docs/source/upgrading.rst +++ b/docs/source/upgrading.rst @@ -328,7 +328,7 @@ transition to this new model, the following changes were made: Previously it would look for a file named ``.chalice/policy.json``. You can also explicitly set this value to In order to ease transition, chalice will check for a - ``.chalice/policy.json`` file when depoying to the ``dev`` stage. + ``.chalice/policy.json`` file when deploying to the ``dev`` stage. Support for ``.chalice/policy.json`` will be removed in future versions of chalice and users are encouraged to switch to the stage specific ``.chalice/policy-.json`` files. @@ -369,7 +369,7 @@ Any of other deployed values that were needed (for example the API Gateway rest API id) was dynamically queried by assuming the resource names matches the app name. In this version of chalice, a separate ``.chalice/deployed.json`` file is written on every -deployement which contains all the resources that have been created. +deployment which contains all the resources that have been created. While this should be a transparent change, you may noticed issues if you run commands such as ``chalice url`` and ``chalice logs`` without first deploying. To fix this issue, run ``chalice deploy`` diff --git a/scripts/gh-page-docs b/scripts/gh-page-docs index 6f2437ba2..88758478b 100755 --- a/scripts/gh-page-docs +++ b/scripts/gh-page-docs @@ -46,7 +46,7 @@ rsync -av --delete --exclude '.git' build/html/ ${CHECKOUT_DIR}/ # paths. touch ${CHECKOUT_DIR}/.nojekyll -echo "Commiting docs." +echo "Committing docs." cd ${CHECKOUT_DIR} git add -A . git commit -am "Updating generated documentation" diff --git a/tests/aws/test_websockets.py b/tests/aws/test_websockets.py index a42275c98..2fc2aa152 100644 --- a/tests/aws/test_websockets.py +++ b/tests/aws/test_websockets.py @@ -304,10 +304,10 @@ def find_skips_in_seq(numbers): def test_websocket_redployment_does_not_lose_messages(smoke_test_app_ws): - # This test is to check if one persistant connection is affected by an app - # redeployment. A connetion is made to the app, and a sequence of numbers + # This test is to check if one persistent connection is affected by an app + # redeployment. A connection is made to the app, and a sequence of numbers # is sent over the socket and written to a DynamoDB table. The app is - # redeployed in a seprate thread. After the redeployment we wait a + # redeployed in a separate thread. After the redeployment we wait a # second to ensure more numbers have been sent. Finally we inspect the # DynamoDB table to ensure there are no gaps in the numbers we saw on the # server side, and that the first and last number we sent is also present. diff --git a/tests/functional/test_awsclient.py b/tests/functional/test_awsclient.py index c565dd79e..ee7dc91c6 100644 --- a/tests/functional/test_awsclient.py +++ b/tests/functional/test_awsclient.py @@ -2009,7 +2009,7 @@ def test_create_function_propagates_unknown_error(self, stubbed_session): stubbed_session.activate_stubs() awsclient = TypedAWSClient(stubbed_session, mock.Mock(spec=time.sleep)) with pytest.raises(LambdaClientError) as excinfo: - awsclient.create_function('name', 'myarn', b'foo', 'pytohn2.7', + awsclient.create_function('name', 'myarn', b'foo', 'python2.7', 'app.app') assert isinstance( excinfo.value.original_error, botocore.exceptions.ClientError) diff --git a/tests/functional/test_local.py b/tests/functional/test_local.py index 2be412115..df9f93cd0 100644 --- a/tests/functional/test_local.py +++ b/tests/functional/test_local.py @@ -250,7 +250,7 @@ def test_can_accept_multiple_connections(config, sample_app, local_server_factory): # When a GET request is made to Chalice from a browser, it will send the # connection keep-alive header in order to hold the connection open and - # reuse it for subsequent requests. If the conncetion close header is sent + # reuse it for subsequent requests. If the connection close header is sent # back by the server the connection will be closed, but the browser will # reopen a new connection just in order to have it ready when needed. # In this case, since it does not send any content we do not have the diff --git a/tests/functional/test_package.py b/tests/functional/test_package.py index afdc28241..b56883fdf 100644 --- a/tests/functional/test_package.py +++ b/tests/functional/test_package.py @@ -543,7 +543,7 @@ def test_does_ignore_include(self, tmpdir, pip_runner): assert 'bar' not in installed_packages def test_does_ignore_scripts(self, tmpdir, pip_runner): - # Make sure the wheel isntaller does not copy the scripts directory + # Make sure the wheel installer does not copy the scripts directory # up to the root. reqs = ['foo'] pip, runner = pip_runner @@ -990,7 +990,7 @@ def test_can_create_app_packager_with_no_autogen(tmpdir, stubbed_session): assert 'sam.json' in contents -def test_can_create_app_packager_with_yaml_extention(tmpdir, stubbed_session): +def test_can_create_app_packager_with_yaml_extension(tmpdir, stubbed_session): appdir = _create_app_structure(tmpdir) outdir = tmpdir.mkdir('outdir') @@ -1094,7 +1094,7 @@ def test_does_error_code_propagate(self): rc, _, err = pip.main(['badcommand']) assert rc != 0 # Don't want to depend on a particular error message from pip since it - # may change if we pin a differnet version to Chalice at some point. + # may change if we pin a different version to Chalice at some point. # But there should be a non-empty error message of some kind. assert err != b'' diff --git a/tests/unit/deploy/test_deployer.py b/tests/unit/deploy/test_deployer.py index 0fbe1b9bc..c1398f4f7 100644 --- a/tests/unit/deploy/test_deployer.py +++ b/tests/unit/deploy/test_deployer.py @@ -143,7 +143,7 @@ def test_lambda_client_error_wording_for_update(self): def test_gives_where_and_suggestion_for_too_large_deployment_error(self): too_large_error = DeploymentPackageTooLargeError( - Exception('Too large of deployment pacakge'), + Exception('Too large of deployment package'), context=LambdaErrorContext( function_name='foo', client_method_name='create_function', @@ -156,7 +156,7 @@ def test_gives_where_and_suggestion_for_too_large_deployment_error(self): 'ERROR - While sending your chalice handler code to ' 'Lambda to create function \n"foo"' in deploy_error_msg ) - assert 'Too large of deployment pacakge' in deploy_error_msg + assert 'Too large of deployment package' in deploy_error_msg assert ( 'To avoid this error, decrease the size of your chalice ' 'application ' in deploy_error_msg @@ -164,7 +164,7 @@ def test_gives_where_and_suggestion_for_too_large_deployment_error(self): def test_include_size_context_for_too_large_deployment_error(self): too_large_error = DeploymentPackageTooLargeError( - Exception('Too large of deployment pacakge'), + Exception('Too large of deployment package'), context=LambdaErrorContext( function_name='foo', client_method_name='create_function', @@ -331,7 +331,7 @@ def test_can_compares_with_identity_not_equality(self): deps = dep_builder.build_dependencies(app) assert deps == [first_leaf, first_parent, second_leaf, second_parent] - def test_no_duplicate_depedencies(self): + def test_no_duplicate_dependencies(self): leaf = LeafResource(name='leaf') second_parent = FooResource(name='second', leaf=leaf) first_parent = FooResource(name='first', leaf=[leaf, second_parent]) diff --git a/tests/unit/deploy/test_swagger.py b/tests/unit/deploy/test_swagger.py index ceadadb45..900a94a78 100644 --- a/tests/unit/deploy/test_swagger.py +++ b/tests/unit/deploy/test_swagger.py @@ -840,7 +840,7 @@ def test_can_custom_resource_policy(sample_app, swagger_gen): "Action": "execute-api:Invoke", "Resource": [ "arn:aws:execute-api:*:*:*", - "arn:aws:exceute-api:*:*:*/*" + "arn:aws:execute-api:*:*:*/*" ], "Condition": { "StringEquals": { @@ -861,7 +861,7 @@ def test_can_custom_resource_policy(sample_app, swagger_gen): 'Principal': '*', 'Resource': [ 'arn:aws:execute-api:*:*:*', - "arn:aws:exceute-api:*:*:*/*"] + "arn:aws:execute-api:*:*:*/*"] }] } diff --git a/tests/unit/test_app.py b/tests/unit/test_app.py index ea33f3ce3..72fd61a2c 100644 --- a/tests/unit/test_app.py +++ b/tests/unit/test_app.py @@ -1735,7 +1735,7 @@ def test_can_explicitly_set_debug_false_in_initializer(): assert test_app.log.getEffectiveLevel() == logging.ERROR -def test_can_set_debug_mode_in_initialzier(): +def test_can_set_debug_mode_in_initializer(): test_app = app.Chalice('logger-test-3', debug=True) assert test_app.debug is True assert test_app.log.getEffectiveLevel() == logging.DEBUG @@ -3177,7 +3177,7 @@ def disconnect_handler(event): with pytest.raises(ValueError) as e: @demo.on_ws_disconnect() - def disconncet_handler_2(event): + def disconnect_handler_2(event): pass assert str(e.value) == ( @@ -3658,7 +3658,7 @@ def handler(event): {'name': 'bp_handler', 'bucket': 'mybucket'}, ] - def test_blueprint_gets_middlware_added(self): + def test_blueprint_gets_middleware_added(self): demo = app.Chalice('app-name') bp = app.Blueprint('bpmiddleware') called = [] diff --git a/tests/unit/test_local.py b/tests/unit/test_local.py index 59fe029c9..a6c69397e 100644 --- a/tests/unit/test_local.py +++ b/tests/unit/test_local.py @@ -42,7 +42,7 @@ def __init__(self, times): def time(self): """Get the next time. - This is for mimicing the Clock interface used in local. + This is for mimicking the Clock interface used in local. """ time = self._times.pop(0) return time @@ -1051,7 +1051,7 @@ def test_does_authorize_unsupported_cognito_token(self, warning = recorded_warnings[0] assert issubclass(warning.category, UserWarning) assert ('CognitoUserPoolAuthorizer for machine-to-machine ' - 'communicaiton is not supported in local mode. All requests ' + 'communication is not supported in local mode. All requests ' 'made against a route will be authorized to allow local ' 'testing.') in str(warning.message)