<commit_before>import glob
import os
import shutil
from exporters.writers.filebase_base_writer import FilebaseBaseWriter


class FSWriter(FilebaseBaseWriter):
    """
    Writes items to local file system files. It is a File Based writer, so it has filebase
    option available

        - filebase (str)
            Path to store the exported files
    """

    supported_options = {

    }

    def __init__(self, options, *args, **kwargs):
        super(FSWriter, self).__init__(options, *args, **kwargs)
        self.logger.info(
            'FSWriter has been initiated. Writing to: {}'.format(self.filebase))

    def _create_path_if_not_exist(self, path):
        """
        Creates a folders path if it doesn't exist
        """
        if not os.path.exists(path):
            os.makedirs(path)

    def get_file_suffix(self, path, prefix):
        """
        Gets a valid filename
        """
        try:
            number_of_files = len(glob.glob(os.path.join(path, prefix) + '*'))
        except:<commit_msg>Fix empty path in create path method<commit_after>import glob
import os
import shutil
from exporters.writers.filebase_base_writer import FilebaseBaseWriter


class FSWriter(FilebaseBaseWriter):
    """
    Writes items to local file system files. It is a File Based writer, so it has filebase
    option available

        - filebase (str)
            Path to store the exported files
    """

    supported_options = {

    }

    def __init__(self, options, *args, **kwargs):
        super(FSWriter, self).__init__(options, *args, **kwargs)
        self.logger.info(
            'FSWriter has been initiated. Writing to: {}'.format(self.filebase))

    def _create_path_if_not_exist(self, path):
        """
        Creates a folders path if it doesn't exist
        """
        if path and not os.path.exists(path):
            os.makedirs(path)

    def get_file_suffix(self, path, prefix):
        """
        Gets a valid filename
        """
        try:
            number_of_files = len(glob.glob(os.path.join(path, prefix) + '*'))
        except:
{'fraction_non_alphanumeric': 0.09903846153846153, 'fraction_numerical': 0.0, 'mean_word_length': 2.4058919803600656, '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': '4913820', 'n_tokens_mistral': 617, 'n_tokens_neox': 592, 'n_words': 177}