def stream_generator(function):
 before_fullname = None
 seen_fullnames = BoundedSet(301)
 without_before_counter = 0
 while True:
  newest_fullname = None
  limit = 100
  if (before_fullname is None):
   limit -= without_before_counter
   without_before_counter = ((without_before_counter + 1) % 30)
  for item in reversed(list(function(limit=limit, params={'before': before_fullname}))):
   if (item.fullname in seen_fullnames):
    continue
   seen_fullnames.add(item.fullname)
   newest_fullname = item.fullname
   (yield item)
  before_fullname = newest_fullname

def stream_generator ( function ) : before_fullname = None seen_fullnames = BoundedSet ( 301 ) without_before_counter = 0 while True : newest_fullname = None limit = 100 if ( before_fullname is None ) : limit -= without_before_counter without_before_counter = ( ( without_before_counter + 1 ) % 30 ) for item in reversed ( list ( function ( limit = limit , params = { 'before' : before_fullname } ) ) ) : if ( item . fullname in seen_fullnames ) : continue seen_fullnames . add ( item . fullname ) newest_fullname = item . fullname ( yield item ) before_fullname = newest_fullname
forever yield new items from listinggenerators .