Return true on success and return false on failure.
480341
public function initUploading(
            $signature, $srcFpath, $url, $fileSize, $sliceSize, $bizAttr, $insertOnly) {
        $this->signature = $signature;
        $this->srcFpath = $srcFpath;
        $this->url = $url;
        $this->fileSize = $fileSize;
        $this->sliceSize = $sliceSize;

        // Clear error so caller can successfully retry.
        $this->clearError();

        $request = array(
            'url' => $url,
            'method' => 'post',
            'timeout' => $this->timeoutMs / 1000,
            'data' => array(
                'op' => 'upload_slice_init',
                'filesize' => $fileSize,
                'slice_size' => $sliceSize,
                'insertOnly' => $insertOnly,
            ),
            'header' => array(
                'Authorization: ' . $signature,
            ),
        );

        if (isset($bizAttr) && strlen($bizAttr)) {
            $request['data']['biz_attr'] = $bizAttr;
        }

        $response = $this->sendRequest($request);
        if ($response === false) {
            return false;
        }
        $this->session = $response['data']['session'];

        if (isset($response['data']['slice_size'])) {
            $this->sliceSize = $response['data']['slice_size'];
        }

        if (isset($response['data']['serial_upload']) && $response['data']['serial_upload'] == 1) {
            $this->concurrentTaskNumber = 1;
        }

        return true;
    }
595433
def on_error(self, status_code):
        """"""
        logger.error('Twitter returned error code %s', status_code)
        self.error = status_code
        return False
644145
def on_boolop(self, node):    # ('op', 'values')
        """"""
        val = self.run(node.values[0])
        is_and = ast.And == node.op.__class__
        if (is_and and val) or (not is_and and not val):
            for n in node.values[1:]:
                val = op2func(node.op)(val, self.run(n))
                if (is_and and not val) or (not is_and and val):
                    break
        return val
696359
def yes_or_no(message):
    """"""
    while True:
        print message, '(yes/no)',
        line = raw_input()
        if line is None:
            return None
        line = line.lower()
        if line == 'y' or line == 'ye' or line == 'yes':
            return True
        if line == 'n' or line == 'no':
            return False
1369978
def json_success(self, json):
        
        if type(json) is dict and 'result' in json and json['result'] == 'success':
            return True
        return False
11530
function (fn) {
            return function (response) {
                fn(response.status === "success" ? true : false, response.message, response.data);
            };
        }
481755
def validate(self):
        
        super(BoolFilter, self).validate()

        self._value = truth(str(self._value), self._condition)
        self._condition = "yes" if self._value else "no"
1104417
def validate_bool(b):
    """"""
    if isinstance(b, six.string_types):
        b = b.lower()
    if b in ('t', 'y', 'yes', 'on', 'true', '1', 1, True):
        return True
    elif b in ('f', 'n', 'no', 'off', 'false', '0', 0, False):
        return False
    else:
        raise ValueError('Could not convert "%s" to boolean' % b)
661244
def is_successful(self, retry=False):
        

        if not self.is_terminated(retry=retry):
            return False
        retry_num = options.retry_times
        while retry_num > 0:
            try:
                statuses = self.get_task_statuses()
                return all(task.status == Instance.Task.TaskStatus.SUCCESS
                           for task in statuses.values())
            except (errors.InternalServerError, errors.RequestTimeTooSkewed):
                retry_num -= 1
                if not retry or retry_num <= 0:
                    raise
1141221
def check_results(tmp_):
        """"""
        # TODO: Fix this to work with more meaningful names
        if tmp_['t'] > 0:
            if tmp_['l'] > 0:
                if tmp_['rr'] > 0 or tmp_['ra'] > 1:
                    print 1, 3, tmp_
                    return 3
                elif tmp_['cr'] > 0 or tmp_['ca'] > 1:
                    print 2, 3, tmp_
                    return 3
                elif tmp_['mr'] > 0 or tmp_['ma'] > 1:
                    print 3, 2, tmp_
                    return 2
            if tmp_['cr'] > 1 or tmp_['ca'] > 2:
                print 4, 2, tmp_
                return 2
            if tmp_['mr'] > 0 or tmp_['ma'] > 1:
                if tmp_['cr'] > 0 or tmp_['ca'] > 1:
                    print 6, 0, tmp_
                    return 0
            if tmp_['rr'] > 1 or tmp_['ra'] > 2:
                print 7, 0, tmp_
                return 0
            if tmp_['sr'] > 1 or tmp_['sa'] > 2:
                print 8, 0, tmp_
                return 0
        if tmp_['l'] > 0:
            if tmp_['rr'] > 0 or tmp_['ra'] > 1:
                print 9, 2, tmp_
                return 2
            if tmp_['cr'] > 0 or tmp_['ca'] > 1:
                print 10, 0, tmp_
                return 0
        return -1
919199
def should_execute(self):
        """"""
        return self.args.apply and (self.args.no_confirm or self.confirm_execution())
1053311
def _to_bool(value):
        """"""
        bool_value = False
        if str(value).lower() in ['1', 'true']:
            bool_value = True
        return bool_value
802361
def success(self):
        """"""
        self._check_valid()
        return self._problem._p.Status == gurobipy.GRB.OPTIMAL
36719
def match(self, *args):
        """"""
        if self.fall or not args:
            return True
        elif self.value in args: # changed for v1.5, see below
            self.fall = True
            return True
        else:
            return False
1142623
def _check_bool(result, func, args):  # pylint: disable=unused-argument
    

    if not result:
        raise ctypes.WinError(ctypes.get_last_error())
    return args
315854
def delegate(self, success, **kwargs):
        """"""
        if success:
            self.succeeded(**kwargs)
        else:
            self.failed(**kwargs)
309723
def check_result(running, recurse=False, highstate=None):
    '''
    
    '''
    if not isinstance(running, dict):
        return False

    if not running:
        return False

    ret = True
    for state_id, state_result in six.iteritems(running):
        expected_type = dict
        # The __extend__ state is a list
        if "__extend__" == state_id:
            expected_type = list
        if not recurse and not isinstance(state_result, expected_type):
            ret = False
        if ret and isinstance(state_result, dict):
            result = state_result.get('result', _empty)
            if result is False:
                ret = False
            # only override return value if we are not already failed
            elif result is _empty and isinstance(state_result, dict) and ret:
                ret = check_result(
                    state_result, recurse=True, highstate=highstate)
        # if we detect a fail, check for onfail requisites
        if not ret:
            # ret can be None in case of no onfail reqs, recast it to bool
            ret = bool(check_onfail_requisites(state_id, state_result,
                                               running, highstate))
        # return as soon as we got a failure
        if not ret:
            break
    return ret