Spaces:
Runtime error
Runtime error
Download utils/utils.py from Multimedika/Bot_Development: direct link, hf CLI and curl.
- Browser
- Download file 651 Bytes
-
https://huggingface.co/spaces/Multimedika/Bot_Development/resolve/f39c74ff1473bfc10074c2c5f06cc4412b5d63c3/utils/utils.py
- Command line
-
hf download hf://spaces/Multimedika/Bot_Development@f39c74ff1473bfc10074c2c5f06cc4412b5d63c3/utils/utils.py
-
curl -L -o utils.py https://huggingface.co/spaces/Multimedika/Bot_Development/resolve/f39c74ff1473bfc10074c2c5f06cc4412b5d63c3/utils/utils.py
651 Bytes
| from uuid import uuid4 | |
| def pipe(data, *funcs): | |
| """ Pipe a value through a sequence of functions | |
| I.e. ``pipe(data, f, g, h)`` is equivalent to ``h(g(f(data)))`` | |
| We think of the value as progressing through a pipe of several | |
| transformations, much like pipes in UNIX | |
| ``$ cat data | f | g | h`` | |
| >>> double = lambda i: 2 * i | |
| >>> pipe(3, double, str) | |
| '6' | |
| See Also: | |
| compose | |
| thread_first | |
| thread_last | |
| """ | |
| for func in funcs: | |
| data = func(data) | |
| return data | |
| def generate_uuid(use_hex=False): | |
| if use_hex: | |
| return str(uuid4().hex) | |
| else: | |
| return str(uuid4()) |