From d5c11a8318324b800e6c5834f96c70a87bb2ac30 Mon Sep 17 00:00:00 2001 From: Raphael Roberts Date: Sun, 7 Apr 2019 20:17:44 -0500 Subject: [PATCH] Made pep8 compliant --- main.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/main.py b/main.py index fefb161..4ac656c 100755 --- a/main.py +++ b/main.py @@ -2,7 +2,9 @@ import re import itertools from spellchecker import SpellChecker -SPELL= SpellChecker() +SPELL = SpellChecker() + + def canidates(letters, min=2, max=5): pos = [] for length in range(min, max+1): @@ -12,9 +14,11 @@ def canidates(letters, min=2, max=5): pos.append(word) return SPELL.known(pos) + def filter_pos(pos, regex): pat = re.compile(regex + '$') - return list(filter(pat.match,pos)) + return list(filter(pat.match, pos)) + while True: letters = input('Enter letters: ') @@ -22,12 +26,13 @@ while True: break pos = canidates(letters) inp = None - while inp not in (":quit:",":new:"): + while inp not in (":quit:", ":new:"): if inp is not None: for word in filter_pos(pos, inp): - print('>>>',word) - print('Letters: ',','.join(letters)) - prompt = "Enter pattern, ':new:' for new letters,\nor ':quit:' to exit: " + print('>>>', word) + print('Letters: ', ','.join(letters)) + prompt = """Enter pattern, ':new:' for new letters, +or ':quit:' to exit: """ inp = input(prompt) if inp == ":quit:": break