From 43a3fecbd2db57bfa99e832aef30c5055b703040 Mon Sep 17 00:00:00 2001 From: Bert Blommers Date: Sun, 16 Oct 2022 20:31:19 +0000 Subject: [PATCH] TechDebt - remove print statements (#5571) --- moto/appsync/responses.py | 2 -- moto/batch/responses.py | 5 +---- moto/moto_server/threaded_moto_server.py | 2 +- moto/moto_server/werkzeug_app.py | 2 +- moto/settings.py | 6 +++--- moto/xray/mock_client.py | 2 +- requirements-dev.txt | 1 + 7 files changed, 8 insertions(+), 12 deletions(-) diff --git a/moto/appsync/responses.py b/moto/appsync/responses.py index cc712da97..0a51bf8b1 100644 --- a/moto/appsync/responses.py +++ b/moto/appsync/responses.py @@ -57,8 +57,6 @@ class AppSyncResponse(BaseResponse): def tags(self, request: Any, full_url: str, headers: Any) -> TYPE_RESPONSE: # type: ignore[return] self.setup_class(request, full_url, headers) - print("tags") - print(request.method) if request.method == "POST": return self.tag_resource() if request.method == "DELETE": diff --git a/moto/batch/responses.py b/moto/batch/responses.py index ee6c97c7f..fa86458b4 100644 --- a/moto/batch/responses.py +++ b/moto/batch/responses.py @@ -25,10 +25,7 @@ class BatchResponse(BaseResponse): if self.body is None or self.body == "": self._json = {} elif not hasattr(self, "_json"): - try: - self._json = json.loads(self.body) - except ValueError: - print() + self._json = json.loads(self.body) return self._json def _get_param(self, param_name, if_none=None): diff --git a/moto/moto_server/threaded_moto_server.py b/moto/moto_server/threaded_moto_server.py index 1f1e91335..70333e282 100644 --- a/moto/moto_server/threaded_moto_server.py +++ b/moto/moto_server/threaded_moto_server.py @@ -25,7 +25,7 @@ class ThreadedMotoServer: def start(self): if self._verbose: - print( + print( # noqa f"Starting a new Thread with MotoServer running on {self._ip_address}:{self._port}..." ) self._thread = Thread(target=self._server_entry, daemon=True) diff --git a/moto/moto_server/werkzeug_app.py b/moto/moto_server/werkzeug_app.py index 107eae0b1..343bfe640 100644 --- a/moto/moto_server/werkzeug_app.py +++ b/moto/moto_server/werkzeug_app.py @@ -78,7 +78,7 @@ class DomainDispatcherApplication(object): return backend if "amazonaws.com" in host: - print( + print( # noqa "Unable to find appropriate backend for {}." "Remember to add the URL to urls.py, and run scripts/update_backend_index.py to index it.".format( host diff --git a/moto/settings.py b/moto/settings.py index 65ceaeb4d..b6ece4171 100644 --- a/moto/settings.py +++ b/moto/settings.py @@ -118,15 +118,15 @@ def get_docker_host(): else: _ip = network_settings["IPAddress"] if network_name: - print( + print( # noqa f"WARNING - Moto couldn't find network '{network_name}' - defaulting to {_ip}" ) return f"http://{_ip}" except Exception as e: # noqa - print( + print( # noqa "WARNING - Unable to parse Docker API response. Defaulting to 'host.docker.internal'" ) - print(f"{type(e)}::{e}") + print(f"{type(e)}::{e}") # noqa return "http://host.docker.internal" diff --git a/moto/xray/mock_client.py b/moto/xray/mock_client.py index b64d6e165..eca1ffe5b 100644 --- a/moto/xray/mock_client.py +++ b/moto/xray/mock_client.py @@ -56,7 +56,7 @@ class MockXrayClient: return wrapped_f def start(self): - print("Starting X-Ray Patch") + print("Starting X-Ray Patch") # noqa self.old_xray_context_var = os.environ.get("AWS_XRAY_CONTEXT_MISSING") os.environ["AWS_XRAY_CONTEXT_MISSING"] = "LOG_ERROR" self.old_xray_context = aws_xray_sdk.core.xray_recorder._context diff --git a/requirements-dev.txt b/requirements-dev.txt index 7539ff1a5..155063c2f 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -3,6 +3,7 @@ black==22.3.0 flake8==4.0.1 +flake8-print click inflection lxml