Bubble 2016.08.16

bubble.util package

«  bubble.commands package   ::   Contents   ::   bubble.util.dataset package  »

bubble.util package

Submodules

bubble.util.buts module

bubble.util.buts.buts(name)[source]

bubble tagging system for bubble meta information

starts with 3 and ends with an underscore name should be all lowercase and todo enforce.

bubble.util.caller module

bubble.util.cfg module

yaml based configuration, with a dotted access of configuration

class bubble.util.cfg.BubbleDoct(org_dict, d=0, p=None, k=None)[source]

Bases: dict

export_dict()[source]
say(msg='something', stuff=None, verbosity=100)[source]
bubble.util.cfg.get_config(*args, **kwargs)[source]
bubble.util.cfg.put_config(*args, **kwargs)[source]

bubble.util.cli_misc module

bubble.util.cli_misc.bubble_lod_dump(ctx, step, stage, full_data, reset, data_gen)[source]
bubble.util.cli_misc.bubble_lod_load(ctx, step, stage)[source]
bubble.util.cli_misc.create_dir(ctx, abs_dir_path)[source]
bubble.util.cli_misc.file_exists(ctx, abs_file_name)[source]
bubble.util.cli_misc.get_client(ctx, CLIENT, abs_path=None)[source]
bubble.util.cli_misc.get_pairs(ctx, spairs=None, missing_colon=False)[source]
bubble.util.cli_misc.get_server(ctx, SERVER, abs_path=None)[source]
bubble.util.cli_misc.load_rule_functions(ctx, custom_rule_functions_py='./custom_rule_functions.py')[source]
bubble.util.cli_misc.make_uniq_for_step(ctx, ukeys, step, stage, full_data, clean_missing_after_seconds, to_uniq)[source]

initially just a copy from UNIQ_PULL

bubble.util.cli_misc.update_stats(ctx, stage, stats={})[source]
bubble.util.cli_misc.utf8_only(ctx)[source]

bubble.util.counter module

class bubble.util.counter.Counter[source]

Bases: bubble.Bubble

count()[source]
get_total()[source]

bubble.util.delta module

bubble.util.delta.clean_bts(ctx, data={})[source]
bubble.util.delta.dict_delta(ctx, new={}, old={})[source]
bubble.util.delta.find_key_index(ctx, key_index, key)[source]
bubble.util.delta.get_current(gbc, item)[source]
bubble.util.delta.get_newest_uniq(ctx, luniq_res={})[source]
bubble.util.delta.get_ukey(ctx, current={}, keys=[])[source]
bubble.util.delta.get_uniq_list(ctx, luniq_res={})[source]
bubble.util.delta.make_key_index(ctx, keyed, full_data, remove_missing_after_seconds=None)[source]
bubble.util.delta.make_uniq(ctx, ldict=[], keyed=[], uniqstr='id', tag='PRE', full_data=True, remove_missing_after_seconds=None)[source]

bubble.util.escapes module

bubble.util.escapes.add_esc(chars, tag)[source]
bubble.util.escapes.escape(ctx, key_str, sep='.')[source]
bubble.util.escapes.unescape(ctx, key_str)[source]

bubble.util.examples module

bubble.util.examples.get_example_client_pull()[source]

dummy client with pull method

bubble.util.examples.get_example_client_push()[source]

dummy client with push method

bubble.util.examples.get_example_configuration()[source]

an example configuration

bubble.util.examples.get_example_rule_functions()[source]

some example rule functions

bubble.util.examples.get_example_rules_bubble()[source]

an example in .bubble format

bubble.util.flat_dict module

# flattten and unflatten dictionaries with some “bubble twists”, initial inspiration from: # http://stackoverflow.com/questions/6027558/flatten-nested-python-dictionaries-compressing-keys # we only make also sure list items are naturally indexed and part of the whole key # {‘a’:[‘A’,’B’,{‘d’:’X’}]} # becomes: # {‘a.1’:’A’ # ‘a.2’:’B’ # ‘a.3.d’:’X’ # ‘a.___bts_list_’:true, # ‘a.___bts_listlen_’:3, # ‘___bts_flat_’:true # } # make index: natural indexing a configuration option

bubble.util.flat_dict.flat(ctx, init={}, path='', sep='.', level=1)[source]
bubble.util.flat_dict.get_flat_path(ctx, current, kpath, default_not_existing=None, sep='.')[source]
bubble.util.flat_dict.process_flk(ctx, k, proc, flktmp)[source]
bubble.util.flat_dict.set_flat_at_path(ctx, path_str, star_dict, data)[source]
bubble.util.flat_dict.set_path(ctx, path_str, value, data)[source]

Sets the given key in the given dict object to the given value. If the given path is nested, child dicts are created as appropriate. Accepts either a dot-delimited path or an array of path elements as the path variable.

bubble.util.flat_dict.unflat(ctx, flattened, sep='.', index=1)[source]
bubble.util.flat_dict.unflat_list(ctx, vals)[source]

bubble.util.generators module

store: for getting and putting files

bubble.util.generators.get_gen_slice(ctx=<bubble.Bubble object>, iterable=[], amount=-1, index=-1)[source]

very crude way of slicing a generator

bubble.util.generators.make_gen(ctx=<bubble.Bubble object>, iterable=[], counter=None)[source]
bubble.util.generators.make_stamping_gen(ctx=<bubble.Bubble object>, iterable=[], full_data=True, counter=None)[source]

bubble.util.inside_try module

bubble.util.inside_try.get_try_option(ctx, key)[source]
bubble.util.inside_try.inside_try(func, options={})[source]

decorator to silence exceptions, for logging we want a “safe” fail of the functions

bubble.util.inside_try.set_try_option(ctx, key, value)[source]

bubble.util.magic module

internal magic values, like the configuration

bubble.util.magic.get_magic(ctx, yaml_mgc_file='config/magic.yaml')[source]
bubble.util.magic.save_magic(ctx, yaml_mgc_file='config/magic.yaml', MGC={'BMGC': {}})[source]

bubble.util.value_path module

not sure if we need this a lot anymore, flat<->unflat seems to work great, eventually add the get_path and set_path to flat_dict

class bubble.util.value_path.ValuePath[source]

Bases: bubble.Bubble

exists(data, path)[source]
get_path(data, path)[source]
set_path(data, path, value)[source]

Sets the given key in the given dict object to the given value. If the given path is nested, child dicts are created as appropriate. Accepts either a dot-delimited path or an array of path elements as the path variable.

bubble.util.value_path.get_keypath(current, kpath, default_not_existing=None)[source]

bubble.util.zipit module

bubble.util.zipit.zipit(*args, **kwargs)[source]

Module contents

«  bubble.commands package   ::   Contents   ::   bubble.util.dataset package  »