Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def tcl_package_require_caas():
if 'XBU_SHARED' in os.environ \
and os.environ['XBU_SHARED'] not in \
tcl.cast_list(tcl.get_var('::auto_path'), item_cast=tclstr):
tcl.call('lappend', '::auto_path', os.environ['XBU_SHARED'])
tcl.call('package', 'require', 'cAAs')
def _clean_cli(clie):
clie = pyats.tcl.cast_list(clie)
if len(clie) == 2:
return (clie[0], tuple(
(_clean_cli(e) for e in pyats.tcl.cast_list(clie[1]))))
else:
return (clie[0], None)
def tcl_invoke_ats_cmd(cmd, *, cast_=None, **kwargs):
cmd = TclCommand(cmd, keywords=kwargs, cast=tcl.cast_list)
result = cmd()
result_code = result[0]
result_msg = result[1] if len(result) == 2 else result[1:]
try:
result_code = tcl.cast_int(result[0])
except ValueError:
result_code = tclstr(result[0])
if result_code in ('passed', 1):
if cast_:
result_msg = cast_(result_msg)
return result_msg
else:
raise RuntimeError(tclstr(result_msg))
def _clean_cli(clie):
clie = pyats.tcl.cast_list(clie)
if len(clie) == 2:
return (clie[0], tuple(sorted(
(_clean_cli(e) for e in pyats.tcl.cast_list(clie[1])),
key=functools.cmp_to_key(_DictionaryCompare_index0))))
else:
return (clie[0], None)
def _clean_cli(clie):
clie = pyats.tcl.cast_list(clie)
if len(clie) == 2:
return (clie[0], tuple(sorted(
(_clean_cli(e) for e in pyats.tcl.cast_list(clie[1])),
key=functools.cmp_to_key(_DictionaryCompare_index0))))
else:
return (clie[0], None)
tree = tuple(sorted(
(_clean_cli(e) for e in pyats.tcl.cast_list(cli)),
key=functools.cmp_to_key(_DictionaryCompare_index0)))
else:
def _clean_cli(clie):
clie = pyats.tcl.cast_list(clie)
if len(clie) == 2:
return (clie[0], tuple(
(_clean_cli(e) for e in pyats.tcl.cast_list(clie[1]))))
else:
return (clie[0], None)
tree = tuple(
(_clean_cli(e) for e in pyats.tcl.cast_list(cli)))
return tree
else:
is_nxos = os == 'nxos'
lvl = 0
lvl_indent = {
lvl: 0,
}
lvl_tree = {
lvl: [],
}
def _wrap_up_one_lvl():