def found_terminator(self):
        """Called when the terminator is found in the buffer
        """

        message = b''.join(self.rbuffer) if PY3 else ''.join(self.rbuffer)
        self.rbuffer = []

        with json_decode(message) as data:
            if not data:
                logging.info('No data received in the handler')
                return

            if data['method'] == 'check':
                self.return_back(message='Ok', uid=data['uid'])
                return

            self.server.last_call = time.time()

        if type(data) is dict:
            logging.info(
                'client requests: {0}'.format(data['method'])
            )

            method = data.pop('method')
            uid = data.pop('uid')
            vid = data.pop('vid', None)
            handler_type = data.pop('handler')
            self.handle_command(handler_type, method, uid, vid, data)
        else:
            logging.error(
                'client sent somethinf that I don\'t understand: {0}'.format(
                    data
                )
            )
Example #2
0
    def found_terminator(self):
        """Called when the terminator is found in the buffer
        """

        message = b"".join(self.rbuffer) if PY3 else "".join(self.rbuffer)
        self.rbuffer = []

        with json_decode(message) as self.data:
            if not self.data:
                logging.info("No data received in the handler")
                return

            if self.data["method"] == "check":
                self.return_back(message="Ok", uid=self.data["uid"])
                return

            self.server.last_call = time.time()

        if type(self.data) is dict:
            logging.info("client requests: {0}".format(self.data["method"]))

            method = self.data.pop("method")
            uid = self.data.pop("uid")
            vid = self.data.pop("vid", None)
            if "lint" in method:
                self.handle_lint_command(method, uid, vid)
            elif "refactor" in method:
                self.handle_refactor_command(method, uid)
            else:
                self.handle_jedi_command(method, uid)
        else:
            logging.error("client sent somethinf that I don't understand: {0}".format(self.data))
Example #3
0
    def found_terminator(self):
        """Called when the terminator is found in the buffer
        """

        message = b''.join(self.rbuffer) if PY3 else ''.join(self.rbuffer)
        self.rbuffer = []

        with json_decode(message) as self.data:
            if not self.data:
                logging.info('No data received in the handler')
                return

            if self.data['method'] == 'check':
                self.return_back(message='Ok', uid=self.data['uid'])
                return

            self.server.last_call = time.time()

        if type(self.data) is dict:
            logging.info('client requests: {0}'.format(self.data['method']))

            method = self.data.pop('method')
            uid = self.data.pop('uid')
            vid = self.data.pop('vid', None)
            if 'lint' in method:
                self.handle_lint_command(method, uid, vid)
            elif 'refactor' in method:
                self.handle_refactor_command(method, uid)
            else:
                self.handle_jedi_command(method, uid)
        else:
            logging.error(
                'client sent somethinf that I don\'t understand: {0}'.format(
                    self.data))
Example #4
0
    def found_terminator(self):
        """Called when the terminator is found in the buffer
        """

        message = b''.join(self.rbuffer) if PY3 else ''.join(self.rbuffer)
        self.rbuffer = []

        with json_decode(message) as self.data:
            if not self.data:
                logging.info('No data received in the handler')
                return

            if self.data['method'] == 'check':
                self.return_back(message='Ok', uid=self.data['uid'])
                return

            self.server.last_call = time.time()

        if type(self.data) is dict:
            logging.info(
                'client requests: {0}'.format(self.data['method'])
            )

            method = self.data.pop('method')
            uid = self.data.pop('uid')
            if 'lint' in method:
                self.handle_lint_command(method, uid)
            elif 'refactor' in method:
                self.handle_refactor_command(method, uid)
            else:
                self.handle_jedi_command(method, uid)
        else:
            logging.error(
                'client sent somethinf that I don\'t understand: {0}'.format(
                    self.data
                )
            )