Args:
            code: (Optional) set code
            ret_r: (Optional) force to return Result. Default value is False
        returns:
            response code(0-success, others-failure) or self
977096
def code(self, code=None, ret_r=False):
        '''
        
        '''
        if code or ret_r:
            self._code = code
            return self
        return self._code
48272
function getResponseStatusCode (res) {
  var status = res.statusCode

  // default status code to 500 if outside valid range
  if (typeof status !== 'number' || status < 400 || status > 599) {
    status = 500
  }

  return status
}
202318
function RETSError(ReplyCode, ReplyText) {
    Error.call(this);
    // Strict mode doesn't like arguments.callee
    Error.captureStackTrace(this);
    this.codes = require('./codes');
    this.code = ReplyCode || null;
    this.name = 'RETSError';
    this.message = '';
    this.ReplyText = ReplyText || null;
    this.wrapper = {
        start: " - [ReplyText: ",
        end: "]"
    };
    if (typeof this.codes[this.code] !== 'undefined') {
        if (typeof this.codes[this.code][0] !== 'undefined') {
            this.message = this.codes[this.code][0];
        }
        if (this.ReplyText !== null) {
            this.message += this.wrapper.start + this.ReplyText + this.wrapper.end;
        }
    }
    this.description = this.message;
}
183257
def _request(self, method, url, query_or_data=None, **kwargs):
        

        if query_or_data is None:
            query_or_data = {}

        request_method = getattr(self, '_http_{0}'.format(method))
        response = retry_request(self)(request_method)(url, query_or_data, **kwargs)

        if self.raw_mode:
            return response

        if response.status_code >= 300:
            error = get_error(response)
            if self.raise_errors:
                raise error
            return error

        # Return response object on NoContent
        if response.status_code == 204 or not response.text:
            return response

        return ResourceBuilder(
            self,
            self.default_locale,
            response.json()
        ).build()
315479
def error_code(self, code):
		

		context = {
			'error_title': "Damn error page %i" % code,
			'error_header': "What has happened?",
			'error_footer': "WHY!?!?!",
			'error_messages': {
				('Error %i' % code): self.__message__(code)
			}
		}
		return WWebTemplateResponse(WTemplateText(self.__error_template__()), context=context)
557813
def error_code(self, code):
		
		return WWebResponse(
			status=code,
			headers=WHTTPHeaders(**{'Content-Type': 'text/plain; charset=utf-8'}),
			response_data=self.__message__(code).encode()
		)
512696
public static DnsResponseCode valueOf(int responseCode) {
        switch (responseCode) {
        case 0:
            return NOERROR;
        case 1:
            return FORMERR;
        case 2:
            return SERVFAIL;
        case 3:
            return NXDOMAIN;
        case 4:
            return NOTIMP;
        case 5:
            return REFUSED;
        case 6:
            return YXDOMAIN;
        case 7:
            return YXRRSET;
        case 8:
            return NXRRSET;
        case 9:
            return NOTAUTH;
        case 10:
            return NOTZONE;
        case 16:
            return BADVERS_OR_BADSIG;
        case 17:
            return BADKEY;
        case 18:
            return BADTIME;
        case 19:
            return BADMODE;
        case 20:
            return BADNAME;
        case 21:
            return BADALG;
        default:
            return new DnsResponseCode(responseCode);
        }
    }
1332796
def code(self, code):
        
        allowed_values = [400, 401, 404]
        if code not in allowed_values:
            raise ValueError(
                "Invalid value for `code` ({0}), must be one of {1}"
                .format(code, allowed_values)
            )

        self._code = code
800815
def evaluate_code(self, code):
        

        if not code:
            return False

        LOGGER.debug("> Evaluating given code.")

        code = code.endswith("\n") and code or "{0}\n".format(code)

        code = code.split("\n", 3)
        for i, line in enumerate(code[:-2]):
            if "coding" in line:
                code[i] = line.replace("=", "\=").replace(":", "\:")
                break
        code = "\n".join(code)

        sys.stdout.write(code)
        self.__console.runcode(code)
        return True
189923
def _get_response_json(self, res):
        

        try:
            error = res.json()
        except ValueError:
            error = {
                "message": "The API did not respond with JSON, but: {0}".format(res.text[:1000]),
                "error_code": "{0}".format(res.status_code)
            }
        return error
302746
def quick_response(self, status_code):
        
        translator = Translator(environ=self.environ)
        if status_code == 404:
            self.status(404)
            self.message(translator.trans('http_messages.404'))
        elif status_code == 401:
            self.status(401)
            self.message(translator.trans('http_messages.401'))
        elif status_code == 400:
            self.status(400)
            self.message(translator.trans('http_messages.400'))
        elif status_code == 200:
            self.status(200)
            self.message(translator.trans('http_messages.200'))
923784
def get_response(_code):
    
    if _code:
        code = str(_code)
        return code[:-2] + str(int(code[-2:-1]) + 1) + code[-1]
    else:
        return None
620914
def check_response_code(resp):
    
    if resp["status"] == "OK" or resp["status"] == "ZERO_RESULTS":
        return

    if resp["status"] == "REQUEST_DENIED":
        raise Exception("Google Places " + resp["status"],
                        "Request was denied, the API key is invalid.")

    if resp["status"] == "OVER_QUERY_LIMIT":
        raise Exception("Google Places " + resp["status"],
                        "You exceeded your Query Limit for Google Places API Web Service, "
                        "check https://developers.google.com/places/web-service/usage "
                        "to upgrade your quota.")

    if resp["status"] == "INVALID_REQUEST":
        raise Exception("Google Places " + resp["status"],
                        "The query string is malformed, "
                        "check if your formatting for lat/lng and radius is correct.")

    raise Exception("Google Places " + resp["status"],
                    "Unidentified error with the Places API, please check the response code")
408831
def validate_response(self, resp):
        
        ok, msg = self.contract.validate(self.returns, 
                                         self.returns.is_array, resp)
        if not ok:
            vals = (self.full_name, str(resp), msg)
            msg = "Function '%s' invalid response: '%s'. %s" % vals
            raise RpcException(ERR_INVALID_RESP, msg)
660885
public static HttpResponseStatus valueOf(int code) {
        HttpResponseStatus status = valueOf0(code);
        return status != null ? status : new HttpResponseStatus(code);
    }
99219
def getratio(self, code) :
		
		if len(code) == 0 : return 0

		code_replaced = self.prog.sub('', code)
		return (len(code) - len(code_replaced)) / len(code)
913046
def nvrtcGetErrorString(self, code):
        
        code_int = c_int(code)
        res = self._lib.nvrtcGetErrorString(code_int)
        return res.decode('utf-8')