repo stringlengths 7 55 | 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 19 28.4k | docstring stringlengths 1 46.9k | docstring_tokens listlengths 1 1.97k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
glomex/gcdt | gcdt/ramuda_core.py | logs | def logs(awsclient, function_name, start_dt, end_dt=None, tail=False):
"""Send a ping request to a lambda function.
:param awsclient:
:param function_name:
:param start_dt:
:param end_dt:
:param tail:
:return:
"""
log.debug('Getting cloudwatch logs for: %s', function_name)
log_g... | python | def logs(awsclient, function_name, start_dt, end_dt=None, tail=False):
"""Send a ping request to a lambda function.
:param awsclient:
:param function_name:
:param start_dt:
:param end_dt:
:param tail:
:return:
"""
log.debug('Getting cloudwatch logs for: %s', function_name)
log_g... | [
"def",
"logs",
"(",
"awsclient",
",",
"function_name",
",",
"start_dt",
",",
"end_dt",
"=",
"None",
",",
"tail",
"=",
"False",
")",
":",
"log",
".",
"debug",
"(",
"'Getting cloudwatch logs for: %s'",
",",
"function_name",
")",
"log_group_name",
"=",
"'/aws/lam... | Send a ping request to a lambda function.
:param awsclient:
:param function_name:
:param start_dt:
:param end_dt:
:param tail:
:return: | [
"Send",
"a",
"ping",
"request",
"to",
"a",
"lambda",
"function",
"."
] | cd67cf416371337b83cb9ca3f696277125703339 | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/ramuda_core.py#L703-L743 | train |
thombashi/typepy | typepy/converter/_datetime.py | DateTimeConverter.__validate_datetime_string | def __validate_datetime_string(self):
"""
This will require validating version string (such as "3.3.5").
A version string could be converted to a datetime value if this
validation is not executed.
"""
try:
try:
StrictVersion(self._value)
... | python | def __validate_datetime_string(self):
"""
This will require validating version string (such as "3.3.5").
A version string could be converted to a datetime value if this
validation is not executed.
"""
try:
try:
StrictVersion(self._value)
... | [
"def",
"__validate_datetime_string",
"(",
"self",
")",
":",
"try",
":",
"try",
":",
"StrictVersion",
"(",
"self",
".",
"_value",
")",
"raise",
"TypeConversionError",
"(",
"\"invalid datetime string: version string found {}\"",
".",
"format",
"(",
"self",
".",
"_valu... | This will require validating version string (such as "3.3.5").
A version string could be converted to a datetime value if this
validation is not executed. | [
"This",
"will",
"require",
"validating",
"version",
"string",
"(",
"such",
"as",
"3",
".",
"3",
".",
"5",
")",
".",
"A",
"version",
"string",
"could",
"be",
"converted",
"to",
"a",
"datetime",
"value",
"if",
"this",
"validation",
"is",
"not",
"executed",... | 8209d1df4f2a7f196a9fa4bfb0708c5ff648461f | https://github.com/thombashi/typepy/blob/8209d1df4f2a7f196a9fa4bfb0708c5ff648461f/typepy/converter/_datetime.py#L131-L147 | train |
DeepHorizons/iarm | iarm/arm_instructions/memory.py | Memory.ADR | def ADR(self, params):
"""
ADR Ra, [PC, #imm10_4]
ADR Ra, label
Load the address of label or the PC offset into Ra
Ra must be a low register
"""
# TODO may need to rethink how I do PC, may need to be byte alligned
# TODO This is wrong as each address is a... | python | def ADR(self, params):
"""
ADR Ra, [PC, #imm10_4]
ADR Ra, label
Load the address of label or the PC offset into Ra
Ra must be a low register
"""
# TODO may need to rethink how I do PC, may need to be byte alligned
# TODO This is wrong as each address is a... | [
"def",
"ADR",
"(",
"self",
",",
"params",
")",
":",
"# TODO may need to rethink how I do PC, may need to be byte alligned",
"# TODO This is wrong as each address is a word, not a byte. The filled value with its location (Do we want that, or the value at that location [Decompiled instruction])",
... | ADR Ra, [PC, #imm10_4]
ADR Ra, label
Load the address of label or the PC offset into Ra
Ra must be a low register | [
"ADR",
"Ra",
"[",
"PC",
"#imm10_4",
"]",
"ADR",
"Ra",
"label"
] | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/memory.py#L9-L39 | train |
DeepHorizons/iarm | iarm/arm_instructions/memory.py | Memory.LDR | def LDR(self, params):
"""
LDR Ra, [PC, #imm10_4]
LDR Ra, label
LDR Ra, =equate
LDR Ra, [Rb, Rc]
LDR Ra, [Rb, #imm7_4]
LDR Ra, [SP, #imm10_4]
Load a word from memory into Ra
Ra, Rb, and Rc must be low registers
"""
# TODO definitio... | python | def LDR(self, params):
"""
LDR Ra, [PC, #imm10_4]
LDR Ra, label
LDR Ra, =equate
LDR Ra, [Rb, Rc]
LDR Ra, [Rb, #imm7_4]
LDR Ra, [SP, #imm10_4]
Load a word from memory into Ra
Ra, Rb, and Rc must be low registers
"""
# TODO definitio... | [
"def",
"LDR",
"(",
"self",
",",
"params",
")",
":",
"# TODO definition for PC is Ra <- M[PC + Imm10_4], Imm10_4 = PC - label, need to figure this one out",
"try",
":",
"Ra",
",",
"Rb",
",",
"Rc",
"=",
"self",
".",
"get_three_parameters",
"(",
"self",
".",
"THREE_PARAMET... | LDR Ra, [PC, #imm10_4]
LDR Ra, label
LDR Ra, =equate
LDR Ra, [Rb, Rc]
LDR Ra, [Rb, #imm7_4]
LDR Ra, [SP, #imm10_4]
Load a word from memory into Ra
Ra, Rb, and Rc must be low registers | [
"LDR",
"Ra",
"[",
"PC",
"#imm10_4",
"]",
"LDR",
"Ra",
"label",
"LDR",
"Ra",
"=",
"equate",
"LDR",
"Ra",
"[",
"Rb",
"Rc",
"]",
"LDR",
"Ra",
"[",
"Rb",
"#imm7_4",
"]",
"LDR",
"Ra",
"[",
"SP",
"#imm10_4",
"]"
] | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/memory.py#L64-L187 | train |
DeepHorizons/iarm | iarm/arm_instructions/memory.py | Memory.LDRB | def LDRB(self, params):
"""
LDRB Ra, [Rb, Rc]
LDRB Ra, [Rb, #imm5]
Load a byte from memory into Ra
Ra, Rb, and Rc must be low registers
"""
try:
Ra, Rb, Rc = self.get_three_parameters(self.THREE_PARAMETER_WITH_BRACKETS, params)
except iarm.exc... | python | def LDRB(self, params):
"""
LDRB Ra, [Rb, Rc]
LDRB Ra, [Rb, #imm5]
Load a byte from memory into Ra
Ra, Rb, and Rc must be low registers
"""
try:
Ra, Rb, Rc = self.get_three_parameters(self.THREE_PARAMETER_WITH_BRACKETS, params)
except iarm.exc... | [
"def",
"LDRB",
"(",
"self",
",",
"params",
")",
":",
"try",
":",
"Ra",
",",
"Rb",
",",
"Rc",
"=",
"self",
".",
"get_three_parameters",
"(",
"self",
".",
"THREE_PARAMETER_WITH_BRACKETS",
",",
"params",
")",
"except",
"iarm",
".",
"exceptions",
".",
"Parsi... | LDRB Ra, [Rb, Rc]
LDRB Ra, [Rb, #imm5]
Load a byte from memory into Ra
Ra, Rb, and Rc must be low registers | [
"LDRB",
"Ra",
"[",
"Rb",
"Rc",
"]",
"LDRB",
"Ra",
"[",
"Rb",
"#imm5",
"]"
] | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/memory.py#L189-L215 | train |
DeepHorizons/iarm | iarm/arm_instructions/memory.py | Memory.LDRH | def LDRH(self, params):
"""
LDRH Ra, [Rb, Rc]
LDRH Ra, [Rb, #imm6_2]
Load a half word from memory into Ra
Ra, Rb, and Rc must be low registers
"""
try:
Ra, Rb, Rc = self.get_three_parameters(self.THREE_PARAMETER_WITH_BRACKETS, params)
except i... | python | def LDRH(self, params):
"""
LDRH Ra, [Rb, Rc]
LDRH Ra, [Rb, #imm6_2]
Load a half word from memory into Ra
Ra, Rb, and Rc must be low registers
"""
try:
Ra, Rb, Rc = self.get_three_parameters(self.THREE_PARAMETER_WITH_BRACKETS, params)
except i... | [
"def",
"LDRH",
"(",
"self",
",",
"params",
")",
":",
"try",
":",
"Ra",
",",
"Rb",
",",
"Rc",
"=",
"self",
".",
"get_three_parameters",
"(",
"self",
".",
"THREE_PARAMETER_WITH_BRACKETS",
",",
"params",
")",
"except",
"iarm",
".",
"exceptions",
".",
"Parsi... | LDRH Ra, [Rb, Rc]
LDRH Ra, [Rb, #imm6_2]
Load a half word from memory into Ra
Ra, Rb, and Rc must be low registers | [
"LDRH",
"Ra",
"[",
"Rb",
"Rc",
"]",
"LDRH",
"Ra",
"[",
"Rb",
"#imm6_2",
"]"
] | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/memory.py#L217-L258 | train |
DeepHorizons/iarm | iarm/arm_instructions/memory.py | Memory.LDRSB | def LDRSB(self, params):
"""
LDRSB Ra, [Rb, Rc]
Load a byte from memory, sign extend, and put into Ra
Ra, Rb, and Rc must be low registers
"""
# TODO LDRSB cant use immediates
Ra, Rb, Rc = self.get_three_parameters(self.THREE_PARAMETER_WITH_BRACKETS, params)
... | python | def LDRSB(self, params):
"""
LDRSB Ra, [Rb, Rc]
Load a byte from memory, sign extend, and put into Ra
Ra, Rb, and Rc must be low registers
"""
# TODO LDRSB cant use immediates
Ra, Rb, Rc = self.get_three_parameters(self.THREE_PARAMETER_WITH_BRACKETS, params)
... | [
"def",
"LDRSB",
"(",
"self",
",",
"params",
")",
":",
"# TODO LDRSB cant use immediates",
"Ra",
",",
"Rb",
",",
"Rc",
"=",
"self",
".",
"get_three_parameters",
"(",
"self",
".",
"THREE_PARAMETER_WITH_BRACKETS",
",",
"params",
")",
"self",
".",
"check_arguments",... | LDRSB Ra, [Rb, Rc]
Load a byte from memory, sign extend, and put into Ra
Ra, Rb, and Rc must be low registers | [
"LDRSB",
"Ra",
"[",
"Rb",
"Rc",
"]"
] | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/memory.py#L260-L279 | train |
DeepHorizons/iarm | iarm/arm_instructions/memory.py | Memory.LDRSH | def LDRSH(self, params):
"""
LDRSH Ra, [Rb, Rc]
Load a half word from memory, sign extend, and put into Ra
Ra, Rb, and Rc must be low registers
"""
# TODO LDRSH cant use immediates
Ra, Rb, Rc = self.get_three_parameters(self.THREE_PARAMETER_WITH_BRACKETS, params)... | python | def LDRSH(self, params):
"""
LDRSH Ra, [Rb, Rc]
Load a half word from memory, sign extend, and put into Ra
Ra, Rb, and Rc must be low registers
"""
# TODO LDRSH cant use immediates
Ra, Rb, Rc = self.get_three_parameters(self.THREE_PARAMETER_WITH_BRACKETS, params)... | [
"def",
"LDRSH",
"(",
"self",
",",
"params",
")",
":",
"# TODO LDRSH cant use immediates",
"Ra",
",",
"Rb",
",",
"Rc",
"=",
"self",
".",
"get_three_parameters",
"(",
"self",
".",
"THREE_PARAMETER_WITH_BRACKETS",
",",
"params",
")",
"self",
".",
"check_arguments",... | LDRSH Ra, [Rb, Rc]
Load a half word from memory, sign extend, and put into Ra
Ra, Rb, and Rc must be low registers | [
"LDRSH",
"Ra",
"[",
"Rb",
"Rc",
"]"
] | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/memory.py#L281-L305 | train |
DeepHorizons/iarm | iarm/arm_instructions/memory.py | Memory.POP | def POP(self, params):
"""
POP {RPopList}
Pop from the stack into the list of registers
List must contain only low registers or PC
"""
# TODO verify pop order
# TODO pop list is comma separate, right?
# TODO what registeres are allowed to POP to? Low Regi... | python | def POP(self, params):
"""
POP {RPopList}
Pop from the stack into the list of registers
List must contain only low registers or PC
"""
# TODO verify pop order
# TODO pop list is comma separate, right?
# TODO what registeres are allowed to POP to? Low Regi... | [
"def",
"POP",
"(",
"self",
",",
"params",
")",
":",
"# TODO verify pop order",
"# TODO pop list is comma separate, right?",
"# TODO what registeres are allowed to POP to? Low Registers and PC",
"# TODO need to support ranges, ie {R2, R5-R7}",
"# TODO PUSH should reverse the list, not POP",
... | POP {RPopList}
Pop from the stack into the list of registers
List must contain only low registers or PC | [
"POP",
"{",
"RPopList",
"}"
] | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/memory.py#L307-L334 | train |
DeepHorizons/iarm | iarm/arm_instructions/memory.py | Memory.PUSH | def PUSH(self, params):
"""
PUSH {RPushList}
Push to the stack from a list of registers
List must contain only low registers or LR
"""
# TODO what registers are allowed to PUSH to? Low registers and LR
# TODO PUSH should reverse the list, not POP
RPushLis... | python | def PUSH(self, params):
"""
PUSH {RPushList}
Push to the stack from a list of registers
List must contain only low registers or LR
"""
# TODO what registers are allowed to PUSH to? Low registers and LR
# TODO PUSH should reverse the list, not POP
RPushLis... | [
"def",
"PUSH",
"(",
"self",
",",
"params",
")",
":",
"# TODO what registers are allowed to PUSH to? Low registers and LR",
"# TODO PUSH should reverse the list, not POP",
"RPushList",
"=",
"self",
".",
"get_one_parameter",
"(",
"r'\\s*{(.*)}(.*)'",
",",
"params",
")",
".",
... | PUSH {RPushList}
Push to the stack from a list of registers
List must contain only low registers or LR | [
"PUSH",
"{",
"RPushList",
"}"
] | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/memory.py#L336-L357 | train |
DeepHorizons/iarm | iarm/arm_instructions/memory.py | Memory.STM | def STM(self, params):
"""
STM Ra!, {RLoList}
Store multiple registers into memory
"""
# TODO what registers can be stored?
Ra, RLoList = self.get_two_parameters(r'\s*([^\s,]*)!,\s*{(.*)}(.*)', params).split(',')
RLoList = RLoList.split(',')
RLoList = [i.... | python | def STM(self, params):
"""
STM Ra!, {RLoList}
Store multiple registers into memory
"""
# TODO what registers can be stored?
Ra, RLoList = self.get_two_parameters(r'\s*([^\s,]*)!,\s*{(.*)}(.*)', params).split(',')
RLoList = RLoList.split(',')
RLoList = [i.... | [
"def",
"STM",
"(",
"self",
",",
"params",
")",
":",
"# TODO what registers can be stored?",
"Ra",
",",
"RLoList",
"=",
"self",
".",
"get_two_parameters",
"(",
"r'\\s*([^\\s,]*)!,\\s*{(.*)}(.*)'",
",",
"params",
")",
".",
"split",
"(",
"','",
")",
"RLoList",
"=",... | STM Ra!, {RLoList}
Store multiple registers into memory | [
"STM",
"Ra!",
"{",
"RLoList",
"}"
] | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/memory.py#L359-L378 | train |
DeepHorizons/iarm | iarm/arm_instructions/memory.py | Memory.STR | def STR(self, params):
"""
STR Ra, [Rb, Rc]
STR Ra, [Rb, #imm7_4]
STR Ra, [SP, #imm10_4]
Store Ra into memory as a word
Ra, Rb, and Rc must be low registers
"""
Ra, Rb, Rc = self.get_three_parameters(self.THREE_PARAMETER_WITH_BRACKETS, params)
if... | python | def STR(self, params):
"""
STR Ra, [Rb, Rc]
STR Ra, [Rb, #imm7_4]
STR Ra, [SP, #imm10_4]
Store Ra into memory as a word
Ra, Rb, and Rc must be low registers
"""
Ra, Rb, Rc = self.get_three_parameters(self.THREE_PARAMETER_WITH_BRACKETS, params)
if... | [
"def",
"STR",
"(",
"self",
",",
"params",
")",
":",
"Ra",
",",
"Rb",
",",
"Rc",
"=",
"self",
".",
"get_three_parameters",
"(",
"self",
".",
"THREE_PARAMETER_WITH_BRACKETS",
",",
"params",
")",
"if",
"self",
".",
"is_immediate",
"(",
"Rc",
")",
":",
"if... | STR Ra, [Rb, Rc]
STR Ra, [Rb, #imm7_4]
STR Ra, [SP, #imm10_4]
Store Ra into memory as a word
Ra, Rb, and Rc must be low registers | [
"STR",
"Ra",
"[",
"Rb",
"Rc",
"]",
"STR",
"Ra",
"[",
"Rb",
"#imm7_4",
"]",
"STR",
"Ra",
"[",
"SP",
"#imm10_4",
"]"
] | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/memory.py#L380-L407 | train |
DeepHorizons/iarm | iarm/arm_instructions/memory.py | Memory.STRB | def STRB(self, params):
"""
STRB Ra, [Rb, Rc]
STRB Ra, [Rb, #imm5]
Store Ra into memory as a byte
Ra, Rb, and Rc must be low registers
"""
Ra, Rb, Rc = self.get_three_parameters(self.THREE_PARAMETER_WITH_BRACKETS, params)
if self.is_immediate(Rc):
... | python | def STRB(self, params):
"""
STRB Ra, [Rb, Rc]
STRB Ra, [Rb, #imm5]
Store Ra into memory as a byte
Ra, Rb, and Rc must be low registers
"""
Ra, Rb, Rc = self.get_three_parameters(self.THREE_PARAMETER_WITH_BRACKETS, params)
if self.is_immediate(Rc):
... | [
"def",
"STRB",
"(",
"self",
",",
"params",
")",
":",
"Ra",
",",
"Rb",
",",
"Rc",
"=",
"self",
".",
"get_three_parameters",
"(",
"self",
".",
"THREE_PARAMETER_WITH_BRACKETS",
",",
"params",
")",
"if",
"self",
".",
"is_immediate",
"(",
"Rc",
")",
":",
"s... | STRB Ra, [Rb, Rc]
STRB Ra, [Rb, #imm5]
Store Ra into memory as a byte
Ra, Rb, and Rc must be low registers | [
"STRB",
"Ra",
"[",
"Rb",
"Rc",
"]",
"STRB",
"Ra",
"[",
"Rb",
"#imm5",
"]"
] | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/memory.py#L409-L430 | train |
DeepHorizons/iarm | iarm/arm_instructions/memory.py | Memory.STRH | def STRH(self, params):
"""
STRH Ra, [Rb, Rc]
STRH Ra, [Rb, #imm6_2]
Store Ra into memory as a half word
Ra, Rb, and Rc must be low registers
"""
Ra, Rb, Rc = self.get_three_parameters(self.THREE_PARAMETER_WITH_BRACKETS, params)
if self.is_immediate(Rc):... | python | def STRH(self, params):
"""
STRH Ra, [Rb, Rc]
STRH Ra, [Rb, #imm6_2]
Store Ra into memory as a half word
Ra, Rb, and Rc must be low registers
"""
Ra, Rb, Rc = self.get_three_parameters(self.THREE_PARAMETER_WITH_BRACKETS, params)
if self.is_immediate(Rc):... | [
"def",
"STRH",
"(",
"self",
",",
"params",
")",
":",
"Ra",
",",
"Rb",
",",
"Rc",
"=",
"self",
".",
"get_three_parameters",
"(",
"self",
".",
"THREE_PARAMETER_WITH_BRACKETS",
",",
"params",
")",
"if",
"self",
".",
"is_immediate",
"(",
"Rc",
")",
":",
"s... | STRH Ra, [Rb, Rc]
STRH Ra, [Rb, #imm6_2]
Store Ra into memory as a half word
Ra, Rb, and Rc must be low registers | [
"STRH",
"Ra",
"[",
"Rb",
"Rc",
"]",
"STRH",
"Ra",
"[",
"Rb",
"#imm6_2",
"]"
] | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/memory.py#L432-L455 | train |
glomex/gcdt | gcdt/kumo_start_stop.py | _stop_ec2_instances | def _stop_ec2_instances(awsclient, ec2_instances, wait=True):
"""Helper to stop ec2 instances.
By default it waits for instances to stop.
:param awsclient:
:param ec2_instances:
:param wait: waits for instances to stop
:return:
"""
if len(ec2_instances) == 0:
return
client_e... | python | def _stop_ec2_instances(awsclient, ec2_instances, wait=True):
"""Helper to stop ec2 instances.
By default it waits for instances to stop.
:param awsclient:
:param ec2_instances:
:param wait: waits for instances to stop
:return:
"""
if len(ec2_instances) == 0:
return
client_e... | [
"def",
"_stop_ec2_instances",
"(",
"awsclient",
",",
"ec2_instances",
",",
"wait",
"=",
"True",
")",
":",
"if",
"len",
"(",
"ec2_instances",
")",
"==",
"0",
":",
"return",
"client_ec2",
"=",
"awsclient",
".",
"get_client",
"(",
"'ec2'",
")",
"# get running i... | Helper to stop ec2 instances.
By default it waits for instances to stop.
:param awsclient:
:param ec2_instances:
:param wait: waits for instances to stop
:return: | [
"Helper",
"to",
"stop",
"ec2",
"instances",
".",
"By",
"default",
"it",
"waits",
"for",
"instances",
"to",
"stop",
"."
] | cd67cf416371337b83cb9ca3f696277125703339 | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/kumo_start_stop.py#L11-L44 | train |
glomex/gcdt | gcdt/kumo_start_stop.py | _start_ec2_instances | def _start_ec2_instances(awsclient, ec2_instances, wait=True):
"""Helper to start ec2 instances
:param awsclient:
:param ec2_instances:
:param wait: waits for instances to start
:return:
"""
if len(ec2_instances) == 0:
return
client_ec2 = awsclient.get_client('ec2')
# get s... | python | def _start_ec2_instances(awsclient, ec2_instances, wait=True):
"""Helper to start ec2 instances
:param awsclient:
:param ec2_instances:
:param wait: waits for instances to start
:return:
"""
if len(ec2_instances) == 0:
return
client_ec2 = awsclient.get_client('ec2')
# get s... | [
"def",
"_start_ec2_instances",
"(",
"awsclient",
",",
"ec2_instances",
",",
"wait",
"=",
"True",
")",
":",
"if",
"len",
"(",
"ec2_instances",
")",
"==",
"0",
":",
"return",
"client_ec2",
"=",
"awsclient",
".",
"get_client",
"(",
"'ec2'",
")",
"# get stopped ... | Helper to start ec2 instances
:param awsclient:
:param ec2_instances:
:param wait: waits for instances to start
:return: | [
"Helper",
"to",
"start",
"ec2",
"instances"
] | cd67cf416371337b83cb9ca3f696277125703339 | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/kumo_start_stop.py#L47-L85 | train |
glomex/gcdt | gcdt/kumo_start_stop.py | _filter_db_instances_by_status | def _filter_db_instances_by_status(awsclient, db_instances, status_list):
"""helper to select dbinstances.
:param awsclient:
:param db_instances:
:param status_list:
:return: list of db_instances that match the filter
"""
client_rds = awsclient.get_client('rds')
db_instances_with_status... | python | def _filter_db_instances_by_status(awsclient, db_instances, status_list):
"""helper to select dbinstances.
:param awsclient:
:param db_instances:
:param status_list:
:return: list of db_instances that match the filter
"""
client_rds = awsclient.get_client('rds')
db_instances_with_status... | [
"def",
"_filter_db_instances_by_status",
"(",
"awsclient",
",",
"db_instances",
",",
"status_list",
")",
":",
"client_rds",
"=",
"awsclient",
".",
"get_client",
"(",
"'rds'",
")",
"db_instances_with_status",
"=",
"[",
"]",
"for",
"db",
"in",
"db_instances",
":",
... | helper to select dbinstances.
:param awsclient:
:param db_instances:
:param status_list:
:return: list of db_instances that match the filter | [
"helper",
"to",
"select",
"dbinstances",
"."
] | cd67cf416371337b83cb9ca3f696277125703339 | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/kumo_start_stop.py#L88-L107 | train |
glomex/gcdt | gcdt/kumo_start_stop.py | _stop_ecs_services | def _stop_ecs_services(awsclient, services, template, parameters, wait=True):
"""Helper to change desiredCount of ECS services to zero.
By default it waits for this to complete.
Docs here: http://docs.aws.amazon.com/cli/latest/reference/ecs/update-service.html
:param awsclient:
:param services:
... | python | def _stop_ecs_services(awsclient, services, template, parameters, wait=True):
"""Helper to change desiredCount of ECS services to zero.
By default it waits for this to complete.
Docs here: http://docs.aws.amazon.com/cli/latest/reference/ecs/update-service.html
:param awsclient:
:param services:
... | [
"def",
"_stop_ecs_services",
"(",
"awsclient",
",",
"services",
",",
"template",
",",
"parameters",
",",
"wait",
"=",
"True",
")",
":",
"if",
"len",
"(",
"services",
")",
"==",
"0",
":",
"return",
"client_ecs",
"=",
"awsclient",
".",
"get_client",
"(",
"... | Helper to change desiredCount of ECS services to zero.
By default it waits for this to complete.
Docs here: http://docs.aws.amazon.com/cli/latest/reference/ecs/update-service.html
:param awsclient:
:param services:
:param template: the cloudformation template
:param parameters: the parameters u... | [
"Helper",
"to",
"change",
"desiredCount",
"of",
"ECS",
"services",
"to",
"zero",
".",
"By",
"default",
"it",
"waits",
"for",
"this",
"to",
"complete",
".",
"Docs",
"here",
":",
"http",
":",
"//",
"docs",
".",
"aws",
".",
"amazon",
".",
"com",
"/",
"c... | cd67cf416371337b83cb9ca3f696277125703339 | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/kumo_start_stop.py#L110-L136 | train |
glomex/gcdt | gcdt/kumo_start_stop.py | stop_stack | def stop_stack(awsclient, stack_name, use_suspend=False):
"""Stop an existing stack on AWS cloud.
:param awsclient:
:param stack_name:
:param use_suspend: use suspend and resume on the autoscaling group
:return: exit_code
"""
exit_code = 0
# check for DisableStop
#disable_stop = co... | python | def stop_stack(awsclient, stack_name, use_suspend=False):
"""Stop an existing stack on AWS cloud.
:param awsclient:
:param stack_name:
:param use_suspend: use suspend and resume on the autoscaling group
:return: exit_code
"""
exit_code = 0
# check for DisableStop
#disable_stop = co... | [
"def",
"stop_stack",
"(",
"awsclient",
",",
"stack_name",
",",
"use_suspend",
"=",
"False",
")",
":",
"exit_code",
"=",
"0",
"# check for DisableStop",
"#disable_stop = conf.get('deployment', {}).get('DisableStop', False)",
"#if disable_stop:",
"# log.warn('\\'DisableStop\\' i... | Stop an existing stack on AWS cloud.
:param awsclient:
:param stack_name:
:param use_suspend: use suspend and resume on the autoscaling group
:return: exit_code | [
"Stop",
"an",
"existing",
"stack",
"on",
"AWS",
"cloud",
"."
] | cd67cf416371337b83cb9ca3f696277125703339 | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/kumo_start_stop.py#L169-L284 | train |
glomex/gcdt | gcdt/kumo_start_stop.py | _get_autoscaling_min_max | def _get_autoscaling_min_max(template, parameters, asg_name):
"""Helper to extract the configured MinSize, MaxSize attributes from the
template.
:param template: cloudformation template (json)
:param parameters: list of {'ParameterKey': 'x1', 'ParameterValue': 'y1'}
:param asg_name: logical resourc... | python | def _get_autoscaling_min_max(template, parameters, asg_name):
"""Helper to extract the configured MinSize, MaxSize attributes from the
template.
:param template: cloudformation template (json)
:param parameters: list of {'ParameterKey': 'x1', 'ParameterValue': 'y1'}
:param asg_name: logical resourc... | [
"def",
"_get_autoscaling_min_max",
"(",
"template",
",",
"parameters",
",",
"asg_name",
")",
":",
"params",
"=",
"{",
"e",
"[",
"'ParameterKey'",
"]",
":",
"e",
"[",
"'ParameterValue'",
"]",
"for",
"e",
"in",
"parameters",
"}",
"asg",
"=",
"template",
".",... | Helper to extract the configured MinSize, MaxSize attributes from the
template.
:param template: cloudformation template (json)
:param parameters: list of {'ParameterKey': 'x1', 'ParameterValue': 'y1'}
:param asg_name: logical resource name of the autoscaling group
:return: MinSize, MaxSize | [
"Helper",
"to",
"extract",
"the",
"configured",
"MinSize",
"MaxSize",
"attributes",
"from",
"the",
"template",
"."
] | cd67cf416371337b83cb9ca3f696277125703339 | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/kumo_start_stop.py#L287-L307 | train |
glomex/gcdt | gcdt/kumo_start_stop.py | _get_service_cluster_desired_count | def _get_service_cluster_desired_count(template, parameters, service_name):
"""Helper to extract the configured desiredCount attribute from the
template.
:param template: cloudformation template (json)
:param parameters: list of {'ParameterKey': 'x1', 'ParameterValue': 'y1'}
:param service_name: lo... | python | def _get_service_cluster_desired_count(template, parameters, service_name):
"""Helper to extract the configured desiredCount attribute from the
template.
:param template: cloudformation template (json)
:param parameters: list of {'ParameterKey': 'x1', 'ParameterValue': 'y1'}
:param service_name: lo... | [
"def",
"_get_service_cluster_desired_count",
"(",
"template",
",",
"parameters",
",",
"service_name",
")",
":",
"params",
"=",
"{",
"e",
"[",
"'ParameterKey'",
"]",
":",
"e",
"[",
"'ParameterValue'",
"]",
"for",
"e",
"in",
"parameters",
"}",
"service",
"=",
... | Helper to extract the configured desiredCount attribute from the
template.
:param template: cloudformation template (json)
:param parameters: list of {'ParameterKey': 'x1', 'ParameterValue': 'y1'}
:param service_name: logical resource name of the ECS service
:return: cluster, desiredCount | [
"Helper",
"to",
"extract",
"the",
"configured",
"desiredCount",
"attribute",
"from",
"the",
"template",
"."
] | cd67cf416371337b83cb9ca3f696277125703339 | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/kumo_start_stop.py#L310-L329 | train |
glomex/gcdt | gcdt/kumo_start_stop.py | start_stack | def start_stack(awsclient, stack_name, use_suspend=False):
"""Start an existing stack on AWS cloud.
:param awsclient:
:param stack_name:
:param use_suspend: use suspend and resume on the autoscaling group
:return: exit_code
"""
exit_code = 0
# check for DisableStop
#disable_stop = ... | python | def start_stack(awsclient, stack_name, use_suspend=False):
"""Start an existing stack on AWS cloud.
:param awsclient:
:param stack_name:
:param use_suspend: use suspend and resume on the autoscaling group
:return: exit_code
"""
exit_code = 0
# check for DisableStop
#disable_stop = ... | [
"def",
"start_stack",
"(",
"awsclient",
",",
"stack_name",
",",
"use_suspend",
"=",
"False",
")",
":",
"exit_code",
"=",
"0",
"# check for DisableStop",
"#disable_stop = conf.get('deployment', {}).get('DisableStop', False)",
"#if disable_stop:",
"# log.warn('\\'DisableStop\\' ... | Start an existing stack on AWS cloud.
:param awsclient:
:param stack_name:
:param use_suspend: use suspend and resume on the autoscaling group
:return: exit_code | [
"Start",
"an",
"existing",
"stack",
"on",
"AWS",
"cloud",
"."
] | cd67cf416371337b83cb9ca3f696277125703339 | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/kumo_start_stop.py#L348-L455 | train |
gmr/helper | helper/controller.py | Controller.is_running | def is_running(self):
"""Property method that returns a bool specifying if the process is
currently running. This will return true if the state is active, idle
or initializing.
:rtype: bool
"""
return self._state in [self.STATE_ACTIVE,
sel... | python | def is_running(self):
"""Property method that returns a bool specifying if the process is
currently running. This will return true if the state is active, idle
or initializing.
:rtype: bool
"""
return self._state in [self.STATE_ACTIVE,
sel... | [
"def",
"is_running",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state",
"in",
"[",
"self",
".",
"STATE_ACTIVE",
",",
"self",
".",
"STATE_IDLE",
",",
"self",
".",
"STATE_INITIALIZING",
"]"
] | Property method that returns a bool specifying if the process is
currently running. This will return true if the state is active, idle
or initializing.
:rtype: bool | [
"Property",
"method",
"that",
"returns",
"a",
"bool",
"specifying",
"if",
"the",
"process",
"is",
"currently",
"running",
".",
"This",
"will",
"return",
"true",
"if",
"the",
"state",
"is",
"active",
"idle",
"or",
"initializing",
"."
] | fe8e45fc8eabf619429b2940c682c252ee33c082 | https://github.com/gmr/helper/blob/fe8e45fc8eabf619429b2940c682c252ee33c082/helper/controller.py#L143-L153 | train |
gmr/helper | helper/controller.py | Controller.process_signal | def process_signal(self, signum):
"""Invoked whenever a signal is added to the stack.
:param int signum: The signal that was added
"""
if signum == signal.SIGTERM:
LOGGER.info('Received SIGTERM, initiating shutdown')
self.stop()
elif signum == signal.SIG... | python | def process_signal(self, signum):
"""Invoked whenever a signal is added to the stack.
:param int signum: The signal that was added
"""
if signum == signal.SIGTERM:
LOGGER.info('Received SIGTERM, initiating shutdown')
self.stop()
elif signum == signal.SIG... | [
"def",
"process_signal",
"(",
"self",
",",
"signum",
")",
":",
"if",
"signum",
"==",
"signal",
".",
"SIGTERM",
":",
"LOGGER",
".",
"info",
"(",
"'Received SIGTERM, initiating shutdown'",
")",
"self",
".",
"stop",
"(",
")",
"elif",
"signum",
"==",
"signal",
... | Invoked whenever a signal is added to the stack.
:param int signum: The signal that was added | [
"Invoked",
"whenever",
"a",
"signal",
"is",
"added",
"to",
"the",
"stack",
"."
] | fe8e45fc8eabf619429b2940c682c252ee33c082 | https://github.com/gmr/helper/blob/fe8e45fc8eabf619429b2940c682c252ee33c082/helper/controller.py#L225-L243 | train |
gmr/helper | helper/controller.py | Controller.run | def run(self):
"""The core method for starting the application. Will setup logging,
toggle the runtime state flag, block on loop, then call shutdown.
Redefine this method if you intend to use an IO Loop or some other
long running process.
"""
LOGGER.info('%s v%s started... | python | def run(self):
"""The core method for starting the application. Will setup logging,
toggle the runtime state flag, block on loop, then call shutdown.
Redefine this method if you intend to use an IO Loop or some other
long running process.
"""
LOGGER.info('%s v%s started... | [
"def",
"run",
"(",
"self",
")",
":",
"LOGGER",
".",
"info",
"(",
"'%s v%s started'",
",",
"self",
".",
"APPNAME",
",",
"self",
".",
"VERSION",
")",
"self",
".",
"setup",
"(",
")",
"while",
"not",
"any",
"(",
"[",
"self",
".",
"is_stopping",
",",
"s... | The core method for starting the application. Will setup logging,
toggle the runtime state flag, block on loop, then call shutdown.
Redefine this method if you intend to use an IO Loop or some other
long running process. | [
"The",
"core",
"method",
"for",
"starting",
"the",
"application",
".",
"Will",
"setup",
"logging",
"toggle",
"the",
"runtime",
"state",
"flag",
"block",
"on",
"loop",
"then",
"call",
"shutdown",
"."
] | fe8e45fc8eabf619429b2940c682c252ee33c082 | https://github.com/gmr/helper/blob/fe8e45fc8eabf619429b2940c682c252ee33c082/helper/controller.py#L245-L266 | train |
gmr/helper | helper/controller.py | Controller.start | def start(self):
"""Important:
Do not extend this method, rather redefine Controller.run
"""
for signum in [signal.SIGHUP, signal.SIGTERM,
signal.SIGUSR1, signal.SIGUSR2]:
signal.signal(signum, self._on_signal)
self.run() | python | def start(self):
"""Important:
Do not extend this method, rather redefine Controller.run
"""
for signum in [signal.SIGHUP, signal.SIGTERM,
signal.SIGUSR1, signal.SIGUSR2]:
signal.signal(signum, self._on_signal)
self.run() | [
"def",
"start",
"(",
"self",
")",
":",
"for",
"signum",
"in",
"[",
"signal",
".",
"SIGHUP",
",",
"signal",
".",
"SIGTERM",
",",
"signal",
".",
"SIGUSR1",
",",
"signal",
".",
"SIGUSR2",
"]",
":",
"signal",
".",
"signal",
"(",
"signum",
",",
"self",
... | Important:
Do not extend this method, rather redefine Controller.run | [
"Important",
":"
] | fe8e45fc8eabf619429b2940c682c252ee33c082 | https://github.com/gmr/helper/blob/fe8e45fc8eabf619429b2940c682c252ee33c082/helper/controller.py#L268-L277 | train |
gmr/helper | helper/controller.py | Controller.set_state | def set_state(self, state):
"""Set the runtime state of the Controller. Use the internal constants
to ensure proper state values:
- :attr:`Controller.STATE_INITIALIZING`
- :attr:`Controller.STATE_ACTIVE`
- :attr:`Controller.STATE_IDLE`
- :attr:`Controller.STATE_SLEEPING`... | python | def set_state(self, state):
"""Set the runtime state of the Controller. Use the internal constants
to ensure proper state values:
- :attr:`Controller.STATE_INITIALIZING`
- :attr:`Controller.STATE_ACTIVE`
- :attr:`Controller.STATE_IDLE`
- :attr:`Controller.STATE_SLEEPING`... | [
"def",
"set_state",
"(",
"self",
",",
"state",
")",
":",
"if",
"state",
"==",
"self",
".",
"_state",
":",
"return",
"elif",
"state",
"not",
"in",
"self",
".",
"_STATES",
".",
"keys",
"(",
")",
":",
"raise",
"ValueError",
"(",
"'Invalid state {}'",
".",... | Set the runtime state of the Controller. Use the internal constants
to ensure proper state values:
- :attr:`Controller.STATE_INITIALIZING`
- :attr:`Controller.STATE_ACTIVE`
- :attr:`Controller.STATE_IDLE`
- :attr:`Controller.STATE_SLEEPING`
- :attr:`Controller.STATE_STOP... | [
"Set",
"the",
"runtime",
"state",
"of",
"the",
"Controller",
".",
"Use",
"the",
"internal",
"constants",
"to",
"ensure",
"proper",
"state",
"values",
":"
] | fe8e45fc8eabf619429b2940c682c252ee33c082 | https://github.com/gmr/helper/blob/fe8e45fc8eabf619429b2940c682c252ee33c082/helper/controller.py#L279-L332 | train |
gmr/helper | helper/controller.py | Controller.stop | def stop(self):
"""Override to implement shutdown steps."""
LOGGER.info('Attempting to stop the process')
self.set_state(self.STATE_STOP_REQUESTED)
# Call shutdown for classes to add shutdown steps
self.shutdown()
# Wait for the current run to finish
while self.... | python | def stop(self):
"""Override to implement shutdown steps."""
LOGGER.info('Attempting to stop the process')
self.set_state(self.STATE_STOP_REQUESTED)
# Call shutdown for classes to add shutdown steps
self.shutdown()
# Wait for the current run to finish
while self.... | [
"def",
"stop",
"(",
"self",
")",
":",
"LOGGER",
".",
"info",
"(",
"'Attempting to stop the process'",
")",
"self",
".",
"set_state",
"(",
"self",
".",
"STATE_STOP_REQUESTED",
")",
"# Call shutdown for classes to add shutdown steps",
"self",
".",
"shutdown",
"(",
")"... | Override to implement shutdown steps. | [
"Override",
"to",
"implement",
"shutdown",
"steps",
"."
] | fe8e45fc8eabf619429b2940c682c252ee33c082 | https://github.com/gmr/helper/blob/fe8e45fc8eabf619429b2940c682c252ee33c082/helper/controller.py#L342-L363 | train |
glomex/gcdt | gcdt/servicediscovery.py | parse_ts | def parse_ts(ts):
"""
parse timestamp.
:param ts: timestamp in ISO8601 format
:return: tbd!!!
"""
# ISO8601 = '%Y-%m-%dT%H:%M:%SZ'
# ISO8601_MS = '%Y-%m-%dT%H:%M:%S.%fZ'
# RFC1123 = '%a, %d %b %Y %H:%M:%S %Z'
dt = maya.parse(ts.strip())
return dt.datetime(naive=True) | python | def parse_ts(ts):
"""
parse timestamp.
:param ts: timestamp in ISO8601 format
:return: tbd!!!
"""
# ISO8601 = '%Y-%m-%dT%H:%M:%SZ'
# ISO8601_MS = '%Y-%m-%dT%H:%M:%S.%fZ'
# RFC1123 = '%a, %d %b %Y %H:%M:%S %Z'
dt = maya.parse(ts.strip())
return dt.datetime(naive=True) | [
"def",
"parse_ts",
"(",
"ts",
")",
":",
"# ISO8601 = '%Y-%m-%dT%H:%M:%SZ'",
"# ISO8601_MS = '%Y-%m-%dT%H:%M:%S.%fZ'",
"# RFC1123 = '%a, %d %b %Y %H:%M:%S %Z'",
"dt",
"=",
"maya",
".",
"parse",
"(",
"ts",
".",
"strip",
"(",
")",
")",
"return",
"dt",
".",
"datetime",
... | parse timestamp.
:param ts: timestamp in ISO8601 format
:return: tbd!!! | [
"parse",
"timestamp",
".",
":",
"param",
"ts",
":",
"timestamp",
"in",
"ISO8601",
"format",
":",
"return",
":",
"tbd!!!"
] | cd67cf416371337b83cb9ca3f696277125703339 | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/servicediscovery.py#L18-L29 | train |
glomex/gcdt | gcdt/servicediscovery.py | get_outputs_for_stack | def get_outputs_for_stack(awsclient, stack_name):
"""
Read environment from ENV and mangle it to a (lower case) representation
Note: gcdt.servicediscovery get_outputs_for_stack((awsclient, stack_name)
is used in many cloudformation.py templates!
:param awsclient:
:param stack_name:
:return:... | python | def get_outputs_for_stack(awsclient, stack_name):
"""
Read environment from ENV and mangle it to a (lower case) representation
Note: gcdt.servicediscovery get_outputs_for_stack((awsclient, stack_name)
is used in many cloudformation.py templates!
:param awsclient:
:param stack_name:
:return:... | [
"def",
"get_outputs_for_stack",
"(",
"awsclient",
",",
"stack_name",
")",
":",
"client_cf",
"=",
"awsclient",
".",
"get_client",
"(",
"'cloudformation'",
")",
"response",
"=",
"client_cf",
".",
"describe_stacks",
"(",
"StackName",
"=",
"stack_name",
")",
"if",
"... | Read environment from ENV and mangle it to a (lower case) representation
Note: gcdt.servicediscovery get_outputs_for_stack((awsclient, stack_name)
is used in many cloudformation.py templates!
:param awsclient:
:param stack_name:
:return: dictionary containing the stack outputs | [
"Read",
"environment",
"from",
"ENV",
"and",
"mangle",
"it",
"to",
"a",
"(",
"lower",
"case",
")",
"representation",
"Note",
":",
"gcdt",
".",
"servicediscovery",
"get_outputs_for_stack",
"((",
"awsclient",
"stack_name",
")",
"is",
"used",
"in",
"many",
"cloud... | cd67cf416371337b83cb9ca3f696277125703339 | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/servicediscovery.py#L33-L49 | train |
glomex/gcdt | gcdt/servicediscovery.py | get_base_ami | def get_base_ami(awsclient, owners):
"""
DEPRECATED!!!
return the latest version of our base AMI
we can't use tags for this, so we have only the name as resource
note: this functionality is deprecated since this only works for "old"
baseami.
"""
client_ec2 = awsclient.get_client('ec2')
... | python | def get_base_ami(awsclient, owners):
"""
DEPRECATED!!!
return the latest version of our base AMI
we can't use tags for this, so we have only the name as resource
note: this functionality is deprecated since this only works for "old"
baseami.
"""
client_ec2 = awsclient.get_client('ec2')
... | [
"def",
"get_base_ami",
"(",
"awsclient",
",",
"owners",
")",
":",
"client_ec2",
"=",
"awsclient",
".",
"get_client",
"(",
"'ec2'",
")",
"image_filter",
"=",
"[",
"{",
"'Name'",
":",
"'state'",
",",
"'Values'",
":",
"[",
"'available'",
",",
"]",
"}",
",",... | DEPRECATED!!!
return the latest version of our base AMI
we can't use tags for this, so we have only the name as resource
note: this functionality is deprecated since this only works for "old"
baseami. | [
"DEPRECATED!!!",
"return",
"the",
"latest",
"version",
"of",
"our",
"base",
"AMI",
"we",
"can",
"t",
"use",
"tags",
"for",
"this",
"so",
"we",
"have",
"only",
"the",
"name",
"as",
"resource",
"note",
":",
"this",
"functionality",
"is",
"deprecated",
"since... | cd67cf416371337b83cb9ca3f696277125703339 | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/servicediscovery.py#L71-L107 | train |
gmr/helper | helper/parser.py | _add_default_arguments | def _add_default_arguments(parser):
"""Add the default arguments to the parser.
:param argparse.ArgumentParser parser: The argument parser
"""
parser.add_argument('-c', '--config', action='store', dest='config',
help='Path to the configuration file')
parser.add_argument('-f... | python | def _add_default_arguments(parser):
"""Add the default arguments to the parser.
:param argparse.ArgumentParser parser: The argument parser
"""
parser.add_argument('-c', '--config', action='store', dest='config',
help='Path to the configuration file')
parser.add_argument('-f... | [
"def",
"_add_default_arguments",
"(",
"parser",
")",
":",
"parser",
".",
"add_argument",
"(",
"'-c'",
",",
"'--config'",
",",
"action",
"=",
"'store'",
",",
"dest",
"=",
"'config'",
",",
"help",
"=",
"'Path to the configuration file'",
")",
"parser",
".",
"add... | Add the default arguments to the parser.
:param argparse.ArgumentParser parser: The argument parser | [
"Add",
"the",
"default",
"arguments",
"to",
"the",
"parser",
"."
] | fe8e45fc8eabf619429b2940c682c252ee33c082 | https://github.com/gmr/helper/blob/fe8e45fc8eabf619429b2940c682c252ee33c082/helper/parser.py#L62-L71 | train |
valhallasw/flask-mwoauth | flask_mwoauth/__init__.py | _str | def _str(val):
"""
Ensures that the val is the default str() type for python2 or 3
"""
if str == bytes:
if isinstance(val, str):
return val
else:
return str(val)
else:
if isinstance(val, str):
return val
else:
return str... | python | def _str(val):
"""
Ensures that the val is the default str() type for python2 or 3
"""
if str == bytes:
if isinstance(val, str):
return val
else:
return str(val)
else:
if isinstance(val, str):
return val
else:
return str... | [
"def",
"_str",
"(",
"val",
")",
":",
"if",
"str",
"==",
"bytes",
":",
"if",
"isinstance",
"(",
"val",
",",
"str",
")",
":",
"return",
"val",
"else",
":",
"return",
"str",
"(",
"val",
")",
"else",
":",
"if",
"isinstance",
"(",
"val",
",",
"str",
... | Ensures that the val is the default str() type for python2 or 3 | [
"Ensures",
"that",
"the",
"val",
"is",
"the",
"default",
"str",
"()",
"type",
"for",
"python2",
"or",
"3"
] | 216aa9c1ead07d99a9e11deb7642e33a70aa59d7 | https://github.com/valhallasw/flask-mwoauth/blob/216aa9c1ead07d99a9e11deb7642e33a70aa59d7/flask_mwoauth/__init__.py#L174-L187 | train |
valhallasw/flask-mwoauth | flask_mwoauth/__init__.py | MWOAuth._prepare_long_request | def _prepare_long_request(self, url, api_query):
"""
Use requests.Request and requests.PreparedRequest to produce the
body (and boundary value) of a multipart/form-data; POST request as
detailed in https://www.mediawiki.org/wiki/API:Edit#Large_texts
"""
partlist = []
... | python | def _prepare_long_request(self, url, api_query):
"""
Use requests.Request and requests.PreparedRequest to produce the
body (and boundary value) of a multipart/form-data; POST request as
detailed in https://www.mediawiki.org/wiki/API:Edit#Large_texts
"""
partlist = []
... | [
"def",
"_prepare_long_request",
"(",
"self",
",",
"url",
",",
"api_query",
")",
":",
"partlist",
"=",
"[",
"]",
"for",
"k",
",",
"v",
"in",
"iteritems",
"(",
"api_query",
")",
":",
"if",
"k",
"in",
"(",
"'title'",
",",
"'text'",
",",
"'summary'",
")"... | Use requests.Request and requests.PreparedRequest to produce the
body (and boundary value) of a multipart/form-data; POST request as
detailed in https://www.mediawiki.org/wiki/API:Edit#Large_texts | [
"Use",
"requests",
".",
"Request",
"and",
"requests",
".",
"PreparedRequest",
"to",
"produce",
"the",
"body",
"(",
"and",
"boundary",
"value",
")",
"of",
"a",
"multipart",
"/",
"form",
"-",
"data",
";",
"POST",
"request",
"as",
"detailed",
"in",
"https",
... | 216aa9c1ead07d99a9e11deb7642e33a70aa59d7 | https://github.com/valhallasw/flask-mwoauth/blob/216aa9c1ead07d99a9e11deb7642e33a70aa59d7/flask_mwoauth/__init__.py#L93-L122 | train |
valhallasw/flask-mwoauth | flask_mwoauth/__init__.py | MWOAuth.request | def request(self, api_query, url=None):
"""
e.g. {'action': 'query', 'meta': 'userinfo'}. format=json not required
function returns a python dict that resembles the api's json response
"""
api_query['format'] = 'json'
if url is not None:
api_url = url + "/api.... | python | def request(self, api_query, url=None):
"""
e.g. {'action': 'query', 'meta': 'userinfo'}. format=json not required
function returns a python dict that resembles the api's json response
"""
api_query['format'] = 'json'
if url is not None:
api_url = url + "/api.... | [
"def",
"request",
"(",
"self",
",",
"api_query",
",",
"url",
"=",
"None",
")",
":",
"api_query",
"[",
"'format'",
"]",
"=",
"'json'",
"if",
"url",
"is",
"not",
"None",
":",
"api_url",
"=",
"url",
"+",
"\"/api.php\"",
"else",
":",
"api_url",
"=",
"sel... | e.g. {'action': 'query', 'meta': 'userinfo'}. format=json not required
function returns a python dict that resembles the api's json response | [
"e",
".",
"g",
".",
"{",
"action",
":",
"query",
"meta",
":",
"userinfo",
"}",
".",
"format",
"=",
"json",
"not",
"required",
"function",
"returns",
"a",
"python",
"dict",
"that",
"resembles",
"the",
"api",
"s",
"json",
"response"
] | 216aa9c1ead07d99a9e11deb7642e33a70aa59d7 | https://github.com/valhallasw/flask-mwoauth/blob/216aa9c1ead07d99a9e11deb7642e33a70aa59d7/flask_mwoauth/__init__.py#L124-L158 | train |
CitrineInformatics/pypif | pypif/pif.py | dump | def dump(pif, fp, **kwargs):
"""
Convert a single Physical Information Object, or a list of such objects, into a JSON-encoded text file.
:param pif: Object or list of objects to serialize.
:param fp: File-like object supporting .write() method to write the serialized object(s) to.
:param kwargs: An... | python | def dump(pif, fp, **kwargs):
"""
Convert a single Physical Information Object, or a list of such objects, into a JSON-encoded text file.
:param pif: Object or list of objects to serialize.
:param fp: File-like object supporting .write() method to write the serialized object(s) to.
:param kwargs: An... | [
"def",
"dump",
"(",
"pif",
",",
"fp",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"json",
".",
"dump",
"(",
"pif",
",",
"fp",
",",
"cls",
"=",
"PifEncoder",
",",
"*",
"*",
"kwargs",
")"
] | Convert a single Physical Information Object, or a list of such objects, into a JSON-encoded text file.
:param pif: Object or list of objects to serialize.
:param fp: File-like object supporting .write() method to write the serialized object(s) to.
:param kwargs: Any options available to json.dump(). | [
"Convert",
"a",
"single",
"Physical",
"Information",
"Object",
"or",
"a",
"list",
"of",
"such",
"objects",
"into",
"a",
"JSON",
"-",
"encoded",
"text",
"file",
"."
] | 938348a8ff7b10b330770cccaaeb2109922f681b | https://github.com/CitrineInformatics/pypif/blob/938348a8ff7b10b330770cccaaeb2109922f681b/pypif/pif.py#L8-L16 | train |
CitrineInformatics/pypif | pypif/pif.py | load | def load(fp, class_=None, **kwargs):
"""
Convert content in a JSON-encoded text file to a Physical Information Object or a list of such objects.
:param fp: File-like object supporting .read() method to deserialize from.
:param class_: Subclass of :class:`.Pio` to produce, if not unambiguous
:param ... | python | def load(fp, class_=None, **kwargs):
"""
Convert content in a JSON-encoded text file to a Physical Information Object or a list of such objects.
:param fp: File-like object supporting .read() method to deserialize from.
:param class_: Subclass of :class:`.Pio` to produce, if not unambiguous
:param ... | [
"def",
"load",
"(",
"fp",
",",
"class_",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"loado",
"(",
"json",
".",
"load",
"(",
"fp",
",",
"*",
"*",
"kwargs",
")",
",",
"class_",
"=",
"class_",
")"
] | Convert content in a JSON-encoded text file to a Physical Information Object or a list of such objects.
:param fp: File-like object supporting .read() method to deserialize from.
:param class_: Subclass of :class:`.Pio` to produce, if not unambiguous
:param kwargs: Any options available to json.load().
... | [
"Convert",
"content",
"in",
"a",
"JSON",
"-",
"encoded",
"text",
"file",
"to",
"a",
"Physical",
"Information",
"Object",
"or",
"a",
"list",
"of",
"such",
"objects",
"."
] | 938348a8ff7b10b330770cccaaeb2109922f681b | https://github.com/CitrineInformatics/pypif/blob/938348a8ff7b10b330770cccaaeb2109922f681b/pypif/pif.py#L29-L38 | train |
CitrineInformatics/pypif | pypif/pif.py | loads | def loads(s, class_=None, **kwargs):
"""
Convert content in a JSON-encoded string to a Physical Information Object or a list of such objects.
:param s: String to deserialize.
:param class_: Subclass of :class:`.Pio` to produce, if not unambiguous
:param kwargs: Any options available to json.loads()... | python | def loads(s, class_=None, **kwargs):
"""
Convert content in a JSON-encoded string to a Physical Information Object or a list of such objects.
:param s: String to deserialize.
:param class_: Subclass of :class:`.Pio` to produce, if not unambiguous
:param kwargs: Any options available to json.loads()... | [
"def",
"loads",
"(",
"s",
",",
"class_",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"loado",
"(",
"json",
".",
"loads",
"(",
"s",
",",
"*",
"*",
"kwargs",
")",
",",
"class_",
"=",
"class_",
")"
] | Convert content in a JSON-encoded string to a Physical Information Object or a list of such objects.
:param s: String to deserialize.
:param class_: Subclass of :class:`.Pio` to produce, if not unambiguous
:param kwargs: Any options available to json.loads().
:return: Single object derived from :class:... | [
"Convert",
"content",
"in",
"a",
"JSON",
"-",
"encoded",
"string",
"to",
"a",
"Physical",
"Information",
"Object",
"or",
"a",
"list",
"of",
"such",
"objects",
"."
] | 938348a8ff7b10b330770cccaaeb2109922f681b | https://github.com/CitrineInformatics/pypif/blob/938348a8ff7b10b330770cccaaeb2109922f681b/pypif/pif.py#L41-L50 | train |
CitrineInformatics/pypif | pypif/pif.py | loado | def loado(obj, class_=None):
"""
Convert a dictionary or a list of dictionaries into a single Physical Information Object or a list of such objects.
:param obj: Dictionary or list to convert to Physical Information Objects.
:param class_: Subclass of :class:`.Pio` to produce, if not unambiguous
:re... | python | def loado(obj, class_=None):
"""
Convert a dictionary or a list of dictionaries into a single Physical Information Object or a list of such objects.
:param obj: Dictionary or list to convert to Physical Information Objects.
:param class_: Subclass of :class:`.Pio` to produce, if not unambiguous
:re... | [
"def",
"loado",
"(",
"obj",
",",
"class_",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"list",
")",
":",
"return",
"[",
"_dict_to_pio",
"(",
"i",
",",
"class_",
"=",
"class_",
")",
"for",
"i",
"in",
"obj",
"]",
"elif",
"isinstance",... | Convert a dictionary or a list of dictionaries into a single Physical Information Object or a list of such objects.
:param obj: Dictionary or list to convert to Physical Information Objects.
:param class_: Subclass of :class:`.Pio` to produce, if not unambiguous
:return: Single object derived from :class:`... | [
"Convert",
"a",
"dictionary",
"or",
"a",
"list",
"of",
"dictionaries",
"into",
"a",
"single",
"Physical",
"Information",
"Object",
"or",
"a",
"list",
"of",
"such",
"objects",
"."
] | 938348a8ff7b10b330770cccaaeb2109922f681b | https://github.com/CitrineInformatics/pypif/blob/938348a8ff7b10b330770cccaaeb2109922f681b/pypif/pif.py#L53-L66 | train |
CitrineInformatics/pypif | pypif/pif.py | _dict_to_pio | def _dict_to_pio(d, class_=None):
"""
Convert a single dictionary object to a Physical Information Object.
:param d: Dictionary to convert.
:param class_: Subclass of :class:`.Pio` to produce, if not unambiguous
:return: Single object derived from :class:`.Pio`.
"""
d = keys_to_snake_case(d... | python | def _dict_to_pio(d, class_=None):
"""
Convert a single dictionary object to a Physical Information Object.
:param d: Dictionary to convert.
:param class_: Subclass of :class:`.Pio` to produce, if not unambiguous
:return: Single object derived from :class:`.Pio`.
"""
d = keys_to_snake_case(d... | [
"def",
"_dict_to_pio",
"(",
"d",
",",
"class_",
"=",
"None",
")",
":",
"d",
"=",
"keys_to_snake_case",
"(",
"d",
")",
"if",
"class_",
":",
"return",
"class_",
"(",
"*",
"*",
"d",
")",
"if",
"'category'",
"not",
"in",
"d",
":",
"raise",
"ValueError",
... | Convert a single dictionary object to a Physical Information Object.
:param d: Dictionary to convert.
:param class_: Subclass of :class:`.Pio` to produce, if not unambiguous
:return: Single object derived from :class:`.Pio`. | [
"Convert",
"a",
"single",
"dictionary",
"object",
"to",
"a",
"Physical",
"Information",
"Object",
"."
] | 938348a8ff7b10b330770cccaaeb2109922f681b | https://github.com/CitrineInformatics/pypif/blob/938348a8ff7b10b330770cccaaeb2109922f681b/pypif/pif.py#L69-L90 | train |
glomex/gcdt | gcdt/gcdt_cmd_dispatcher.py | get_command | def get_command(arguments):
"""Utility function to extract command from docopt arguments.
:param arguments:
:return: command
"""
cmds = list(filter(lambda k: not (k.startswith('-') or
k.startswith('<')) and arguments[k],
arguments.keys()))
if l... | python | def get_command(arguments):
"""Utility function to extract command from docopt arguments.
:param arguments:
:return: command
"""
cmds = list(filter(lambda k: not (k.startswith('-') or
k.startswith('<')) and arguments[k],
arguments.keys()))
if l... | [
"def",
"get_command",
"(",
"arguments",
")",
":",
"cmds",
"=",
"list",
"(",
"filter",
"(",
"lambda",
"k",
":",
"not",
"(",
"k",
".",
"startswith",
"(",
"'-'",
")",
"or",
"k",
".",
"startswith",
"(",
"'<'",
")",
")",
"and",
"arguments",
"[",
"k",
... | Utility function to extract command from docopt arguments.
:param arguments:
:return: command | [
"Utility",
"function",
"to",
"extract",
"command",
"from",
"docopt",
"arguments",
"."
] | cd67cf416371337b83cb9ca3f696277125703339 | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/gcdt_cmd_dispatcher.py#L101-L112 | train |
glomex/gcdt | gcdt/gcdt_cmd_dispatcher.py | cmd.dispatch | def dispatch(cls, arguments, **kwargs):
"""Dispatch arguments parsed by docopt to the cmd with matching spec.
:param arguments:
:param kwargs:
:return: exit_code
"""
# first match wins
# spec: all '-' elements must match, all others are False;
# '<s... | python | def dispatch(cls, arguments, **kwargs):
"""Dispatch arguments parsed by docopt to the cmd with matching spec.
:param arguments:
:param kwargs:
:return: exit_code
"""
# first match wins
# spec: all '-' elements must match, all others are False;
# '<s... | [
"def",
"dispatch",
"(",
"cls",
",",
"arguments",
",",
"*",
"*",
"kwargs",
")",
":",
"# first match wins",
"# spec: all '-' elements must match, all others are False;",
"# '<sth>' elements are converted to call args on order of",
"# appearance",
"#",
"# kwargs are provid... | Dispatch arguments parsed by docopt to the cmd with matching spec.
:param arguments:
:param kwargs:
:return: exit_code | [
"Dispatch",
"arguments",
"parsed",
"by",
"docopt",
"to",
"the",
"cmd",
"with",
"matching",
"spec",
"."
] | cd67cf416371337b83cb9ca3f696277125703339 | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/gcdt_cmd_dispatcher.py#L42-L98 | train |
glomex/gcdt | gcdt/kumo_util.py | StackLookup.get_att | def get_att(self, parameter, as_reference=True):
"""Retrieves an attribute from an existing stack
:param parameter: The output parameter which should be retrieved
:param as_reference: Is the parameter a reference (Default) or a string
:return: Value of parameter to retrieve
"""
... | python | def get_att(self, parameter, as_reference=True):
"""Retrieves an attribute from an existing stack
:param parameter: The output parameter which should be retrieved
:param as_reference: Is the parameter a reference (Default) or a string
:return: Value of parameter to retrieve
"""
... | [
"def",
"get_att",
"(",
"self",
",",
"parameter",
",",
"as_reference",
"=",
"True",
")",
":",
"if",
"as_reference",
":",
"return",
"troposphere",
".",
"GetAtt",
"(",
"self",
".",
"__custom_stack_obj",
",",
"troposphere",
".",
"Ref",
"(",
"parameter",
")",
"... | Retrieves an attribute from an existing stack
:param parameter: The output parameter which should be retrieved
:param as_reference: Is the parameter a reference (Default) or a string
:return: Value of parameter to retrieve | [
"Retrieves",
"an",
"attribute",
"from",
"an",
"existing",
"stack",
":",
"param",
"parameter",
":",
"The",
"output",
"parameter",
"which",
"should",
"be",
"retrieved",
":",
"param",
"as_reference",
":",
"Is",
"the",
"parameter",
"a",
"reference",
"(",
"Default"... | cd67cf416371337b83cb9ca3f696277125703339 | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/kumo_util.py#L64-L79 | train |
glomex/gcdt | gcdt/event_source/s3.py | S3EventSource._get_notification_spec | def _get_notification_spec(self, lambda_arn):
lambda_name = base.get_lambda_name(lambda_arn)
notification_spec = {
'Id': self._make_notification_id(lambda_name),
'Events': [e for e in self._config['events']],
'LambdaFunctionArn': lambda_arn
}
# Add S3... | python | def _get_notification_spec(self, lambda_arn):
lambda_name = base.get_lambda_name(lambda_arn)
notification_spec = {
'Id': self._make_notification_id(lambda_name),
'Events': [e for e in self._config['events']],
'LambdaFunctionArn': lambda_arn
}
# Add S3... | [
"def",
"_get_notification_spec",
"(",
"self",
",",
"lambda_arn",
")",
":",
"lambda_name",
"=",
"base",
".",
"get_lambda_name",
"(",
"lambda_arn",
")",
"notification_spec",
"=",
"{",
"'Id'",
":",
"self",
".",
"_make_notification_id",
"(",
"lambda_name",
")",
",",... | if 'key_filters' in self._config:
filters_spec = {'Key': {'FilterRules': [] } }
# I do not think this is a useful structure:
for filter in self._config['key_filters']:
if 'type' in filter and 'value' in filter and filter['type'] in ('prefix', 'suffix'):
... | [
"if",
"key_filters",
"in",
"self",
".",
"_config",
":",
"filters_spec",
"=",
"{",
"Key",
":",
"{",
"FilterRules",
":",
"[]",
"}",
"}",
"#",
"I",
"do",
"not",
"think",
"this",
"is",
"a",
"useful",
"structure",
":",
"for",
"filter",
"in",
"self",
".",
... | cd67cf416371337b83cb9ca3f696277125703339 | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/event_source/s3.py#L51-L80 | train |
DeepHorizons/iarm | iarm_kernel/iarmkernel.py | ArmKernel.convert_representation | def convert_representation(self, i):
"""
Return the proper representation for the given integer
"""
if self.number_representation == 'unsigned':
return i
elif self.number_representation == 'signed':
if i & (1 << self.interpreter._bit_width - 1):
... | python | def convert_representation(self, i):
"""
Return the proper representation for the given integer
"""
if self.number_representation == 'unsigned':
return i
elif self.number_representation == 'signed':
if i & (1 << self.interpreter._bit_width - 1):
... | [
"def",
"convert_representation",
"(",
"self",
",",
"i",
")",
":",
"if",
"self",
".",
"number_representation",
"==",
"'unsigned'",
":",
"return",
"i",
"elif",
"self",
".",
"number_representation",
"==",
"'signed'",
":",
"if",
"i",
"&",
"(",
"1",
"<<",
"self... | Return the proper representation for the given integer | [
"Return",
"the",
"proper",
"representation",
"for",
"the",
"given",
"integer"
] | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm_kernel/iarmkernel.py#L40-L52 | train |
DeepHorizons/iarm | iarm_kernel/iarmkernel.py | ArmKernel.magic_generate_random | def magic_generate_random(self, line):
"""
Set the generate random flag, unset registers and memory will return a random value.
Usage:
Call the magic by itself or with `true` to have registers and memory return a random value
if they are unset and read from, much like how real h... | python | def magic_generate_random(self, line):
"""
Set the generate random flag, unset registers and memory will return a random value.
Usage:
Call the magic by itself or with `true` to have registers and memory return a random value
if they are unset and read from, much like how real h... | [
"def",
"magic_generate_random",
"(",
"self",
",",
"line",
")",
":",
"line",
"=",
"line",
".",
"strip",
"(",
")",
".",
"lower",
"(",
")",
"if",
"not",
"line",
"or",
"line",
"==",
"'true'",
":",
"self",
".",
"interpreter",
".",
"generate_random",
"=",
... | Set the generate random flag, unset registers and memory will return a random value.
Usage:
Call the magic by itself or with `true` to have registers and memory return a random value
if they are unset and read from, much like how real hardware would work.
Defaults to False, or to not ge... | [
"Set",
"the",
"generate",
"random",
"flag",
"unset",
"registers",
"and",
"memory",
"will",
"return",
"a",
"random",
"value",
"."
] | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm_kernel/iarmkernel.py#L54-L81 | train |
DeepHorizons/iarm | iarm_kernel/iarmkernel.py | ArmKernel.magic_postpone_execution | def magic_postpone_execution(self, line):
"""
Postpone execution of instructions until explicitly run
Usage:
Call this magic with `true` or nothing to postpone execution,
or call with `false` to execute each instruction when evaluated.
This defaults to True.
Not... | python | def magic_postpone_execution(self, line):
"""
Postpone execution of instructions until explicitly run
Usage:
Call this magic with `true` or nothing to postpone execution,
or call with `false` to execute each instruction when evaluated.
This defaults to True.
Not... | [
"def",
"magic_postpone_execution",
"(",
"self",
",",
"line",
")",
":",
"line",
"=",
"line",
".",
"strip",
"(",
")",
".",
"lower",
"(",
")",
"if",
"not",
"line",
"or",
"line",
"==",
"'true'",
":",
"self",
".",
"interpreter",
".",
"postpone_execution",
"... | Postpone execution of instructions until explicitly run
Usage:
Call this magic with `true` or nothing to postpone execution,
or call with `false` to execute each instruction when evaluated.
This defaults to True.
Note that each cell is executed only executed after all lines in
... | [
"Postpone",
"execution",
"of",
"instructions",
"until",
"explicitly",
"run"
] | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm_kernel/iarmkernel.py#L83-L113 | train |
DeepHorizons/iarm | iarm_kernel/iarmkernel.py | ArmKernel.magic_register | def magic_register(self, line):
"""
Print out the current value of a register
Usage:
Pass in the register, or a list of registers separated by spaces
A list of registeres can be entered by separating them by a hyphen
`%reg R1`
or
`%reg R0 R5 R6`
... | python | def magic_register(self, line):
"""
Print out the current value of a register
Usage:
Pass in the register, or a list of registers separated by spaces
A list of registeres can be entered by separating them by a hyphen
`%reg R1`
or
`%reg R0 R5 R6`
... | [
"def",
"magic_register",
"(",
"self",
",",
"line",
")",
":",
"message",
"=",
"\"\"",
"for",
"reg",
"in",
"[",
"i",
".",
"strip",
"(",
")",
"for",
"i",
"in",
"line",
".",
"replace",
"(",
"','",
",",
"''",
")",
".",
"split",
"(",
")",
"]",
":",
... | Print out the current value of a register
Usage:
Pass in the register, or a list of registers separated by spaces
A list of registeres can be entered by separating them by a hyphen
`%reg R1`
or
`%reg R0 R5 R6`
or
`%reg R8-R12` | [
"Print",
"out",
"the",
"current",
"value",
"of",
"a",
"register"
] | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm_kernel/iarmkernel.py#L148-L181 | train |
DeepHorizons/iarm | iarm_kernel/iarmkernel.py | ArmKernel.magic_memory | def magic_memory(self, line):
"""
Print out the current value of memory
Usage:
Pass in the byte of memory to read, separated by spaced
A list of memory contents can be entered by separating them by a hyphen
`%mem 4 5`
or
`%mem 8-12`
"""
#... | python | def magic_memory(self, line):
"""
Print out the current value of memory
Usage:
Pass in the byte of memory to read, separated by spaced
A list of memory contents can be entered by separating them by a hyphen
`%mem 4 5`
or
`%mem 8-12`
"""
#... | [
"def",
"magic_memory",
"(",
"self",
",",
"line",
")",
":",
"# TODO add support for directives",
"message",
"=",
"\"\"",
"for",
"address",
"in",
"[",
"i",
".",
"strip",
"(",
")",
"for",
"i",
"in",
"line",
".",
"replace",
"(",
"','",
",",
"''",
")",
".",... | Print out the current value of memory
Usage:
Pass in the byte of memory to read, separated by spaced
A list of memory contents can be entered by separating them by a hyphen
`%mem 4 5`
or
`%mem 8-12` | [
"Print",
"out",
"the",
"current",
"value",
"of",
"memory"
] | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm_kernel/iarmkernel.py#L183-L215 | train |
DeepHorizons/iarm | iarm_kernel/iarmkernel.py | ArmKernel.magic_run | def magic_run(self, line):
"""
Run the current program
Usage:
Call with a numbe rto run that many steps,
or call with no arguments to run to the end of the current program
`%run`
or
`%run 1`
"""
i = float('inf')
if line.strip():
... | python | def magic_run(self, line):
"""
Run the current program
Usage:
Call with a numbe rto run that many steps,
or call with no arguments to run to the end of the current program
`%run`
or
`%run 1`
"""
i = float('inf')
if line.strip():
... | [
"def",
"magic_run",
"(",
"self",
",",
"line",
")",
":",
"i",
"=",
"float",
"(",
"'inf'",
")",
"if",
"line",
".",
"strip",
"(",
")",
":",
"i",
"=",
"int",
"(",
"line",
")",
"try",
":",
"with",
"warnings",
".",
"catch_warnings",
"(",
"record",
"=",... | Run the current program
Usage:
Call with a numbe rto run that many steps,
or call with no arguments to run to the end of the current program
`%run`
or
`%run 1` | [
"Run",
"the",
"current",
"program"
] | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm_kernel/iarmkernel.py#L217-L254 | train |
DeepHorizons/iarm | iarm_kernel/iarmkernel.py | ArmKernel.magic_help | def magic_help(self, line):
"""
Print out the help for magics
Usage:
Call help with no arguments to list all magics,
or call it with a magic to print out it's help info.
`%help`
or
`%help run
"""
line = line.strip()
if not line:
... | python | def magic_help(self, line):
"""
Print out the help for magics
Usage:
Call help with no arguments to list all magics,
or call it with a magic to print out it's help info.
`%help`
or
`%help run
"""
line = line.strip()
if not line:
... | [
"def",
"magic_help",
"(",
"self",
",",
"line",
")",
":",
"line",
"=",
"line",
".",
"strip",
"(",
")",
"if",
"not",
"line",
":",
"for",
"magic",
"in",
"self",
".",
"magics",
":",
"stream_content",
"=",
"{",
"'name'",
":",
"'stdout'",
",",
"'text'",
... | Print out the help for magics
Usage:
Call help with no arguments to list all magics,
or call it with a magic to print out it's help info.
`%help`
or
`%help run | [
"Print",
"out",
"the",
"help",
"for",
"magics"
] | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm_kernel/iarmkernel.py#L256-L283 | train |
glomex/gcdt | gcdt/yugen_core.py | export_to_swagger | def export_to_swagger(awsclient, api_name, stage_name, api_description,
lambdas, custom_hostname=False, custom_base_path=False):
"""Export the API design as swagger file.
:param api_name:
:param stage_name:
:param api_description:
:param lambdas:
:param custom_hos... | python | def export_to_swagger(awsclient, api_name, stage_name, api_description,
lambdas, custom_hostname=False, custom_base_path=False):
"""Export the API design as swagger file.
:param api_name:
:param stage_name:
:param api_description:
:param lambdas:
:param custom_hos... | [
"def",
"export_to_swagger",
"(",
"awsclient",
",",
"api_name",
",",
"stage_name",
",",
"api_description",
",",
"lambdas",
",",
"custom_hostname",
"=",
"False",
",",
"custom_base_path",
"=",
"False",
")",
":",
"print",
"(",
"'Exporting to swagger...'",
")",
"api",
... | Export the API design as swagger file.
:param api_name:
:param stage_name:
:param api_description:
:param lambdas:
:param custom_hostname:
:param custom_base_path: | [
"Export",
"the",
"API",
"design",
"as",
"swagger",
"file",
".",
":",
"param",
"api_name",
":",
":",
"param",
"stage_name",
":",
":",
"param",
"api_description",
":",
":",
"param",
"lambdas",
":",
":",
"param",
"custom_hostname",
":",
":",
"param",
"custom_... | cd67cf416371337b83cb9ca3f696277125703339 | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/yugen_core.py#L21-L54 | train |
glomex/gcdt | gcdt/yugen_core.py | list_apis | def list_apis(awsclient):
"""List APIs in account."""
client_api = awsclient.get_client('apigateway')
apis = client_api.get_rest_apis()['items']
for api in apis:
print(json2table(api)) | python | def list_apis(awsclient):
"""List APIs in account."""
client_api = awsclient.get_client('apigateway')
apis = client_api.get_rest_apis()['items']
for api in apis:
print(json2table(api)) | [
"def",
"list_apis",
"(",
"awsclient",
")",
":",
"client_api",
"=",
"awsclient",
".",
"get_client",
"(",
"'apigateway'",
")",
"apis",
"=",
"client_api",
".",
"get_rest_apis",
"(",
")",
"[",
"'items'",
"]",
"for",
"api",
"in",
"apis",
":",
"print",
"(",
"j... | List APIs in account. | [
"List",
"APIs",
"in",
"account",
"."
] | cd67cf416371337b83cb9ca3f696277125703339 | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/yugen_core.py#L57-L64 | train |
glomex/gcdt | gcdt/yugen_core.py | deploy_api | def deploy_api(awsclient, api_name, api_description, stage_name, api_key,
lambdas, cache_cluster_enabled, cache_cluster_size, method_settings=None):
"""Deploy API Gateway to AWS cloud.
:param awsclient:
:param api_name:
:param api_description:
:param stage_name:
:param api_key:
... | python | def deploy_api(awsclient, api_name, api_description, stage_name, api_key,
lambdas, cache_cluster_enabled, cache_cluster_size, method_settings=None):
"""Deploy API Gateway to AWS cloud.
:param awsclient:
:param api_name:
:param api_description:
:param stage_name:
:param api_key:
... | [
"def",
"deploy_api",
"(",
"awsclient",
",",
"api_name",
",",
"api_description",
",",
"stage_name",
",",
"api_key",
",",
"lambdas",
",",
"cache_cluster_enabled",
",",
"cache_cluster_size",
",",
"method_settings",
"=",
"None",
")",
":",
"if",
"not",
"_api_exists",
... | Deploy API Gateway to AWS cloud.
:param awsclient:
:param api_name:
:param api_description:
:param stage_name:
:param api_key:
:param lambdas:
:param cache_cluster_enabled:
:param cache_cluster_size:
:param method_settings: | [
"Deploy",
"API",
"Gateway",
"to",
"AWS",
"cloud",
"."
] | cd67cf416371337b83cb9ca3f696277125703339 | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/yugen_core.py#L67-L113 | train |
glomex/gcdt | gcdt/yugen_core.py | delete_api | def delete_api(awsclient, api_name):
"""Delete the API.
:param api_name:
"""
_sleep()
client_api = awsclient.get_client('apigateway')
print('deleting api: %s' % api_name)
api = _api_by_name(awsclient, api_name)
if api is not None:
print(json2table(api))
response = cli... | python | def delete_api(awsclient, api_name):
"""Delete the API.
:param api_name:
"""
_sleep()
client_api = awsclient.get_client('apigateway')
print('deleting api: %s' % api_name)
api = _api_by_name(awsclient, api_name)
if api is not None:
print(json2table(api))
response = cli... | [
"def",
"delete_api",
"(",
"awsclient",
",",
"api_name",
")",
":",
"_sleep",
"(",
")",
"client_api",
"=",
"awsclient",
".",
"get_client",
"(",
"'apigateway'",
")",
"print",
"(",
"'deleting api: %s'",
"%",
"api_name",
")",
"api",
"=",
"_api_by_name",
"(",
"aws... | Delete the API.
:param api_name: | [
"Delete",
"the",
"API",
"."
] | cd67cf416371337b83cb9ca3f696277125703339 | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/yugen_core.py#L116-L136 | train |
glomex/gcdt | gcdt/yugen_core.py | create_api_key | def create_api_key(awsclient, api_name, api_key_name):
"""Create a new API key as reference for api.conf.
:param api_name:
:param api_key_name:
:return: api_key
"""
_sleep()
client_api = awsclient.get_client('apigateway')
print('create api key: %s' % api_key_name)
response = client... | python | def create_api_key(awsclient, api_name, api_key_name):
"""Create a new API key as reference for api.conf.
:param api_name:
:param api_key_name:
:return: api_key
"""
_sleep()
client_api = awsclient.get_client('apigateway')
print('create api key: %s' % api_key_name)
response = client... | [
"def",
"create_api_key",
"(",
"awsclient",
",",
"api_name",
",",
"api_key_name",
")",
":",
"_sleep",
"(",
")",
"client_api",
"=",
"awsclient",
".",
"get_client",
"(",
"'apigateway'",
")",
"print",
"(",
"'create api key: %s'",
"%",
"api_key_name",
")",
"response"... | Create a new API key as reference for api.conf.
:param api_name:
:param api_key_name:
:return: api_key | [
"Create",
"a",
"new",
"API",
"key",
"as",
"reference",
"for",
"api",
".",
"conf",
"."
] | cd67cf416371337b83cb9ca3f696277125703339 | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/yugen_core.py#L139-L159 | train |
glomex/gcdt | gcdt/yugen_core.py | delete_api_key | def delete_api_key(awsclient, api_key):
"""Remove API key.
:param api_key:
"""
_sleep()
client_api = awsclient.get_client('apigateway')
print('delete api key: %s' % api_key)
response = client_api.delete_api_key(
apiKey=api_key
)
print(json2table(response)) | python | def delete_api_key(awsclient, api_key):
"""Remove API key.
:param api_key:
"""
_sleep()
client_api = awsclient.get_client('apigateway')
print('delete api key: %s' % api_key)
response = client_api.delete_api_key(
apiKey=api_key
)
print(json2table(response)) | [
"def",
"delete_api_key",
"(",
"awsclient",
",",
"api_key",
")",
":",
"_sleep",
"(",
")",
"client_api",
"=",
"awsclient",
".",
"get_client",
"(",
"'apigateway'",
")",
"print",
"(",
"'delete api key: %s'",
"%",
"api_key",
")",
"response",
"=",
"client_api",
".",... | Remove API key.
:param api_key: | [
"Remove",
"API",
"key",
"."
] | cd67cf416371337b83cb9ca3f696277125703339 | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/yugen_core.py#L162-L175 | train |
glomex/gcdt | gcdt/yugen_core.py | list_api_keys | def list_api_keys(awsclient):
"""Print the defined API keys.
"""
_sleep()
client_api = awsclient.get_client('apigateway')
print('listing api keys')
response = client_api.get_api_keys()['items']
for item in response:
print(json2table(item)) | python | def list_api_keys(awsclient):
"""Print the defined API keys.
"""
_sleep()
client_api = awsclient.get_client('apigateway')
print('listing api keys')
response = client_api.get_api_keys()['items']
for item in response:
print(json2table(item)) | [
"def",
"list_api_keys",
"(",
"awsclient",
")",
":",
"_sleep",
"(",
")",
"client_api",
"=",
"awsclient",
".",
"get_client",
"(",
"'apigateway'",
")",
"print",
"(",
"'listing api keys'",
")",
"response",
"=",
"client_api",
".",
"get_api_keys",
"(",
")",
"[",
"... | Print the defined API keys. | [
"Print",
"the",
"defined",
"API",
"keys",
"."
] | cd67cf416371337b83cb9ca3f696277125703339 | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/yugen_core.py#L178-L188 | train |
glomex/gcdt | gcdt/yugen_core.py | deploy_custom_domain | def deploy_custom_domain(awsclient, api_name, api_target_stage,
api_base_path, domain_name, route_53_record,
cert_name, cert_arn, hosted_zone_id, ensure_cname):
"""Add custom domain to your API.
:param api_name:
:param api_target_stage:
:param api_base_... | python | def deploy_custom_domain(awsclient, api_name, api_target_stage,
api_base_path, domain_name, route_53_record,
cert_name, cert_arn, hosted_zone_id, ensure_cname):
"""Add custom domain to your API.
:param api_name:
:param api_target_stage:
:param api_base_... | [
"def",
"deploy_custom_domain",
"(",
"awsclient",
",",
"api_name",
",",
"api_target_stage",
",",
"api_base_path",
",",
"domain_name",
",",
"route_53_record",
",",
"cert_name",
",",
"cert_arn",
",",
"hosted_zone_id",
",",
"ensure_cname",
")",
":",
"api_base_path",
"="... | Add custom domain to your API.
:param api_name:
:param api_target_stage:
:param api_base_path:
:param domain_name:
:param route_53_record:
:param ssl_cert:
:param cert_name:
:param cert_arn:
:param hosted_zone_id:
:return: exit_code | [
"Add",
"custom",
"domain",
"to",
"your",
"API",
"."
] | cd67cf416371337b83cb9ca3f696277125703339 | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/yugen_core.py#L191-L249 | train |
glomex/gcdt | gcdt/yugen_core.py | get_lambdas | def get_lambdas(awsclient, config, add_arn=False):
"""Get the list of lambda functions.
:param config:
:param add_arn:
:return: list containing lambda entries
"""
if 'lambda' in config:
client_lambda = awsclient.get_client('lambda')
lambda_entries = config['lambda'].get('entries... | python | def get_lambdas(awsclient, config, add_arn=False):
"""Get the list of lambda functions.
:param config:
:param add_arn:
:return: list containing lambda entries
"""
if 'lambda' in config:
client_lambda = awsclient.get_client('lambda')
lambda_entries = config['lambda'].get('entries... | [
"def",
"get_lambdas",
"(",
"awsclient",
",",
"config",
",",
"add_arn",
"=",
"False",
")",
":",
"if",
"'lambda'",
"in",
"config",
":",
"client_lambda",
"=",
"awsclient",
".",
"get_client",
"(",
"'lambda'",
")",
"lambda_entries",
"=",
"config",
"[",
"'lambda'"... | Get the list of lambda functions.
:param config:
:param add_arn:
:return: list containing lambda entries | [
"Get",
"the",
"list",
"of",
"lambda",
"functions",
"."
] | cd67cf416371337b83cb9ca3f696277125703339 | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/yugen_core.py#L252-L277 | train |
glomex/gcdt | gcdt/yugen_core.py | _update_stage | def _update_stage(awsclient, api_id, stage_name, method_settings):
"""Helper to apply method_settings to stage
:param awsclient:
:param api_id:
:param stage_name:
:param method_settings:
:return:
"""
# settings docs in response: https://botocore.readthedocs.io/en/latest/reference/servic... | python | def _update_stage(awsclient, api_id, stage_name, method_settings):
"""Helper to apply method_settings to stage
:param awsclient:
:param api_id:
:param stage_name:
:param method_settings:
:return:
"""
# settings docs in response: https://botocore.readthedocs.io/en/latest/reference/servic... | [
"def",
"_update_stage",
"(",
"awsclient",
",",
"api_id",
",",
"stage_name",
",",
"method_settings",
")",
":",
"# settings docs in response: https://botocore.readthedocs.io/en/latest/reference/services/apigateway.html#APIGateway.Client.update_stage",
"client_api",
"=",
"awsclient",
".... | Helper to apply method_settings to stage
:param awsclient:
:param api_id:
:param stage_name:
:param method_settings:
:return: | [
"Helper",
"to",
"apply",
"method_settings",
"to",
"stage"
] | cd67cf416371337b83cb9ca3f696277125703339 | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/yugen_core.py#L461-L479 | train |
glomex/gcdt | gcdt/yugen_core.py | _convert_method_settings_into_operations | def _convert_method_settings_into_operations(method_settings=None):
"""Helper to handle the conversion of method_settings to operations
:param method_settings:
:return: list of operations
"""
# operations docs here: https://tools.ietf.org/html/rfc6902#section-4
operations = []
if method_set... | python | def _convert_method_settings_into_operations(method_settings=None):
"""Helper to handle the conversion of method_settings to operations
:param method_settings:
:return: list of operations
"""
# operations docs here: https://tools.ietf.org/html/rfc6902#section-4
operations = []
if method_set... | [
"def",
"_convert_method_settings_into_operations",
"(",
"method_settings",
"=",
"None",
")",
":",
"# operations docs here: https://tools.ietf.org/html/rfc6902#section-4",
"operations",
"=",
"[",
"]",
"if",
"method_settings",
":",
"for",
"method",
"in",
"method_settings",
".",... | Helper to handle the conversion of method_settings to operations
:param method_settings:
:return: list of operations | [
"Helper",
"to",
"handle",
"the",
"conversion",
"of",
"method_settings",
"to",
"operations"
] | cd67cf416371337b83cb9ca3f696277125703339 | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/yugen_core.py#L503-L524 | train |
lincolnloop/salmon | salmon/core/runner.py | generate_settings | def generate_settings():
"""
This command is run when ``default_path`` doesn't exist, or ``init`` is
run and returns a string representing the default data to put into their
settings file.
"""
conf_file = os.path.join(os.path.dirname(base_settings.__file__),
'example... | python | def generate_settings():
"""
This command is run when ``default_path`` doesn't exist, or ``init`` is
run and returns a string representing the default data to put into their
settings file.
"""
conf_file = os.path.join(os.path.dirname(base_settings.__file__),
'example... | [
"def",
"generate_settings",
"(",
")",
":",
"conf_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"base_settings",
".",
"__file__",
")",
",",
"'example'",
",",
"'conf.py'",
")",
"conf_template",
"=",
"open",
"(",
... | This command is run when ``default_path`` doesn't exist, or ``init`` is
run and returns a string representing the default data to put into their
settings file. | [
"This",
"command",
"is",
"run",
"when",
"default_path",
"doesn",
"t",
"exist",
"or",
"init",
"is",
"run",
"and",
"returns",
"a",
"string",
"representing",
"the",
"default",
"data",
"to",
"put",
"into",
"their",
"settings",
"file",
"."
] | 62a965ad9716707ea1db4afb5d9646766f29b64b | https://github.com/lincolnloop/salmon/blob/62a965ad9716707ea1db4afb5d9646766f29b64b/salmon/core/runner.py#L11-L28 | train |
lincolnloop/salmon | salmon/core/runner.py | configure_app | def configure_app(**kwargs):
"""Builds up the settings using the same method as logan"""
sys_args = sys.argv
args, command, command_args = parse_args(sys_args[1:])
parser = OptionParser()
parser.add_option('--config', metavar='CONFIG')
(options, logan_args) = parser.parse_args(args)
config_p... | python | def configure_app(**kwargs):
"""Builds up the settings using the same method as logan"""
sys_args = sys.argv
args, command, command_args = parse_args(sys_args[1:])
parser = OptionParser()
parser.add_option('--config', metavar='CONFIG')
(options, logan_args) = parser.parse_args(args)
config_p... | [
"def",
"configure_app",
"(",
"*",
"*",
"kwargs",
")",
":",
"sys_args",
"=",
"sys",
".",
"argv",
"args",
",",
"command",
",",
"command_args",
"=",
"parse_args",
"(",
"sys_args",
"[",
"1",
":",
"]",
")",
"parser",
"=",
"OptionParser",
"(",
")",
"parser",... | Builds up the settings using the same method as logan | [
"Builds",
"up",
"the",
"settings",
"using",
"the",
"same",
"method",
"as",
"logan"
] | 62a965ad9716707ea1db4afb5d9646766f29b64b | https://github.com/lincolnloop/salmon/blob/62a965ad9716707ea1db4afb5d9646766f29b64b/salmon/core/runner.py#L42-L50 | train |
lincolnloop/salmon | salmon/metrics/models.py | Metric._reset_changes | def _reset_changes(self):
"""Stores current values for comparison later"""
self._original = {}
if self.last_updated is not None:
self._original['last_updated'] = self.last_updated | python | def _reset_changes(self):
"""Stores current values for comparison later"""
self._original = {}
if self.last_updated is not None:
self._original['last_updated'] = self.last_updated | [
"def",
"_reset_changes",
"(",
"self",
")",
":",
"self",
".",
"_original",
"=",
"{",
"}",
"if",
"self",
".",
"last_updated",
"is",
"not",
"None",
":",
"self",
".",
"_original",
"[",
"'last_updated'",
"]",
"=",
"self",
".",
"last_updated"
] | Stores current values for comparison later | [
"Stores",
"current",
"values",
"for",
"comparison",
"later"
] | 62a965ad9716707ea1db4afb5d9646766f29b64b | https://github.com/lincolnloop/salmon/blob/62a965ad9716707ea1db4afb5d9646766f29b64b/salmon/metrics/models.py#L62-L66 | train |
lincolnloop/salmon | salmon/metrics/models.py | Metric.whisper_filename | def whisper_filename(self):
"""Build a file path to the Whisper database"""
source_name = self.source_id and self.source.name or ''
return get_valid_filename("{0}__{1}.wsp".format(source_name,
self.name)) | python | def whisper_filename(self):
"""Build a file path to the Whisper database"""
source_name = self.source_id and self.source.name or ''
return get_valid_filename("{0}__{1}.wsp".format(source_name,
self.name)) | [
"def",
"whisper_filename",
"(",
"self",
")",
":",
"source_name",
"=",
"self",
".",
"source_id",
"and",
"self",
".",
"source",
".",
"name",
"or",
"''",
"return",
"get_valid_filename",
"(",
"\"{0}__{1}.wsp\"",
".",
"format",
"(",
"source_name",
",",
"self",
".... | Build a file path to the Whisper database | [
"Build",
"a",
"file",
"path",
"to",
"the",
"Whisper",
"database"
] | 62a965ad9716707ea1db4afb5d9646766f29b64b | https://github.com/lincolnloop/salmon/blob/62a965ad9716707ea1db4afb5d9646766f29b64b/salmon/metrics/models.py#L69-L73 | train |
lincolnloop/salmon | salmon/metrics/models.py | Metric.get_value_display | def get_value_display(self):
"""Human friendly value output"""
if self.display_as == 'percentage':
return '{0}%'.format(self.latest_value)
if self.display_as == 'boolean':
return bool(self.latest_value)
if self.display_as == 'byte':
return defaultfilte... | python | def get_value_display(self):
"""Human friendly value output"""
if self.display_as == 'percentage':
return '{0}%'.format(self.latest_value)
if self.display_as == 'boolean':
return bool(self.latest_value)
if self.display_as == 'byte':
return defaultfilte... | [
"def",
"get_value_display",
"(",
"self",
")",
":",
"if",
"self",
".",
"display_as",
"==",
"'percentage'",
":",
"return",
"'{0}%'",
".",
"format",
"(",
"self",
".",
"latest_value",
")",
"if",
"self",
".",
"display_as",
"==",
"'boolean'",
":",
"return",
"boo... | Human friendly value output | [
"Human",
"friendly",
"value",
"output"
] | 62a965ad9716707ea1db4afb5d9646766f29b64b | https://github.com/lincolnloop/salmon/blob/62a965ad9716707ea1db4afb5d9646766f29b64b/salmon/metrics/models.py#L95-L105 | train |
lincolnloop/salmon | salmon/metrics/models.py | Metric.time_between_updates | def time_between_updates(self):
"""Time between current `last_updated` and previous `last_updated`"""
if 'last_updated' not in self._original:
return 0
last_update = self._original['last_updated']
this_update = self.last_updated
return this_update - last_update | python | def time_between_updates(self):
"""Time between current `last_updated` and previous `last_updated`"""
if 'last_updated' not in self._original:
return 0
last_update = self._original['last_updated']
this_update = self.last_updated
return this_update - last_update | [
"def",
"time_between_updates",
"(",
"self",
")",
":",
"if",
"'last_updated'",
"not",
"in",
"self",
".",
"_original",
":",
"return",
"0",
"last_update",
"=",
"self",
".",
"_original",
"[",
"'last_updated'",
"]",
"this_update",
"=",
"self",
".",
"last_updated",
... | Time between current `last_updated` and previous `last_updated` | [
"Time",
"between",
"current",
"last_updated",
"and",
"previous",
"last_updated"
] | 62a965ad9716707ea1db4afb5d9646766f29b64b | https://github.com/lincolnloop/salmon/blob/62a965ad9716707ea1db4afb5d9646766f29b64b/salmon/metrics/models.py#L107-L113 | train |
lincolnloop/salmon | salmon/metrics/models.py | Metric.do_transform | def do_transform(self):
"""Apply the transformation (if it exists) to the latest_value"""
if not self.transform:
return
try:
self.latest_value = utils.Transform(
expr=self.transform, value=self.latest_value,
timedelta=self.time_between_upda... | python | def do_transform(self):
"""Apply the transformation (if it exists) to the latest_value"""
if not self.transform:
return
try:
self.latest_value = utils.Transform(
expr=self.transform, value=self.latest_value,
timedelta=self.time_between_upda... | [
"def",
"do_transform",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"transform",
":",
"return",
"try",
":",
"self",
".",
"latest_value",
"=",
"utils",
".",
"Transform",
"(",
"expr",
"=",
"self",
".",
"transform",
",",
"value",
"=",
"self",
".",
"... | Apply the transformation (if it exists) to the latest_value | [
"Apply",
"the",
"transformation",
"(",
"if",
"it",
"exists",
")",
"to",
"the",
"latest_value"
] | 62a965ad9716707ea1db4afb5d9646766f29b64b | https://github.com/lincolnloop/salmon/blob/62a965ad9716707ea1db4afb5d9646766f29b64b/salmon/metrics/models.py#L115-L126 | train |
lincolnloop/salmon | salmon/metrics/models.py | Metric.do_counter_conversion | def do_counter_conversion(self):
"""Update latest value to the diff between it and the previous value"""
if self.is_counter:
if self._previous_counter_value is None:
prev_value = self.latest_value
else:
prev_value = self._previous_counter_value
... | python | def do_counter_conversion(self):
"""Update latest value to the diff between it and the previous value"""
if self.is_counter:
if self._previous_counter_value is None:
prev_value = self.latest_value
else:
prev_value = self._previous_counter_value
... | [
"def",
"do_counter_conversion",
"(",
"self",
")",
":",
"if",
"self",
".",
"is_counter",
":",
"if",
"self",
".",
"_previous_counter_value",
"is",
"None",
":",
"prev_value",
"=",
"self",
".",
"latest_value",
"else",
":",
"prev_value",
"=",
"self",
".",
"_previ... | Update latest value to the diff between it and the previous value | [
"Update",
"latest",
"value",
"to",
"the",
"diff",
"between",
"it",
"and",
"the",
"previous",
"value"
] | 62a965ad9716707ea1db4afb5d9646766f29b64b | https://github.com/lincolnloop/salmon/blob/62a965ad9716707ea1db4afb5d9646766f29b64b/salmon/metrics/models.py#L128-L136 | train |
ninapavlich/django-imagekit-cropper | imagekit_cropper/registry.py | InstanceSourceGroupRegistry.source_group_receiver | def source_group_receiver(self, sender, source, signal, **kwargs):
"""
Relay source group signals to the appropriate spec strategy.
"""
from imagekit.cachefiles import ImageCacheFile
source_group = sender
# Ignore signals from unregistered groups.
if source_gro... | python | def source_group_receiver(self, sender, source, signal, **kwargs):
"""
Relay source group signals to the appropriate spec strategy.
"""
from imagekit.cachefiles import ImageCacheFile
source_group = sender
# Ignore signals from unregistered groups.
if source_gro... | [
"def",
"source_group_receiver",
"(",
"self",
",",
"sender",
",",
"source",
",",
"signal",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
"imagekit",
".",
"cachefiles",
"import",
"ImageCacheFile",
"source_group",
"=",
"sender",
"# Ignore signals from unregistered groups.... | Relay source group signals to the appropriate spec strategy. | [
"Relay",
"source",
"group",
"signals",
"to",
"the",
"appropriate",
"spec",
"strategy",
"."
] | c1c2dc5c3c4724492052e5d244e9de1cc362dbcc | https://github.com/ninapavlich/django-imagekit-cropper/blob/c1c2dc5c3c4724492052e5d244e9de1cc362dbcc/imagekit_cropper/registry.py#L46-L68 | train |
lincolnloop/salmon | salmon/metrics/utils.py | Transform.replace_variable | def replace_variable(self, variable):
"""Substitute variables with numeric values"""
if variable == 'x':
return self.value
if variable == 't':
return self.timedelta
raise ValueError("Invalid variable %s", variable) | python | def replace_variable(self, variable):
"""Substitute variables with numeric values"""
if variable == 'x':
return self.value
if variable == 't':
return self.timedelta
raise ValueError("Invalid variable %s", variable) | [
"def",
"replace_variable",
"(",
"self",
",",
"variable",
")",
":",
"if",
"variable",
"==",
"'x'",
":",
"return",
"self",
".",
"value",
"if",
"variable",
"==",
"'t'",
":",
"return",
"self",
".",
"timedelta",
"raise",
"ValueError",
"(",
"\"Invalid variable %s\... | Substitute variables with numeric values | [
"Substitute",
"variables",
"with",
"numeric",
"values"
] | 62a965ad9716707ea1db4afb5d9646766f29b64b | https://github.com/lincolnloop/salmon/blob/62a965ad9716707ea1db4afb5d9646766f29b64b/salmon/metrics/utils.py#L17-L23 | train |
lincolnloop/salmon | salmon/metrics/utils.py | Transform.result | def result(self):
"""Evaluate expression and return result"""
# Module(body=[Expr(value=...)])
return self.eval_(ast.parse(self.expr).body[0].value) | python | def result(self):
"""Evaluate expression and return result"""
# Module(body=[Expr(value=...)])
return self.eval_(ast.parse(self.expr).body[0].value) | [
"def",
"result",
"(",
"self",
")",
":",
"# Module(body=[Expr(value=...)])",
"return",
"self",
".",
"eval_",
"(",
"ast",
".",
"parse",
"(",
"self",
".",
"expr",
")",
".",
"body",
"[",
"0",
"]",
".",
"value",
")"
] | Evaluate expression and return result | [
"Evaluate",
"expression",
"and",
"return",
"result"
] | 62a965ad9716707ea1db4afb5d9646766f29b64b | https://github.com/lincolnloop/salmon/blob/62a965ad9716707ea1db4afb5d9646766f29b64b/salmon/metrics/utils.py#L25-L28 | train |
acrazing/dbapi | dbapi/People.py | People.get_people | def get_people(self, user_alias=None):
"""
获取用户信息
:param user_alias: 用户ID
:return:
"""
user_alias = user_alias or self.api.user_alias
content = self.api.req(API_PEOPLE_HOME % user_alias).content
xml = self.api.to_xml(re.sub(b'<br />', b'\n', cont... | python | def get_people(self, user_alias=None):
"""
获取用户信息
:param user_alias: 用户ID
:return:
"""
user_alias = user_alias or self.api.user_alias
content = self.api.req(API_PEOPLE_HOME % user_alias).content
xml = self.api.to_xml(re.sub(b'<br />', b'\n', cont... | [
"def",
"get_people",
"(",
"self",
",",
"user_alias",
"=",
"None",
")",
":",
"user_alias",
"=",
"user_alias",
"or",
"self",
".",
"api",
".",
"user_alias",
"content",
"=",
"self",
".",
"api",
".",
"req",
"(",
"API_PEOPLE_HOME",
"%",
"user_alias",
")",
".",... | 获取用户信息
:param user_alias: 用户ID
:return: | [
"获取用户信息",
":",
"param",
"user_alias",
":",
"用户ID",
":",
"return",
":"
] | 8c1f85cb1a051daf7be1fc97a62c4499983e9898 | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/People.py#L16-L59 | train |
matthiask/django-authlib | authlib/views.py | email_login | def email_login(request, *, email, **kwargs):
"""
Given a request, an email and optionally some additional data, ensure that
a user with the email address exists, and authenticate & login them right
away if the user is active.
Returns a tuple consisting of ``(user, created)`` upon success or ``(Non... | python | def email_login(request, *, email, **kwargs):
"""
Given a request, an email and optionally some additional data, ensure that
a user with the email address exists, and authenticate & login them right
away if the user is active.
Returns a tuple consisting of ``(user, created)`` upon success or ``(Non... | [
"def",
"email_login",
"(",
"request",
",",
"*",
",",
"email",
",",
"*",
"*",
"kwargs",
")",
":",
"_u",
",",
"created",
"=",
"auth",
".",
"get_user_model",
"(",
")",
".",
"_default_manager",
".",
"get_or_create",
"(",
"email",
"=",
"email",
")",
"user",... | Given a request, an email and optionally some additional data, ensure that
a user with the email address exists, and authenticate & login them right
away if the user is active.
Returns a tuple consisting of ``(user, created)`` upon success or ``(None,
None)`` when authentication fails. | [
"Given",
"a",
"request",
"an",
"email",
"and",
"optionally",
"some",
"additional",
"data",
"ensure",
"that",
"a",
"user",
"with",
"the",
"email",
"address",
"exists",
"and",
"authenticate",
"&",
"login",
"them",
"right",
"away",
"if",
"the",
"user",
"is",
... | a142da7e27fe9d30f34a84b12f24f686f9d2c8e1 | https://github.com/matthiask/django-authlib/blob/a142da7e27fe9d30f34a84b12f24f686f9d2c8e1/authlib/views.py#L54-L68 | train |
lincolnloop/salmon | salmon/metrics/views.py | dashboard | def dashboard(request):
"""Shows the latest results for each source"""
sources = (models.Source.objects.all().prefetch_related('metric_set')
.order_by('name'))
metrics = SortedDict([(src, src.metric_set.all()) for src in sources])
no_source_metrics = models.Metr... | python | def dashboard(request):
"""Shows the latest results for each source"""
sources = (models.Source.objects.all().prefetch_related('metric_set')
.order_by('name'))
metrics = SortedDict([(src, src.metric_set.all()) for src in sources])
no_source_metrics = models.Metr... | [
"def",
"dashboard",
"(",
"request",
")",
":",
"sources",
"=",
"(",
"models",
".",
"Source",
".",
"objects",
".",
"all",
"(",
")",
".",
"prefetch_related",
"(",
"'metric_set'",
")",
".",
"order_by",
"(",
"'name'",
")",
")",
"metrics",
"=",
"SortedDict",
... | Shows the latest results for each source | [
"Shows",
"the",
"latest",
"results",
"for",
"each",
"source"
] | 62a965ad9716707ea1db4afb5d9646766f29b64b | https://github.com/lincolnloop/salmon/blob/62a965ad9716707ea1db4afb5d9646766f29b64b/salmon/metrics/views.py#L32-L48 | train |
lincolnloop/salmon | salmon/core/graph.py | WhisperDatabase._create | def _create(self):
"""Create the Whisper file on disk"""
if not os.path.exists(settings.SALMON_WHISPER_DB_PATH):
os.makedirs(settings.SALMON_WHISPER_DB_PATH)
archives = [whisper.parseRetentionDef(retentionDef)
for retentionDef in settings.ARCHIVES.split(",")]
... | python | def _create(self):
"""Create the Whisper file on disk"""
if not os.path.exists(settings.SALMON_WHISPER_DB_PATH):
os.makedirs(settings.SALMON_WHISPER_DB_PATH)
archives = [whisper.parseRetentionDef(retentionDef)
for retentionDef in settings.ARCHIVES.split(",")]
... | [
"def",
"_create",
"(",
"self",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"settings",
".",
"SALMON_WHISPER_DB_PATH",
")",
":",
"os",
".",
"makedirs",
"(",
"settings",
".",
"SALMON_WHISPER_DB_PATH",
")",
"archives",
"=",
"[",
"whisper",
... | Create the Whisper file on disk | [
"Create",
"the",
"Whisper",
"file",
"on",
"disk"
] | 62a965ad9716707ea1db4afb5d9646766f29b64b | https://github.com/lincolnloop/salmon/blob/62a965ad9716707ea1db4afb5d9646766f29b64b/salmon/core/graph.py#L18-L26 | train |
lincolnloop/salmon | salmon/core/graph.py | WhisperDatabase._update | def _update(self, datapoints):
"""
This method store in the datapoints in the current database.
:datapoints: is a list of tupple with the epoch timestamp and value
[(1368977629,10)]
"""
if len(datapoints) == 1:
timestamp, value = datapoints[0]
... | python | def _update(self, datapoints):
"""
This method store in the datapoints in the current database.
:datapoints: is a list of tupple with the epoch timestamp and value
[(1368977629,10)]
"""
if len(datapoints) == 1:
timestamp, value = datapoints[0]
... | [
"def",
"_update",
"(",
"self",
",",
"datapoints",
")",
":",
"if",
"len",
"(",
"datapoints",
")",
"==",
"1",
":",
"timestamp",
",",
"value",
"=",
"datapoints",
"[",
"0",
"]",
"whisper",
".",
"update",
"(",
"self",
".",
"path",
",",
"value",
",",
"ti... | This method store in the datapoints in the current database.
:datapoints: is a list of tupple with the epoch timestamp and value
[(1368977629,10)] | [
"This",
"method",
"store",
"in",
"the",
"datapoints",
"in",
"the",
"current",
"database",
"."
] | 62a965ad9716707ea1db4afb5d9646766f29b64b | https://github.com/lincolnloop/salmon/blob/62a965ad9716707ea1db4afb5d9646766f29b64b/salmon/core/graph.py#L31-L42 | train |
lincolnloop/salmon | salmon/core/graph.py | WhisperDatabase.fetch | def fetch(self, from_time, until_time=None):
"""
This method fetch data from the database according to the period
given
fetch(path, fromTime, untilTime=None)
fromTime is an datetime
untilTime is also an datetime, but defaults to now.
Returns a tuple of (timeInf... | python | def fetch(self, from_time, until_time=None):
"""
This method fetch data from the database according to the period
given
fetch(path, fromTime, untilTime=None)
fromTime is an datetime
untilTime is also an datetime, but defaults to now.
Returns a tuple of (timeInf... | [
"def",
"fetch",
"(",
"self",
",",
"from_time",
",",
"until_time",
"=",
"None",
")",
":",
"until_time",
"=",
"until_time",
"or",
"datetime",
".",
"now",
"(",
")",
"time_info",
",",
"values",
"=",
"whisper",
".",
"fetch",
"(",
"self",
".",
"path",
",",
... | This method fetch data from the database according to the period
given
fetch(path, fromTime, untilTime=None)
fromTime is an datetime
untilTime is also an datetime, but defaults to now.
Returns a tuple of (timeInfo, valueList)
where timeInfo is itself a tuple of (fromTi... | [
"This",
"method",
"fetch",
"data",
"from",
"the",
"database",
"according",
"to",
"the",
"period",
"given"
] | 62a965ad9716707ea1db4afb5d9646766f29b64b | https://github.com/lincolnloop/salmon/blob/62a965ad9716707ea1db4afb5d9646766f29b64b/salmon/core/graph.py#L44-L70 | train |
acrazing/dbapi | dbapi/utils.py | build_list_result | def build_list_result(results, xml):
"""
构建带翻页的列表
:param results: 已获取的数据列表
:param xml: 原始页面xml
:return: {'results': list, 'count': int, 'next_start': int|None}
如果count与results长度不同,则有更多
如果next_start不为None,则可以到下一页
"""
xml_count = xml.xpath('//div[@class="paginator"... | python | def build_list_result(results, xml):
"""
构建带翻页的列表
:param results: 已获取的数据列表
:param xml: 原始页面xml
:return: {'results': list, 'count': int, 'next_start': int|None}
如果count与results长度不同,则有更多
如果next_start不为None,则可以到下一页
"""
xml_count = xml.xpath('//div[@class="paginator"... | [
"def",
"build_list_result",
"(",
"results",
",",
"xml",
")",
":",
"xml_count",
"=",
"xml",
".",
"xpath",
"(",
"'//div[@class=\"paginator\"]/span[@class=\"count\"]/text()'",
")",
"xml_next",
"=",
"xml",
".",
"xpath",
"(",
"'//div[@class=\"paginator\"]/span[@class=\"next\"]... | 构建带翻页的列表
:param results: 已获取的数据列表
:param xml: 原始页面xml
:return: {'results': list, 'count': int, 'next_start': int|None}
如果count与results长度不同,则有更多
如果next_start不为None,则可以到下一页 | [
"构建带翻页的列表",
":",
"param",
"results",
":",
"已获取的数据列表",
":",
"param",
"xml",
":",
"原始页面xml",
":",
"return",
":",
"{",
"results",
":",
"list",
"count",
":",
"int",
"next_start",
":",
"int|None",
"}",
"如果count与results长度不同,则有更多",
"如果next_start不为None,则可以到下一页"
] | 8c1f85cb1a051daf7be1fc97a62c4499983e9898 | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/utils.py#L25-L39 | train |
DeepHorizons/iarm | iarm/arm_instructions/arithmetic.py | Arithmetic.ADCS | def ADCS(self, params):
"""
ADCS [Ra,] Rb, Rc
Add Rb and Rc + the carry bit and store the result in Ra
Ra, Rb, and Rc must be low registers
if Ra is omitted, then it is assumed to be Rb
"""
# This instruction allows for an optional destination register
# ... | python | def ADCS(self, params):
"""
ADCS [Ra,] Rb, Rc
Add Rb and Rc + the carry bit and store the result in Ra
Ra, Rb, and Rc must be low registers
if Ra is omitted, then it is assumed to be Rb
"""
# This instruction allows for an optional destination register
# ... | [
"def",
"ADCS",
"(",
"self",
",",
"params",
")",
":",
"# This instruction allows for an optional destination register",
"# If it is omitted, then it is assumed to be Rb",
"# As defined in http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0662b/index.html",
"try",
":",
"Ra",
"... | ADCS [Ra,] Rb, Rc
Add Rb and Rc + the carry bit and store the result in Ra
Ra, Rb, and Rc must be low registers
if Ra is omitted, then it is assumed to be Rb | [
"ADCS",
"[",
"Ra",
"]",
"Rb",
"Rc"
] | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/arithmetic.py#L6-L35 | train |
DeepHorizons/iarm | iarm/arm_instructions/arithmetic.py | Arithmetic.ADD | def ADD(self, params):
"""
ADD [Rx,] Ry, [Rz, PC]
ADD [Rx,] [SP, PC], #imm10_4
ADD [SP,] SP, #imm9_4
Add Ry and Rz and store the result in Rx
Rx, Ry, and Rz can be any register
If Rx is omitted, then it is assumed to be Ry
"""
# This instruction a... | python | def ADD(self, params):
"""
ADD [Rx,] Ry, [Rz, PC]
ADD [Rx,] [SP, PC], #imm10_4
ADD [SP,] SP, #imm9_4
Add Ry and Rz and store the result in Rx
Rx, Ry, and Rz can be any register
If Rx is omitted, then it is assumed to be Ry
"""
# This instruction a... | [
"def",
"ADD",
"(",
"self",
",",
"params",
")",
":",
"# This instruction allows for an optional destination register",
"# If it is omitted, then it is assumed to be Rb",
"# As defined in http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0662b/index.html",
"# TODO can we have ADD SP... | ADD [Rx,] Ry, [Rz, PC]
ADD [Rx,] [SP, PC], #imm10_4
ADD [SP,] SP, #imm9_4
Add Ry and Rz and store the result in Rx
Rx, Ry, and Rz can be any register
If Rx is omitted, then it is assumed to be Ry | [
"ADD",
"[",
"Rx",
"]",
"Ry",
"[",
"Rz",
"PC",
"]",
"ADD",
"[",
"Rx",
"]",
"[",
"SP",
"PC",
"]",
"#imm10_4",
"ADD",
"[",
"SP",
"]",
"SP",
"#imm9_4"
] | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/arithmetic.py#L37-L80 | train |
DeepHorizons/iarm | iarm/arm_instructions/arithmetic.py | Arithmetic.CMN | def CMN(self, params):
"""
CMN Ra, Rb
Add the two registers and set the NZCV flags
The result is discarded
Ra and Rb must be low registers
"""
Ra, Rb = self.get_two_parameters(self.TWO_PARAMETER_COMMA_SEPARATED, params)
self.check_arguments(low_registers... | python | def CMN(self, params):
"""
CMN Ra, Rb
Add the two registers and set the NZCV flags
The result is discarded
Ra and Rb must be low registers
"""
Ra, Rb = self.get_two_parameters(self.TWO_PARAMETER_COMMA_SEPARATED, params)
self.check_arguments(low_registers... | [
"def",
"CMN",
"(",
"self",
",",
"params",
")",
":",
"Ra",
",",
"Rb",
"=",
"self",
".",
"get_two_parameters",
"(",
"self",
".",
"TWO_PARAMETER_COMMA_SEPARATED",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"low_registers",
"=",
"(",
"Ra",
",",
... | CMN Ra, Rb
Add the two registers and set the NZCV flags
The result is discarded
Ra and Rb must be low registers | [
"CMN",
"Ra",
"Rb"
] | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/arithmetic.py#L132-L149 | train |
DeepHorizons/iarm | iarm/arm_instructions/arithmetic.py | Arithmetic.CMP | def CMP(self, params):
"""
CMP Rm, Rn
CMP Rm, #imm8
Subtract Rn or imm8 from Rm, set the NZCV flags, and discard the result
Rm and Rn can be R0-R14
"""
Rm, Rn = self.get_two_parameters(self.TWO_PARAMETER_COMMA_SEPARATED, params)
if self.is_register(Rn):
... | python | def CMP(self, params):
"""
CMP Rm, Rn
CMP Rm, #imm8
Subtract Rn or imm8 from Rm, set the NZCV flags, and discard the result
Rm and Rn can be R0-R14
"""
Rm, Rn = self.get_two_parameters(self.TWO_PARAMETER_COMMA_SEPARATED, params)
if self.is_register(Rn):
... | [
"def",
"CMP",
"(",
"self",
",",
"params",
")",
":",
"Rm",
",",
"Rn",
"=",
"self",
".",
"get_two_parameters",
"(",
"self",
".",
"TWO_PARAMETER_COMMA_SEPARATED",
",",
"params",
")",
"if",
"self",
".",
"is_register",
"(",
"Rn",
")",
":",
"# CMP Rm, Rn",
"se... | CMP Rm, Rn
CMP Rm, #imm8
Subtract Rn or imm8 from Rm, set the NZCV flags, and discard the result
Rm and Rn can be R0-R14 | [
"CMP",
"Rm",
"Rn",
"CMP",
"Rm",
"#imm8"
] | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/arithmetic.py#L151-L177 | train |
DeepHorizons/iarm | iarm/arm_instructions/arithmetic.py | Arithmetic.MULS | def MULS(self, params):
"""
MULS Ra, Rb, Ra
Multiply Rb and Ra together and store the result in Ra.
Set the NZ flags.
Ra and Rb must be low registers
The first and last operand must be the same register
"""
Ra, Rb, Rc = self.get_three_parameters(self.THRE... | python | def MULS(self, params):
"""
MULS Ra, Rb, Ra
Multiply Rb and Ra together and store the result in Ra.
Set the NZ flags.
Ra and Rb must be low registers
The first and last operand must be the same register
"""
Ra, Rb, Rc = self.get_three_parameters(self.THRE... | [
"def",
"MULS",
"(",
"self",
",",
"params",
")",
":",
"Ra",
",",
"Rb",
",",
"Rc",
"=",
"self",
".",
"get_three_parameters",
"(",
"self",
".",
"THREE_PARAMETER_COMMA_SEPARATED",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"low_registers",
"=",
"... | MULS Ra, Rb, Ra
Multiply Rb and Ra together and store the result in Ra.
Set the NZ flags.
Ra and Rb must be low registers
The first and last operand must be the same register | [
"MULS",
"Ra",
"Rb",
"Ra"
] | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/arithmetic.py#L179-L199 | train |
DeepHorizons/iarm | iarm/arm_instructions/arithmetic.py | Arithmetic.RSBS | def RSBS(self, params):
"""
RSBS [Ra,] Rb, #0
Subtract Rb from zero (0 - Rb) and store the result in Ra
Set the NZCV flags
Ra and Rb must be low registers
if Ra is omitted, then it is assumed to be Rb
"""
# This instruction allows for an optional destinat... | python | def RSBS(self, params):
"""
RSBS [Ra,] Rb, #0
Subtract Rb from zero (0 - Rb) and store the result in Ra
Set the NZCV flags
Ra and Rb must be low registers
if Ra is omitted, then it is assumed to be Rb
"""
# This instruction allows for an optional destinat... | [
"def",
"RSBS",
"(",
"self",
",",
"params",
")",
":",
"# This instruction allows for an optional destination register",
"# If it is omitted, then it is assumed to be Rb",
"# As defined in http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0662b/index.html",
"try",
":",
"Ra",
"... | RSBS [Ra,] Rb, #0
Subtract Rb from zero (0 - Rb) and store the result in Ra
Set the NZCV flags
Ra and Rb must be low registers
if Ra is omitted, then it is assumed to be Rb | [
"RSBS",
"[",
"Ra",
"]",
"Rb",
"#0"
] | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/arithmetic.py#L212-L240 | train |
DeepHorizons/iarm | iarm/arm_instructions/arithmetic.py | Arithmetic.SUB | def SUB(self, params):
"""
SUB [SP,] SP, #imm9_4
Subtract an immediate from the Stack Pointer
The first SP is optional
"""
# This instruction allows for an optional destination register
# If it is omitted, then it is assumed to be Rb
# As defined in http:... | python | def SUB(self, params):
"""
SUB [SP,] SP, #imm9_4
Subtract an immediate from the Stack Pointer
The first SP is optional
"""
# This instruction allows for an optional destination register
# If it is omitted, then it is assumed to be Rb
# As defined in http:... | [
"def",
"SUB",
"(",
"self",
",",
"params",
")",
":",
"# This instruction allows for an optional destination register",
"# If it is omitted, then it is assumed to be Rb",
"# As defined in http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0662b/index.html",
"try",
":",
"Ra",
",... | SUB [SP,] SP, #imm9_4
Subtract an immediate from the Stack Pointer
The first SP is optional | [
"SUB",
"[",
"SP",
"]",
"SP",
"#imm9_4"
] | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/arithmetic.py#L273-L299 | train |
DeepHorizons/iarm | iarm/arm_instructions/arithmetic.py | Arithmetic.SUBS | def SUBS(self, params):
"""
SUBS [Ra,] Rb, Rc
SUBS [Ra,] Rb, #imm3
SUBS [Ra,] Ra, #imm8
Subtract Rc or an immediate from Rb and store the result in Ra
Ra, Rb, and Rc must be low registers
If Ra is omitted, then it is assumed to be Rb
"""
# This in... | python | def SUBS(self, params):
"""
SUBS [Ra,] Rb, Rc
SUBS [Ra,] Rb, #imm3
SUBS [Ra,] Ra, #imm8
Subtract Rc or an immediate from Rb and store the result in Ra
Ra, Rb, and Rc must be low registers
If Ra is omitted, then it is assumed to be Rb
"""
# This in... | [
"def",
"SUBS",
"(",
"self",
",",
"params",
")",
":",
"# This instruction allows for an optional destination register",
"# If it is omitted, then it is assumed to be Rb",
"# As defined in http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0662b/index.html",
"try",
":",
"Ra",
"... | SUBS [Ra,] Rb, Rc
SUBS [Ra,] Rb, #imm3
SUBS [Ra,] Ra, #imm8
Subtract Rc or an immediate from Rb and store the result in Ra
Ra, Rb, and Rc must be low registers
If Ra is omitted, then it is assumed to be Rb | [
"SUBS",
"[",
"Ra",
"]",
"Rb",
"Rc",
"SUBS",
"[",
"Ra",
"]",
"Rb",
"#imm3",
"SUBS",
"[",
"Ra",
"]",
"Ra",
"#imm8"
] | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/arithmetic.py#L301-L347 | train |
glomex/gcdt | gcdt/kumo_particle_helper.py | initialize | def initialize(template, service_name, environment='dev'):
"""Adds SERVICE_NAME, SERVICE_ENVIRONMENT, and DEFAULT_TAGS to the template
:param template:
:param service_name:
:param environment:
:return:
"""
template.SERVICE_NAME = os.getenv('SERVICE_NAME', service_name)
template.SERVICE_... | python | def initialize(template, service_name, environment='dev'):
"""Adds SERVICE_NAME, SERVICE_ENVIRONMENT, and DEFAULT_TAGS to the template
:param template:
:param service_name:
:param environment:
:return:
"""
template.SERVICE_NAME = os.getenv('SERVICE_NAME', service_name)
template.SERVICE_... | [
"def",
"initialize",
"(",
"template",
",",
"service_name",
",",
"environment",
"=",
"'dev'",
")",
":",
"template",
".",
"SERVICE_NAME",
"=",
"os",
".",
"getenv",
"(",
"'SERVICE_NAME'",
",",
"service_name",
")",
"template",
".",
"SERVICE_ENVIRONMENT",
"=",
"os"... | Adds SERVICE_NAME, SERVICE_ENVIRONMENT, and DEFAULT_TAGS to the template
:param template:
:param service_name:
:param environment:
:return: | [
"Adds",
"SERVICE_NAME",
"SERVICE_ENVIRONMENT",
"and",
"DEFAULT_TAGS",
"to",
"the",
"template"
] | cd67cf416371337b83cb9ca3f696277125703339 | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/kumo_particle_helper.py#L14-L29 | train |
glomex/gcdt | gcdt/package_utils.py | get_dist | def get_dist(dist_name, lookup_dirs=None):
"""Get dist for installed version of dist_name avoiding pkg_resources cache
"""
# note: based on pip/utils/__init__.py, get_installed_version(...)
# Create a requirement that we'll look for inside of setuptools.
req = pkg_resources.Requirement.parse(dist_n... | python | def get_dist(dist_name, lookup_dirs=None):
"""Get dist for installed version of dist_name avoiding pkg_resources cache
"""
# note: based on pip/utils/__init__.py, get_installed_version(...)
# Create a requirement that we'll look for inside of setuptools.
req = pkg_resources.Requirement.parse(dist_n... | [
"def",
"get_dist",
"(",
"dist_name",
",",
"lookup_dirs",
"=",
"None",
")",
":",
"# note: based on pip/utils/__init__.py, get_installed_version(...)",
"# Create a requirement that we'll look for inside of setuptools.",
"req",
"=",
"pkg_resources",
".",
"Requirement",
".",
"parse",... | Get dist for installed version of dist_name avoiding pkg_resources cache | [
"Get",
"dist",
"for",
"installed",
"version",
"of",
"dist_name",
"avoiding",
"pkg_resources",
"cache"
] | cd67cf416371337b83cb9ca3f696277125703339 | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/package_utils.py#L8-L24 | train |
glomex/gcdt | gcdt/package_utils.py | get_package_versions | def get_package_versions(package):
"""Get the package version information (=SetuptoolsVersion) which is
comparable.
note: we use the pip list_command implementation for this
:param package: name of the package
:return: installed version, latest available version
"""
list_command = ListComma... | python | def get_package_versions(package):
"""Get the package version information (=SetuptoolsVersion) which is
comparable.
note: we use the pip list_command implementation for this
:param package: name of the package
:return: installed version, latest available version
"""
list_command = ListComma... | [
"def",
"get_package_versions",
"(",
"package",
")",
":",
"list_command",
"=",
"ListCommand",
"(",
")",
"options",
",",
"args",
"=",
"list_command",
".",
"parse_args",
"(",
"[",
"]",
")",
"packages",
"=",
"[",
"get_dist",
"(",
"package",
")",
"]",
"dists",
... | Get the package version information (=SetuptoolsVersion) which is
comparable.
note: we use the pip list_command implementation for this
:param package: name of the package
:return: installed version, latest available version | [
"Get",
"the",
"package",
"version",
"information",
"(",
"=",
"SetuptoolsVersion",
")",
"which",
"is",
"comparable",
".",
"note",
":",
"we",
"use",
"the",
"pip",
"list_command",
"implementation",
"for",
"this"
] | cd67cf416371337b83cb9ca3f696277125703339 | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/package_utils.py#L27-L43 | train |
glomex/gcdt | gcdt/gcdt_lifecycle.py | _load_hooks | def _load_hooks(path):
"""Load hook module and register signals.
:param path: Absolute or relative path to module.
:return: module
"""
module = imp.load_source(os.path.splitext(os.path.basename(path))[0], path)
if not check_hook_mechanism_is_intact(module):
# no hooks - do nothing
... | python | def _load_hooks(path):
"""Load hook module and register signals.
:param path: Absolute or relative path to module.
:return: module
"""
module = imp.load_source(os.path.splitext(os.path.basename(path))[0], path)
if not check_hook_mechanism_is_intact(module):
# no hooks - do nothing
... | [
"def",
"_load_hooks",
"(",
"path",
")",
":",
"module",
"=",
"imp",
".",
"load_source",
"(",
"os",
".",
"path",
".",
"splitext",
"(",
"os",
".",
"path",
".",
"basename",
"(",
"path",
")",
")",
"[",
"0",
"]",
",",
"path",
")",
"if",
"not",
"check_h... | Load hook module and register signals.
:param path: Absolute or relative path to module.
:return: module | [
"Load",
"hook",
"module",
"and",
"register",
"signals",
"."
] | cd67cf416371337b83cb9ca3f696277125703339 | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/gcdt_lifecycle.py#L29-L43 | train |
glomex/gcdt | gcdt/gcdt_lifecycle.py | lifecycle | def lifecycle(awsclient, env, tool, command, arguments):
"""Tool lifecycle which provides hooks into the different stages of the
command execution. See signals for hook details.
"""
log.debug('### init')
load_plugins()
context = get_context(awsclient, env, tool, command, arguments)
# every t... | python | def lifecycle(awsclient, env, tool, command, arguments):
"""Tool lifecycle which provides hooks into the different stages of the
command execution. See signals for hook details.
"""
log.debug('### init')
load_plugins()
context = get_context(awsclient, env, tool, command, arguments)
# every t... | [
"def",
"lifecycle",
"(",
"awsclient",
",",
"env",
",",
"tool",
",",
"command",
",",
"arguments",
")",
":",
"log",
".",
"debug",
"(",
"'### init'",
")",
"load_plugins",
"(",
")",
"context",
"=",
"get_context",
"(",
"awsclient",
",",
"env",
",",
"tool",
... | Tool lifecycle which provides hooks into the different stages of the
command execution. See signals for hook details. | [
"Tool",
"lifecycle",
"which",
"provides",
"hooks",
"into",
"the",
"different",
"stages",
"of",
"the",
"command",
"execution",
".",
"See",
"signals",
"for",
"hook",
"details",
"."
] | cd67cf416371337b83cb9ca3f696277125703339 | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/gcdt_lifecycle.py#L48-L171 | train |
glomex/gcdt | gcdt/gcdt_lifecycle.py | main | def main(doc, tool, dispatch_only=None):
"""gcdt tools parametrized main function to initiate gcdt lifecycle.
:param doc: docopt string
:param tool: gcdt tool (gcdt, kumo, tenkai, ramuda, yugen)
:param dispatch_only: list of commands which do not use gcdt lifecycle
:return: exit_code
"""
# ... | python | def main(doc, tool, dispatch_only=None):
"""gcdt tools parametrized main function to initiate gcdt lifecycle.
:param doc: docopt string
:param tool: gcdt tool (gcdt, kumo, tenkai, ramuda, yugen)
:param dispatch_only: list of commands which do not use gcdt lifecycle
:return: exit_code
"""
# ... | [
"def",
"main",
"(",
"doc",
",",
"tool",
",",
"dispatch_only",
"=",
"None",
")",
":",
"# Use signal handler to throw exception which can be caught to allow",
"# graceful exit.",
"# here: https://stackoverflow.com/questions/26414704/how-does-a-python-process-exit-gracefully-after-receiving... | gcdt tools parametrized main function to initiate gcdt lifecycle.
:param doc: docopt string
:param tool: gcdt tool (gcdt, kumo, tenkai, ramuda, yugen)
:param dispatch_only: list of commands which do not use gcdt lifecycle
:return: exit_code | [
"gcdt",
"tools",
"parametrized",
"main",
"function",
"to",
"initiate",
"gcdt",
"lifecycle",
"."
] | cd67cf416371337b83cb9ca3f696277125703339 | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/gcdt_lifecycle.py#L174-L217 | train |
DeepHorizons/iarm | iarm/arm_instructions/data_movement.py | DataMovement.MOV | def MOV(self, params):
"""
MOV Rx, Ry
MOV PC, Ry
Move the value of Ry into Rx or PC
"""
Rx, Ry = self.get_two_parameters(self.TWO_PARAMETER_COMMA_SEPARATED, params)
self.check_arguments(any_registers=(Rx, Ry))
def MOV_func():
self.register[R... | python | def MOV(self, params):
"""
MOV Rx, Ry
MOV PC, Ry
Move the value of Ry into Rx or PC
"""
Rx, Ry = self.get_two_parameters(self.TWO_PARAMETER_COMMA_SEPARATED, params)
self.check_arguments(any_registers=(Rx, Ry))
def MOV_func():
self.register[R... | [
"def",
"MOV",
"(",
"self",
",",
"params",
")",
":",
"Rx",
",",
"Ry",
"=",
"self",
".",
"get_two_parameters",
"(",
"self",
".",
"TWO_PARAMETER_COMMA_SEPARATED",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"any_registers",
"=",
"(",
"Rx",
",",
... | MOV Rx, Ry
MOV PC, Ry
Move the value of Ry into Rx or PC | [
"MOV",
"Rx",
"Ry",
"MOV",
"PC",
"Ry"
] | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/data_movement.py#L11-L25 | train |
DeepHorizons/iarm | iarm/arm_instructions/data_movement.py | DataMovement.MOVS | def MOVS(self, params):
"""
MOVS Ra, Rb
MOVS Ra, #imm8
Move the value of Rb or imm8 into Ra
Ra and Rb must be low registers
"""
Ra, Rb = self.get_two_parameters(self.TWO_PARAMETER_COMMA_SEPARATED, params)
if self.is_immediate(Rb):
self.check_... | python | def MOVS(self, params):
"""
MOVS Ra, Rb
MOVS Ra, #imm8
Move the value of Rb or imm8 into Ra
Ra and Rb must be low registers
"""
Ra, Rb = self.get_two_parameters(self.TWO_PARAMETER_COMMA_SEPARATED, params)
if self.is_immediate(Rb):
self.check_... | [
"def",
"MOVS",
"(",
"self",
",",
"params",
")",
":",
"Ra",
",",
"Rb",
"=",
"self",
".",
"get_two_parameters",
"(",
"self",
".",
"TWO_PARAMETER_COMMA_SEPARATED",
",",
"params",
")",
"if",
"self",
".",
"is_immediate",
"(",
"Rb",
")",
":",
"self",
".",
"c... | MOVS Ra, Rb
MOVS Ra, #imm8
Move the value of Rb or imm8 into Ra
Ra and Rb must be low registers | [
"MOVS",
"Ra",
"Rb",
"MOVS",
"Ra",
"#imm8"
] | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/data_movement.py#L27-L57 | train |
DeepHorizons/iarm | iarm/arm_instructions/data_movement.py | DataMovement.MRS | def MRS(self, params):
"""
MRS Rj, Rspecial
Copy the value of Rspecial to Rj
Rspecial can be APSR, IPSR, or EPSR
"""
Rj, Rspecial = self.get_two_parameters(self.TWO_PARAMETER_COMMA_SEPARATED, params)
self.check_arguments(LR_or_general_purpose_registers=(Rj,), sp... | python | def MRS(self, params):
"""
MRS Rj, Rspecial
Copy the value of Rspecial to Rj
Rspecial can be APSR, IPSR, or EPSR
"""
Rj, Rspecial = self.get_two_parameters(self.TWO_PARAMETER_COMMA_SEPARATED, params)
self.check_arguments(LR_or_general_purpose_registers=(Rj,), sp... | [
"def",
"MRS",
"(",
"self",
",",
"params",
")",
":",
"Rj",
",",
"Rspecial",
"=",
"self",
".",
"get_two_parameters",
"(",
"self",
".",
"TWO_PARAMETER_COMMA_SEPARATED",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"LR_or_general_purpose_registers",
"=",... | MRS Rj, Rspecial
Copy the value of Rspecial to Rj
Rspecial can be APSR, IPSR, or EPSR | [
"MRS",
"Rj",
"Rspecial"
] | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/data_movement.py#L59-L79 | train |
DeepHorizons/iarm | iarm/arm_instructions/data_movement.py | DataMovement.MSR | def MSR(self, params):
"""
MSR Rspecial, Rj
Copy the value of Rj to Rspecial
Rspecial can be APSR, IPSR, or EPSR
"""
Rspecial, Rj = self.get_two_parameters(self.TWO_PARAMETER_COMMA_SEPARATED, params)
self.check_arguments(LR_or_general_purpose_registers=(Rj,), sp... | python | def MSR(self, params):
"""
MSR Rspecial, Rj
Copy the value of Rj to Rspecial
Rspecial can be APSR, IPSR, or EPSR
"""
Rspecial, Rj = self.get_two_parameters(self.TWO_PARAMETER_COMMA_SEPARATED, params)
self.check_arguments(LR_or_general_purpose_registers=(Rj,), sp... | [
"def",
"MSR",
"(",
"self",
",",
"params",
")",
":",
"Rspecial",
",",
"Rj",
"=",
"self",
".",
"get_two_parameters",
"(",
"self",
".",
"TWO_PARAMETER_COMMA_SEPARATED",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"LR_or_general_purpose_registers",
"=",... | MSR Rspecial, Rj
Copy the value of Rj to Rspecial
Rspecial can be APSR, IPSR, or EPSR | [
"MSR",
"Rspecial",
"Rj"
] | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/data_movement.py#L81-L103 | train |
DeepHorizons/iarm | iarm/arm_instructions/data_movement.py | DataMovement.MVNS | def MVNS(self, params):
"""
MVNS Ra, Rb
Negate the value in Rb and store it in Ra
Ra and Rb must be a low register
"""
Ra, Rb = self.get_two_parameters(self.TWO_PARAMETER_COMMA_SEPARATED, params)
self.check_arguments(low_registers=(Ra, Rb))
def MVNS_fun... | python | def MVNS(self, params):
"""
MVNS Ra, Rb
Negate the value in Rb and store it in Ra
Ra and Rb must be a low register
"""
Ra, Rb = self.get_two_parameters(self.TWO_PARAMETER_COMMA_SEPARATED, params)
self.check_arguments(low_registers=(Ra, Rb))
def MVNS_fun... | [
"def",
"MVNS",
"(",
"self",
",",
"params",
")",
":",
"Ra",
",",
"Rb",
"=",
"self",
".",
"get_two_parameters",
"(",
"self",
".",
"TWO_PARAMETER_COMMA_SEPARATED",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"low_registers",
"=",
"(",
"Ra",
",",
... | MVNS Ra, Rb
Negate the value in Rb and store it in Ra
Ra and Rb must be a low register | [
"MVNS",
"Ra",
"Rb"
] | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/data_movement.py#L105-L120 | train |
DeepHorizons/iarm | iarm/arm_instructions/data_movement.py | DataMovement.REV | def REV(self, params):
"""
REV Ra, Rb
Reverse the byte order in register Rb and store the result in Ra
"""
Ra, Rb = self.get_two_parameters(self.TWO_PARAMETER_COMMA_SEPARATED, params)
self.check_arguments(low_registers=(Ra, Rb))
def REV_func():
self... | python | def REV(self, params):
"""
REV Ra, Rb
Reverse the byte order in register Rb and store the result in Ra
"""
Ra, Rb = self.get_two_parameters(self.TWO_PARAMETER_COMMA_SEPARATED, params)
self.check_arguments(low_registers=(Ra, Rb))
def REV_func():
self... | [
"def",
"REV",
"(",
"self",
",",
"params",
")",
":",
"Ra",
",",
"Rb",
"=",
"self",
".",
"get_two_parameters",
"(",
"self",
".",
"TWO_PARAMETER_COMMA_SEPARATED",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"low_registers",
"=",
"(",
"Ra",
",",
... | REV Ra, Rb
Reverse the byte order in register Rb and store the result in Ra | [
"REV",
"Ra",
"Rb"
] | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/data_movement.py#L122-L138 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.