def _GetRequireOrProvideTokens(self, token, token_string):
    tokens = []
    while token:
      if token.type == Type.IDENTIFIER:
        if token.string == token_string:
          tokens.append(token)
        elif token.string not in [
            'goog.provide', 'goog.require', 'goog.setTestOnly']:
          # These 3 identifiers are at the top of the file. So if any other
          # identifier is encountered, return.
          # TODO(user): Once it's decided what ordering goog.require
          # should use, add 'goog.module' to the list above and implement the
          # decision.
          break
      token = token.next

    return tokens
Gets all goog.provide or goog.require tokens in the given token stream.
dataset/ETHPy150Open google/closure-linter/closure_linter/requireprovidesorter.py/RequireProvideSorter._GetRequireOrProvideTokens