returns a list of all token IDs occuring the the given exmaralda file,
        sorted by their time stamp in ascending order.
509368
def get_token_ids(tree):
        
        def tok2time(token_element):
            '''
            extracts the time (float) of a <tli> element
            (i.e. the absolute position of a token in the document)
            '''
            return float(token_element.attrib['time'])

        timeline = tree.find('//common-timeline')
        return (tok.attrib['id']
                for tok in sorted((tli for tli in timeline.iterchildren()),
                                  key=tok2time))
1183690
def _subtoken_ids_to_tokens(self, subtokens):
    
    concatenated = "".join(
        [self._subtoken_id_to_subtoken_string(s) for s in subtokens])
    split = concatenated.split("_")
    ret = []
    for t in split:
      if t:
        unescaped = _unescape_token(t + "_")
        if unescaped:
          ret.append(unescaped)
    return ret
313464
public List<Match<E>> findAll(List<E> tokens) {
        List<Match<E>> results = new ArrayList<Match<E>>();

        int start = 0;
        Match<E> match;
        do {
            match = this.find(tokens, start);

            if (match != null) {
                start = match.endIndex();

                // match may be empty query string has all optional parts
                if (!match.isEmpty()) {
                    results.add(match);
                }
            }
        } while (match != null);

        return results;
    }
549022
def get_files(file_tokens, cwd=None):
    
    if not file_tokens:
        return []

    token = file_tokens.pop()
    try:
        filename = token.filename
    except AttributeError:
        filename = ''

    if cwd:
        input = Input(token.alias, filename, cwd=cwd)
    else:
        input = Input(token.alias, filename)

    return [input] + get_files(file_tokens)
667829
@Get("/tokens")
    public CompletableFuture<Collection<Token>> listTokens(User loginUser) {
        if (loginUser.isAdmin()) {
            return mds.getTokens()
                      .thenApply(tokens -> tokens.appIds().values());
        } else {
            return mds.getTokens()
                      .thenApply(Tokens::withoutSecret)
                      .thenApply(tokens -> tokens.appIds().values());
        }
    }
15102
def ids(args):
    
    p = OptionParser(ids.__doc__)
    p.add_option("--prefix", type="int",
                 help="Find rep id for prefix of len [default: %default]")
    opts, args = p.parse_args(args)

    if len(args) != 1:
        sys.exit(not p.print_help())

    clstrfile, = args
    cf = ClstrFile(clstrfile)
    prefix = opts.prefix
    if prefix:
        reads = list(cf.iter_reps_prefix(prefix=prefix))
    else:
        reads = list(cf.iter_reps())

    nreads = len(reads)
    idsfile = clstrfile.replace(".clstr", ".ids")
    fw = open(idsfile, "w")
    for i, name in reads:
        print("\t".join(str(x) for x in (i, name)), file=fw)

    logging.debug("A total of {0} unique reads written to `{1}`.".\
            format(nreads, idsfile))
    fw.close()

    return idsfile
439488
public String getAllTokIds() {
    if (Timex3_Type.featOkTst && ((Timex3_Type)jcasType).casFeat_allTokIds == null)
      jcasType.jcas.throwFeatMissing("allTokIds", "de.unihd.dbs.uima.types.heideltime.Timex3");
    return jcasType.ll_cas.ll_getStringValue(addr, ((Timex3_Type)jcasType).casFeatCode_allTokIds);}
8439
def find_tokens(self, q):
    """"""
    found_me = []
    if hasattr(self, 'location'):
      if self.location.contains(q):
        found_me = [self]
    elif self._found_by(q):
      found_me = [self]

    cs = [n.find_tokens(q) for n in self._children()]
    return found_me + list(itertools.chain(*cs))
621485
def tokens(self, instance):
        
        if not instance.pk:
            # e.g.: Use will create a new TOTP entry
            return "-"

        totp = TOTP(instance.bin_key, instance.step, instance.t0, instance.digits)

        tokens = []
        for offset in range(-instance.tolerance, instance.tolerance + 1):
            totp.drift = instance.drift + offset
            tokens.append(totp.token())

        return " ".join(["%s" % token for token in tokens])
970208
def convert_ids_to_tokens(self, ids):
        """"""
        tokens = []
        for i in ids:
            tokens.append(self.ids_to_tokens[i])
        return tokens
238620
def tokens2ids(tokens: Iterable[str], vocab: Dict[str, int]) -> List[int]:
    
    return [vocab.get(w, vocab[C.UNK_SYMBOL]) for w in tokens]
32638
def _FormatOtherFileToken(self, token_data):
    
    # TODO: if this timestamp is useful, it must be extracted as a separate
    # event object.
    timestamp = token_data.microseconds + (
        token_data.timestamp * definitions.MICROSECONDS_PER_SECOND)
    date_time = dfdatetime_posix_time.PosixTimeInMicroseconds(
        timestamp=timestamp)
    date_time_string = date_time.CopyToDateTimeString()

    return {
        'string': token_data.name.rstrip('\x00'),
        'timestamp': date_time_string}
1051893
def _GetResourceTimestamps(self, pefile_object):
    
    timestamps = []
    if not hasattr(pefile_object, 'DIRECTORY_ENTRY_RESOURCE'):
      return timestamps
    for entrydata in pefile_object.DIRECTORY_ENTRY_RESOURCE.entries:
      directory = entrydata.directory
      timestamp = getattr(directory, 'TimeDateStamp', 0)
      if timestamp:
        timestamps.append(timestamp)
    return timestamps
113874
public List<String> documentIds() {
        List<String> documentIds = new ArrayList<String>();
        List<DocumentRevision> docs = CollectionUtils.newArrayList(iterator());
        for (DocumentRevision doc : docs) {
            documentIds.add(doc.getId());
        }
        return documentIds;
    }
1252642
def list_extmods():
    '''
    
    '''
    ret = {}
    ext_dir = os.path.join(__opts__['cachedir'], 'extmods')
    mod_types = os.listdir(ext_dir)
    for mod_type in mod_types:
        ret[mod_type] = set()
        for _, _, files in salt.utils.path.os_walk(os.path.join(ext_dir, mod_type)):
            for fh_ in files:
                ret[mod_type].add(fh_.split('.')[0])
        ret[mod_type] = list(ret[mod_type])
    return ret
849006
def _GetTimelineStatEntries(client_id, file_path, with_history=True):
  """"""

  if data_store.RelationalDBEnabled():
    fn = _GetTimelineStatEntriesRelDB
  else:
    fn = _GetTimelineStatEntriesLegacy

  for v in fn(client_id, file_path, with_history=with_history):
    yield v
342348
def _GetImportTimestamps(self, pefile_object):
    
    import_timestamps = []
    if not hasattr(pefile_object, 'DIRECTORY_ENTRY_IMPORT'):
      return import_timestamps
    for importdata in pefile_object.DIRECTORY_ENTRY_IMPORT:
      dll_name = getattr(importdata, 'dll', '')
      try:
        dll_name = dll_name.decode('ascii')
      except UnicodeDecodeError:
        dll_name = dll_name.decode('ascii', errors='replace')
      if not dll_name:
        dll_name = '<NO DLL NAME>'

      timestamp = getattr(importdata.struct, 'TimeDateStamp', 0)
      if timestamp:
        import_timestamps.append([dll_name, timestamp])
    return import_timestamps