Source code for mmaction.utils.misc

import ctypes
import random
import string


[docs]def get_random_string(length=15): """Get random string with letters and digits. Args: length (int): Length of random string. Default: 15. """ return ''.join( random.choice(string.ascii_letters + string.digits) for _ in range(length))
[docs]def get_thread_id(): """Get current thread id.""" # use ctype to find thread id thread_id = ctypes.CDLL('libc.so.6').syscall(186) return thread_id
[docs]def get_shm_dir(): """Get shm dir for temporary usage.""" return '/dev/shm'