@defer.inlineCallbacks
    def call_py(self, jsondata):
        try:
            try:
                rdata = json.loads(jsondata)
            except ValueError:
                raise ParseError
        except ParseError, e:
            defer.returnValue(self._get_err(e))
            return

        # set some default values for error handling
        request = self._get_default_vals()

        try:
            if isinstance(rdata, dict) and rdata:
                # It's a single request.
                self._fill_request(request, rdata)
                respond = yield self._handle_request(request)

                # Don't respond to notifications
                if respond is None:
                    defer.returnValue(None)
                else:
                    defer.returnValue(respond)
                return
            elif isinstance(rdata, list) and rdata:
                # It's a batch.
                requests = []
                responds = []

                for rdata_ in rdata:
                    # set some default values for error handling
                    request_ = self._get_default_vals()
                    try:
                        self._fill_request(request_, rdata_)
                    except InvalidRequestError, e:
                        err = self._get_err(e, request_['id'])
                        if err:
                            responds.append(err)
                        continue
                    except JSONRPCError, e:
                        err = self._get_err(e, request_['id'])
                        if err:
                            responds.append(err)
                        continue

                    requests.append(request_)

                for request_ in requests:
                    try:
                        # TODO: We should use a deferred list so requests
                        #       are processed in parallel
                        respond = yield self._handle_request(request_)
                    except JSONRPCError, e:
                        respond = self._get_err(e,
                                                request_['id'],
                                                request_['jsonrpc'])

                    # Don't respond to notifications
                    if respond is not None:
                        responds.append(respond)

                if responds:
                    defer.returnValue(responds)
                    return

                # Nothing to respond.
                defer.returnValue(None)
                return
            else:
                # empty dict, list or wrong type
                raise InvalidRequestError
        except InvalidRequestError, e:
            defer.returnValue(self._get_err(e, request['id']))
        except JSONRPCError, e:
            defer.returnValue(self._get_err(e,
                                            request['id'],
                                            request['jsonrpc']))
Add option groups from specific modules
dataset/ETHPy150Open flowroute/txjason/txjason/service.py/JSONRPCService.call_py--crossover with--dataset/ETHPy150Open Mouse-Imaging-Centre/pydpiper/atoms_and_modules/LSQ6.py/LSQ6Registration.setup_options