def parse(commands): _command = commands[0] if _command == 'help': # Done command.help() elif _command == 'add': # Done command.add(commands[1:]) elif _command == 'display': # All done # TODO: Date # sort [date|cost] command.display() elif _command == 'delete': # Done command.delete(commands[1]) elif _command == 'find': # TODO if len(commands) == 1: print('please enter criteria') return True command.find(commands[1:]) elif _command == 'clear': command.clear() elif _command == 'quit': # Done command.quit() return False return True
async def on_ready(): clear() sleep(1) print("I'm online") sleep(1) print(f"username: {client.user}") await client.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name="you"))
def run(self): if self.args.c: commands.check(app=self, input_str=":c {0}".format(self.args.c)) if self.args.d: commands.delete(app=self, input_str=":d {0}".format(self.args.d)) if self.args.clear: commands.clear(app=self) print str(self.list),
def main(): logger.info("RUN") print("WELCOME BACK, GARRET!".rjust(110)) log_parser(LOGFILE) print_commands() # need to add move_word() words = read_words() defs = read_defs() easy_words = read_easy_words() med_words = read_med_words() hard_words = read_hard_words() # above init needed for parameters print("CURRENT WORKING DICTIONARY:") print_words(words) while True: action = input("\nCommand:\t") if action.lower() == "add": add_word(words, defs) elif action.lower() == "list": print_words(words) elif action.lower() == "flash": flash_mode(words,defs) elif action.lower() == "dict": #change name & make justified print_defs(words, defs) elif action.lower() == "del": delete_word(words, defs) elif action.lower() == "def": define_word(words,defs) elif action.lower() == "commands": print_commands() elif action.lower() == "body": body_test() elif action.lower() == "clear": clear() elif action.lower() == "test": test_mode() elif action.lower() == "move": move_word(words, defs, easy_words, med_words, hard_words, easy_defs) elif action.lower() == "exit": print("Way To Learn... See You Soon!") break else: print("Invalid Command... see menu")
def test_clear(self): ''' C Limpa a matriz. O tamanho permanece o mesmo. Todos os pixels ficam brancos (O). ''' m, n = 5, 5 matrix = commands.create(m, n) for line in matrix: line[2] = 'A' matrix_str = ''.join(itertools.chain.from_iterable(matrix)) self.assertTrue(matrix_str != 'O' * m * n) matrix = commands.clear(matrix) matrix_str = ''.join(itertools.chain.from_iterable(matrix)) self.assertTrue(matrix_str == 'O' * m * n)
import glob import json import settings import common from utils.path import join common.COMMANDLINE = True import commands as com def prettify_name(name): return name.capitalize().replace("_", " ") if __name__ == '__main__': com.clear() sid = com.register('admin', 'maintance')['sid'] print('Log in as administrator, sid: {0}'. format(sid)) maps_dir = join('data/maps') units_dir = join('data/units') factions = {} for dirpath, dirnames, filenames in os.walk(units_dir): faction = os.path.basename(dirpath) if faction not in factions: factions[faction] = [] filenames = [os.path.join(dirpath, f) for f in filenames if os.path.splitext(f)[1] == '.cfg'] for unit_file in filenames: