Mercurial > ppgen
comparison ppgen.py @ 6:81f75c9aac84
Cleanup, minor: improves Comments. Bumps copyright.
author | Bernhard Reiter <bernhard@intevation.de> |
---|---|
date | Mon, 13 Feb 2017 08:38:06 +0100 |
parents | f8e24b2b6b6a |
children | 8b2f8f439817 |
comparison
equal
deleted
inserted
replaced
5:f8e24b2b6b6a | 6:81f75c9aac84 |
---|---|
19 | 19 |
20 Related: There is a Go implementation started by Sascha L. Teichmann at | 20 Related: There is a Go implementation started by Sascha L. Teichmann at |
21 https://bitbucket.org/s_l_teichmann/ppgen | 21 https://bitbucket.org/s_l_teichmann/ppgen |
22 | 22 |
23 | 23 |
24 Copyright 2016 by Intevation GmbH. | 24 Copyright 2016, 2017 by Intevation GmbH. |
25 Author: Bernhard E. Reiter <bernhard@intevation.de> | 25 Author: Bernhard E. Reiter <bernhard@intevation.de> |
26 | 26 |
27 This file is Free Software under the Apache 2.0 license and thus | 27 This file is Free Software under the Apache 2.0 license and thus |
28 comes without any warranty (to extend permissible under applicable law). | 28 comes without any warranty (to extend permissible under applicable law). |
29 """ | 29 """ |
80 useLeft: Boolean to control which language to use | 80 useLeft: Boolean to control which language to use |
81 | 81 |
82 TODO: add option to use both languages for people that speak them both? | 82 TODO: add option to use both languages for people that speak them both? |
83 """ | 83 """ |
84 | 84 |
85 dset = set() # using the datatype 'set' to aviod duplicates | 85 dset = set() # using the datatype 'set' to avoid duplicates |
86 | 86 |
87 splitter = re.compile(r"""\ \|\ # first pattern ' | ' | 87 splitter = re.compile(r"""\ \|\ # first pattern ' | ' |
88 |;\ # second pattern '; ' | 88 |;\ # second pattern '; ' |
89 |(?<=\S)/(?=\S) # 3.: '\' surrounded by chars | 89 |(?<=\S)/(?=\S) # 3.: '/' surrounded by chars |
90 |\s+ # by whitespace | 90 |\s+ # by whitespace |
91 """, re.VERBOSE) | 91 """, re.VERBOSE) |
92 | 92 |
93 print("Reading entries from {}.".format(filename), end='') | 93 print("Reading entries from {}.".format(filename), end='') |
94 counter = 0 # for progress or stopping early | 94 counter = 0 # for progress or stopping early |
129 | 129 |
130 dictionary = buildDictionary(options) | 130 dictionary = buildDictionary(options) |
131 | 131 |
132 howMany = 4 | 132 howMany = 4 |
133 | 133 |
134 # use a dictionary with lower case words for a simple check if | 134 # use a dictionary with lower cased words for a simple check if |
135 # our random source is okay | 135 # our random source is okay |
136 print("\nGenerated passphrase with {} randomly selected words:\n".format( | 136 print("\nGenerated passphrase with {} randomly selected words:\n".format( |
137 howMany)) | 137 howMany)) |
138 print(" ", end='') | 138 print(" ", end='') |
139 words = {} | 139 words = {} |