@memoize
def _get_terminal_map():
    ret = {}
    ls = glob.glob('/dev/tty*') + glob.glob('/dev/pts/*')
    for name in ls:
        assert name not in ret
        try:
            ret[os.stat(name).st_rdev] = name
        except __HOLE__ as err:
            if err.errno != errno.ENOENT:
                raise
    return ret
dataset/ETHPy150Open giampaolo/psutil/psutil/_psposix.py/_get_terminal_map