示例#1
0
def _build_meta_collection():
    from kiss_rdb import hub_mod_name_and_mod_dir as func
    mod_name_1, mod_dir_1 = func()

    pcs = 'data_pipes', 'format_adapters'
    from os.path import join as path_join, dirname as dn
    mod_name, mod_dir = '.'.join(pcs), path_join(dn(dn(__file__)), *pcs)

    from kiss_rdb.magnetics_.collection_via_path import \
        collectioner_via_storage_adapters_module as func
    return func(mod_name_1, mod_dir_1, mod_name, mod_dir)
def _collection_via_resource(x,
                             listener=_throwing_listener,
                             opn=None,
                             iden_er_er=None):
    sa_mod = _adapter_module()
    from kiss_rdb import collection_via_storage_adapter_and_path as func
    return func(sa_mod, x, listener, opn=opn, iden_er_er=iden_er_er)
    def build_idener():
        def idener(expr):
            iden = vendor(expr)
            if iden is None:
                raise _Stop()
            return iden

        from pho._issues import build_identifier_parser_ as func
        vendor = func(listener)
        return idener
示例#4
0
def mutable_eno_collection_via(
        directory, listener=None,
        rng=None, fsr=None,
        do_load_schema_from_filesystem=True  # 👀
        ):

    import sys
    sa_mod = sys.modules[__name__]
    from kiss_rdb import collection_via_storage_adapter_and_path as func
    return func(
            sa_mod, directory, listener,
            rng=rng, fsr=fsr,
            do_load_schema_from_filesystem=do_load_schema_from_filesystem)
def _notecard_body_lines_via_document_path(path):

    with open(path) as lines:
        fm_lines, sections = _FM_lines_and_sects_via_lines(lines, path)

    # NOTE: doing NOTHING with frontmatter for now

    # Skip this one section if it exists
    if sections and 'document-meta' == sections[-1].header.label_text:
        sections.pop()

    from pho.magnetics_.abstract_document_via_native_markdown_lines \
        import AbstractDocument_ as func

    ad = func(None, tuple(sections), path=path)
    return ad.TO_HOPEFULLY_AGNOSTIC_MARKDOWN_LINES()
def _FM_lines_and_sects_via_lines(lines, path):
    from pho.magnetics_.abstract_document_via_native_markdown_lines \
        import PARSE_DOCUMENT_NEW_WAY_ as func

    fm_lines, sects = None, None
    itr = func(lines, path)
    for typ, x in itr:  # once
        assert 'unparsed_frontmatter_lines' == typ
        fm_lines = x

        def these():
            for typ, x in itr:
                assert 'markdown_header' == typ
                yield x

        sects = list(these())
        break
    return fm_lines, sects
def _whine_big(iden, dindex, dir_abspath):
    key = iden.to_inner_string_()

    from pho.magnetics_.text_via import \
        word_wrap_pieces_using_commas as func

    head = f"A document for {key!r} no found"
    these = tuple(func(dindex.keys(), 79))  # ick/meh
    leng = len(these)
    if leng:
        if 1 == leng and len(these[0]) < 20:
            yield '. Have: '.join((head, these[0]))
        else:
            yield ''.join((head, '. Have:'))
            for line in these:
                yield line
    else:
        sentence = 'Directory has no documents.'
        yield '. '.join((head, sentence))

    yield ''.join(('Directory: ', dir_abspath))
 def build_collection(abspath):
     from kiss_rdb import \
         collection_via_storage_adapter_name_and_path as func
     return func('eno', abspath, listener)
示例#9
0
 def open_entities_via_identifiers(idens, listener):
     mon = _monitor_via_listener(listener)
     itr = fs_reader().entities_via_identifiers(idens, mon)
     from contextlib import nullcontext as func
     return func(itr)
示例#10
0
 def AUDIT_TRAIL_FOR(eid, mon, opn=None):
     from ._audit_trail import func
     return func(eid, self, mon, opn=opn)
示例#11
0
 def RESERVE_NEW_ENTITY_IDENTIFIER(listener, eid=None):
     from kiss_rdb.magnetics_.provision_ID_randomly_via_identifiers \
         import reserve_new_entity_identifier_ as func
     return func(eid, directory, rng, _THREE, listener)
 def do(fp, listener):
     assert hasattr(fp, '__next__')  # [#022]
     return func(fp, listener, which_table=None, iden_er_er=iden_er_er)
 def use_f(*a):
     from importlib import import_module
     mod = import_module(module_name)
     func = getattr(mod, attr)
     return func(*a)
def collection_via_real_path(path, listener):
    from kiss_rdb import collectionerer as func
    mcoll = func()
    return mcoll.collection_via_path(path, listener)
def complete_schema_via_row_ASTs(row1, row2):
    func = _adapter_module().complete_schema_via_
    return func(row1, row2)