summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimotej Lazar <timotej.lazar@fri.uni-lj.si>2019-03-07 12:02:09 +0100
committerTimotej Lazar <timotej.lazar@fri.uni-lj.si>2019-03-07 12:02:09 +0100
commit646369852af3a367c9c97d104c2895ec70d17fca (patch)
tree73584dabdb7bf11162419c4abc82ca969d40fc19
parent5c1efef4551e48edaee6b0ae2da00a9f85fd3ae4 (diff)
kpov_util: support generating strings without digits
-rwxr-xr-xkpov_util.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/kpov_util.py b/kpov_util.py
index 4acaf79..6a667bf 100755
--- a/kpov_util.py
+++ b/kpov_util.py
@@ -42,11 +42,11 @@ def ssh_test(host, user, password, commands=()):
# omit i, l, o, I, O, 1, 0 for readability
uppers = 'ABCDEFGHJKLMNPQRSTUVWXYZ'
lowers = 'abcdefghjkmnpqrstuvwxyz'
-numbers = '23456789'
-def alnum_gen(r, length=1, lower=True, upper=True):
+digits = '23456789'
+def alnum_gen(r, length=1, digit=True, lower=True, upper=True):
return ''.join(
r.choice(
- numbers +
+ (digits if digit else '') +
(lowers if lower else '') +
(uppers if upper else ''))
for i in range(length))