repo stringlengths 7 54 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 20 28.4k | docstring stringlengths 1 46.3k | docstring_tokens listlengths 1 1.66k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 1
value | summary stringlengths 4 350 | obf_code stringlengths 7.85k 764k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ktbyers/netmiko | netmiko/alcatel/alcatel_sros_ssh.py | AlcatelSrosSSH.exit_config_mode | def exit_config_mode(self, exit_config="exit all", pattern="#"):
""" Exit from configuration mode."""
return super(AlcatelSrosSSH, self).exit_config_mode(
exit_config=exit_config, pattern=pattern
) | python | def exit_config_mode(self, exit_config="exit all", pattern="#"):
""" Exit from configuration mode."""
return super(AlcatelSrosSSH, self).exit_config_mode(
exit_config=exit_config, pattern=pattern
) | [
"def",
"exit_config_mode",
"(",
"self",
",",
"exit_config",
"=",
"\"exit all\"",
",",
"pattern",
"=",
"\"#\"",
")",
":",
"return",
"super",
"(",
"AlcatelSrosSSH",
",",
"self",
")",
".",
"exit_config_mode",
"(",
"exit_config",
"=",
"exit_config",
",",
"pattern"... | Exit from configuration mode. | [
"Exit",
"from",
"configuration",
"mode",
"."
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/alcatel/alcatel_sros_ssh.py#L66-L70 | train | Exit from configuration mode. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/alcatel/alcatel_sros_ssh.py | AlcatelSrosSSH.check_config_mode | def check_config_mode(self, check_string="config", pattern="#"):
""" Checks if the device is in configuration mode or not. """
return super(AlcatelSrosSSH, self).check_config_mode(
check_string=check_string, pattern=pattern
) | python | def check_config_mode(self, check_string="config", pattern="#"):
""" Checks if the device is in configuration mode or not. """
return super(AlcatelSrosSSH, self).check_config_mode(
check_string=check_string, pattern=pattern
) | [
"def",
"check_config_mode",
"(",
"self",
",",
"check_string",
"=",
"\"config\"",
",",
"pattern",
"=",
"\"#\"",
")",
":",
"return",
"super",
"(",
"AlcatelSrosSSH",
",",
"self",
")",
".",
"check_config_mode",
"(",
"check_string",
"=",
"check_string",
",",
"patte... | Checks if the device is in configuration mode or not. | [
"Checks",
"if",
"the",
"device",
"is",
"in",
"configuration",
"mode",
"or",
"not",
"."
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/alcatel/alcatel_sros_ssh.py#L72-L76 | train | Checks if the device is in configuration mode or not. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/dell/dell_dnos6.py | DellDNOS6Base.save_config | def save_config(
self,
cmd="copy running-configuration startup-configuration",
confirm=False,
confirm_response="",
):
"""Saves Config"""
return super(DellDNOS6Base, self).save_config(
cmd=cmd, confirm=confirm, confirm_response=confirm_response
) | python | def save_config(
self,
cmd="copy running-configuration startup-configuration",
confirm=False,
confirm_response="",
):
"""Saves Config"""
return super(DellDNOS6Base, self).save_config(
cmd=cmd, confirm=confirm, confirm_response=confirm_response
) | [
"def",
"save_config",
"(",
"self",
",",
"cmd",
"=",
"\"copy running-configuration startup-configuration\"",
",",
"confirm",
"=",
"False",
",",
"confirm_response",
"=",
"\"\"",
",",
")",
":",
"return",
"super",
"(",
"DellDNOS6Base",
",",
"self",
")",
".",
"save_c... | Saves Config | [
"Saves",
"Config"
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/dell/dell_dnos6.py#L20-L29 | train | Saves Config | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/extreme/extreme_exos.py | ExtremeExosBase.set_base_prompt | def set_base_prompt(self, *args, **kwargs):
"""
Extreme attaches an id to the prompt. The id increases with every command.
It needs to br stripped off to match the prompt. Eg.
testhost.1 #
testhost.2 #
testhost.3 #
If new config is loaded and not sav... | python | def set_base_prompt(self, *args, **kwargs):
"""
Extreme attaches an id to the prompt. The id increases with every command.
It needs to br stripped off to match the prompt. Eg.
testhost.1 #
testhost.2 #
testhost.3 #
If new config is loaded and not sav... | [
"def",
"set_base_prompt",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"cur_base_prompt",
"=",
"super",
"(",
"ExtremeExosBase",
",",
"self",
")",
".",
"set_base_prompt",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"# Strip off an... | Extreme attaches an id to the prompt. The id increases with every command.
It needs to br stripped off to match the prompt. Eg.
testhost.1 #
testhost.2 #
testhost.3 #
If new config is loaded and not saved yet, a '* ' prefix appears before the
prompt, eg.
... | [
"Extreme",
"attaches",
"an",
"id",
"to",
"the",
"prompt",
".",
"The",
"id",
"increases",
"with",
"every",
"command",
".",
"It",
"needs",
"to",
"br",
"stripped",
"off",
"to",
"match",
"the",
"prompt",
".",
"Eg",
"."
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/extreme/extreme_exos.py#L23-L45 | train | Override set_base_prompt to strip off any leading and trailing period and digits and return the base prompt. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/extreme/extreme_exos.py | ExtremeExosBase.send_command | def send_command(self, *args, **kwargs):
"""Extreme needs special handler here due to the prompt changes."""
# Change send_command behavior to use self.base_prompt
kwargs.setdefault("auto_find_prompt", False)
# refresh self.base_prompt
self.set_base_prompt()
return supe... | python | def send_command(self, *args, **kwargs):
"""Extreme needs special handler here due to the prompt changes."""
# Change send_command behavior to use self.base_prompt
kwargs.setdefault("auto_find_prompt", False)
# refresh self.base_prompt
self.set_base_prompt()
return supe... | [
"def",
"send_command",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Change send_command behavior to use self.base_prompt",
"kwargs",
".",
"setdefault",
"(",
"\"auto_find_prompt\"",
",",
"False",
")",
"# refresh self.base_prompt",
"self",
".",
... | Extreme needs special handler here due to the prompt changes. | [
"Extreme",
"needs",
"special",
"handler",
"here",
"due",
"to",
"the",
"prompt",
"changes",
"."
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/extreme/extreme_exos.py#L47-L55 | train | Override send_command to change the prompt to use self. base_prompt
. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/extreme/extreme_exos.py | ExtremeExosBase.save_config | def save_config(
self, cmd="save configuration primary", confirm=False, confirm_response=""
):
"""Saves configuration."""
return super(ExtremeExosBase, self).save_config(
cmd=cmd, confirm=confirm, confirm_response=confirm_response
) | python | def save_config(
self, cmd="save configuration primary", confirm=False, confirm_response=""
):
"""Saves configuration."""
return super(ExtremeExosBase, self).save_config(
cmd=cmd, confirm=confirm, confirm_response=confirm_response
) | [
"def",
"save_config",
"(",
"self",
",",
"cmd",
"=",
"\"save configuration primary\"",
",",
"confirm",
"=",
"False",
",",
"confirm_response",
"=",
"\"\"",
")",
":",
"return",
"super",
"(",
"ExtremeExosBase",
",",
"self",
")",
".",
"save_config",
"(",
"cmd",
"... | Saves configuration. | [
"Saves",
"configuration",
"."
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/extreme/extreme_exos.py#L69-L75 | train | Saves configuration primary. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/juniper/juniper.py | JuniperBase.enter_cli_mode | def enter_cli_mode(self):
"""Check if at shell prompt root@ and go into CLI."""
delay_factor = self.select_delay_factor(delay_factor=0)
count = 0
cur_prompt = ""
while count < 50:
self.write_channel(self.RETURN)
time.sleep(0.1 * delay_factor)
c... | python | def enter_cli_mode(self):
"""Check if at shell prompt root@ and go into CLI."""
delay_factor = self.select_delay_factor(delay_factor=0)
count = 0
cur_prompt = ""
while count < 50:
self.write_channel(self.RETURN)
time.sleep(0.1 * delay_factor)
c... | [
"def",
"enter_cli_mode",
"(",
"self",
")",
":",
"delay_factor",
"=",
"self",
".",
"select_delay_factor",
"(",
"delay_factor",
"=",
"0",
")",
"count",
"=",
"0",
"cur_prompt",
"=",
"\"\"",
"while",
"count",
"<",
"50",
":",
"self",
".",
"write_channel",
"(",
... | Check if at shell prompt root@ and go into CLI. | [
"Check",
"if",
"at",
"shell",
"prompt",
"root"
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/juniper/juniper.py#L43-L59 | train | Check if at shell prompt root@ and go into CLI. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/juniper/juniper.py | JuniperBase.strip_prompt | def strip_prompt(self, *args, **kwargs):
"""Strip the trailing router prompt from the output."""
a_string = super(JuniperBase, self).strip_prompt(*args, **kwargs)
return self.strip_context_items(a_string) | python | def strip_prompt(self, *args, **kwargs):
"""Strip the trailing router prompt from the output."""
a_string = super(JuniperBase, self).strip_prompt(*args, **kwargs)
return self.strip_context_items(a_string) | [
"def",
"strip_prompt",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"a_string",
"=",
"super",
"(",
"JuniperBase",
",",
"self",
")",
".",
"strip_prompt",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"self",
".",
"st... | Strip the trailing router prompt from the output. | [
"Strip",
"the",
"trailing",
"router",
"prompt",
"from",
"the",
"output",
"."
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/juniper/juniper.py#L187-L190 | train | Strip the trailing router prompt from the output. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/juniper/juniper.py | JuniperBase.strip_context_items | def strip_context_items(self, a_string):
"""Strip Juniper-specific output.
Juniper will also put a configuration context:
[edit]
and various chassis contexts:
{master:0}, {backup:1}
This method removes those lines.
"""
strings_to_strip = [
r... | python | def strip_context_items(self, a_string):
"""Strip Juniper-specific output.
Juniper will also put a configuration context:
[edit]
and various chassis contexts:
{master:0}, {backup:1}
This method removes those lines.
"""
strings_to_strip = [
r... | [
"def",
"strip_context_items",
"(",
"self",
",",
"a_string",
")",
":",
"strings_to_strip",
"=",
"[",
"r\"\\[edit.*\\]\"",
",",
"r\"\\{master:.*\\}\"",
",",
"r\"\\{backup:.*\\}\"",
",",
"r\"\\{line.*\\}\"",
",",
"r\"\\{primary.*\\}\"",
",",
"r\"\\{secondary.*\\}\"",
",",
... | Strip Juniper-specific output.
Juniper will also put a configuration context:
[edit]
and various chassis contexts:
{master:0}, {backup:1}
This method removes those lines. | [
"Strip",
"Juniper",
"-",
"specific",
"output",
"."
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/juniper/juniper.py#L192-L218 | train | Strip Juniper - specific output. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/arista/arista.py | AristaBase.check_config_mode | def check_config_mode(self, check_string=")#", pattern=""):
"""
Checks if the device is in configuration mode or not.
Arista, unfortunately, does this:
loc1-core01(s1)#
Can also be (s2)
"""
log.debug("pattern: {0}".format(pattern))
self.write_channel(sel... | python | def check_config_mode(self, check_string=")#", pattern=""):
"""
Checks if the device is in configuration mode or not.
Arista, unfortunately, does this:
loc1-core01(s1)#
Can also be (s2)
"""
log.debug("pattern: {0}".format(pattern))
self.write_channel(sel... | [
"def",
"check_config_mode",
"(",
"self",
",",
"check_string",
"=",
"\")#\"",
",",
"pattern",
"=",
"\"\"",
")",
":",
"log",
".",
"debug",
"(",
"\"pattern: {0}\"",
".",
"format",
"(",
"pattern",
")",
")",
"self",
".",
"write_channel",
"(",
"self",
".",
"RE... | Checks if the device is in configuration mode or not.
Arista, unfortunately, does this:
loc1-core01(s1)#
Can also be (s2) | [
"Checks",
"if",
"the",
"device",
"is",
"in",
"configuration",
"mode",
"or",
"not",
"."
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/arista/arista.py#L19-L35 | train | Checks if the device is in configuration mode or not. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/cisco/cisco_nxos_ssh.py | CiscoNxosSSH.session_preparation | def session_preparation(self):
"""Prepare the session after the connection has been established."""
self._test_channel_read(pattern=r"[>#]")
self.ansi_escape_codes = True
self.set_base_prompt()
self.disable_paging()
# Clear the read buffer
time.sleep(0.3 * self.gl... | python | def session_preparation(self):
"""Prepare the session after the connection has been established."""
self._test_channel_read(pattern=r"[>#]")
self.ansi_escape_codes = True
self.set_base_prompt()
self.disable_paging()
# Clear the read buffer
time.sleep(0.3 * self.gl... | [
"def",
"session_preparation",
"(",
"self",
")",
":",
"self",
".",
"_test_channel_read",
"(",
"pattern",
"=",
"r\"[>#]\"",
")",
"self",
".",
"ansi_escape_codes",
"=",
"True",
"self",
".",
"set_base_prompt",
"(",
")",
"self",
".",
"disable_paging",
"(",
")",
"... | Prepare the session after the connection has been established. | [
"Prepare",
"the",
"session",
"after",
"the",
"connection",
"has",
"been",
"established",
"."
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/cisco/cisco_nxos_ssh.py#L11-L19 | train | Prepare the session after the connection has been established. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/cisco/cisco_nxos_ssh.py | CiscoNxosSSH.normalize_linefeeds | def normalize_linefeeds(self, a_string):
"""Convert '\r\n' or '\r\r\n' to '\n, and remove extra '\r's in the text."""
newline = re.compile(r"(\r\r\n|\r\n)")
# NX-OS fix for incorrect MD5 on 9K (due to strange <enter> patterns on NX-OS)
return newline.sub(self.RESPONSE_RETURN, a_string).r... | python | def normalize_linefeeds(self, a_string):
"""Convert '\r\n' or '\r\r\n' to '\n, and remove extra '\r's in the text."""
newline = re.compile(r"(\r\r\n|\r\n)")
# NX-OS fix for incorrect MD5 on 9K (due to strange <enter> patterns on NX-OS)
return newline.sub(self.RESPONSE_RETURN, a_string).r... | [
"def",
"normalize_linefeeds",
"(",
"self",
",",
"a_string",
")",
":",
"newline",
"=",
"re",
".",
"compile",
"(",
"r\"(\\r\\r\\n|\\r\\n)\"",
")",
"# NX-OS fix for incorrect MD5 on 9K (due to strange <enter> patterns on NX-OS)",
"return",
"newline",
".",
"sub",
"(",
"self",... | Convert '\r\n' or '\r\r\n' to '\n, and remove extra '\r's in the text. | [
"Convert",
"\\",
"r",
"\\",
"n",
"or",
"\\",
"r",
"\\",
"r",
"\\",
"n",
"to",
"\\",
"n",
"and",
"remove",
"extra",
"\\",
"r",
"s",
"in",
"the",
"text",
"."
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/cisco/cisco_nxos_ssh.py#L21-L25 | train | Convert \ r \ n or \ r \ n to \ n and remove extra \ r s in the text. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/cisco/cisco_nxos_ssh.py | CiscoNxosSSH.check_config_mode | def check_config_mode(self, check_string=")#", pattern="#"):
"""Checks if the device is in configuration mode or not."""
return super(CiscoNxosSSH, self).check_config_mode(
check_string=check_string, pattern=pattern
) | python | def check_config_mode(self, check_string=")#", pattern="#"):
"""Checks if the device is in configuration mode or not."""
return super(CiscoNxosSSH, self).check_config_mode(
check_string=check_string, pattern=pattern
) | [
"def",
"check_config_mode",
"(",
"self",
",",
"check_string",
"=",
"\")#\"",
",",
"pattern",
"=",
"\"#\"",
")",
":",
"return",
"super",
"(",
"CiscoNxosSSH",
",",
"self",
")",
".",
"check_config_mode",
"(",
"check_string",
"=",
"check_string",
",",
"pattern",
... | Checks if the device is in configuration mode or not. | [
"Checks",
"if",
"the",
"device",
"is",
"in",
"configuration",
"mode",
"or",
"not",
"."
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/cisco/cisco_nxos_ssh.py#L27-L31 | train | Checks if the device is in configuration mode or not. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/cisco/cisco_nxos_ssh.py | CiscoNxosFileTransfer.check_file_exists | def check_file_exists(self, remote_cmd=""):
"""Check if the dest_file already exists on the file system (return boolean)."""
if self.direction == "put":
if not remote_cmd:
remote_cmd = "dir {}{}".format(self.file_system, self.dest_file)
remote_out = self.ssh_ctl_c... | python | def check_file_exists(self, remote_cmd=""):
"""Check if the dest_file already exists on the file system (return boolean)."""
if self.direction == "put":
if not remote_cmd:
remote_cmd = "dir {}{}".format(self.file_system, self.dest_file)
remote_out = self.ssh_ctl_c... | [
"def",
"check_file_exists",
"(",
"self",
",",
"remote_cmd",
"=",
"\"\"",
")",
":",
"if",
"self",
".",
"direction",
"==",
"\"put\"",
":",
"if",
"not",
"remote_cmd",
":",
"remote_cmd",
"=",
"\"dir {}{}\"",
".",
"format",
"(",
"self",
".",
"file_system",
",",... | Check if the dest_file already exists on the file system (return boolean). | [
"Check",
"if",
"the",
"dest_file",
"already",
"exists",
"on",
"the",
"file",
"system",
"(",
"return",
"boolean",
")",
"."
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/cisco/cisco_nxos_ssh.py#L64-L78 | train | Check if the dest_file already exists on the file system ( return boolean. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/cisco/cisco_tp_tcce.py | CiscoTpTcCeSSH.strip_prompt | def strip_prompt(self, a_string):
"""Strip the trailing router prompt from the output."""
expect_string = r"^(OK|ERROR|Command not recognized\.)$"
response_list = a_string.split(self.RESPONSE_RETURN)
last_line = response_list[-1]
if re.search(expect_string, last_line):
... | python | def strip_prompt(self, a_string):
"""Strip the trailing router prompt from the output."""
expect_string = r"^(OK|ERROR|Command not recognized\.)$"
response_list = a_string.split(self.RESPONSE_RETURN)
last_line = response_list[-1]
if re.search(expect_string, last_line):
... | [
"def",
"strip_prompt",
"(",
"self",
",",
"a_string",
")",
":",
"expect_string",
"=",
"r\"^(OK|ERROR|Command not recognized\\.)$\"",
"response_list",
"=",
"a_string",
".",
"split",
"(",
"self",
".",
"RESPONSE_RETURN",
")",
"last_line",
"=",
"response_list",
"[",
"-",... | Strip the trailing router prompt from the output. | [
"Strip",
"the",
"trailing",
"router",
"prompt",
"from",
"the",
"output",
"."
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/cisco/cisco_tp_tcce.py#L53-L61 | train | Strip the trailing router prompt from the output. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/cisco/cisco_tp_tcce.py | CiscoTpTcCeSSH.send_command | def send_command(self, *args, **kwargs):
"""
Send command to network device retrieve output until router_prompt or expect_string
By default this method will keep waiting to receive data until the network device prompt is
detected. The current network device prompt will be determined aut... | python | def send_command(self, *args, **kwargs):
"""
Send command to network device retrieve output until router_prompt or expect_string
By default this method will keep waiting to receive data until the network device prompt is
detected. The current network device prompt will be determined aut... | [
"def",
"send_command",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"len",
"(",
"args",
")",
">=",
"2",
":",
"expect_string",
"=",
"args",
"[",
"1",
"]",
"else",
":",
"expect_string",
"=",
"kwargs",
".",
"get",
"(",
"\"... | Send command to network device retrieve output until router_prompt or expect_string
By default this method will keep waiting to receive data until the network device prompt is
detected. The current network device prompt will be determined automatically.
command_string = command to execute
... | [
"Send",
"command",
"to",
"network",
"device",
"retrieve",
"output",
"until",
"router_prompt",
"or",
"expect_string"
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/cisco/cisco_tp_tcce.py#L63-L87 | train | Send a command to the network device retrieve output until router_prompt or expect_string is set. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/extreme/extreme_nos_ssh.py | ExtremeNosSSH.save_config | def save_config(
self,
cmd="copy running-config startup-config",
confirm=True,
confirm_response="y",
):
"""Save Config for Extreme VDX."""
return super(ExtremeNosSSH, self).save_config(
cmd=cmd, confirm=confirm, confirm_response=confirm_response
) | python | def save_config(
self,
cmd="copy running-config startup-config",
confirm=True,
confirm_response="y",
):
"""Save Config for Extreme VDX."""
return super(ExtremeNosSSH, self).save_config(
cmd=cmd, confirm=confirm, confirm_response=confirm_response
) | [
"def",
"save_config",
"(",
"self",
",",
"cmd",
"=",
"\"copy running-config startup-config\"",
",",
"confirm",
"=",
"True",
",",
"confirm_response",
"=",
"\"y\"",
",",
")",
":",
"return",
"super",
"(",
"ExtremeNosSSH",
",",
"self",
")",
".",
"save_config",
"(",... | Save Config for Extreme VDX. | [
"Save",
"Config",
"for",
"Extreme",
"VDX",
"."
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/extreme/extreme_nos_ssh.py#L24-L33 | train | Save Config for Extreme VDX. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/huawei/huawei.py | HuaweiBase.exit_config_mode | def exit_config_mode(self, exit_config="return", pattern=r">"):
"""Exit configuration mode."""
return super(HuaweiBase, self).exit_config_mode(
exit_config=exit_config, pattern=pattern
) | python | def exit_config_mode(self, exit_config="return", pattern=r">"):
"""Exit configuration mode."""
return super(HuaweiBase, self).exit_config_mode(
exit_config=exit_config, pattern=pattern
) | [
"def",
"exit_config_mode",
"(",
"self",
",",
"exit_config",
"=",
"\"return\"",
",",
"pattern",
"=",
"r\">\"",
")",
":",
"return",
"super",
"(",
"HuaweiBase",
",",
"self",
")",
".",
"exit_config_mode",
"(",
"exit_config",
"=",
"exit_config",
",",
"pattern",
"... | Exit configuration mode. | [
"Exit",
"configuration",
"mode",
"."
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/huawei/huawei.py#L24-L28 | train | Exit configuration mode. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/huawei/huawei.py | HuaweiBase.set_base_prompt | def set_base_prompt(
self, pri_prompt_terminator=">", alt_prompt_terminator="]", delay_factor=1
):
"""
Sets self.base_prompt
Used as delimiter for stripping of trailing prompt in output.
Should be set to something that is general and applies in multiple contexts. For Comwar... | python | def set_base_prompt(
self, pri_prompt_terminator=">", alt_prompt_terminator="]", delay_factor=1
):
"""
Sets self.base_prompt
Used as delimiter for stripping of trailing prompt in output.
Should be set to something that is general and applies in multiple contexts. For Comwar... | [
"def",
"set_base_prompt",
"(",
"self",
",",
"pri_prompt_terminator",
"=",
"\">\"",
",",
"alt_prompt_terminator",
"=",
"\"]\"",
",",
"delay_factor",
"=",
"1",
")",
":",
"log",
".",
"debug",
"(",
"\"In set_base_prompt\"",
")",
"delay_factor",
"=",
"self",
".",
"... | Sets self.base_prompt
Used as delimiter for stripping of trailing prompt in output.
Should be set to something that is general and applies in multiple contexts. For Comware
this will be the router prompt with < > or [ ] stripped off.
This will be set on logging in, but not when enteri... | [
"Sets",
"self",
".",
"base_prompt"
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/huawei/huawei.py#L46-L85 | train | Sets self. base_prompt to the router prompt. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/huawei/huawei.py | HuaweiBase.save_config | def save_config(self, cmd="save", confirm=False, confirm_response=""):
""" Save Config for HuaweiSSH"""
return super(HuaweiBase, self).save_config(
cmd=cmd, confirm=confirm, confirm_response=confirm_response
) | python | def save_config(self, cmd="save", confirm=False, confirm_response=""):
""" Save Config for HuaweiSSH"""
return super(HuaweiBase, self).save_config(
cmd=cmd, confirm=confirm, confirm_response=confirm_response
) | [
"def",
"save_config",
"(",
"self",
",",
"cmd",
"=",
"\"save\"",
",",
"confirm",
"=",
"False",
",",
"confirm_response",
"=",
"\"\"",
")",
":",
"return",
"super",
"(",
"HuaweiBase",
",",
"self",
")",
".",
"save_config",
"(",
"cmd",
"=",
"cmd",
",",
"conf... | Save Config for HuaweiSSH | [
"Save",
"Config",
"for",
"HuaweiSSH"
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/huawei/huawei.py#L87-L91 | train | Save Config for HuaweiSSH | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/huawei/huawei.py | HuaweiTelnet.telnet_login | def telnet_login(
self,
pri_prompt_terminator=r"]\s*$",
alt_prompt_terminator=r">\s*$",
username_pattern=r"(?:user:|username|login|user name)",
pwd_pattern=r"assword",
delay_factor=1,
max_loops=20,
):
"""Telnet login for Huawei Devices"""
dela... | python | def telnet_login(
self,
pri_prompt_terminator=r"]\s*$",
alt_prompt_terminator=r">\s*$",
username_pattern=r"(?:user:|username|login|user name)",
pwd_pattern=r"assword",
delay_factor=1,
max_loops=20,
):
"""Telnet login for Huawei Devices"""
dela... | [
"def",
"telnet_login",
"(",
"self",
",",
"pri_prompt_terminator",
"=",
"r\"]\\s*$\"",
",",
"alt_prompt_terminator",
"=",
"r\">\\s*$\"",
",",
"username_pattern",
"=",
"r\"(?:user:|username|login|user name)\"",
",",
"pwd_pattern",
"=",
"r\"assword\"",
",",
"delay_factor",
"... | Telnet login for Huawei Devices | [
"Telnet",
"login",
"for",
"Huawei",
"Devices"
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/huawei/huawei.py#L103-L164 | train | Telnet login for Huawei Devices | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/huawei/huawei.py | HuaweiVrpv8SSH.commit | def commit(self, comment="", delay_factor=1):
"""
Commit the candidate configuration.
Commit the entered configuration. Raise an error and return the failure
if the commit fails.
default:
command_string = commit
comment:
command_string = commit com... | python | def commit(self, comment="", delay_factor=1):
"""
Commit the candidate configuration.
Commit the entered configuration. Raise an error and return the failure
if the commit fails.
default:
command_string = commit
comment:
command_string = commit com... | [
"def",
"commit",
"(",
"self",
",",
"comment",
"=",
"\"\"",
",",
"delay_factor",
"=",
"1",
")",
":",
"delay_factor",
"=",
"self",
".",
"select_delay_factor",
"(",
"delay_factor",
")",
"error_marker",
"=",
"\"Failed to generate committed config\"",
"command_string",
... | Commit the candidate configuration.
Commit the entered configuration. Raise an error and return the failure
if the commit fails.
default:
command_string = commit
comment:
command_string = commit comment <comment> | [
"Commit",
"the",
"candidate",
"configuration",
"."
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/huawei/huawei.py#L168-L202 | train | Commit the candidate configuration. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | examples/asa_upgrade.py | asa_scp_handler | def asa_scp_handler(ssh_conn, cmd="ssh scopy enable", mode="enable"):
"""Enable/disable SCP on Cisco ASA."""
if mode == "disable":
cmd = "no " + cmd
return ssh_conn.send_config_set([cmd]) | python | def asa_scp_handler(ssh_conn, cmd="ssh scopy enable", mode="enable"):
"""Enable/disable SCP on Cisco ASA."""
if mode == "disable":
cmd = "no " + cmd
return ssh_conn.send_config_set([cmd]) | [
"def",
"asa_scp_handler",
"(",
"ssh_conn",
",",
"cmd",
"=",
"\"ssh scopy enable\"",
",",
"mode",
"=",
"\"enable\"",
")",
":",
"if",
"mode",
"==",
"\"disable\"",
":",
"cmd",
"=",
"\"no \"",
"+",
"cmd",
"return",
"ssh_conn",
".",
"send_config_set",
"(",
"[",
... | Enable/disable SCP on Cisco ASA. | [
"Enable",
"/",
"disable",
"SCP",
"on",
"Cisco",
"ASA",
"."
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/examples/asa_upgrade.py#L9-L13 | train | Enable or disable SCP on Cisco ASA. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | examples/asa_upgrade.py | main | def main():
"""Script to upgrade a Cisco ASA."""
try:
ip_addr = raw_input("Enter ASA IP address: ")
except NameError:
ip_addr = input("Enter ASA IP address: ")
my_pass = getpass()
start_time = datetime.now()
print(">>>> {}".format(start_time))
net_device = {
"device_... | python | def main():
"""Script to upgrade a Cisco ASA."""
try:
ip_addr = raw_input("Enter ASA IP address: ")
except NameError:
ip_addr = input("Enter ASA IP address: ")
my_pass = getpass()
start_time = datetime.now()
print(">>>> {}".format(start_time))
net_device = {
"device_... | [
"def",
"main",
"(",
")",
":",
"try",
":",
"ip_addr",
"=",
"raw_input",
"(",
"\"Enter ASA IP address: \"",
")",
"except",
"NameError",
":",
"ip_addr",
"=",
"input",
"(",
"\"Enter ASA IP address: \"",
")",
"my_pass",
"=",
"getpass",
"(",
")",
"start_time",
"=",
... | Script to upgrade a Cisco ASA. | [
"Script",
"to",
"upgrade",
"a",
"Cisco",
"ASA",
"."
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/examples/asa_upgrade.py#L16-L91 | train | Script to upgrade a Cisco ASA. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | examples/use_cases/case16_concurrency/processes_netmiko.py | show_version | def show_version(a_device):
"""Execute show version command using Netmiko."""
remote_conn = ConnectHandler(**a_device)
print()
print("#" * 80)
print(remote_conn.send_command("show version"))
print("#" * 80)
print() | python | def show_version(a_device):
"""Execute show version command using Netmiko."""
remote_conn = ConnectHandler(**a_device)
print()
print("#" * 80)
print(remote_conn.send_command("show version"))
print("#" * 80)
print() | [
"def",
"show_version",
"(",
"a_device",
")",
":",
"remote_conn",
"=",
"ConnectHandler",
"(",
"*",
"*",
"a_device",
")",
"print",
"(",
")",
"print",
"(",
"\"#\"",
"*",
"80",
")",
"print",
"(",
"remote_conn",
".",
"send_command",
"(",
"\"show version\"",
")"... | Execute show version command using Netmiko. | [
"Execute",
"show",
"version",
"command",
"using",
"Netmiko",
"."
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/examples/use_cases/case16_concurrency/processes_netmiko.py#L14-L21 | train | Execute show version command using Netmiko. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | examples/use_cases/case16_concurrency/processes_netmiko.py | main | def main():
"""
Use processes and Netmiko to connect to each of the devices. Execute
'show version' on each device. Record the amount of time required to do this.
"""
start_time = datetime.now()
procs = []
for a_device in devices:
my_proc = Process(target=show_version, args=(a_devic... | python | def main():
"""
Use processes and Netmiko to connect to each of the devices. Execute
'show version' on each device. Record the amount of time required to do this.
"""
start_time = datetime.now()
procs = []
for a_device in devices:
my_proc = Process(target=show_version, args=(a_devic... | [
"def",
"main",
"(",
")",
":",
"start_time",
"=",
"datetime",
".",
"now",
"(",
")",
"procs",
"=",
"[",
"]",
"for",
"a_device",
"in",
"devices",
":",
"my_proc",
"=",
"Process",
"(",
"target",
"=",
"show_version",
",",
"args",
"=",
"(",
"a_device",
",",... | Use processes and Netmiko to connect to each of the devices. Execute
'show version' on each device. Record the amount of time required to do this. | [
"Use",
"processes",
"and",
"Netmiko",
"to",
"connect",
"to",
"each",
"of",
"the",
"devices",
".",
"Execute",
"show",
"version",
"on",
"each",
"device",
".",
"Record",
"the",
"amount",
"of",
"time",
"required",
"to",
"do",
"this",
"."
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/examples/use_cases/case16_concurrency/processes_netmiko.py#L24-L41 | train | Execute show version on each of the devices. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/cisco/cisco_wlc_ssh.py | CiscoWlcSSH.special_login_handler | def special_login_handler(self, delay_factor=1):
"""WLC presents with the following on login (in certain OS versions)
login as: user
(Cisco Controller)
User: user
Password:****
"""
delay_factor = self.select_delay_factor(delay_factor)
i = 0
tim... | python | def special_login_handler(self, delay_factor=1):
"""WLC presents with the following on login (in certain OS versions)
login as: user
(Cisco Controller)
User: user
Password:****
"""
delay_factor = self.select_delay_factor(delay_factor)
i = 0
tim... | [
"def",
"special_login_handler",
"(",
"self",
",",
"delay_factor",
"=",
"1",
")",
":",
"delay_factor",
"=",
"self",
".",
"select_delay_factor",
"(",
"delay_factor",
")",
"i",
"=",
"0",
"time",
".",
"sleep",
"(",
"delay_factor",
"*",
"0.5",
")",
"output",
"=... | WLC presents with the following on login (in certain OS versions)
login as: user
(Cisco Controller)
User: user
Password:**** | [
"WLC",
"presents",
"with",
"the",
"following",
"on",
"login",
"(",
"in",
"certain",
"OS",
"versions",
")"
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/cisco/cisco_wlc_ssh.py#L15-L42 | train | This is a special login handler that handles the special login as command. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/cisco/cisco_wlc_ssh.py | CiscoWlcSSH.send_command_w_enter | def send_command_w_enter(self, *args, **kwargs):
"""
For 'show run-config' Cisco WLC adds a 'Press Enter to continue...' message
Even though pagination is disabled
show run-config also has excessive delays in the output which requires special
handling.
Arguments are the s... | python | def send_command_w_enter(self, *args, **kwargs):
"""
For 'show run-config' Cisco WLC adds a 'Press Enter to continue...' message
Even though pagination is disabled
show run-config also has excessive delays in the output which requires special
handling.
Arguments are the s... | [
"def",
"send_command_w_enter",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"len",
"(",
"args",
")",
">",
"1",
":",
"raise",
"ValueError",
"(",
"\"Must pass in delay_factor as keyword argument\"",
")",
"# If no delay_factor use 1 for def... | For 'show run-config' Cisco WLC adds a 'Press Enter to continue...' message
Even though pagination is disabled
show run-config also has excessive delays in the output which requires special
handling.
Arguments are the same as send_command_timing() method | [
"For",
"show",
"run",
"-",
"config",
"Cisco",
"WLC",
"adds",
"a",
"Press",
"Enter",
"to",
"continue",
"...",
"message",
"Even",
"though",
"pagination",
"is",
"disabled",
"show",
"run",
"-",
"config",
"also",
"has",
"excessive",
"delays",
"in",
"the",
"outp... | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/cisco/cisco_wlc_ssh.py#L44-L94 | train | Send a command to the Cisco WLC. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/cisco/cisco_wlc_ssh.py | CiscoWlcSSH.check_config_mode | def check_config_mode(self, check_string="config", pattern=""):
"""Checks if the device is in configuration mode or not."""
if not pattern:
pattern = re.escape(self.base_prompt)
return super(CiscoWlcSSH, self).check_config_mode(check_string, pattern) | python | def check_config_mode(self, check_string="config", pattern=""):
"""Checks if the device is in configuration mode or not."""
if not pattern:
pattern = re.escape(self.base_prompt)
return super(CiscoWlcSSH, self).check_config_mode(check_string, pattern) | [
"def",
"check_config_mode",
"(",
"self",
",",
"check_string",
"=",
"\"config\"",
",",
"pattern",
"=",
"\"\"",
")",
":",
"if",
"not",
"pattern",
":",
"pattern",
"=",
"re",
".",
"escape",
"(",
"self",
".",
"base_prompt",
")",
"return",
"super",
"(",
"Cisco... | Checks if the device is in configuration mode or not. | [
"Checks",
"if",
"the",
"device",
"is",
"in",
"configuration",
"mode",
"or",
"not",
"."
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/cisco/cisco_wlc_ssh.py#L118-L122 | train | Checks if the device is in configuration mode. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/cisco/cisco_wlc_ssh.py | CiscoWlcSSH.exit_config_mode | def exit_config_mode(self, exit_config="exit", pattern=""):
"""Exit config_mode."""
if not pattern:
pattern = re.escape(self.base_prompt)
return super(CiscoWlcSSH, self).exit_config_mode(exit_config, pattern) | python | def exit_config_mode(self, exit_config="exit", pattern=""):
"""Exit config_mode."""
if not pattern:
pattern = re.escape(self.base_prompt)
return super(CiscoWlcSSH, self).exit_config_mode(exit_config, pattern) | [
"def",
"exit_config_mode",
"(",
"self",
",",
"exit_config",
"=",
"\"exit\"",
",",
"pattern",
"=",
"\"\"",
")",
":",
"if",
"not",
"pattern",
":",
"pattern",
"=",
"re",
".",
"escape",
"(",
"self",
".",
"base_prompt",
")",
"return",
"super",
"(",
"CiscoWlcS... | Exit config_mode. | [
"Exit",
"config_mode",
"."
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/cisco/cisco_wlc_ssh.py#L130-L134 | train | Exit config mode. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/cisco/cisco_wlc_ssh.py | CiscoWlcSSH.save_config | def save_config(self, cmd="save config", confirm=True, confirm_response="y"):
"""Saves Config."""
self.enable()
if confirm:
output = self.send_command_timing(command_string=cmd)
if confirm_response:
output += self.send_command_timing(confirm_response)
... | python | def save_config(self, cmd="save config", confirm=True, confirm_response="y"):
"""Saves Config."""
self.enable()
if confirm:
output = self.send_command_timing(command_string=cmd)
if confirm_response:
output += self.send_command_timing(confirm_response)
... | [
"def",
"save_config",
"(",
"self",
",",
"cmd",
"=",
"\"save config\"",
",",
"confirm",
"=",
"True",
",",
"confirm_response",
"=",
"\"y\"",
")",
":",
"self",
".",
"enable",
"(",
")",
"if",
"confirm",
":",
"output",
"=",
"self",
".",
"send_command_timing",
... | Saves Config. | [
"Saves",
"Config",
"."
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/cisco/cisco_wlc_ssh.py#L176-L189 | train | Saves Config. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/_textfsm/_texttable.py | Row._BuildIndex | def _BuildIndex(self):
"""Recreate the key index."""
self._index = {}
for i, k in enumerate(self._keys):
self._index[k] = i | python | def _BuildIndex(self):
"""Recreate the key index."""
self._index = {}
for i, k in enumerate(self._keys):
self._index[k] = i | [
"def",
"_BuildIndex",
"(",
"self",
")",
":",
"self",
".",
"_index",
"=",
"{",
"}",
"for",
"i",
",",
"k",
"in",
"enumerate",
"(",
"self",
".",
"_keys",
")",
":",
"self",
".",
"_index",
"[",
"k",
"]",
"=",
"i"
] | Recreate the key index. | [
"Recreate",
"the",
"key",
"index",
"."
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/_textfsm/_texttable.py#L78-L82 | train | Recreate the key index. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/_textfsm/_texttable.py | Row.get | def get(self, column, default_value=None):
"""Get an item from the Row by column name.
Args:
column: Tuple of column names, or a (str) column name, or positional
column number, 0-indexed.
default_value: The value to use if the key is not found.
Returns:
A list or string with ... | python | def get(self, column, default_value=None):
"""Get an item from the Row by column name.
Args:
column: Tuple of column names, or a (str) column name, or positional
column number, 0-indexed.
default_value: The value to use if the key is not found.
Returns:
A list or string with ... | [
"def",
"get",
"(",
"self",
",",
"column",
",",
"default_value",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"column",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"ret",
"=",
"[",
"]",
"for",
"col",
"in",
"column",
":",
"ret",
".",
"append"... | Get an item from the Row by column name.
Args:
column: Tuple of column names, or a (str) column name, or positional
column number, 0-indexed.
default_value: The value to use if the key is not found.
Returns:
A list or string with column value(s) or default_value if not found. | [
"Get",
"an",
"item",
"from",
"the",
"Row",
"by",
"column",
"name",
"."
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/_textfsm/_texttable.py#L145-L169 | train | Get an item from the Row by column name. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/_textfsm/_texttable.py | Row.index | def index(self, column): # pylint: disable=C6409
"""Fetches the column number (0 indexed).
Args:
column: A string, column to fetch the index of.
Returns:
An int, the row index number.
Raises:
ValueError: The specified column was not found.
"""
for i, key in enumerat... | python | def index(self, column): # pylint: disable=C6409
"""Fetches the column number (0 indexed).
Args:
column: A string, column to fetch the index of.
Returns:
An int, the row index number.
Raises:
ValueError: The specified column was not found.
"""
for i, key in enumerat... | [
"def",
"index",
"(",
"self",
",",
"column",
")",
":",
"# pylint: disable=C6409",
"for",
"i",
",",
"key",
"in",
"enumerate",
"(",
"self",
".",
"_keys",
")",
":",
"if",
"key",
"==",
"column",
":",
"return",
"i",
"raise",
"ValueError",
"(",
"'Column \"%s\" ... | Fetches the column number (0 indexed).
Args:
column: A string, column to fetch the index of.
Returns:
An int, the row index number.
Raises:
ValueError: The specified column was not found. | [
"Fetches",
"the",
"column",
"number",
"(",
"0",
"indexed",
")",
"."
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/_textfsm/_texttable.py#L171-L186 | train | Fetches the column number 0 indexed. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/_textfsm/_texttable.py | Row._SetColour | def _SetColour(self, value_list):
"""Sets row's colour attributes to a list of values in terminal.SGR."""
if value_list is None:
self._color = None
return
colors = []
for color in value_list:
if color in terminal.SGR:
colors.append(colo... | python | def _SetColour(self, value_list):
"""Sets row's colour attributes to a list of values in terminal.SGR."""
if value_list is None:
self._color = None
return
colors = []
for color in value_list:
if color in terminal.SGR:
colors.append(colo... | [
"def",
"_SetColour",
"(",
"self",
",",
"value_list",
")",
":",
"if",
"value_list",
"is",
"None",
":",
"self",
".",
"_color",
"=",
"None",
"return",
"colors",
"=",
"[",
"]",
"for",
"color",
"in",
"value_list",
":",
"if",
"color",
"in",
"terminal",
".",
... | Sets row's colour attributes to a list of values in terminal.SGR. | [
"Sets",
"row",
"s",
"colour",
"attributes",
"to",
"a",
"list",
"of",
"values",
"in",
"terminal",
".",
"SGR",
"."
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/_textfsm/_texttable.py#L213-L228 | train | Sets the row s colour attributes to a list of values in terminal. SGR. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/_textfsm/_texttable.py | Row.Insert | def Insert(self, key, value, row_index):
"""Inserts new values at a specified offset.
Args:
key: string for header value.
value: string for a data value.
row_index: Offset into row for data.
Raises:
IndexError: If the offset is out of bands.
"""
if row_index < 0:
... | python | def Insert(self, key, value, row_index):
"""Inserts new values at a specified offset.
Args:
key: string for header value.
value: string for a data value.
row_index: Offset into row for data.
Raises:
IndexError: If the offset is out of bands.
"""
if row_index < 0:
... | [
"def",
"Insert",
"(",
"self",
",",
"key",
",",
"value",
",",
"row_index",
")",
":",
"if",
"row_index",
"<",
"0",
":",
"row_index",
"+=",
"len",
"(",
"self",
")",
"if",
"not",
"0",
"<=",
"row_index",
"<",
"len",
"(",
"self",
")",
":",
"raise",
"In... | Inserts new values at a specified offset.
Args:
key: string for header value.
value: string for a data value.
row_index: Offset into row for data.
Raises:
IndexError: If the offset is out of bands. | [
"Inserts",
"new",
"values",
"at",
"a",
"specified",
"offset",
"."
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/_textfsm/_texttable.py#L280-L305 | train | Inserts new values at a specified offset into the row. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/_textfsm/_texttable.py | TextTable.Map | def Map(self, function):
"""Applies the function to every row in the table.
Args:
function: A function applied to each row.
Returns:
A new TextTable()
Raises:
TableError: When transform is not invalid row entry. The transform
must be compatible with Append().
... | python | def Map(self, function):
"""Applies the function to every row in the table.
Args:
function: A function applied to each row.
Returns:
A new TextTable()
Raises:
TableError: When transform is not invalid row entry. The transform
must be compatible with Append().
... | [
"def",
"Map",
"(",
"self",
",",
"function",
")",
":",
"new_table",
"=",
"self",
".",
"__class__",
"(",
")",
"# pylint: disable=protected-access",
"new_table",
".",
"_table",
"=",
"[",
"self",
".",
"header",
"]",
"for",
"row",
"in",
"self",
":",
"filtered_r... | Applies the function to every row in the table.
Args:
function: A function applied to each row.
Returns:
A new TextTable()
Raises:
TableError: When transform is not invalid row entry. The transform
must be compatible with Append(). | [
"Applies",
"the",
"function",
"to",
"every",
"row",
"in",
"the",
"table",
"."
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/_textfsm/_texttable.py#L420-L440 | train | Applies the function to every row in the table. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/_textfsm/_texttable.py | TextTable.sort | def sort(self, cmp=None, key=None, reverse=False):
"""Sorts rows in the texttable.
Args:
cmp: func, non default sort algorithm to use.
key: func, applied to each element before sorting.
reverse: bool, reverse order of sort.
"""
def _DefaultKey(value):
"""Default k... | python | def sort(self, cmp=None, key=None, reverse=False):
"""Sorts rows in the texttable.
Args:
cmp: func, non default sort algorithm to use.
key: func, applied to each element before sorting.
reverse: bool, reverse order of sort.
"""
def _DefaultKey(value):
"""Default k... | [
"def",
"sort",
"(",
"self",
",",
"cmp",
"=",
"None",
",",
"key",
"=",
"None",
",",
"reverse",
"=",
"False",
")",
":",
"def",
"_DefaultKey",
"(",
"value",
")",
":",
"\"\"\"Default key func is to create a list of all fields.\"\"\"",
"result",
"=",
"[",
"]",
"f... | Sorts rows in the texttable.
Args:
cmp: func, non default sort algorithm to use.
key: func, applied to each element before sorting.
reverse: bool, reverse order of sort. | [
"Sorts",
"rows",
"in",
"the",
"texttable",
"."
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/_textfsm/_texttable.py#L444-L478 | train | Sorts the rows in the texttable. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/_textfsm/_texttable.py | TextTable.extend | def extend(self, table, keys=None):
"""Extends all rows in the texttable.
The rows are extended with the new columns from the table.
Args:
table: A texttable, the table to extend this table by.
keys: A set, the set of columns to use as the key. If None, the
row index is used.
... | python | def extend(self, table, keys=None):
"""Extends all rows in the texttable.
The rows are extended with the new columns from the table.
Args:
table: A texttable, the table to extend this table by.
keys: A set, the set of columns to use as the key. If None, the
row index is used.
... | [
"def",
"extend",
"(",
"self",
",",
"table",
",",
"keys",
"=",
"None",
")",
":",
"if",
"keys",
":",
"for",
"k",
"in",
"keys",
":",
"if",
"k",
"not",
"in",
"self",
".",
"_Header",
"(",
")",
":",
"raise",
"IndexError",
"(",
"\"Unknown key: '%s'\"",
",... | Extends all rows in the texttable.
The rows are extended with the new columns from the table.
Args:
table: A texttable, the table to extend this table by.
keys: A set, the set of columns to use as the key. If None, the
row index is used.
Raises:
IndexError: If key is not a valid... | [
"Extends",
"all",
"rows",
"in",
"the",
"texttable",
"."
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/_textfsm/_texttable.py#L482-L525 | train | Extends all rows in the texttable by the new columns from the table. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/_textfsm/_texttable.py | TextTable.Remove | def Remove(self, row):
"""Removes a row from the table.
Args:
row: int, the row number to delete. Must be >= 1, as the header
cannot be removed.
Raises:
TableError: Attempt to remove nonexistent or header row.
"""
if row == 0 or row > self.size:
raise TableE... | python | def Remove(self, row):
"""Removes a row from the table.
Args:
row: int, the row number to delete. Must be >= 1, as the header
cannot be removed.
Raises:
TableError: Attempt to remove nonexistent or header row.
"""
if row == 0 or row > self.size:
raise TableE... | [
"def",
"Remove",
"(",
"self",
",",
"row",
")",
":",
"if",
"row",
"==",
"0",
"or",
"row",
">",
"self",
".",
"size",
":",
"raise",
"TableError",
"(",
"\"Attempt to remove header row\"",
")",
"new_table",
"=",
"[",
"]",
"# pylint: disable=E1103",
"for",
"t_ro... | Removes a row from the table.
Args:
row: int, the row number to delete. Must be >= 1, as the header
cannot be removed.
Raises:
TableError: Attempt to remove nonexistent or header row. | [
"Removes",
"a",
"row",
"from",
"the",
"table",
"."
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/_textfsm/_texttable.py#L528-L547 | train | Removes a row from the table. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/_textfsm/_texttable.py | TextTable._GetRow | def _GetRow(self, columns=None):
"""Returns the current row as a tuple."""
row = self._table[self._row_index]
if columns:
result = []
for col in columns:
if col not in self.header:
raise TableError("Column header %s not known in table.... | python | def _GetRow(self, columns=None):
"""Returns the current row as a tuple."""
row = self._table[self._row_index]
if columns:
result = []
for col in columns:
if col not in self.header:
raise TableError("Column header %s not known in table.... | [
"def",
"_GetRow",
"(",
"self",
",",
"columns",
"=",
"None",
")",
":",
"row",
"=",
"self",
".",
"_table",
"[",
"self",
".",
"_row_index",
"]",
"if",
"columns",
":",
"result",
"=",
"[",
"]",
"for",
"col",
"in",
"columns",
":",
"if",
"col",
"not",
"... | Returns the current row as a tuple. | [
"Returns",
"the",
"current",
"row",
"as",
"a",
"tuple",
"."
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/_textfsm/_texttable.py#L553-L564 | train | Returns the current row as a tuple. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/_textfsm/_texttable.py | TextTable._SetRow | def _SetRow(self, new_values, row=0):
"""Sets the current row to new list.
Args:
new_values: List|dict of new values to insert into row.
row: int, Row to insert values into.
Raises:
TableError: If number of new values is not equal to row size.
"""
if not row:
... | python | def _SetRow(self, new_values, row=0):
"""Sets the current row to new list.
Args:
new_values: List|dict of new values to insert into row.
row: int, Row to insert values into.
Raises:
TableError: If number of new values is not equal to row size.
"""
if not row:
... | [
"def",
"_SetRow",
"(",
"self",
",",
"new_values",
",",
"row",
"=",
"0",
")",
":",
"if",
"not",
"row",
":",
"row",
"=",
"self",
".",
"_row_index",
"if",
"row",
">",
"self",
".",
"size",
":",
"raise",
"TableError",
"(",
"\"Entry %s beyond table size %s.\""... | Sets the current row to new list.
Args:
new_values: List|dict of new values to insert into row.
row: int, Row to insert values into.
Raises:
TableError: If number of new values is not equal to row size. | [
"Sets",
"the",
"current",
"row",
"to",
"new",
"list",
"."
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/_textfsm/_texttable.py#L566-L583 | train | Sets the current row to new list. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/_textfsm/_texttable.py | TextTable._SetHeader | def _SetHeader(self, new_values):
"""Sets header of table to the given tuple.
Args:
new_values: Tuple of new header values.
"""
row = self.row_class()
row.row = 0
for v in new_values:
row[v] = v
self._table[0] = row | python | def _SetHeader(self, new_values):
"""Sets header of table to the given tuple.
Args:
new_values: Tuple of new header values.
"""
row = self.row_class()
row.row = 0
for v in new_values:
row[v] = v
self._table[0] = row | [
"def",
"_SetHeader",
"(",
"self",
",",
"new_values",
")",
":",
"row",
"=",
"self",
".",
"row_class",
"(",
")",
"row",
".",
"row",
"=",
"0",
"for",
"v",
"in",
"new_values",
":",
"row",
"[",
"v",
"]",
"=",
"v",
"self",
".",
"_table",
"[",
"0",
"]... | Sets header of table to the given tuple.
Args:
new_values: Tuple of new header values. | [
"Sets",
"header",
"of",
"table",
"to",
"the",
"given",
"tuple",
"."
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/_textfsm/_texttable.py#L585-L595 | train | Sets the header of the table to the given tuple. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/_textfsm/_texttable.py | TextTable._SmallestColSize | def _SmallestColSize(self, text):
"""Finds the largest indivisible word of a string.
...and thus the smallest possible column width that can contain that
word unsplit over rows.
Args:
text: A string of text potentially consisting of words.
Returns:
Integer size of the largest sing... | python | def _SmallestColSize(self, text):
"""Finds the largest indivisible word of a string.
...and thus the smallest possible column width that can contain that
word unsplit over rows.
Args:
text: A string of text potentially consisting of words.
Returns:
Integer size of the largest sing... | [
"def",
"_SmallestColSize",
"(",
"self",
",",
"text",
")",
":",
"if",
"not",
"text",
":",
"return",
"0",
"stripped",
"=",
"terminal",
".",
"StripAnsiText",
"(",
"text",
")",
"return",
"max",
"(",
"len",
"(",
"word",
")",
"for",
"word",
"in",
"stripped",... | Finds the largest indivisible word of a string.
...and thus the smallest possible column width that can contain that
word unsplit over rows.
Args:
text: A string of text potentially consisting of words.
Returns:
Integer size of the largest single word in the text. | [
"Finds",
"the",
"largest",
"indivisible",
"word",
"of",
"a",
"string",
"."
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/_textfsm/_texttable.py#L637-L652 | train | Finds the largest indivisible word of a string and thus the smallest possible column width that can contain that single word. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/_textfsm/_texttable.py | TextTable.RowWith | def RowWith(self, column, value):
"""Retrieves the first non header row with the column of the given value.
Args:
column: str, the name of the column to check.
value: str, The value of the column to check.
Returns:
A Row() of the first row found, None otherwise.
Raises:
In... | python | def RowWith(self, column, value):
"""Retrieves the first non header row with the column of the given value.
Args:
column: str, the name of the column to check.
value: str, The value of the column to check.
Returns:
A Row() of the first row found, None otherwise.
Raises:
In... | [
"def",
"RowWith",
"(",
"self",
",",
"column",
",",
"value",
")",
":",
"for",
"row",
"in",
"self",
".",
"_table",
"[",
"1",
":",
"]",
":",
"if",
"row",
"[",
"column",
"]",
"==",
"value",
":",
"return",
"row",
"return",
"None"
] | Retrieves the first non header row with the column of the given value.
Args:
column: str, the name of the column to check.
value: str, The value of the column to check.
Returns:
A Row() of the first row found, None otherwise.
Raises:
IndexError: The specified column does not exist... | [
"Retrieves",
"the",
"first",
"non",
"header",
"row",
"with",
"the",
"column",
"of",
"the",
"given",
"value",
"."
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/_textfsm/_texttable.py#L965-L981 | train | Retrieves the first non header row with the given column of the given value. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/_textfsm/_texttable.py | TextTable.AddColumn | def AddColumn(self, column, default="", col_index=-1):
"""Appends a new column to the table.
Args:
column: A string, name of the column to add.
default: Default value for entries. Defaults to ''.
col_index: Integer index for where to insert new column.
Raises:
TableError: Colum... | python | def AddColumn(self, column, default="", col_index=-1):
"""Appends a new column to the table.
Args:
column: A string, name of the column to add.
default: Default value for entries. Defaults to ''.
col_index: Integer index for where to insert new column.
Raises:
TableError: Colum... | [
"def",
"AddColumn",
"(",
"self",
",",
"column",
",",
"default",
"=",
"\"\"",
",",
"col_index",
"=",
"-",
"1",
")",
":",
"if",
"column",
"in",
"self",
".",
"table",
":",
"raise",
"TableError",
"(",
"\"Column %r already in table.\"",
"%",
"column",
")",
"i... | Appends a new column to the table.
Args:
column: A string, name of the column to add.
default: Default value for entries. Defaults to ''.
col_index: Integer index for where to insert new column.
Raises:
TableError: Column name already exists. | [
"Appends",
"a",
"new",
"column",
"to",
"the",
"table",
"."
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/_textfsm/_texttable.py#L983-L1004 | train | Appends a new column to the table. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/_textfsm/_texttable.py | TextTable.Append | def Append(self, new_values):
"""Adds a new row (list) to the table.
Args:
new_values: Tuple, dict, or Row() of new values to append as a row.
Raises:
TableError: Supplied tuple not equal to table width.
"""
newrow = self.NewRow()
newrow.values = new_values
self... | python | def Append(self, new_values):
"""Adds a new row (list) to the table.
Args:
new_values: Tuple, dict, or Row() of new values to append as a row.
Raises:
TableError: Supplied tuple not equal to table width.
"""
newrow = self.NewRow()
newrow.values = new_values
self... | [
"def",
"Append",
"(",
"self",
",",
"new_values",
")",
":",
"newrow",
"=",
"self",
".",
"NewRow",
"(",
")",
"newrow",
".",
"values",
"=",
"new_values",
"self",
".",
"_table",
".",
"append",
"(",
"newrow",
")"
] | Adds a new row (list) to the table.
Args:
new_values: Tuple, dict, or Row() of new values to append as a row.
Raises:
TableError: Supplied tuple not equal to table width. | [
"Adds",
"a",
"new",
"row",
"(",
"list",
")",
"to",
"the",
"table",
"."
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/_textfsm/_texttable.py#L1006-L1017 | train | Adds a new row to the table. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/_textfsm/_texttable.py | TextTable.NewRow | def NewRow(self, value=""):
"""Fetches a new, empty row, with headers populated.
Args:
value: Initial value to set each row entry to.
Returns:
A Row() object.
"""
newrow = self.row_class()
newrow.row = self.size + 1
newrow.table = self
headers = self._He... | python | def NewRow(self, value=""):
"""Fetches a new, empty row, with headers populated.
Args:
value: Initial value to set each row entry to.
Returns:
A Row() object.
"""
newrow = self.row_class()
newrow.row = self.size + 1
newrow.table = self
headers = self._He... | [
"def",
"NewRow",
"(",
"self",
",",
"value",
"=",
"\"\"",
")",
":",
"newrow",
"=",
"self",
".",
"row_class",
"(",
")",
"newrow",
".",
"row",
"=",
"self",
".",
"size",
"+",
"1",
"newrow",
".",
"table",
"=",
"self",
"headers",
"=",
"self",
".",
"_He... | Fetches a new, empty row, with headers populated.
Args:
value: Initial value to set each row entry to.
Returns:
A Row() object. | [
"Fetches",
"a",
"new",
"empty",
"row",
"with",
"headers",
"populated",
"."
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/_textfsm/_texttable.py#L1019-L1034 | train | Fetches a new empty row with headers populated. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/_textfsm/_texttable.py | TextTable.CsvToTable | def CsvToTable(self, buf, header=True, separator=","):
"""Parses buffer into tabular format.
Strips off comments (preceded by '#').
Optionally parses and indexes by first line (header).
Args:
buf: String file buffer containing CSV data.
header: Is the first line of buffer a header.
... | python | def CsvToTable(self, buf, header=True, separator=","):
"""Parses buffer into tabular format.
Strips off comments (preceded by '#').
Optionally parses and indexes by first line (header).
Args:
buf: String file buffer containing CSV data.
header: Is the first line of buffer a header.
... | [
"def",
"CsvToTable",
"(",
"self",
",",
"buf",
",",
"header",
"=",
"True",
",",
"separator",
"=",
"\",\"",
")",
":",
"self",
".",
"Reset",
"(",
")",
"header_row",
"=",
"self",
".",
"row_class",
"(",
")",
"if",
"header",
":",
"line",
"=",
"buf",
".",... | Parses buffer into tabular format.
Strips off comments (preceded by '#').
Optionally parses and indexes by first line (header).
Args:
buf: String file buffer containing CSV data.
header: Is the first line of buffer a header.
separator: String that CSV is separated by.
Returns:
... | [
"Parses",
"buffer",
"into",
"tabular",
"format",
"."
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/_textfsm/_texttable.py#L1036-L1103 | train | Parses a CSV file into a table. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/extreme/extreme_vsp_ssh.py | ExtremeVspSSH.save_config | def save_config(self, cmd="save config", confirm=False, confirm_response=""):
"""Save Config"""
return super(ExtremeVspSSH, self).save_config(
cmd=cmd, confirm=confirm, confirm_response=confirm_response
) | python | def save_config(self, cmd="save config", confirm=False, confirm_response=""):
"""Save Config"""
return super(ExtremeVspSSH, self).save_config(
cmd=cmd, confirm=confirm, confirm_response=confirm_response
) | [
"def",
"save_config",
"(",
"self",
",",
"cmd",
"=",
"\"save config\"",
",",
"confirm",
"=",
"False",
",",
"confirm_response",
"=",
"\"\"",
")",
":",
"return",
"super",
"(",
"ExtremeVspSSH",
",",
"self",
")",
".",
"save_config",
"(",
"cmd",
"=",
"cmd",
",... | Save Config | [
"Save",
"Config"
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/extreme/extreme_vsp_ssh.py#L20-L24 | train | Save config of the current user. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/pluribus/pluribus_ssh.py | PluribusSSH.disable_paging | def disable_paging(self, command="pager off", delay_factor=1):
"""Make sure paging is disabled."""
return super(PluribusSSH, self).disable_paging(
command=command, delay_factor=delay_factor
) | python | def disable_paging(self, command="pager off", delay_factor=1):
"""Make sure paging is disabled."""
return super(PluribusSSH, self).disable_paging(
command=command, delay_factor=delay_factor
) | [
"def",
"disable_paging",
"(",
"self",
",",
"command",
"=",
"\"pager off\"",
",",
"delay_factor",
"=",
"1",
")",
":",
"return",
"super",
"(",
"PluribusSSH",
",",
"self",
")",
".",
"disable_paging",
"(",
"command",
"=",
"command",
",",
"delay_factor",
"=",
"... | Make sure paging is disabled. | [
"Make",
"sure",
"paging",
"is",
"disabled",
"."
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/pluribus/pluribus_ssh.py#L13-L17 | train | Make sure paging is disabled. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/utilities.py | load_yaml_file | def load_yaml_file(yaml_file):
"""Read YAML file."""
try:
import yaml
except ImportError:
sys.exit("Unable to import yaml module.")
try:
with io.open(yaml_file, "rt", encoding="utf-8") as fname:
return yaml.safe_load(fname)
except IOError:
sys.exit("Unable... | python | def load_yaml_file(yaml_file):
"""Read YAML file."""
try:
import yaml
except ImportError:
sys.exit("Unable to import yaml module.")
try:
with io.open(yaml_file, "rt", encoding="utf-8") as fname:
return yaml.safe_load(fname)
except IOError:
sys.exit("Unable... | [
"def",
"load_yaml_file",
"(",
"yaml_file",
")",
":",
"try",
":",
"import",
"yaml",
"except",
"ImportError",
":",
"sys",
".",
"exit",
"(",
"\"Unable to import yaml module.\"",
")",
"try",
":",
"with",
"io",
".",
"open",
"(",
"yaml_file",
",",
"\"rt\"",
",",
... | Read YAML file. | [
"Read",
"YAML",
"file",
"."
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/utilities.py#L55-L65 | train | Read YAML file. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/utilities.py | find_cfg_file | def find_cfg_file(file_name=None):
"""Look for .netmiko.yml in current dir, then ~/.netmiko.yml."""
base_file = ".netmiko.yml"
check_files = [base_file, os.path.expanduser("~") + "/" + base_file]
if file_name:
check_files.insert(0, file_name)
for test_file in check_files:
if os.path.... | python | def find_cfg_file(file_name=None):
"""Look for .netmiko.yml in current dir, then ~/.netmiko.yml."""
base_file = ".netmiko.yml"
check_files = [base_file, os.path.expanduser("~") + "/" + base_file]
if file_name:
check_files.insert(0, file_name)
for test_file in check_files:
if os.path.... | [
"def",
"find_cfg_file",
"(",
"file_name",
"=",
"None",
")",
":",
"base_file",
"=",
"\".netmiko.yml\"",
"check_files",
"=",
"[",
"base_file",
",",
"os",
".",
"path",
".",
"expanduser",
"(",
"\"~\"",
")",
"+",
"\"/\"",
"+",
"base_file",
"]",
"if",
"file_name... | Look for .netmiko.yml in current dir, then ~/.netmiko.yml. | [
"Look",
"for",
".",
"netmiko",
".",
"yml",
"in",
"current",
"dir",
"then",
"~",
"/",
".",
"netmiko",
".",
"yml",
"."
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/utilities.py#L74-L83 | train | Look for. netmiko. yml in current dir then ~. netmiko. yml. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/utilities.py | display_inventory | def display_inventory(my_devices):
"""Print out inventory devices and groups."""
inventory_groups = ["all"]
inventory_devices = []
for k, v in my_devices.items():
if isinstance(v, list):
inventory_groups.append(k)
elif isinstance(v, dict):
inventory_devices.append... | python | def display_inventory(my_devices):
"""Print out inventory devices and groups."""
inventory_groups = ["all"]
inventory_devices = []
for k, v in my_devices.items():
if isinstance(v, list):
inventory_groups.append(k)
elif isinstance(v, dict):
inventory_devices.append... | [
"def",
"display_inventory",
"(",
"my_devices",
")",
":",
"inventory_groups",
"=",
"[",
"\"all\"",
"]",
"inventory_devices",
"=",
"[",
"]",
"for",
"k",
",",
"v",
"in",
"my_devices",
".",
"items",
"(",
")",
":",
"if",
"isinstance",
"(",
"v",
",",
"list",
... | Print out inventory devices and groups. | [
"Print",
"out",
"inventory",
"devices",
"and",
"groups",
"."
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/utilities.py#L86-L107 | train | Print out inventory devices and groups. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/utilities.py | obtain_all_devices | def obtain_all_devices(my_devices):
"""Dynamically create 'all' group."""
new_devices = {}
for device_name, device_or_group in my_devices.items():
# Skip any groups
if not isinstance(device_or_group, list):
new_devices[device_name] = device_or_group
return new_devices | python | def obtain_all_devices(my_devices):
"""Dynamically create 'all' group."""
new_devices = {}
for device_name, device_or_group in my_devices.items():
# Skip any groups
if not isinstance(device_or_group, list):
new_devices[device_name] = device_or_group
return new_devices | [
"def",
"obtain_all_devices",
"(",
"my_devices",
")",
":",
"new_devices",
"=",
"{",
"}",
"for",
"device_name",
",",
"device_or_group",
"in",
"my_devices",
".",
"items",
"(",
")",
":",
"# Skip any groups",
"if",
"not",
"isinstance",
"(",
"device_or_group",
",",
... | Dynamically create 'all' group. | [
"Dynamically",
"create",
"all",
"group",
"."
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/utilities.py#L110-L117 | train | Dynamically create all group. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/utilities.py | ensure_dir_exists | def ensure_dir_exists(verify_dir):
"""Ensure directory exists. Create if necessary."""
if not os.path.exists(verify_dir):
# Doesn't exist create dir
os.makedirs(verify_dir)
else:
# Exists
if not os.path.isdir(verify_dir):
# Not a dir, raise an exception
... | python | def ensure_dir_exists(verify_dir):
"""Ensure directory exists. Create if necessary."""
if not os.path.exists(verify_dir):
# Doesn't exist create dir
os.makedirs(verify_dir)
else:
# Exists
if not os.path.isdir(verify_dir):
# Not a dir, raise an exception
... | [
"def",
"ensure_dir_exists",
"(",
"verify_dir",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"verify_dir",
")",
":",
"# Doesn't exist create dir",
"os",
".",
"makedirs",
"(",
"verify_dir",
")",
"else",
":",
"# Exists",
"if",
"not",
"os",
".... | Ensure directory exists. Create if necessary. | [
"Ensure",
"directory",
"exists",
".",
"Create",
"if",
"necessary",
"."
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/utilities.py#L133-L142 | train | Ensure directory exists. Create if necessary. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/utilities.py | find_netmiko_dir | def find_netmiko_dir():
"""Check environment first, then default dir"""
try:
netmiko_base_dir = os.environ["NETMIKO_DIR"]
except KeyError:
netmiko_base_dir = NETMIKO_BASE_DIR
netmiko_base_dir = os.path.expanduser(netmiko_base_dir)
if netmiko_base_dir == "/":
raise ValueError(... | python | def find_netmiko_dir():
"""Check environment first, then default dir"""
try:
netmiko_base_dir = os.environ["NETMIKO_DIR"]
except KeyError:
netmiko_base_dir = NETMIKO_BASE_DIR
netmiko_base_dir = os.path.expanduser(netmiko_base_dir)
if netmiko_base_dir == "/":
raise ValueError(... | [
"def",
"find_netmiko_dir",
"(",
")",
":",
"try",
":",
"netmiko_base_dir",
"=",
"os",
".",
"environ",
"[",
"\"NETMIKO_DIR\"",
"]",
"except",
"KeyError",
":",
"netmiko_base_dir",
"=",
"NETMIKO_BASE_DIR",
"netmiko_base_dir",
"=",
"os",
".",
"path",
".",
"expanduser... | Check environment first, then default dir | [
"Check",
"environment",
"first",
"then",
"default",
"dir"
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/utilities.py#L145-L155 | train | Find the netmiko dir and full dir | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/utilities.py | write_bytes | def write_bytes(out_data, encoding="ascii"):
"""Write Python2 and Python3 compatible byte stream."""
if sys.version_info[0] >= 3:
if isinstance(out_data, type("")):
if encoding == "utf-8":
return out_data.encode("utf-8")
else:
return out_data.encod... | python | def write_bytes(out_data, encoding="ascii"):
"""Write Python2 and Python3 compatible byte stream."""
if sys.version_info[0] >= 3:
if isinstance(out_data, type("")):
if encoding == "utf-8":
return out_data.encode("utf-8")
else:
return out_data.encod... | [
"def",
"write_bytes",
"(",
"out_data",
",",
"encoding",
"=",
"\"ascii\"",
")",
":",
"if",
"sys",
".",
"version_info",
"[",
"0",
"]",
">=",
"3",
":",
"if",
"isinstance",
"(",
"out_data",
",",
"type",
"(",
"\"\"",
")",
")",
":",
"if",
"encoding",
"==",... | Write Python2 and Python3 compatible byte stream. | [
"Write",
"Python2",
"and",
"Python3",
"compatible",
"byte",
"stream",
"."
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/utilities.py#L158-L179 | train | Write Python2 and Python3 compatible byte stream. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/utilities.py | check_serial_port | def check_serial_port(name):
"""returns valid COM Port."""
try:
cdc = next(serial.tools.list_ports.grep(name))
return cdc[0]
except StopIteration:
msg = "device {} not found. ".format(name)
msg += "available devices are: "
ports = list(serial.tools.list_ports.comports... | python | def check_serial_port(name):
"""returns valid COM Port."""
try:
cdc = next(serial.tools.list_ports.grep(name))
return cdc[0]
except StopIteration:
msg = "device {} not found. ".format(name)
msg += "available devices are: "
ports = list(serial.tools.list_ports.comports... | [
"def",
"check_serial_port",
"(",
"name",
")",
":",
"try",
":",
"cdc",
"=",
"next",
"(",
"serial",
".",
"tools",
".",
"list_ports",
".",
"grep",
"(",
"name",
")",
")",
"return",
"cdc",
"[",
"0",
"]",
"except",
"StopIteration",
":",
"msg",
"=",
"\"devi... | returns valid COM Port. | [
"returns",
"valid",
"COM",
"Port",
"."
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/utilities.py#L182-L193 | train | returns valid COM Port. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/utilities.py | get_template_dir | def get_template_dir():
"""Find and return the ntc-templates/templates dir."""
try:
template_dir = os.path.expanduser(os.environ["NET_TEXTFSM"])
index = os.path.join(template_dir, "index")
if not os.path.isfile(index):
# Assume only base ./ntc-templates specified
... | python | def get_template_dir():
"""Find and return the ntc-templates/templates dir."""
try:
template_dir = os.path.expanduser(os.environ["NET_TEXTFSM"])
index = os.path.join(template_dir, "index")
if not os.path.isfile(index):
# Assume only base ./ntc-templates specified
... | [
"def",
"get_template_dir",
"(",
")",
":",
"try",
":",
"template_dir",
"=",
"os",
".",
"path",
".",
"expanduser",
"(",
"os",
".",
"environ",
"[",
"\"NET_TEXTFSM\"",
"]",
")",
"index",
"=",
"os",
".",
"path",
".",
"join",
"(",
"template_dir",
",",
"\"ind... | Find and return the ntc-templates/templates dir. | [
"Find",
"and",
"return",
"the",
"ntc",
"-",
"templates",
"/",
"templates",
"dir",
"."
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/utilities.py#L196-L216 | train | Find and return the ntc - templates dir. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/utilities.py | clitable_to_dict | def clitable_to_dict(cli_table):
"""Converts TextFSM cli_table object to list of dictionaries."""
objs = []
for row in cli_table:
temp_dict = {}
for index, element in enumerate(row):
temp_dict[cli_table.header[index].lower()] = element
objs.append(temp_dict)
return ob... | python | def clitable_to_dict(cli_table):
"""Converts TextFSM cli_table object to list of dictionaries."""
objs = []
for row in cli_table:
temp_dict = {}
for index, element in enumerate(row):
temp_dict[cli_table.header[index].lower()] = element
objs.append(temp_dict)
return ob... | [
"def",
"clitable_to_dict",
"(",
"cli_table",
")",
":",
"objs",
"=",
"[",
"]",
"for",
"row",
"in",
"cli_table",
":",
"temp_dict",
"=",
"{",
"}",
"for",
"index",
",",
"element",
"in",
"enumerate",
"(",
"row",
")",
":",
"temp_dict",
"[",
"cli_table",
".",... | Converts TextFSM cli_table object to list of dictionaries. | [
"Converts",
"TextFSM",
"cli_table",
"object",
"to",
"list",
"of",
"dictionaries",
"."
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/utilities.py#L219-L227 | train | Converts TextFSM cli_table object to list of dictionaries. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/utilities.py | get_structured_data | def get_structured_data(raw_output, platform, command):
"""Convert raw CLI output to structured data using TextFSM template."""
template_dir = get_template_dir()
index_file = os.path.join(template_dir, "index")
textfsm_obj = clitable.CliTable(index_file, template_dir)
attrs = {"Command": command, "P... | python | def get_structured_data(raw_output, platform, command):
"""Convert raw CLI output to structured data using TextFSM template."""
template_dir = get_template_dir()
index_file = os.path.join(template_dir, "index")
textfsm_obj = clitable.CliTable(index_file, template_dir)
attrs = {"Command": command, "P... | [
"def",
"get_structured_data",
"(",
"raw_output",
",",
"platform",
",",
"command",
")",
":",
"template_dir",
"=",
"get_template_dir",
"(",
")",
"index_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"template_dir",
",",
"\"index\"",
")",
"textfsm_obj",
"=",
... | Convert raw CLI output to structured data using TextFSM template. | [
"Convert",
"raw",
"CLI",
"output",
"to",
"structured",
"data",
"using",
"TextFSM",
"template",
"."
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/utilities.py#L230-L243 | train | Convert raw CLI output to structured data using TextFSM template. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
ktbyers/netmiko | netmiko/extreme/extreme_netiron.py | ExtremeNetironBase.save_config | def save_config(self, cmd="write memory", confirm=False, confirm_response=""):
"""Save Config"""
return super(ExtremeNetironBase, self).save_config(
cmd=cmd, confirm=confirm, confirm_response=confirm_response
) | python | def save_config(self, cmd="write memory", confirm=False, confirm_response=""):
"""Save Config"""
return super(ExtremeNetironBase, self).save_config(
cmd=cmd, confirm=confirm, confirm_response=confirm_response
) | [
"def",
"save_config",
"(",
"self",
",",
"cmd",
"=",
"\"write memory\"",
",",
"confirm",
"=",
"False",
",",
"confirm_response",
"=",
"\"\"",
")",
":",
"return",
"super",
"(",
"ExtremeNetironBase",
",",
"self",
")",
".",
"save_config",
"(",
"cmd",
"=",
"cmd"... | Save Config | [
"Save",
"Config"
] | 54e6116c0b4664de2123081937e0a9a27bdfdfea | https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/extreme/extreme_netiron.py#L6-L10 | train | Save config from a nexus object. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
cloudtools/troposphere | examples/ElastiCacheRedis.py | main | def main():
"""
Create a ElastiCache Redis Node and EC2 Instance
"""
template = Template()
# Description
template.add_description(
'AWS CloudFormation Sample Template ElastiCache_Redis:'
'Sample template showing how to create an Amazon'
'ElastiCache Redis Cluster. **WAR... | python | def main():
"""
Create a ElastiCache Redis Node and EC2 Instance
"""
template = Template()
# Description
template.add_description(
'AWS CloudFormation Sample Template ElastiCache_Redis:'
'Sample template showing how to create an Amazon'
'ElastiCache Redis Cluster. **WAR... | [
"def",
"main",
"(",
")",
":",
"template",
"=",
"Template",
"(",
")",
"# Description",
"template",
".",
"add_description",
"(",
"'AWS CloudFormation Sample Template ElastiCache_Redis:'",
"'Sample template showing how to create an Amazon'",
"'ElastiCache Redis Cluster. **WARNING** Th... | Create a ElastiCache Redis Node and EC2 Instance | [
"Create",
"a",
"ElastiCache",
"Redis",
"Node",
"and",
"EC2",
"Instance"
] | f7ea5591a7c287a843adc9c184d2f56064cfc632 | https://github.com/cloudtools/troposphere/blob/f7ea5591a7c287a843adc9c184d2f56064cfc632/examples/ElastiCacheRedis.py#L36-L523 | train | This function is used to create an Amazon ElastiCache Redis Node and EC2 Instance and an Amazon ElastiCache Cluster. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
cloudtools/troposphere | troposphere/rds.py | validate_iops | def validate_iops(iops):
"""DBInstance Iops validation rules."""
iops = integer(iops)
if int(iops) == 0:
return iops
if int(iops) < 1000:
raise ValueError("DBInstance Iops, if set, must be greater than 1000.")
return iops | python | def validate_iops(iops):
"""DBInstance Iops validation rules."""
iops = integer(iops)
if int(iops) == 0:
return iops
if int(iops) < 1000:
raise ValueError("DBInstance Iops, if set, must be greater than 1000.")
return iops | [
"def",
"validate_iops",
"(",
"iops",
")",
":",
"iops",
"=",
"integer",
"(",
"iops",
")",
"if",
"int",
"(",
"iops",
")",
"==",
"0",
":",
"return",
"iops",
"if",
"int",
"(",
"iops",
")",
"<",
"1000",
":",
"raise",
"ValueError",
"(",
"\"DBInstance Iops,... | DBInstance Iops validation rules. | [
"DBInstance",
"Iops",
"validation",
"rules",
"."
] | f7ea5591a7c287a843adc9c184d2f56064cfc632 | https://github.com/cloudtools/troposphere/blob/f7ea5591a7c287a843adc9c184d2f56064cfc632/troposphere/rds.py#L26-L34 | train | DBInstance Iops validation rules. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
cloudtools/troposphere | troposphere/rds.py | validate_backup_window | def validate_backup_window(window):
"""Validate PreferredBackupWindow for DBInstance"""
hour = r'[01]?[0-9]|2[0-3]'
minute = r'[0-5][0-9]'
r = ("(?P<start_hour>%s):(?P<start_minute>%s)-"
"(?P<end_hour>%s):(?P<end_minute>%s)") % (hour, minute, hour, minute)
range_regex = re.compile(r)
m... | python | def validate_backup_window(window):
"""Validate PreferredBackupWindow for DBInstance"""
hour = r'[01]?[0-9]|2[0-3]'
minute = r'[0-5][0-9]'
r = ("(?P<start_hour>%s):(?P<start_minute>%s)-"
"(?P<end_hour>%s):(?P<end_minute>%s)") % (hour, minute, hour, minute)
range_regex = re.compile(r)
m... | [
"def",
"validate_backup_window",
"(",
"window",
")",
":",
"hour",
"=",
"r'[01]?[0-9]|2[0-3]'",
"minute",
"=",
"r'[0-5][0-9]'",
"r",
"=",
"(",
"\"(?P<start_hour>%s):(?P<start_minute>%s)-\"",
"\"(?P<end_hour>%s):(?P<end_minute>%s)\"",
")",
"%",
"(",
"hour",
",",
"minute",
... | Validate PreferredBackupWindow for DBInstance | [
"Validate",
"PreferredBackupWindow",
"for",
"DBInstance"
] | f7ea5591a7c287a843adc9c184d2f56064cfc632 | https://github.com/cloudtools/troposphere/blob/f7ea5591a7c287a843adc9c184d2f56064cfc632/troposphere/rds.py#L73-L90 | train | Validate PreferredBackupWindow for DBInstance | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
cloudtools/troposphere | troposphere/rds.py | validate_maintenance_window | def validate_maintenance_window(window):
"""Validate PreferredMaintenanceWindow for DBInstance"""
days = ("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun")
day_re = r'[A-Z]{1}[a-z]{2}'
hour = r'[01]?[0-9]|2[0-3]'
minute = r'[0-5][0-9]'
r = ("(?P<start_day>%s):(?P<start_hour>%s):(?P<start_minute>... | python | def validate_maintenance_window(window):
"""Validate PreferredMaintenanceWindow for DBInstance"""
days = ("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun")
day_re = r'[A-Z]{1}[a-z]{2}'
hour = r'[01]?[0-9]|2[0-3]'
minute = r'[0-5][0-9]'
r = ("(?P<start_day>%s):(?P<start_hour>%s):(?P<start_minute>... | [
"def",
"validate_maintenance_window",
"(",
"window",
")",
":",
"days",
"=",
"(",
"\"Mon\"",
",",
"\"Tue\"",
",",
"\"Wed\"",
",",
"\"Thu\"",
",",
"\"Fri\"",
",",
"\"Sat\"",
",",
"\"Sun\"",
")",
"day_re",
"=",
"r'[A-Z]{1}[a-z]{2}'",
"hour",
"=",
"r'[01]?[0-9]|2[... | Validate PreferredMaintenanceWindow for DBInstance | [
"Validate",
"PreferredMaintenanceWindow",
"for",
"DBInstance"
] | f7ea5591a7c287a843adc9c184d2f56064cfc632 | https://github.com/cloudtools/troposphere/blob/f7ea5591a7c287a843adc9c184d2f56064cfc632/troposphere/rds.py#L93-L122 | train | Validate PreferredMaintenanceWindow for DBInstance | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
cloudtools/troposphere | troposphere/rds.py | validate_capacity | def validate_capacity(capacity):
"""Validate ScalingConfiguration capacity for serverless DBCluster"""
if capacity not in VALID_SCALING_CONFIGURATION_CAPACITIES:
raise ValueError(
"ScalingConfiguration capacity must be one of: {}".format(
", ".join(map(
s... | python | def validate_capacity(capacity):
"""Validate ScalingConfiguration capacity for serverless DBCluster"""
if capacity not in VALID_SCALING_CONFIGURATION_CAPACITIES:
raise ValueError(
"ScalingConfiguration capacity must be one of: {}".format(
", ".join(map(
s... | [
"def",
"validate_capacity",
"(",
"capacity",
")",
":",
"if",
"capacity",
"not",
"in",
"VALID_SCALING_CONFIGURATION_CAPACITIES",
":",
"raise",
"ValueError",
"(",
"\"ScalingConfiguration capacity must be one of: {}\"",
".",
"format",
"(",
"\", \"",
".",
"join",
"(",
"map"... | Validate ScalingConfiguration capacity for serverless DBCluster | [
"Validate",
"ScalingConfiguration",
"capacity",
"for",
"serverless",
"DBCluster"
] | f7ea5591a7c287a843adc9c184d2f56064cfc632 | https://github.com/cloudtools/troposphere/blob/f7ea5591a7c287a843adc9c184d2f56064cfc632/troposphere/rds.py#L135-L147 | train | Validate ScalingConfiguration capacity for serverless DBCluster | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
cloudtools/troposphere | setup.py | file_contents | def file_contents(file_name):
"""Given a file name to a valid file returns the file object."""
curr_dir = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(curr_dir, file_name)) as the_file:
contents = the_file.read()
return contents | python | def file_contents(file_name):
"""Given a file name to a valid file returns the file object."""
curr_dir = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(curr_dir, file_name)) as the_file:
contents = the_file.read()
return contents | [
"def",
"file_contents",
"(",
"file_name",
")",
":",
"curr_dir",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"__file__",
")",
")",
"with",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"curr_dir",
",",
"f... | Given a file name to a valid file returns the file object. | [
"Given",
"a",
"file",
"name",
"to",
"a",
"valid",
"file",
"returns",
"the",
"file",
"object",
"."
] | f7ea5591a7c287a843adc9c184d2f56064cfc632 | https://github.com/cloudtools/troposphere/blob/f7ea5591a7c287a843adc9c184d2f56064cfc632/setup.py#L26-L31 | train | Given a file name to a valid file returns the file object. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
cloudtools/troposphere | troposphere/__init__.py | depends_on_helper | def depends_on_helper(obj):
""" Handles using .title if the given object is a troposphere resource.
If the given object is a troposphere resource, use the `.title` attribute
of that resource. If it's a string, just use the string. This should allow
more pythonic use of DependsOn.
"""
if isinsta... | python | def depends_on_helper(obj):
""" Handles using .title if the given object is a troposphere resource.
If the given object is a troposphere resource, use the `.title` attribute
of that resource. If it's a string, just use the string. This should allow
more pythonic use of DependsOn.
"""
if isinsta... | [
"def",
"depends_on_helper",
"(",
"obj",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"AWSObject",
")",
":",
"return",
"obj",
".",
"title",
"elif",
"isinstance",
"(",
"obj",
",",
"list",
")",
":",
"return",
"list",
"(",
"map",
"(",
"depends_on_helper",
... | Handles using .title if the given object is a troposphere resource.
If the given object is a troposphere resource, use the `.title` attribute
of that resource. If it's a string, just use the string. This should allow
more pythonic use of DependsOn. | [
"Handles",
"using",
".",
"title",
"if",
"the",
"given",
"object",
"is",
"a",
"troposphere",
"resource",
"."
] | f7ea5591a7c287a843adc9c184d2f56064cfc632 | https://github.com/cloudtools/troposphere/blob/f7ea5591a7c287a843adc9c184d2f56064cfc632/troposphere/__init__.py#L76-L87 | train | Handles the. title attribute of a troposphere resource. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
cloudtools/troposphere | troposphere/__init__.py | Template.set_parameter_label | def set_parameter_label(self, parameter, label):
"""
Sets the Label used in the User Interface for the given parameter.
:type parameter: str or Parameter
:type label: str
"""
labels = self.metadata\
.setdefault("AWS::CloudFormation::Interface", {})\
... | python | def set_parameter_label(self, parameter, label):
"""
Sets the Label used in the User Interface for the given parameter.
:type parameter: str or Parameter
:type label: str
"""
labels = self.metadata\
.setdefault("AWS::CloudFormation::Interface", {})\
... | [
"def",
"set_parameter_label",
"(",
"self",
",",
"parameter",
",",
"label",
")",
":",
"labels",
"=",
"self",
".",
"metadata",
".",
"setdefault",
"(",
"\"AWS::CloudFormation::Interface\"",
",",
"{",
"}",
")",
".",
"setdefault",
"(",
"\"ParameterLabels\"",
",",
"... | Sets the Label used in the User Interface for the given parameter.
:type parameter: str or Parameter
:type label: str | [
"Sets",
"the",
"Label",
"used",
"in",
"the",
"User",
"Interface",
"for",
"the",
"given",
"parameter",
".",
":",
"type",
"parameter",
":",
"str",
"or",
"Parameter",
":",
"type",
"label",
":",
"str"
] | f7ea5591a7c287a843adc9c184d2f56064cfc632 | https://github.com/cloudtools/troposphere/blob/f7ea5591a7c287a843adc9c184d2f56064cfc632/troposphere/__init__.py#L710-L723 | train | Sets the Label used in the User Interface for the given parameter. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
cloudtools/troposphere | troposphere/__init__.py | Template.add_parameter_to_group | def add_parameter_to_group(self, parameter, group_name):
"""
Add a parameter under a group (created if needed).
:type parameter: str or Parameter
:type group_name: str
"""
groups = self.metadata \
.setdefault("AWS::CloudFormation::Interface", {}) \
... | python | def add_parameter_to_group(self, parameter, group_name):
"""
Add a parameter under a group (created if needed).
:type parameter: str or Parameter
:type group_name: str
"""
groups = self.metadata \
.setdefault("AWS::CloudFormation::Interface", {}) \
... | [
"def",
"add_parameter_to_group",
"(",
"self",
",",
"parameter",
",",
"group_name",
")",
":",
"groups",
"=",
"self",
".",
"metadata",
".",
"setdefault",
"(",
"\"AWS::CloudFormation::Interface\"",
",",
"{",
"}",
")",
".",
"setdefault",
"(",
"\"ParameterGroups\"",
... | Add a parameter under a group (created if needed).
:type parameter: str or Parameter
:type group_name: str | [
"Add",
"a",
"parameter",
"under",
"a",
"group",
"(",
"created",
"if",
"needed",
")",
".",
":",
"type",
"parameter",
":",
"str",
"or",
"Parameter",
":",
"type",
"group_name",
":",
"str"
] | f7ea5591a7c287a843adc9c184d2f56064cfc632 | https://github.com/cloudtools/troposphere/blob/f7ea5591a7c287a843adc9c184d2f56064cfc632/troposphere/__init__.py#L725-L754 | train | Adds a parameter to a group | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
cloudtools/troposphere | troposphere/helpers/userdata.py | from_file | def from_file(filepath, delimiter='', blanklines=False):
"""Imports userdata from a file.
:type filepath: string
:param filepath The absolute path to the file.
:type delimiter: string
:param: delimiter Delimiter to use with the troposphere.Join().
:type blanklines: boolean
:param bla... | python | def from_file(filepath, delimiter='', blanklines=False):
"""Imports userdata from a file.
:type filepath: string
:param filepath The absolute path to the file.
:type delimiter: string
:param: delimiter Delimiter to use with the troposphere.Join().
:type blanklines: boolean
:param bla... | [
"def",
"from_file",
"(",
"filepath",
",",
"delimiter",
"=",
"''",
",",
"blanklines",
"=",
"False",
")",
":",
"data",
"=",
"[",
"]",
"try",
":",
"with",
"open",
"(",
"filepath",
",",
"'r'",
")",
"as",
"f",
":",
"for",
"line",
"in",
"f",
":",
"if",... | Imports userdata from a file.
:type filepath: string
:param filepath The absolute path to the file.
:type delimiter: string
:param: delimiter Delimiter to use with the troposphere.Join().
:type blanklines: boolean
:param blanklines If blank lines shoud be ignored
rtype: troposphere... | [
"Imports",
"userdata",
"from",
"a",
"file",
"."
] | f7ea5591a7c287a843adc9c184d2f56064cfc632 | https://github.com/cloudtools/troposphere/blob/f7ea5591a7c287a843adc9c184d2f56064cfc632/troposphere/helpers/userdata.py#L6-L36 | train | Imports userdata from a file. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
cloudtools/troposphere | troposphere/utils.py | get_events | def get_events(conn, stackname):
"""Get the events in batches and return in chronological order"""
next = None
event_list = []
while 1:
events = conn.describe_stack_events(stackname, next)
event_list.append(events)
if events.next_token is None:
break
next = ev... | python | def get_events(conn, stackname):
"""Get the events in batches and return in chronological order"""
next = None
event_list = []
while 1:
events = conn.describe_stack_events(stackname, next)
event_list.append(events)
if events.next_token is None:
break
next = ev... | [
"def",
"get_events",
"(",
"conn",
",",
"stackname",
")",
":",
"next",
"=",
"None",
"event_list",
"=",
"[",
"]",
"while",
"1",
":",
"events",
"=",
"conn",
".",
"describe_stack_events",
"(",
"stackname",
",",
"next",
")",
"event_list",
".",
"append",
"(",
... | Get the events in batches and return in chronological order | [
"Get",
"the",
"events",
"in",
"batches",
"and",
"return",
"in",
"chronological",
"order"
] | f7ea5591a7c287a843adc9c184d2f56064cfc632 | https://github.com/cloudtools/troposphere/blob/f7ea5591a7c287a843adc9c184d2f56064cfc632/troposphere/utils.py#L8-L19 | train | Get the events in batches and return in chronological order | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
cloudtools/troposphere | troposphere/utils.py | tail | def tail(conn, stack_name, log_func=_tail_print, sleep_time=5,
include_initial=True):
"""Show and then tail the event log"""
# First dump the full list of events in chronological order and keep
# track of the events we've seen already
seen = set()
initial_events = get_events(conn, stack_nam... | python | def tail(conn, stack_name, log_func=_tail_print, sleep_time=5,
include_initial=True):
"""Show and then tail the event log"""
# First dump the full list of events in chronological order and keep
# track of the events we've seen already
seen = set()
initial_events = get_events(conn, stack_nam... | [
"def",
"tail",
"(",
"conn",
",",
"stack_name",
",",
"log_func",
"=",
"_tail_print",
",",
"sleep_time",
"=",
"5",
",",
"include_initial",
"=",
"True",
")",
":",
"# First dump the full list of events in chronological order and keep",
"# track of the events we've seen already"... | Show and then tail the event log | [
"Show",
"and",
"then",
"tail",
"the",
"event",
"log"
] | f7ea5591a7c287a843adc9c184d2f56064cfc632 | https://github.com/cloudtools/troposphere/blob/f7ea5591a7c287a843adc9c184d2f56064cfc632/troposphere/utils.py#L22-L41 | train | Show and then tail the event log | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
cloudtools/troposphere | troposphere/awslambda.py | validate_memory_size | def validate_memory_size(memory_value):
""" Validate memory size for Lambda Function
:param memory_value: The memory size specified in the Function
:return: The provided memory size if it is valid
"""
memory_value = int(positive_integer(memory_value))
if memory_value not in MEMORY_VALUES:
... | python | def validate_memory_size(memory_value):
""" Validate memory size for Lambda Function
:param memory_value: The memory size specified in the Function
:return: The provided memory size if it is valid
"""
memory_value = int(positive_integer(memory_value))
if memory_value not in MEMORY_VALUES:
... | [
"def",
"validate_memory_size",
"(",
"memory_value",
")",
":",
"memory_value",
"=",
"int",
"(",
"positive_integer",
"(",
"memory_value",
")",
")",
"if",
"memory_value",
"not",
"in",
"MEMORY_VALUES",
":",
"raise",
"ValueError",
"(",
"\"Lambda Function memory size must b... | Validate memory size for Lambda Function
:param memory_value: The memory size specified in the Function
:return: The provided memory size if it is valid | [
"Validate",
"memory",
"size",
"for",
"Lambda",
"Function",
":",
"param",
"memory_value",
":",
"The",
"memory",
"size",
"specified",
"in",
"the",
"Function",
":",
"return",
":",
"The",
"provided",
"memory",
"size",
"if",
"it",
"is",
"valid"
] | f7ea5591a7c287a843adc9c184d2f56064cfc632 | https://github.com/cloudtools/troposphere/blob/f7ea5591a7c287a843adc9c184d2f56064cfc632/troposphere/awslambda.py#L28-L37 | train | Validate the memory size for Lambda Function
. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
cloudtools/troposphere | scripts/gen.py | Override.get_validator_list | def get_validator_list(self):
"""Return a list of validators specified in the override file"""
ignore = [
'dict',
]
vlist = []
if not self.override:
return vlist
for k, v in list(self.override['classes'].items()):
if 'validator' in v:
... | python | def get_validator_list(self):
"""Return a list of validators specified in the override file"""
ignore = [
'dict',
]
vlist = []
if not self.override:
return vlist
for k, v in list(self.override['classes'].items()):
if 'validator' in v:
... | [
"def",
"get_validator_list",
"(",
"self",
")",
":",
"ignore",
"=",
"[",
"'dict'",
",",
"]",
"vlist",
"=",
"[",
"]",
"if",
"not",
"self",
".",
"override",
":",
"return",
"vlist",
"for",
"k",
",",
"v",
"in",
"list",
"(",
"self",
".",
"override",
"[",... | Return a list of validators specified in the override file | [
"Return",
"a",
"list",
"of",
"validators",
"specified",
"in",
"the",
"override",
"file"
] | f7ea5591a7c287a843adc9c184d2f56064cfc632 | https://github.com/cloudtools/troposphere/blob/f7ea5591a7c287a843adc9c184d2f56064cfc632/scripts/gen.py#L98-L119 | train | Return a list of validators specified in the override file | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
cloudtools/troposphere | scripts/gen.py | File._output_tags | def _output_tags(self):
"""Look for a Tags object to output a Tags import"""
for class_name, properties in sorted(self.resources.items()):
for key, value in sorted(properties.items()):
validator = self.override.get_validator(class_name, key)
if key == 'Tags' a... | python | def _output_tags(self):
"""Look for a Tags object to output a Tags import"""
for class_name, properties in sorted(self.resources.items()):
for key, value in sorted(properties.items()):
validator = self.override.get_validator(class_name, key)
if key == 'Tags' a... | [
"def",
"_output_tags",
"(",
"self",
")",
":",
"for",
"class_name",
",",
"properties",
"in",
"sorted",
"(",
"self",
".",
"resources",
".",
"items",
"(",
")",
")",
":",
"for",
"key",
",",
"value",
"in",
"sorted",
"(",
"properties",
".",
"items",
"(",
"... | Look for a Tags object to output a Tags import | [
"Look",
"for",
"a",
"Tags",
"object",
"to",
"output",
"a",
"Tags",
"import"
] | f7ea5591a7c287a843adc9c184d2f56064cfc632 | https://github.com/cloudtools/troposphere/blob/f7ea5591a7c287a843adc9c184d2f56064cfc632/scripts/gen.py#L164-L177 | train | Look for a Tags object to output a Tags import | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
cloudtools/troposphere | scripts/gen.py | File._check_type | def _check_type(self, check_type, properties):
"""Decode a properties type looking for a specific type."""
if 'PrimitiveType' in properties:
return properties['PrimitiveType'] == check_type
if properties['Type'] == 'List':
if 'ItemType' in properties:
retu... | python | def _check_type(self, check_type, properties):
"""Decode a properties type looking for a specific type."""
if 'PrimitiveType' in properties:
return properties['PrimitiveType'] == check_type
if properties['Type'] == 'List':
if 'ItemType' in properties:
retu... | [
"def",
"_check_type",
"(",
"self",
",",
"check_type",
",",
"properties",
")",
":",
"if",
"'PrimitiveType'",
"in",
"properties",
":",
"return",
"properties",
"[",
"'PrimitiveType'",
"]",
"==",
"check_type",
"if",
"properties",
"[",
"'Type'",
"]",
"==",
"'List'"... | Decode a properties type looking for a specific type. | [
"Decode",
"a",
"properties",
"type",
"looking",
"for",
"a",
"specific",
"type",
"."
] | f7ea5591a7c287a843adc9c184d2f56064cfc632 | https://github.com/cloudtools/troposphere/blob/f7ea5591a7c287a843adc9c184d2f56064cfc632/scripts/gen.py#L179-L188 | train | Decode a properties type looking for a specific type. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
cloudtools/troposphere | scripts/gen.py | File._walk_for_type | def _walk_for_type(self, check_type):
"""Walk the resources/properties looking for a specific type."""
for class_name, properties in sorted(self.resources.items()):
for key, value in sorted(properties.items()):
if self._check_type(check_type, value):
retur... | python | def _walk_for_type(self, check_type):
"""Walk the resources/properties looking for a specific type."""
for class_name, properties in sorted(self.resources.items()):
for key, value in sorted(properties.items()):
if self._check_type(check_type, value):
retur... | [
"def",
"_walk_for_type",
"(",
"self",
",",
"check_type",
")",
":",
"for",
"class_name",
",",
"properties",
"in",
"sorted",
"(",
"self",
".",
"resources",
".",
"items",
"(",
")",
")",
":",
"for",
"key",
",",
"value",
"in",
"sorted",
"(",
"properties",
"... | Walk the resources/properties looking for a specific type. | [
"Walk",
"the",
"resources",
"/",
"properties",
"looking",
"for",
"a",
"specific",
"type",
"."
] | f7ea5591a7c287a843adc9c184d2f56064cfc632 | https://github.com/cloudtools/troposphere/blob/f7ea5591a7c287a843adc9c184d2f56064cfc632/scripts/gen.py#L190-L201 | train | Walk the resources and properties looking for a specific type. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
cloudtools/troposphere | scripts/gen.py | File._get_type_list | def _get_type_list(self, props):
"""Return a list of non-primitive types used by this object."""
type_list = []
for k, v in list(props.items()):
t = self._get_property_type(v)
if t is not None:
type_list.append(t)
return sorted(type_list) | python | def _get_type_list(self, props):
"""Return a list of non-primitive types used by this object."""
type_list = []
for k, v in list(props.items()):
t = self._get_property_type(v)
if t is not None:
type_list.append(t)
return sorted(type_list) | [
"def",
"_get_type_list",
"(",
"self",
",",
"props",
")",
":",
"type_list",
"=",
"[",
"]",
"for",
"k",
",",
"v",
"in",
"list",
"(",
"props",
".",
"items",
"(",
")",
")",
":",
"t",
"=",
"self",
".",
"_get_property_type",
"(",
"v",
")",
"if",
"t",
... | Return a list of non-primitive types used by this object. | [
"Return",
"a",
"list",
"of",
"non",
"-",
"primitive",
"types",
"used",
"by",
"this",
"object",
"."
] | f7ea5591a7c287a843adc9c184d2f56064cfc632 | https://github.com/cloudtools/troposphere/blob/f7ea5591a7c287a843adc9c184d2f56064cfc632/scripts/gen.py#L218-L225 | train | Return a list of non - primitive types used by this object. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
cloudtools/troposphere | scripts/gen.py | File._output_validators | def _output_validators(self):
"""Output common validator types based on usage."""
if self._walk_for_type('Boolean'):
print("from .validators import boolean")
if self._walk_for_type('Integer'):
print("from .validators import integer")
vlist = self.override.get_vali... | python | def _output_validators(self):
"""Output common validator types based on usage."""
if self._walk_for_type('Boolean'):
print("from .validators import boolean")
if self._walk_for_type('Integer'):
print("from .validators import integer")
vlist = self.override.get_vali... | [
"def",
"_output_validators",
"(",
"self",
")",
":",
"if",
"self",
".",
"_walk_for_type",
"(",
"'Boolean'",
")",
":",
"print",
"(",
"\"from .validators import boolean\"",
")",
"if",
"self",
".",
"_walk_for_type",
"(",
"'Integer'",
")",
":",
"print",
"(",
"\"fro... | Output common validator types based on usage. | [
"Output",
"common",
"validator",
"types",
"based",
"on",
"usage",
"."
] | f7ea5591a7c287a843adc9c184d2f56064cfc632 | https://github.com/cloudtools/troposphere/blob/f7ea5591a7c287a843adc9c184d2f56064cfc632/scripts/gen.py#L227-L240 | train | Output common validator types based on usage. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
cloudtools/troposphere | scripts/gen.py | File.build_tree | def build_tree(self, name, props, resource_name=None):
"""Build a tree of non-primitive typed dependency order."""
n = Node(name, props, resource_name)
prop_type_list = self._get_type_list(props)
if not prop_type_list:
return n
prop_type_list = sorted(prop_type_list)
... | python | def build_tree(self, name, props, resource_name=None):
"""Build a tree of non-primitive typed dependency order."""
n = Node(name, props, resource_name)
prop_type_list = self._get_type_list(props)
if not prop_type_list:
return n
prop_type_list = sorted(prop_type_list)
... | [
"def",
"build_tree",
"(",
"self",
",",
"name",
",",
"props",
",",
"resource_name",
"=",
"None",
")",
":",
"n",
"=",
"Node",
"(",
"name",
",",
"props",
",",
"resource_name",
")",
"prop_type_list",
"=",
"self",
".",
"_get_type_list",
"(",
"props",
")",
"... | Build a tree of non-primitive typed dependency order. | [
"Build",
"a",
"tree",
"of",
"non",
"-",
"primitive",
"typed",
"dependency",
"order",
"."
] | f7ea5591a7c287a843adc9c184d2f56064cfc632 | https://github.com/cloudtools/troposphere/blob/f7ea5591a7c287a843adc9c184d2f56064cfc632/scripts/gen.py#L249-L262 | train | Build a tree of non - primitive typed dependency order. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
cloudtools/troposphere | scripts/gen.py | File.output_tree | def output_tree(self, t, seen):
"""Given a dependency tree of objects, output it in DFS order."""
if not t:
return
for c in t.children:
self.output_tree(c, seen)
if t.name in seen:
return
seen[t.name] = True
if t.resource_name:
... | python | def output_tree(self, t, seen):
"""Given a dependency tree of objects, output it in DFS order."""
if not t:
return
for c in t.children:
self.output_tree(c, seen)
if t.name in seen:
return
seen[t.name] = True
if t.resource_name:
... | [
"def",
"output_tree",
"(",
"self",
",",
"t",
",",
"seen",
")",
":",
"if",
"not",
"t",
":",
"return",
"for",
"c",
"in",
"t",
".",
"children",
":",
"self",
".",
"output_tree",
"(",
"c",
",",
"seen",
")",
"if",
"t",
".",
"name",
"in",
"seen",
":",... | Given a dependency tree of objects, output it in DFS order. | [
"Given",
"a",
"dependency",
"tree",
"of",
"objects",
"output",
"it",
"in",
"DFS",
"order",
"."
] | f7ea5591a7c287a843adc9c184d2f56064cfc632 | https://github.com/cloudtools/troposphere/blob/f7ea5591a7c287a843adc9c184d2f56064cfc632/scripts/gen.py#L264-L276 | train | Given a dependency tree of objects output it in DFS order. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
cloudtools/troposphere | scripts/gen.py | File.output | def output(self):
"""Output the generated source file."""
print(copyright_header % spec_version)
self._output_imports()
self._output_tags()
self._output_validators()
header = self.override.get_header()
if header:
print()
print()
... | python | def output(self):
"""Output the generated source file."""
print(copyright_header % spec_version)
self._output_imports()
self._output_tags()
self._output_validators()
header = self.override.get_header()
if header:
print()
print()
... | [
"def",
"output",
"(",
"self",
")",
":",
"print",
"(",
"copyright_header",
"%",
"spec_version",
")",
"self",
".",
"_output_imports",
"(",
")",
"self",
".",
"_output_tags",
"(",
")",
"self",
".",
"_output_validators",
"(",
")",
"header",
"=",
"self",
".",
... | Output the generated source file. | [
"Output",
"the",
"generated",
"source",
"file",
"."
] | f7ea5591a7c287a843adc9c184d2f56064cfc632 | https://github.com/cloudtools/troposphere/blob/f7ea5591a7c287a843adc9c184d2f56064cfc632/scripts/gen.py#L278-L294 | train | Output the generated source file. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
cloudtools/troposphere | troposphere/template_generator.py | TemplateGenerator.inspect_members | def inspect_members(self):
"""
Returns the list of all troposphere members we are able to
construct
"""
if not self._inspect_members:
TemplateGenerator._inspect_members = \
self._import_all_troposphere_modules()
return self._inspect_members | python | def inspect_members(self):
"""
Returns the list of all troposphere members we are able to
construct
"""
if not self._inspect_members:
TemplateGenerator._inspect_members = \
self._import_all_troposphere_modules()
return self._inspect_members | [
"def",
"inspect_members",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_inspect_members",
":",
"TemplateGenerator",
".",
"_inspect_members",
"=",
"self",
".",
"_import_all_troposphere_modules",
"(",
")",
"return",
"self",
".",
"_inspect_members"
] | Returns the list of all troposphere members we are able to
construct | [
"Returns",
"the",
"list",
"of",
"all",
"troposphere",
"members",
"we",
"are",
"able",
"to",
"construct"
] | f7ea5591a7c287a843adc9c184d2f56064cfc632 | https://github.com/cloudtools/troposphere/blob/f7ea5591a7c287a843adc9c184d2f56064cfc632/troposphere/template_generator.py#L78-L86 | train | Returns the list of all troposphere members that are able to be used in this generator | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
cloudtools/troposphere | troposphere/template_generator.py | TemplateGenerator.inspect_resources | def inspect_resources(self):
""" Returns a map of `ResourceType: ResourceClass` """
if not self._inspect_resources:
d = {}
for m in self.inspect_members:
if issubclass(m, (AWSObject, cloudformation.AWSCustomObject)) \
and hasattr(m, 'resour... | python | def inspect_resources(self):
""" Returns a map of `ResourceType: ResourceClass` """
if not self._inspect_resources:
d = {}
for m in self.inspect_members:
if issubclass(m, (AWSObject, cloudformation.AWSCustomObject)) \
and hasattr(m, 'resour... | [
"def",
"inspect_resources",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_inspect_resources",
":",
"d",
"=",
"{",
"}",
"for",
"m",
"in",
"self",
".",
"inspect_members",
":",
"if",
"issubclass",
"(",
"m",
",",
"(",
"AWSObject",
",",
"cloudformation",... | Returns a map of `ResourceType: ResourceClass` | [
"Returns",
"a",
"map",
"of",
"ResourceType",
":",
"ResourceClass"
] | f7ea5591a7c287a843adc9c184d2f56064cfc632 | https://github.com/cloudtools/troposphere/blob/f7ea5591a7c287a843adc9c184d2f56064cfc632/troposphere/template_generator.py#L89-L100 | train | Returns a map of ResourceType to ResourceClass | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
cloudtools/troposphere | troposphere/template_generator.py | TemplateGenerator.inspect_functions | def inspect_functions(self):
""" Returns a map of `FunctionName: FunctionClass` """
if not self._inspect_functions:
d = {}
for m in self.inspect_members:
if issubclass(m, AWSHelperFn):
d[m.__name__] = m
TemplateGenerator._inspect_f... | python | def inspect_functions(self):
""" Returns a map of `FunctionName: FunctionClass` """
if not self._inspect_functions:
d = {}
for m in self.inspect_members:
if issubclass(m, AWSHelperFn):
d[m.__name__] = m
TemplateGenerator._inspect_f... | [
"def",
"inspect_functions",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_inspect_functions",
":",
"d",
"=",
"{",
"}",
"for",
"m",
"in",
"self",
".",
"inspect_members",
":",
"if",
"issubclass",
"(",
"m",
",",
"AWSHelperFn",
")",
":",
"d",
"[",
"... | Returns a map of `FunctionName: FunctionClass` | [
"Returns",
"a",
"map",
"of",
"FunctionName",
":",
"FunctionClass"
] | f7ea5591a7c287a843adc9c184d2f56064cfc632 | https://github.com/cloudtools/troposphere/blob/f7ea5591a7c287a843adc9c184d2f56064cfc632/troposphere/template_generator.py#L103-L113 | train | Returns a map of FunctionName to FunctionClass | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
cloudtools/troposphere | troposphere/template_generator.py | TemplateGenerator._get_resource_type_cls | def _get_resource_type_cls(self, name, resource):
"""Attempts to return troposphere class that represents Type of
provided resource. Attempts to find the troposphere class who's
`resource_type` field is the same as the provided resources `Type`
field.
:param resource: Resource t... | python | def _get_resource_type_cls(self, name, resource):
"""Attempts to return troposphere class that represents Type of
provided resource. Attempts to find the troposphere class who's
`resource_type` field is the same as the provided resources `Type`
field.
:param resource: Resource t... | [
"def",
"_get_resource_type_cls",
"(",
"self",
",",
"name",
",",
"resource",
")",
":",
"# If provided resource does not have `Type` field",
"if",
"'Type'",
"not",
"in",
"resource",
":",
"raise",
"ResourceTypeNotDefined",
"(",
"name",
")",
"# Attempt to find troposphere res... | Attempts to return troposphere class that represents Type of
provided resource. Attempts to find the troposphere class who's
`resource_type` field is the same as the provided resources `Type`
field.
:param resource: Resource to find troposphere class for
:return: None: If no cla... | [
"Attempts",
"to",
"return",
"troposphere",
"class",
"that",
"represents",
"Type",
"of",
"provided",
"resource",
".",
"Attempts",
"to",
"find",
"the",
"troposphere",
"class",
"who",
"s",
"resource_type",
"field",
"is",
"the",
"same",
"as",
"the",
"provided",
"r... | f7ea5591a7c287a843adc9c184d2f56064cfc632 | https://github.com/cloudtools/troposphere/blob/f7ea5591a7c287a843adc9c184d2f56064cfc632/troposphere/template_generator.py#L115-L141 | train | Attempts to find the troposphere class that represents Type of
provided resource. Attempts to find the troposphere class that represents Type of
provided resource. Attempts to find the troposphere class that represents Type of
provided resource. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
cloudtools/troposphere | troposphere/template_generator.py | TemplateGenerator._convert_definition | def _convert_definition(self, definition, ref=None, cls=None):
"""
Converts any object to its troposphere equivalent, if applicable.
This function will recurse into lists and mappings to create
additional objects as necessary.
:param {*} definition: Object to convert
:pa... | python | def _convert_definition(self, definition, ref=None, cls=None):
"""
Converts any object to its troposphere equivalent, if applicable.
This function will recurse into lists and mappings to create
additional objects as necessary.
:param {*} definition: Object to convert
:pa... | [
"def",
"_convert_definition",
"(",
"self",
",",
"definition",
",",
"ref",
"=",
"None",
",",
"cls",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"definition",
",",
"Mapping",
")",
":",
"if",
"'Type'",
"in",
"definition",
":",
"# this is an AWS Resource",
... | Converts any object to its troposphere equivalent, if applicable.
This function will recurse into lists and mappings to create
additional objects as necessary.
:param {*} definition: Object to convert
:param str ref: Name of key in parent dict that the provided definition
... | [
"Converts",
"any",
"object",
"to",
"its",
"troposphere",
"equivalent",
"if",
"applicable",
".",
"This",
"function",
"will",
"recurse",
"into",
"lists",
"and",
"mappings",
"to",
"create",
"additional",
"objects",
"as",
"necessary",
"."
] | f7ea5591a7c287a843adc9c184d2f56064cfc632 | https://github.com/cloudtools/troposphere/blob/f7ea5591a7c287a843adc9c184d2f56064cfc632/troposphere/template_generator.py#L143-L198 | train | Converts any object to troposphere equivalent if applicable. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
cloudtools/troposphere | troposphere/template_generator.py | TemplateGenerator._create_instance | def _create_instance(self, cls, args, ref=None):
"""
Returns an instance of `cls` with `args` passed as arguments.
Recursively inspects `args` to create nested objects and functions as
necessary.
`cls` will only be considered only if it's an object we track
(i.e.: trop... | python | def _create_instance(self, cls, args, ref=None):
"""
Returns an instance of `cls` with `args` passed as arguments.
Recursively inspects `args` to create nested objects and functions as
necessary.
`cls` will only be considered only if it's an object we track
(i.e.: trop... | [
"def",
"_create_instance",
"(",
"self",
",",
"cls",
",",
"args",
",",
"ref",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"cls",
",",
"Sequence",
")",
":",
"if",
"len",
"(",
"cls",
")",
"==",
"1",
":",
"# a list of 1 type means we must provide a list of... | Returns an instance of `cls` with `args` passed as arguments.
Recursively inspects `args` to create nested objects and functions as
necessary.
`cls` will only be considered only if it's an object we track
(i.e.: troposphere objects).
If `cls` has a `props` attribute, nested p... | [
"Returns",
"an",
"instance",
"of",
"cls",
"with",
"args",
"passed",
"as",
"arguments",
"."
] | f7ea5591a7c287a843adc9c184d2f56064cfc632 | https://github.com/cloudtools/troposphere/blob/f7ea5591a7c287a843adc9c184d2f56064cfc632/troposphere/template_generator.py#L200-L299 | train | Create an instance of cls with args passed as arguments. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
cloudtools/troposphere | troposphere/template_generator.py | TemplateGenerator._normalize_properties | def _normalize_properties(self, definition):
"""
Inspects the definition and returns a copy of it that is updated
with any special property such as Condition, UpdatePolicy and the
like.
"""
args = definition.get('Properties', {}).copy()
if 'Condition' in definitio... | python | def _normalize_properties(self, definition):
"""
Inspects the definition and returns a copy of it that is updated
with any special property such as Condition, UpdatePolicy and the
like.
"""
args = definition.get('Properties', {}).copy()
if 'Condition' in definitio... | [
"def",
"_normalize_properties",
"(",
"self",
",",
"definition",
")",
":",
"args",
"=",
"definition",
".",
"get",
"(",
"'Properties'",
",",
"{",
"}",
")",
".",
"copy",
"(",
")",
"if",
"'Condition'",
"in",
"definition",
":",
"args",
".",
"update",
"(",
"... | Inspects the definition and returns a copy of it that is updated
with any special property such as Condition, UpdatePolicy and the
like. | [
"Inspects",
"the",
"definition",
"and",
"returns",
"a",
"copy",
"of",
"it",
"that",
"is",
"updated",
"with",
"any",
"special",
"property",
"such",
"as",
"Condition",
"UpdatePolicy",
"and",
"the",
"like",
"."
] | f7ea5591a7c287a843adc9c184d2f56064cfc632 | https://github.com/cloudtools/troposphere/blob/f7ea5591a7c287a843adc9c184d2f56064cfc632/troposphere/template_generator.py#L301-L332 | train | Returns a copy of the definition with any special properties such as Condition UpdatePolicy and DeletionPolicy. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
cloudtools/troposphere | troposphere/template_generator.py | TemplateGenerator._generate_custom_type | def _generate_custom_type(self, resource_type):
"""
Dynamically allocates a new CustomResource class definition using the
specified Custom::SomeCustomName resource type. This special resource
type is equivalent to the AWS::CloudFormation::CustomResource.
"""
if not resour... | python | def _generate_custom_type(self, resource_type):
"""
Dynamically allocates a new CustomResource class definition using the
specified Custom::SomeCustomName resource type. This special resource
type is equivalent to the AWS::CloudFormation::CustomResource.
"""
if not resour... | [
"def",
"_generate_custom_type",
"(",
"self",
",",
"resource_type",
")",
":",
"if",
"not",
"resource_type",
".",
"startswith",
"(",
"\"Custom::\"",
")",
":",
"raise",
"TypeError",
"(",
"\"Custom types must start with Custom::\"",
")",
"custom_type",
"=",
"type",
"(",... | Dynamically allocates a new CustomResource class definition using the
specified Custom::SomeCustomName resource type. This special resource
type is equivalent to the AWS::CloudFormation::CustomResource. | [
"Dynamically",
"allocates",
"a",
"new",
"CustomResource",
"class",
"definition",
"using",
"the",
"specified",
"Custom",
"::",
"SomeCustomName",
"resource",
"type",
".",
"This",
"special",
"resource",
"type",
"is",
"equivalent",
"to",
"the",
"AWS",
"::",
"CloudForm... | f7ea5591a7c287a843adc9c184d2f56064cfc632 | https://github.com/cloudtools/troposphere/blob/f7ea5591a7c287a843adc9c184d2f56064cfc632/troposphere/template_generator.py#L334-L348 | train | Dynamically allocates a new CustomResource class definition using the specified Custom :: SomeCustomName resource type. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
cloudtools/troposphere | troposphere/template_generator.py | TemplateGenerator._generate_autoscaling_metadata | def _generate_autoscaling_metadata(self, cls, args):
""" Provides special handling for the autoscaling.Metadata object """
assert isinstance(args, Mapping)
init_config = self._create_instance(
cloudformation.InitConfig,
args['AWS::CloudFormation::Init']['config'])
... | python | def _generate_autoscaling_metadata(self, cls, args):
""" Provides special handling for the autoscaling.Metadata object """
assert isinstance(args, Mapping)
init_config = self._create_instance(
cloudformation.InitConfig,
args['AWS::CloudFormation::Init']['config'])
... | [
"def",
"_generate_autoscaling_metadata",
"(",
"self",
",",
"cls",
",",
"args",
")",
":",
"assert",
"isinstance",
"(",
"args",
",",
"Mapping",
")",
"init_config",
"=",
"self",
".",
"_create_instance",
"(",
"cloudformation",
".",
"InitConfig",
",",
"args",
"[",
... | Provides special handling for the autoscaling.Metadata object | [
"Provides",
"special",
"handling",
"for",
"the",
"autoscaling",
".",
"Metadata",
"object"
] | f7ea5591a7c287a843adc9c184d2f56064cfc632 | https://github.com/cloudtools/troposphere/blob/f7ea5591a7c287a843adc9c184d2f56064cfc632/troposphere/template_generator.py#L350-L369 | train | Generates the autoscaling. Metadata object from the given args. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
cloudtools/troposphere | troposphere/template_generator.py | TemplateGenerator._get_function_type | def _get_function_type(self, function_name):
"""
Returns the function object that matches the provided name.
Only Fn:: and Ref functions are supported here so that other
functions specific to troposphere are skipped.
"""
if (function_name.startswith("Fn::") and
... | python | def _get_function_type(self, function_name):
"""
Returns the function object that matches the provided name.
Only Fn:: and Ref functions are supported here so that other
functions specific to troposphere are skipped.
"""
if (function_name.startswith("Fn::") and
... | [
"def",
"_get_function_type",
"(",
"self",
",",
"function_name",
")",
":",
"if",
"(",
"function_name",
".",
"startswith",
"(",
"\"Fn::\"",
")",
"and",
"function_name",
"[",
"4",
":",
"]",
"in",
"self",
".",
"inspect_functions",
")",
":",
"return",
"self",
"... | Returns the function object that matches the provided name.
Only Fn:: and Ref functions are supported here so that other
functions specific to troposphere are skipped. | [
"Returns",
"the",
"function",
"object",
"that",
"matches",
"the",
"provided",
"name",
".",
"Only",
"Fn",
"::",
"and",
"Ref",
"functions",
"are",
"supported",
"here",
"so",
"that",
"other",
"functions",
"specific",
"to",
"troposphere",
"are",
"skipped",
"."
] | f7ea5591a7c287a843adc9c184d2f56064cfc632 | https://github.com/cloudtools/troposphere/blob/f7ea5591a7c287a843adc9c184d2f56064cfc632/troposphere/template_generator.py#L371-L381 | train | Returns the function object that matches the provided name. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
cloudtools/troposphere | troposphere/template_generator.py | TemplateGenerator._import_all_troposphere_modules | def _import_all_troposphere_modules(self):
""" Imports all troposphere modules and returns them """
dirname = os.path.join(os.path.dirname(__file__))
module_names = [
pkg_name
for importer, pkg_name, is_pkg in
pkgutil.walk_packages([dirname], prefix="troposphe... | python | def _import_all_troposphere_modules(self):
""" Imports all troposphere modules and returns them """
dirname = os.path.join(os.path.dirname(__file__))
module_names = [
pkg_name
for importer, pkg_name, is_pkg in
pkgutil.walk_packages([dirname], prefix="troposphe... | [
"def",
"_import_all_troposphere_modules",
"(",
"self",
")",
":",
"dirname",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"__file__",
")",
")",
"module_names",
"=",
"[",
"pkg_name",
"for",
"importer",
",",
"pkg_name",
... | Imports all troposphere modules and returns them | [
"Imports",
"all",
"troposphere",
"modules",
"and",
"returns",
"them"
] | f7ea5591a7c287a843adc9c184d2f56064cfc632 | https://github.com/cloudtools/troposphere/blob/f7ea5591a7c287a843adc9c184d2f56064cfc632/troposphere/template_generator.py#L383-L405 | train | Imports all troposphere modules and returns them | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/contrib/gtp_v2.py | PCO_option_dispatcher | def PCO_option_dispatcher(s):
"""Choose the correct PCO element."""
option = orb(s[0])
cls = PCO_OPTION_CLASSES.get(option, Raw)
return cls(s) | python | def PCO_option_dispatcher(s):
"""Choose the correct PCO element."""
option = orb(s[0])
cls = PCO_OPTION_CLASSES.get(option, Raw)
return cls(s) | [
"def",
"PCO_option_dispatcher",
"(",
"s",
")",
":",
"option",
"=",
"orb",
"(",
"s",
"[",
"0",
"]",
")",
"cls",
"=",
"PCO_OPTION_CLASSES",
".",
"get",
"(",
"option",
",",
"Raw",
")",
"return",
"cls",
"(",
"s",
")"
] | Choose the correct PCO element. | [
"Choose",
"the",
"correct",
"PCO",
"element",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/gtp_v2.py#L476-L481 | train | Choose the correct PCO element. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/contrib/gtp_v2.py | PCO_protocol_dispatcher | def PCO_protocol_dispatcher(s):
"""Choose the correct PCO element."""
proto_num = orb(s[0]) * 256 + orb(s[1])
cls = PCO_PROTOCOL_CLASSES.get(proto_num, Raw)
return cls(s) | python | def PCO_protocol_dispatcher(s):
"""Choose the correct PCO element."""
proto_num = orb(s[0]) * 256 + orb(s[1])
cls = PCO_PROTOCOL_CLASSES.get(proto_num, Raw)
return cls(s) | [
"def",
"PCO_protocol_dispatcher",
"(",
"s",
")",
":",
"proto_num",
"=",
"orb",
"(",
"s",
"[",
"0",
"]",
")",
"*",
"256",
"+",
"orb",
"(",
"s",
"[",
"1",
"]",
")",
"cls",
"=",
"PCO_PROTOCOL_CLASSES",
".",
"get",
"(",
"proto_num",
",",
"Raw",
")",
... | Choose the correct PCO element. | [
"Choose",
"the",
"correct",
"PCO",
"element",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/gtp_v2.py#L628-L632 | train | Choose the correct PCO element. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/arch/windows/__init__.py | _get_npcap_config | def _get_npcap_config(param_key):
"""
Get a Npcap parameter matching key in the registry.
List:
AdminOnly, DefaultFilterSettings, DltNull, Dot11Adapters, Dot11Support
LoopbackAdapter, LoopbackSupport, NdisImPlatformBindingOptions, VlanSupport
WinPcapCompatible
"""
hkey = winreg.HKEY_LOC... | python | def _get_npcap_config(param_key):
"""
Get a Npcap parameter matching key in the registry.
List:
AdminOnly, DefaultFilterSettings, DltNull, Dot11Adapters, Dot11Support
LoopbackAdapter, LoopbackSupport, NdisImPlatformBindingOptions, VlanSupport
WinPcapCompatible
"""
hkey = winreg.HKEY_LOC... | [
"def",
"_get_npcap_config",
"(",
"param_key",
")",
":",
"hkey",
"=",
"winreg",
".",
"HKEY_LOCAL_MACHINE",
"node",
"=",
"r\"SYSTEM\\CurrentControlSet\\Services\\npcap\\Parameters\"",
"try",
":",
"key",
"=",
"winreg",
".",
"OpenKey",
"(",
"hkey",
",",
"node",
")",
"... | Get a Npcap parameter matching key in the registry.
List:
AdminOnly, DefaultFilterSettings, DltNull, Dot11Adapters, Dot11Support
LoopbackAdapter, LoopbackSupport, NdisImPlatformBindingOptions, VlanSupport
WinPcapCompatible | [
"Get",
"a",
"Npcap",
"parameter",
"matching",
"key",
"in",
"the",
"registry",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/windows/__init__.py#L76-L93 | train | Get a Npcap parameter matching key in the registry. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/arch/windows/__init__.py | _exec_cmd | def _exec_cmd(command):
"""Call a CMD command and return the output and returncode"""
proc = sp.Popen(command,
stdout=sp.PIPE,
shell=True)
if six.PY2:
res = proc.communicate()[0]
else:
res = proc.communicate(timeout=5)[0]
return res, proc.retur... | python | def _exec_cmd(command):
"""Call a CMD command and return the output and returncode"""
proc = sp.Popen(command,
stdout=sp.PIPE,
shell=True)
if six.PY2:
res = proc.communicate()[0]
else:
res = proc.communicate(timeout=5)[0]
return res, proc.retur... | [
"def",
"_exec_cmd",
"(",
"command",
")",
":",
"proc",
"=",
"sp",
".",
"Popen",
"(",
"command",
",",
"stdout",
"=",
"sp",
".",
"PIPE",
",",
"shell",
"=",
"True",
")",
"if",
"six",
".",
"PY2",
":",
"res",
"=",
"proc",
".",
"communicate",
"(",
")",
... | Call a CMD command and return the output and returncode | [
"Call",
"a",
"CMD",
"command",
"and",
"return",
"the",
"output",
"and",
"returncode"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/windows/__init__.py#L174-L183 | train | Call a CMD command and return the output and returncode | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.