<commit_before>import os
import pickle

from lexos.helpers import constants
from lexos.managers.file_manager import FileManager
from lexos.models.base_model import BaseModel
from lexos.receivers.session_receiver import SessionReceiver


class FileManagerModel(BaseModel):

    def __init__(self):
        """A model to control file manager.

        the _file_manager_path is where the file manager is stored
        the file_manager is the file_manager for current session.
        We uses pickel library to save and load filemanager on our disk
        """
        super().__init__()

    @property
    def _file_manager_path(self) -> str:

        # receive option from fontend
        session_folder = SessionReceiver().get_session_folder_nullable()

        return os.path.join(session_folder, constants.FILEMANAGER_FILENAME)

    def load_file_manager(self) -> FileManager:
        """Loads the file manager for the current session from the hard drive.

        :return: file manager object for the session.
        """
        return pickle.load(open(self._file_manager_path, 'rb'))

    def save_file_manager(self, file_manager: FileManager):
        """saves file manager to file manger path."""

        pickle.dump(file_manager, open(self._file_manager_path, 'wb'))
<commit_msg>Fix typo<commit_after>import os
import pickle

from lexos.helpers import constants
from lexos.managers.file_manager import FileManager
from lexos.models.base_model import BaseModel
from lexos.receivers.session_receiver import SessionReceiver


class FileManagerModel(BaseModel):

    def __init__(self):
        """A model to control file manager.

        the _file_manager_path is where the file manager is stored
        the file_manager is the file_manager for current session.
        We uses pickel library to save and load filemanager on our disk
        """
        super().__init__()

    @property
    def _file_manager_path(self) -> str:

        # receive option from frontend
        session_folder = SessionReceiver().get_session_folder_nullable()

        return os.path.join(session_folder, constants.FILEMANAGER_FILENAME)

    def load_file_manager(self) -> FileManager:
        """Loads the file manager for the current session from the hard drive.

        :return: file manager object for the session.
        """
        return pickle.load(open(self._file_manager_path, 'rb'))

    def save_file_manager(self, file_manager: FileManager):
        """saves file manager to file manger path."""

        pickle.dump(file_manager, open(self._file_manager_path, 'wb'))

{'fraction_non_alphanumeric': 0.07303807303807304, 'fraction_numerical': 0.0, 'mean_word_length': 3.379251700680272, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '4491906', 'n_tokens_mistral': 719, 'n_tokens_neox': 692, 'n_words': 225}