Determine a retcode for a given return
439082
def _get_retcode(self, ret):
        '''
        
        '''
        retcode = 0
        # if there is a dict with retcode, use that
        if isinstance(ret, dict) and ret.get('retcode', 0) != 0:
            if isinstance(ret.get('retcode', 0), dict):
                return max(six.itervalues(ret.get('retcode', {0: 0})))
            return ret['retcode']
        # if its a boolean, False means 1
        elif isinstance(ret, bool) and not ret:
            return 1
        return retcode
945327
def returner(ret):
    '''
    
    '''

    job_fun = ret['fun']
    job_fun_escaped = job_fun.replace('.', '_')
    job_id = ret['jid']
    job_retcode = ret.get('retcode', 1)
    job_success = True if not job_retcode else False

    options = _get_options(ret)

    if job_fun in options['functions_blacklist']:
        log.info(
            'Won\'t push new data to Elasticsearch, job with jid=%s and '
            'function=%s which is in the user-defined list of ignored '
            'functions', job_id, job_fun
        )
        return
    if ret.get('data', None) is None and ret.get('return') is None:
        log.info(
            'Won\'t push new data to Elasticsearch, job with jid=%s was '
            'not successful', job_id
        )
        return

    # Build the index name
    if options['states_single_index'] and job_fun in STATE_FUNCTIONS:
        index = 'salt-{0}'.format(STATE_FUNCTIONS[job_fun])
    else:
        index = 'salt-{0}'.format(job_fun_escaped)

    if options['index_date']:
        index = '{0}-{1}'.format(index,
            datetime.date.today().strftime('%Y.%m.%d'))

    counts = {}

    # Do some special processing for state returns
    if job_fun in STATE_FUNCTIONS:
        # Init the state counts
        if options['states_count']:
            counts = {
                'suceeded': 0,
                'failed':   0,
            }

        # Prepend each state execution key in ret['data'] with a zero-padded
        # version of the '__run_num__' field allowing the states to be ordered
        # more easily. Change the index to be
        # index to be '<index>-ordered' so as not to clash with the unsorted
        # index data format
        if options['states_order_output'] and isinstance(ret['data'], dict):
            index = '{0}-ordered'.format(index)
            max_chars = len(six.text_type(len(ret['data'])))

            for uid, data in six.iteritems(ret['data']):
                # Skip keys we've already prefixed
                if uid.startswith(tuple('0123456789')):
                    continue

                # Store the function being called as it's a useful key to search
                decoded_uid = uid.split('_|-')
                ret['data'][uid]['_func'] = '{0}.{1}'.format(
                    decoded_uid[0],
                    decoded_uid[-1]
                )

                # Prefix the key with the run order so it can be sorted
                new_uid = '{0}_|-{1}'.format(
                    six.text_type(data['__run_num__']).zfill(max_chars),
                    uid,
                )

                ret['data'][new_uid] = ret['data'].pop(uid)

        # Catch a state output that has failed and where the error message is
        # not in a dict as expected. This prevents elasticsearch from
        # complaining about a mapping error
        elif not isinstance(ret['data'], dict):
            ret['data'] = {job_fun_escaped: {'return': ret['data']}}

        # Need to count state successes and failures
        if options['states_count']:
            for state_data in ret['data'].values():
                if state_data['result'] is False:
                    counts['failed'] += 1
                else:
                    counts['suceeded'] += 1

    # Ensure the index exists
    _ensure_index(index)

    # Build the payload
    class UTC(tzinfo):
        def utcoffset(self, dt):
            return timedelta(0)

        def tzname(self, dt):
            return 'UTC'

        def dst(self, dt):
            return timedelta(0)

    utc = UTC()
    data = {
        '@timestamp': datetime.datetime.now(utc).isoformat(),
        'success': job_success,
        'retcode': job_retcode,
        'minion': ret['id'],
        'fun': job_fun,
        'jid': job_id,
        'counts': counts,
        'data': _convert_keys(ret['data'])
    }

    if options['debug_returner_payload']:
        log.debug('elasicsearch payload: %s', data)

    # Post the payload
    ret = __salt__['elasticsearch.document_create'](index=index,
                                                    doc_type=options['doc_type'],
                                                    body=salt.utils.json.dumps(data))
