Return true on success and return false on failure.
185514
public function performUploading() {
        for ($i = 0; $i < $this->concurrentTaskNumber; ++$i) {
            if ($this->offset >= $this->fileSize) {
                break;
            }

            $sliceContent = file_get_contents($this->srcFpath, false, null, $this->offset, $this->sliceSize);
            if ($sliceContent === false) {
                $this->setError(Response::COSAPI_PARAMS_ERROR, 'read file ' . $this->srcFpath . ' error');
                return false;
            }

            $request = new HttpRequest();
            $request->timeoutMs = $this->timeoutMs;
            $request->url = $this->url;
            $request->method = 'POST';
            $request->customHeaders = array(
                        'Authorization: ' . $this->signature,
                    );
            $request->dataToPost = array(
                        'op' => 'upload_slice_data',
                        'session' => $this->session,
                        'offset' => $this->offset,
                        'filecontent' => $sliceContent,
                        'datamd5' => md5($sliceContent),
                    );
            $request->userData = array(
                        'retryCount' => 0,
                    );

            $this->libcurlWrapper->startSendingRequest($request, array($this, 'uploadCallback'));

            $this->offset += $this->sliceSize;
        }

        $this->libcurlWrapper->performSendingRequest();

        if ($this->errorCode !== Response::COSAPI_SUCCESS) {
            return false;
        }

        return true;
    }
1019138
def validate_response(self):
        """"""
        if self.response is None:
            logger.error("Failed to submit")
            return False

        if not self.response:
            logger.error(
                "HTTP status %d: failed to submit to %s",
                self.response.status_code,
                self.response.url,
            )
            return False

        if not self.parsed_response:
            logger.error("Submit to %s failed, invalid response received", self.response.url)
            return False

        error_message = self.get_error_message()
        if error_message:
            logger.error("Submit to %s failed with error", self.response.url)
            logger.debug("Error message: %s", error_message)
            return False

        if not self.job_ids:
            logger.error("Submit to %s failed to get job id", self.response.url)
            return False

        logger.info("Results received by the Importer (HTTP status %d)", self.response.status_code)
        logger.info("Job IDs: %s", self.job_ids)

        return True
192858
def __assert_false(returned):
        '''
        
        '''
        result = "Pass"
        if isinstance(returned, str):
            try:
                returned = bool(returned)
            except ValueError:
                raise
        try:
            assert (returned is False), "{0} not False".format(returned)
        except AssertionError as err:
            result = "Fail: " + six.text_type(err)
        return result
505866
def boolean(v):
    """"""
    if nodesetp(v):
        return len(v) > 0
    elif numberp(v):
        if v == 0 or v != v:
            return False
        return True
    elif stringp(v):
        return v != ''
    return v
4988
def on_success(self, fn, *args, **kwargs):
        

        self._callbacks.append((fn, args, kwargs))

        result = self._resulted_in
        if result is not _NOTHING_YET:
            self._succeed(result=result)
954044
def success(self, value):
        
        if value == self._defaults['success'] and 'success' in self._values:
            del self._values['success']
        else:
            self._values['success'] = value
241361
def ratable_result(value, name, msgs):
    """"""
    return lambda w: Result(w, value, name, msgs)
668209
def true_false_returns(func):
    

    @functools.wraps(func)
    def _execute(*args, **kwargs):
        """Executes function, if error returns False, else True

        :param args: args of function
        :param kwargs: extra args of function
        :param *args: args
        :param **kwargs: extra args
        :return: True iff ok, else False
        """

        try:
            func(*args, **kwargs)
            return True
        except:
            return False

    return _execute
39252
def result(self, value):
        """"""
        if self._process_result:
            self._result = self._process_result(value)

        self._raw_result = value
462107
protected boolean isFailure(ExecutionResult result) {
    if (result.isNonResult())
      return false;
    else if (policy instanceof FailurePolicy)
      return ((FailurePolicy) policy).isFailure(result);
    else
      return result.getFailure() != null;
  }
709320
function (err, user, info) {
    if (err) {
      return self.error(err)
    }
    if (!user) {
      return self.fail(info)
    }
    self.success(user, info)
  }
1088620
def fail(self, message, status=500, **kw):
        
        self.request.response.setStatus(status)
        result = {"success": False, "errors": message, "status": status}
        result.update(kw)
        return result
202137
function (successValue, failValue, fns) {
            for (var i = 0; i < fns.length; i++) {
                var o = fns[i][0][fns[i][1]].apply(fns[i][0], fns[i][2]);
                if (o === failValue) {
                    return o;
                }
            }
            return successValue;
        }
874146
def truthy(value):
    
    if value is None or value == '':
        return False
    value = str(value)
    try:
        return (int(value) != 0)
    except:
        pass
    return (truthy_true_yes.match(value) is not None)
690215
def observe(self, success, failure):
        '''
        

        '''
        if isinstance(success, int) is False:
            if isinstance(success, float) is False:
                raise TypeError()
        if isinstance(failure, int) is False:
            if isinstance(failure, float) is False:
                raise TypeError()

        if success <= 0:
            raise ValueError()
        if failure <= 0:
            raise ValueError()

        self.__success += success
        self.__failure += failure
557034
def has_succeed(self):
        
        status_code = self._response.status_code

        if status_code in [HTTP_CODE_ZERO, HTTP_CODE_SUCCESS, HTTP_CODE_CREATED, HTTP_CODE_EMPTY, HTTP_CODE_MULTIPLE_CHOICES]:
            return True

        if status_code in [HTTP_CODE_BAD_REQUEST, HTTP_CODE_UNAUTHORIZED, HTTP_CODE_PERMISSION_DENIED, HTTP_CODE_NOT_FOUND, HTTP_CODE_METHOD_NOT_ALLOWED, HTTP_CODE_CONNECTION_TIMEOUT, HTTP_CODE_CONFLICT, HTTP_CODE_PRECONDITION_FAILED, HTTP_CODE_INTERNAL_SERVER_ERROR, HTTP_CODE_SERVICE_UNAVAILABLE]:
            return False

        raise Exception('Unknown status code %s.', status_code)
129352
def success(self):
        """"""
        self._check_valid()
        return self._problem._cp.solution.get_status() in (
            self._problem._cp.solution.status.optimal,
            self._problem._cp.solution.status.optimal_tolerance,
            self._problem._cp.solution.status.MIP_optimal)