Returns a packet list filtered by a truth function
329798
def filter(self, func):
        """"""
        return self.__class__(list(filter(func,self.res)),
                              name="filtered %s"%self.listname)
861088
def filter(self, func):
        
        return TList([v for k, v in self.items() if func(k, v)])
876370
def command(self):
        """"""
        f = []
        for fn,fv in self.fields.items():
            fld = self.get_field(fn)
            if isinstance(fv, Packet):
                fv = fv.command()
            elif fld.islist and fld.holds_packets and type(fv) is list:
                #fv = "[%s]" % ",".join( map(Packet.command, fv))
                fv = "[%s]" % ",".join([ Packet.command(i) for i in fv ])
            else:
                fv = repr(fv)
            f.append("%s=%s" % (fn, fv))
        c = "%s(%s)" % (self.__class__.__name__, ", ".join(f))
        pc = self.payload.command()
        if pc:
            c += "/"+pc
        return c
182095
def filter_query(filter_dict, required_keys):
    """"""
    if not isinstance(filter_dict, dict):
        raise TypeError("dict_list is not a list. Please try again")

    if not isinstance(required_keys, list):
        raise TypeError("dict_list is not a list. Please try again")

    available = []
    for k,v in filter_dict.items():
        # print(k, v)
        if k in required_keys:
            available.append(k)
    return available
662777
def filter(self, func):
        """"""
        return self.__class__( [ i for i in self.res if func(*i) ], name='filtered %s'%self.listname)
108223
def policy_list(request, **kwargs):
    """"""
    policies = neutronclient(request).list_qos_policies(
        **kwargs).get('policies')
    return [QoSPolicy(p) for p in policies]
79470
def _get_struct_filterlist(self):
        """"""
        obj = _make_object("FilterList")
        obj.NumberOfFilters = unpack_ui8(self._src)
        obj.Filter = filters = []
        # how to decode each filter type (and name), according to the filter id
        filter_type = [
            ("DropShadowFilter", self._get_struct_dropshadowfilter),  # 0
            ("BlurFilter", self._get_struct_blurfilter),  # 1
            ("GlowFilter", self._get_struct_glowfilter),  # 2...
            ("BevelFilter", self._get_struct_bevelfilter),
            ("GradientGlowFilter", self._get_struct_gradientglowfilter),
            ("ConvolutionFilter", self._get_struct_convolutionfilter),
            ("ColorMatrixFilter", self._get_struct_colormatrixfilter),
            ("GradientBevelFilter", self._get_struct_gradientbevelfilter),  # 7
        ]

        for _ in range(obj.NumberOfFilters):
            _filter = _make_object("Filter")
            filters.append(_filter)

            _filter.FilterId = unpack_ui8(self._src)
            name, func = filter_type[_filter.FilterId]
            setattr(_filter, name, func())
875113
def list(self, full=False):
        """"""

        if self.is_api:
            return self._list_api(full=full)
        else:
            return self._list_fs(full=full)
1103330
def getChannelColRowList(self, ra, dec, wantZeroOffset=False,
                         allowIllegalReturnValues=True):
        """"""
        try:
            ch = self.pickAChannelList(ra, dec)
        except ValueError:
            logger.warning("WARN: %.7f %.7f not on any channel" % (ra, dec))
            return (0, 0, 0)

        col = np.zeros(len(ch))
        row = np.zeros(len(ch))
        for channel in set(ch):
            mask = (ch == channel)
            col[mask], row[mask] = self.getColRowWithinChannelList(ra[mask], dec[mask], channel, 
                                                        wantZeroOffset, allowIllegalReturnValues)
        return (ch, col, row)
263315
def getExperimentList():
  
  contents = sio.loadmat("./data/DataFolderList.mat",
                         variable_names=['DataFolderList'],
                         struct_as_record=False,
                         squeeze_me=True)

  return contents['DataFolderList']
605224
def readFILTERLIST(self):
        
        number = self.readUI8()
        return [self.readFILTER() for _ in range(number)]
535267
def service_list():
    '''
    
    '''
    r = salt.utils.http.query(DETAILS['url']+'service/list', decode_type='json', decode=True)
    return r['dict']
35120
def list_():
    '''
    
    '''
    mdata = _check_mdata_list()
    if mdata:
        cmd = '{0}'.format(mdata)
        return __salt__['cmd.run'](cmd, ignore_retcode=True).splitlines()
    return {}
1068194
def filter_package_list(package_list):
    
    remote_pkgs = []
    local_pkgs = []

    possible_remotes = filter(lambda i: not os.path.exists(i), package_list)
    juicer.utils.Log.log_debug("Considering %s possible remotes" % len(possible_remotes))

    for item in possible_remotes:
        remote_pkgs.extend(juicer.utils.Remotes.assemble_remotes(item))
    juicer.utils.Log.log_notice("Remote packages: %s" % str(remote_pkgs))

    possible_locals = filter(os.path.exists, package_list)
    possible_locals = filter(is_rpm, possible_locals)
    juicer.utils.Log.log_debug("Considering %s possible locals" % len(possible_locals))

    for item in possible_locals:
        for match in find_pattern(item):
            local_pkgs.append(match)
    juicer.utils.Log.log_notice("Local packages: %s" % str(local_pkgs))

    filtered_package_list = dedupe(remote_pkgs + local_pkgs)
    return filtered_package_list
344886
def _sense_packet_to_data(packet):
        """"""
        data = bytearray(0)
        last = 0
        i = 1
        while (i < len(packet)):
            if not (last == 2 and packet[i] == 0):
                data.append(packet[i])
            last = packet[i]
            i += 1

        return data
936261
def _truthtable(inputs, pcdata):
    """"""
    if len(inputs) == 0 and pcdata[0] in {PC_ZERO, PC_ONE}:
        return {
            PC_ZERO : TTZERO,
            PC_ONE  : TTONE
        }[pcdata[0]]
    elif len(inputs) == 1 and pcdata[0] == PC_ZERO and pcdata[1] == PC_ONE:
        return inputs[0]
    else:
        return TruthTable(inputs, pcdata)
280094
def _checksum(self, packet):
        ''''''
        xorsum = 0
        for s in packet:
            xorsum ^= ord(s)
        return xorsum