Skip to content

Commit 3b76516

Browse files
author
Simca
committed
Update apputils version
1 parent ed0ae16 commit 3b76516

File tree

4 files changed

+13
-11
lines changed

4 files changed

+13
-11
lines changed

src/openstack_cli/commands/scripts/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
# limitations under the License.
1515

1616
from openstack_cli.core.config import Configuration
17-
from openstack_cli.modules.apputils.discovery import CommandMetaInfo
17+
from openstack_cli.modules.apputils.discovery import CommandMetaInfo, NotImplementedCommandException
1818

1919
__module__ = CommandMetaInfo("scripts", item_help="Manage user scripts",
2020
default_sub_command="list", exec_with_child=True)
2121

2222

2323
def __init__(conf: Configuration, **kwargs):
24-
print("Lol")
25-
# raise NotImplementedCommandException()
24+
print("====Wait for version 1.3=====")
25+
raise NotImplementedCommandException()

src/openstack_cli/commands/snap/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@
1616
from openstack_cli.core.config import Configuration
1717
from openstack_cli.modules.apputils.discovery import CommandMetaInfo, NotImplementedCommandException
1818

19-
__module__ = CommandMetaInfo("snap", item_help="Manage OpenStack Snapshoots", default_sub_command="list")
19+
__module__ = CommandMetaInfo("snap", item_help="Manage OpenStack Snapshoots",
20+
default_sub_command="list", exec_with_child=True)
2021

2122

2223
def __init__(conf: Configuration):
24+
print("====Wait for version 1.3=====")
2325
raise NotImplementedCommandException()

src/openstack_cli/modules/apputils/discovery/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def _get_command(self, injected_args: dict = None, fail_on_unknown: bool = False
130130

131131
# Now process the last command "default sub-command" forward if present
132132
if command.meta_info.default_sub_command and \
133-
command.meta_info.default_sub_command in command.subcommand_names:
133+
command.meta_info.default_sub_command in command.subcommand_names:
134134

135135
if command.meta_info.exec_with_child:
136136
command_chain.append(command)
@@ -139,8 +139,8 @@ def _get_command(self, injected_args: dict = None, fail_on_unknown: bool = False
139139
command_chain.append(command)
140140
inj_args = set(injected_args.keys()) if injected_args else set()
141141
for _command in command_chain:
142-
_require_transform = True if _command == command else False
143-
_command.set_argument(command_args, self._options.kwargs, inj_args, fail_on_unknown, not _require_transform)
142+
_require_transform = True if _command == command else False
143+
_command.set_argument(command_args, self._options.kwargs, inj_args, fail_on_unknown, not _require_transform)
144144

145145
return command_chain
146146

@@ -180,8 +180,8 @@ def start_application(self, kwargs: dict = None):
180180
# ToDO: add default command to be executed if no passed
181181
self.__inject_help_command()
182182
try:
183-
commands = self._get_command(injected_args=kwargs, fail_on_unknown=True)
184-
for command in commands:
183+
cmd_list = self._get_command(injected_args=kwargs, fail_on_unknown=True)
184+
for command in cmd_list:
185185
command.execute(injected_args=kwargs)
186186
except NotImplementedCommandException:
187187
sys.stdout.write(generate_help(self._modules, self._options, *self.__get_modules_from_args()))

src/openstack_cli/modules/apputils/discovery/commands.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ def transform_default_arguments(self, argv: list, fail_on_unknown: bool = False)
238238

239239
raise CommandArgumentException(f"Command require {expected_length} positional argument(s), found {real_length}")
240240
elif self._arguments.has_optional_default_argument and argv \
241-
and real_length < expected_length - default_args_count\
241+
and real_length < expected_length - default_args_count \
242242
or (fail_on_unknown and real_length > expected_length):
243243

244244
raise CommandArgumentException(
@@ -334,7 +334,7 @@ def set_argument(self, args: list, kwargs: dict, injected_args: set = None,
334334
if len(f_args) - len(set(f_args) & injected_args) != len(set(args.keys()) & set(f_args)):
335335
raise CommandArgumentException("Function \"{}\" from module {} doesn't implement all arguments in the"
336336
" signature or implements unknown definition".format(
337-
self.__entry_point.__name__, self.__classpath
337+
self.__entry_point.__name__, self.__classpath
338338
))
339339
else:
340340
args = {

0 commit comments

Comments
 (0)