Returns list of matching VRFs
777146
def complete_vrf(arg):
    

    search_string = ''
    if arg is not None:
        search_string = '^%s' % arg

    res = VRF.search({
        'operator': 'regex_match',
        'val1': 'rt',
        'val2':  search_string
        }, { 'max_result': 100000 } )

    ret = []

    for v in res['result']:
        ret.append(v.rt)
    if re.match(search_string, 'none'):
        ret.append('none')

    return ret
459948
def fillVolumesAndPaths(self):
        
        return [
            (self.toDict.vol(vol), paths)
            for vol, paths in self.butterStore.paths.items()
        ]
342686
def matchingfiles(self, projectpath):
        """"""
        results = []

        if projectpath[-1] == '/':
            inputpath = projectpath + 'input/'
        else:
            inputpath = projectpath + '/input/'

        for linkf,realf in clam.common.util.globsymlinks(inputpath + '/.*.INPUTTEMPLATE.' + self.id + '.*'):
            seqnr = int(linkf.split('.')[-1])
            results.append( (seqnr, realf[len(inputpath):], self) )
        results = sorted(results)
        if self.unique and len(results) != 1:
            return []
        else:
            return results
724221
async def list_vms(self, preset_name):
        """"""
        return list(vm for vm in self._vms.values() if vm.name == preset_name)
1330324
def load_all(cls, vr, params=None):
        
        ob_docs = vr.query(cls.base, params)
        return [cls(vr, ob) for ob in ob_docs]
18216
def op_list_venvs(self):
        
        self.logger.info('Listing known virtual environments ...')
        venvs = self.get_venvs()
        for venv in venvs:
            self.logger.info('Found `%s`' % venv)
        else:
            self.logger.info('No virtual environments found in `%s` directory.' % VENVS_DIRNAME)
        return venvs
1104445
def _get_dvs(service_instance, dvs_name):
    '''
    
    '''
    switches = list_dvs(service_instance)
    if dvs_name in switches:
        inventory = get_inventory(service_instance)
        container = inventory.viewManager.CreateContainerView(inventory.rootFolder, [vim.DistributedVirtualSwitch], True)
        for item in container.view:
            if item.name == dvs_name:
                return item

    return None
420936
def list(cls, vrf=None):
        

        if vrf is None:
            vrf = {}

        xmlrpc = XMLRPCConnection()
        try:
            vrf_list = xmlrpc.connection.list_vrf(
                {
                    'vrf': vrf,
                    'auth': AuthOptions().options
                })
        except xmlrpclib.Fault as xml_fault:
            raise _fault_to_exception(xml_fault)

        res = list()
        for v in vrf_list:
            res.append(VRF.from_dict(v))

        return res
771840
def add_current_vrf(self):
        

        vrf_id = request.json['vrf_id']

        if vrf_id is not None:

            if vrf_id == 'null':
                vrf = VRF()
            else:
                vrf_id = int(vrf_id)
                vrf = VRF.get(vrf_id)

            session['current_vrfs'][vrf_id] = { 'id': vrf.id, 'rt': vrf.rt,
                    'name': vrf.name, 'description': vrf.description }
            session.save()

        return json.dumps(session.get('current_vrfs', {}))
876232
def list(self):
        """"""
        return [self._pos3d.x, self._pos3d.y, self._pos3d.z]
582809
def my_glob(pattern):
    
    result = []
    if pattern[0:4] == 'vos:':
        dirname = os.path.dirname(pattern)
        flist = listdir(dirname)
        for fname in flist:
            fname = '/'.join([dirname, fname])
            if fnmatch.fnmatch(fname, pattern):
                result.append(fname)
    else:
        result = glob(pattern)
    return result
