Takes in no param as input to fetch SNMP TRAP definitions from HP IMC RESTFUL API
    :param None
    :return: object of type list containing the device asset details
349911
def get_trap_definitions():
    
    # checks to see if the imc credentials are already available
    if auth is None or url is None:
        set_imc_creds()
    global r
    get_trap_def_url = "/imcrs/fault/trapDefine/sync/query?enterpriseId=1.3.6.1.4.1.11&size=10000"
    f_url = url + get_trap_def_url
    payload = None
    # creates the URL using the payload variable as the contents
    r = requests.get(f_url, auth=auth, headers=headers)
    # r.status_code
    if r.status_code == 200:
        trap_def_list = (json.loads(r.text))
        return trap_def_list['trapDefine']
    else:
        print("get_dev_asset_details:  An Error has occured")
279532
def _get_base_interface_info(interface):
    '''
    
    '''
    blacklist = {
        'tcpip': {
            'name': [],
            'type': [],
            'additional_protocol': False
        },
        'disabled': {
            'name': ['eth0'],
            'type': ['gadget'],
            'additional_protocol': False
        },
        'ethercat': {
            'name': ['eth0'],
            'type': ['gadget', 'usb', 'wlan'],
            'additional_protocol': True
        },
        '_': {
            'usb': 'sys',
            'gadget': 'uevent',
            'wlan': 'uevent'
        }
    }
    return {
        'label': interface.name,
        'connectionid': interface.name,
        'supported_adapter_modes': _get_possible_adapter_modes(interface.name, blacklist),
        'adapter_mode': _get_adapter_mode_info(interface.name),
        'up': interface.flags & IFF_RUNNING != 0,
        'ipv4': {
            'supportedrequestmodes': ['dhcp_linklocal', 'dhcp_only', 'linklocal_only', 'static'],
            'requestmode': _get_request_mode_info(interface.name)
        },
        'hwaddr': interface.hwaddr[:-1]
    }
78685
def _get_traceback_no_io():
    
    try:
        module = load_module(str("_traceback_no_io"), traceback)
    except NotImplementedError:
        # Can't fix the I/O problem, oh well:
        return traceback

    class FakeLineCache(object):
        def checkcache(self, *args, **kwargs):
            None

        def getline(self, *args, **kwargs):
            return ""

        def lazycache(self, *args, **kwargs):
            return None

    module.linecache = FakeLineCache()
    return module
1142983
def device_info(index=None):
    
    if index is None:
        return (device_info(i) for i in range(_pa.Pa_GetDeviceCount()))
    else:
        info = _pa.Pa_GetDeviceInfo(index)
        if not info:
            raise RuntimeError("Invalid device")
        assert info.structVersion == 2

        if 'DirectSound' in hostapi_info(info.hostApi)['name']:
            enc = 'mbcs'
        else:
            enc = 'utf-8'

        return {'name': ffi.string(info.name).decode(encoding=enc,
                                                     errors='ignore'),
                'hostapi': info.hostApi,
                'max_input_channels': info.maxInputChannels,
                'max_output_channels': info.maxOutputChannels,
                'default_low_input_latency': info.defaultLowInputLatency,
                'default_low_output_latency': info.defaultLowOutputLatency,
                'default_high_input_latency': info.defaultHighInputLatency,
                'default_high_output_latency': info.defaultHighOutputLatency,
                'default_samplerate': info.defaultSampleRate}
964379
def _get_vm(name=None, session=None):
    '''
    
    '''
    if session is None:
        session = _get_session()
    vms = session.xenapi.VM.get_by_name_label(name)
    if len(vms) == 1:
        return vms[0]
    return None
1125265
def list(host=None, quiet=False, hyper=None):  # pylint: disable=redefined-builtin
    '''
    
    '''
    if quiet:
        log.warning("'quiet' is deprecated. Please migrate to --quiet")
    ret = {}
    client = salt.client.get_local_client(__opts__['conf_file'])
    for info in client.cmd_iter('virtual:physical',
                                'virt.vm_info', tgt_type='grain'):
        if not info:
            continue
        if not isinstance(info, dict):
            continue
        chunk = {}
        id_ = next(six.iterkeys(info))
        if host:
            if host != id_:
                continue
        if not isinstance(info[id_], dict):
            continue
        if 'ret' not in info[id_]:
            continue
        if not isinstance(info[id_]['ret'], dict):
            continue
        data = {}
        for key, val in six.iteritems(info[id_]['ret']):
            if val['state'] in data:
                data[val['state']].append(key)
            else:
                data[val['state']] = [key]
        chunk[id_] = data
        ret.update(chunk)
        if not quiet:
            __jid_event__.fire_event({'data': chunk, 'outputter': 'nested'}, 'progress')

    return ret
248330
def _get(app, endpoint, id=None, auth_required=False, **kwargs):
    '''
    
    '''
    nb = _nb_obj(auth_required=auth_required)
    if id:
        item = getattr(getattr(nb, app), endpoint).get(id)
    else:
        kwargs = __utils__['args.clean_kwargs'](**kwargs)
        item = getattr(getattr(nb, app), endpoint).get(**kwargs)
    return item
342474
def get_data(self, size=None, addr=None):
        '''
        
        '''
        # readback memory offset
        if addr is None:
            addr = self._mem_bytes

        if size and self._mem_bytes < size:
            raise ValueError('Size is too big')

        if size is None:
            return self._intf.read(self._conf['base_addr'] + self._spi_mem_offset + addr, self._mem_bytes)
        else:
            return self._intf.read(self._conf['base_addr'] + self._spi_mem_offset + addr, size)
