summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkotfu <kotfu@kotfu.net>2018-06-21 15:09:31 -0600
committerkotfu <kotfu@kotfu.net>2018-06-21 15:09:31 -0600
commitc9ea3a749f7febb6dfe0f36001457e3907524ee7 (patch)
treeb3b7b3d1b5935665c82c6753f17d654e545570e0
parent7298501357504312e137180c99c05a40f49eb48a (diff)
downloadcmd2-git-c9ea3a749f7febb6dfe0f36001457e3907524ee7.tar.gz
Use `data` instead of `params`
-rw-r--r--cmd2/cmd2.py14
-rw-r--r--tests/test_plugin.py24
2 files changed, 19 insertions, 19 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py
index c2e79b09..75814b14 100644
--- a/cmd2/cmd2.py
+++ b/cmd2/cmd2.py
@@ -1691,17 +1691,17 @@ class Cmd(cmd.Cmd):
try:
statement = self._complete_statement(line)
# call the postparsing hooks
- params = plugin.PostparsingData(False, statement)
+ data = plugin.PostparsingData(False, statement)
for func in self._postparsing_hooks:
- params = func(params)
- if params.stop:
+ data = func(data)
+ if data.stop:
break
# postparsing_precmd is deprecated
- if not params.stop:
- (params.stop, params.statement) = self.postparsing_precmd(params.statement)
+ if not data.stop:
+ (data.stop, data.statement) = self.postparsing_precmd(data.statement)
# unpack the data object
- statement = params.statement
- stop = params.stop
+ statement = data.statement
+ stop = data.stop
if stop:
# we should not run the command, but
# we need to run the finalization hooks
diff --git a/tests/test_plugin.py b/tests/test_plugin.py
index 39f35cb0..98ad30ee 100644
--- a/tests/test_plugin.py
+++ b/tests/test_plugin.py
@@ -52,44 +52,44 @@ class Plugin:
# Postparsing hooks
#
###
- def postparse_hook(self, params: cmd2.plugin.PostparsingData) -> cmd2.plugin.PostparsingData:
+ def postparse_hook(self, data: cmd2.plugin.PostparsingData) -> cmd2.plugin.PostparsingData:
"A postparsing hook"
self.called_postparsing += 1
- return params
+ return data
- def postparse_hook_stop(self, params: cmd2.plugin.PostparsingData) -> cmd2.plugin.PostparsingData:
+ def postparse_hook_stop(self, data: cmd2.plugin.PostparsingData) -> cmd2.plugin.PostparsingData:
"A postparsing hook with requests application exit"
self.called_postparsing += 1
- params.stop = True
- return params
+ data.stop = True
+ return data
- def postparse_hook_emptystatement(self, params: cmd2.plugin.PostparsingData) -> cmd2.plugin.PostparsingData:
+ def postparse_hook_emptystatement(self, data: cmd2.plugin.PostparsingData) -> cmd2.plugin.PostparsingData:
"A postparsing hook with raises an EmptyStatement exception"
self.called_postparsing += 1
raise cmd2.EmptyStatement
- def postparse_hook_exception(self, params: cmd2.plugin.PostparsingData) -> cmd2.plugin.PostparsingData:
+ def postparse_hook_exception(self, data: cmd2.plugin.PostparsingData) -> cmd2.plugin.PostparsingData:
"A postparsing hook which raises an exception"
self.called_postparsing += 1
raise ValueError
- def postparse_hook_too_many_parameters(self, param1, param2) -> cmd2.plugin.PostparsingData:
+ def postparse_hook_too_many_parameters(self, data1, data2) -> cmd2.plugin.PostparsingData:
"A postparsing hook with too many parameters"
pass
- def postparse_hook_undeclared_parameter_type(self, param) -> cmd2.plugin.PostparsingData:
+ def postparse_hook_undeclared_parameter_type(self, data) -> cmd2.plugin.PostparsingData:
"A postparsing hook with an undeclared parameter type"
pass
- def postparse_hook_wrong_parameter_type(self, params: str) -> cmd2.plugin.PostparsingData:
+ def postparse_hook_wrong_parameter_type(self, data: str) -> cmd2.plugin.PostparsingData:
"A postparsing hook with the wrong parameter type"
pass
- def postparse_hook_undeclared_return_type(self, params: cmd2.plugin.PostparsingData):
+ def postparse_hook_undeclared_return_type(self, data: cmd2.plugin.PostparsingData):
"A postparsing hook with an undeclared return type"
pass
- def postparse_hook_wrong_return_type(self, params: cmd2.plugin.PostparsingData) -> str:
+ def postparse_hook_wrong_return_type(self, data: cmd2.plugin.PostparsingData) -> str:
"A postparsing hook with the wrong return type"
pass