From c910565b9aba25a65b98f87dad9c3a16b1318c6d Mon Sep 17 00:00:00 2001 From: Pavel Minaev Date: Wed, 30 Oct 2019 14:35:38 -0700 Subject: [PATCH] Blacken code. --- pyproject.toml | 1 + src/ptvsd/adapter/__main__.py | 6 ++---- src/ptvsd/server/api.py | 11 ++++------- tests/ptvsd/server/test_breakpoints.py | 6 ------ tests/ptvsd/server/test_output.py | 14 +++++--------- 5 files changed, 12 insertions(+), 26 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 40b34b0a..4ad6ecae 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,6 +8,7 @@ build-backend = "setuptools.build_meta" # The only exclusions that should remain in the end are _vendored and versioneer. exclude = ''' ( __pycache__ +| ^/.tox | ^/versioneer.py | ^/src/ptvsd/_vendored | ^/src/ptvsd/_version.py diff --git a/src/ptvsd/adapter/__main__.py b/src/ptvsd/adapter/__main__.py index c21d0978..a0061027 100644 --- a/src/ptvsd/adapter/__main__.py +++ b/src/ptvsd/adapter/__main__.py @@ -40,7 +40,7 @@ def main(args): if args.for_enable_attach: endpoints = { "ide": {"host": ide_host, "port": ide_port}, - "server": {"host": server_host, "port": server_port} + "server": {"host": server_host, "port": server_port}, } log.info("Sending endpoints to stdout: {0!r}", endpoints) print(json.dumps(endpoints)) @@ -76,9 +76,7 @@ def _parse_argv(argv): ) parser.add_argument( - "--for-enable-attach", - action="store_true", - help=argparse.SUPPRESS, + "--for-enable-attach", action="store_true", help=argparse.SUPPRESS ) parser.add_argument( diff --git a/src/ptvsd/server/api.py b/src/ptvsd/server/api.py index 944ef1c2..961136cd 100644 --- a/src/ptvsd/server/api.py +++ b/src/ptvsd/server/api.py @@ -81,6 +81,7 @@ def enable_attach(dont_trace_start_patterns, dont_trace_end_patterns): raise RuntimeError("enable_attach() can only be called once per process.") import subprocess + adapter_args = [ sys.executable, _ADAPTER_PATH, @@ -98,11 +99,7 @@ def enable_attach(dont_trace_start_patterns, dont_trace_end_patterns): # Adapter life time is expected to be longer than this process, # so never wait on the adapter process - process = subprocess.Popen( - adapter_args, - bufsize=0, - stdout=subprocess.PIPE, - ) + process = subprocess.Popen(adapter_args, bufsize=0, stdout=subprocess.PIPE) line = process.stdout.readline() if isinstance(line, bytes): @@ -110,7 +107,7 @@ def enable_attach(dont_trace_start_patterns, dont_trace_end_patterns): connection_details = json.JSONDecoder().decode(line) log.info("Connection details received from adapter: {0!r}", connection_details) - host = "127.0.0.1" # This should always be loopback address. + host = "127.0.0.1" # This should always be loopback address. port = connection_details["server"]["port"] pydevd.settrace( @@ -128,7 +125,7 @@ def enable_attach(dont_trace_start_patterns, dont_trace_end_patterns): # Ensure that we ignore the adapter process when terminating the debugger. pydevd.add_dont_terminate_child_pid(process.pid) - server_opts.port = connection_details["ide"]["port"] + server_opts.port = connection_details["ide"]["port"] listener_file = os.getenv("PTVSD_LISTENER_FILE") if listener_file is not None: diff --git a/tests/ptvsd/server/test_breakpoints.py b/tests/ptvsd/server/test_breakpoints.py index e8c1145f..812ebd43 100644 --- a/tests/ptvsd/server/test_breakpoints.py +++ b/tests/ptvsd/server/test_breakpoints.py @@ -101,7 +101,6 @@ def test_conditional_breakpoint(pyfile, target, run, condition_kind, condition): def test_crossfile_breakpoint(pyfile, target, run): - @pyfile def script1(): import debug_me # noqa @@ -171,7 +170,6 @@ def test_error_in_condition(pyfile, target, run, error_name): @pytest.mark.parametrize("condition", ["condition", ""]) def test_log_point(pyfile, target, run, condition): - @pyfile def code_to_debug(): import debug_me # noqa @@ -247,7 +245,6 @@ def test_package_launch(run): def test_add_and_remove_breakpoint(pyfile, target, run): - @pyfile def code_to_debug(): import debug_me # noqa @@ -279,7 +276,6 @@ def test_add_and_remove_breakpoint(pyfile, target, run): def test_breakpoint_in_nonexistent_file(pyfile, target, run): - @pyfile def code_to_debug(): import debug_me # noqa @@ -300,7 +296,6 @@ def test_breakpoint_in_nonexistent_file(pyfile, target, run): def test_invalid_breakpoints(pyfile, target, run): - @pyfile def code_to_debug(): import debug_me # noqa @@ -368,7 +363,6 @@ def test_invalid_breakpoints(pyfile, target, run): def test_deep_stacks(pyfile, target, run): - @pyfile def code_to_debug(): import debug_me # noqa diff --git a/tests/ptvsd/server/test_output.py b/tests/ptvsd/server/test_output.py index bd25c9cc..2c766c25 100644 --- a/tests/ptvsd/server/test_output.py +++ b/tests/ptvsd/server/test_output.py @@ -15,7 +15,6 @@ from tests import debug def test_with_no_output(pyfile, target, run): - @pyfile def code_to_debug(): import debug_me # noqa @@ -36,7 +35,6 @@ def test_with_no_output(pyfile, target, run): def test_with_tab_in_output(pyfile, target, run): - @pyfile def code_to_debug(): import debug_me # noqa @@ -57,7 +55,6 @@ def test_with_tab_in_output(pyfile, target, run): @pytest.mark.parametrize("redirect", ["enabled", "disabled"]) def test_redirect_output(pyfile, target, run, redirect): - @pyfile def code_to_debug(): import debug_me # noqa @@ -83,12 +80,12 @@ def test_redirect_output(pyfile, target, run, redirect): def test_non_ascii_output(pyfile, target, run): - @pyfile def code_to_debug(): import debug_me # noqa import sys - a = b'\xc3\xa9 \xc3\xa0 \xc3\xb6 \xc3\xb9\n' + + a = b"\xc3\xa9 \xc3\xa0 \xc3\xb6 \xc3\xb9\n" if sys.version_info[0] >= 3: sys.stdout.buffer.write(a) else: @@ -104,10 +101,9 @@ def test_non_ascii_output(pyfile, target, run): session.wait_for_stop() session.request_continue() - output = session.output("stdout").encode('utf-8', 'replace') + output = session.output("stdout").encode("utf-8", "replace") assert output in ( - b'\xc3\xa9 \xc3\xa0 \xc3\xb6 \xc3\xb9\n', - b'\xc3\x83\xc2\xa9 \xc3\x83\xc2\xa0 \xc3\x83\xc2\xb6 \xc3\x83\xc2\xb9\n' + b"\xc3\xa9 \xc3\xa0 \xc3\xb6 \xc3\xb9\n", + b"\xc3\x83\xc2\xa9 \xc3\x83\xc2\xa0 \xc3\x83\xc2\xb6 \xc3\x83\xc2\xb9\n", ) -