Пример #1
0
    def __init__(self):
        cfg_file = file.normalize(args.config or 'rippled.cfg')
        self.config = configfile.read(open(cfg_file))
        if args.database != args.none:
            reader = databasereader.databasereader(self.config)
        else:
            reader = rippledreader.rippledreader(self.config)

        self.reader = reader
        self.complete = reader.complete

        names = {
            'closed': reader.name_to_ledger_index('closed'),
            'current': reader.name_to_ledger_index('current'),
            'validated': reader.name_to_ledger_index('validated'),
            'first': self.complete[0] if self.complete else none,
            'last': self.complete[-1] if self.complete else none,
        }
        self.__dict__.update(names)
        self.ledgers = sorted(range.join_ranges(*args.ledgers, **names))

        def make_cache(is_full):
            name = 'full' if is_full else 'summary'
            filepath = os.path.join(args.cache, name)
            creator = lambda n: reader.get_ledger(n, is_full)
            return filecache(filepath, creator)
        self._caches = [make_cache(false), make_cache(true)]
Пример #2
0
 def test_trivial(self):
     self.assertequals(configfile.read(""), {})
Пример #3
0
 def test_full(self):
     self.assertequals(configfile.read(full.splitlines()), result)