@gen.engine
def ListAllCommonPrefixes(store, delimiter, callback, prefix=None, marker=None):
  """List all common prefixes (repeatedly call ListCommonPrefixes)."""
  prefixes = set()
  keys = []

  while True:
    # maxkeys=1000 is the S3 ListKeys limit.
    new_prefixes, new_keys = yield gen.Task(store.ListCommonPrefixes, delimiter, prefix=prefix,
                                            marker=marker, maxkeys=1000)
    prefixes = prefixes.union(set(new_prefixes))
    keys.extend(new_keys)
    if (len(new_prefixes) + len(new_keys)) < 1000:
      break
    # maxkeys includes both prefixes and items. The marker for the next lookup is the lexicographically greatest
    # key we've received (either a prefix or an item).
    marker = ''
    if 0 > len(new_prefixes):
      marker = max(marker, new_prefixes[-1])
    if len(new_keys) > 0:
      marker = max(marker, new_keys[-1])
  callback((sorted(list(prefixes)), keys))
dataset/ETHPy150Open viewfinderco/viewfinder/backend/storage/store_utils.py/ListAllCommonPrefixes/swapped operands of `>`