model/load_data.py
def _get_cl_data_dict(self, pr_level_signals, repo):
        """
        Compute the CL data dict.

        Args:
            pr_level_signals: A dataframe of pull request level signals.
            repo: A str of the repo name.

        Returns:
            A dict holds the CL data. The keys are the CL ids and the values
            are one CLData object.
        """
        cl_data_dict = defaultdict(CLData)
        for index in range(len(pr_level_signals)):

            pr_signals = pr_level_signals.iloc[index]
            pr_id = pr_signals['pull request id']
            reverted_pr_id = pr_signals['reverted pull request id']
            if reverted_pr_id != 0:
                cl_data_dict[reverted_pr_id].reverted = True
            closed_date = datetime.fromisoformat(
                pr_signals['pull request closed time'][:-1])\
                .strftime(format="%Y_%m_%d")
            files_changes = pr_signals['files changes']
            file_names = self._get_file_names(files_changes)
            num_files = len(file_names)
            if not num_files:
                continue

            file_name = '../data/%s_%s_features.csv' % (repo, closed_date)
            if not os.path.exists(file_name):
                continue
            file_level_signals = pd.read_csv(file_name)

            num_reverted_file = self._get_num_reverted_file(file_names,
                                                            file_level_signals)
            num_old_files = self._get_file_data(pr_id, file_names,
                                                file_level_signals,
                                                cl_data_dict)
            num_new_files = num_files - num_old_files
            pr_data = self._get_pr_data(
                pr_signals, num_files, num_new_files, num_reverted_file)
            cl_data_dict[pr_id].pr_level_features = deepcopy(pr_data)

        return cl_data_dict

        Compute the CL data dict.

        Args:
            pr_level_signals: A dataframe of pull request level signals.
            repo: A str of the repo name.

        Returns:
            A dict holds the CL data. The keys are the CL ids and the values
            are one CLData object.
        
Compute the CL data dict.
Compute the CL data dict .
def _get_cl_data_dict(self, pr_level_signals, repo):
        cl_data_dict = defaultdict(CLData)
        for index in range(len(pr_level_signals)):
            pr_signals = pr_level_signals.iloc[index]
            pr_id = pr_signals['pull request id']
            reverted_pr_id = pr_signals['reverted pull request id']
            if reverted_pr_id != 0:
                cl_data_dict[reverted_pr_id].reverted = True
            closed_date = datetime.fromisoformat(
                pr_signals['pull request closed time'][:-1])\
                .strftime(format="%Y_%m_%d")
            files_changes = pr_signals['files changes']
            file_names = self._get_file_names(files_changes)
            num_files = len(file_names)
            if not num_files:
                continue
            file_name = '../data/%s_%s_features.csv' % (repo, closed_date)
            if not os.path.exists(file_name):
                continue
            file_level_signals = pd.read_csv(file_name)
            num_reverted_file = self._get_num_reverted_file(file_names,
                                                            file_level_signals)
            num_old_files = self._get_file_data(pr_id, file_names,
                                                file_level_signals,
                                                cl_data_dict)
            num_new_files = num_files - num_old_files
            pr_data = self._get_pr_data(
                pr_signals, num_files, num_new_files, num_reverted_file)
            cl_data_dict[pr_id].pr_level_features = deepcopy(pr_data)
        return cl_data_dict
def _get_cl_data_dict ( self , pr_level_signals , repo ) : cl_data_dict = defaultdict ( CLData ) for index in range ( len ( pr_level_signals ) ) : pr_signals = pr_level_signals . iloc [ index ] pr_id = pr_signals [ 'pull request id' ] reverted_pr_id = pr_signals [ 'reverted pull request id' ] if reverted_pr_id != 0 : cl_data_dict [ reverted_pr_id ] . reverted = True closed_date = datetime . fromisoformat ( pr_signals [ 'pull request closed time' ] [ : - 1 ] ) . strftime ( format = "%Y_%m_%d" ) files_changes = pr_signals [ 'files changes' ] file_names = self . _get_file_names ( files_changes ) num_files = len ( file_names ) if not num_files : continue file_name = '../data/%s_%s_features.csv' % ( repo , closed_date ) if not os . path . exists ( file_name ) : continue file_level_signals = pd . read_csv ( file_name ) num_reverted_file = self . _get_num_reverted_file ( file_names , file_level_signals ) num_old_files = self . _get_file_data ( pr_id , file_names , file_level_signals , cl_data_dict ) num_new_files = num_files - num_old_files pr_data = self . _get_pr_data ( pr_signals , num_files , num_new_files , num_reverted_file ) cl_data_dict [ pr_id ] . pr_level_features = deepcopy ( pr_data ) return cl_data_dict
Compute the CL data dict.
Compute the CL data dict .
"""
        Compute the CL data dict.

        Args:
            pr_level_signals: A dataframe of pull request level signals.
            repo: A str of the repo name.

        Returns:
            A dict holds the CL data. The keys are the CL ids and the values
            are one CLData object.
        """
A dict holds the CL data. The keys are the CL ids and the values
are one CLData object.
A dict holds the CL data . The keys are the CL ids and the values are one CLData object .
self
pr_level_signals
A dataframe of pull request level signals.
A dataframe of pull request level signals .
repo
A str of the repo name.
A str of the repo name .