repository_name stringlengths 7 55 | func_path_in_repository stringlengths 4 223 | func_name stringlengths 1 134 | whole_func_string stringlengths 75 104k | language stringclasses 1
value | func_code_string stringlengths 75 104k | func_code_tokens listlengths 19 28.4k | func_documentation_string stringlengths 1 46.9k | func_documentation_tokens listlengths 1 1.97k | split_name stringclasses 1
value | func_code_url stringlengths 87 315 |
|---|---|---|---|---|---|---|---|---|---|---|
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"
] | train | https://github.com/lincolnloop/salmon/blob/62a965ad9716707ea1db4afb5d9646766f29b64b/salmon/core/graph.py#L44-L70 |
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,则可以到下一页"
] | train | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/utils.py#L25-L39 |
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"
] | train | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/arithmetic.py#L6-L35 |
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"
] | train | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/arithmetic.py#L37-L80 |
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"
] | train | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/arithmetic.py#L132-L149 |
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"
] | train | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/arithmetic.py#L151-L177 |
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"
] | train | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/arithmetic.py#L179-L199 |
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"
] | train | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/arithmetic.py#L212-L240 |
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"
] | train | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/arithmetic.py#L273-L299 |
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"
] | train | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/arithmetic.py#L301-L347 |
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"
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/kumo_particle_helper.py#L14-L29 |
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"
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/package_utils.py#L8-L24 |
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"
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/package_utils.py#L27-L43 |
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",
"."
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/gcdt_lifecycle.py#L29-L43 |
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",
"."
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/gcdt_lifecycle.py#L48-L171 |
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",
"."
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/gcdt_lifecycle.py#L174-L217 |
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"
] | train | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/data_movement.py#L11-L25 |
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"
] | train | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/data_movement.py#L27-L57 |
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"
] | train | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/data_movement.py#L59-L79 |
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"
] | train | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/data_movement.py#L81-L103 |
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"
] | train | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/data_movement.py#L105-L120 |
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"
] | train | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/data_movement.py#L122-L138 |
DeepHorizons/iarm | iarm/arm_instructions/data_movement.py | DataMovement.REV16 | def REV16(self, params):
"""
REV16 Ra, Rb
Reverse the byte order of the half words 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 REV16_... | python | def REV16(self, params):
"""
REV16 Ra, Rb
Reverse the byte order of the half words 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 REV16_... | [
"def",
"REV16",
"(",
"self",
",",
"params",
")",
":",
"Ra",
",",
"Rb",
"=",
"self",
".",
"get_two_parameters",
"(",
"self",
".",
"TWO_PARAMETER_COMMA_SEPARATED",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"low_registers",
"=",
"(",
"Ra",
",",... | REV16 Ra, Rb
Reverse the byte order of the half words in register Rb and store the result in Ra | [
"REV16",
"Ra",
"Rb"
] | train | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/data_movement.py#L140-L154 |
DeepHorizons/iarm | iarm/arm_instructions/data_movement.py | DataMovement.REVSH | def REVSH(self, params):
"""
REVSH
Reverse the byte order in the lower half word in Rb and store the result in Ra.
If the result of the result is signed, then sign extend
"""
Ra, Rb = self.get_two_parameters(r'\s*([^\s,]*),\s*([^\s,]*)(,\s*[^\s,]*)*\s*', params)
... | python | def REVSH(self, params):
"""
REVSH
Reverse the byte order in the lower half word in Rb and store the result in Ra.
If the result of the result is signed, then sign extend
"""
Ra, Rb = self.get_two_parameters(r'\s*([^\s,]*),\s*([^\s,]*)(,\s*[^\s,]*)*\s*', params)
... | [
"def",
"REVSH",
"(",
"self",
",",
"params",
")",
":",
"Ra",
",",
"Rb",
"=",
"self",
".",
"get_two_parameters",
"(",
"r'\\s*([^\\s,]*),\\s*([^\\s,]*)(,\\s*[^\\s,]*)*\\s*'",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"low_registers",
"=",
"(",
"Ra",
... | REVSH
Reverse the byte order in the lower half word in Rb and store the result in Ra.
If the result of the result is signed, then sign extend | [
"REVSH"
] | train | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/data_movement.py#L156-L173 |
DeepHorizons/iarm | iarm/arm_instructions/data_movement.py | DataMovement.SXTB | def SXTB(self, params):
"""
STXB Ra, Rb
Sign extend the byte in Rb and store the result in Ra
"""
Ra, Rb = self.get_two_parameters(r'\s*([^\s,]*),\s*([^\s,]*)(,\s*[^\s,]*)*\s*', params)
self.check_arguments(low_registers=(Ra, Rb))
def SXTB_func():
i... | python | def SXTB(self, params):
"""
STXB Ra, Rb
Sign extend the byte in Rb and store the result in Ra
"""
Ra, Rb = self.get_two_parameters(r'\s*([^\s,]*),\s*([^\s,]*)(,\s*[^\s,]*)*\s*', params)
self.check_arguments(low_registers=(Ra, Rb))
def SXTB_func():
i... | [
"def",
"SXTB",
"(",
"self",
",",
"params",
")",
":",
"Ra",
",",
"Rb",
"=",
"self",
".",
"get_two_parameters",
"(",
"r'\\s*([^\\s,]*),\\s*([^\\s,]*)(,\\s*[^\\s,]*)*\\s*'",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"low_registers",
"=",
"(",
"Ra",
... | STXB Ra, Rb
Sign extend the byte in Rb and store the result in Ra | [
"STXB",
"Ra",
"Rb"
] | train | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/data_movement.py#L175-L191 |
DeepHorizons/iarm | iarm/arm_instructions/data_movement.py | DataMovement.SXTH | def SXTH(self, params):
"""
STXH Ra, Rb
Sign extend the half word in Rb and store the result in Ra
"""
Ra, Rb = self.get_two_parameters(r'\s*([^\s,]*),\s*([^\s,]*)(,\s*[^\s,]*)*\s*', params)
self.check_arguments(low_registers=(Ra, Rb))
def SXTH_func():
... | python | def SXTH(self, params):
"""
STXH Ra, Rb
Sign extend the half word in Rb and store the result in Ra
"""
Ra, Rb = self.get_two_parameters(r'\s*([^\s,]*),\s*([^\s,]*)(,\s*[^\s,]*)*\s*', params)
self.check_arguments(low_registers=(Ra, Rb))
def SXTH_func():
... | [
"def",
"SXTH",
"(",
"self",
",",
"params",
")",
":",
"Ra",
",",
"Rb",
"=",
"self",
".",
"get_two_parameters",
"(",
"r'\\s*([^\\s,]*),\\s*([^\\s,]*)(,\\s*[^\\s,]*)*\\s*'",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"low_registers",
"=",
"(",
"Ra",
... | STXH Ra, Rb
Sign extend the half word in Rb and store the result in Ra | [
"STXH",
"Ra",
"Rb"
] | train | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/data_movement.py#L193-L209 |
DeepHorizons/iarm | iarm/arm_instructions/data_movement.py | DataMovement.UXTB | def UXTB(self, params):
"""
UTXB Ra, Rb
Zero extend the byte in Rb and store the result in Ra
"""
Ra, Rb = self.get_two_parameters(r'\s*([^\s,]*),\s*([^\s,]*)(,\s*[^\s,]*)*\s*', params)
self.check_arguments(low_registers=(Ra, Rb))
def UXTB_func():
s... | python | def UXTB(self, params):
"""
UTXB Ra, Rb
Zero extend the byte in Rb and store the result in Ra
"""
Ra, Rb = self.get_two_parameters(r'\s*([^\s,]*),\s*([^\s,]*)(,\s*[^\s,]*)*\s*', params)
self.check_arguments(low_registers=(Ra, Rb))
def UXTB_func():
s... | [
"def",
"UXTB",
"(",
"self",
",",
"params",
")",
":",
"Ra",
",",
"Rb",
"=",
"self",
".",
"get_two_parameters",
"(",
"r'\\s*([^\\s,]*),\\s*([^\\s,]*)(,\\s*[^\\s,]*)*\\s*'",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"low_registers",
"=",
"(",
"Ra",
... | UTXB Ra, Rb
Zero extend the byte in Rb and store the result in Ra | [
"UTXB",
"Ra",
"Rb"
] | train | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/data_movement.py#L211-L224 |
DeepHorizons/iarm | iarm/arm_instructions/data_movement.py | DataMovement.UXTH | def UXTH(self, params):
"""
UTXH Ra, Rb
Zero extend the half word in Rb and store the result in Ra
"""
Ra, Rb = self.get_two_parameters(r'\s*([^\s,]*),\s*([^\s,]*)(,\s*[^\s,]*)*\s*', params)
self.check_arguments(low_registers=(Ra, Rb))
def UXTH_func():
... | python | def UXTH(self, params):
"""
UTXH Ra, Rb
Zero extend the half word in Rb and store the result in Ra
"""
Ra, Rb = self.get_two_parameters(r'\s*([^\s,]*),\s*([^\s,]*)(,\s*[^\s,]*)*\s*', params)
self.check_arguments(low_registers=(Ra, Rb))
def UXTH_func():
... | [
"def",
"UXTH",
"(",
"self",
",",
"params",
")",
":",
"Ra",
",",
"Rb",
"=",
"self",
".",
"get_two_parameters",
"(",
"r'\\s*([^\\s,]*),\\s*([^\\s,]*)(,\\s*[^\\s,]*)*\\s*'",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"low_registers",
"=",
"(",
"Ra",
... | UTXH Ra, Rb
Zero extend the half word in Rb and store the result in Ra | [
"UTXH",
"Ra",
"Rb"
] | train | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/data_movement.py#L226-L239 |
glomex/gcdt | gcdt/ramuda_wire.py | _get_event_type | def _get_event_type(evt_source):
"""Get type of event e.g. 's3', 'events', 'kinesis',...
:param evt_source:
:return:
"""
if 'schedule' in evt_source:
return 'events'
elif 'pattern' in evt_source:
return 'events'
elif 'log_group_name_prefix' in evt_source:
return 'clo... | python | def _get_event_type(evt_source):
"""Get type of event e.g. 's3', 'events', 'kinesis',...
:param evt_source:
:return:
"""
if 'schedule' in evt_source:
return 'events'
elif 'pattern' in evt_source:
return 'events'
elif 'log_group_name_prefix' in evt_source:
return 'clo... | [
"def",
"_get_event_type",
"(",
"evt_source",
")",
":",
"if",
"'schedule'",
"in",
"evt_source",
":",
"return",
"'events'",
"elif",
"'pattern'",
"in",
"evt_source",
":",
"return",
"'events'",
"elif",
"'log_group_name_prefix'",
"in",
"evt_source",
":",
"return",
"'cl... | Get type of event e.g. 's3', 'events', 'kinesis',...
:param evt_source:
:return: | [
"Get",
"type",
"of",
"event",
"e",
".",
"g",
".",
"s3",
"events",
"kinesis",
"..."
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/ramuda_wire.py#L28-L43 |
glomex/gcdt | gcdt/ramuda_wire.py | _get_event_source_obj | def _get_event_source_obj(awsclient, evt_source):
"""
Given awsclient, event_source dictionary item
create an event_source object of the appropriate event type
to schedule this event, and return the object.
"""
event_source_map = {
'dynamodb': event_source.dynamodb_stream.DynamoDBStreamE... | python | def _get_event_source_obj(awsclient, evt_source):
"""
Given awsclient, event_source dictionary item
create an event_source object of the appropriate event type
to schedule this event, and return the object.
"""
event_source_map = {
'dynamodb': event_source.dynamodb_stream.DynamoDBStreamE... | [
"def",
"_get_event_source_obj",
"(",
"awsclient",
",",
"evt_source",
")",
":",
"event_source_map",
"=",
"{",
"'dynamodb'",
":",
"event_source",
".",
"dynamodb_stream",
".",
"DynamoDBStreamEventSource",
",",
"'kinesis'",
":",
"event_source",
".",
"kinesis",
".",
"Kin... | Given awsclient, event_source dictionary item
create an event_source object of the appropriate event type
to schedule this event, and return the object. | [
"Given",
"awsclient",
"event_source",
"dictionary",
"item",
"create",
"an",
"event_source",
"object",
"of",
"the",
"appropriate",
"event",
"type",
"to",
"schedule",
"this",
"event",
"and",
"return",
"the",
"object",
"."
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/ramuda_wire.py#L84-L106 |
glomex/gcdt | gcdt/ramuda_wire.py | _add_event_source | def _add_event_source(awsclient, evt_source, lambda_arn):
"""
Given an event_source dictionary, create the object and add the event source.
"""
event_source_obj = _get_event_source_obj(awsclient, evt_source)
# (where zappa goes like remove, add)
# we go with update and add like this:
if eve... | python | def _add_event_source(awsclient, evt_source, lambda_arn):
"""
Given an event_source dictionary, create the object and add the event source.
"""
event_source_obj = _get_event_source_obj(awsclient, evt_source)
# (where zappa goes like remove, add)
# we go with update and add like this:
if eve... | [
"def",
"_add_event_source",
"(",
"awsclient",
",",
"evt_source",
",",
"lambda_arn",
")",
":",
"event_source_obj",
"=",
"_get_event_source_obj",
"(",
"awsclient",
",",
"evt_source",
")",
"# (where zappa goes like remove, add)",
"# we go with update and add like this:",
"if",
... | Given an event_source dictionary, create the object and add the event source. | [
"Given",
"an",
"event_source",
"dictionary",
"create",
"the",
"object",
"and",
"add",
"the",
"event",
"source",
"."
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/ramuda_wire.py#L109-L120 |
glomex/gcdt | gcdt/ramuda_wire.py | _remove_event_source | def _remove_event_source(awsclient, evt_source, lambda_arn):
"""
Given an event_source dictionary, create the object and remove the event source.
"""
event_source_obj = _get_event_source_obj(awsclient, evt_source)
if event_source_obj.exists(lambda_arn):
event_source_obj.remove(lambda_arn) | python | def _remove_event_source(awsclient, evt_source, lambda_arn):
"""
Given an event_source dictionary, create the object and remove the event source.
"""
event_source_obj = _get_event_source_obj(awsclient, evt_source)
if event_source_obj.exists(lambda_arn):
event_source_obj.remove(lambda_arn) | [
"def",
"_remove_event_source",
"(",
"awsclient",
",",
"evt_source",
",",
"lambda_arn",
")",
":",
"event_source_obj",
"=",
"_get_event_source_obj",
"(",
"awsclient",
",",
"evt_source",
")",
"if",
"event_source_obj",
".",
"exists",
"(",
"lambda_arn",
")",
":",
"even... | Given an event_source dictionary, create the object and remove the event source. | [
"Given",
"an",
"event_source",
"dictionary",
"create",
"the",
"object",
"and",
"remove",
"the",
"event",
"source",
"."
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/ramuda_wire.py#L123-L129 |
glomex/gcdt | gcdt/ramuda_wire.py | _get_event_source_status | def _get_event_source_status(awsclient, evt_source, lambda_arn):
"""
Given an event_source dictionary, create the object and get the event source status.
"""
event_source_obj = _get_event_source_obj(awsclient, evt_source)
return event_source_obj.status(lambda_arn) | python | def _get_event_source_status(awsclient, evt_source, lambda_arn):
"""
Given an event_source dictionary, create the object and get the event source status.
"""
event_source_obj = _get_event_source_obj(awsclient, evt_source)
return event_source_obj.status(lambda_arn) | [
"def",
"_get_event_source_status",
"(",
"awsclient",
",",
"evt_source",
",",
"lambda_arn",
")",
":",
"event_source_obj",
"=",
"_get_event_source_obj",
"(",
"awsclient",
",",
"evt_source",
")",
"return",
"event_source_obj",
".",
"status",
"(",
"lambda_arn",
")"
] | Given an event_source dictionary, create the object and get the event source status. | [
"Given",
"an",
"event_source",
"dictionary",
"create",
"the",
"object",
"and",
"get",
"the",
"event",
"source",
"status",
"."
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/ramuda_wire.py#L132-L137 |
glomex/gcdt | gcdt/ramuda_wire.py | unwire | def unwire(awsclient, events, lambda_name, alias_name=ALIAS_NAME):
"""Unwire a list of event from an AWS Lambda function.
'events' is a list of dictionaries, where the dict must contains the
'schedule' of the event as string, and an optional 'name' and 'description'.
:param awsclient:
:param event... | python | def unwire(awsclient, events, lambda_name, alias_name=ALIAS_NAME):
"""Unwire a list of event from an AWS Lambda function.
'events' is a list of dictionaries, where the dict must contains the
'schedule' of the event as string, and an optional 'name' and 'description'.
:param awsclient:
:param event... | [
"def",
"unwire",
"(",
"awsclient",
",",
"events",
",",
"lambda_name",
",",
"alias_name",
"=",
"ALIAS_NAME",
")",
":",
"if",
"not",
"lambda_exists",
"(",
"awsclient",
",",
"lambda_name",
")",
":",
"log",
".",
"error",
"(",
"colored",
".",
"red",
"(",
"'Th... | Unwire a list of event from an AWS Lambda function.
'events' is a list of dictionaries, where the dict must contains the
'schedule' of the event as string, and an optional 'name' and 'description'.
:param awsclient:
:param events: list of events
:param lambda_name:
:param alias_name:
:retu... | [
"Unwire",
"a",
"list",
"of",
"event",
"from",
"an",
"AWS",
"Lambda",
"function",
"."
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/ramuda_wire.py#L140-L181 |
glomex/gcdt | gcdt/ramuda_wire.py | wire_deprecated | def wire_deprecated(awsclient, function_name, s3_event_sources=None,
time_event_sources=None,
alias_name=ALIAS_NAME):
"""Deprecated! Please use wire!
:param awsclient:
:param function_name:
:param s3_event_sources: dictionary
:param time_event_sources:
:... | python | def wire_deprecated(awsclient, function_name, s3_event_sources=None,
time_event_sources=None,
alias_name=ALIAS_NAME):
"""Deprecated! Please use wire!
:param awsclient:
:param function_name:
:param s3_event_sources: dictionary
:param time_event_sources:
:... | [
"def",
"wire_deprecated",
"(",
"awsclient",
",",
"function_name",
",",
"s3_event_sources",
"=",
"None",
",",
"time_event_sources",
"=",
"None",
",",
"alias_name",
"=",
"ALIAS_NAME",
")",
":",
"if",
"not",
"lambda_exists",
"(",
"awsclient",
",",
"function_name",
... | Deprecated! Please use wire!
:param awsclient:
:param function_name:
:param s3_event_sources: dictionary
:param time_event_sources:
:param alias_name:
:return: exit_code | [
"Deprecated!",
"Please",
"use",
"wire!"
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/ramuda_wire.py#L191-L235 |
glomex/gcdt | gcdt/ramuda_wire.py | unwire_deprecated | def unwire_deprecated(awsclient, function_name, s3_event_sources=None,
time_event_sources=None, alias_name=ALIAS_NAME):
"""Deprecated! Please use unwire!
:param awsclient:
:param function_name:
:param s3_event_sources: dictionary
:param time_event_sources:
:param alias_nam... | python | def unwire_deprecated(awsclient, function_name, s3_event_sources=None,
time_event_sources=None, alias_name=ALIAS_NAME):
"""Deprecated! Please use unwire!
:param awsclient:
:param function_name:
:param s3_event_sources: dictionary
:param time_event_sources:
:param alias_nam... | [
"def",
"unwire_deprecated",
"(",
"awsclient",
",",
"function_name",
",",
"s3_event_sources",
"=",
"None",
",",
"time_event_sources",
"=",
"None",
",",
"alias_name",
"=",
"ALIAS_NAME",
")",
":",
"if",
"not",
"lambda_exists",
"(",
"awsclient",
",",
"function_name",
... | Deprecated! Please use unwire!
:param awsclient:
:param function_name:
:param s3_event_sources: dictionary
:param time_event_sources:
:param alias_name:
:return: exit_code | [
"Deprecated!",
"Please",
"use",
"unwire!"
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/ramuda_wire.py#L238-L313 |
glomex/gcdt | gcdt/ramuda_wire.py | _lambda_add_s3_event_source | def _lambda_add_s3_event_source(awsclient, arn, event, bucket, prefix,
suffix):
"""Use only prefix OR suffix
:param arn:
:param event:
:param bucket:
:param prefix:
:param suffix:
:return:
"""
json_data = {
'LambdaFunctionConfigurations': [{
... | python | def _lambda_add_s3_event_source(awsclient, arn, event, bucket, prefix,
suffix):
"""Use only prefix OR suffix
:param arn:
:param event:
:param bucket:
:param prefix:
:param suffix:
:return:
"""
json_data = {
'LambdaFunctionConfigurations': [{
... | [
"def",
"_lambda_add_s3_event_source",
"(",
"awsclient",
",",
"arn",
",",
"event",
",",
"bucket",
",",
"prefix",
",",
"suffix",
")",
":",
"json_data",
"=",
"{",
"'LambdaFunctionConfigurations'",
":",
"[",
"{",
"'LambdaFunctionArn'",
":",
"arn",
",",
"'Id'",
":"... | Use only prefix OR suffix
:param arn:
:param event:
:param bucket:
:param prefix:
:param suffix:
:return: | [
"Use",
"only",
"prefix",
"OR",
"suffix"
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/ramuda_wire.py#L616-L665 |
tdegeus/cppmat | cppmat/__init__.py | find_eigen | def find_eigen(hint=None):
r'''
Try to find the Eigen library. If successful the include directory is returned.
'''
# search with pkgconfig
# ---------------------
try:
import pkgconfig
if pkgconfig.installed('eigen3','>3.0.0'):
return pkgconfig.parse('eigen3')['include_dirs'][0]
except:
... | python | def find_eigen(hint=None):
r'''
Try to find the Eigen library. If successful the include directory is returned.
'''
# search with pkgconfig
# ---------------------
try:
import pkgconfig
if pkgconfig.installed('eigen3','>3.0.0'):
return pkgconfig.parse('eigen3')['include_dirs'][0]
except:
... | [
"def",
"find_eigen",
"(",
"hint",
"=",
"None",
")",
":",
"# search with pkgconfig",
"# ---------------------",
"try",
":",
"import",
"pkgconfig",
"if",
"pkgconfig",
".",
"installed",
"(",
"'eigen3'",
",",
"'>3.0.0'",
")",
":",
"return",
"pkgconfig",
".",
"parse"... | r'''
Try to find the Eigen library. If successful the include directory is returned. | [
"r",
"Try",
"to",
"find",
"the",
"Eigen",
"library",
".",
"If",
"successful",
"the",
"include",
"directory",
"is",
"returned",
"."
] | train | https://github.com/tdegeus/cppmat/blob/0d5031d08ce621a4d3e9c396779d99fd5203aa00/cppmat/__init__.py#L109-L157 |
glomex/gcdt | gcdt/ramuda_utils.py | check_and_format_logs_params | def check_and_format_logs_params(start, end, tail):
"""Helper to read the params for the logs command"""
def _decode_duration_type(duration_type):
durations = {'m': 'minutes', 'h': 'hours', 'd': 'days', 'w': 'weeks'}
return durations[duration_type]
if not start:
if tail:
... | python | def check_and_format_logs_params(start, end, tail):
"""Helper to read the params for the logs command"""
def _decode_duration_type(duration_type):
durations = {'m': 'minutes', 'h': 'hours', 'd': 'days', 'w': 'weeks'}
return durations[duration_type]
if not start:
if tail:
... | [
"def",
"check_and_format_logs_params",
"(",
"start",
",",
"end",
",",
"tail",
")",
":",
"def",
"_decode_duration_type",
"(",
"duration_type",
")",
":",
"durations",
"=",
"{",
"'m'",
":",
"'minutes'",
",",
"'h'",
":",
"'hours'",
",",
"'d'",
":",
"'days'",
"... | Helper to read the params for the logs command | [
"Helper",
"to",
"read",
"the",
"params",
"for",
"the",
"logs",
"command"
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/ramuda_utils.py#L201-L227 |
glomex/gcdt | gcdt/s3.py | upload_file_to_s3 | def upload_file_to_s3(awsclient, bucket, key, filename):
"""Upload a file to AWS S3 bucket.
:param awsclient:
:param bucket:
:param key:
:param filename:
:return:
"""
client_s3 = awsclient.get_client('s3')
transfer = S3Transfer(client_s3)
# Upload /tmp/myfile to s3://bucket/key ... | python | def upload_file_to_s3(awsclient, bucket, key, filename):
"""Upload a file to AWS S3 bucket.
:param awsclient:
:param bucket:
:param key:
:param filename:
:return:
"""
client_s3 = awsclient.get_client('s3')
transfer = S3Transfer(client_s3)
# Upload /tmp/myfile to s3://bucket/key ... | [
"def",
"upload_file_to_s3",
"(",
"awsclient",
",",
"bucket",
",",
"key",
",",
"filename",
")",
":",
"client_s3",
"=",
"awsclient",
".",
"get_client",
"(",
"'s3'",
")",
"transfer",
"=",
"S3Transfer",
"(",
"client_s3",
")",
"# Upload /tmp/myfile to s3://bucket/key a... | Upload a file to AWS S3 bucket.
:param awsclient:
:param bucket:
:param key:
:param filename:
:return: | [
"Upload",
"a",
"file",
"to",
"AWS",
"S3",
"bucket",
"."
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/s3.py#L73-L89 |
glomex/gcdt | gcdt/s3.py | remove_file_from_s3 | def remove_file_from_s3(awsclient, bucket, key):
"""Remove a file from an AWS S3 bucket.
:param awsclient:
:param bucket:
:param key:
:return:
"""
client_s3 = awsclient.get_client('s3')
response = client_s3.delete_object(Bucket=bucket, Key=key) | python | def remove_file_from_s3(awsclient, bucket, key):
"""Remove a file from an AWS S3 bucket.
:param awsclient:
:param bucket:
:param key:
:return:
"""
client_s3 = awsclient.get_client('s3')
response = client_s3.delete_object(Bucket=bucket, Key=key) | [
"def",
"remove_file_from_s3",
"(",
"awsclient",
",",
"bucket",
",",
"key",
")",
":",
"client_s3",
"=",
"awsclient",
".",
"get_client",
"(",
"'s3'",
")",
"response",
"=",
"client_s3",
".",
"delete_object",
"(",
"Bucket",
"=",
"bucket",
",",
"Key",
"=",
"key... | Remove a file from an AWS S3 bucket.
:param awsclient:
:param bucket:
:param key:
:return: | [
"Remove",
"a",
"file",
"from",
"an",
"AWS",
"S3",
"bucket",
"."
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/s3.py#L92-L101 |
glomex/gcdt | gcdt/s3.py | ls | def ls(awsclient, bucket, prefix=None):
"""List bucket contents
:param awsclient:
:param bucket:
:param prefix:
:return:
"""
# this works until 1000 keys!
params = {'Bucket': bucket}
if prefix:
params['Prefix'] = prefix
client_s3 = awsclient.get_client('s3')
objects ... | python | def ls(awsclient, bucket, prefix=None):
"""List bucket contents
:param awsclient:
:param bucket:
:param prefix:
:return:
"""
# this works until 1000 keys!
params = {'Bucket': bucket}
if prefix:
params['Prefix'] = prefix
client_s3 = awsclient.get_client('s3')
objects ... | [
"def",
"ls",
"(",
"awsclient",
",",
"bucket",
",",
"prefix",
"=",
"None",
")",
":",
"# this works until 1000 keys!",
"params",
"=",
"{",
"'Bucket'",
":",
"bucket",
"}",
"if",
"prefix",
":",
"params",
"[",
"'Prefix'",
"]",
"=",
"prefix",
"client_s3",
"=",
... | List bucket contents
:param awsclient:
:param bucket:
:param prefix:
:return: | [
"List",
"bucket",
"contents"
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/s3.py#L104-L120 |
DeepHorizons/iarm | iarm/arm_instructions/logic.py | Logic.ORRS | def ORRS(self, params):
"""
ORRS [Ra,] Ra, Rb
OR Ra and Rb together and store the result in Ra
The equivalent of `Ra = Ra | Rc`
Updates NZ flags
Ra and Rb must be low registers
The first register is optional
"""
# This instruction allows for an op... | python | def ORRS(self, params):
"""
ORRS [Ra,] Ra, Rb
OR Ra and Rb together and store the result in Ra
The equivalent of `Ra = Ra | Rc`
Updates NZ flags
Ra and Rb must be low registers
The first register is optional
"""
# This instruction allows for an op... | [
"def",
"ORRS",
"(",
"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",
"... | ORRS [Ra,] Ra, Rb
OR Ra and Rb together and store the result in Ra
The equivalent of `Ra = Ra | Rc`
Updates NZ flags
Ra and Rb must be low registers
The first register is optional | [
"ORRS",
"[",
"Ra",
"]",
"Ra",
"Rb"
] | train | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/logic.py#L93-L120 |
DeepHorizons/iarm | iarm/arm_instructions/logic.py | Logic.TST | def TST(self, params):
"""
TST Ra, Rb
AND Ra and Rb together and update the NZ flag. The result is not set
The equivalent of `Ra & Rc`
Ra and Rb must be low registers
"""
Ra, Rb = self.get_two_parameters(self.TWO_PARAMETER_COMMA_SEPARATED, params)
self.c... | python | def TST(self, params):
"""
TST Ra, Rb
AND Ra and Rb together and update the NZ flag. The result is not set
The equivalent of `Ra & Rc`
Ra and Rb must be low registers
"""
Ra, Rb = self.get_two_parameters(self.TWO_PARAMETER_COMMA_SEPARATED, params)
self.c... | [
"def",
"TST",
"(",
"self",
",",
"params",
")",
":",
"Ra",
",",
"Rb",
"=",
"self",
".",
"get_two_parameters",
"(",
"self",
".",
"TWO_PARAMETER_COMMA_SEPARATED",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"low_registers",
"=",
"(",
"Ra",
",",
... | TST Ra, Rb
AND Ra and Rb together and update the NZ flag. The result is not set
The equivalent of `Ra & Rc`
Ra and Rb must be low registers | [
"TST",
"Ra",
"Rb"
] | train | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/logic.py#L122-L138 |
matthiask/django-authlib | authlib/email.py | render_to_mail | def render_to_mail(template, context, **kwargs):
"""
Renders a mail and returns the resulting ``EmailMultiAlternatives``
instance
* ``template``: The base name of the text and HTML (optional) version of
the mail.
* ``context``: The context used to render the mail. This context instance
... | python | def render_to_mail(template, context, **kwargs):
"""
Renders a mail and returns the resulting ``EmailMultiAlternatives``
instance
* ``template``: The base name of the text and HTML (optional) version of
the mail.
* ``context``: The context used to render the mail. This context instance
... | [
"def",
"render_to_mail",
"(",
"template",
",",
"context",
",",
"*",
"*",
"kwargs",
")",
":",
"lines",
"=",
"iter",
"(",
"line",
".",
"rstrip",
"(",
")",
"for",
"line",
"in",
"render_to_string",
"(",
"\"%s.txt\"",
"%",
"template",
",",
"context",
")",
"... | Renders a mail and returns the resulting ``EmailMultiAlternatives``
instance
* ``template``: The base name of the text and HTML (optional) version of
the mail.
* ``context``: The context used to render the mail. This context instance
should contain everything required.
* Additional keyword ... | [
"Renders",
"a",
"mail",
"and",
"returns",
"the",
"resulting",
"EmailMultiAlternatives",
"instance"
] | train | https://github.com/matthiask/django-authlib/blob/a142da7e27fe9d30f34a84b12f24f686f9d2c8e1/authlib/email.py#L14-L61 |
matthiask/django-authlib | authlib/email.py | get_confirmation_url | def get_confirmation_url(email, request, name="email_registration_confirm", **kwargs):
"""
Returns the confirmation URL
"""
return request.build_absolute_uri(
reverse(name, kwargs={"code": get_confirmation_code(email, request, **kwargs)})
) | python | def get_confirmation_url(email, request, name="email_registration_confirm", **kwargs):
"""
Returns the confirmation URL
"""
return request.build_absolute_uri(
reverse(name, kwargs={"code": get_confirmation_code(email, request, **kwargs)})
) | [
"def",
"get_confirmation_url",
"(",
"email",
",",
"request",
",",
"name",
"=",
"\"email_registration_confirm\"",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"request",
".",
"build_absolute_uri",
"(",
"reverse",
"(",
"name",
",",
"kwargs",
"=",
"{",
"\"code\""... | Returns the confirmation URL | [
"Returns",
"the",
"confirmation",
"URL"
] | train | https://github.com/matthiask/django-authlib/blob/a142da7e27fe9d30f34a84b12f24f686f9d2c8e1/authlib/email.py#L81-L87 |
matthiask/django-authlib | authlib/email.py | send_registration_mail | def send_registration_mail(email, *, request, **kwargs):
"""send_registration_mail(email, *, request, **kwargs)
Sends the registration mail
* ``email``: The email address where the registration link should be
sent to.
* ``request``: A HTTP request instance, used to construct the complete
UR... | python | def send_registration_mail(email, *, request, **kwargs):
"""send_registration_mail(email, *, request, **kwargs)
Sends the registration mail
* ``email``: The email address where the registration link should be
sent to.
* ``request``: A HTTP request instance, used to construct the complete
UR... | [
"def",
"send_registration_mail",
"(",
"email",
",",
"*",
",",
"request",
",",
"*",
"*",
"kwargs",
")",
":",
"render_to_mail",
"(",
"\"registration/email_registration_email\"",
",",
"{",
"\"url\"",
":",
"get_confirmation_url",
"(",
"email",
",",
"request",
",",
"... | send_registration_mail(email, *, request, **kwargs)
Sends the registration mail
* ``email``: The email address where the registration link should be
sent to.
* ``request``: A HTTP request instance, used to construct the complete
URL (including protocol and domain) for the registration link.
... | [
"send_registration_mail",
"(",
"email",
"*",
"request",
"**",
"kwargs",
")",
"Sends",
"the",
"registration",
"mail"
] | train | https://github.com/matthiask/django-authlib/blob/a142da7e27fe9d30f34a84b12f24f686f9d2c8e1/authlib/email.py#L90-L115 |
matthiask/django-authlib | authlib/email.py | decode | def decode(code, *, max_age):
"""decode(code, *, max_age)
Decodes the code from the registration link and returns a tuple consisting
of the verified email address and the payload which was passed through to
``get_confirmation_code``.
The maximum age in seconds of the link has to be specified as ``m... | python | def decode(code, *, max_age):
"""decode(code, *, max_age)
Decodes the code from the registration link and returns a tuple consisting
of the verified email address and the payload which was passed through to
``get_confirmation_code``.
The maximum age in seconds of the link has to be specified as ``m... | [
"def",
"decode",
"(",
"code",
",",
"*",
",",
"max_age",
")",
":",
"try",
":",
"data",
"=",
"get_signer",
"(",
")",
".",
"unsign",
"(",
"code",
",",
"max_age",
"=",
"max_age",
")",
"except",
"signing",
".",
"SignatureExpired",
":",
"raise",
"ValidationE... | decode(code, *, max_age)
Decodes the code from the registration link and returns a tuple consisting
of the verified email address and the payload which was passed through to
``get_confirmation_code``.
The maximum age in seconds of the link has to be specified as ``max_age``.
This method raises ``V... | [
"decode",
"(",
"code",
"*",
"max_age",
")",
"Decodes",
"the",
"code",
"from",
"the",
"registration",
"link",
"and",
"returns",
"a",
"tuple",
"consisting",
"of",
"the",
"verified",
"email",
"address",
"and",
"the",
"payload",
"which",
"was",
"passed",
"throug... | train | https://github.com/matthiask/django-authlib/blob/a142da7e27fe9d30f34a84b12f24f686f9d2c8e1/authlib/email.py#L118-L146 |
jay-johnson/celery-loaders | celery_loaders/work_tasks/tasks.py | do_some_work | def do_some_work(
self,
work_dict):
"""do_some_work
:param work_dict: dictionary for key/values
"""
label = "do_some_work"
log.info(("task - {} - start "
"work_dict={}")
.format(label,
work_dict))
ret_data = {
"job_resul... | python | def do_some_work(
self,
work_dict):
"""do_some_work
:param work_dict: dictionary for key/values
"""
label = "do_some_work"
log.info(("task - {} - start "
"work_dict={}")
.format(label,
work_dict))
ret_data = {
"job_resul... | [
"def",
"do_some_work",
"(",
"self",
",",
"work_dict",
")",
":",
"label",
"=",
"\"do_some_work\"",
"log",
".",
"info",
"(",
"(",
"\"task - {} - start \"",
"\"work_dict={}\"",
")",
".",
"format",
"(",
"label",
",",
"work_dict",
")",
")",
"ret_data",
"=",
"{",
... | do_some_work
:param work_dict: dictionary for key/values | [
"do_some_work"
] | train | https://github.com/jay-johnson/celery-loaders/blob/aca8169c774582af42a377c27cb3980020080814/celery_loaders/work_tasks/tasks.py#L15-L40 |
glomex/gcdt | gcdt/route53.py | create_record | def create_record(awsclient, name_prefix, instance_reference, type="A", host_zone_name=None):
"""
Builds route53 record entries enabling DNS names for services
Note: gcdt.route53 create_record(awsclient, ...)
is used in dataplatform cloudformation.py templates!
:param name_prefix: The sub domain pr... | python | def create_record(awsclient, name_prefix, instance_reference, type="A", host_zone_name=None):
"""
Builds route53 record entries enabling DNS names for services
Note: gcdt.route53 create_record(awsclient, ...)
is used in dataplatform cloudformation.py templates!
:param name_prefix: The sub domain pr... | [
"def",
"create_record",
"(",
"awsclient",
",",
"name_prefix",
",",
"instance_reference",
",",
"type",
"=",
"\"A\"",
",",
"host_zone_name",
"=",
"None",
")",
":",
"# Only fetch the host zone from the COPS stack if nessary",
"if",
"host_zone_name",
"is",
"None",
":",
"h... | Builds route53 record entries enabling DNS names for services
Note: gcdt.route53 create_record(awsclient, ...)
is used in dataplatform cloudformation.py templates!
:param name_prefix: The sub domain prefix to use
:param instance_reference: The EC2 troposphere reference which's private IP should be link... | [
"Builds",
"route53",
"record",
"entries",
"enabling",
"DNS",
"names",
"for",
"services",
"Note",
":",
"gcdt",
".",
"route53",
"create_record",
"(",
"awsclient",
"...",
")",
"is",
"used",
"in",
"dataplatform",
"cloudformation",
".",
"py",
"templates!"
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/route53.py#L24-L70 |
glomex/gcdt | gcdt/route53.py | _retrieve_stack_host_zone_name | def _retrieve_stack_host_zone_name(awsclient, default_stack_name=None):
"""
Use service discovery to get the host zone name from the default stack
:return: Host zone name as string
"""
global _host_zone_name
if _host_zone_name is not None:
return _host_zone_name
env = get_env()
... | python | def _retrieve_stack_host_zone_name(awsclient, default_stack_name=None):
"""
Use service discovery to get the host zone name from the default stack
:return: Host zone name as string
"""
global _host_zone_name
if _host_zone_name is not None:
return _host_zone_name
env = get_env()
... | [
"def",
"_retrieve_stack_host_zone_name",
"(",
"awsclient",
",",
"default_stack_name",
"=",
"None",
")",
":",
"global",
"_host_zone_name",
"if",
"_host_zone_name",
"is",
"not",
"None",
":",
"return",
"_host_zone_name",
"env",
"=",
"get_env",
"(",
")",
"if",
"env",
... | Use service discovery to get the host zone name from the default stack
:return: Host zone name as string | [
"Use",
"service",
"discovery",
"to",
"get",
"the",
"host",
"zone",
"name",
"from",
"the",
"default",
"stack"
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/route53.py#L73-L105 |
glomex/gcdt | gcdt/gcdt_plugins.py | load_plugins | def load_plugins(group='gcdt10'):
"""Load and register installed gcdt plugins.
"""
# on using entrypoints:
# http://stackoverflow.com/questions/774824/explain-python-entry-points
# TODO: make sure we do not have conflicting generators installed!
for ep in pkg_resources.iter_entry_points(group, n... | python | def load_plugins(group='gcdt10'):
"""Load and register installed gcdt plugins.
"""
# on using entrypoints:
# http://stackoverflow.com/questions/774824/explain-python-entry-points
# TODO: make sure we do not have conflicting generators installed!
for ep in pkg_resources.iter_entry_points(group, n... | [
"def",
"load_plugins",
"(",
"group",
"=",
"'gcdt10'",
")",
":",
"# on using entrypoints:",
"# http://stackoverflow.com/questions/774824/explain-python-entry-points",
"# TODO: make sure we do not have conflicting generators installed!",
"for",
"ep",
"in",
"pkg_resources",
".",
"iter_e... | Load and register installed gcdt plugins. | [
"Load",
"and",
"register",
"installed",
"gcdt",
"plugins",
"."
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/gcdt_plugins.py#L18-L30 |
glomex/gcdt | gcdt/gcdt_plugins.py | get_plugin_versions | def get_plugin_versions(group='gcdt10'):
"""Load and register installed gcdt plugins.
"""
versions = {}
for ep in pkg_resources.iter_entry_points(group, name=None):
versions[ep.dist.project_name] = ep.dist.version
return versions | python | def get_plugin_versions(group='gcdt10'):
"""Load and register installed gcdt plugins.
"""
versions = {}
for ep in pkg_resources.iter_entry_points(group, name=None):
versions[ep.dist.project_name] = ep.dist.version
return versions | [
"def",
"get_plugin_versions",
"(",
"group",
"=",
"'gcdt10'",
")",
":",
"versions",
"=",
"{",
"}",
"for",
"ep",
"in",
"pkg_resources",
".",
"iter_entry_points",
"(",
"group",
",",
"name",
"=",
"None",
")",
":",
"versions",
"[",
"ep",
".",
"dist",
".",
"... | Load and register installed gcdt plugins. | [
"Load",
"and",
"register",
"installed",
"gcdt",
"plugins",
"."
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/gcdt_plugins.py#L33-L40 |
glomex/gcdt | gcdt/cloudwatch_logs.py | delete_log_group | def delete_log_group(awsclient, log_group_name):
"""Delete the specified log group
:param log_group_name: log group name
:return:
"""
client_logs = awsclient.get_client('logs')
response = client_logs.delete_log_group(
logGroupName=log_group_name
) | python | def delete_log_group(awsclient, log_group_name):
"""Delete the specified log group
:param log_group_name: log group name
:return:
"""
client_logs = awsclient.get_client('logs')
response = client_logs.delete_log_group(
logGroupName=log_group_name
) | [
"def",
"delete_log_group",
"(",
"awsclient",
",",
"log_group_name",
")",
":",
"client_logs",
"=",
"awsclient",
".",
"get_client",
"(",
"'logs'",
")",
"response",
"=",
"client_logs",
".",
"delete_log_group",
"(",
"logGroupName",
"=",
"log_group_name",
")"
] | Delete the specified log group
:param log_group_name: log group name
:return: | [
"Delete",
"the",
"specified",
"log",
"group"
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/cloudwatch_logs.py#L18-L28 |
glomex/gcdt | gcdt/cloudwatch_logs.py | put_retention_policy | def put_retention_policy(awsclient, log_group_name, retention_in_days):
"""Sets the retention of the specified log group
if the log group does not yet exist than it will be created first.
:param log_group_name: log group name
:param retention_in_days: log group name
:return:
"""
try:
... | python | def put_retention_policy(awsclient, log_group_name, retention_in_days):
"""Sets the retention of the specified log group
if the log group does not yet exist than it will be created first.
:param log_group_name: log group name
:param retention_in_days: log group name
:return:
"""
try:
... | [
"def",
"put_retention_policy",
"(",
"awsclient",
",",
"log_group_name",
",",
"retention_in_days",
")",
":",
"try",
":",
"# Note: for AWS Lambda the log_group is created once the first",
"# log event occurs. So if the log_group does not exist we create it",
"create_log_group",
"(",
"a... | Sets the retention of the specified log group
if the log group does not yet exist than it will be created first.
:param log_group_name: log group name
:param retention_in_days: log group name
:return: | [
"Sets",
"the",
"retention",
"of",
"the",
"specified",
"log",
"group",
"if",
"the",
"log",
"group",
"does",
"not",
"yet",
"exist",
"than",
"it",
"will",
"be",
"created",
"first",
"."
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/cloudwatch_logs.py#L31-L53 |
glomex/gcdt | gcdt/cloudwatch_logs.py | filter_log_events | def filter_log_events(awsclient, log_group_name, start_ts, end_ts=None):
"""
Note: this is used to retrieve logs in ramuda.
:param log_group_name: log group name
:param start_ts: timestamp
:param end_ts: timestamp
:return: list of log entries
"""
client_logs = awsclient.get_client('logs... | python | def filter_log_events(awsclient, log_group_name, start_ts, end_ts=None):
"""
Note: this is used to retrieve logs in ramuda.
:param log_group_name: log group name
:param start_ts: timestamp
:param end_ts: timestamp
:return: list of log entries
"""
client_logs = awsclient.get_client('logs... | [
"def",
"filter_log_events",
"(",
"awsclient",
",",
"log_group_name",
",",
"start_ts",
",",
"end_ts",
"=",
"None",
")",
":",
"client_logs",
"=",
"awsclient",
".",
"get_client",
"(",
"'logs'",
")",
"# TODO use all_pages instead!",
"logs",
"=",
"[",
"]",
"next_toke... | Note: this is used to retrieve logs in ramuda.
:param log_group_name: log group name
:param start_ts: timestamp
:param end_ts: timestamp
:return: list of log entries | [
"Note",
":",
"this",
"is",
"used",
"to",
"retrieve",
"logs",
"in",
"ramuda",
"."
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/cloudwatch_logs.py#L56-L86 |
glomex/gcdt | gcdt/cloudwatch_logs.py | describe_log_group | def describe_log_group(awsclient, log_group_name):
"""Get info on the specified log group
:param log_group_name: log group name
:return:
"""
client_logs = awsclient.get_client('logs')
request = {
'logGroupNamePrefix': log_group_name,
'limit': 1
}
response = client_logs.... | python | def describe_log_group(awsclient, log_group_name):
"""Get info on the specified log group
:param log_group_name: log group name
:return:
"""
client_logs = awsclient.get_client('logs')
request = {
'logGroupNamePrefix': log_group_name,
'limit': 1
}
response = client_logs.... | [
"def",
"describe_log_group",
"(",
"awsclient",
",",
"log_group_name",
")",
":",
"client_logs",
"=",
"awsclient",
".",
"get_client",
"(",
"'logs'",
")",
"request",
"=",
"{",
"'logGroupNamePrefix'",
":",
"log_group_name",
",",
"'limit'",
":",
"1",
"}",
"response",... | Get info on the specified log group
:param log_group_name: log group name
:return: | [
"Get",
"info",
"on",
"the",
"specified",
"log",
"group"
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/cloudwatch_logs.py#L90-L106 |
glomex/gcdt | gcdt/cloudwatch_logs.py | describe_log_stream | def describe_log_stream(awsclient, log_group_name, log_stream_name):
"""Get info on the specified log stream
:param log_group_name: log group name
:param log_stream_name: log stream
:return:
"""
client_logs = awsclient.get_client('logs')
response = client_logs.describe_log_streams(
... | python | def describe_log_stream(awsclient, log_group_name, log_stream_name):
"""Get info on the specified log stream
:param log_group_name: log group name
:param log_stream_name: log stream
:return:
"""
client_logs = awsclient.get_client('logs')
response = client_logs.describe_log_streams(
... | [
"def",
"describe_log_stream",
"(",
"awsclient",
",",
"log_group_name",
",",
"log_stream_name",
")",
":",
"client_logs",
"=",
"awsclient",
".",
"get_client",
"(",
"'logs'",
")",
"response",
"=",
"client_logs",
".",
"describe_log_streams",
"(",
"logGroupName",
"=",
... | Get info on the specified log stream
:param log_group_name: log group name
:param log_stream_name: log stream
:return: | [
"Get",
"info",
"on",
"the",
"specified",
"log",
"stream"
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/cloudwatch_logs.py#L109-L126 |
glomex/gcdt | gcdt/cloudwatch_logs.py | create_log_group | def create_log_group(awsclient, log_group_name):
"""Creates a log group with the specified name.
:param log_group_name: log group name
:return:
"""
client_logs = awsclient.get_client('logs')
response = client_logs.create_log_group(
logGroupName=log_group_name,
) | python | def create_log_group(awsclient, log_group_name):
"""Creates a log group with the specified name.
:param log_group_name: log group name
:return:
"""
client_logs = awsclient.get_client('logs')
response = client_logs.create_log_group(
logGroupName=log_group_name,
) | [
"def",
"create_log_group",
"(",
"awsclient",
",",
"log_group_name",
")",
":",
"client_logs",
"=",
"awsclient",
".",
"get_client",
"(",
"'logs'",
")",
"response",
"=",
"client_logs",
".",
"create_log_group",
"(",
"logGroupName",
"=",
"log_group_name",
",",
")"
] | Creates a log group with the specified name.
:param log_group_name: log group name
:return: | [
"Creates",
"a",
"log",
"group",
"with",
"the",
"specified",
"name",
"."
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/cloudwatch_logs.py#L140-L150 |
glomex/gcdt | gcdt/cloudwatch_logs.py | create_log_stream | def create_log_stream(awsclient, log_group_name, log_stream_name):
"""Creates a log stream for the specified log group.
:param log_group_name: log group name
:param log_stream_name: log stream name
:return:
"""
client_logs = awsclient.get_client('logs')
response = client_logs.create_log_st... | python | def create_log_stream(awsclient, log_group_name, log_stream_name):
"""Creates a log stream for the specified log group.
:param log_group_name: log group name
:param log_stream_name: log stream name
:return:
"""
client_logs = awsclient.get_client('logs')
response = client_logs.create_log_st... | [
"def",
"create_log_stream",
"(",
"awsclient",
",",
"log_group_name",
",",
"log_stream_name",
")",
":",
"client_logs",
"=",
"awsclient",
".",
"get_client",
"(",
"'logs'",
")",
"response",
"=",
"client_logs",
".",
"create_log_stream",
"(",
"logGroupName",
"=",
"log_... | Creates a log stream for the specified log group.
:param log_group_name: log group name
:param log_stream_name: log stream name
:return: | [
"Creates",
"a",
"log",
"stream",
"for",
"the",
"specified",
"log",
"group",
"."
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/cloudwatch_logs.py#L153-L165 |
glomex/gcdt | gcdt/cloudwatch_logs.py | put_log_events | def put_log_events(awsclient, log_group_name, log_stream_name, log_events,
sequence_token=None):
"""Put log events for the specified log group and stream.
:param log_group_name: log group name
:param log_stream_name: log stream name
:param log_events: [{'timestamp': 123, 'message': '... | python | def put_log_events(awsclient, log_group_name, log_stream_name, log_events,
sequence_token=None):
"""Put log events for the specified log group and stream.
:param log_group_name: log group name
:param log_stream_name: log stream name
:param log_events: [{'timestamp': 123, 'message': '... | [
"def",
"put_log_events",
"(",
"awsclient",
",",
"log_group_name",
",",
"log_stream_name",
",",
"log_events",
",",
"sequence_token",
"=",
"None",
")",
":",
"client_logs",
"=",
"awsclient",
".",
"get_client",
"(",
"'logs'",
")",
"request",
"=",
"{",
"'logGroupName... | Put log events for the specified log group and stream.
:param log_group_name: log group name
:param log_stream_name: log stream name
:param log_events: [{'timestamp': 123, 'message': 'string'}, ...]
:param sequence_token: the sequence token
:return: next_token | [
"Put",
"log",
"events",
"for",
"the",
"specified",
"log",
"group",
"and",
"stream",
"."
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/cloudwatch_logs.py#L168-L191 |
glomex/gcdt | gcdt/cloudwatch_logs.py | get_log_events | def get_log_events(awsclient, log_group_name, log_stream_name, start_ts=None):
"""Get log events for the specified log group and stream.
this is used in tenkai output instance diagnostics
:param log_group_name: log group name
:param log_stream_name: log stream name
:param start_ts: timestamp
:r... | python | def get_log_events(awsclient, log_group_name, log_stream_name, start_ts=None):
"""Get log events for the specified log group and stream.
this is used in tenkai output instance diagnostics
:param log_group_name: log group name
:param log_stream_name: log stream name
:param start_ts: timestamp
:r... | [
"def",
"get_log_events",
"(",
"awsclient",
",",
"log_group_name",
",",
"log_stream_name",
",",
"start_ts",
"=",
"None",
")",
":",
"client_logs",
"=",
"awsclient",
".",
"get_client",
"(",
"'logs'",
")",
"request",
"=",
"{",
"'logGroupName'",
":",
"log_group_name"... | Get log events for the specified log group and stream.
this is used in tenkai output instance diagnostics
:param log_group_name: log group name
:param log_stream_name: log stream name
:param start_ts: timestamp
:return: | [
"Get",
"log",
"events",
"for",
"the",
"specified",
"log",
"group",
"and",
"stream",
".",
"this",
"is",
"used",
"in",
"tenkai",
"output",
"instance",
"diagnostics"
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/cloudwatch_logs.py#L194-L218 |
glomex/gcdt | gcdt/cloudwatch_logs.py | check_log_stream_exists | def check_log_stream_exists(awsclient, log_group_name, log_stream_name):
"""Check
:param log_group_name: log group name
:param log_stream_name: log stream name
:return: True / False
"""
lg = describe_log_group(awsclient, log_group_name)
if lg and lg['logGroupName'] == log_group_name:
... | python | def check_log_stream_exists(awsclient, log_group_name, log_stream_name):
"""Check
:param log_group_name: log group name
:param log_stream_name: log stream name
:return: True / False
"""
lg = describe_log_group(awsclient, log_group_name)
if lg and lg['logGroupName'] == log_group_name:
... | [
"def",
"check_log_stream_exists",
"(",
"awsclient",
",",
"log_group_name",
",",
"log_stream_name",
")",
":",
"lg",
"=",
"describe_log_group",
"(",
"awsclient",
",",
"log_group_name",
")",
"if",
"lg",
"and",
"lg",
"[",
"'logGroupName'",
"]",
"==",
"log_group_name",... | Check
:param log_group_name: log group name
:param log_stream_name: log stream name
:return: True / False | [
"Check"
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/cloudwatch_logs.py#L221-L233 |
glomex/gcdt | gcdt/cloudwatch_logs.py | decode_format_timestamp | def decode_format_timestamp(timestamp):
"""Convert unix timestamp (millis) into date & time we use in logs output.
:param timestamp: unix timestamp in millis
:return: date, time in UTC
"""
dt = maya.MayaDT(timestamp / 1000).datetime(naive=True)
return dt.strftime('%Y-%m-%d'), dt.strftime('%H:%M... | python | def decode_format_timestamp(timestamp):
"""Convert unix timestamp (millis) into date & time we use in logs output.
:param timestamp: unix timestamp in millis
:return: date, time in UTC
"""
dt = maya.MayaDT(timestamp / 1000).datetime(naive=True)
return dt.strftime('%Y-%m-%d'), dt.strftime('%H:%M... | [
"def",
"decode_format_timestamp",
"(",
"timestamp",
")",
":",
"dt",
"=",
"maya",
".",
"MayaDT",
"(",
"timestamp",
"/",
"1000",
")",
".",
"datetime",
"(",
"naive",
"=",
"True",
")",
"return",
"dt",
".",
"strftime",
"(",
"'%Y-%m-%d'",
")",
",",
"dt",
"."... | Convert unix timestamp (millis) into date & time we use in logs output.
:param timestamp: unix timestamp in millis
:return: date, time in UTC | [
"Convert",
"unix",
"timestamp",
"(",
"millis",
")",
"into",
"date",
"&",
"time",
"we",
"use",
"in",
"logs",
"output",
"."
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/cloudwatch_logs.py#L236-L243 |
gmr/helper | helper/config.py | Config.reload | def reload(self):
"""Reload the configuration from disk returning True if the
configuration has changed from the previous values.
"""
config = self._default_configuration()
if self._file_path:
config.update(self._load_config_file())
if config != self._values:... | python | def reload(self):
"""Reload the configuration from disk returning True if the
configuration has changed from the previous values.
"""
config = self._default_configuration()
if self._file_path:
config.update(self._load_config_file())
if config != self._values:... | [
"def",
"reload",
"(",
"self",
")",
":",
"config",
"=",
"self",
".",
"_default_configuration",
"(",
")",
"if",
"self",
".",
"_file_path",
":",
"config",
".",
"update",
"(",
"self",
".",
"_load_config_file",
"(",
")",
")",
"if",
"config",
"!=",
"self",
"... | Reload the configuration from disk returning True if the
configuration has changed from the previous values. | [
"Reload",
"the",
"configuration",
"from",
"disk",
"returning",
"True",
"if",
"the",
"configuration",
"has",
"changed",
"from",
"the",
"previous",
"values",
"."
] | train | https://github.com/gmr/helper/blob/fe8e45fc8eabf619429b2940c682c252ee33c082/helper/config.py#L102-L113 |
gmr/helper | helper/config.py | Config._load_config_file | def _load_config_file(self):
"""Load the configuration file into memory, returning the content.
"""
LOGGER.info('Loading configuration from %s', self._file_path)
if self._file_path.endswith('json'):
config = self._load_json_config()
else:
config = self._l... | python | def _load_config_file(self):
"""Load the configuration file into memory, returning the content.
"""
LOGGER.info('Loading configuration from %s', self._file_path)
if self._file_path.endswith('json'):
config = self._load_json_config()
else:
config = self._l... | [
"def",
"_load_config_file",
"(",
"self",
")",
":",
"LOGGER",
".",
"info",
"(",
"'Loading configuration from %s'",
",",
"self",
".",
"_file_path",
")",
"if",
"self",
".",
"_file_path",
".",
"endswith",
"(",
"'json'",
")",
":",
"config",
"=",
"self",
".",
"_... | Load the configuration file into memory, returning the content. | [
"Load",
"the",
"configuration",
"file",
"into",
"memory",
"returning",
"the",
"content",
"."
] | train | https://github.com/gmr/helper/blob/fe8e45fc8eabf619429b2940c682c252ee33c082/helper/config.py#L128-L141 |
gmr/helper | helper/config.py | Config._load_json_config | def _load_json_config(self):
"""Load the configuration file in JSON format
:rtype: dict
"""
try:
return json.loads(self._read_config())
except ValueError as error:
raise ValueError(
'Could not read configuration file: {}'.format(error)) | python | def _load_json_config(self):
"""Load the configuration file in JSON format
:rtype: dict
"""
try:
return json.loads(self._read_config())
except ValueError as error:
raise ValueError(
'Could not read configuration file: {}'.format(error)) | [
"def",
"_load_json_config",
"(",
"self",
")",
":",
"try",
":",
"return",
"json",
".",
"loads",
"(",
"self",
".",
"_read_config",
"(",
")",
")",
"except",
"ValueError",
"as",
"error",
":",
"raise",
"ValueError",
"(",
"'Could not read configuration file: {}'",
"... | Load the configuration file in JSON format
:rtype: dict | [
"Load",
"the",
"configuration",
"file",
"in",
"JSON",
"format"
] | train | https://github.com/gmr/helper/blob/fe8e45fc8eabf619429b2940c682c252ee33c082/helper/config.py#L143-L153 |
gmr/helper | helper/config.py | Config._load_yaml_config | def _load_yaml_config(self):
"""Loads the configuration file from a .yaml or .yml file
:type: dict
"""
try:
config = self._read_config()
except OSError as error:
raise ValueError('Could not read configuration file: %s' % error)
try:
r... | python | def _load_yaml_config(self):
"""Loads the configuration file from a .yaml or .yml file
:type: dict
"""
try:
config = self._read_config()
except OSError as error:
raise ValueError('Could not read configuration file: %s' % error)
try:
r... | [
"def",
"_load_yaml_config",
"(",
"self",
")",
":",
"try",
":",
"config",
"=",
"self",
".",
"_read_config",
"(",
")",
"except",
"OSError",
"as",
"error",
":",
"raise",
"ValueError",
"(",
"'Could not read configuration file: %s'",
"%",
"error",
")",
"try",
":",
... | Loads the configuration file from a .yaml or .yml file
:type: dict | [
"Loads",
"the",
"configuration",
"file",
"from",
"a",
".",
"yaml",
"or",
".",
"yml",
"file"
] | train | https://github.com/gmr/helper/blob/fe8e45fc8eabf619429b2940c682c252ee33c082/helper/config.py#L155-L175 |
gmr/helper | helper/config.py | Config._normalize_file_path | def _normalize_file_path(file_path):
"""Normalize the file path value.
:param str file_path: The file path as passed in
:rtype: str
"""
if not file_path:
return None
elif file_path.startswith('s3://') or \
file_path.startswith('http://') or \... | python | def _normalize_file_path(file_path):
"""Normalize the file path value.
:param str file_path: The file path as passed in
:rtype: str
"""
if not file_path:
return None
elif file_path.startswith('s3://') or \
file_path.startswith('http://') or \... | [
"def",
"_normalize_file_path",
"(",
"file_path",
")",
":",
"if",
"not",
"file_path",
":",
"return",
"None",
"elif",
"file_path",
".",
"startswith",
"(",
"'s3://'",
")",
"or",
"file_path",
".",
"startswith",
"(",
"'http://'",
")",
"or",
"file_path",
".",
"sta... | Normalize the file path value.
:param str file_path: The file path as passed in
:rtype: str | [
"Normalize",
"the",
"file",
"path",
"value",
"."
] | train | https://github.com/gmr/helper/blob/fe8e45fc8eabf619429b2940c682c252ee33c082/helper/config.py#L178-L191 |
gmr/helper | helper/config.py | Config._read_config | def _read_config(self):
"""Read the configuration from the various places it may be read from.
:rtype: str
:raises: ValueError
"""
if not self._file_path:
return None
elif self._file_path.startswith('s3://'):
return self._read_s3_config()
... | python | def _read_config(self):
"""Read the configuration from the various places it may be read from.
:rtype: str
:raises: ValueError
"""
if not self._file_path:
return None
elif self._file_path.startswith('s3://'):
return self._read_s3_config()
... | [
"def",
"_read_config",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_file_path",
":",
"return",
"None",
"elif",
"self",
".",
"_file_path",
".",
"startswith",
"(",
"'s3://'",
")",
":",
"return",
"self",
".",
"_read_s3_config",
"(",
")",
"elif",
"self... | Read the configuration from the various places it may be read from.
:rtype: str
:raises: ValueError | [
"Read",
"the",
"configuration",
"from",
"the",
"various",
"places",
"it",
"may",
"be",
"read",
"from",
"."
] | train | https://github.com/gmr/helper/blob/fe8e45fc8eabf619429b2940c682c252ee33c082/helper/config.py#L193-L212 |
gmr/helper | helper/config.py | Config._read_remote_config | def _read_remote_config(self):
"""Read a remote config via URL.
:rtype: str
:raises: ValueError
"""
try:
import requests
except ImportError:
requests = None
if not requests:
raise ValueError(
'Remote config URL... | python | def _read_remote_config(self):
"""Read a remote config via URL.
:rtype: str
:raises: ValueError
"""
try:
import requests
except ImportError:
requests = None
if not requests:
raise ValueError(
'Remote config URL... | [
"def",
"_read_remote_config",
"(",
"self",
")",
":",
"try",
":",
"import",
"requests",
"except",
"ImportError",
":",
"requests",
"=",
"None",
"if",
"not",
"requests",
":",
"raise",
"ValueError",
"(",
"'Remote config URL specified but requests not installed'",
")",
"... | Read a remote config via URL.
:rtype: str
:raises: ValueError | [
"Read",
"a",
"remote",
"config",
"via",
"URL",
"."
] | train | https://github.com/gmr/helper/blob/fe8e45fc8eabf619429b2940c682c252ee33c082/helper/config.py#L214-L233 |
gmr/helper | helper/config.py | Config._read_s3_config | def _read_s3_config(self):
"""Read in the value of the configuration file in Amazon S3.
:rtype: str
:raises: ValueError
"""
try:
import boto3
import botocore.exceptions
except ImportError:
boto3, botocore = None, None
if not ... | python | def _read_s3_config(self):
"""Read in the value of the configuration file in Amazon S3.
:rtype: str
:raises: ValueError
"""
try:
import boto3
import botocore.exceptions
except ImportError:
boto3, botocore = None, None
if not ... | [
"def",
"_read_s3_config",
"(",
"self",
")",
":",
"try",
":",
"import",
"boto3",
"import",
"botocore",
".",
"exceptions",
"except",
"ImportError",
":",
"boto3",
",",
"botocore",
"=",
"None",
",",
"None",
"if",
"not",
"boto3",
":",
"raise",
"ValueError",
"("... | Read in the value of the configuration file in Amazon S3.
:rtype: str
:raises: ValueError | [
"Read",
"in",
"the",
"value",
"of",
"the",
"configuration",
"file",
"in",
"Amazon",
"S3",
"."
] | train | https://github.com/gmr/helper/blob/fe8e45fc8eabf619429b2940c682c252ee33c082/helper/config.py#L235-L259 |
gmr/helper | helper/config.py | LoggingConfig.update | def update(self, configuration, debug=None):
"""Update the internal configuration values, removing debug_only
handlers if debug is False. Returns True if the configuration has
changed from previous configuration values.
:param dict configuration: The logging configuration
:param... | python | def update(self, configuration, debug=None):
"""Update the internal configuration values, removing debug_only
handlers if debug is False. Returns True if the configuration has
changed from previous configuration values.
:param dict configuration: The logging configuration
:param... | [
"def",
"update",
"(",
"self",
",",
"configuration",
",",
"debug",
"=",
"None",
")",
":",
"if",
"self",
".",
"config",
"!=",
"dict",
"(",
"configuration",
")",
"and",
"debug",
"!=",
"self",
".",
"debug",
":",
"self",
".",
"config",
"=",
"dict",
"(",
... | Update the internal configuration values, removing debug_only
handlers if debug is False. Returns True if the configuration has
changed from previous configuration values.
:param dict configuration: The logging configuration
:param bool debug: Toggles use of debug_only loggers
:... | [
"Update",
"the",
"internal",
"configuration",
"values",
"removing",
"debug_only",
"handlers",
"if",
"debug",
"is",
"False",
".",
"Returns",
"True",
"if",
"the",
"configuration",
"has",
"changed",
"from",
"previous",
"configuration",
"values",
"."
] | train | https://github.com/gmr/helper/blob/fe8e45fc8eabf619429b2940c682c252ee33c082/helper/config.py#L288-L303 |
gmr/helper | helper/config.py | LoggingConfig.configure | def configure(self):
"""Configure the Python stdlib logger"""
if self.debug is not None and not self.debug:
self._remove_debug_handlers()
self._remove_debug_only()
logging.config.dictConfig(self.config)
try:
logging.captureWarnings(True)
except Att... | python | def configure(self):
"""Configure the Python stdlib logger"""
if self.debug is not None and not self.debug:
self._remove_debug_handlers()
self._remove_debug_only()
logging.config.dictConfig(self.config)
try:
logging.captureWarnings(True)
except Att... | [
"def",
"configure",
"(",
"self",
")",
":",
"if",
"self",
".",
"debug",
"is",
"not",
"None",
"and",
"not",
"self",
".",
"debug",
":",
"self",
".",
"_remove_debug_handlers",
"(",
")",
"self",
".",
"_remove_debug_only",
"(",
")",
"logging",
".",
"config",
... | Configure the Python stdlib logger | [
"Configure",
"the",
"Python",
"stdlib",
"logger"
] | train | https://github.com/gmr/helper/blob/fe8e45fc8eabf619429b2940c682c252ee33c082/helper/config.py#L305-L314 |
gmr/helper | helper/config.py | LoggingConfig._remove_debug_handlers | def _remove_debug_handlers(self):
"""Remove any handlers with an attribute of debug_only that is True and
remove the references to said handlers from any loggers that are
referencing them.
"""
remove = list()
for handler in self.config[self.HANDLERS]:
if self... | python | def _remove_debug_handlers(self):
"""Remove any handlers with an attribute of debug_only that is True and
remove the references to said handlers from any loggers that are
referencing them.
"""
remove = list()
for handler in self.config[self.HANDLERS]:
if self... | [
"def",
"_remove_debug_handlers",
"(",
"self",
")",
":",
"remove",
"=",
"list",
"(",
")",
"for",
"handler",
"in",
"self",
".",
"config",
"[",
"self",
".",
"HANDLERS",
"]",
":",
"if",
"self",
".",
"config",
"[",
"self",
".",
"HANDLERS",
"]",
"[",
"hand... | Remove any handlers with an attribute of debug_only that is True and
remove the references to said handlers from any loggers that are
referencing them. | [
"Remove",
"any",
"handlers",
"with",
"an",
"attribute",
"of",
"debug_only",
"that",
"is",
"True",
"and",
"remove",
"the",
"references",
"to",
"said",
"handlers",
"from",
"any",
"loggers",
"that",
"are",
"referencing",
"them",
"."
] | train | https://github.com/gmr/helper/blob/fe8e45fc8eabf619429b2940c682c252ee33c082/helper/config.py#L316-L332 |
gmr/helper | helper/config.py | LoggingConfig._remove_debug_only | def _remove_debug_only(self):
"""Iterate through each handler removing the invalid dictConfig key of
debug_only.
"""
LOGGER.debug('Removing debug only from handlers')
for handler in self.config[self.HANDLERS]:
if self.DEBUG_ONLY in self.config[self.HANDLERS][handler]... | python | def _remove_debug_only(self):
"""Iterate through each handler removing the invalid dictConfig key of
debug_only.
"""
LOGGER.debug('Removing debug only from handlers')
for handler in self.config[self.HANDLERS]:
if self.DEBUG_ONLY in self.config[self.HANDLERS][handler]... | [
"def",
"_remove_debug_only",
"(",
"self",
")",
":",
"LOGGER",
".",
"debug",
"(",
"'Removing debug only from handlers'",
")",
"for",
"handler",
"in",
"self",
".",
"config",
"[",
"self",
".",
"HANDLERS",
"]",
":",
"if",
"self",
".",
"DEBUG_ONLY",
"in",
"self",... | Iterate through each handler removing the invalid dictConfig key of
debug_only. | [
"Iterate",
"through",
"each",
"handler",
"removing",
"the",
"invalid",
"dictConfig",
"key",
"of",
"debug_only",
"."
] | train | https://github.com/gmr/helper/blob/fe8e45fc8eabf619429b2940c682c252ee33c082/helper/config.py#L334-L342 |
CitrineInformatics/pypif | pypif/util/serializable.py | Serializable.as_dictionary | def as_dictionary(self):
"""
Convert this object to a dictionary with formatting appropriate for a PIF.
:returns: Dictionary with the content of this object formatted for a PIF.
"""
return {to_camel_case(i): Serializable._convert_to_dictionary(self.__dict__[i])
f... | python | def as_dictionary(self):
"""
Convert this object to a dictionary with formatting appropriate for a PIF.
:returns: Dictionary with the content of this object formatted for a PIF.
"""
return {to_camel_case(i): Serializable._convert_to_dictionary(self.__dict__[i])
f... | [
"def",
"as_dictionary",
"(",
"self",
")",
":",
"return",
"{",
"to_camel_case",
"(",
"i",
")",
":",
"Serializable",
".",
"_convert_to_dictionary",
"(",
"self",
".",
"__dict__",
"[",
"i",
"]",
")",
"for",
"i",
"in",
"self",
".",
"__dict__",
"if",
"self",
... | Convert this object to a dictionary with formatting appropriate for a PIF.
:returns: Dictionary with the content of this object formatted for a PIF. | [
"Convert",
"this",
"object",
"to",
"a",
"dictionary",
"with",
"formatting",
"appropriate",
"for",
"a",
"PIF",
"."
] | train | https://github.com/CitrineInformatics/pypif/blob/938348a8ff7b10b330770cccaaeb2109922f681b/pypif/util/serializable.py#L10-L17 |
CitrineInformatics/pypif | pypif/util/serializable.py | Serializable._convert_to_dictionary | def _convert_to_dictionary(obj):
"""
Convert obj to a dictionary with formatting appropriate for a PIF. This function attempts to treat obj as
a Pio object and otherwise returns obj.
:param obj: Object to convert to a dictionary.
:returns: Input object as a dictionary or the ori... | python | def _convert_to_dictionary(obj):
"""
Convert obj to a dictionary with formatting appropriate for a PIF. This function attempts to treat obj as
a Pio object and otherwise returns obj.
:param obj: Object to convert to a dictionary.
:returns: Input object as a dictionary or the ori... | [
"def",
"_convert_to_dictionary",
"(",
"obj",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"list",
")",
":",
"return",
"[",
"Serializable",
".",
"_convert_to_dictionary",
"(",
"i",
")",
"for",
"i",
"in",
"obj",
"]",
"elif",
"hasattr",
"(",
"obj",
",",
... | Convert obj to a dictionary with formatting appropriate for a PIF. This function attempts to treat obj as
a Pio object and otherwise returns obj.
:param obj: Object to convert to a dictionary.
:returns: Input object as a dictionary or the original object. | [
"Convert",
"obj",
"to",
"a",
"dictionary",
"with",
"formatting",
"appropriate",
"for",
"a",
"PIF",
".",
"This",
"function",
"attempts",
"to",
"treat",
"obj",
"as",
"a",
"Pio",
"object",
"and",
"otherwise",
"returns",
"obj",
"."
] | train | https://github.com/CitrineInformatics/pypif/blob/938348a8ff7b10b330770cccaaeb2109922f681b/pypif/util/serializable.py#L20-L33 |
CitrineInformatics/pypif | pypif/util/serializable.py | Serializable._get_object | def _get_object(class_, obj):
"""
Helper function that returns an object, or if it is a dictionary, initializes it from class_.
:param class_: Class to use to instantiate object.
:param obj: Object to process.
:return: One or more objects.
"""
if isinstance(obj, ... | python | def _get_object(class_, obj):
"""
Helper function that returns an object, or if it is a dictionary, initializes it from class_.
:param class_: Class to use to instantiate object.
:param obj: Object to process.
:return: One or more objects.
"""
if isinstance(obj, ... | [
"def",
"_get_object",
"(",
"class_",
",",
"obj",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"list",
")",
":",
"return",
"[",
"Serializable",
".",
"_get_object",
"(",
"class_",
",",
"i",
")",
"for",
"i",
"in",
"obj",
"]",
"elif",
"isinstance",
"("... | Helper function that returns an object, or if it is a dictionary, initializes it from class_.
:param class_: Class to use to instantiate object.
:param obj: Object to process.
:return: One or more objects. | [
"Helper",
"function",
"that",
"returns",
"an",
"object",
"or",
"if",
"it",
"is",
"a",
"dictionary",
"initializes",
"it",
"from",
"class_",
"."
] | train | https://github.com/CitrineInformatics/pypif/blob/938348a8ff7b10b330770cccaaeb2109922f681b/pypif/util/serializable.py#L36-L49 |
marians/audiocalc | audiocalc/py_audiocalc.py | damping | def damping(temp, relhum, freq, pres=101325):
"""
Calculates the damping factor for sound in dB/m
depending on temperature, humidity and sound frequency.
Source: http://www.sengpielaudio.com/LuftdaempfungFormel.htm
temp: Temperature in degrees celsius
relhum: Relative humidity as percentage, e.... | python | def damping(temp, relhum, freq, pres=101325):
"""
Calculates the damping factor for sound in dB/m
depending on temperature, humidity and sound frequency.
Source: http://www.sengpielaudio.com/LuftdaempfungFormel.htm
temp: Temperature in degrees celsius
relhum: Relative humidity as percentage, e.... | [
"def",
"damping",
"(",
"temp",
",",
"relhum",
",",
"freq",
",",
"pres",
"=",
"101325",
")",
":",
"temp",
"+=",
"273.15",
"# convert to kelvin",
"pres",
"=",
"pres",
"/",
"101325.0",
"# convert to relative pressure",
"c_humid",
"=",
"4.6151",
"-",
"6.8346",
"... | Calculates the damping factor for sound in dB/m
depending on temperature, humidity and sound frequency.
Source: http://www.sengpielaudio.com/LuftdaempfungFormel.htm
temp: Temperature in degrees celsius
relhum: Relative humidity as percentage, e.g. 50
freq: Sound frequency in herz
pres: Atmosphe... | [
"Calculates",
"the",
"damping",
"factor",
"for",
"sound",
"in",
"dB",
"/",
"m",
"depending",
"on",
"temperature",
"humidity",
"and",
"sound",
"frequency",
".",
"Source",
":",
"http",
":",
"//",
"www",
".",
"sengpielaudio",
".",
"com",
"/",
"LuftdaempfungForm... | train | https://github.com/marians/audiocalc/blob/ef917b05d9dddc5a3a44165112835669ef4808d3/audiocalc/py_audiocalc.py#L19-L51 |
marians/audiocalc | audiocalc/py_audiocalc.py | total_level | def total_level(source_levels):
"""
Calculates the total sound pressure level based on multiple source levels
"""
sums = 0.0
for l in source_levels:
if l is None:
continue
if l == 0:
continue
sums += pow(10.0, float(l) / 10.0)
level = 10.0 * math.l... | python | def total_level(source_levels):
"""
Calculates the total sound pressure level based on multiple source levels
"""
sums = 0.0
for l in source_levels:
if l is None:
continue
if l == 0:
continue
sums += pow(10.0, float(l) / 10.0)
level = 10.0 * math.l... | [
"def",
"total_level",
"(",
"source_levels",
")",
":",
"sums",
"=",
"0.0",
"for",
"l",
"in",
"source_levels",
":",
"if",
"l",
"is",
"None",
":",
"continue",
"if",
"l",
"==",
"0",
":",
"continue",
"sums",
"+=",
"pow",
"(",
"10.0",
",",
"float",
"(",
... | Calculates the total sound pressure level based on multiple source levels | [
"Calculates",
"the",
"total",
"sound",
"pressure",
"level",
"based",
"on",
"multiple",
"source",
"levels"
] | train | https://github.com/marians/audiocalc/blob/ef917b05d9dddc5a3a44165112835669ef4808d3/audiocalc/py_audiocalc.py#L54-L66 |
marians/audiocalc | audiocalc/py_audiocalc.py | total_rated_level | def total_rated_level(octave_frequencies):
"""
Calculates the A-rated total sound pressure level
based on octave band frequencies
"""
sums = 0.0
for band in OCTAVE_BANDS.keys():
if band not in octave_frequencies:
continue
if octave_frequencies[band] is None:
... | python | def total_rated_level(octave_frequencies):
"""
Calculates the A-rated total sound pressure level
based on octave band frequencies
"""
sums = 0.0
for band in OCTAVE_BANDS.keys():
if band not in octave_frequencies:
continue
if octave_frequencies[band] is None:
... | [
"def",
"total_rated_level",
"(",
"octave_frequencies",
")",
":",
"sums",
"=",
"0.0",
"for",
"band",
"in",
"OCTAVE_BANDS",
".",
"keys",
"(",
")",
":",
"if",
"band",
"not",
"in",
"octave_frequencies",
":",
"continue",
"if",
"octave_frequencies",
"[",
"band",
"... | Calculates the A-rated total sound pressure level
based on octave band frequencies | [
"Calculates",
"the",
"A",
"-",
"rated",
"total",
"sound",
"pressure",
"level",
"based",
"on",
"octave",
"band",
"frequencies"
] | train | https://github.com/marians/audiocalc/blob/ef917b05d9dddc5a3a44165112835669ef4808d3/audiocalc/py_audiocalc.py#L69-L84 |
marians/audiocalc | audiocalc/py_audiocalc.py | leq3 | def leq3(levels):
"""
Calculates the energy-equivalent (Leq3) value
given a regular measurement interval.
"""
n = float(len(levels))
sums = 0.0
if sum(levels) == 0.0:
return 0.0
for l in levels:
if l == 0:
continue
sums += pow(10.0, float(l) / 10.0)
... | python | def leq3(levels):
"""
Calculates the energy-equivalent (Leq3) value
given a regular measurement interval.
"""
n = float(len(levels))
sums = 0.0
if sum(levels) == 0.0:
return 0.0
for l in levels:
if l == 0:
continue
sums += pow(10.0, float(l) / 10.0)
... | [
"def",
"leq3",
"(",
"levels",
")",
":",
"n",
"=",
"float",
"(",
"len",
"(",
"levels",
")",
")",
"sums",
"=",
"0.0",
"if",
"sum",
"(",
"levels",
")",
"==",
"0.0",
":",
"return",
"0.0",
"for",
"l",
"in",
"levels",
":",
"if",
"l",
"==",
"0",
":"... | Calculates the energy-equivalent (Leq3) value
given a regular measurement interval. | [
"Calculates",
"the",
"energy",
"-",
"equivalent",
"(",
"Leq3",
")",
"value",
"given",
"a",
"regular",
"measurement",
"interval",
"."
] | train | https://github.com/marians/audiocalc/blob/ef917b05d9dddc5a3a44165112835669ef4808d3/audiocalc/py_audiocalc.py#L87-L102 |
marians/audiocalc | audiocalc/py_audiocalc.py | distant_level | def distant_level(reference_level, distance, reference_distance=1.0):
"""
Calculates the sound pressure level
in dependence of a distance
where a perfect ball-shaped source and spread is assumed.
reference_level: Sound pressure level in reference distance in dB
distance: Distance to calculate s... | python | def distant_level(reference_level, distance, reference_distance=1.0):
"""
Calculates the sound pressure level
in dependence of a distance
where a perfect ball-shaped source and spread is assumed.
reference_level: Sound pressure level in reference distance in dB
distance: Distance to calculate s... | [
"def",
"distant_level",
"(",
"reference_level",
",",
"distance",
",",
"reference_distance",
"=",
"1.0",
")",
":",
"rel_dist",
"=",
"float",
"(",
"reference_distance",
")",
"/",
"float",
"(",
"distance",
")",
"level",
"=",
"float",
"(",
"reference_level",
")",
... | Calculates the sound pressure level
in dependence of a distance
where a perfect ball-shaped source and spread is assumed.
reference_level: Sound pressure level in reference distance in dB
distance: Distance to calculate sound pressure level for, in meters
reference_distance: reference distance in m... | [
"Calculates",
"the",
"sound",
"pressure",
"level",
"in",
"dependence",
"of",
"a",
"distance",
"where",
"a",
"perfect",
"ball",
"-",
"shaped",
"source",
"and",
"spread",
"is",
"assumed",
"."
] | train | https://github.com/marians/audiocalc/blob/ef917b05d9dddc5a3a44165112835669ef4808d3/audiocalc/py_audiocalc.py#L105-L117 |
marians/audiocalc | audiocalc/py_audiocalc.py | distant_total_damped_rated_level | def distant_total_damped_rated_level(
octave_frequencies,
distance,
temp,
relhum,
reference_distance=1.0):
"""
Calculates the damped, A-rated total sound pressure level
in a given distance, temperature and relative humidity
from octave frequenc... | python | def distant_total_damped_rated_level(
octave_frequencies,
distance,
temp,
relhum,
reference_distance=1.0):
"""
Calculates the damped, A-rated total sound pressure level
in a given distance, temperature and relative humidity
from octave frequenc... | [
"def",
"distant_total_damped_rated_level",
"(",
"octave_frequencies",
",",
"distance",
",",
"temp",
",",
"relhum",
",",
"reference_distance",
"=",
"1.0",
")",
":",
"damping_distance",
"=",
"distance",
"-",
"reference_distance",
"sums",
"=",
"0.0",
"for",
"band",
"... | Calculates the damped, A-rated total sound pressure level
in a given distance, temperature and relative humidity
from octave frequency sound pressure levels in a reference distance | [
"Calculates",
"the",
"damped",
"A",
"-",
"rated",
"total",
"sound",
"pressure",
"level",
"in",
"a",
"given",
"distance",
"temperature",
"and",
"relative",
"humidity",
"from",
"octave",
"frequency",
"sound",
"pressure",
"levels",
"in",
"a",
"reference",
"distance... | train | https://github.com/marians/audiocalc/blob/ef917b05d9dddc5a3a44165112835669ef4808d3/audiocalc/py_audiocalc.py#L120-L154 |
DeepHorizons/iarm | iarm/arm_instructions/shift.py | Shift.ASRS | def ASRS(self, params):
"""
ASRS [Ra,] Ra, Rc
ASRS [Ra,] Rb, #imm5_counting
Arithmetic shift right Rb by Rc or imm5_counting and store the result in Ra
imm5 counting is [1, 32]
In the register shift, the first two operands must be the same register
Ra, Rb, and Rc... | python | def ASRS(self, params):
"""
ASRS [Ra,] Ra, Rc
ASRS [Ra,] Rb, #imm5_counting
Arithmetic shift right Rb by Rc or imm5_counting and store the result in Ra
imm5 counting is [1, 32]
In the register shift, the first two operands must be the same register
Ra, Rb, and Rc... | [
"def",
"ASRS",
"(",
"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",
"... | ASRS [Ra,] Ra, Rc
ASRS [Ra,] Rb, #imm5_counting
Arithmetic shift right Rb by Rc or imm5_counting and store the result in Ra
imm5 counting is [1, 32]
In the register shift, the first two operands must be the same register
Ra, Rb, and Rc must be low registers
If Ra is omit... | [
"ASRS",
"[",
"Ra",
"]",
"Ra",
"Rc",
"ASRS",
"[",
"Ra",
"]",
"Rb",
"#imm5_counting"
] | train | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/shift.py#L6-L63 |
DeepHorizons/iarm | iarm/arm_instructions/shift.py | Shift.LSLS | def LSLS(self, params):
"""
LSLS [Ra,] Ra, Rc
LSLS [Ra,] Rb, #imm5
Logical shift left Rb by Rc or imm5 and store the result in Ra
imm5 is [0, 31]
In the register shift, the first two operands must be the same register
Ra, Rb, and Rc must be low registers
... | python | def LSLS(self, params):
"""
LSLS [Ra,] Ra, Rc
LSLS [Ra,] Rb, #imm5
Logical shift left Rb by Rc or imm5 and store the result in Ra
imm5 is [0, 31]
In the register shift, the first two operands must be the same register
Ra, Rb, and Rc must be low registers
... | [
"def",
"LSLS",
"(",
"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",
"... | LSLS [Ra,] Ra, Rc
LSLS [Ra,] Rb, #imm5
Logical shift left Rb by Rc or imm5 and store the result in Ra
imm5 is [0, 31]
In the register shift, the first two operands must be the same register
Ra, Rb, and Rc must be low registers
If Ra is omitted, then it is assumed to be R... | [
"LSLS",
"[",
"Ra",
"]",
"Ra",
"Rc",
"LSLS",
"[",
"Ra",
"]",
"Rb",
"#imm5"
] | train | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/shift.py#L65-L114 |
DeepHorizons/iarm | iarm/arm_instructions/shift.py | Shift.LSRS | def LSRS(self, params):
"""
LSRS [Ra,] Ra, Rc
LSRS [Ra,] Rb, #imm5_counting
Logical shift right Rb by Rc or imm5 and store the result in Ra
imm5 counting is [1, 32]
In the register shift, the first two operands must be the same register
Ra, Rb, and Rc must be low... | python | def LSRS(self, params):
"""
LSRS [Ra,] Ra, Rc
LSRS [Ra,] Rb, #imm5_counting
Logical shift right Rb by Rc or imm5 and store the result in Ra
imm5 counting is [1, 32]
In the register shift, the first two operands must be the same register
Ra, Rb, and Rc must be low... | [
"def",
"LSRS",
"(",
"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",
"... | LSRS [Ra,] Ra, Rc
LSRS [Ra,] Rb, #imm5_counting
Logical shift right Rb by Rc or imm5 and store the result in Ra
imm5 counting is [1, 32]
In the register shift, the first two operands must be the same register
Ra, Rb, and Rc must be low registers
If Ra is omitted, then it... | [
"LSRS",
"[",
"Ra",
"]",
"Ra",
"Rc",
"LSRS",
"[",
"Ra",
"]",
"Rb",
"#imm5_counting"
] | train | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/shift.py#L116-L165 |
DeepHorizons/iarm | iarm/arm_instructions/shift.py | Shift.RORS | def RORS(self, params):
"""
RORS [Ra,] Ra, Rc
Rotate shift right Rb by Rc or imm5 and store the result in Ra
The first two operands must be the same register
Ra and Rc must be low registers
The first register is optional
"""
# This instruction allows for ... | python | def RORS(self, params):
"""
RORS [Ra,] Ra, Rc
Rotate shift right Rb by Rc or imm5 and store the result in Ra
The first two operands must be the same register
Ra and Rc must be low registers
The first register is optional
"""
# This instruction allows for ... | [
"def",
"RORS",
"(",
"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",
"... | RORS [Ra,] Ra, Rc
Rotate shift right Rb by Rc or imm5 and store the result in Ra
The first two operands must be the same register
Ra and Rc must be low registers
The first register is optional | [
"RORS",
"[",
"Ra",
"]",
"Ra",
"Rc"
] | train | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/shift.py#L167-L197 |
acrazing/dbapi | dbapi/Group.py | Group._parse_topic_table | def _parse_topic_table(self, xml, tds='title,created,comment,group', selector='//table[@class="olt"]//tr'):
"""
解析话题列表
:internal
:param xml: 页面XML
:param tds: 每列的含义,可以是title, created, comment, group, updated, author, time, rec
:param selector: 表在页面中的位置
:... | python | def _parse_topic_table(self, xml, tds='title,created,comment,group', selector='//table[@class="olt"]//tr'):
"""
解析话题列表
:internal
:param xml: 页面XML
:param tds: 每列的含义,可以是title, created, comment, group, updated, author, time, rec
:param selector: 表在页面中的位置
:... | [
"def",
"_parse_topic_table",
"(",
"self",
",",
"xml",
",",
"tds",
"=",
"'title,created,comment,group'",
",",
"selector",
"=",
"'//table[@class=\"olt\"]//tr'",
")",
":",
"xml_results",
"=",
"xml",
".",
"xpath",
"(",
"selector",
")",
"results",
"=",
"[",
"]",
"t... | 解析话题列表
:internal
:param xml: 页面XML
:param tds: 每列的含义,可以是title, created, comment, group, updated, author, time, rec
:param selector: 表在页面中的位置
:return: | [
"解析话题列表",
":",
"internal",
":",
"param",
"xml",
":",
"页面XML",
":",
"param",
"tds",
":",
"每列的含义,可以是title",
"created",
"comment",
"group",
"updated",
"author",
"time",
"rec",
":",
"param",
"selector",
":",
"表在页面中的位置",
":",
"return",
":"
] | train | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/Group.py#L29-L90 |
acrazing/dbapi | dbapi/Group.py | Group.search_groups | def search_groups(self, keyword, start=0):
"""
搜索小组
:param keyword: 搜索的关键字
:param start: 翻页
:return: 含总数的列表
"""
xml = self.api.xml(API_GROUP_SEARCH_GROUPS % (start, keyword))
xml_results = xml.xpath('//div[@class="groups"]/div[@class="result"]')
... | python | def search_groups(self, keyword, start=0):
"""
搜索小组
:param keyword: 搜索的关键字
:param start: 翻页
:return: 含总数的列表
"""
xml = self.api.xml(API_GROUP_SEARCH_GROUPS % (start, keyword))
xml_results = xml.xpath('//div[@class="groups"]/div[@class="result"]')
... | [
"def",
"search_groups",
"(",
"self",
",",
"keyword",
",",
"start",
"=",
"0",
")",
":",
"xml",
"=",
"self",
".",
"api",
".",
"xml",
"(",
"API_GROUP_SEARCH_GROUPS",
"%",
"(",
"start",
",",
"keyword",
")",
")",
"xml_results",
"=",
"xml",
".",
"xpath",
"... | 搜索小组
:param keyword: 搜索的关键字
:param start: 翻页
:return: 含总数的列表 | [
"搜索小组",
":",
"param",
"keyword",
":",
"搜索的关键字",
":",
"param",
"start",
":",
"翻页",
":",
"return",
":",
"含总数的列表"
] | train | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/Group.py#L101-L129 |
acrazing/dbapi | dbapi/Group.py | Group.list_joined_groups | def list_joined_groups(self, user_alias=None):
"""
已加入的小组列表
:param user_alias: 用户名,默认为当前用户名
:return: 单页列表
"""
xml = self.api.xml(API_GROUP_LIST_JOINED_GROUPS % (user_alias or self.api.user_alias))
xml_results = xml.xpath('//div[@class="group-list group-ca... | python | def list_joined_groups(self, user_alias=None):
"""
已加入的小组列表
:param user_alias: 用户名,默认为当前用户名
:return: 单页列表
"""
xml = self.api.xml(API_GROUP_LIST_JOINED_GROUPS % (user_alias or self.api.user_alias))
xml_results = xml.xpath('//div[@class="group-list group-ca... | [
"def",
"list_joined_groups",
"(",
"self",
",",
"user_alias",
"=",
"None",
")",
":",
"xml",
"=",
"self",
".",
"api",
".",
"xml",
"(",
"API_GROUP_LIST_JOINED_GROUPS",
"%",
"(",
"user_alias",
"or",
"self",
".",
"api",
".",
"user_alias",
")",
")",
"xml_results... | 已加入的小组列表
:param user_alias: 用户名,默认为当前用户名
:return: 单页列表 | [
"已加入的小组列表",
":",
"param",
"user_alias",
":",
"用户名,默认为当前用户名",
":",
"return",
":",
"单页列表"
] | train | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/Group.py#L131-L158 |
acrazing/dbapi | dbapi/Group.py | Group.join_group | def join_group(self, group_alias, message=None):
"""
加入小组
:param group_alias: 小组ID
:param message: 如果要验证,留言信息
:return: 枚举
- joined: 加入成功
- waiting: 等待审核
- initial: 加入失败
"""
xml = self.api.xml(API_GROUP_GROUP... | python | def join_group(self, group_alias, message=None):
"""
加入小组
:param group_alias: 小组ID
:param message: 如果要验证,留言信息
:return: 枚举
- joined: 加入成功
- waiting: 等待审核
- initial: 加入失败
"""
xml = self.api.xml(API_GROUP_GROUP... | [
"def",
"join_group",
"(",
"self",
",",
"group_alias",
",",
"message",
"=",
"None",
")",
":",
"xml",
"=",
"self",
".",
"api",
".",
"xml",
"(",
"API_GROUP_GROUP_HOME",
"%",
"group_alias",
",",
"params",
"=",
"{",
"'action'",
":",
"'join'",
",",
"'ck'",
"... | 加入小组
:param group_alias: 小组ID
:param message: 如果要验证,留言信息
:return: 枚举
- joined: 加入成功
- waiting: 等待审核
- initial: 加入失败 | [
"加入小组",
":",
"param",
"group_alias",
":",
"小组ID",
":",
"param",
"message",
":",
"如果要验证,留言信息",
":",
"return",
":",
"枚举",
"-",
"joined",
":",
"加入成功",
"-",
"waiting",
":",
"等待审核",
"-",
"initial",
":",
"加入失败"
] | train | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/Group.py#L169-L204 |
acrazing/dbapi | dbapi/Group.py | Group.leave_group | def leave_group(self, group_alias):
"""
退出小组
:param group_alias: 小组ID
:return:
"""
return self.api.req(API_GROUP_GROUP_HOME % group_alias, params={
'action': 'quit',
'ck': self.api.ck(),
}) | python | def leave_group(self, group_alias):
"""
退出小组
:param group_alias: 小组ID
:return:
"""
return self.api.req(API_GROUP_GROUP_HOME % group_alias, params={
'action': 'quit',
'ck': self.api.ck(),
}) | [
"def",
"leave_group",
"(",
"self",
",",
"group_alias",
")",
":",
"return",
"self",
".",
"api",
".",
"req",
"(",
"API_GROUP_GROUP_HOME",
"%",
"group_alias",
",",
"params",
"=",
"{",
"'action'",
":",
"'quit'",
",",
"'ck'",
":",
"self",
".",
"api",
".",
"... | 退出小组
:param group_alias: 小组ID
:return: | [
"退出小组",
":",
"param",
"group_alias",
":",
"小组ID",
":",
"return",
":"
] | train | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/Group.py#L206-L216 |
acrazing/dbapi | dbapi/Group.py | Group.search_topics | def search_topics(self, keyword, sort='relevance', start=0):
"""
搜索话题
:param keyword: 关键字
:param sort: 排序方式 relevance/newest
:param start: 翻页
:return: 带总数的列表
"""
xml = self.api.xml(API_GROUP_SEARCH_TOPICS % (start, sort, keyword))
return b... | python | def search_topics(self, keyword, sort='relevance', start=0):
"""
搜索话题
:param keyword: 关键字
:param sort: 排序方式 relevance/newest
:param start: 翻页
:return: 带总数的列表
"""
xml = self.api.xml(API_GROUP_SEARCH_TOPICS % (start, sort, keyword))
return b... | [
"def",
"search_topics",
"(",
"self",
",",
"keyword",
",",
"sort",
"=",
"'relevance'",
",",
"start",
"=",
"0",
")",
":",
"xml",
"=",
"self",
".",
"api",
".",
"xml",
"(",
"API_GROUP_SEARCH_TOPICS",
"%",
"(",
"start",
",",
"sort",
",",
"keyword",
")",
"... | 搜索话题
:param keyword: 关键字
:param sort: 排序方式 relevance/newest
:param start: 翻页
:return: 带总数的列表 | [
"搜索话题",
":",
"param",
"keyword",
":",
"关键字",
":",
"param",
"sort",
":",
"排序方式",
"relevance",
"/",
"newest",
":",
"param",
"start",
":",
"翻页",
":",
"return",
":",
"带总数的列表"
] | train | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/Group.py#L218-L228 |
acrazing/dbapi | dbapi/Group.py | Group.list_topics | def list_topics(self, group_alias, _type='', start=0):
"""
小组内话题列表
:param group_alias: 小组ID
:param _type: 类型 默认最新,hot:最热
:param start: 翻页
:return: 带下一页的列表
"""
xml = self.api.xml(API_GROUP_LIST_GROUP_TOPICS % group_alias, params={
'star... | python | def list_topics(self, group_alias, _type='', start=0):
"""
小组内话题列表
:param group_alias: 小组ID
:param _type: 类型 默认最新,hot:最热
:param start: 翻页
:return: 带下一页的列表
"""
xml = self.api.xml(API_GROUP_LIST_GROUP_TOPICS % group_alias, params={
'star... | [
"def",
"list_topics",
"(",
"self",
",",
"group_alias",
",",
"_type",
"=",
"''",
",",
"start",
"=",
"0",
")",
":",
"xml",
"=",
"self",
".",
"api",
".",
"xml",
"(",
"API_GROUP_LIST_GROUP_TOPICS",
"%",
"group_alias",
",",
"params",
"=",
"{",
"'start'",
":... | 小组内话题列表
:param group_alias: 小组ID
:param _type: 类型 默认最新,hot:最热
:param start: 翻页
:return: 带下一页的列表 | [
"小组内话题列表",
":",
"param",
"group_alias",
":",
"小组ID",
":",
"param",
"_type",
":",
"类型",
"默认最新,hot",
":",
"最热",
":",
"param",
"start",
":",
"翻页",
":",
"return",
":",
"带下一页的列表"
] | train | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/Group.py#L230-L243 |
acrazing/dbapi | dbapi/Group.py | Group.list_joined_topics | def list_joined_topics(self, start=0):
"""
已加入的所有小组的话题列表
:param start: 翻页
:return: 带下一页的列表
"""
xml = self.api.xml(API_GROUP_HOME, params={'start': start})
return build_list_result(self._parse_topic_table(xml, 'title,comment,created,group'), xml) | python | def list_joined_topics(self, start=0):
"""
已加入的所有小组的话题列表
:param start: 翻页
:return: 带下一页的列表
"""
xml = self.api.xml(API_GROUP_HOME, params={'start': start})
return build_list_result(self._parse_topic_table(xml, 'title,comment,created,group'), xml) | [
"def",
"list_joined_topics",
"(",
"self",
",",
"start",
"=",
"0",
")",
":",
"xml",
"=",
"self",
".",
"api",
".",
"xml",
"(",
"API_GROUP_HOME",
",",
"params",
"=",
"{",
"'start'",
":",
"start",
"}",
")",
"return",
"build_list_result",
"(",
"self",
".",
... | 已加入的所有小组的话题列表
:param start: 翻页
:return: 带下一页的列表 | [
"已加入的所有小组的话题列表",
":",
"param",
"start",
":",
"翻页",
":",
"return",
":",
"带下一页的列表"
] | train | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/Group.py#L245-L253 |
acrazing/dbapi | dbapi/Group.py | Group.list_user_topics | def list_user_topics(self, start=0):
"""
发表的话题
:param start: 翻页
:return: 带下一页的列表
"""
xml = self.api.xml(API_GROUP_LIST_USER_PUBLISHED_TOPICS % self.api.user_alias, params={'start': start})
return build_list_result(self._parse_topic_table(xml, 'title,comme... | python | def list_user_topics(self, start=0):
"""
发表的话题
:param start: 翻页
:return: 带下一页的列表
"""
xml = self.api.xml(API_GROUP_LIST_USER_PUBLISHED_TOPICS % self.api.user_alias, params={'start': start})
return build_list_result(self._parse_topic_table(xml, 'title,comme... | [
"def",
"list_user_topics",
"(",
"self",
",",
"start",
"=",
"0",
")",
":",
"xml",
"=",
"self",
".",
"api",
".",
"xml",
"(",
"API_GROUP_LIST_USER_PUBLISHED_TOPICS",
"%",
"self",
".",
"api",
".",
"user_alias",
",",
"params",
"=",
"{",
"'start'",
":",
"start... | 发表的话题
:param start: 翻页
:return: 带下一页的列表 | [
"发表的话题",
":",
"param",
"start",
":",
"翻页",
":",
"return",
":",
"带下一页的列表"
] | train | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/Group.py#L255-L263 |
acrazing/dbapi | dbapi/Group.py | Group.list_commented_topics | def list_commented_topics(self, start=0):
"""
回复过的话题列表
:param start: 翻页
:return: 带下一页的列表
"""
xml = self.api.xml(API_GROUP_LIST_USER_COMMENTED_TOPICS % self.api.user_alias, params={'start': start})
return build_list_result(self._parse_topic_table(xml, 'tit... | python | def list_commented_topics(self, start=0):
"""
回复过的话题列表
:param start: 翻页
:return: 带下一页的列表
"""
xml = self.api.xml(API_GROUP_LIST_USER_COMMENTED_TOPICS % self.api.user_alias, params={'start': start})
return build_list_result(self._parse_topic_table(xml, 'tit... | [
"def",
"list_commented_topics",
"(",
"self",
",",
"start",
"=",
"0",
")",
":",
"xml",
"=",
"self",
".",
"api",
".",
"xml",
"(",
"API_GROUP_LIST_USER_COMMENTED_TOPICS",
"%",
"self",
".",
"api",
".",
"user_alias",
",",
"params",
"=",
"{",
"'start'",
":",
"... | 回复过的话题列表
:param start: 翻页
:return: 带下一页的列表 | [
"回复过的话题列表",
":",
"param",
"start",
":",
"翻页",
":",
"return",
":",
"带下一页的列表"
] | train | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/Group.py#L265-L273 |
acrazing/dbapi | dbapi/Group.py | Group.list_liked_topics | def list_liked_topics(self, user_alias=None, start=0):
"""
喜欢过的话题
:param user_alias: 指定用户,默认当前
:param start: 翻页
:return: 带下一页的列表
"""
user_alias = user_alias or self.api.user_alias
xml = self.api.xml(API_GROUP_LIST_USER_LIKED_TOPICS % user_alias, p... | python | def list_liked_topics(self, user_alias=None, start=0):
"""
喜欢过的话题
:param user_alias: 指定用户,默认当前
:param start: 翻页
:return: 带下一页的列表
"""
user_alias = user_alias or self.api.user_alias
xml = self.api.xml(API_GROUP_LIST_USER_LIKED_TOPICS % user_alias, p... | [
"def",
"list_liked_topics",
"(",
"self",
",",
"user_alias",
"=",
"None",
",",
"start",
"=",
"0",
")",
":",
"user_alias",
"=",
"user_alias",
"or",
"self",
".",
"api",
".",
"user_alias",
"xml",
"=",
"self",
".",
"api",
".",
"xml",
"(",
"API_GROUP_LIST_USER... | 喜欢过的话题
:param user_alias: 指定用户,默认当前
:param start: 翻页
:return: 带下一页的列表 | [
"喜欢过的话题",
":",
"param",
"user_alias",
":",
"指定用户,默认当前",
":",
"param",
"start",
":",
"翻页",
":",
"return",
":",
"带下一页的列表"
] | train | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/Group.py#L275-L285 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.