MCPcopy Create free account
hub / github.com/microsoft/debugpy / launch_request

Function launch_request

src/debugpy/launcher/handlers.py:14–141  ·  view source on GitHub ↗
(request)

Source from the content-addressed store, hash-verified

12
13
14def launch_request(request):
15 debug_options = set(request("debugOptions", json.array(str)))
16
17 # Handling of properties that can also be specified as legacy "debugOptions" flags.
18 # If property is explicitly set to false, but the flag is in "debugOptions", treat
19 # it as an error. Returns None if the property wasn't explicitly set either way.
20 def property_or_debug_option(prop_name, flag_name):
21 assert prop_name[0].islower() and flag_name[0].isupper()
22
23 value = request(prop_name, bool, optional=True)
24 if value == ():
25 value = None
26
27 if flag_name in debug_options:
28 if value is False:
29 raise request.isnt_valid(
30 '{0}:false and "debugOptions":[{1}] are mutually exclusive',
31 json.repr(prop_name),
32 json.repr(flag_name),
33 )
34 value = True
35
36 return value
37
38 python = request("python", json.array(str, size=(1,)))
39 cmdline = list(python)
40
41 if not request("noDebug", json.default(False)):
42 # see https://github.com/microsoft/debugpy/issues/861
43 if sys.version_info[:2] >= (3, 11):
44 cmdline += ["-X", "frozen_modules=off"]
45
46 port = request("port", int)
47 cmdline += [
48 os.path.dirname(debugpy.__file__),
49 "--connect",
50 launcher.adapter_host + ":" + str(port),
51 ]
52
53 if not request("subProcess", True):
54 cmdline += ["--configure-subProcess", "False"]
55
56 qt_mode = request(
57 "qt",
58 json.enum(
59 "none", "auto", "pyside", "pyside2", "pyqt4", "pyqt5", optional=True
60 ),
61 )
62 cmdline += ["--configure-qt", qt_mode]
63
64 adapter_access_token = request("adapterAccessToken", str, optional=True)
65 if adapter_access_token != ():
66 cmdline += ["--adapter-access-token", adapter_access_token]
67
68 debugpy_args = request("debugpyArgs", json.array(str))
69 cmdline += debugpy_args
70
71 # Use the copy of arguments that was propagated via the command line rather than

Callers

nothing calls this directly

Calls 8

property_or_debug_optionFunction · 0.85
itemsMethod · 0.80
isnt_validMethod · 0.80
popMethod · 0.80
defaultMethod · 0.45
copyMethod · 0.45
updateMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…