454157
def list_prefix(arg, opts, shell_opts):
    

    search_string = ''
    if type(arg) == list or type(arg) == tuple:
        search_string = ' '.join(arg)

    v = get_vrf(opts.get('vrf_rt'), default_var='default_list_vrf_rt', abort=True)

    if v.rt == 'all':
        vrf_text = 'any VRF'
        vrf_q = None
    else:
        vrf_text = vrf_format(v)
        vrf_q = {
            'operator': 'equals',
            'val1': 'vrf_rt',
            'val2': v.rt
        }
    print("Searching for prefixes in %s..." % vrf_text)

    col_def = {
            'added': { 'title': 'Added' },
            'alarm_priority': { 'title': 'Alarm Prio' },
            'authoritative_source': { 'title': 'Auth source' },
            'children': { 'title': 'Children' },
            'comment': { 'title': 'Comment' },
            'customer_id': { 'title': 'Customer ID' },
            'description': { 'title': 'Description' },
            'expires': { 'title': 'Expires' },
            'free_addresses': { 'title': 'Free addresses' },
            'monitor': { 'title': 'Monitor' },
            'last_modified': { 'title': 'Last mod' },
            'node': { 'title': 'Node' },
            'order_id': { 'title': 'Order ID' },
            'pool_name': { 'title': 'Pool name' },
            'prefix': { 'title': 'Prefix' },
            'status': { 'title': 'Status' },
            'tags': { 'title': '#' },
            'total_addresses': { 'title': 'Total addresses' },
            'type': { 'title': '' },
            'used_addresses': { 'title': 'Used addresses' },
            'vlan': { 'title': 'VLAN' },
            'vrf_rt': { 'title': 'VRF RT' },
            }
    # default columns
    columns = [ 'vrf_rt', 'prefix', 'type', 'tags', 'node', 'order_id', 'customer_id', 'description' ]

    # custom columns? prefer shell opts, then look in config file
    custom_columns = None
    if shell_opts.columns and len(shell_opts.columns) > 0:
        custom_columns = shell_opts.columns
    elif cfg.get('global', 'prefix_list_columns'):
        custom_columns = cfg.get('global', 'prefix_list_columns')

    # parse custom columns
    if custom_columns:
        # Clear out default columns, unless user whishes to append
        if custom_columns[0] != '+':
            columns = []

        # read in custom columns
        for col in list(csv.reader([custom_columns.lstrip('+') or ''], escapechar='\\'))[0]:
            col = col.strip()
            if col not in col_def:
                print("Invalid column:", col, file=sys.stderr)
                sys.exit(1)
            columns.append(col)

    offset = 0
    # small initial limit for "instant" result
    limit = 50
    prefix_str = ""
    while True:
        res = Prefix.smart_search(search_string, { 'parents_depth': -1,
            'include_neighbors': True, 'offset': offset, 'max_result': limit },
            vrf_q)

        if offset == 0: # first time in loop?
            if shell_opts.show_interpretation:
                print("Query interpretation:")
                _parse_interp_prefix(res['interpretation'])

            if res['error']:
                print("Query failed: %s" % res['error_message'])
                return

            if len(res['result']) == 0:
                print("No addresses matching '%s' found." % search_string)
                return

            # guess column width by looking at the initial result set
            for p in res['result']:
                for colname, col in col_def.items():
                    val = getattr(p, colname, '')
                    col['width'] = max(len(colname), col.get('width', 0),
                                       len(str(val)))

                # special handling of a few columns
                col_def['vrf_rt']['width'] = max(col_def['vrf_rt'].get('width', 8),
                                                 len(str(p.vrf.rt)))
                col_def['prefix']['width'] = max(col_def['prefix'].get('width', 0)-12,
                                                 p.indent * 2 + len(p.prefix)) + 12
                try:
                    col_def['pool_name']['width'] = max(col_def['pool_name'].get('width', 8),
                                                        len(str(p.pool.name)))
                except:
                    pass
            # override certain column widths
            col_def['type']['width'] = 1
            col_def['tags']['width'] = 2

            col_header_data = {}
            # build prefix formatting string
            for colname, col in [(k, col_def[k]) for k in columns]:
                prefix_str += "{%s:<%d}  " % (colname, col['width'])
                col_header_data[colname] = col['title']

            column_header = prefix_str.format(**col_header_data)
            print(column_header)
            print("".join("=" for i in range(len(column_header))))

        for p in res['result']:
            if p.display == False:
                continue

            col_data = {}
            try:
                for colname, col in col_def.items():
                    col_data[colname] = str(getattr(p, colname, None))

                # overwrite some columns due to special handling
                col_data['tags'] = '-'
                if len(p.tags) > 0:
                    col_data['tags'] = '#%d' % len(p.tags)

                try: 
                    col_data['pool_name'] = p.pool.name
                except:
                    pass

                col_data['prefix'] = "".join("  " for i in range(p.indent)) + p.display_prefix
                col_data['type'] = p.type[0].upper()
                col_data['vrf_rt'] = p.vrf.rt or '-'

                print(prefix_str.format(**col_data))

            except UnicodeEncodeError as e:
                print("\nCrazy encoding for prefix %s\n" % p.prefix, file=sys.stderr)

        if len(res['result']) < limit:
            break
        offset += limit

        # let consecutive limit be higher to tax the XML-RPC backend less
        limit = 200
1179510
def vif_list(name, call=None, kwargs=None):
    '''
    

    '''
    if call == 'function':
        raise SaltCloudSystemExit(
            'This function must be called with -a, --action argument.'
        )
    if name is None:
        return 'A name kwarg is rquired'
    ret = {}
    data = {}
    session = _get_session()
    vm = _get_vm(name)
    vifs = session.xenapi.VM.get_VIFs(vm)
    if vifs is not None:
        x = 0
        for vif in vifs:
            vif_record = session.xenapi.VIF.get_record(vif)
            data['vif-{}'.format(x)] = vif_record
            x += 1
    ret[name] = data
    return ret
1158588
def _batch_gvcfs(data, region, vrn_files, ref_file, out_file=None):
    
    if out_file is None:
        out_file = vrn_files[0]
    # group to get below the maximum batch size, using 200 as the baseline
    max_batch = int(dd.get_joint_group_size(data))
    if len(vrn_files) > max_batch:
        out = []
        num_batches = int(math.ceil(float(len(vrn_files)) / max_batch))
        for i, batch_vrn_files in enumerate(tz.partition_all(num_batches, vrn_files)):
            base, ext = utils.splitext_plus(out_file)
            batch_out_file = "%s-b%s%s" % (base, i, ext)
            out.append(run_combine_gvcfs(batch_vrn_files, region, ref_file, batch_out_file, data))
        return _batch_gvcfs(data, region, out, ref_file)
    else:
        return vrn_files
787751
def get_signatures_with_results(vcs):
    
    results_dir = os.path.join(vcs.private_dir(), 'results')
    if not os.path.exists(results_dir):
        return []
    rel_paths = os.listdir(results_dir)
    return [p for p in rel_paths if os.path.isdir(os.path.join(results_dir, p))]
512070
def list_ar (archive, compression, cmd, verbosity, interactive):
    """"""
    opts = 't'
    if verbosity > 1:
        opts += 'v'
    return [cmd, opts, archive]
114580
async def List(self, arches, region, root_storage_type, series, stream, virt_type):
        '''
        
        '''
        # map input types to rpc msg
        _params = dict()
        msg = dict(type='ImageMetadata',
                   request='List',
                   version=2,
                   params=_params)
        _params['arches'] = arches
        _params['region'] = region
        _params['root-storage-type'] = root_storage_type
        _params['series'] = series
        _params['stream'] = stream
        _params['virt-type'] = virt_type
        reply = await self.rpc(msg)
        return reply