223182
def _verify_run(out, cmd=None):
    '''
    
    '''
    if out.get('retcode', 0) and out['stderr']:
        if cmd:
            log.debug('Command: \'%s\'', cmd)

        log.debug('Return code: %s', out.get('retcode'))
        log.debug('Error output:\n%s', out.get('stderr', 'N/A'))

        raise CommandExecutionError(out['stderr'])
553606
function isInReturnStatement(node) {
			while (node) {
				if (node.type === "ReturnStatement" ||
					(node.type === "ArrowFunctionExpression" && node.body.type !== "BlockStatement")) {
					return true;
				}
				node = node.parent;
			}

			return false;
		}
991943
static function Configlist_return()
    {
        $old = self::$current;
        self::$current = 0;
        self::$currentend = &self::$current;
        return $old;
    }
716699
def do_retval(self, arg):
        
        locals = self.get_locals(self.curframe)
        if '__return__' in locals:
            self.message(bdb.safe_repr(locals['__return__']))
        else:
            self.error('Not yet returned!')
249485
private void checkReturnValue(Decl.FunctionOrMethod d, Environment last) {
		if (d.match(Modifier.Native.class) == null && last != FlowTypeUtils.BOTTOM && d.getReturns().size() != 0) {
			// In this case, code reaches the end of the function or method and,
			// furthermore, that this requires a return value. To get here means
			// that there was no explicit return statement given on at least one
			// execution path.
			syntaxError(d, MISSING_RETURN_STATEMENT);
		}
	}
72765
def _check_retcode(cmd):
    '''
    
    '''
    return salt.modules.cmdmod.retcode(cmd, output_loglevel='quiet', ignore_retcode=True) == 0
530437
def returner(load):
    '''
    
    '''
    conn = _get_conn()
    if conn is None:
        return None
    cur = conn.cursor()
    sql = '''INSERT INTO salt_returns
            (fun, jid, return, id, success)
            VALUES (%s, %s, %s, %s, %s)'''
    try:
        ret = six.text_type(load['return'])
    except UnicodeDecodeError:
        ret = str(load['return'])
    job_ret = {'return': ret}
    if 'retcode' in load:
        job_ret['retcode'] = load['retcode']
    if 'success' in load:
        job_ret['success'] = load['success']
    cur.execute(
        sql, (
            load['fun'],
            load['jid'],
            salt.utils.json.dumps(job_ret),
            load['id'],
            load.get('success'),
        )
    )
    _close_conn(conn)
1306217
def _get_initial_returning(self):
        

        hooker = None
        if self.is_syscall:
            hooker = self.project.simos.syscall_from_addr(self.addr)
        elif self.is_simprocedure:
            hooker = self.project.hooked_by(self.addr)
        if hooker and hasattr(hooker, 'NO_RET'):
            return not hooker.NO_RET

        # Cannot determine
        return None
1327684
def formatreturn(arg, input_is_array=False):
    """"""
    if not input_is_array and arg.size == 1:
        arg = arg.item()
    return arg
623998
def get_return_code(self, stderr=STDOUT):
        
        args = shlex.split(self.cmd)
        return call(args, stdout=PIPE, stderr=stderr)
547576
def get_return_from(self, check):
        
        for prop in ['exit_status', 'output', 'long_output', 'check_time', 'execution_time',
                     'perf_data', 'u_time', 's_time']:
            setattr(self, prop, getattr(check, prop))
974586
def returner(ret):
    '''
    
    '''
    conn = _get_conn(ret)
    cur = conn.cursor()
    sql = '''INSERT INTO salt_returns
            (fun, jid, retval, id, success, full_ret)
            VALUES (?, ?, ?, ?, ?, ?)'''
    cur.execute(
        sql, (
            ret['fun'],
            ret['jid'],
            salt.utils.json.dumps(ret['return']),
            ret['id'],
            ret['success'],
            salt.utils.json.dumps(ret)
        )
    )
    _close_conn(conn)
977096
def code(self, code=None, ret_r=False):
        '''
        
        '''
        if code or ret_r:
            self._code = code
            return self
        return self._code
99578
function alwaysReturns(node) {
            if (node.type === "BlockStatement") {

                // If we have a BlockStatement, check each consequent body node.
                return node.body.some(checkForReturnOrIf);
            }

            /*
             * If not a block statement, make sure the consequent isn't a
             * ReturnStatement or an IfStatement with returns on both paths.
             */
            return checkForReturnOrIf(node);
        }
444466
@Override
    public R visitReturn(ReturnTree node, P p) {
        return scan(node.getExpression(), p);
    }