def info(server): log.out('first =', server.first) log.out('last =', server.last) log.out('closed =', server.closed) log.out('current =', server.current) log.out('validated =', server.validated) log.out('complete =', range.to_string(server.complete)) if args.full: log.out(pretty_print(server.info()))
def cache(server, clear=false): cache = server.cache(args.full) name = ['summary', 'full'][args.full] files = cache.file_count() if not files: log.error('no files in %s cache.' % name) elif clear: if not clear.strip() == 'clear': raise exception("don't understand 'clear %s'." % clear) if not args.yes: yes = raw_input('ok to clear %s cache? (y/n) ' % name) if not yes.lower().startswith('y'): log.out('cancelled.') return cache.clear(args.full) log.out('%s cache cleared - %d file%s deleted.' % (name.capitalize(), files, '' if files == 1 else 's')) else: caches = (int(c) for c in cache.cache_list()) log.out(range.to_string(caches))
def round_trip(self, s, *items): self.assertequals(range.from_string(s), set(items)) self.assertequals(range.to_string(items), s)
def ledger_number(print, server, numbers): print(range.to_string(numbers))