Merge branch 'style_changes' of https://github.com/jfindlay/XKCD-password-generator...
authorSteven Tobin <redacted>
Mon, 26 Sep 2016 11:09:31 +0000 (12:09 +0100)
committerSteven Tobin <redacted>
Mon, 26 Sep 2016 11:09:31 +0000 (12:09 +0100)
1  2 
xkcdpass/xkcd_password.py

index 155b151b494dcb36e1347ff2302807e8673d04bb,cb8f79eb62738c68d46ed79a0c54222327422bac..b975e202c99c193d847b4cc2f922dd2cbb0424a0
@@@ -186,29 -187,13 +187,30 @@@ def find_acrostic(acrostic, worddict)
  
  
  def choose_words(wordlist, numwords):
-     s = []
-     for i in xrange(numwords):
-         s.append(rng().choice(wordlist))
-     return s
+     """
+     Choose numwords randomly from wordlist
+     """
+     return [rng().choice(wordlist) for i in xrange(numwords)]
  
  
 +def try_input(prompt, validate):
 +    """
 +    Suppress stack trace on user cancel and validate input with supplied
 +    validate callable.
 +    """
 +
 +    try:
 +        answer = raw_input(prompt)
 +    except (KeyboardInterrupt, EOFError):
 +        # user cancelled
 +        print("")
 +        sys.exit(0)
 +
 +    # validate input
 +    return validate(answer)
 +
 +
  def generate_xkcdpassword(wordlist,
                            numwords=6,
                            interactive=False,
git clone https://git.99rst.org/PROJECT