Utils
Data generation utilities.
file_or_std(parent, filename, mode)
Open file and return handle or return stdin/stdout.
Source code in src/snailz/utils.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | |
id_gen(stem, digits)
Generate unique IDs of the form 'stemDDDD'.
Source code in src/snailz/utils.py
30 31 32 33 34 35 36 37 38 | |
json_dump(obj, indent=2)
Dump as JSON with custom serializer.
Source code in src/snailz/utils.py
41 42 43 44 | |
random_date(params)
Select random date in range (inclusive).
Source code in src/snailz/utils.py
47 48 49 50 51 | |
random_size(params)
Generate random sample mass and diameter.
Source code in src/snailz/utils.py
54 55 56 57 58 59 | |
_serialize_json(obj)
Custom JSON serializer.
Source code in src/snailz/utils.py
62 63 64 65 66 67 68 69 | |