# Path: zabby/core/exceptions.py
# class WrongArgumentError(Exception):
#     """ Wrong argument was passed to a function"""
# 
# Path: zabby/core/six.py
# def b(s):
#     return s.encode('utf-8')


import string
import struct
import logging
import sys
    import socketserver
    import SocketServer as socketserver
from zabby.core.exceptions import WrongArgumentError
from zabby.core.six import b
    ,arg0 and "","arg0" will be parsed as ['','arg0']
    , will be parsed as ['']
    """

    def parse(self, unparsed_arguments):
        arguments = list()

        while len(unparsed_arguments) != 0:
            argument_end = self._find_argument_end(unparsed_arguments)

            argument = unparsed_arguments[:argument_end]
            argument = argument.strip(self.to_strip)
            argument = argument.replace('\\' + self.quote, self.quote)
            arguments.append(argument)
            unparsed_arguments = unparsed_arguments[argument_end + 1:]

        return arguments

    def _find_first_comma(self, unparsed_arguments, start):
        first_comma_position = unparsed_arguments.find(self.separator, start)
        return (first_comma_position
                if first_comma_position >= 0
                else len(unparsed_arguments))

    def _find_quoted_argument_end(self, unparsed_arguments):
        argument_end_found = False
        start = 1
        while not argument_end_found:
            quote_position = unparsed_arguments.find(self.quote, start)
            if quote_position == -1:

# Path: zabby/core/exceptions.py
# class WrongArgumentError(Exception):
#     """ Wrong argument was passed to a function"""
# 
# Path: zabby/core/six.py
# def b(s):
#     return s.encode('utf-8')


# Path: zabby/agent.py
import string
import struct
import logging
import sys
    import socketserver
    import SocketServer as socketserver
from zabby.core.exceptions import WrongArgumentError
from zabby.core.six import b

    ,arg0 and "","arg0" will be parsed as ['','arg0']
    , will be parsed as ['']
    """

    def parse(self, unparsed_arguments):
        arguments = list()

        while len(unparsed_arguments) != 0:
            argument_end = self._find_argument_end(unparsed_arguments)

            argument = unparsed_arguments[:argument_end]
            argument = argument.strip(self.to_strip)
            argument = argument.replace('\\' + self.quote, self.quote)
            arguments.append(argument)
            unparsed_arguments = unparsed_arguments[argument_end + 1:]

        return arguments

    def _find_first_comma(self, unparsed_arguments, start):
        first_comma_position = unparsed_arguments.find(self.separator, start)
        return (first_comma_position
                if first_comma_position >= 0
                else len(unparsed_arguments))

    def _find_quoted_argument_end(self, unparsed_arguments):
        argument_end_found = False
        start = 1
        while not argument_end_found:
            quote_position = unparsed_arguments.find(self.quote, start)
            if quote_position == -1:

                raise WrongArgumentError('Missing terminating quote')