aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mitmproxy/command.py6
-rw-r--r--mitmproxy/tools/console/consoleaddons.py10
-rw-r--r--mitmproxy/tools/console/defaultkeys.py8
-rw-r--r--test/mitmproxy/test_command.py19
4 files changed, 21 insertions, 22 deletions
diff --git a/mitmproxy/command.py b/mitmproxy/command.py
index 22c2376b..c86d9792 100644
--- a/mitmproxy/command.py
+++ b/mitmproxy/command.py
@@ -110,7 +110,7 @@ class Arg(str):
pass
-def typename(t: type, ret: bool) -> str:
+def typename(t: type) -> str:
"""
Translates a type to an explanatory string. If ret is True, we're
looking at a return type, else we're looking at a parameter type.
@@ -153,13 +153,13 @@ class Command:
self.returntype = sig.return_annotation
def paramnames(self) -> typing.Sequence[str]:
- v = [typename(i, False) for i in self.paramtypes]
+ v = [typename(i) for i in self.paramtypes]
if self.has_positional:
v[-1] = "*" + v[-1]
return v
def retname(self) -> str:
- return typename(self.returntype, True) if self.returntype else ""
+ return typename(self.returntype) if self.returntype else ""
def signature_help(self) -> str:
params = " ".join(self.paramnames())
diff --git a/mitmproxy/tools/console/consoleaddons.py b/mitmproxy/tools/console/consoleaddons.py
index 61e107f4..95100fbf 100644
--- a/mitmproxy/tools/console/consoleaddons.py
+++ b/mitmproxy/tools/console/consoleaddons.py
@@ -402,17 +402,17 @@ class ConsoleAddon:
"""
self._grideditor().cmd_delete()
- @command.command("console.grideditor.readfile")
- def grideditor_readfile(self, path: command.Path) -> None:
+ @command.command("console.grideditor.load")
+ def grideditor_load(self, path: command.Path) -> None:
"""
Read a file into the currrent cell.
"""
self._grideditor().cmd_read_file(path)
- @command.command("console.grideditor.readfile_escaped")
- def grideditor_readfile_escaped(self, path: command.Path) -> None:
+ @command.command("console.grideditor.load_escaped")
+ def grideditor_load_escaped(self, path: command.Path) -> None:
"""
- Read a file containing a Python-style escaped stringinto the
+ Read a file containing a Python-style escaped string into the
currrent cell.
"""
self._grideditor().cmd_read_file_escaped(path)
diff --git a/mitmproxy/tools/console/defaultkeys.py b/mitmproxy/tools/console/defaultkeys.py
index 7920225b..69c6e49f 100644
--- a/mitmproxy/tools/console/defaultkeys.py
+++ b/mitmproxy/tools/console/defaultkeys.py
@@ -145,15 +145,15 @@ def map(km):
km.add("d", "console.grideditor.delete", ["grideditor"], "Delete this row")
km.add(
"r",
- "console.command console.grideditor.readfile",
+ "console.command console.grideditor.load",
["grideditor"],
- "Read unescaped data from file"
+ "Read unescaped data into the current cell from file"
)
km.add(
"R",
- "console.command console.grideditor.readfile_escaped",
+ "console.command console.grideditor.load_escaped",
["grideditor"],
- "Read a Python-style escaped string from file"
+ "Load a Python-style escaped string into the current cell from file"
)
km.add("e", "console.grideditor.editor", ["grideditor"], "Edit in external editor")
diff --git a/test/mitmproxy/test_command.py b/test/mitmproxy/test_command.py
index 47680c99..50ad3d55 100644
--- a/test/mitmproxy/test_command.py
+++ b/test/mitmproxy/test_command.py
@@ -151,19 +151,18 @@ def test_simple():
def test_typename():
- assert command.typename(str, True) == "str"
- assert command.typename(typing.Sequence[flow.Flow], True) == "[flow]"
- assert command.typename(typing.Sequence[flow.Flow], False) == "[flow]"
+ assert command.typename(str) == "str"
+ assert command.typename(typing.Sequence[flow.Flow]) == "[flow]"
- assert command.typename(command.Cuts, True) == "[cuts]"
- assert command.typename(typing.Sequence[command.Cut], False) == "[cut]"
+ assert command.typename(command.Cuts) == "[cuts]"
+ assert command.typename(typing.Sequence[command.Cut]) == "[cut]"
- assert command.typename(flow.Flow, False) == "flow"
- assert command.typename(typing.Sequence[str], False) == "[str]"
+ assert command.typename(flow.Flow) == "flow"
+ assert command.typename(typing.Sequence[str]) == "[str]"
- assert command.typename(command.Choice("foo"), False) == "choice"
- assert command.typename(command.Path, False) == "path"
- assert command.typename(command.Cmd, False) == "cmd"
+ assert command.typename(command.Choice("foo")) == "choice"
+ assert command.typename(command.Path) == "path"
+ assert command.typename(command.Cmd) == "cmd"
class DummyConsole: