diff options
author | Muriithi Frederick Muriuki | 2021-08-31 11:16:29 +0300 |
---|---|---|
committer | Muriithi Frederick Muriuki | 2021-08-31 11:16:29 +0300 |
commit | b5e1d1176f1bf4f7c0b68b27beb15e99418f1650 (patch) | |
tree | f158a54b262214ca65394a7dc65a64590533cc0c /gn3/random.py | |
parent | e441509a59c20a051fd5ab94710513f1968a5e02 (diff) | |
download | genenetwork3-b5e1d1176f1bf4f7c0b68b27beb15e99418f1650.tar.gz |
Fix linting errors, minor bugs and reorganise code
* Fix some linting errors and some minor bugs caught by the linter.
Move the `random_string` function to separate module for use in multiple
places in the code.
Diffstat (limited to 'gn3/random.py')
-rw-r--r-- | gn3/random.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/gn3/random.py b/gn3/random.py new file mode 100644 index 0000000..f0ba574 --- /dev/null +++ b/gn3/random.py @@ -0,0 +1,11 @@ +""" +Functions to generate complex random data. +""" +import random +import string + +def random_string(length): + """Generate a random string of length `length`.""" + return "".join( + random.choices( + string.ascii_letters + string.digits, k=length)) |