<commit_before># -*- test-case-name: axiom.test.test_substore -*-

from axiom.store import Store
from axiom.item import Item
from axiom.attributes import integer, path, inmemory

class SubStore(Item):

    schemaVersion = 1
    typeName = 'substore'

    storepath = path()
    substore = inmemory()

    def __init__(self, store, path, *a, **kw):
        super(SubStore, self).__init__(store=store, *a, **kw)
        self.storepath = store.newDirectory(*path)

    def open(self):
        if hasattr(self, 'substore'):
            return self.substore
        else:
            s = self.substore = Store(self.storepath.path,
                                      parent=self.store,
                                      idInParent=self.storeID)
            s._openSubStore = self # don't fall out of cache as long as the
                                   # store is alive!<commit_msg>Administrator powerup with working nav features.<commit_after># -*- test-case-name: axiom.test.test_substore -*-

from axiom.store import Store
from axiom.item import Item
from axiom.attributes import integer, path, inmemory

class SubStore(Item):

    schemaVersion = 1
    typeName = 'substore'

    storepath = path()
    substore = inmemory()

    def __init__(self, store, path, *a, **kw):
        super(SubStore, self).__init__(store=store, *a, **kw)
        self.storepath = store.newDirectory(*path)
        # Force a database to exist if it didn't
        self.open()
        self.close()

    def close(self):
        self.substore.close()
        del self.substore._openSubStore
        del self.substore

    def open(self):
        if hasattr(self, 'substore'):
            return self.substore
        else:
            s = self.substore = Store(self.storepath.path,
                                      parent=self.store,
                                      idInParent=self.storeID)
            s._openSubStore = self # don't fall out of cache as long as the
                                   # store is alive!
{'fraction_non_alphanumeric': 0.09975186104218363, 'fraction_numerical': 0.0009925558312655087, 'mean_word_length': 1.8841201716738198, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3989837', 'n_tokens_mistral': 585, 'n_tokens_neox': 555, 'n_words': 153}