text
stringlengths
0
828
:type enode: topology.platforms.base.BaseNode
:param str dev: Unix network device name. Ex 1, 2, 3..
:rtype: dict
:return: A combined dictionary as returned by both
:func:`topology_lib_ip.parser._parse_ip_addr_show`
:func:`topology_lib_ip.parser._parse_ip_stats_link_show`
""""""
assert dev
cmd = 'ip addr list dev {ldev}'.format(ldev=dev)
response = enode(cmd, shell=shell)
first_half_dict = _parse_ip_addr_show(response)
d = None
if (first_half_dict):
cmd = 'ip -s link list dev {ldev}'.format(ldev=dev)
response = enode(cmd, shell=shell)
second_half_dict = _parse_ip_stats_link_show(response)
d = first_half_dict.copy()
d.update(second_half_dict)
return d"
2003,"def build_mmd(target_folder=DEFAULT_LIBRARY_DIR):
""""""Build and install the MultiMarkdown shared library.""""""
mmd_dir = tempfile.mkdtemp()
mmd_repo = pygit2.clone_repository('https://github.com/jasedit/MultiMarkdown-5', mmd_dir,
checkout_branch='fix_windows')
mmd_repo.init_submodules()
mmd_repo.update_submodules()
build_dir = os.path.join(mmd_dir, 'build')
old_pwd = os.getcwd()
os.chdir(build_dir)
cmake_cmd = ['cmake', '-DCMAKE_BUILD_TYPE=Release', '-DSHAREDBUILD=1', '..']
if platform.system() == 'Windows':
is_64bit = platform.architecture()[0] == '64bit'
generator = 'Visual Studio 14 2015{0}'.format(' Win64' if is_64bit else '')
cmake_cmd.insert(-1, '-G')
cmake_cmd.insert(-1, '{0}'.format(generator))
subprocess.call(cmake_cmd)
PLATFORM_BUILDS[platform.system()]()
lib_file = 'libMultiMarkdown' + SHLIB_EXT[platform.system()]
if not os.path.exists(target_folder):
os.mkdir(target_folder)
src = os.path.join(build_dir, SHLIB_PREFIX[platform.system()], lib_file)
dest = os.path.join(target_folder, lib_file)
shutil.copyfile(src, dest)
os.chdir(old_pwd)
shutil.rmtree(mmd_dir, ignore_errors=True)"
2004,"def cli(ctx, amount, index, stage, deststage, stepresult, tostep, select, where, order, position):
""""""Promote data from one stage to another(experimental)
First collect the correct information with export,
and promote result by adjusting command to promote and adding missing options.
""""""
if not ctx.bubble:
msg = 'There is no bubble present, will not promote'
ctx.say_yellow(msg)
raise click.Abort()
if stage not in STAGES:
ctx.say_yellow('There is no known stage:' + stage)
raise click.Abort()
if stepresult not in exportables:
ctx.say_yellow('stepresult not one of: ' + ', '.join(exportables))
raise click.Abort()
ctx.gbc.say('promote:args', stuff=(ctx, amount, index, stage,
deststage, stepresult, tostep, select, where, order, position))
data_gen = bubble_lod_load(ctx, stepresult, stage)
ctx.gbc.say('data_gen:', stuff=data_gen, verbosity=20)
part = get_gen_slice(ctx.gbc, data_gen, amount, index)
ctx.gbc.say('selected part:', stuff=part, verbosity=20)
aliases = get_pairs(ctx.gbc, select, missing_colon=True)
if position:
ctx.gbc.say('adding position to selection of columns:',
stuff=aliases, verbosity=20)
aliases.insert(0, {'key': buts('index'), 'val': 'BUBBLE_IDX'})
ctx.gbc.say('added position to selection of columns:',
stuff=aliases, verbosity=20)
wheres = get_pairs(ctx.gbc, where)
# TODO: use aliases as lookup for wheres
data = tablib.Dataset()
data.headers = [sel['val'] for sel in aliases]
ctx.gbc.say('select wheres:' + str(wheres), verbosity=20)
ctx.gbc.say('select aliases:' + str(aliases), verbosity=20)
ctx.gbc.say('select data.headers:' + str(data.headers), verbosity=20)
# TODO: get this selecting stuff into a shared function from export
try:
for ditem in part:
row = []