Example #1
0
File: vpp.py Project: yalikes/vpp
def main():
    args = parser_arg()
    args.sub_command_name
    if args.sub_command_name == "init":
        init_command(args)
    elif args.sub_command_name == "add":
        add_command(args)
    elif args.sub_command_name == "generate" or args.sub_command_name == "g":
        generate_command(args)
Example #2
0
def test_add_command():
 f = lambda obj: None
 with pytest.raises(ValueError):
  commands.add_command('', f)
 f.name = 'test'
 commands.add_command('', f)
 assert not f.access
 f.access = 't**s'
 with pytest.raises(ValueError):
  commands.add_command('', f)
 f.access = commands.objects.players.WIZARD
 commands.add_command('', f)
 assert f.access == commands.objects.players.WIZARD
Example #3
0
    def add_command(self, command, func):
        def func_proxy(main_window, argv):
            ct = main_window.current_tab

            if not ct:
                server_name = ""
                target_name = ""
            elif type(ct) == tabs.Server:
                server_name = ct.name
                target_name = ""
            else:
                server_name = tabs.get_server(ct).name
                target_name = ct.name

            return func(server_name, target_name, argv[1:])

        # 		self.emit("command_add", command, func)
        return commands.add_command(command, func_proxy)
Example #4
0
    def add_command(self, command, func):
        def func_proxy(main_window, argv):
            ct = main_window.current_tab

            if not ct:
                server_name = ""
                target_name = ""
            elif type(ct) == tabs.Server:
                server_name = ct.name
                target_name = ""
            else:
                server_name = tabs.get_server(ct).name
                target_name = ct.name

            return func(server_name, target_name, argv[1:])

#		self.emit("command_add", command, func)

        return commands.add_command(command, func_proxy)
Example #5
0
         print(
             f"Are you sure, that you don't want to submit {len(events_list)} events to system"
         )
         print(
             "Write yes if you want to exit without submitting files"
         )
         text = "are you sure"
         is_yes_awaiting = True
     else:
         text = QUIT
 elif command == HELP:
     print(list_of_commands)
 elif command == ADD and arg is not None:
     prev_length = len(excel_list)
     path = os.path.realpath(arg)
     add_command_result = check_result(add_command(path))
     repeated, new_values = span(lambda elem: elem in excel_list,
                                 add_command_result)
     excel_list.extend(new_values)
     [print(f"File {elem} added again") for elem in repeated]
     print(f"Successfully added {len(new_values)} excel files")
 elif command == REMOVE and arg is not None:
     path = os.path.realpath(arg)
     to_remove = remove_command(excel_list, path)
     for i in to_remove:
         excel_list.remove(i)
     print(f"Successfully removed {to_remove}.")
 elif command == CHECK:
     to_remove = [
         excel for excel in excel_list if not os.path.isfile(excel)
     ]