pyxplorer_plus/loader.py
def check_separator(self, data):
        """
        THis method evaluates a list of separators on the input data to check which one
        is correct. This is done by first splitting the input by newline and then
        checking if the split by separator is equal for each input row except the last
        that might be incomplete due to the limited input data

        :param data: input data to check
        :return:
        """

        sep_list = [r'\t', r';', r',', r'|', r'\s+']

        data_copy = data
        for sep in sep_list:
            # Check if the count matches each line
            splitted = data_copy.split("\n")
            parts = [len(re.split(sep, line)) for line in splitted]

            # If we did not split anything continue
            if sum(parts) == len(splitted):
                continue

            diff = 0

            for i in range(len(parts[1:-1])):
                diff += abs(parts[i] - parts[i + 1])

            if diff == 0:
                return sep, parts[0]

        # If we reach this point we did not find a separator
        return None

        THis method evaluates a list of separators on the input data to check which one
        is correct. This is done by first splitting the input by newline and then
        checking if the split by separator is equal for each input row except the last
        that might be incomplete due to the limited input data

        :param data: input data to check
        :return:
        
THis method evaluates a list of separators on the input data to check which one
is correct. This is done by first splitting the input by newline and then
checking if the split by separator is equal for each input row except the last
that might be incomplete due to the limited input data
THis method evaluates a list of separators on the input data to check which one is correct . This is done by first splitting the input by newline and then checking if the split by separator is equal for each input row except the last that might be incomplete due to the limited input data
def check_separator(self, data):
        sep_list = [r'\t', r';', r',', r'|', r'\s+']
        data_copy = data
        for sep in sep_list:
            splitted = data_copy.split("\n")
            parts = [len(re.split(sep, line)) for line in splitted]
            if sum(parts) == len(splitted):
                continue
            diff = 0
            for i in range(len(parts[1:-1])):
                diff += abs(parts[i] - parts[i + 1])
            if diff == 0:
                return sep, parts[0]
        return None
def check_separator ( self , data ) : sep_list = [ r'\t' , r';' , r',' , r'|' , r'\s+' ] data_copy = data for sep in sep_list : splitted = data_copy . split ( "\n" ) parts = [ len ( re . split ( sep , line ) ) for line in splitted ] if sum ( parts ) == len ( splitted ) : continue diff = 0 for i in range ( len ( parts [ 1 : - 1 ] ) ) : diff += abs ( parts [ i ] - parts [ i + 1 ] ) if diff == 0 : return sep , parts [ 0 ] return None
THis method evaluates a list of separators on the input data to check which one
is correct.
THis method evaluates a list of separators on the input data to check which one is correct .
"""
        THis method evaluates a list of separators on the input data to check which one
        is correct. This is done by first splitting the input by newline and then
        checking if the split by separator is equal for each input row except the last
        that might be incomplete due to the limited input data

        :param data: input data to check
        :return:
        """ # Check if the count matches each line # If we did not split anything continue # If we reach this point we did not find a separator
None
self
data
input data to check
input data to check