def _set_nofile(nofile_atleast=4096):
    '\n    sets nofile soft limit to at least 4096, useful for running matlplotlib/seaborn on\n    parallel executing plot generators vs. Ubuntu default ulimit -n 1024 or OS X El Captian 256\n    temporary setting extinguishing with Python session.\n    '
    try:
        import resource as res
    except ImportError:
        res = None
    from .logging import default_logger
    if (res is None):
        return ((None,) * 2)
    (soft, ohard) = res.getrlimit(res.RLIMIT_NOFILE)
    hard = ohard
    if (soft < nofile_atleast):
        soft = nofile_atleast
        if (hard < soft):
            hard = soft
        default_logger.debug(f'setting soft & hard ulimit -n {soft} {hard}')
        try:
            res.setrlimit(res.RLIMIT_NOFILE, (soft, hard))
        except (ValueError, res.error):
            try:
                hard = soft
                default_logger.warning(f'trouble with max limit, retrying with soft,hard {soft},{hard}')
                res.setrlimit(res.RLIMIT_NOFILE, (soft, hard))
            except Exception:
                default_logger.warning('failed to set ulimit, giving up')
                (soft, hard) = res.getrlimit(res.RLIMIT_NOFILE)
    default_logger.debug(f'ulimit -n soft,hard: {soft} {hard}')
    return (soft, hard)
sets nofile soft limit to at least 4096, useful for running matlplotlib/seaborn on
parallel executing plot generators vs. Ubuntu default ulimit -n 1024 or OS X El Captian 256
temporary setting extinguishing with Python session.
def _set_nofile(nofile_atleast=4096):
    '\n    sets nofile soft limit to at least 4096, useful for running matlplotlib/seaborn on\n    parallel executing plot generators vs. Ubuntu default ulimit -n 1024 or OS X El Captian 256\n    temporary setting extinguishing with Python session.\n    '
    try:
        import resource as res
    except ImportError:
        res = None
    from .logging import default_logger
    if (res is None):
        return ((None,) * 2)
    (soft, ohard) = res.getrlimit(res.RLIMIT_NOFILE)
    hard = ohard
    if (soft < nofile_atleast):
        soft = nofile_atleast
        if (hard < soft):
            hard = soft
        default_logger.debug(f'setting soft & hard ulimit -n {soft} {hard}')
        try:
            res.setrlimit(res.RLIMIT_NOFILE, (soft, hard))
        except (ValueError, res.error):
            try:
                hard = soft
                default_logger.warning(f'trouble with max limit, retrying with soft,hard {soft},{hard}')
                res.setrlimit(res.RLIMIT_NOFILE, (soft, hard))
            except Exception:
                default_logger.warning('failed to set ulimit, giving up')
                (soft, hard) = res.getrlimit(res.RLIMIT_NOFILE)
    default_logger.debug(f'ulimit -n soft,hard: {soft} {hard}')
    return (soft, hard)