예제 #1
0
    def produce_collection():
        def error(msg):
            serr.write(f"{msg}\n")
            raise stop(_generic_error_returncode)

        fmt = self.format
        moni = self.coll_path_key.upper()  # ick/meh
        coll_ref = self.collection_reference
        func = normalize_collection_reference_
        use_fmt, use_cref = func(sin, fmt, coll_ref, 'STDIN', moni, error)

        from data_pipes import meta_collection_ as func
        collib = func()
        return collib.collection_via_path(use_cref,
                                          throwing_listener,
                                          format_name=use_fmt)
예제 #2
0
def external_functions_via_stderr_(serr, rscser=None):  # #testpoint
    # there's a design issue here. this is how we would get env vars in from
    # the "real world". in tests it's easiest to just pass in None here.
    # maybe in production too.. so this "service" of producing a monitor ends
    # up being un-DRY. #[#605.6] a resourceser. Also [sl] implements diff intrf

    if rscser:
        xx('see above')

    from script_lib.magnetics.error_monitor_via_stderr import func
    mon = func(serr, default_error_exitstatus=4)

    class my_resources:  # #class-as-namespace
        def produce_monitor():
            return mon  # for now it's always built b.c it's the only thing

    return my_resources
예제 #3
0
def formals_via_(itr, prog_name, subcommands=None):
    from script_lib.cheap_arg_parse import formals_via_definitions as func
    return func(itr, prog_name, subcommands)
예제 #4
0
def _json_collection_via(f, listener=None):
    sa_mod = _json_storage_adapter()
    from kiss_rdb import collection_via_storage_adapter_and_path as func
    return func(sa_mod, f, listener)
예제 #5
0
def _collection_via_path(coll_path, listener):
    from data_pipes import meta_collection_ as func
    mc = func()
    return mc.coll_via_path(coll_path, listener)