def ingestions_for_bundle(bundle, environ=None): return sorted( (from_bundle_ingest_dirname(ing) for ing in os.listdir(pth.data_path([bundle], environ)) if not pth.hidden(ing)), reverse=True, )
def bundles(): """List all of the available data bundles. """ for bundle in sorted(bundles_module.bundles.keys()): try: ingestions = sorted( (str(bundles_module.from_bundle_ingest_dirname(ing)) for ing in os.listdir(pth.data_path([bundle])) if not pth.hidden(ing)), reverse=True, ) except OSError as e: if e.errno != errno.ENOENT: raise ingestions = [] # If we got no ingestions, either because the directory didn't exist or # because there were no entries, print a single message indicating that # no ingestions have yet been made. for timestamp in ingestions or ["<no ingestions>"]: print("%s %s" % (bundle, timestamp))
def bundles(): """List all of the available data bundles. """ for bundle in sorted(bundles_module.bundles.keys()): try: ingestions = sorted( (str(bundles_module.from_bundle_ingest_dirname(ing)) for ing in os.listdir(pth.data_path([bundle])) if not pth.hidden(ing)), reverse=True, ) except IOError as e: if e.errno != errno.ENOENT: raise ingestions = [] # If we got no ingestions, either because the directory didn't exist or # because there were no entries, print a single message indicating that # no ingestions have yet been made. for timestamp in ingestions or ["<no ingestions>"]: print("%s %s" % (bundle, timestamp))
def bundles(): """List all of the available data bundles. """ for bundle in sorted(bundles_module.bundles.keys()): try: ingestions = sorted( (str(bundles_module.from_bundle_ingest_dirname(ing)) for ing in os.listdir(pth.data_path([bundle])) if not pth.hidden(ing)), reverse=True, ) except IOError as e: if e.errno != errno.ENOENT: raise ingestions = [] print( '\n'.join( '%s %s' % (bundle, line) for line in ( ingestions if ingestions else ('<no ingestions>',) ) ), )