allows random lookup
329246
def getScan(self, title, peptide=None):
        
        if self.ra.has_key(title):
            self.filename.seek(self.ra[title][0],0)
            toRead = self.ra[title][1]-self.ra[title][0]
            info = self.filename.read(toRead)
            scan = self.parseScan(info)
        else:
            return None
        return scan
628366
def lookup_field(key, lookup_type=None, placeholder=None, html_class="div",
                 select_type="strapselect", mapping="uuid"):
    """"""

    if lookup_type is None:
        lookup_type = key

    if placeholder is None:
        placeholder = "Select a " + lookup_type

    result = {
        'key': key,
        'htmlClass': html_class,
        'type': select_type,
        'placeholder': placeholder,
        'options': {
            "type": lookup_type,
            "asyncCallback": "$ctrl.getFormData",
            "map": {'valueProperty': mapping, 'nameProperty': 'name'}
        }
    }

    return result
211402
def get_random_url(ltd="com"):
        

        url = [
            "https://",
            RandomInputHelper.get_random_value(8, [string.ascii_lowercase]),
            ".",
            ltd
        ]

        return "".join(url)
319800
def random_id(length):
    """"""

    def char():
        """Generate single random char"""

        return random.choice(string.ascii_letters + string.digits)

    return "".join(char() for _ in range(length))
1041463
def get_random_item(enum: Any, rnd: Optional[Random] = None) -> Any:
    
    if rnd and isinstance(rnd, Random):
        return rnd.choice(list(enum))
    return random_module.choice(list(enum))
274741
def random(self, *args, **kwargs):
        
        indexer = Random()
        self.add(indexer)

        return self
693292
private void shuffleAndFilterInstances(Map<String, VipIndexSupport> srcMap, boolean filterUpInstances) {

        Random shuffleRandom = new Random();
        for (Map.Entry<String, VipIndexSupport> entries : srcMap.entrySet()) {
            VipIndexSupport vipIndexSupport = entries.getValue();
            AbstractQueue<InstanceInfo> vipInstances = vipIndexSupport.instances;
            final List<InstanceInfo> filteredInstances;
            if (filterUpInstances) {
                filteredInstances = vipInstances.stream().filter(ii -> ii.getStatus() == InstanceStatus.UP)
                        .collect(Collectors.toCollection(() -> new ArrayList<>(vipInstances.size())));
            } else {
                filteredInstances = new ArrayList<InstanceInfo>(vipInstances);
            }
            Collections.shuffle(filteredInstances, shuffleRandom);
            vipIndexSupport.vipList.set(filteredInstances);
            vipIndexSupport.roundRobinIndex.set(0);
        }
    }
536294
def get_random_service(
        service_registry: ServiceRegistry,
        block_identifier: BlockSpecification,
) -> Tuple[Optional[str], Optional[str]]:
    
    count = service_registry.service_count(block_identifier=block_identifier)
    if count == 0:
        return None, None
    index = random.SystemRandom().randint(0, count - 1)
    address = service_registry.get_service_address(
        block_identifier=block_identifier,
        index=index,
    )
    # We are using the same blockhash for both blockchain queries so the address
    # should exist for this query. Additionally at the moment there is no way for
    # services to be removed from the registry.
    assert address, 'address should exist for this index'
    url = service_registry.get_service_url(
        block_identifier=block_identifier,
        service_hex_address=address,
    )
    return url, address
822605
def random_filename(path=None):
    """"""
    filename = uuid4().hex
    if path is not None:
        filename = os.path.join(path, filename)
    return filename
839867
def random_filtered_sources(sources, srcfilter, seed):
    
    random.seed(seed)
    while sources:
        src = random.choice(sources)
        if srcfilter.get_close_sites(src) is not None:
            return [src]
        sources.remove(src)
    return []
323215
def get_random_name():
    """"""
    char_seq = []
    name_source = random.randint(1, 2**8-1)
    current_value = name_source
    while current_value > 0:
        char_offset = current_value % 26
        current_value = current_value - random.randint(1, 26)
        char_seq.append(chr(char_offset + ord('a')))
    name = ''.join(char_seq)
    assert re.match(VALID_PACKAGE_RE, name)
    return name
1062833
function lookup(jobAsked) {
    let hits = [];
    let query = jobAsked.getSerialIdentity();
    for (let job of sourceJobIter()) {
        let item = job.getSerialIdentity();
        if (isConstraintsOk(query, item))
            hits.push(job);
    }
    logger.debug(`Found ${hits.length} hits`);
    if (hits.length == 0)
        return undefined;
    return hits;
}
1030235
def register_lookup(self, lookup):
        """"""
        if lookup.operator in self._lookups:
            raise KeyError("Lookup for operator '{}' is already registered".format(lookup.operator))

        self._lookups[lookup.operator] = lookup()
764858
def do_random(context, seq):
    """"""
    try:
        return random.choice(seq)
    except IndexError:
        return context.environment.undefined('No random item, sequence was empty.')
1193648
def random_name_gen(size=6):
    """"""

    return ''.join(
        [random.choice(string.ascii_uppercase)] +
        [random.choice(string.ascii_uppercase + string.digits) for i in range(size - 1)]
    ) if size > 0 else ''
7685
def get_random_proxy(self):
        """"""
        idx = randint(0, len(self._list) - 1)
        return self._list[idx]
12094
function (item, req, eachReq, res, next) {
          eachReq.item = item;
          eachReq[indexKey] = index;
          index++;
          next();
        }