383525
def absent(name=None, ipv4addr=None, **api_opts):
    '''
    
    '''
    ret = {'name': name, 'result': False, 'comment': '', 'changes': {}}
    obj = __salt__['infoblox.get_a'](name=name, ipv4addr=ipv4addr, allow_array=False, **api_opts)

    if not obj:
        ret['result'] = True
        ret['comment'] = 'infoblox already removed'
        return ret

    if __opts__['test']:
        ret['result'] = None
        ret['changes'] = {'old': obj, 'new': 'absent'}
        return ret

    if __salt__['infoblox.delete_a'](name=name, ipv4addr=ipv4addr, **api_opts):
        ret['result'] = True
        ret['changes'] = {'old': obj, 'new': 'absent'}
    return ret
290205
def get(cls, device_id, custom_headers=None):
        

        if custom_headers is None:
            custom_headers = {}

        api_client = client.ApiClient(cls._get_api_context())
        endpoint_url = cls._ENDPOINT_URL_READ.format(device_id)
        response_raw = api_client.get(endpoint_url, {}, custom_headers)

        return BunqResponseDevice.cast_from_bunq_response(
            cls._from_json(response_raw)
        )
266578
def get_event_noblock(self):
        '''
        
        '''
        assert self._run_io_loop_sync

        if not self.cpub:
            if not self.connect_pub():
                return None
        raw = self.subscriber.read_sync(timeout=0)
        if raw is None:
            return None
        mtag, data = self.unpack(raw, self.serial)
        return {'data': data, 'tag': mtag}
373047
def _get_constrs_no_operation(self, gadget):
        
        # Constraints on memory locations.
        # mem_constrs = [self.analyzer.get_memory("pre") != self.analyzer.get_memory("post")]
        mem_constrs = [self.analyzer.get_memory_curr("pre").__neq__(self.analyzer.get_memory_curr("post"))]

        # Constraints on flags.
        flags_constrs = []

        for name in self._arch_info.registers_flags:
            var_initial = self.analyzer.get_register_expr(name, mode="pre")
            var_final = self.analyzer.get_register_expr(name, mode="post")

            flags_constrs += [var_initial != var_final]

        # Constraints on registers.
        reg_constrs = []

        for name in self._arch_info.registers_gp_base:
            var_initial = self.analyzer.get_register_expr(name, mode="pre")
            var_final = self.analyzer.get_register_expr(name, mode="post")

            reg_constrs += [var_initial != var_final]

        # Make a big OR expression.
        constrs = mem_constrs + flags_constrs + reg_constrs
        constrs = [reduce(lambda c, acc: acc | c, constrs[1:], constrs[0])]

        return constrs
543464
public static snmp_trap delete(nitro_service client, snmp_trap resource) throws Exception
	{
		resource.validate("delete");
		return ((snmp_trap[]) resource.delete_resource(client))[0];
	}
624617
def api(self):
        
        functions = [x[0]for x in inspect.getmembers(self, predicate=inspect.ismethod)
                     if not x[0].startswith('_')]

        full_api = {
            'doc': u"When posting data you have to use the JSON format.",
            'api': []
        }
        my_daemon_type = "%s" % getattr(self.app, 'type', 'unknown')
        my_address = getattr(self.app, 'host_name', getattr(self.app, 'name', 'unknown'))
        if getattr(self.app, 'address', '127.0.0.1') not in ['127.0.0.1']:
            # If an address is explicitely specified, I must use it!
            my_address = self.app.address
        for fun in functions:
            endpoint = {
                'daemon': my_daemon_type,
                'name': fun,
                'doc': getattr(self, fun).__doc__,
                'uri': '%s://%s:%s/%s' % (getattr(self.app, 'scheme', 'http'),
                                          my_address,
                                          self.app.port, fun),
                'args': {}
            }

            try:
                spec = inspect.getfullargspec(getattr(self, fun))
            except Exception:  # pylint: disable=broad-except
                # pylint: disable=deprecated-method
                spec = inspect.getargspec(getattr(self, fun))
            args = [a for a in spec.args if a not in ('self', 'cls')]
            if spec.defaults:
                a_dict = dict(list(zip(args, spec.defaults)))
            else:
                a_dict = dict(list(zip(args, ("No default value",) * len(args))))

            endpoint["args"] = a_dict
            full_api['api'].append(endpoint)

        return full_api
276921
def hostapi_info(index=None):
    
    if index is None:
        return (hostapi_info(i) for i in range(_pa.Pa_GetHostApiCount()))
    else:
        info = _pa.Pa_GetHostApiInfo(index)
        if not info:
            raise RuntimeError("Invalid host API")
        assert info.structVersion == 1
        return {'name': ffi.string(info.name).decode(errors='ignore'),
                'default_input_device': info.defaultInputDevice,
                'default_output_device': info.defaultOutputDevice}
419163
public static snmpalarm get(nitro_service service, String trapname) throws Exception{
		snmpalarm obj = new snmpalarm();
		obj.set_trapname(trapname);
		snmpalarm response = (snmpalarm) obj.get_resource(service);
		return response;
	}
534744
def add_device_information(helper, session):
        
        host_name_data = helper.get_snmp_value(session, helper,
                                               DEVICE_INFORMATION_OIDS['oid_host_name'])

        product_type_data = helper.get_snmp_value(session, helper,
                                                  DEVICE_INFORMATION_OIDS['oid_product_type'])

        service_tag_data = helper.get_snmp_value(session, helper,
                                                 DEVICE_INFORMATION_OIDS['oid_service_tag'])

        helper.add_summary('Name: {} - Typ: {} - Service tag: {}'.format(
            host_name_data, product_type_data, service_tag_data))