示例#1
0
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()))
示例#2
0
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))
示例#3
0
 def round_trip(self, s, *items):
     self.assertequals(range.from_string(s), set(items))
     self.assertequals(range.to_string(items), s)
示例#4
0
def ledger_number(print, server, numbers):
    print(range.to_string(numbers))