<commit_before>import sys

def ReadFriendList(file_name):
    friends_status_list = []
    with open(file_name) as file:
        for line in file:
            ip, name = line.split(':')
            friends_status_list.append((ip, name, 'Off'))#default to offline
            print(friends_status_list)
        return friends_status_list
            
def WriteFriendList(file_name, friends_status_list):
    with open(file_name, 'w') as file:
        for each in friends_status_list:
            file.write(each[0]+':'+each[1])
            
def RefreshOnlineFriends(friends_status_list):
    for each in friends_status_list:
        if CheckSomeoneOnline(each[0]) == True:
            refreshed_list.append((each[0], each[1], 'On'))
        elif CheckSomeoneOnline(each[0]) == False:
            refreshed_list.append((each[0], each[1], 'Off'))
    return refreshed_list

def AddNewFriend(friends_status_list, ip, name):
    friends_status_list.append((ip, name, 'Off'))
    RefreshOnlineFriends(friends_status_list)
    pass<commit_msg>make friend list in friend_mechanism.py an object<commit_after>from online_check import *
class FriendList:
    def __init__(self, file_name):
        self.file_name = file_name
        self.friends_status_list = []
        with open(self.file_name) as file:
            for line in file:
                ip, name = line.split(':')
                self.friends_status_list.append([ip, name, 'Off'])#default to offline
                
    def Save(self):
        with open(self.file_name, 'w') as file:
            for each in self.friends_status_list:
                file.write(each[0]+':'+each[1])
        
    def RefreshOnlineStatus(self):
        '''
        refresh online status
        '''
        for each in self.friends_status_list:
            if CheckSomeoneOnline(each[0]) == True:
                each[2] = 'On'
            elif CheckSomeoneOnline(each[0]) == False:
                each[2] = 'Off'

    def AddNewFriend(self,ip, name):
        '''
        '''
        self.friends_status_list.append([ip, name, 'Off'])
        
        pass
{'fraction_non_alphanumeric': 0.11275680840898232, 'fraction_numerical': 0.006688963210702341, 'mean_word_length': 2.3719806763285023, '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': '7015331', 'n_tokens_mistral': 645, 'n_tokens_neox': 617, 'n_words': 136}