List the available beacons
974949
def list_available_beacons(self):
        '''
        
        '''
        _beacons = ['{0}'.format(_beacon.replace('.beacon', ''))
                    for _beacon in self.beacons if '.beacon' in _beacon]

        # Fire the complete event back along with the list of beacons
        evt = salt.utils.event.get_event('minion', opts=self.opts)
        evt.fire_event({'complete': True, 'beacons': _beacons},
                       tag='/salt/minion/minion_beacons_list_available_complete')

        return True
1259944
def widget_status(self):
        """"""
        widget_status_list = []
        for i in self.widgetlist:
            widget_status_list += [[i.name, i.status]]
        return widget_status_list
88442
function findBlinkSticks (filter) {
    if (filter === undefined) filter = function () { return true; };

    var result = [], device, i, devices;

    if (isWin) {
        devices = usb.devices();

        for (i in devices) {
            device = devices[i];

            if (device.vendorId === VENDOR_ID &&
                device.productId === PRODUCT_ID &&
                    filter(device))
                {
                    result.push(new BlinkStick(device.path, device.serialNumber, device.manufacturer, device.product));
                }
        }

    } else {
        devices = usb.getDeviceList();

        for (i in devices) {
            device = devices[i];
            if (device.deviceDescriptor.idVendor === VENDOR_ID &&
                device.deviceDescriptor.idProduct === PRODUCT_ID &&
                    filter(device))
                result.push(new BlinkStick(device));
        }
    }

    return result;
}
694781
def list_receivers(self):
        
        print("Receiver list")
        print("*************\n")
        for key, receiver in self.app.signals.receivers.items():
            print("%s <-- %s (%s):\n  %s\n" % (receiver.name,
                                               receiver.signal,
                                               receiver.plugin.name,
                                               receiver.description))
529581
public void startAdvertising(Beacon beacon, AdvertiseCallback callback) {
        mBeacon = beacon;
        mAdvertisingClientCallback = callback;
        startAdvertising();
    }
1065307
def available_backends():
    """"""
    print 'The following LiveSync agents are available:'
    for name, backend in current_plugin.backend_classes.iteritems():
        print cformat('  - %{white!}{}%{reset}: {} ({})').format(name, backend.title, backend.description)
478682
def list_broadcasts():
    
    casts = [{'cast': b[0], 'onto': b[1]} for b in orca.list_broadcasts()]
    return jsonify(broadcasts=casts)
409598
def ListGrrUsers(self):
    """"""

    args = user_management_pb2.ApiListGrrUsersArgs()

    items = self._context.SendIteratorRequest("ListGrrUsers", args)
    return utils.MapItemsIterator(
        lambda data: GrrUser(data=data, context=self._context), items)
909719
async def available_ssids() -> List[Dict[str, Any]]:
    
    fields = ['ssid', 'signal', 'active', 'security']
    cmd = ['--terse',
           '--fields',
           ','.join(fields),
           'device',
           'wifi',
           'list']
    out, err = await _call(cmd)
    if err:
        raise RuntimeError(err)
    output = _dict_from_terse_tabular(
        fields, out,
        transformers={'signal': lambda s: int(s) if s.isdigit() else None,
                      'active': lambda a: a.lower() == 'yes',
                      'ssid': lambda s: s if s != '--' else None})

    return [_add_security_type_to_scan(nw) for nw in output if nw['ssid']]
669967
def waypoint_request_list_send(self):
        ''''''
        if self.mavlink10():
            self.mav.mission_request_list_send(self.target_system, self.target_component)
        else:
            self.mav.waypoint_request_list_send(self.target_system, self.target_component)
492554
def list_blobs(self, prefix=''):
    """"""
    return [b.name for b in self.bucket.list_blobs(prefix=prefix)]
802388
def show(self, resolve_mac=True, print_result=True):
        """"""
        res = []
        for iface_name in sorted(self.data):
            dev = self.data[iface_name]
            mac = dev.mac
            if resolve_mac and conf.manufdb:
                mac = conf.manufdb._resolve_MAC(mac)
            validity_color = lambda x: conf.color_theme.red if x else \
                conf.color_theme.green
            description = validity_color(dev.is_invalid())(
                str(dev.description)
            )
            index = str(dev.win_index)
            res.append((index, description, str(dev.ip), mac))

        res = pretty_list(res, [("INDEX", "IFACE", "IP", "MAC")], sortBy=2)
        if print_result:
            print(res)
        else:
            return res
