prospector/ranking/rank.py
def make_dataframe(
    data_filename=TRAINING_DATA, num_elem_training_data=NUM_ELEMENTS_TRAINING_DATA
):
    """
    This is the helper function to construct the pandas dataframe object for the training data.
    It returns pandas dataframe if succeeds and None otherwise
    """
    commits = []
    try:
        with open(data_filename, "r", encoding="utf8") as f_in:
            count = 0
            for line in f_in:
                line = line.strip()
                line = re.sub(r"[\['\] ]", "", line).split(",")
                count += 1
                if len(line) < num_elem_training_data:
                    _logger.warning(
                        f"SKIPPING: A problem occurred while reading line {count}, line {line}"
                    )
                    continue
                # cve_id = line[0]
                repo = line[1]
                commit_id = line[2]
                # dash = line[3]  # column 3
                # technologies = [line[tech] for tech in range(4, len(line) - 1)]  # column 4
                # classification = line[-1]

                commits.append([commit_id, repo])
                #   if (commit_id,repo) not found in commitdb:
                #     commit_obj = make_commit(commit_id,repo)
                #     preprocess(commit_obj)
                #     save commit_obj to db
                #   augment commit_obj with advisory-dependent features
    except OSError:
        _logger.error(
            f"An exception occurred while I was trying to extract information from {data_filename}",
            exc_info=True,
        )
        raise OSError(
            f"An exception occurred while I was trying to extract information from {data_filename}"
        )
    if len(commits) > 0:
        return pd.DataFrame(
            commits, columns=["commit_id", "repo"]
        )  # This line needs to be updated to correspond to
        # the actual features
    return

    This is the helper function to construct the pandas dataframe object for the training data.
    It returns pandas dataframe if succeeds and None otherwise
    
This is the helper function to construct the pandas dataframe object for the training data.
It returns pandas dataframe if succeeds and None otherwise
This is the helper function to construct the pandas dataframe object for the training data . It returns pandas dataframe if succeeds and None otherwise
def make_dataframe(
    data_filename=TRAINING_DATA, num_elem_training_data=NUM_ELEMENTS_TRAINING_DATA
):
    commits = []
    try:
        with open(data_filename, "r", encoding="utf8") as f_in:
            count = 0
            for line in f_in:
                line = line.strip()
                line = re.sub(r"[\['\] ]", "", line).split(",")
                count += 1
                if len(line) < num_elem_training_data:
                    _logger.warning(
                        f"SKIPPING: A problem occurred while reading line {count}, line {line}"
                    )
                    continue
                repo = line[1]
                commit_id = line[2]
                commits.append([commit_id, repo])
    except OSError:
        _logger.error(
            f"An exception occurred while I was trying to extract information from {data_filename}",
            exc_info=True,
        )
        raise OSError(
            f"An exception occurred while I was trying to extract information from {data_filename}"
        )
    if len(commits) > 0:
        return pd.DataFrame(
            commits, columns=["commit_id", "repo"]
        )  
    return
def make_dataframe ( data_filename = TRAINING_DATA , num_elem_training_data = NUM_ELEMENTS_TRAINING_DATA ) : commits = [ ] try : with open ( data_filename , "r" , encoding = "utf8" ) as f_in : count = 0 for line in f_in : line = line . strip ( ) line = re . sub ( r"[\['\] ]" , "" , line ) . split ( "," ) count += 1 if len ( line ) < num_elem_training_data : _logger . warning ( f"SKIPPING: A problem occurred while reading line {count}, line {line}" ) continue repo = line [ 1 ] commit_id = line [ 2 ] commits . append ( [ commit_id , repo ] ) except OSError : _logger . error ( f"An exception occurred while I was trying to extract information from {data_filename}" , exc_info = True , ) raise OSError ( f"An exception occurred while I was trying to extract information from {data_filename}" ) if len ( commits ) > 0 : return pd . DataFrame ( commits , columns = [ "commit_id" , "repo" ] ) return
This is the helper function to construct the pandas dataframe object for the training data.
This is the helper function to construct the pandas dataframe object for the training data .
"""
    This is the helper function to construct the pandas dataframe object for the training data.
    It returns pandas dataframe if succeeds and None otherwise
    """ # cve_id = line[0] # dash = line[3]  # column 3 # technologies = [line[tech] for tech in range(4, len(line) - 1)]  # column 4 # classification = line[-1] #   if (commit_id,repo) not found in commitdb: #     commit_obj = make_commit(commit_id,repo) #     preprocess(commit_obj) #     save commit_obj to db #   augment commit_obj with advisory-dependent features # This line needs to be updated to correspond to # the actual features
data_filename
num_elem_training_data