Encode the name, the status of all checks, and the current overall status.
505979
def to_dict(self):
        
        if not isinstance(self.graph.loader, PartitioningLoader):
            return dict(msg="Config sharing disabled for non-partioned loader")

        if not hasattr(self.graph.loader, "secrets"):
            return dict(msg="Config sharing disabled if no secrets are labelled")

        def remove_nulls(dct):
            return {key: value for key, value in dct.items() if value is not None}

        return loads(
            dumps(self.graph.loader.config, skipkeys=True, default=lambda obj: None),
            object_hook=remove_nulls,
        )
536026
def prepare_check(data):
    
    if not data:
        return None, {}

    if isinstance(data, str):
        return data, {}

    result = {}
    if "ID" in data:
        result["CheckID"] = data["ID"]
    for k in ("Node", "CheckID", "Name", "Notes", "Status", "ServiceID"):
        if k in data:
            result[k] = data[k]
    if list(result) == ["CheckID"]:
        return result["CheckID"], {}
    return result.get("CheckID"), result
939610
def rpc_get_all_names_cumulative( self, offset, count, **con_info ):
        
        if not check_offset(offset):
            return {'error': 'invalid offset', 'http_status': 400}

        if not check_count(count, 100):
            return {'error': 'invalid count', 'http_status': 400}

        db = get_db_state(self.working_dir)
        all_names = db.get_all_names( offset=offset, count=count, include_expired=True )
        db.close()

        return self.success_response( {'names': all_names} )
927565
def _statuscode2string(status_code):
    """"""
    try:
        s = _STATUSCODE2STRING[status_code]
    except KeyError:
        s = _format("Invalid status code {0}", status_code)
    return s
1042698
def ss(name):
    '''
    

    '''
    sanitize_name = six.text_type(name)
    ss_infos = __salt__['cmd.run']("ss -neap")
    found_infos = []
    ret = []
    for info in ss_infos.splitlines():
        if info.find(sanitize_name) != -1:
            found_infos.append(info)
    ret.extend([sanitize_name, found_infos])
    return ret
710496
def checkStatus(self):
        
        checkAccount()

        data = {'userid': self.user_id,
                'useridx': self.useridx
               }
        r = self.session.post(nurls['checkStatus'], data = data)

        p = re.compile(r'\<message\>(?P<message>.+)\</message\>')
        message = p.search(r.text).group('message')

        if message == 'success':
            return True
        else:
            return False
1318138
public function checkStatus()
    {
        $status = OneLogin_Saml2_Utils::getStatus($this->document);

        if (isset($status['code']) && $status['code'] !== OneLogin_Saml2_Constants::STATUS_SUCCESS) {
            $explodedCode = explode(':', $status['code']);
            $printableCode = array_pop($explodedCode);

            $statusExceptionMsg = 'The status code of the Response was not Success, was '.$printableCode;
            if (!empty($status['msg'])) {
                $statusExceptionMsg .= ' -> '.$status['msg'];
            }
            throw new OneLogin_Saml2_ValidationError(
                $statusExceptionMsg,
                OneLogin_Saml2_ValidationError::STATUS_CODE_IS_NOT_SUCCESS
            );
        }
    }
1083700
def check_global_status(flag, name, oid):
    
    # only check the status, if the "no" flag is not set
    if flag:
        # get the data via snmp
        myData = get_data(sess, oid, helper)
        data_summary_output, data_long_output = state_summary(myData, name, normal_state, helper)
        add_output(data_summary_output, data_long_output, helper)
615826
def _handle_status(self, key, value):
        
        informational_keys = ["KEY_CONSIDERED"]
        if key in ("EXPORTED"):
            self.fingerprints.append(value)
        elif key == "EXPORT_RES":
            export_res = value.split()
            for x in self.counts.keys():
                self.counts[x] += int(export_res.pop(0))
        elif key not in informational_keys:
            raise ValueError("Unknown status message: %r" % key)
379633
def _generate_processed_key_name(process_to, upload_name):
        """"""
        timestamp = datetime.now().strftime('%Y%m%d%H%M%S%f')
        name, extension = os.path.splitext(upload_name)
        digest = md5(''.join([timestamp, upload_name])).hexdigest()
        return os.path.join(process_to, '{0}.{1}'.format(digest, extension))
1224983
def info(self):
        ''' 
        '''
        return sorted(self._checkers.values(), key=lambda x: (x.ns, x.name))
786433
def status(self):
        ''''''
        message = self.status_message
        if message is None:
            message = STATUS[self.status_code]
        return '%s %s' % (self.status_code, message)
45605
def _encode_list(name, value, check_keys, opts):
    """"""
    lname = gen_list_name()
    data = b"".join([_name_value_to_bson(next(lname), item,
                                         check_keys, opts)
                     for item in value])
    return b"\x04" + name + _PACK_INT(len(data) + 5) + data + b"\x00"
1085873
def bech32_encode(hrp, data):
    """"""
    combined = data + bech32_create_checksum(hrp, data)
    return hrp + '1' + ''.join([CHARSET[d] for d in combined])
1074702
def _format_state_result(name, result, changes=None, comment=''):
    '''
    
    '''
    if changes is None:
        changes = {'old': '', 'new': ''}
    return {'name': name, 'result': result,
            'changes': changes, 'comment': comment}
660605
def get_status(api_subject):
  ''' 
  '''
  summary = api_subject.healthSummary
  if summary is None:
    return None
  # status string always starts with "<nagios code>: <summary>"
  status = "%s: %s" % (NAGIOS_CODE_MESSAGES[CM_STATE_CODES[summary]], summary)
  if summary != "GOOD" and summary != "DISABLED":
    # if the summary is CONCERNING or BAD, then append the health checks
    for health_check in api_subject.healthChecks:
      if health_check['summary'] != "GOOD" and health_check['summary'] != "DISABLED":
        status = ("%s, %s=%s" % (status, health_check['name'], health_check['summary']))
  return status
1056065
function getStatus (res) {
		let status;
		const statusCode = res.statusCode;
		if (statusCode) {
			status = Math.floor(statusCode / 100) * 100;
		}
		switch (status) {
			case 100:
			case 200:
			case 300:
				return 'success';
			default:
				return 'failure';
		}
	}