quick comments
authorSteven Tobin <steventtobin (at) gmail.com>
Sun, 19 Mar 2017 20:46:54 +0000 (20:46 +0000)
committerSteven Tobin <steventtobin (at) gmail.com>
Sun, 19 Mar 2017 20:46:54 +0000 (20:46 +0000)
examples/example_postprocess.py

index 5bab8ca0e129f55a954a84e0ccd2076d7eae2616..62fe7b68903f46cc76abcee44d4f41c39f6ba524 100755 (executable)
@@ -3,6 +3,7 @@ import sys
 import fileinput
 import random
 
+# generate a list of symbols via ascii code
 SYMBOLS = [str(unichr(i)) for i in range(33, 65)]
 
 
@@ -10,6 +11,8 @@ def rng_delimitor(password):
     words = password.split()
     n_words = len(words)
 
+    # zip the split password and an equivalent number of symbols
+    # join, and drop the first symbol
     return " ".join(i for l in zip(
         [random.choice(SYMBOLS) for _ in range(n_words)],
         words
@@ -17,6 +20,7 @@ def rng_delimitor(password):
 
 
 if __name__ == "__main__":
+    # fileinput.input allows us to iterate over stdin
     for line in fileinput.input():
         rng_delim_line = rng_delimitor(line)
         sys.stdout.write(rng_delim_line + "\n")
git clone https://git.99rst.org/PROJECT