Exemplo n.º 1
0
 def _BBI_one(self, NCID, listener):
     from .notecards_.big_index_via_collection import \
         big_index_for_one as func, higher_level_functions as fxer
     items = func(NCID, self, listener)
     if items is None:
         return
     return fxer().pretend_big_index(NCID, items)
Exemplo n.º 2
0
def read_only_business_collection_via_path_(collection_path, listener=None):

    if not isinstance(collection_path, str):
        collection_path.build_big_index_
        return collection_path

    from kiss_rdb.storage_adapters_.eno import \
        EXPERIMENTAL_caching_collection as func

    coll = func(
        collection_path, max_num_lines_to_cache=None,
        do_load_schema_from_filesystem=True, opn=None,
        listener=listener)
    return coll and _Notecards(coll)
Exemplo n.º 3
0
    def build_end_state(self):
        opn = self.build_convoluted_opn()
        coll_path = '/fake/DIRRO'

        from kiss_rdb.storage_adapters_.eno import \
            EXPERIMENTAL_caching_collection as func
        coll = func(coll_path, do_load_schema_from_filesystem=False, opn=opn)
        ci = coll.custom_functions

        from modality_agnostic import ModalityAgnosticErrorMonitor as cls
        mon = cls(None)

        wow = ci.AUDIT_TRAIL_FOR('ABC', mon, opn=opn)
        return tuple(wow)
Exemplo n.º 4
0
    def end_state_keys_and_values(self):
        listener, emis = listener_and_emissions_for(self)

        # Hack a builder function that you inspect the result from
        def fsr(ci):
            my_reader = sm.Caching_FS_Reader_(ci, max_num_lines_to_cache=mn)
            yuck.append(my_reader)
            yuck.append(self.take_snapshot_before(my_reader))
            return my_reader

        yuck = []
        mn = self.given_max_num_lines_to_cache()

        sm = subject_module()

        # Build the collection
        coll_path = this_one_dir()
        from kiss_rdb.storage_adapters_.eno import \
            mutable_eno_collection_via as func
        coll = func(coll_path, fsr=fsr)

        rest = () if (eid := self.given_EID()) is None else (eid, )
        for k, v in self.given_performance(listener, coll, *rest):
            yield k, v

        my_reader, before = yuck
        after = self.take_snapshot_after(my_reader)

        do_BA = (before is not None or after is not None)
        if do_BA:
            yield 'before', before

        if 0 != len(emis):
            yield 'emissions', tuple(emis)

        if do_BA:
            yield 'after', after
Exemplo n.º 5
0
 def monitor_via_stderr(serr):
     from script_lib.magnetics.error_monitor_via_stderr import func
     return func(serr, default_error_exitstatus=4)
Exemplo n.º 6
0
def _collection_via_dict(dct):
    from kiss_rdb.magnetics.via_collection import \
        collection_via_dictionary as func
    return func(dct)
Exemplo n.º 7
0
    if 0 == len(bash_argv) or '-' == (coll_path := bash_argv.pop())[0]:
        return usage()

    test_name = bash_argv_pop('<test-name>')
    f = tests.get(test_name)
    if f is None:
        serr.write(f'{test_name!r} is not a test\n')
        serr.write(f'Available tests: {test_names_alternation()}\n')
        return 3

    listener = _listener_via_IO(serr)

    from kiss_rdb.storage_adapters_.eno import \
        mutable_eno_collection_via as func
    coll = func(coll_path, rng=None, listener=listener)
    if coll is None:
        return 123
    return tests[test_name]()


# ci = collection implementation


def _big_audit_trail(sout, eid, coll, mon):
    def summarize(o):
        sout.writelines(o.to_summary_lines())

    ci = coll.custom_functions
    itr = ci.AUDIT_TRAIL_FOR(eid, mon)
    if itr:
Exemplo n.º 8
0
def _mutable_business_collection_via(
        collection_path, rng, listener=None):  # #testpoint
    from kiss_rdb.storage_adapters_.eno import \
        mutable_eno_collection_via as func
    coll = func(collection_path, rng=rng, listener=listener)
    return coll and _Notecards(coll)
Exemplo n.º 9
0
    def _BBI_many(self, listener):
        from .notecards_.big_index_via_collection import \
            big_index_for_many as func

        with self.open_EID_traversal_EXPERIMENTAL(listener) as eids:
            return func(eids, self, listener)
Exemplo n.º 10
0
 def call_value_function_(self, expression_string, bent, listener, **kw):
     if not hasattr(self, '_custom_func_memo'):
         self._custom_func_memo = {}
     from .notecards_.call_value_function import func
     return func(bent, expression_string,
                 self._custom_func_memo, self, listener, kw)
Exemplo n.º 11
0
 def abstract_document_via_notecards(self, ncs, listener):
     from .notecards_.abstract_document_via_notecards import \
             abstract_document_via_notecards_iterator_ as func
     return func(iter(ncs), self, listener)
Exemplo n.º 12
0
 def _prepare_edit(self, direc, mixed, listener):  # #testpoint
     from .notecards_.edited_notecard_via_request_and_notecards \
             import prepare_edit_ as func
     return func(direc, mixed, self, listener)