849987
def add_beacon(self, name, beacon_data):
        '''
        
        '''

        data = {}
        data[name] = beacon_data

        if name in self._get_beacons(include_opts=False):
            comment = 'Cannot update beacon item {0}, ' \
                      'because it is configured in pillar.'.format(name)
            complete = False
        else:
            if name in self.opts['beacons']:
                comment = 'Updating settings for beacon ' \
                          'item: {0}'.format(name)
            else:
                comment = 'Added new beacon item: {0}'.format(name)
            complete = True
            self.opts['beacons'].update(data)

        # Fire the complete event back along with updated list of beacons
        evt = salt.utils.event.get_event('minion', opts=self.opts)
        evt.fire_event({'complete': complete, 'comment': comment,
                        'beacons': self.opts['beacons']},
                       tag='/salt/minion/minion_beacon_add_complete')

        return True
960747
def list_lbaas_healthmonitors(self, retrieve_all=True, **_params):
        """"""
        return self.list('healthmonitors', self.lbaas_healthmonitors_path,
                         retrieve_all, **_params)
538499
def lights(self):
        """"""
        return [Light(self, light.get('name'))
                for light in self._state.get('deviceStatusInfo',
                                             {}).get('device', [])
                if light.get('rgbColor')]
712350
def validate(config):
    '''
    
    '''

    VALID_ITEMS = [
        'type', 'bytes_sent', 'bytes_recv', 'packets_sent',
        'packets_recv', 'errin', 'errout', 'dropin',
        'dropout'
    ]

    # Configuration for load beacon should be a list of dicts
    if not isinstance(config, list):
        return False, ('Configuration for network_info beacon must be a list.')
    else:

        _config = {}
        list(map(_config.update, config))

        for item in _config.get('interfaces', {}):
            if not isinstance(_config['interfaces'][item], dict):
                return False, ('Configuration for network_info beacon must '
                               'be a list of dictionaries.')
            else:
                if not any(j in VALID_ITEMS for j in _config['interfaces'][item]):
                    return False, ('Invalid configuration item in '
                                   'Beacon configuration.')
    return True, 'Valid beacon configuration'
1349368
def beacon(config):
    '''
    
    '''
    ret = []
    pkey = 'sh.vt'
    shells = _get_shells()
    ps_out = __salt__['status.procs']()
    track_pids = []
    for pid in ps_out:
        if any(ps_out[pid].get('cmd', '').lstrip('-') in shell for shell in shells):
            track_pids.append(pid)
    if pkey not in __context__:
        __context__[pkey] = {}
    for pid in track_pids:
        if pid not in __context__[pkey]:
            cmd = ['strace', '-f', '-e', 'execve', '-p', '{0}'.format(pid)]
            __context__[pkey][pid] = {}
            __context__[pkey][pid]['vt'] = salt.utils.vt.Terminal(
                    cmd,
                    log_stdout=True,
                    log_stderr=True,
                    stream_stdout=False,
                    stream_stderr=False)
            __context__[pkey][pid]['user'] = ps_out[pid].get('user')
    for pid in list(__context__[pkey]):
        out = ''
        err = ''
        while __context__[pkey][pid]['vt'].has_unread_data:
            tout, terr = __context__[pkey][pid]['vt'].recv()
            if not terr:
                break
            out += salt.utils.stringutils.to_unicode(tout or '')
            err += terr
        for line in err.split('\n'):
            event = {'args': [],
                     'tag': pid}
            if 'execve' in line:
                comps = line.split('execve')[1].split('"')
                for ind, field in enumerate(comps):
                    if ind == 1:
                        event['cmd'] = field
                        continue
                    if ind % 2 != 0:
                        event['args'].append(field)
                event['user'] = __context__[pkey][pid]['user']
                ret.append(event)
        if not __context__[pkey][pid]['vt'].isalive():
            __context__[pkey][pid]['vt'].close()
            __context__[pkey].pop(pid)
    return ret