(paths=None, **kwargs)
return py27_comp(paths, **kwargs)
:param paths: A list of paths in your file system to be scanned for
        Virtualenvs. It will search in these paths and potentially execute the
        Python binaries. Also the VIRTUAL_ENV variable will be checked if it
        contains a valid Virtualenv.
    :param safe: Default True. In case this is False, it will allow this
        function to execute potential `python` environments. An attacker might
        be able to drop an executable in a path this function is searching by
        default. If the executable has not been installed by root, it will not
        be executed.

    :yields: :class:`Environment`
:param paths: A list of paths in your file system to be scanned for
        Virtualenvs. It will search in these paths and potentially execute the
        Python binaries. Also the VIRTUAL_ENV variable will be checked if it
        contains a valid Virtualenv.
    :param safe: Default True. In case this is False, it will allow this
        function to execute potential `python` environments. An attacker might
        be able to drop an executable in a path this function is searching by
        default. If the executable has not been installed by root, it will not
        be executed.
: param paths : A list of paths in your file system to be scanned for Virtualenvs . It will search in these paths and potentially execute the Python binaries . Also the VIRTUAL_ENV variable will be checked if it contains a valid Virtualenv . : param safe : Default True . In case this is False it will allow this function to execute potential python environments . An attacker might be able to drop an executable in a path this function is searching by default . If the executable has not been installed by root it will not be executed .
def find_virtualenvs(paths=None, **kwargs):
    """
    :param paths: A list of paths in your file system to be scanned for
        Virtualenvs. It will search in these paths and potentially execute the
        Python binaries. Also the VIRTUAL_ENV variable will be checked if it
        contains a valid Virtualenv.
    :param safe: Default True. In case this is False, it will allow this
        function to execute potential `python` environments. An attacker might
        be able to drop an executable in a path this function is searching by
        default. If the executable has not been installed by root, it will not
        be executed.

    :yields: :class:`Environment`
    """
    def py27_comp(paths=None, safe=True):
        if paths is None:
            paths = []

        _used_paths = set()

        # Using this variable should be safe, because attackers might be able
        # to drop files (via git) but not environment variables.
        virtual_env = _get_virtual_env_from_var()
        if virtual_env is not None:
            yield virtual_env
            _used_paths.add(virtual_env.path)

        for directory in paths:
            if not os.path.isdir(directory):
                continue

            directory = os.path.abspath(directory)
            for path in os.listdir(directory):
                path = os.path.join(directory, path)
                if path in _used_paths:
                    # A path shouldn't be evaluated twice.
                    continue
                _used_paths.add(path)

                try:
                    executable = _get_executable_path(path, safe=safe)
                    yield Environment(path, executable)
                except InvalidPythonEnvironment:
                    pass

    return py27_comp(paths, **kwargs)
def find_virtualenvs ( paths = None , * * kwargs ) : def py27_comp ( paths = None , safe = True ) : if paths is None : paths = [ ] _used_paths = set ( ) # Using this variable should be safe, because attackers might be able # to drop files (via git) but not environment variables. virtual_env = _get_virtual_env_from_var ( ) if virtual_env is not None : yield virtual_env _used_paths . add ( virtual_env . path ) for directory in paths : if not os . path . isdir ( directory ) : continue directory = os . path . abspath ( directory ) for path in os . listdir ( directory ) : path = os . path . join ( directory , path ) if path in _used_paths : # A path shouldn't be evaluated twice. continue _used_paths . add ( path ) try : executable = _get_executable_path ( path , safe = safe ) yield Environment ( path , executable ) except InvalidPythonEnvironment : pass return py27_comp ( paths , * * kwargs )