<commit_before>from butler_offline.core import FileSystem
import os

INSTANCE = None

def instance():
    if FileSystem.INSTANCE == None:
        FileSystem.INSTANCE = FileSystemImpl()
    return FileSystem.INSTANCE


class FileSystemImpl:

    def read(self, file_path):

        if not os.path.isfile(file_path):
            return None

        file = open(file_path, 'r')
        file_content = []

        for line in file:
            file_content.append(line)

        file.close()

        return file_content

    def write(self, file_path, file_content):
        file = open(file_path, 'w')
        file.write(file_content)
        file.close()<commit_msg>move to with open<commit_after>from butler_offline.core import FileSystem
import os

INSTANCE = None

def instance():
    if FileSystem.INSTANCE == None:
        FileSystem.INSTANCE = FileSystemImpl()
    return FileSystem.INSTANCE


class FileSystemImpl:

    def read(self, file_path):

        if not os.path.isfile(file_path):
            return None

        with open(file_path) as file:
            file_content = []

            for line in file:
                file_content.append(line)
        return file_content

    def write(self, file_path, file_content):
        with open(file_path, 'w') as file:
            file.write(file_content)
{'fraction_non_alphanumeric': 0.08428246013667426, 'fraction_numerical': 0.0, 'mean_word_length': 2.3881748071979434, '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': '7299176', 'n_tokens_mistral': 388, 'n_tokens_neox': 380, 'n_words': 99}