def main(): pattern = re.compile('nothing to commit, working directory clean') command = concat(['git', 'push'] + sys.argv[1:]) proc = Popen('git status', stdout=PIPE, shell=True) out = proc.stdout.readlines() if len(out) == 2 and pattern.match(out[1].rstrip()): exec_push(command) exit() msg = get_message() print print red(msg) print say_message(msg) for line in out: print yellow(line), print print u'git pushしますか?[yn] > ', while True: desire = raw_input() if desire == 'n': exit() elif desire == 'y': exec_push(command) exit() else: print "please input 'y' or 'n'!!!" print u'git pushしますか?[yn] > ',
def play(): """Play function of the game.""" usedtime = 0.0 remtime = 0.0 twords = 0 cwords = 0 inp = 'ttemp' alllen = 0 i = 1 listi = makelist() while True: try: x = int(raw_input("How many sentence will you type?\n>>")) break except ValueError: print red("Oops! That was no valid number. Try again...") raw_input('>>Press Enter to start the game') start = time.time() while (i <= x): word = randomword(listi) i += 1 alllen += len(word) listi.remove(word) #remtime = 60.0 - usedtime #print remtime os.system('clear') print time.time() - start while (inp != word): print purple("-" * 90) print '>>' + cyan(word) print purple("-" * 90) inp = raw_input('>>') print "\n\n" if (inp == 'quit'): return 0 end = time.time() usedtime = (end - start) #twords += 1 os.system('clear') print red("\nIt's done!") print "-" * 90 print "time:" + str(usedtime) mtime = usedtime/60 wcount = alllen/5 print yellow("WPM:" + str(wcount/mtime)) print "Words Count:" + str(alllen) print "-" * 90 ''' print "Total no. of words:", twords incwords=twords - cwords print "No. of incorrect words", incwords raw=(twords/usedtime) * 60.0 print "RAW words per minute %.2f" %raw actual=(cwords/usedtime) * 60.0 print "Actual words per minute: %.2f"%actual scores=scorelist() addscore(scores,actual) writescore(scores) ''' menu()
def rules(): """Rules of the game""" print cyan("Welcome\nTest your typing skills...\nType as many words as you can in under 60 seconds and get your RAW words per minute and actual words per minute\n") raw_input(red('Press Enter')) menu()
def on_deleted(self, event): if event.is_directory: print red('directory \'{0}\' deleted.'.format(event.src_path)) else: print red('file \'{0}\' deleted.'.format(event.src_path))