<commit_before>""" Project Folder Manager code """

import os
import shutil

class ProjectFolderManager(object):
    """ This code provides helpers to find project folders """

    @staticmethod
    def get_tmp_directory_from_list_folders(folders_list):
        return os.sep.join(folders_list)

    @staticmethod
    def get_cwd_of_first_git_project_found_in(directory):
        """ Searches for the first .git folder on the project path and returns its location """
        for root, dirs, files in os.walk(directory):
            del files
            for dir_to_check in dirs:
                if dir_to_check == '.git':
                    return root
        return None

    @staticmethod
    def get_folder_paths(cwd, tmp_folders_list, archive_name, project_name, local_search_path):
        """ Returns an object with all the paths needed on a project """

        obj = {}
        obj['temp'] = str(os.path.join(cwd, ProjectFolderManager.get_tmp_directory_from_list_folders(tmp_folders_list)))
        obj['archive'] = str(os.path.join(obj['temp'], archive_name))
        obj['project_name'] = str(os.path.join(obj['archive'], project_name))
        obj['project'] = str(os.path.join(obj['project_name'], 'project'))
        obj['log'] = str(os.path.join(obj['project_name'], 'log'))
        obj['git_project_search_path'] = str(os.path.join(obj['project'], local_search_path))

        obj['temp'] = os.path.normpath(obj['temp'])
        obj['archive'] = os.path.normpath(obj['archive'])
        obj['project_name'] = os.path.normpath(obj['project_name'])
        obj['project'] = os.path.normpath(obj['project'])
        obj['log'] = os.path.normpath(obj['log'])
        obj['git_project_search_path'] = os.path.normpath(obj['git_project_search_path'])
        return obj

    @staticmethod
    def is_project_folder_present(paths):<commit_msg>ProjectFolderManager will now search for the first git folder project if the git local search path is . or empty<commit_after>""" Project Folder Manager code """

import os
import shutil

class ProjectFolderManager(object):
    """ This code provides helpers to find project folders """

    @staticmethod
    def get_tmp_directory_from_list_folders(folders_list):
        return os.sep.join(folders_list)

    @staticmethod
    def get_cwd_of_first_git_project_found_in(directory):
        """ Searches for the first .git folder on the project path and returns its location """
        for root, dirs, files in os.walk(directory):
            del files
            for dir_to_check in dirs:
                if dir_to_check == '.git':
                    return root
        return None

    @staticmethod
    def get_folder_paths(cwd, tmp_folders_list, archive_name, project_name, local_search_path):
        """ Returns an object with all the paths needed on a project """

        obj = {}
        obj['temp'] = str(os.path.join(cwd, ProjectFolderManager.get_tmp_directory_from_list_folders(tmp_folders_list)))
        obj['archive'] = str(os.path.join(obj['temp'], archive_name))
        obj['project_name'] = str(os.path.join(obj['archive'], project_name))
        obj['project'] = str(os.path.join(obj['project_name'], 'project'))
        obj['log'] = str(os.path.join(obj['project_name'], 'log'))
        obj['git_project_search_path'] = str(os.path.join(obj['project'], local_search_path))

        if local_search_path == '.' or local_search_path == '':
            obj['git_project_search_path'] = ProjectFolderManager.get_cwd_of_first_git_project_found_in(obj['project'])

        obj['temp'] = os.path.normpath(obj['temp'])
        obj['archive'] = os.path.normpath(obj['archive'])
        obj['project_name'] = os.path.normpath(obj['project_name'])
        obj['project'] = os.path.normpath(obj['project'])
        obj['log'] = os.path.normpath(obj['log'])
        obj['git_project_search_path'] = os.path.normpath(obj['git_project_search_path'])
        return obj

    @staticmethod
    def is_project_folder_present(paths):
{'fraction_non_alphanumeric': 0.1299449173760641, 'fraction_numerical': 0.0, 'mean_word_length': 3.4537346711259755, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4906572', 'n_tokens_mistral': 1215, 'n_tokens_neox': 1193, 'n_words': 251}