mirror of
https://github.com/ulbwazhine/MockupEngineer.git
synced 2024-11-22 08:56:33 +03:00
17 lines
442 B
Python
17 lines
442 B
Python
|
import asyncio
|
||
|
import functools
|
||
|
import random
|
||
|
import string
|
||
|
|
||
|
|
||
|
def run_sync(func, *args, **kwargs):
|
||
|
return asyncio.get_event_loop() \
|
||
|
.run_in_executor(None,
|
||
|
functools.partial(func,
|
||
|
*args,
|
||
|
**kwargs))
|
||
|
|
||
|
|
||
|
def random_string(n: int):
|
||
|
return ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(n))
|