MCPcopy
hub / github.com/mitmproxy/mitmproxy / call

Method call

mitmproxy/command.py:143–158  ·  view source on GitHub ↗

Call the command with a list of arguments. At this point, all arguments are strings.

(self, args: Sequence[str])

Source from the content-addressed store, hash-verified

141 return bound_arguments
142
143 def call(self, args: Sequence[str]) -> Any:
144 """
145 Call the command with a list of arguments. At this point, all
146 arguments are strings.
147 """
148 bound_args = self.prepare_args(args)
149 ret = self.func(*bound_args.args, **bound_args.kwargs)
150 if ret is None and self.return_type is None:
151 return
152 typ = mitmproxy.types.CommandTypes.get(self.return_type)
153 assert typ
154 if not typ.is_valid(self.manager, typ, ret):
155 raise exceptions.CommandError(
156 f"{self.name} returned unexpected data - expected {typ.display}"
157 )
158 return ret
159
160
161class ParseResult(NamedTuple):

Callers 15

test_varargsMethod · 0.95
test_callMethod · 0.95
commandMethod · 0.95
test_flowviewFunction · 0.45
test_sync_signalFunction · 0.45
test_async_signalFunction · 0.45
OnFunction · 0.45
QnFunction · 0.45
OnFunction · 0.45
simple.jsFile · 0.45
QnFunction · 0.45

Calls 3

prepare_argsMethod · 0.95
getMethod · 0.45
is_validMethod · 0.45

Tested by 5

test_varargsMethod · 0.76
test_callMethod · 0.76
test_flowviewFunction · 0.36
test_sync_signalFunction · 0.36
test_async_signalFunction · 0.36