def _lint_pre_commit(session, rcfile, flags, paths):
    if ('VIRTUAL_ENV' not in os.environ):
        session.error("This should be running from within a virtualenv and 'VIRTUAL_ENV' was not found as an environment variable.")
    if ('pre-commit' not in os.environ['VIRTUAL_ENV']):
        session.error("This should be running from within a pre-commit virtualenv and 'VIRTUAL_ENV'({}) does not appear to be a pre-commit virtualenv.".format(os.environ['VIRTUAL_ENV']))
    from nox.virtualenv import VirtualEnv
    try:
        session._runner.venv = VirtualEnv(os.environ['VIRTUAL_ENV'], interpreter=session._runner.func.python, reuse_existing=True, venv=True)
    except TypeError:
        session._runner.venv = VirtualEnv(os.environ['VIRTUAL_ENV'], interpreter=session._runner.func.python, reuse_existing=True)
    _lint(session, rcfile, flags, paths, tee_output=False)
def _lint_pre_commit(session, rcfile, flags, paths):
    if ('VIRTUAL_ENV' not in os.environ):
        session.error("This should be running from within a virtualenv and 'VIRTUAL_ENV' was not found as an environment variable.")
    if ('pre-commit' not in os.environ['VIRTUAL_ENV']):
        session.error("This should be running from within a pre-commit virtualenv and 'VIRTUAL_ENV'({}) does not appear to be a pre-commit virtualenv.".format(os.environ['VIRTUAL_ENV']))
    from nox.virtualenv import VirtualEnv
    try:
        session._runner.venv = VirtualEnv(os.environ['VIRTUAL_ENV'], interpreter=session._runner.func.python, reuse_existing=True, venv=True)
    except TypeError:
        session._runner.venv = VirtualEnv(os.environ['VIRTUAL_ENV'], interpreter=session._runner.func.python, reuse_existing=True)
    _lint(session, rcfile, flags, paths, tee_output=False)