partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | Directives.directive_SPACE | label SPACE num
Allocate space on the stack. `num` is the number of bytes to allocate | iarm/arm_instructions/directives.py | def directive_SPACE(self, label, params):
"""
label SPACE num
Allocate space on the stack. `num` is the number of bytes to allocate
"""
# TODO allow equations
params = params.strip()
try:
self.convert_to_integer(params)
except ValueError:
... | def directive_SPACE(self, label, params):
"""
label SPACE num
Allocate space on the stack. `num` is the number of bytes to allocate
"""
# TODO allow equations
params = params.strip()
try:
self.convert_to_integer(params)
except ValueError:
... | [
"label",
"SPACE",
"num"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/directives.py#L63-L81 | [
"def",
"directive_SPACE",
"(",
"self",
",",
"label",
",",
"params",
")",
":",
"# TODO allow equations",
"params",
"=",
"params",
".",
"strip",
"(",
")",
"try",
":",
"self",
".",
"convert_to_integer",
"(",
"params",
")",
"except",
"ValueError",
":",
"warnings... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | Directives.directive_DCD | label DCD value[, value ...]
Allocate a word space in read only memory for the value or list of values | iarm/arm_instructions/directives.py | def directive_DCD(self, label, params):
"""
label DCD value[, value ...]
Allocate a word space in read only memory for the value or list of values
"""
# TODO make this read only
# TODO check for param size
# TODO can take any length comma separated values (VAL ... | def directive_DCD(self, label, params):
"""
label DCD value[, value ...]
Allocate a word space in read only memory for the value or list of values
"""
# TODO make this read only
# TODO check for param size
# TODO can take any length comma separated values (VAL ... | [
"label",
"DCD",
"value",
"[",
"value",
"...",
"]"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/directives.py#L92-L118 | [
"def",
"directive_DCD",
"(",
"self",
",",
"label",
",",
"params",
")",
":",
"# TODO make this read only",
"# TODO check for param size",
"# TODO can take any length comma separated values (VAL DCD 1, 0x2, 3, 4",
"params",
"=",
"params",
".",
"strip",
"(",
")",
"try",
":",
... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | Directives.directive_DCH | label DCH value[, value ...]
Allocate a half word space in read only memory for the value or list of values | iarm/arm_instructions/directives.py | def directive_DCH(self, label, params):
"""
label DCH value[, value ...]
Allocate a half word space in read only memory for the value or list of values
"""
# TODO make this read only
# TODO check for word size
# Align address
if self.space_pointer % 2 ... | def directive_DCH(self, label, params):
"""
label DCH value[, value ...]
Allocate a half word space in read only memory for the value or list of values
"""
# TODO make this read only
# TODO check for word size
# Align address
if self.space_pointer % 2 ... | [
"label",
"DCH",
"value",
"[",
"value",
"...",
"]"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/directives.py#L120-L137 | [
"def",
"directive_DCH",
"(",
"self",
",",
"label",
",",
"params",
")",
":",
"# TODO make this read only",
"# TODO check for word size",
"# Align address",
"if",
"self",
".",
"space_pointer",
"%",
"2",
"!=",
"0",
":",
"self",
".",
"space_pointer",
"+=",
"self",
"... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | Directives.directive_DCB | label DCB value[, value ...]
Allocate a byte space in read only memory for the value or list of values | iarm/arm_instructions/directives.py | def directive_DCB(self, label, params):
"""
label DCB value[, value ...]
Allocate a byte space in read only memory for the value or list of values
"""
# TODO make this read only
# TODO check for byte size
self.labels[label] = self.space_pointer
if param... | def directive_DCB(self, label, params):
"""
label DCB value[, value ...]
Allocate a byte space in read only memory for the value or list of values
"""
# TODO make this read only
# TODO check for byte size
self.labels[label] = self.space_pointer
if param... | [
"label",
"DCB",
"value",
"[",
"value",
"...",
"]"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/directives.py#L139-L151 | [
"def",
"directive_DCB",
"(",
"self",
",",
"label",
",",
"params",
")",
":",
"# TODO make this read only",
"# TODO check for byte size",
"self",
".",
"labels",
"[",
"label",
"]",
"=",
"self",
".",
"space_pointer",
"if",
"params",
"in",
"self",
".",
"equates",
"... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | get_celery_app | get_celery_app
:param name: name for this app
:param auth_url: celery broker
:param backend_url: celery backend
:param include_tasks: list of modules containing tasks to add
:param ssl_options: security options dictionary
:param trasport_options: transport options dictionary
:param path_to_... | celery_loaders/work_tasks/get_celery_app.py | def get_celery_app(
name=os.getenv(
"CELERY_NAME",
"worker"),
auth_url=os.getenv(
"BROKER_URL",
"redis://localhost:6379/9"),
backend_url=os.getenv(
"BACKEND_URL",
"redis://localhost:6379/10"),
include_tasks=[],
... | def get_celery_app(
name=os.getenv(
"CELERY_NAME",
"worker"),
auth_url=os.getenv(
"BROKER_URL",
"redis://localhost:6379/9"),
backend_url=os.getenv(
"BACKEND_URL",
"redis://localhost:6379/10"),
include_tasks=[],
... | [
"get_celery_app"
] | jay-johnson/celery-loaders | python | https://github.com/jay-johnson/celery-loaders/blob/aca8169c774582af42a377c27cb3980020080814/celery_loaders/work_tasks/get_celery_app.py#L10-L81 | [
"def",
"get_celery_app",
"(",
"name",
"=",
"os",
".",
"getenv",
"(",
"\"CELERY_NAME\"",
",",
"\"worker\"",
")",
",",
"auth_url",
"=",
"os",
".",
"getenv",
"(",
"\"BROKER_URL\"",
",",
"\"redis://localhost:6379/9\"",
")",
",",
"backend_url",
"=",
"os",
".",
"g... | aca8169c774582af42a377c27cb3980020080814 |
train | RegisterCpu.check_arguments | Determine if the parameters meet the specifications
kwargs contains lists grouped by their parameter
rules are defined by methods starting with 'rule_'
:param kwargs:
:return: | iarm/cpu.py | def check_arguments(self, **kwargs):
"""
Determine if the parameters meet the specifications
kwargs contains lists grouped by their parameter
rules are defined by methods starting with 'rule_'
:param kwargs:
:return:
"""
for key in kwargs:
if k... | def check_arguments(self, **kwargs):
"""
Determine if the parameters meet the specifications
kwargs contains lists grouped by their parameter
rules are defined by methods starting with 'rule_'
:param kwargs:
:return:
"""
for key in kwargs:
if k... | [
"Determine",
"if",
"the",
"parameters",
"meet",
"the",
"specifications",
"kwargs",
"contains",
"lists",
"grouped",
"by",
"their",
"parameter",
"rules",
"are",
"defined",
"by",
"methods",
"starting",
"with",
"rule_",
":",
"param",
"kwargs",
":",
":",
"return",
... | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/cpu.py#L60-L73 | [
"def",
"check_arguments",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"key",
"in",
"kwargs",
":",
"if",
"key",
"in",
"self",
".",
"_rules",
":",
"for",
"val",
"in",
"kwargs",
"[",
"key",
"]",
":",
"self",
".",
"_rules",
"[",
"key",
"]"... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | RandomValueDict.link | Make these two keys have the same value
:param key1:
:param key2:
:return: | iarm/cpu.py | def link(self, key1, key2):
"""
Make these two keys have the same value
:param key1:
:param key2:
:return:
"""
# TODO make this have more than one key linked
# TODO Maybe make the value a set?
self._linked_keys[key1] = key2
self._linked_key... | def link(self, key1, key2):
"""
Make these two keys have the same value
:param key1:
:param key2:
:return:
"""
# TODO make this have more than one key linked
# TODO Maybe make the value a set?
self._linked_keys[key1] = key2
self._linked_key... | [
"Make",
"these",
"two",
"keys",
"have",
"the",
"same",
"value",
":",
"param",
"key1",
":",
":",
"param",
"key2",
":",
":",
"return",
":"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/cpu.py#L130-L140 | [
"def",
"link",
"(",
"self",
",",
"key1",
",",
"key2",
")",
":",
"# TODO make this have more than one key linked",
"# TODO Maybe make the value a set?",
"self",
".",
"_linked_keys",
"[",
"key1",
"]",
"=",
"key2",
"self",
".",
"_linked_keys",
"[",
"key2",
"]",
"=",
... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | instance_ik_model_receiver | A method decorator that filters out sign_original_specals coming from models that don't
have fields that function as ImageFieldSourceGroup sources. | imagekit_cropper/utils.py | def instance_ik_model_receiver(fn):
"""
A method decorator that filters out sign_original_specals coming from models that don't
have fields that function as ImageFieldSourceGroup sources.
"""
@wraps(fn)
def receiver(self, sender, **kwargs):
# print 'inspect.isclass(sender? %s'%(inspect.... | def instance_ik_model_receiver(fn):
"""
A method decorator that filters out sign_original_specals coming from models that don't
have fields that function as ImageFieldSourceGroup sources.
"""
@wraps(fn)
def receiver(self, sender, **kwargs):
# print 'inspect.isclass(sender? %s'%(inspect.... | [
"A",
"method",
"decorator",
"that",
"filters",
"out",
"sign_original_specals",
"coming",
"from",
"models",
"that",
"don",
"t",
"have",
"fields",
"that",
"function",
"as",
"ImageFieldSourceGroup",
"sources",
"."
] | ninapavlich/django-imagekit-cropper | python | https://github.com/ninapavlich/django-imagekit-cropper/blob/c1c2dc5c3c4724492052e5d244e9de1cc362dbcc/imagekit_cropper/utils.py#L32-L50 | [
"def",
"instance_ik_model_receiver",
"(",
"fn",
")",
":",
"@",
"wraps",
"(",
"fn",
")",
"def",
"receiver",
"(",
"self",
",",
"sender",
",",
"*",
"*",
"kwargs",
")",
":",
"# print 'inspect.isclass(sender? %s'%(inspect.isclass(sender))",
"if",
"not",
"inspect",
".... | c1c2dc5c3c4724492052e5d244e9de1cc362dbcc |
train | InstanceSourceGroupRegistry.source_group_receiver | Relay source group signals to the appropriate spec strategy. | imagekit_cropper/utils.py | def source_group_receiver(self, sender, source, signal, **kwargs):
"""
Relay source group signals to the appropriate spec strategy.
"""
from imagekit.cachefiles import ImageCacheFile
source_group = sender
instance = kwargs['instance']
# Ignore signals from unre... | def source_group_receiver(self, sender, source, signal, **kwargs):
"""
Relay source group signals to the appropriate spec strategy.
"""
from imagekit.cachefiles import ImageCacheFile
source_group = sender
instance = kwargs['instance']
# Ignore signals from unre... | [
"Relay",
"source",
"group",
"signals",
"to",
"the",
"appropriate",
"spec",
"strategy",
"."
] | ninapavlich/django-imagekit-cropper | python | https://github.com/ninapavlich/django-imagekit-cropper/blob/c1c2dc5c3c4724492052e5d244e9de1cc362dbcc/imagekit_cropper/utils.py#L87-L114 | [
"def",
"source_group_receiver",
"(",
"self",
",",
"sender",
",",
"source",
",",
"signal",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
"imagekit",
".",
"cachefiles",
"import",
"ImageCacheFile",
"source_group",
"=",
"sender",
"instance",
"=",
"kwargs",
"[",
"'i... | c1c2dc5c3c4724492052e5d244e9de1cc362dbcc |
train | InstanceModelSignalRouter.update_source_hashes | Stores hashes of the source image files so that they can be compared
later to see whether the source image has changed (and therefore whether
the spec file needs to be regenerated). | imagekit_cropper/utils.py | def update_source_hashes(self, instance):
"""
Stores hashes of the source image files so that they can be compared
later to see whether the source image has changed (and therefore whether
the spec file needs to be regenerated).
"""
self.init_instance(instance)
in... | def update_source_hashes(self, instance):
"""
Stores hashes of the source image files so that they can be compared
later to see whether the source image has changed (and therefore whether
the spec file needs to be regenerated).
"""
self.init_instance(instance)
in... | [
"Stores",
"hashes",
"of",
"the",
"source",
"image",
"files",
"so",
"that",
"they",
"can",
"be",
"compared",
"later",
"to",
"see",
"whether",
"the",
"source",
"image",
"has",
"changed",
"(",
"and",
"therefore",
"whether",
"the",
"spec",
"file",
"needs",
"to... | ninapavlich/django-imagekit-cropper | python | https://github.com/ninapavlich/django-imagekit-cropper/blob/c1c2dc5c3c4724492052e5d244e9de1cc362dbcc/imagekit_cropper/utils.py#L134-L145 | [
"def",
"update_source_hashes",
"(",
"self",
",",
"instance",
")",
":",
"self",
".",
"init_instance",
"(",
"instance",
")",
"instance",
".",
"_ik",
"[",
"'source_hashes'",
"]",
"=",
"dict",
"(",
"(",
"attname",
",",
"hash",
"(",
"getattr",
"(",
"instance",
... | c1c2dc5c3c4724492052e5d244e9de1cc362dbcc |
train | InstanceModelSignalRouter.get_source_fields | Returns a list of the source fields for the given instance. | imagekit_cropper/utils.py | def get_source_fields(self, instance):
"""
Returns a list of the source fields for the given instance.
"""
return set(src.image_field
for src in self._source_groups
if isinstance(instance, src.model_class)) | def get_source_fields(self, instance):
"""
Returns a list of the source fields for the given instance.
"""
return set(src.image_field
for src in self._source_groups
if isinstance(instance, src.model_class)) | [
"Returns",
"a",
"list",
"of",
"the",
"source",
"fields",
"for",
"the",
"given",
"instance",
"."
] | ninapavlich/django-imagekit-cropper | python | https://github.com/ninapavlich/django-imagekit-cropper/blob/c1c2dc5c3c4724492052e5d244e9de1cc362dbcc/imagekit_cropper/utils.py#L147-L153 | [
"def",
"get_source_fields",
"(",
"self",
",",
"instance",
")",
":",
"return",
"set",
"(",
"src",
".",
"image_field",
"for",
"src",
"in",
"self",
".",
"_source_groups",
"if",
"isinstance",
"(",
"instance",
",",
"src",
".",
"model_class",
")",
")"
] | c1c2dc5c3c4724492052e5d244e9de1cc362dbcc |
train | CustomTask.on_success | on_success
http://docs.celeryproject.org/en/latest/reference/celery.app.task.html
:param retval: return value
:param task_id: celery task id
:param args: arguments passed into task
:param kwargs: keyword arguments passed into task | celery_loaders/work_tasks/custom_task.py | def on_success(self, retval, task_id, args, kwargs):
"""on_success
http://docs.celeryproject.org/en/latest/reference/celery.app.task.html
:param retval: return value
:param task_id: celery task id
:param args: arguments passed into task
:param kwargs: keyword arguments ... | def on_success(self, retval, task_id, args, kwargs):
"""on_success
http://docs.celeryproject.org/en/latest/reference/celery.app.task.html
:param retval: return value
:param task_id: celery task id
:param args: arguments passed into task
:param kwargs: keyword arguments ... | [
"on_success"
] | jay-johnson/celery-loaders | python | https://github.com/jay-johnson/celery-loaders/blob/aca8169c774582af42a377c27cb3980020080814/celery_loaders/work_tasks/custom_task.py#L14-L32 | [
"def",
"on_success",
"(",
"self",
",",
"retval",
",",
"task_id",
",",
"args",
",",
"kwargs",
")",
":",
"log",
".",
"info",
"(",
"(",
"\"{} SUCCESS - retval={} task_id={} \"",
"\"args={} kwargs={}\"",
")",
".",
"format",
"(",
"self",
".",
"log_label",
",",
"r... | aca8169c774582af42a377c27cb3980020080814 |
train | CustomTask.on_failure | on_failure
http://docs.celeryproject.org/en/latest/userguide/tasks.html#task-inheritance
:param exc: exception
:param task_id: task id
:param args: arguments passed into task
:param kwargs: keyword arguments passed into task
:param einfo: exception info | celery_loaders/work_tasks/custom_task.py | def on_failure(self, exc, task_id, args, kwargs, einfo):
"""on_failure
http://docs.celeryproject.org/en/latest/userguide/tasks.html#task-inheritance
:param exc: exception
:param task_id: task id
:param args: arguments passed into task
:param kwargs: keyword arguments pa... | def on_failure(self, exc, task_id, args, kwargs, einfo):
"""on_failure
http://docs.celeryproject.org/en/latest/userguide/tasks.html#task-inheritance
:param exc: exception
:param task_id: task id
:param args: arguments passed into task
:param kwargs: keyword arguments pa... | [
"on_failure"
] | jay-johnson/celery-loaders | python | https://github.com/jay-johnson/celery-loaders/blob/aca8169c774582af42a377c27cb3980020080814/celery_loaders/work_tasks/custom_task.py#L35-L54 | [
"def",
"on_failure",
"(",
"self",
",",
"exc",
",",
"task_id",
",",
"args",
",",
"kwargs",
",",
"einfo",
")",
":",
"use_exc",
"=",
"str",
"(",
"exc",
")",
"log",
".",
"error",
"(",
"(",
"\"{} FAIL - exc={} \"",
"\"args={} kwargs={}\"",
")",
".",
"format",... | aca8169c774582af42a377c27cb3980020080814 |
train | check_hook_mechanism_is_intact | Check if the hook configuration is absent or has both register AND deregister.
:param module:
:return: True if valid plugin / module. | gcdt/gcdt_signals.py | def check_hook_mechanism_is_intact(module):
"""Check if the hook configuration is absent or has both register AND deregister.
:param module:
:return: True if valid plugin / module.
"""
result = True
if check_register_present(module):
result = not result
if check_deregister_present(m... | def check_hook_mechanism_is_intact(module):
"""Check if the hook configuration is absent or has both register AND deregister.
:param module:
:return: True if valid plugin / module.
"""
result = True
if check_register_present(module):
result = not result
if check_deregister_present(m... | [
"Check",
"if",
"the",
"hook",
"configuration",
"is",
"absent",
"or",
"has",
"both",
"register",
"AND",
"deregister",
"."
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/gcdt_signals.py#L59-L70 | [
"def",
"check_hook_mechanism_is_intact",
"(",
"module",
")",
":",
"result",
"=",
"True",
"if",
"check_register_present",
"(",
"module",
")",
":",
"result",
"=",
"not",
"result",
"if",
"check_deregister_present",
"(",
"module",
")",
":",
"result",
"=",
"not",
"... | cd67cf416371337b83cb9ca3f696277125703339 |
train | cfn_viz | Render dot output for cloudformation.template in json format. | gcdt/kumo_viz.py | def cfn_viz(template, parameters={}, outputs={}, out=sys.stdout):
"""Render dot output for cloudformation.template in json format.
"""
known_sg, open_sg = _analyze_sg(template['Resources'])
(graph, edges) = _extract_graph(template.get('Description', ''),
template['Res... | def cfn_viz(template, parameters={}, outputs={}, out=sys.stdout):
"""Render dot output for cloudformation.template in json format.
"""
known_sg, open_sg = _analyze_sg(template['Resources'])
(graph, edges) = _extract_graph(template.get('Description', ''),
template['Res... | [
"Render",
"dot",
"output",
"for",
"cloudformation",
".",
"template",
"in",
"json",
"format",
"."
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/kumo_viz.py#L30-L41 | [
"def",
"cfn_viz",
"(",
"template",
",",
"parameters",
"=",
"{",
"}",
",",
"outputs",
"=",
"{",
"}",
",",
"out",
"=",
"sys",
".",
"stdout",
")",
":",
"known_sg",
",",
"open_sg",
"=",
"_analyze_sg",
"(",
"template",
"[",
"'Resources'",
"]",
")",
"(",
... | cd67cf416371337b83cb9ca3f696277125703339 |
train | _get_fillcolor | Determine fillcolor for resources (public ones in this case) | gcdt/kumo_viz.py | def _get_fillcolor(resource_type, properties, known_sg=[], open_sg=[]):
"""Determine fillcolor for resources (public ones in this case)
"""
fillcolor = None
# check security groups
if 'SecurityGroups' in properties:
# check for external security groups
for sg in properties['SecurityG... | def _get_fillcolor(resource_type, properties, known_sg=[], open_sg=[]):
"""Determine fillcolor for resources (public ones in this case)
"""
fillcolor = None
# check security groups
if 'SecurityGroups' in properties:
# check for external security groups
for sg in properties['SecurityG... | [
"Determine",
"fillcolor",
"for",
"resources",
"(",
"public",
"ones",
"in",
"this",
"case",
")"
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/kumo_viz.py#L109-L133 | [
"def",
"_get_fillcolor",
"(",
"resource_type",
",",
"properties",
",",
"known_sg",
"=",
"[",
"]",
",",
"open_sg",
"=",
"[",
"]",
")",
":",
"fillcolor",
"=",
"None",
"# check security groups",
"if",
"'SecurityGroups'",
"in",
"properties",
":",
"# check for extern... | cd67cf416371337b83cb9ca3f696277125703339 |
train | svg_output | Render template into svg file using the dot command (must be installed).
:param dotfile: path to the dotfile
:param outfile: filename for the output file
:return: | gcdt/kumo_viz.py | def svg_output(dotfile, outfile='cloudformation.svg'):
"""Render template into svg file using the dot command (must be installed).
:param dotfile: path to the dotfile
:param outfile: filename for the output file
:return:
"""
try:
cmd = ['dot', '-Tsvg', '-o' + outfile, dotfile]
s... | def svg_output(dotfile, outfile='cloudformation.svg'):
"""Render template into svg file using the dot command (must be installed).
:param dotfile: path to the dotfile
:param outfile: filename for the output file
:return:
"""
try:
cmd = ['dot', '-Tsvg', '-o' + outfile, dotfile]
s... | [
"Render",
"template",
"into",
"svg",
"file",
"using",
"the",
"dot",
"command",
"(",
"must",
"be",
"installed",
")",
"."
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/kumo_viz.py#L238-L254 | [
"def",
"svg_output",
"(",
"dotfile",
",",
"outfile",
"=",
"'cloudformation.svg'",
")",
":",
"try",
":",
"cmd",
"=",
"[",
"'dot'",
",",
"'-Tsvg'",
",",
"'-o'",
"+",
"outfile",
",",
"dotfile",
"]",
"subprocess",
".",
"check_output",
"(",
"cmd",
",",
"stder... | cd67cf416371337b83cb9ca3f696277125703339 |
train | start | Start the Helper controller either in the foreground or as a daemon
process.
:param controller_class: The controller class handle to create and run
:type controller_class: callable | helper/__init__.py | def start(controller_class):
"""Start the Helper controller either in the foreground or as a daemon
process.
:param controller_class: The controller class handle to create and run
:type controller_class: callable
"""
args = parser.parse()
obj = controller_class(args, platform.operating_sys... | def start(controller_class):
"""Start the Helper controller either in the foreground or as a daemon
process.
:param controller_class: The controller class handle to create and run
:type controller_class: callable
"""
args = parser.parse()
obj = controller_class(args, platform.operating_sys... | [
"Start",
"the",
"Helper",
"controller",
"either",
"in",
"the",
"foreground",
"or",
"as",
"a",
"daemon",
"process",
"."
] | gmr/helper | python | https://github.com/gmr/helper/blob/fe8e45fc8eabf619429b2940c682c252ee33c082/helper/__init__.py#L149-L171 | [
"def",
"start",
"(",
"controller_class",
")",
":",
"args",
"=",
"parser",
".",
"parse",
"(",
")",
"obj",
"=",
"controller_class",
"(",
"args",
",",
"platform",
".",
"operating_system",
"(",
")",
")",
"if",
"args",
".",
"foreground",
":",
"try",
":",
"o... | fe8e45fc8eabf619429b2940c682c252ee33c082 |
train | Arm.run | Run to the current end of the program or a number of steps
:return: | iarm/arm.py | def run(self, steps=float('inf')):
"""
Run to the current end of the program or a number of steps
:return:
"""
while len(self.program) > (self.register['PC'] - 1):
steps -= 1
if steps < 0:
break
self.program[self.register['PC'] ... | def run(self, steps=float('inf')):
"""
Run to the current end of the program or a number of steps
:return:
"""
while len(self.program) > (self.register['PC'] - 1):
steps -= 1
if steps < 0:
break
self.program[self.register['PC'] ... | [
"Run",
"to",
"the",
"current",
"end",
"of",
"the",
"program",
"or",
"a",
"number",
"of",
"steps",
":",
"return",
":"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm.py#L91-L101 | [
"def",
"run",
"(",
"self",
",",
"steps",
"=",
"float",
"(",
"'inf'",
")",
")",
":",
"while",
"len",
"(",
"self",
".",
"program",
")",
">",
"(",
"self",
".",
"register",
"[",
"'PC'",
"]",
"-",
"1",
")",
":",
"steps",
"-=",
"1",
"if",
"steps",
... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | Pio._validate_type | Helper function that checks the input object type against each in a list of classes. This function
also allows the input value to be equal to None.
:param name: Name of the object.
:param obj: Object to check the type of.
:param args: List of classes.
:raises TypeError: if the i... | pypif/obj/common/pio.py | def _validate_type(self, name, obj, *args):
"""
Helper function that checks the input object type against each in a list of classes. This function
also allows the input value to be equal to None.
:param name: Name of the object.
:param obj: Object to check the type of.
:... | def _validate_type(self, name, obj, *args):
"""
Helper function that checks the input object type against each in a list of classes. This function
also allows the input value to be equal to None.
:param name: Name of the object.
:param obj: Object to check the type of.
:... | [
"Helper",
"function",
"that",
"checks",
"the",
"input",
"object",
"type",
"against",
"each",
"in",
"a",
"list",
"of",
"classes",
".",
"This",
"function",
"also",
"allows",
"the",
"input",
"value",
"to",
"be",
"equal",
"to",
"None",
"."
] | CitrineInformatics/pypif | python | https://github.com/CitrineInformatics/pypif/blob/938348a8ff7b10b330770cccaaeb2109922f681b/pypif/obj/common/pio.py#L36-L52 | [
"def",
"_validate_type",
"(",
"self",
",",
"name",
",",
"obj",
",",
"*",
"args",
")",
":",
"if",
"obj",
"is",
"None",
":",
"return",
"for",
"arg",
"in",
"args",
":",
"if",
"isinstance",
"(",
"obj",
",",
"arg",
")",
":",
"return",
"raise",
"TypeErro... | 938348a8ff7b10b330770cccaaeb2109922f681b |
train | Pio._validate_list_type | Helper function that checks the input object type against each in a list of classes, or if the input object
is a list, each value that it contains against that list.
:param name: Name of the object.
:param obj: Object to check the type of.
:param args: List of classes.
:raises T... | pypif/obj/common/pio.py | def _validate_list_type(self, name, obj, *args):
"""
Helper function that checks the input object type against each in a list of classes, or if the input object
is a list, each value that it contains against that list.
:param name: Name of the object.
:param obj: Object to check... | def _validate_list_type(self, name, obj, *args):
"""
Helper function that checks the input object type against each in a list of classes, or if the input object
is a list, each value that it contains against that list.
:param name: Name of the object.
:param obj: Object to check... | [
"Helper",
"function",
"that",
"checks",
"the",
"input",
"object",
"type",
"against",
"each",
"in",
"a",
"list",
"of",
"classes",
"or",
"if",
"the",
"input",
"object",
"is",
"a",
"list",
"each",
"value",
"that",
"it",
"contains",
"against",
"that",
"list",
... | CitrineInformatics/pypif | python | https://github.com/CitrineInformatics/pypif/blob/938348a8ff7b10b330770cccaaeb2109922f681b/pypif/obj/common/pio.py#L69-L85 | [
"def",
"_validate_list_type",
"(",
"self",
",",
"name",
",",
"obj",
",",
"*",
"args",
")",
":",
"if",
"obj",
"is",
"None",
":",
"return",
"if",
"isinstance",
"(",
"obj",
",",
"list",
")",
":",
"for",
"i",
"in",
"obj",
":",
"self",
".",
"_validate_t... | 938348a8ff7b10b330770cccaaeb2109922f681b |
train | Pio._validate_nested_list_type | Helper function that checks the input object as a list then recursively until nested_level is 1.
:param name: Name of the object.
:param obj: Object to check the type of.
:param nested_level: Integer with the current nested level.
:param args: List of classes.
:raises TypeError:... | pypif/obj/common/pio.py | def _validate_nested_list_type(self, name, obj, nested_level, *args):
"""
Helper function that checks the input object as a list then recursively until nested_level is 1.
:param name: Name of the object.
:param obj: Object to check the type of.
:param nested_level: Integer with ... | def _validate_nested_list_type(self, name, obj, nested_level, *args):
"""
Helper function that checks the input object as a list then recursively until nested_level is 1.
:param name: Name of the object.
:param obj: Object to check the type of.
:param nested_level: Integer with ... | [
"Helper",
"function",
"that",
"checks",
"the",
"input",
"object",
"as",
"a",
"list",
"then",
"recursively",
"until",
"nested_level",
"is",
"1",
"."
] | CitrineInformatics/pypif | python | https://github.com/CitrineInformatics/pypif/blob/938348a8ff7b10b330770cccaaeb2109922f681b/pypif/obj/common/pio.py#L87-L106 | [
"def",
"_validate_nested_list_type",
"(",
"self",
",",
"name",
",",
"obj",
",",
"nested_level",
",",
"*",
"args",
")",
":",
"if",
"nested_level",
"<=",
"1",
":",
"self",
".",
"_validate_list_type",
"(",
"name",
",",
"obj",
",",
"*",
"args",
")",
"else",
... | 938348a8ff7b10b330770cccaaeb2109922f681b |
train | UnconditionalBranch.B | B label
Unconditional branch to the address at label | iarm/arm_instructions/unconditional_branch.py | def B(self, params):
"""
B label
Unconditional branch to the address at label
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# TODO check if label is within +- 2 KB
# B label
def B_func... | def B(self, params):
"""
B label
Unconditional branch to the address at label
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# TODO check if label is within +- 2 KB
# B label
def B_func... | [
"B",
"label"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/unconditional_branch.py#L6-L23 | [
"def",
"B",
"(",
"self",
",",
"params",
")",
":",
"label",
"=",
"self",
".",
"get_one_parameter",
"(",
"self",
".",
"ONE_PARAMETER",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"label_exists",
"=",
"(",
"label",
",",
")",
")",
"# TODO check ... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | UnconditionalBranch.BL | BL label
Branch to the label, storing the next instruction in the Link Register | iarm/arm_instructions/unconditional_branch.py | def BL(self, params):
"""
BL label
Branch to the label, storing the next instruction in the Link Register
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# TODO check if label is within +- 16 MB
... | def BL(self, params):
"""
BL label
Branch to the label, storing the next instruction in the Link Register
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# TODO check if label is within +- 16 MB
... | [
"BL",
"label"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/unconditional_branch.py#L33-L49 | [
"def",
"BL",
"(",
"self",
",",
"params",
")",
":",
"label",
"=",
"self",
".",
"get_one_parameter",
"(",
"self",
".",
"ONE_PARAMETER",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"label_exists",
"=",
"(",
"label",
",",
")",
")",
"# TODO check... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | UnconditionalBranch.BLX | BLX Rj
Branch to the address in Rj, storing the next instruction in the Link Register | iarm/arm_instructions/unconditional_branch.py | def BLX(self, params):
"""
BLX Rj
Branch to the address in Rj, storing the next instruction in the Link Register
"""
Rj = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(LR_or_general_purpose_registers=(Rj,))
def BLX_func():
... | def BLX(self, params):
"""
BLX Rj
Branch to the address in Rj, storing the next instruction in the Link Register
"""
Rj = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(LR_or_general_purpose_registers=(Rj,))
def BLX_func():
... | [
"BLX",
"Rj"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/unconditional_branch.py#L51-L65 | [
"def",
"BLX",
"(",
"self",
",",
"params",
")",
":",
"Rj",
"=",
"self",
".",
"get_one_parameter",
"(",
"self",
".",
"ONE_PARAMETER",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"LR_or_general_purpose_registers",
"=",
"(",
"Rj",
",",
")",
")",
... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | UnconditionalBranch.BX | BX Rj
Jump to the address in the Link Register | iarm/arm_instructions/unconditional_branch.py | def BX(self, params):
"""
BX Rj
Jump to the address in the Link Register
"""
Rj = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(LR_or_general_purpose_registers=(Rj,))
def BX_func():
self.register['PC'] = self.register[Rj]
... | def BX(self, params):
"""
BX Rj
Jump to the address in the Link Register
"""
Rj = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(LR_or_general_purpose_registers=(Rj,))
def BX_func():
self.register['PC'] = self.register[Rj]
... | [
"BX",
"Rj"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/unconditional_branch.py#L67-L80 | [
"def",
"BX",
"(",
"self",
",",
"params",
")",
":",
"Rj",
"=",
"self",
".",
"get_one_parameter",
"(",
"self",
".",
"ONE_PARAMETER",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"LR_or_general_purpose_registers",
"=",
"(",
"Rj",
",",
")",
")",
... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | get_version | Returns a PEP 440-compliant version number from VERSION.
Created by modifying django.utils.version.get_version | click_shell/version.py | def get_version(version):
"""
Returns a PEP 440-compliant version number from VERSION.
Created by modifying django.utils.version.get_version
"""
# Now build the two parts of the version number:
# major = X.Y[.Z]
# sub = .devN - for development releases
# | {a|b|rc}N - for alpha, be... | def get_version(version):
"""
Returns a PEP 440-compliant version number from VERSION.
Created by modifying django.utils.version.get_version
"""
# Now build the two parts of the version number:
# major = X.Y[.Z]
# sub = .devN - for development releases
# | {a|b|rc}N - for alpha, be... | [
"Returns",
"a",
"PEP",
"440",
"-",
"compliant",
"version",
"number",
"from",
"VERSION",
"."
] | clarkperkins/click-shell | python | https://github.com/clarkperkins/click-shell/blob/8d6e1a492176bc79e029d714f19d3156409656ea/click_shell/version.py#L15-L54 | [
"def",
"get_version",
"(",
"version",
")",
":",
"# Now build the two parts of the version number:",
"# major = X.Y[.Z]",
"# sub = .devN - for development releases",
"# | {a|b|rc}N - for alpha, beta and rc releases",
"# | .postN - for post-release releases",
"assert",
"len",
"(",
... | 8d6e1a492176bc79e029d714f19d3156409656ea |
train | get_git_changeset | Returns a numeric identifier of the latest git changeset.
The result is the UTC timestamp of the changeset in YYYYMMDDHHMMSS format.
This value isn't guaranteed to be unique, but collisions are very unlikely,
so it's sufficient for generating the development version numbers. | click_shell/version.py | def get_git_changeset():
"""Returns a numeric identifier of the latest git changeset.
The result is the UTC timestamp of the changeset in YYYYMMDDHHMMSS format.
This value isn't guaranteed to be unique, but collisions are very unlikely,
so it's sufficient for generating the development version numbers.... | def get_git_changeset():
"""Returns a numeric identifier of the latest git changeset.
The result is the UTC timestamp of the changeset in YYYYMMDDHHMMSS format.
This value isn't guaranteed to be unique, but collisions are very unlikely,
so it's sufficient for generating the development version numbers.... | [
"Returns",
"a",
"numeric",
"identifier",
"of",
"the",
"latest",
"git",
"changeset",
"."
] | clarkperkins/click-shell | python | https://github.com/clarkperkins/click-shell/blob/8d6e1a492176bc79e029d714f19d3156409656ea/click_shell/version.py#L58-L74 | [
"def",
"get_git_changeset",
"(",
")",
":",
"repo_dir",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"os",
".",
"path",
".",
"abspath",
"(",
"__file__",
")",
")",
"git_log",
"=",
"subprocess",
".",
"Popen",
"(",
"'git log --pretty=format:%ct --quiet -1 HEAD'",
... | 8d6e1a492176bc79e029d714f19d3156409656ea |
train | load_cloudformation_template | Load cloudformation template from path.
:param path: Absolute or relative path of cloudformation template. Defaults to cwd.
:return: module, success | gcdt/kumo_core.py | def load_cloudformation_template(path=None):
"""Load cloudformation template from path.
:param path: Absolute or relative path of cloudformation template. Defaults to cwd.
:return: module, success
"""
if not path:
path = os.path.abspath('cloudformation.py')
else:
path = os.path.... | def load_cloudformation_template(path=None):
"""Load cloudformation template from path.
:param path: Absolute or relative path of cloudformation template. Defaults to cwd.
:return: module, success
"""
if not path:
path = os.path.abspath('cloudformation.py')
else:
path = os.path.... | [
"Load",
"cloudformation",
"template",
"from",
"path",
"."
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/kumo_core.py#L28-L64 | [
"def",
"load_cloudformation_template",
"(",
"path",
"=",
"None",
")",
":",
"if",
"not",
"path",
":",
"path",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"'cloudformation.py'",
")",
"else",
":",
"path",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"pat... | cd67cf416371337b83cb9ca3f696277125703339 |
train | get_parameter_diff | get differences between local config and currently active config | gcdt/kumo_core.py | def get_parameter_diff(awsclient, config):
"""get differences between local config and currently active config
"""
client_cf = awsclient.get_client('cloudformation')
try:
stack_name = config['stack']['StackName']
if stack_name:
response = client_cf.describe_stacks(StackName=s... | def get_parameter_diff(awsclient, config):
"""get differences between local config and currently active config
"""
client_cf = awsclient.get_client('cloudformation')
try:
stack_name = config['stack']['StackName']
if stack_name:
response = client_cf.describe_stacks(StackName=s... | [
"get",
"differences",
"between",
"local",
"config",
"and",
"currently",
"active",
"config"
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/kumo_core.py#L67-L120 | [
"def",
"get_parameter_diff",
"(",
"awsclient",
",",
"config",
")",
":",
"client_cf",
"=",
"awsclient",
".",
"get_client",
"(",
"'cloudformation'",
")",
"try",
":",
"stack_name",
"=",
"config",
"[",
"'stack'",
"]",
"[",
"'StackName'",
"]",
"if",
"stack_name",
... | cd67cf416371337b83cb9ca3f696277125703339 |
train | call_pre_hook | Invoke the pre_hook BEFORE the config is read.
:param awsclient:
:param cloudformation: | gcdt/kumo_core.py | def call_pre_hook(awsclient, cloudformation):
"""Invoke the pre_hook BEFORE the config is read.
:param awsclient:
:param cloudformation:
"""
# TODO: this is deprecated!! move this to glomex_config_reader
# no config available
if not hasattr(cloudformation, 'pre_hook'):
# hook is not... | def call_pre_hook(awsclient, cloudformation):
"""Invoke the pre_hook BEFORE the config is read.
:param awsclient:
:param cloudformation:
"""
# TODO: this is deprecated!! move this to glomex_config_reader
# no config available
if not hasattr(cloudformation, 'pre_hook'):
# hook is not... | [
"Invoke",
"the",
"pre_hook",
"BEFORE",
"the",
"config",
"is",
"read",
"."
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/kumo_core.py#L123-L139 | [
"def",
"call_pre_hook",
"(",
"awsclient",
",",
"cloudformation",
")",
":",
"# TODO: this is deprecated!! move this to glomex_config_reader",
"# no config available",
"if",
"not",
"hasattr",
"(",
"cloudformation",
",",
"'pre_hook'",
")",
":",
"# hook is not present",
"return",... | cd67cf416371337b83cb9ca3f696277125703339 |
train | deploy_stack | Deploy the stack to AWS cloud. Does either create or update the stack.
:param conf:
:param override_stack_policy:
:return: exit_code | gcdt/kumo_core.py | def deploy_stack(awsclient, context, conf, cloudformation, override_stack_policy=False):
"""Deploy the stack to AWS cloud. Does either create or update the stack.
:param conf:
:param override_stack_policy:
:return: exit_code
"""
stack_name = _get_stack_name(conf)
parameters = _generate_para... | def deploy_stack(awsclient, context, conf, cloudformation, override_stack_policy=False):
"""Deploy the stack to AWS cloud. Does either create or update the stack.
:param conf:
:param override_stack_policy:
:return: exit_code
"""
stack_name = _get_stack_name(conf)
parameters = _generate_para... | [
"Deploy",
"the",
"stack",
"to",
"AWS",
"cloud",
".",
"Does",
"either",
"create",
"or",
"update",
"the",
"stack",
"."
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/kumo_core.py#L322-L344 | [
"def",
"deploy_stack",
"(",
"awsclient",
",",
"context",
",",
"conf",
",",
"cloudformation",
",",
"override_stack_policy",
"=",
"False",
")",
":",
"stack_name",
"=",
"_get_stack_name",
"(",
"conf",
")",
"parameters",
"=",
"_generate_parameters",
"(",
"conf",
")"... | cd67cf416371337b83cb9ca3f696277125703339 |
train | delete_stack | Delete the stack from AWS cloud.
:param awsclient:
:param conf:
:param feedback: print out stack events (defaults to True) | gcdt/kumo_core.py | def delete_stack(awsclient, conf, feedback=True):
"""Delete the stack from AWS cloud.
:param awsclient:
:param conf:
:param feedback: print out stack events (defaults to True)
"""
client_cf = awsclient.get_client('cloudformation')
stack_name = _get_stack_name(conf)
last_event = _get_sta... | def delete_stack(awsclient, conf, feedback=True):
"""Delete the stack from AWS cloud.
:param awsclient:
:param conf:
:param feedback: print out stack events (defaults to True)
"""
client_cf = awsclient.get_client('cloudformation')
stack_name = _get_stack_name(conf)
last_event = _get_sta... | [
"Delete",
"the",
"stack",
"from",
"AWS",
"cloud",
"."
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/kumo_core.py#L526-L543 | [
"def",
"delete_stack",
"(",
"awsclient",
",",
"conf",
",",
"feedback",
"=",
"True",
")",
":",
"client_cf",
"=",
"awsclient",
".",
"get_client",
"(",
"'cloudformation'",
")",
"stack_name",
"=",
"_get_stack_name",
"(",
"conf",
")",
"last_event",
"=",
"_get_stack... | cd67cf416371337b83cb9ca3f696277125703339 |
train | list_stacks | Print out the list of stacks deployed at AWS cloud.
:param awsclient:
:return: | gcdt/kumo_core.py | def list_stacks(awsclient):
"""Print out the list of stacks deployed at AWS cloud.
:param awsclient:
:return:
"""
client_cf = awsclient.get_client('cloudformation')
response = client_cf.list_stacks(
StackStatusFilter=[
'CREATE_IN_PROGRESS', 'CREATE_COMPLETE', 'ROLLBACK_IN_PR... | def list_stacks(awsclient):
"""Print out the list of stacks deployed at AWS cloud.
:param awsclient:
:return:
"""
client_cf = awsclient.get_client('cloudformation')
response = client_cf.list_stacks(
StackStatusFilter=[
'CREATE_IN_PROGRESS', 'CREATE_COMPLETE', 'ROLLBACK_IN_PR... | [
"Print",
"out",
"the",
"list",
"of",
"stacks",
"deployed",
"at",
"AWS",
"cloud",
"."
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/kumo_core.py#L554-L580 | [
"def",
"list_stacks",
"(",
"awsclient",
")",
":",
"client_cf",
"=",
"awsclient",
".",
"get_client",
"(",
"'cloudformation'",
")",
"response",
"=",
"client_cf",
".",
"list_stacks",
"(",
"StackStatusFilter",
"=",
"[",
"'CREATE_IN_PROGRESS'",
",",
"'CREATE_COMPLETE'",
... | cd67cf416371337b83cb9ca3f696277125703339 |
train | describe_change_set | Print out the change_set to console.
This needs to run create_change_set first.
:param awsclient:
:param change_set_name:
:param stack_name: | gcdt/kumo_core.py | def describe_change_set(awsclient, change_set_name, stack_name):
"""Print out the change_set to console.
This needs to run create_change_set first.
:param awsclient:
:param change_set_name:
:param stack_name:
"""
client = awsclient.get_client('cloudformation')
status = None
while s... | def describe_change_set(awsclient, change_set_name, stack_name):
"""Print out the change_set to console.
This needs to run create_change_set first.
:param awsclient:
:param change_set_name:
:param stack_name:
"""
client = awsclient.get_client('cloudformation')
status = None
while s... | [
"Print",
"out",
"the",
"change_set",
"to",
"console",
".",
"This",
"needs",
"to",
"run",
"create_change_set",
"first",
"."
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/kumo_core.py#L608-L629 | [
"def",
"describe_change_set",
"(",
"awsclient",
",",
"change_set_name",
",",
"stack_name",
")",
":",
"client",
"=",
"awsclient",
".",
"get_client",
"(",
"'cloudformation'",
")",
"status",
"=",
"None",
"while",
"status",
"not",
"in",
"[",
"'CREATE_COMPLETE'",
","... | cd67cf416371337b83cb9ca3f696277125703339 |
train | delete_change_set | Delete specified change set. Currently we only use this during
automated regression testing. But we have plans so lets locate this
functionality here
:param awsclient:
:param change_set_name:
:param stack_name: | gcdt/kumo_core.py | def delete_change_set(awsclient, change_set_name, stack_name):
"""Delete specified change set. Currently we only use this during
automated regression testing. But we have plans so lets locate this
functionality here
:param awsclient:
:param change_set_name:
:param stack_name:
"""
client... | def delete_change_set(awsclient, change_set_name, stack_name):
"""Delete specified change set. Currently we only use this during
automated regression testing. But we have plans so lets locate this
functionality here
:param awsclient:
:param change_set_name:
:param stack_name:
"""
client... | [
"Delete",
"specified",
"change",
"set",
".",
"Currently",
"we",
"only",
"use",
"this",
"during",
"automated",
"regression",
"testing",
".",
"But",
"we",
"have",
"plans",
"so",
"lets",
"locate",
"this",
"functionality",
"here"
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/kumo_core.py#L632-L645 | [
"def",
"delete_change_set",
"(",
"awsclient",
",",
"change_set_name",
",",
"stack_name",
")",
":",
"client",
"=",
"awsclient",
".",
"get_client",
"(",
"'cloudformation'",
")",
"response",
"=",
"client",
".",
"delete_change_set",
"(",
"ChangeSetName",
"=",
"change_... | cd67cf416371337b83cb9ca3f696277125703339 |
train | write_template_to_file | Writes the template to disk | gcdt/kumo_core.py | def write_template_to_file(conf, template_body):
"""Writes the template to disk
"""
template_file_name = _get_stack_name(conf) + '-generated-cf-template.json'
with open(template_file_name, 'w') as opened_file:
opened_file.write(template_body)
print('wrote cf-template for %s to disk: %s' % (
... | def write_template_to_file(conf, template_body):
"""Writes the template to disk
"""
template_file_name = _get_stack_name(conf) + '-generated-cf-template.json'
with open(template_file_name, 'w') as opened_file:
opened_file.write(template_body)
print('wrote cf-template for %s to disk: %s' % (
... | [
"Writes",
"the",
"template",
"to",
"disk"
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/kumo_core.py#L658-L666 | [
"def",
"write_template_to_file",
"(",
"conf",
",",
"template_body",
")",
":",
"template_file_name",
"=",
"_get_stack_name",
"(",
"conf",
")",
"+",
"'-generated-cf-template.json'",
"with",
"open",
"(",
"template_file_name",
",",
"'w'",
")",
"as",
"opened_file",
":",
... | cd67cf416371337b83cb9ca3f696277125703339 |
train | generate_template | call cloudformation to generate the template (json format).
:param context:
:param config:
:param cloudformation:
:return: | gcdt/kumo_core.py | def generate_template(context, config, cloudformation):
"""call cloudformation to generate the template (json format).
:param context:
:param config:
:param cloudformation:
:return:
"""
spec = inspect.getargspec(cloudformation.generate_template)[0]
if len(spec) == 0:
return clou... | def generate_template(context, config, cloudformation):
"""call cloudformation to generate the template (json format).
:param context:
:param config:
:param cloudformation:
:return:
"""
spec = inspect.getargspec(cloudformation.generate_template)[0]
if len(spec) == 0:
return clou... | [
"call",
"cloudformation",
"to",
"generate",
"the",
"template",
"(",
"json",
"format",
")",
"."
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/kumo_core.py#L669-L683 | [
"def",
"generate_template",
"(",
"context",
",",
"config",
",",
"cloudformation",
")",
":",
"spec",
"=",
"inspect",
".",
"getargspec",
"(",
"cloudformation",
".",
"generate_template",
")",
"[",
"0",
"]",
"if",
"len",
"(",
"spec",
")",
"==",
"0",
":",
"re... | cd67cf416371337b83cb9ca3f696277125703339 |
train | info | collect info and output to console
:param awsclient:
:param config:
:param json: True / False to use json format as output
:return: | gcdt/kumo_core.py | def info(awsclient, config, format=None):
"""
collect info and output to console
:param awsclient:
:param config:
:param json: True / False to use json format as output
:return:
"""
if format is None:
format = 'tabular'
stack_name = _get_stack_name(config)
client_cfn = a... | def info(awsclient, config, format=None):
"""
collect info and output to console
:param awsclient:
:param config:
:param json: True / False to use json format as output
:return:
"""
if format is None:
format = 'tabular'
stack_name = _get_stack_name(config)
client_cfn = a... | [
"collect",
"info",
"and",
"output",
"to",
"console"
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/kumo_core.py#L686-L719 | [
"def",
"info",
"(",
"awsclient",
",",
"config",
",",
"format",
"=",
"None",
")",
":",
"if",
"format",
"is",
"None",
":",
"format",
"=",
"'tabular'",
"stack_name",
"=",
"_get_stack_name",
"(",
"config",
")",
"client_cfn",
"=",
"awsclient",
".",
"get_client"... | cd67cf416371337b83cb9ca3f696277125703339 |
train | ConditionalBranch.BCC | BCC label
Branch to the instruction at label if the C flag is not set | iarm/arm_instructions/conditional_branch.py | def BCC(self, params):
"""
BCC label
Branch to the instruction at label if the C flag is not set
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BCC label
def BCC_func():
if not se... | def BCC(self, params):
"""
BCC label
Branch to the instruction at label if the C flag is not set
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BCC label
def BCC_func():
if not se... | [
"BCC",
"label"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/conditional_branch.py#L5-L20 | [
"def",
"BCC",
"(",
"self",
",",
"params",
")",
":",
"label",
"=",
"self",
".",
"get_one_parameter",
"(",
"self",
".",
"ONE_PARAMETER",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"label_exists",
"=",
"(",
"label",
",",
")",
")",
"# BCC label... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | ConditionalBranch.BCS | BCS label
Branch to the instruction at label if the C flag is set | iarm/arm_instructions/conditional_branch.py | def BCS(self, params):
"""
BCS label
Branch to the instruction at label if the C flag is set
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BCS label
def BCS_func():
if self.is_C_... | def BCS(self, params):
"""
BCS label
Branch to the instruction at label if the C flag is set
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BCS label
def BCS_func():
if self.is_C_... | [
"BCS",
"label"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/conditional_branch.py#L22-L37 | [
"def",
"BCS",
"(",
"self",
",",
"params",
")",
":",
"label",
"=",
"self",
".",
"get_one_parameter",
"(",
"self",
".",
"ONE_PARAMETER",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"label_exists",
"=",
"(",
"label",
",",
")",
")",
"# BCS label... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | ConditionalBranch.BEQ | BEQ label
Branch to the instruction at label if the Z flag is set | iarm/arm_instructions/conditional_branch.py | def BEQ(self, params):
"""
BEQ label
Branch to the instruction at label if the Z flag is set
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BEQ label
def BEQ_func():
if self.is_Z_... | def BEQ(self, params):
"""
BEQ label
Branch to the instruction at label if the Z flag is set
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BEQ label
def BEQ_func():
if self.is_Z_... | [
"BEQ",
"label"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/conditional_branch.py#L39-L54 | [
"def",
"BEQ",
"(",
"self",
",",
"params",
")",
":",
"label",
"=",
"self",
".",
"get_one_parameter",
"(",
"self",
".",
"ONE_PARAMETER",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"label_exists",
"=",
"(",
"label",
",",
")",
")",
"# BEQ label... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | ConditionalBranch.BGE | BGE label
Branch to the instruction at label if the N flag is the same as the V flag | iarm/arm_instructions/conditional_branch.py | def BGE(self, params):
"""
BGE label
Branch to the instruction at label if the N flag is the same as the V flag
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BGE label
def BGE_func():
... | def BGE(self, params):
"""
BGE label
Branch to the instruction at label if the N flag is the same as the V flag
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BGE label
def BGE_func():
... | [
"BGE",
"label"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/conditional_branch.py#L56-L71 | [
"def",
"BGE",
"(",
"self",
",",
"params",
")",
":",
"label",
"=",
"self",
".",
"get_one_parameter",
"(",
"self",
".",
"ONE_PARAMETER",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"label_exists",
"=",
"(",
"label",
",",
")",
")",
"# BGE label... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | ConditionalBranch.BGT | BGT label
Branch to the instruction at label if the N flag is the same as the V flag and the Z flag is not set | iarm/arm_instructions/conditional_branch.py | def BGT(self, params):
"""
BGT label
Branch to the instruction at label if the N flag is the same as the V flag and the Z flag is not set
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BGT label
... | def BGT(self, params):
"""
BGT label
Branch to the instruction at label if the N flag is the same as the V flag and the Z flag is not set
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BGT label
... | [
"BGT",
"label"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/conditional_branch.py#L73-L88 | [
"def",
"BGT",
"(",
"self",
",",
"params",
")",
":",
"label",
"=",
"self",
".",
"get_one_parameter",
"(",
"self",
".",
"ONE_PARAMETER",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"label_exists",
"=",
"(",
"label",
",",
")",
")",
"# BGT label... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | ConditionalBranch.BHI | BHI label
Branch to the instruction at label if the C flag is set and the Z flag is not set | iarm/arm_instructions/conditional_branch.py | def BHI(self, params):
"""
BHI label
Branch to the instruction at label if the C flag is set and the Z flag is not set
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BHI label
def BHI_func():... | def BHI(self, params):
"""
BHI label
Branch to the instruction at label if the C flag is set and the Z flag is not set
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BHI label
def BHI_func():... | [
"BHI",
"label"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/conditional_branch.py#L90-L105 | [
"def",
"BHI",
"(",
"self",
",",
"params",
")",
":",
"label",
"=",
"self",
".",
"get_one_parameter",
"(",
"self",
".",
"ONE_PARAMETER",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"label_exists",
"=",
"(",
"label",
",",
")",
")",
"# BHI label... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | ConditionalBranch.BHS | BHS label
Branch to the instruction at label if the C flag is set | iarm/arm_instructions/conditional_branch.py | def BHS(self, params):
"""
BHS label
Branch to the instruction at label if the C flag is set
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BHS label
def BHS_func():
if self.is_C_... | def BHS(self, params):
"""
BHS label
Branch to the instruction at label if the C flag is set
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BHS label
def BHS_func():
if self.is_C_... | [
"BHS",
"label"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/conditional_branch.py#L107-L122 | [
"def",
"BHS",
"(",
"self",
",",
"params",
")",
":",
"label",
"=",
"self",
".",
"get_one_parameter",
"(",
"self",
".",
"ONE_PARAMETER",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"label_exists",
"=",
"(",
"label",
",",
")",
")",
"# BHS label... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | ConditionalBranch.BLE | BLE label
Branch to the instruction at label if the Z flag is set or if the N flag is not the same as the V flag | iarm/arm_instructions/conditional_branch.py | def BLE(self, params):
"""
BLE label
Branch to the instruction at label if the Z flag is set or if the N flag is not the same as the V flag
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BLE label
... | def BLE(self, params):
"""
BLE label
Branch to the instruction at label if the Z flag is set or if the N flag is not the same as the V flag
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BLE label
... | [
"BLE",
"label"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/conditional_branch.py#L124-L139 | [
"def",
"BLE",
"(",
"self",
",",
"params",
")",
":",
"label",
"=",
"self",
".",
"get_one_parameter",
"(",
"self",
".",
"ONE_PARAMETER",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"label_exists",
"=",
"(",
"label",
",",
")",
")",
"# BLE label... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | ConditionalBranch.BLO | BLO label
Branch to the instruction at label if the C flag is not set | iarm/arm_instructions/conditional_branch.py | def BLO(self, params):
"""
BLO label
Branch to the instruction at label if the C flag is not set
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BLO label
def BLO_func():
if not se... | def BLO(self, params):
"""
BLO label
Branch to the instruction at label if the C flag is not set
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BLO label
def BLO_func():
if not se... | [
"BLO",
"label"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/conditional_branch.py#L141-L156 | [
"def",
"BLO",
"(",
"self",
",",
"params",
")",
":",
"label",
"=",
"self",
".",
"get_one_parameter",
"(",
"self",
".",
"ONE_PARAMETER",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"label_exists",
"=",
"(",
"label",
",",
")",
")",
"# BLO label... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | ConditionalBranch.BLS | BLS label
Branch to the instruction at label if the C flag is not set or the Z flag is set | iarm/arm_instructions/conditional_branch.py | def BLS(self, params):
"""
BLS label
Branch to the instruction at label if the C flag is not set or the Z flag is set
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BLS label
def BLS_func():
... | def BLS(self, params):
"""
BLS label
Branch to the instruction at label if the C flag is not set or the Z flag is set
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BLS label
def BLS_func():
... | [
"BLS",
"label"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/conditional_branch.py#L158-L173 | [
"def",
"BLS",
"(",
"self",
",",
"params",
")",
":",
"label",
"=",
"self",
".",
"get_one_parameter",
"(",
"self",
".",
"ONE_PARAMETER",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"label_exists",
"=",
"(",
"label",
",",
")",
")",
"# BLS label... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | ConditionalBranch.BLT | BLT label
Branch to the instruction at label if the N flag is not the same as the V flag | iarm/arm_instructions/conditional_branch.py | def BLT(self, params):
"""
BLT label
Branch to the instruction at label if the N flag is not the same as the V flag
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BLT label
def BLT_func():
... | def BLT(self, params):
"""
BLT label
Branch to the instruction at label if the N flag is not the same as the V flag
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BLT label
def BLT_func():
... | [
"BLT",
"label"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/conditional_branch.py#L175-L190 | [
"def",
"BLT",
"(",
"self",
",",
"params",
")",
":",
"label",
"=",
"self",
".",
"get_one_parameter",
"(",
"self",
".",
"ONE_PARAMETER",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"label_exists",
"=",
"(",
"label",
",",
")",
")",
"# BLT label... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | ConditionalBranch.BMI | BMI label
Branch to the instruction at label if the N flag is set | iarm/arm_instructions/conditional_branch.py | def BMI(self, params):
"""
BMI label
Branch to the instruction at label if the N flag is set
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BMI label
def BMI_func():
if self.is_N_... | def BMI(self, params):
"""
BMI label
Branch to the instruction at label if the N flag is set
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BMI label
def BMI_func():
if self.is_N_... | [
"BMI",
"label"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/conditional_branch.py#L192-L207 | [
"def",
"BMI",
"(",
"self",
",",
"params",
")",
":",
"label",
"=",
"self",
".",
"get_one_parameter",
"(",
"self",
".",
"ONE_PARAMETER",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"label_exists",
"=",
"(",
"label",
",",
")",
")",
"# BMI label... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | ConditionalBranch.BNE | BNE label
Branch to the instruction at label if the Z flag is not set | iarm/arm_instructions/conditional_branch.py | def BNE(self, params):
"""
BNE label
Branch to the instruction at label if the Z flag is not set
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BNE label
def BNE_func():
if not se... | def BNE(self, params):
"""
BNE label
Branch to the instruction at label if the Z flag is not set
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BNE label
def BNE_func():
if not se... | [
"BNE",
"label"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/conditional_branch.py#L209-L224 | [
"def",
"BNE",
"(",
"self",
",",
"params",
")",
":",
"label",
"=",
"self",
".",
"get_one_parameter",
"(",
"self",
".",
"ONE_PARAMETER",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"label_exists",
"=",
"(",
"label",
",",
")",
")",
"# BNE label... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | ConditionalBranch.BPL | BPL label
Branch to the instruction at label if the N flag is set | iarm/arm_instructions/conditional_branch.py | def BPL(self, params):
"""
BPL label
Branch to the instruction at label if the N flag is set
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BPL label
def BPL_func():
if not self.i... | def BPL(self, params):
"""
BPL label
Branch to the instruction at label if the N flag is set
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BPL label
def BPL_func():
if not self.i... | [
"BPL",
"label"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/conditional_branch.py#L226-L241 | [
"def",
"BPL",
"(",
"self",
",",
"params",
")",
":",
"label",
"=",
"self",
".",
"get_one_parameter",
"(",
"self",
".",
"ONE_PARAMETER",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"label_exists",
"=",
"(",
"label",
",",
")",
")",
"# BPL label... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | ConditionalBranch.BVC | BVC label
Branch to the instruction at label if the V flag is not set | iarm/arm_instructions/conditional_branch.py | def BVC(self, params):
"""
BVC label
Branch to the instruction at label if the V flag is not set
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BVC label
def BVC_func():
if not se... | def BVC(self, params):
"""
BVC label
Branch to the instruction at label if the V flag is not set
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BVC label
def BVC_func():
if not se... | [
"BVC",
"label"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/conditional_branch.py#L243-L258 | [
"def",
"BVC",
"(",
"self",
",",
"params",
")",
":",
"label",
"=",
"self",
".",
"get_one_parameter",
"(",
"self",
".",
"ONE_PARAMETER",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"label_exists",
"=",
"(",
"label",
",",
")",
")",
"# BVC label... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | ConditionalBranch.BVS | BVS label
Branch to the instruction at label if the V flag is set | iarm/arm_instructions/conditional_branch.py | def BVS(self, params):
"""
BVS label
Branch to the instruction at label if the V flag is set
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BVS label
def BVS_func():
if self.is_V_... | def BVS(self, params):
"""
BVS label
Branch to the instruction at label if the V flag is set
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BVS label
def BVS_func():
if self.is_V_... | [
"BVS",
"label"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/conditional_branch.py#L260-L275 | [
"def",
"BVS",
"(",
"self",
",",
"params",
")",
":",
"label",
"=",
"self",
".",
"get_one_parameter",
"(",
"self",
".",
"ONE_PARAMETER",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"label_exists",
"=",
"(",
"label",
",",
")",
")",
"# BVS label... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | MetricGroupAdmin.get_queryset | Shows one entry per distinct metric name | salmon/metrics/admin.py | def get_queryset(self, request):
"""Shows one entry per distinct metric name"""
queryset = super(MetricGroupAdmin, self).get_queryset(request)
# poor-man's DISTINCT ON for Sqlite3
qs_values = queryset.values('id', 'name')
# 2.7+ only :(
# = {metric['name']: metric['id'] f... | def get_queryset(self, request):
"""Shows one entry per distinct metric name"""
queryset = super(MetricGroupAdmin, self).get_queryset(request)
# poor-man's DISTINCT ON for Sqlite3
qs_values = queryset.values('id', 'name')
# 2.7+ only :(
# = {metric['name']: metric['id'] f... | [
"Shows",
"one",
"entry",
"per",
"distinct",
"metric",
"name"
] | lincolnloop/salmon | python | https://github.com/lincolnloop/salmon/blob/62a965ad9716707ea1db4afb5d9646766f29b64b/salmon/metrics/admin.py#L34-L45 | [
"def",
"get_queryset",
"(",
"self",
",",
"request",
")",
":",
"queryset",
"=",
"super",
"(",
"MetricGroupAdmin",
",",
"self",
")",
".",
"get_queryset",
"(",
"request",
")",
"# poor-man's DISTINCT ON for Sqlite3",
"qs_values",
"=",
"queryset",
".",
"values",
"(",... | 62a965ad9716707ea1db4afb5d9646766f29b64b |
train | MetricGroupAdmin.save_model | Updates all metrics with the same name | salmon/metrics/admin.py | def save_model(self, request, obj, form, change):
"""Updates all metrics with the same name"""
like_metrics = self.model.objects.filter(name=obj.name)
# 2.7+ only :(
# = {key: form.cleaned_data[key] for key in form.changed_data}
updates = {}
for key in form.changed_data:
... | def save_model(self, request, obj, form, change):
"""Updates all metrics with the same name"""
like_metrics = self.model.objects.filter(name=obj.name)
# 2.7+ only :(
# = {key: form.cleaned_data[key] for key in form.changed_data}
updates = {}
for key in form.changed_data:
... | [
"Updates",
"all",
"metrics",
"with",
"the",
"same",
"name"
] | lincolnloop/salmon | python | https://github.com/lincolnloop/salmon/blob/62a965ad9716707ea1db4afb5d9646766f29b64b/salmon/metrics/admin.py#L47-L55 | [
"def",
"save_model",
"(",
"self",
",",
"request",
",",
"obj",
",",
"form",
",",
"change",
")",
":",
"like_metrics",
"=",
"self",
".",
"model",
".",
"objects",
".",
"filter",
"(",
"name",
"=",
"obj",
".",
"name",
")",
"# 2.7+ only :(",
"# = {key: form.cle... | 62a965ad9716707ea1db4afb5d9646766f29b64b |
train | _Meta.parse_lines | Return a list of the parsed code
For each line, return a three-tuple containing:
1. The label
2. The instruction
3. Any arguments or parameters
An element in the tuple may be None or '' if it did not find anything
:param code: The code to parse
:return: A list o... | iarm/arm_instructions/_meta.py | def parse_lines(self, code):
"""
Return a list of the parsed code
For each line, return a three-tuple containing:
1. The label
2. The instruction
3. Any arguments or parameters
An element in the tuple may be None or '' if it did not find anything
:param ... | def parse_lines(self, code):
"""
Return a list of the parsed code
For each line, return a three-tuple containing:
1. The label
2. The instruction
3. Any arguments or parameters
An element in the tuple may be None or '' if it did not find anything
:param ... | [
"Return",
"a",
"list",
"of",
"the",
"parsed",
"code"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/_meta.py#L20-L40 | [
"def",
"parse_lines",
"(",
"self",
",",
"code",
")",
":",
"remove_comments",
"=",
"re",
".",
"compile",
"(",
"r'^([^;@\\n]*);?.*$'",
",",
"re",
".",
"MULTILINE",
")",
"code",
"=",
"'\\n'",
".",
"join",
"(",
"remove_comments",
".",
"findall",
"(",
"code",
... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | _Meta.check_register | Is the parameter a register in the form of 'R<d>',
and if so is it within the bounds of registers defined
Raises an exception if
1. The parameter is not in the form of 'R<d>'
2. <d> is outside the range of registers defined in the init value
registers or _max_registers
... | iarm/arm_instructions/_meta.py | def check_register(self, arg):
"""
Is the parameter a register in the form of 'R<d>',
and if so is it within the bounds of registers defined
Raises an exception if
1. The parameter is not in the form of 'R<d>'
2. <d> is outside the range of registers defined in the init ... | def check_register(self, arg):
"""
Is the parameter a register in the form of 'R<d>',
and if so is it within the bounds of registers defined
Raises an exception if
1. The parameter is not in the form of 'R<d>'
2. <d> is outside the range of registers defined in the init ... | [
"Is",
"the",
"parameter",
"a",
"register",
"in",
"the",
"form",
"of",
"R<d",
">",
"and",
"if",
"so",
"is",
"it",
"within",
"the",
"bounds",
"of",
"registers",
"defined"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/_meta.py#L76-L109 | [
"def",
"check_register",
"(",
"self",
",",
"arg",
")",
":",
"self",
".",
"check_parameter",
"(",
"arg",
")",
"match",
"=",
"re",
".",
"search",
"(",
"self",
".",
"REGISTER_REGEX",
",",
"arg",
")",
"if",
"match",
"is",
"None",
":",
"raise",
"iarm",
".... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | _Meta.check_immediate | Is the parameter an immediate in the form of '#<d>',
Raises an exception if
1. The parameter is not in the form of '#<d>'
:param arg: The parameter to check
:return: The value of the immediate | iarm/arm_instructions/_meta.py | def check_immediate(self, arg):
"""
Is the parameter an immediate in the form of '#<d>',
Raises an exception if
1. The parameter is not in the form of '#<d>'
:param arg: The parameter to check
:return: The value of the immediate
"""
self.check_parameter(a... | def check_immediate(self, arg):
"""
Is the parameter an immediate in the form of '#<d>',
Raises an exception if
1. The parameter is not in the form of '#<d>'
:param arg: The parameter to check
:return: The value of the immediate
"""
self.check_parameter(a... | [
"Is",
"the",
"parameter",
"an",
"immediate",
"in",
"the",
"form",
"of",
"#<d",
">"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/_meta.py#L111-L124 | [
"def",
"check_immediate",
"(",
"self",
",",
"arg",
")",
":",
"self",
".",
"check_parameter",
"(",
"arg",
")",
"match",
"=",
"re",
".",
"search",
"(",
"self",
".",
"IMMEDIATE_REGEX",
",",
"arg",
")",
"if",
"match",
"is",
"None",
":",
"raise",
"iarm",
... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | _Meta.check_immediate_unsigned_value | Is the immediate within the unsigned value of 2**bit - 1
Raises an exception if
1. The immediate value is > 2**bit - 1
:param arg: The parameter to check
:param bit: The number of bits to use in 2**bit
:return: The value of the immediate | iarm/arm_instructions/_meta.py | def check_immediate_unsigned_value(self, arg, bit):
"""
Is the immediate within the unsigned value of 2**bit - 1
Raises an exception if
1. The immediate value is > 2**bit - 1
:param arg: The parameter to check
:param bit: The number of bits to use in 2**bit
:retu... | def check_immediate_unsigned_value(self, arg, bit):
"""
Is the immediate within the unsigned value of 2**bit - 1
Raises an exception if
1. The immediate value is > 2**bit - 1
:param arg: The parameter to check
:param bit: The number of bits to use in 2**bit
:retu... | [
"Is",
"the",
"immediate",
"within",
"the",
"unsigned",
"value",
"of",
"2",
"**",
"bit",
"-",
"1"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/_meta.py#L134-L147 | [
"def",
"check_immediate_unsigned_value",
"(",
"self",
",",
"arg",
",",
"bit",
")",
":",
"i_num",
"=",
"self",
".",
"check_immediate",
"(",
"arg",
")",
"if",
"(",
"i_num",
">",
"(",
"2",
"**",
"bit",
"-",
"1",
")",
")",
"or",
"(",
"i_num",
"<",
"0",... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | _Meta.check_immediate_value | Is the immediate within the range of [_min, _max]
Raises an exception if
1. The immediate value is < _min or > _max
:param arg: The parameter to check
:param _max: The maximum value
:param _min: The minimum value, optional, default is zero
:return: The immediate value | iarm/arm_instructions/_meta.py | def check_immediate_value(self, arg, _max, _min=0):
"""
Is the immediate within the range of [_min, _max]
Raises an exception if
1. The immediate value is < _min or > _max
:param arg: The parameter to check
:param _max: The maximum value
:param _min: The minimum ... | def check_immediate_value(self, arg, _max, _min=0):
"""
Is the immediate within the range of [_min, _max]
Raises an exception if
1. The immediate value is < _min or > _max
:param arg: The parameter to check
:param _max: The maximum value
:param _min: The minimum ... | [
"Is",
"the",
"immediate",
"within",
"the",
"range",
"of",
"[",
"_min",
"_max",
"]"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/_meta.py#L149-L163 | [
"def",
"check_immediate_value",
"(",
"self",
",",
"arg",
",",
"_max",
",",
"_min",
"=",
"0",
")",
":",
"i_num",
"=",
"self",
".",
"check_immediate",
"(",
"arg",
")",
"if",
"(",
"i_num",
">",
"_max",
")",
"or",
"(",
"i_num",
"<",
"_min",
")",
":",
... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | _Meta.rule_low_registers | Low registers are R0 - R7 | iarm/arm_instructions/_meta.py | def rule_low_registers(self, arg):
"""Low registers are R0 - R7"""
r_num = self.check_register(arg)
if r_num > 7:
raise iarm.exceptions.RuleError(
"Register {} is not a low register".format(arg)) | def rule_low_registers(self, arg):
"""Low registers are R0 - R7"""
r_num = self.check_register(arg)
if r_num > 7:
raise iarm.exceptions.RuleError(
"Register {} is not a low register".format(arg)) | [
"Low",
"registers",
"are",
"R0",
"-",
"R7"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/_meta.py#L170-L175 | [
"def",
"rule_low_registers",
"(",
"self",
",",
"arg",
")",
":",
"r_num",
"=",
"self",
".",
"check_register",
"(",
"arg",
")",
"if",
"r_num",
">",
"7",
":",
"raise",
"iarm",
".",
"exceptions",
".",
"RuleError",
"(",
"\"Register {} is not a low register\"",
".... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | _Meta.get_parameters | Given a regex expression and the string with the paramers,
either return a regex match object or raise an exception if the regex
did not find a match
:param regex_exp:
:param parameters:
:return: | iarm/arm_instructions/_meta.py | def get_parameters(self, regex_exp, parameters):
"""
Given a regex expression and the string with the paramers,
either return a regex match object or raise an exception if the regex
did not find a match
:param regex_exp:
:param parameters:
:return:
"""
... | def get_parameters(self, regex_exp, parameters):
"""
Given a regex expression and the string with the paramers,
either return a regex match object or raise an exception if the regex
did not find a match
:param regex_exp:
:param parameters:
:return:
"""
... | [
"Given",
"a",
"regex",
"expression",
"and",
"the",
"string",
"with",
"the",
"paramers",
"either",
"return",
"a",
"regex",
"match",
"object",
"or",
"raise",
"an",
"exception",
"if",
"the",
"regex",
"did",
"not",
"find",
"a",
"match",
":",
"param",
"regex_ex... | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/_meta.py#L241-L257 | [
"def",
"get_parameters",
"(",
"self",
",",
"regex_exp",
",",
"parameters",
")",
":",
"# TODO find a better way to do the equate replacement",
"for",
"rep",
"in",
"self",
".",
"equates",
":",
"parameters",
"=",
"parameters",
".",
"replace",
"(",
"rep",
",",
"str",
... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | _Meta.get_one_parameter | Get three parameters from a given regex expression
Raise an exception if more than three were found
:param regex_exp:
:param parameters:
:return: | iarm/arm_instructions/_meta.py | def get_one_parameter(self, regex_exp, parameters):
"""
Get three parameters from a given regex expression
Raise an exception if more than three were found
:param regex_exp:
:param parameters:
:return:
"""
Rx, other = self.get_parameters(regex_exp, parame... | def get_one_parameter(self, regex_exp, parameters):
"""
Get three parameters from a given regex expression
Raise an exception if more than three were found
:param regex_exp:
:param parameters:
:return:
"""
Rx, other = self.get_parameters(regex_exp, parame... | [
"Get",
"three",
"parameters",
"from",
"a",
"given",
"regex",
"expression"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/_meta.py#L259-L271 | [
"def",
"get_one_parameter",
"(",
"self",
",",
"regex_exp",
",",
"parameters",
")",
":",
"Rx",
",",
"other",
"=",
"self",
".",
"get_parameters",
"(",
"regex_exp",
",",
"parameters",
")",
"if",
"other",
"is",
"not",
"None",
"and",
"other",
".",
"strip",
"(... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | _Meta.get_two_parameters | Get two parameters from a given regex expression
Raise an exception if more than two were found
:param regex_exp:
:param parameters:
:return: | iarm/arm_instructions/_meta.py | def get_two_parameters(self, regex_exp, parameters):
"""
Get two parameters from a given regex expression
Raise an exception if more than two were found
:param regex_exp:
:param parameters:
:return:
"""
Rx, Ry, other = self.get_parameters(regex_exp, param... | def get_two_parameters(self, regex_exp, parameters):
"""
Get two parameters from a given regex expression
Raise an exception if more than two were found
:param regex_exp:
:param parameters:
:return:
"""
Rx, Ry, other = self.get_parameters(regex_exp, param... | [
"Get",
"two",
"parameters",
"from",
"a",
"given",
"regex",
"expression"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/_meta.py#L273-L290 | [
"def",
"get_two_parameters",
"(",
"self",
",",
"regex_exp",
",",
"parameters",
")",
":",
"Rx",
",",
"Ry",
",",
"other",
"=",
"self",
".",
"get_parameters",
"(",
"regex_exp",
",",
"parameters",
")",
"if",
"other",
"is",
"not",
"None",
"and",
"other",
".",... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | _Meta.get_three_parameters | Get three parameters from a given regex expression
Raise an exception if more than three were found
:param regex_exp:
:param parameters:
:return: | iarm/arm_instructions/_meta.py | def get_three_parameters(self, regex_exp, parameters):
"""
Get three parameters from a given regex expression
Raise an exception if more than three were found
:param regex_exp:
:param parameters:
:return:
"""
Rx, Ry, Rz, other = self.get_parameters(regex_... | def get_three_parameters(self, regex_exp, parameters):
"""
Get three parameters from a given regex expression
Raise an exception if more than three were found
:param regex_exp:
:param parameters:
:return:
"""
Rx, Ry, Rz, other = self.get_parameters(regex_... | [
"Get",
"three",
"parameters",
"from",
"a",
"given",
"regex",
"expression"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/_meta.py#L292-L304 | [
"def",
"get_three_parameters",
"(",
"self",
",",
"regex_exp",
",",
"parameters",
")",
":",
"Rx",
",",
"Ry",
",",
"Rz",
",",
"other",
"=",
"self",
".",
"get_parameters",
"(",
"regex_exp",
",",
"parameters",
")",
"if",
"other",
"is",
"not",
"None",
"and",
... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | _Meta.set_APSR_flag_to_value | Set or clear flag in ASPR
:param flag: The flag to set
:param value: If value evaulates to true, it is set, cleared otherwise
:return: | iarm/arm_instructions/_meta.py | def set_APSR_flag_to_value(self, flag, value):
"""
Set or clear flag in ASPR
:param flag: The flag to set
:param value: If value evaulates to true, it is set, cleared otherwise
:return:
"""
if flag == 'N':
bit = 31
elif flag == 'Z':
... | def set_APSR_flag_to_value(self, flag, value):
"""
Set or clear flag in ASPR
:param flag: The flag to set
:param value: If value evaulates to true, it is set, cleared otherwise
:return:
"""
if flag == 'N':
bit = 31
elif flag == 'Z':
... | [
"Set",
"or",
"clear",
"flag",
"in",
"ASPR",
":",
"param",
"flag",
":",
"The",
"flag",
"to",
"set",
":",
"param",
"value",
":",
"If",
"value",
"evaulates",
"to",
"true",
"it",
"is",
"set",
"cleared",
"otherwise",
":",
"return",
":"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/_meta.py#L306-L327 | [
"def",
"set_APSR_flag_to_value",
"(",
"self",
",",
"flag",
",",
"value",
")",
":",
"if",
"flag",
"==",
"'N'",
":",
"bit",
"=",
"31",
"elif",
"flag",
"==",
"'Z'",
":",
"bit",
"=",
"30",
"elif",
"flag",
"==",
"'C'",
":",
"bit",
"=",
"29",
"elif",
"... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | _Meta.rule_special_registers | Raises an exception if the register is not a special register | iarm/arm_instructions/_meta.py | def rule_special_registers(self, arg):
"""Raises an exception if the register is not a special register"""
# TODO is PSR supposed to be here?
special_registers = "PSR APSR IPSR EPSR PRIMASK FAULTMASK BASEPRI CONTROL"
if arg not in special_registers.split():
raise iarm.excepti... | def rule_special_registers(self, arg):
"""Raises an exception if the register is not a special register"""
# TODO is PSR supposed to be here?
special_registers = "PSR APSR IPSR EPSR PRIMASK FAULTMASK BASEPRI CONTROL"
if arg not in special_registers.split():
raise iarm.excepti... | [
"Raises",
"an",
"exception",
"if",
"the",
"register",
"is",
"not",
"a",
"special",
"register"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/_meta.py#L329-L334 | [
"def",
"rule_special_registers",
"(",
"self",
",",
"arg",
")",
":",
"# TODO is PSR supposed to be here?",
"special_registers",
"=",
"\"PSR APSR IPSR EPSR PRIMASK FAULTMASK BASEPRI CONTROL\"",
"if",
"arg",
"not",
"in",
"special_registers",
".",
"split",
"(",
")",
":",
"rai... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | _Meta.set_C_flag | Set C flag
C flag is set if the unsigned number overflows
This condition is obtained if:
1. In addition, the result is smaller than either of the operands
2. In subtraction, if the second operand is larger than the first
This should not be used for shifting as each shift will ne... | iarm/arm_instructions/_meta.py | def set_C_flag(self, oper_1, oper_2, result, type):
"""
Set C flag
C flag is set if the unsigned number overflows
This condition is obtained if:
1. In addition, the result is smaller than either of the operands
2. In subtraction, if the second operand is larger than the f... | def set_C_flag(self, oper_1, oper_2, result, type):
"""
Set C flag
C flag is set if the unsigned number overflows
This condition is obtained if:
1. In addition, the result is smaller than either of the operands
2. In subtraction, if the second operand is larger than the f... | [
"Set",
"C",
"flag",
"C",
"flag",
"is",
"set",
"if",
"the",
"unsigned",
"number",
"overflows",
"This",
"condition",
"is",
"obtained",
"if",
":",
"1",
".",
"In",
"addition",
"the",
"result",
"is",
"smaller",
"than",
"either",
"of",
"the",
"operands",
"2",
... | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/_meta.py#L352-L381 | [
"def",
"set_C_flag",
"(",
"self",
",",
"oper_1",
",",
"oper_2",
",",
"result",
",",
"type",
")",
":",
"# TODO is this correct?",
"if",
"type",
"==",
"'add'",
":",
"if",
"result",
"<",
"oper_1",
":",
"self",
".",
"set_APSR_flag_to_value",
"(",
"'C'",
",",
... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | version | Output version of gcdt tools and plugins. | gcdt/utils.py | def version():
"""Output version of gcdt tools and plugins."""
log.info('gcdt version %s' % __version__)
tools = get_plugin_versions('gcdttool10')
if tools:
log.info('gcdt tools:')
for p, v in tools.items():
log.info(' * %s version %s' % (p, v))
log.info('gcdt plugins:')
... | def version():
"""Output version of gcdt tools and plugins."""
log.info('gcdt version %s' % __version__)
tools = get_plugin_versions('gcdttool10')
if tools:
log.info('gcdt tools:')
for p, v in tools.items():
log.info(' * %s version %s' % (p, v))
log.info('gcdt plugins:')
... | [
"Output",
"version",
"of",
"gcdt",
"tools",
"and",
"plugins",
"."
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/utils.py#L32-L47 | [
"def",
"version",
"(",
")",
":",
"log",
".",
"info",
"(",
"'gcdt version %s'",
"%",
"__version__",
")",
"tools",
"=",
"get_plugin_versions",
"(",
"'gcdttool10'",
")",
"if",
"tools",
":",
"log",
".",
"info",
"(",
"'gcdt tools:'",
")",
"for",
"p",
",",
"v"... | cd67cf416371337b83cb9ca3f696277125703339 |
train | retries | Function decorator implementing retrying logic.
delay: Sleep this many seconds * backoff * try number after failure
backoff: Multiply delay by this factor after each failure
exceptions: A tuple of exception classes; default (Exception,)
hook: A function with the signature: (tries_remaining, exception, ... | gcdt/utils.py | def retries(max_tries, delay=1, backoff=2, exceptions=(Exception,), hook=None):
"""Function decorator implementing retrying logic.
delay: Sleep this many seconds * backoff * try number after failure
backoff: Multiply delay by this factor after each failure
exceptions: A tuple of exception classes; defa... | def retries(max_tries, delay=1, backoff=2, exceptions=(Exception,), hook=None):
"""Function decorator implementing retrying logic.
delay: Sleep this many seconds * backoff * try number after failure
backoff: Multiply delay by this factor after each failure
exceptions: A tuple of exception classes; defa... | [
"Function",
"decorator",
"implementing",
"retrying",
"logic",
"."
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/utils.py#L50-L102 | [
"def",
"retries",
"(",
"max_tries",
",",
"delay",
"=",
"1",
",",
"backoff",
"=",
"2",
",",
"exceptions",
"=",
"(",
"Exception",
",",
")",
",",
"hook",
"=",
"None",
")",
":",
"\"\"\"\n def example_hook(tries_remaining, exception, delay):\n '''Example except... | cd67cf416371337b83cb9ca3f696277125703339 |
train | get_env | Read environment from ENV and mangle it to a (lower case) representation
Note: gcdt.utils get_env() is used in many cloudformation.py templates
:return: Environment as lower case string (or None if not matched) | gcdt/utils.py | def get_env():
"""
Read environment from ENV and mangle it to a (lower case) representation
Note: gcdt.utils get_env() is used in many cloudformation.py templates
:return: Environment as lower case string (or None if not matched)
"""
env = os.getenv('ENV', os.getenv('env', None))
if env:
... | def get_env():
"""
Read environment from ENV and mangle it to a (lower case) representation
Note: gcdt.utils get_env() is used in many cloudformation.py templates
:return: Environment as lower case string (or None if not matched)
"""
env = os.getenv('ENV', os.getenv('env', None))
if env:
... | [
"Read",
"environment",
"from",
"ENV",
"and",
"mangle",
"it",
"to",
"a",
"(",
"lower",
"case",
")",
"representation",
"Note",
":",
"gcdt",
".",
"utils",
"get_env",
"()",
"is",
"used",
"in",
"many",
"cloudformation",
".",
"py",
"templates",
":",
"return",
... | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/utils.py#L109-L118 | [
"def",
"get_env",
"(",
")",
":",
"env",
"=",
"os",
".",
"getenv",
"(",
"'ENV'",
",",
"os",
".",
"getenv",
"(",
"'env'",
",",
"None",
")",
")",
"if",
"env",
":",
"env",
"=",
"env",
".",
"lower",
"(",
")",
"return",
"env"
] | cd67cf416371337b83cb9ca3f696277125703339 |
train | get_context | This assembles the tool context. Private members are preceded by a '_'.
:param tool:
:param command:
:return: dictionary containing the gcdt tool context | gcdt/utils.py | def get_context(awsclient, env, tool, command, arguments=None):
"""This assembles the tool context. Private members are preceded by a '_'.
:param tool:
:param command:
:return: dictionary containing the gcdt tool context
"""
# TODO: elapsed, artifact(stack, depl-grp, lambda, api)
if argumen... | def get_context(awsclient, env, tool, command, arguments=None):
"""This assembles the tool context. Private members are preceded by a '_'.
:param tool:
:param command:
:return: dictionary containing the gcdt tool context
"""
# TODO: elapsed, artifact(stack, depl-grp, lambda, api)
if argumen... | [
"This",
"assembles",
"the",
"tool",
"context",
".",
"Private",
"members",
"are",
"preceded",
"by",
"a",
"_",
"."
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/utils.py#L121-L142 | [
"def",
"get_context",
"(",
"awsclient",
",",
"env",
",",
"tool",
",",
"command",
",",
"arguments",
"=",
"None",
")",
":",
"# TODO: elapsed, artifact(stack, depl-grp, lambda, api)",
"if",
"arguments",
"is",
"None",
":",
"arguments",
"=",
"{",
"}",
"context",
"=",... | cd67cf416371337b83cb9ca3f696277125703339 |
train | get_command | Extract the first argument from arguments parsed by docopt.
:param arguments parsed by docopt:
:return: command | gcdt/utils.py | def get_command(arguments):
"""Extract the first argument from arguments parsed by docopt.
:param arguments parsed by docopt:
:return: command
"""
return [k for k, v in arguments.items()
if not k.startswith('-') and v is True][0] | def get_command(arguments):
"""Extract the first argument from arguments parsed by docopt.
:param arguments parsed by docopt:
:return: command
"""
return [k for k, v in arguments.items()
if not k.startswith('-') and v is True][0] | [
"Extract",
"the",
"first",
"argument",
"from",
"arguments",
"parsed",
"by",
"docopt",
"."
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/utils.py#L145-L152 | [
"def",
"get_command",
"(",
"arguments",
")",
":",
"return",
"[",
"k",
"for",
"k",
",",
"v",
"in",
"arguments",
".",
"items",
"(",
")",
"if",
"not",
"k",
".",
"startswith",
"(",
"'-'",
")",
"and",
"v",
"is",
"True",
"]",
"[",
"0",
"]"
] | cd67cf416371337b83cb9ca3f696277125703339 |
train | check_gcdt_update | Check whether a newer gcdt is available and output a warning. | gcdt/utils.py | def check_gcdt_update():
"""Check whether a newer gcdt is available and output a warning.
"""
try:
inst_version, latest_version = get_package_versions('gcdt')
if inst_version < latest_version:
log.warn('Please consider an update to gcdt version: %s' %
... | def check_gcdt_update():
"""Check whether a newer gcdt is available and output a warning.
"""
try:
inst_version, latest_version = get_package_versions('gcdt')
if inst_version < latest_version:
log.warn('Please consider an update to gcdt version: %s' %
... | [
"Check",
"whether",
"a",
"newer",
"gcdt",
"is",
"available",
"and",
"output",
"a",
"warning",
"."
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/utils.py#L173-L185 | [
"def",
"check_gcdt_update",
"(",
")",
":",
"try",
":",
"inst_version",
",",
"latest_version",
"=",
"get_package_versions",
"(",
"'gcdt'",
")",
"if",
"inst_version",
"<",
"latest_version",
":",
"log",
".",
"warn",
"(",
"'Please consider an update to gcdt version: %s'",... | cd67cf416371337b83cb9ca3f696277125703339 |
train | dict_selective_merge | Conditionally merges b into a if b's keys are contained in selection
:param a:
:param b:
:param selection: limit merge to these top-level keys
:param path:
:return: | gcdt/utils.py | def dict_selective_merge(a, b, selection, path=None):
"""Conditionally merges b into a if b's keys are contained in selection
:param a:
:param b:
:param selection: limit merge to these top-level keys
:param path:
:return:
"""
if path is None:
path = []
for key in b:
... | def dict_selective_merge(a, b, selection, path=None):
"""Conditionally merges b into a if b's keys are contained in selection
:param a:
:param b:
:param selection: limit merge to these top-level keys
:param path:
:return:
"""
if path is None:
path = []
for key in b:
... | [
"Conditionally",
"merges",
"b",
"into",
"a",
"if",
"b",
"s",
"keys",
"are",
"contained",
"in",
"selection"
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/utils.py#L190-L211 | [
"def",
"dict_selective_merge",
"(",
"a",
",",
"b",
",",
"selection",
",",
"path",
"=",
"None",
")",
":",
"if",
"path",
"is",
"None",
":",
"path",
"=",
"[",
"]",
"for",
"key",
"in",
"b",
":",
"if",
"key",
"in",
"selection",
":",
"if",
"key",
"in",... | cd67cf416371337b83cb9ca3f696277125703339 |
train | dict_merge | merges b into a | gcdt/utils.py | def dict_merge(a, b, path=None):
"""merges b into a"""
return dict_selective_merge(a, b, b.keys(), path) | def dict_merge(a, b, path=None):
"""merges b into a"""
return dict_selective_merge(a, b, b.keys(), path) | [
"merges",
"b",
"into",
"a"
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/utils.py#L214-L216 | [
"def",
"dict_merge",
"(",
"a",
",",
"b",
",",
"path",
"=",
"None",
")",
":",
"return",
"dict_selective_merge",
"(",
"a",
",",
"b",
",",
"b",
".",
"keys",
"(",
")",
",",
"path",
")"
] | cd67cf416371337b83cb9ca3f696277125703339 |
train | are_credentials_still_valid | Check whether the credentials have expired.
:param awsclient:
:return: exit_code | gcdt/utils.py | def are_credentials_still_valid(awsclient):
"""Check whether the credentials have expired.
:param awsclient:
:return: exit_code
"""
client = awsclient.get_client('lambda')
try:
client.list_functions()
except GracefulExit:
raise
except Exception as e:
log.debug(e)... | def are_credentials_still_valid(awsclient):
"""Check whether the credentials have expired.
:param awsclient:
:return: exit_code
"""
client = awsclient.get_client('lambda')
try:
client.list_functions()
except GracefulExit:
raise
except Exception as e:
log.debug(e)... | [
"Check",
"whether",
"the",
"credentials",
"have",
"expired",
"."
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/utils.py#L222-L237 | [
"def",
"are_credentials_still_valid",
"(",
"awsclient",
")",
":",
"client",
"=",
"awsclient",
".",
"get_client",
"(",
"'lambda'",
")",
"try",
":",
"client",
".",
"list_functions",
"(",
")",
"except",
"GracefulExit",
":",
"raise",
"except",
"Exception",
"as",
"... | cd67cf416371337b83cb9ca3f696277125703339 |
train | flatten | Given a list, possibly nested to any level, return it flattened. | gcdt/utils.py | def flatten(lis):
"""Given a list, possibly nested to any level, return it flattened."""
new_lis = []
for item in lis:
if isinstance(item, collections.Sequence) and not isinstance(item, basestring):
new_lis.extend(flatten(item))
else:
new_lis.append(item)
return n... | def flatten(lis):
"""Given a list, possibly nested to any level, return it flattened."""
new_lis = []
for item in lis:
if isinstance(item, collections.Sequence) and not isinstance(item, basestring):
new_lis.extend(flatten(item))
else:
new_lis.append(item)
return n... | [
"Given",
"a",
"list",
"possibly",
"nested",
"to",
"any",
"level",
"return",
"it",
"flattened",
"."
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/utils.py#L241-L249 | [
"def",
"flatten",
"(",
"lis",
")",
":",
"new_lis",
"=",
"[",
"]",
"for",
"item",
"in",
"lis",
":",
"if",
"isinstance",
"(",
"item",
",",
"collections",
".",
"Sequence",
")",
"and",
"not",
"isinstance",
"(",
"item",
",",
"basestring",
")",
":",
"new_l... | cd67cf416371337b83cb9ca3f696277125703339 |
train | signal_handler | handle signals.
example: 'signal.signal(signal.SIGTERM, signal_handler)' | gcdt/utils.py | def signal_handler(signum, frame):
"""
handle signals.
example: 'signal.signal(signal.SIGTERM, signal_handler)'
"""
# signals are CONSTANTS so there is no mapping from signum to description
# so please add to the mapping in case you use more signals!
description = '%d' % signum
if signum... | def signal_handler(signum, frame):
"""
handle signals.
example: 'signal.signal(signal.SIGTERM, signal_handler)'
"""
# signals are CONSTANTS so there is no mapping from signum to description
# so please add to the mapping in case you use more signals!
description = '%d' % signum
if signum... | [
"handle",
"signals",
".",
"example",
":",
"signal",
".",
"signal",
"(",
"signal",
".",
"SIGTERM",
"signal_handler",
")"
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/utils.py#L260-L272 | [
"def",
"signal_handler",
"(",
"signum",
",",
"frame",
")",
":",
"# signals are CONSTANTS so there is no mapping from signum to description",
"# so please add to the mapping in case you use more signals!",
"description",
"=",
"'%d'",
"%",
"signum",
"if",
"signum",
"==",
"2",
":"... | cd67cf416371337b83cb9ca3f696277125703339 |
train | json2table | This does format a dictionary into a table.
Note this expects a dictionary (not a json string!)
:param json:
:return: | gcdt/utils.py | def json2table(json):
"""This does format a dictionary into a table.
Note this expects a dictionary (not a json string!)
:param json:
:return:
"""
filter_terms = ['ResponseMetadata']
table = []
try:
for k in filter(lambda k: k not in filter_terms, json.keys()):
table... | def json2table(json):
"""This does format a dictionary into a table.
Note this expects a dictionary (not a json string!)
:param json:
:return:
"""
filter_terms = ['ResponseMetadata']
table = []
try:
for k in filter(lambda k: k not in filter_terms, json.keys()):
table... | [
"This",
"does",
"format",
"a",
"dictionary",
"into",
"a",
"table",
".",
"Note",
"this",
"expects",
"a",
"dictionary",
"(",
"not",
"a",
"json",
"string!",
")"
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/utils.py#L275-L293 | [
"def",
"json2table",
"(",
"json",
")",
":",
"filter_terms",
"=",
"[",
"'ResponseMetadata'",
"]",
"table",
"=",
"[",
"]",
"try",
":",
"for",
"k",
"in",
"filter",
"(",
"lambda",
"k",
":",
"k",
"not",
"in",
"filter_terms",
",",
"json",
".",
"keys",
"(",... | cd67cf416371337b83cb9ca3f696277125703339 |
train | random_string | Create a random 6 character string.
note: in case you use this function in a test during test together with
an awsclient then this function is altered so you get reproducible results
that will work with your recorded placebo json files (see helpers_aws.py). | gcdt/utils.py | def random_string(length=6):
"""Create a random 6 character string.
note: in case you use this function in a test during test together with
an awsclient then this function is altered so you get reproducible results
that will work with your recorded placebo json files (see helpers_aws.py).
"""
r... | def random_string(length=6):
"""Create a random 6 character string.
note: in case you use this function in a test during test together with
an awsclient then this function is altered so you get reproducible results
that will work with your recorded placebo json files (see helpers_aws.py).
"""
r... | [
"Create",
"a",
"random",
"6",
"character",
"string",
"."
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/utils.py#L316-L323 | [
"def",
"random_string",
"(",
"length",
"=",
"6",
")",
":",
"return",
"''",
".",
"join",
"(",
"[",
"random",
".",
"choice",
"(",
"string",
".",
"ascii_lowercase",
")",
"for",
"i",
"in",
"range",
"(",
"length",
")",
"]",
")"
] | cd67cf416371337b83cb9ca3f696277125703339 |
train | all_pages | Helper to process all pages using botocore service methods (exhausts NextToken).
note: `cond` is optional... you can use it to make filtering more explicit
if you like. Alternatively you can do the filtering in the `accessor` which
is perfectly fine, too
Note: lambda uses a slightly different mechanism ... | gcdt/utils.py | def all_pages(method, request, accessor, cond=None):
"""Helper to process all pages using botocore service methods (exhausts NextToken).
note: `cond` is optional... you can use it to make filtering more explicit
if you like. Alternatively you can do the filtering in the `accessor` which
is perfectly fin... | def all_pages(method, request, accessor, cond=None):
"""Helper to process all pages using botocore service methods (exhausts NextToken).
note: `cond` is optional... you can use it to make filtering more explicit
if you like. Alternatively you can do the filtering in the `accessor` which
is perfectly fin... | [
"Helper",
"to",
"process",
"all",
"pages",
"using",
"botocore",
"service",
"methods",
"(",
"exhausts",
"NextToken",
")",
".",
"note",
":",
"cond",
"is",
"optional",
"...",
"you",
"can",
"use",
"it",
"to",
"make",
"filtering",
"more",
"explicit",
"if",
"you... | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/utils.py#L336-L369 | [
"def",
"all_pages",
"(",
"method",
",",
"request",
",",
"accessor",
",",
"cond",
"=",
"None",
")",
":",
"if",
"cond",
"is",
"None",
":",
"cond",
"=",
"lambda",
"x",
":",
"True",
"result",
"=",
"[",
"]",
"next_token",
"=",
"None",
"while",
"True",
"... | cd67cf416371337b83cb9ca3f696277125703339 |
train | get_invoke | Get the Cmd main method from the click command
:param command: The click Command object
:return: the do_* method for Cmd
:rtype: function | click_shell/core.py | def get_invoke(command):
"""
Get the Cmd main method from the click command
:param command: The click Command object
:return: the do_* method for Cmd
:rtype: function
"""
assert isinstance(command, click.Command)
def invoke_(self, arg): # pylint: disable=unused-argument
try:
... | def get_invoke(command):
"""
Get the Cmd main method from the click command
:param command: The click Command object
:return: the do_* method for Cmd
:rtype: function
"""
assert isinstance(command, click.Command)
def invoke_(self, arg): # pylint: disable=unused-argument
try:
... | [
"Get",
"the",
"Cmd",
"main",
"method",
"from",
"the",
"click",
"command",
":",
"param",
"command",
":",
"The",
"click",
"Command",
"object",
":",
"return",
":",
"the",
"do_",
"*",
"method",
"for",
"Cmd",
":",
"rtype",
":",
"function"
] | clarkperkins/click-shell | python | https://github.com/clarkperkins/click-shell/blob/8d6e1a492176bc79e029d714f19d3156409656ea/click_shell/core.py#L21-L56 | [
"def",
"get_invoke",
"(",
"command",
")",
":",
"assert",
"isinstance",
"(",
"command",
",",
"click",
".",
"Command",
")",
"def",
"invoke_",
"(",
"self",
",",
"arg",
")",
":",
"# pylint: disable=unused-argument",
"try",
":",
"command",
".",
"main",
"(",
"ar... | 8d6e1a492176bc79e029d714f19d3156409656ea |
train | get_help | Get the Cmd help function from the click command
:param command: The click Command object
:return: the help_* method for Cmd
:rtype: function | click_shell/core.py | def get_help(command):
"""
Get the Cmd help function from the click command
:param command: The click Command object
:return: the help_* method for Cmd
:rtype: function
"""
assert isinstance(command, click.Command)
def help_(self): # pylint: disable=unused-argument
extra = {}
... | def get_help(command):
"""
Get the Cmd help function from the click command
:param command: The click Command object
:return: the help_* method for Cmd
:rtype: function
"""
assert isinstance(command, click.Command)
def help_(self): # pylint: disable=unused-argument
extra = {}
... | [
"Get",
"the",
"Cmd",
"help",
"function",
"from",
"the",
"click",
"command",
":",
"param",
"command",
":",
"The",
"click",
"Command",
"object",
":",
"return",
":",
"the",
"help_",
"*",
"method",
"for",
"Cmd",
":",
"rtype",
":",
"function"
] | clarkperkins/click-shell | python | https://github.com/clarkperkins/click-shell/blob/8d6e1a492176bc79e029d714f19d3156409656ea/click_shell/core.py#L59-L79 | [
"def",
"get_help",
"(",
"command",
")",
":",
"assert",
"isinstance",
"(",
"command",
",",
"click",
".",
"Command",
")",
"def",
"help_",
"(",
"self",
")",
":",
"# pylint: disable=unused-argument",
"extra",
"=",
"{",
"}",
"for",
"key",
",",
"value",
"in",
... | 8d6e1a492176bc79e029d714f19d3156409656ea |
train | get_complete | Get the Cmd complete function for the click command
:param command: The click Command object
:return: the complete_* method for Cmd
:rtype: function | click_shell/core.py | def get_complete(command):
"""
Get the Cmd complete function for the click command
:param command: The click Command object
:return: the complete_* method for Cmd
:rtype: function
"""
assert isinstance(command, click.Command)
def complete_(self, text, line, begidx, endidx): # pylint: ... | def get_complete(command):
"""
Get the Cmd complete function for the click command
:param command: The click Command object
:return: the complete_* method for Cmd
:rtype: function
"""
assert isinstance(command, click.Command)
def complete_(self, text, line, begidx, endidx): # pylint: ... | [
"Get",
"the",
"Cmd",
"complete",
"function",
"for",
"the",
"click",
"command",
":",
"param",
"command",
":",
"The",
"click",
"Command",
"object",
":",
"return",
":",
"the",
"complete_",
"*",
"method",
"for",
"Cmd",
":",
"rtype",
":",
"function"
] | clarkperkins/click-shell | python | https://github.com/clarkperkins/click-shell/blob/8d6e1a492176bc79e029d714f19d3156409656ea/click_shell/core.py#L82-L102 | [
"def",
"get_complete",
"(",
"command",
")",
":",
"assert",
"isinstance",
"(",
"command",
",",
"click",
".",
"Command",
")",
"def",
"complete_",
"(",
"self",
",",
"text",
",",
"line",
",",
"begidx",
",",
"endidx",
")",
":",
"# pylint: disable=unused-argument"... | 8d6e1a492176bc79e029d714f19d3156409656ea |
train | load_template | Bail out if template is not found. | gcdt/kumo_main.py | def load_template():
"""Bail out if template is not found.
"""
cloudformation, found = load_cloudformation_template()
if not found:
print(colored.red('could not load cloudformation.py, bailing out...'))
sys.exit(1)
return cloudformation | def load_template():
"""Bail out if template is not found.
"""
cloudformation, found = load_cloudformation_template()
if not found:
print(colored.red('could not load cloudformation.py, bailing out...'))
sys.exit(1)
return cloudformation | [
"Bail",
"out",
"if",
"template",
"is",
"not",
"found",
"."
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/kumo_main.py#L49-L56 | [
"def",
"load_template",
"(",
")",
":",
"cloudformation",
",",
"found",
"=",
"load_cloudformation_template",
"(",
")",
"if",
"not",
"found",
":",
"print",
"(",
"colored",
".",
"red",
"(",
"'could not load cloudformation.py, bailing out...'",
")",
")",
"sys",
".",
... | cd67cf416371337b83cb9ca3f696277125703339 |
train | _import_public_names | Import public names from module into this module, like import * | nefertari/engine.py | def _import_public_names(module):
"Import public names from module into this module, like import *"
self = sys.modules[__name__]
for name in module.__all__:
if hasattr(self, name):
# don't overwrite existing names
continue
setattr(self, name, getattr(module, name)) | def _import_public_names(module):
"Import public names from module into this module, like import *"
self = sys.modules[__name__]
for name in module.__all__:
if hasattr(self, name):
# don't overwrite existing names
continue
setattr(self, name, getattr(module, name)) | [
"Import",
"public",
"names",
"from",
"module",
"into",
"this",
"module",
"like",
"import",
"*"
] | ramses-tech/nefertari | python | https://github.com/ramses-tech/nefertari/blob/c7caffe11576c11aa111adbdbadeff70ce66b1dd/nefertari/engine.py#L59-L66 | [
"def",
"_import_public_names",
"(",
"module",
")",
":",
"self",
"=",
"sys",
".",
"modules",
"[",
"__name__",
"]",
"for",
"name",
"in",
"module",
".",
"__all__",
":",
"if",
"hasattr",
"(",
"self",
",",
"name",
")",
":",
"# don't overwrite existing names",
"... | c7caffe11576c11aa111adbdbadeff70ce66b1dd |
train | create_argument_parser | Creates the argument parser for haas. | haas/haas_application.py | def create_argument_parser():
"""Creates the argument parser for haas.
"""
parser = argparse.ArgumentParser(prog='haas')
parser.add_argument('--version', action='version',
version='%(prog)s {0}'.format(haas.__version__))
verbosity = parser.add_mutually_exclusive_group()
... | def create_argument_parser():
"""Creates the argument parser for haas.
"""
parser = argparse.ArgumentParser(prog='haas')
parser.add_argument('--version', action='version',
version='%(prog)s {0}'.format(haas.__version__))
verbosity = parser.add_mutually_exclusive_group()
... | [
"Creates",
"the",
"argument",
"parser",
"for",
"haas",
"."
] | scalative/haas | python | https://github.com/scalative/haas/blob/72c05216a2a80e5ee94d9cd8d05ed2b188725027/haas/haas_application.py#L20-L50 | [
"def",
"create_argument_parser",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"prog",
"=",
"'haas'",
")",
"parser",
".",
"add_argument",
"(",
"'--version'",
",",
"action",
"=",
"'version'",
",",
"version",
"=",
"'%(prog)s {0}'",
".",
... | 72c05216a2a80e5ee94d9cd8d05ed2b188725027 |
train | HaasApplication.run | Run the haas test runner.
This will load and configure the selected plugins, set up the
environment and begin test discovery, loading and running.
Parameters
----------
plugin_manager : haas.plugin_manager.PluginManager
[Optional] Override the use of the default plu... | haas/haas_application.py | def run(self, plugin_manager=None):
"""Run the haas test runner.
This will load and configure the selected plugins, set up the
environment and begin test discovery, loading and running.
Parameters
----------
plugin_manager : haas.plugin_manager.PluginManager
... | def run(self, plugin_manager=None):
"""Run the haas test runner.
This will load and configure the selected plugins, set up the
environment and begin test discovery, loading and running.
Parameters
----------
plugin_manager : haas.plugin_manager.PluginManager
... | [
"Run",
"the",
"haas",
"test",
"runner",
"."
] | scalative/haas | python | https://github.com/scalative/haas/blob/72c05216a2a80e5ee94d9cd8d05ed2b188725027/haas/haas_application.py#L83-L133 | [
"def",
"run",
"(",
"self",
",",
"plugin_manager",
"=",
"None",
")",
":",
"if",
"plugin_manager",
"is",
"None",
":",
"plugin_manager",
"=",
"PluginManager",
"(",
")",
"plugin_manager",
".",
"add_plugin_arguments",
"(",
"self",
".",
"parser",
")",
"args",
"=",... | 72c05216a2a80e5ee94d9cd8d05ed2b188725027 |
train | encrypt_password | Crypt :new_value: if it's not crypted yet. | nefertari/authentication/models.py | def encrypt_password(**kwargs):
""" Crypt :new_value: if it's not crypted yet. """
new_value = kwargs['new_value']
field = kwargs['field']
min_length = field.params['min_length']
if len(new_value) < min_length:
raise ValueError(
'`{}`: Value length must be more than {}'.format(
... | def encrypt_password(**kwargs):
""" Crypt :new_value: if it's not crypted yet. """
new_value = kwargs['new_value']
field = kwargs['field']
min_length = field.params['min_length']
if len(new_value) < min_length:
raise ValueError(
'`{}`: Value length must be more than {}'.format(
... | [
"Crypt",
":",
"new_value",
":",
"if",
"it",
"s",
"not",
"crypted",
"yet",
"."
] | ramses-tech/nefertari | python | https://github.com/ramses-tech/nefertari/blob/c7caffe11576c11aa111adbdbadeff70ce66b1dd/nefertari/authentication/models.py#L159-L171 | [
"def",
"encrypt_password",
"(",
"*",
"*",
"kwargs",
")",
":",
"new_value",
"=",
"kwargs",
"[",
"'new_value'",
"]",
"field",
"=",
"kwargs",
"[",
"'field'",
"]",
"min_length",
"=",
"field",
".",
"params",
"[",
"'min_length'",
"]",
"if",
"len",
"(",
"new_va... | c7caffe11576c11aa111adbdbadeff70ce66b1dd |
train | create_apikey_model | Generate ApiKey model class and connect it with :user_model:.
ApiKey is generated with relationship to user model class :user_model:
as a One-to-One relationship with a backreference.
ApiKey is set up to be auto-generated when a new :user_model: is created.
Returns ApiKey document class. If ApiKey is ... | nefertari/authentication/models.py | def create_apikey_model(user_model):
""" Generate ApiKey model class and connect it with :user_model:.
ApiKey is generated with relationship to user model class :user_model:
as a One-to-One relationship with a backreference.
ApiKey is set up to be auto-generated when a new :user_model: is created.
... | def create_apikey_model(user_model):
""" Generate ApiKey model class and connect it with :user_model:.
ApiKey is generated with relationship to user model class :user_model:
as a One-to-One relationship with a backreference.
ApiKey is set up to be auto-generated when a new :user_model: is created.
... | [
"Generate",
"ApiKey",
"model",
"class",
"and",
"connect",
"it",
"with",
":",
"user_model",
":",
"."
] | ramses-tech/nefertari | python | https://github.com/ramses-tech/nefertari/blob/c7caffe11576c11aa111adbdbadeff70ce66b1dd/nefertari/authentication/models.py#L195-L243 | [
"def",
"create_apikey_model",
"(",
"user_model",
")",
":",
"try",
":",
"return",
"engine",
".",
"get_document_cls",
"(",
"'ApiKey'",
")",
"except",
"ValueError",
":",
"pass",
"fk_kwargs",
"=",
"{",
"'ref_column'",
":",
"None",
",",
"}",
"if",
"hasattr",
"(",... | c7caffe11576c11aa111adbdbadeff70ce66b1dd |
train | cache_request_user | Helper function to cache currently logged in user.
User is cached at `request._user`. Caching happens only only
if user is not already cached or if cached user's pk does not
match `user_id`.
:param user_cls: User model class to use for user lookup.
:param request: Pyramid Request instance.
:us... | nefertari/authentication/models.py | def cache_request_user(user_cls, request, user_id):
""" Helper function to cache currently logged in user.
User is cached at `request._user`. Caching happens only only
if user is not already cached or if cached user's pk does not
match `user_id`.
:param user_cls: User model class to use for user l... | def cache_request_user(user_cls, request, user_id):
""" Helper function to cache currently logged in user.
User is cached at `request._user`. Caching happens only only
if user is not already cached or if cached user's pk does not
match `user_id`.
:param user_cls: User model class to use for user l... | [
"Helper",
"function",
"to",
"cache",
"currently",
"logged",
"in",
"user",
"."
] | ramses-tech/nefertari | python | https://github.com/ramses-tech/nefertari/blob/c7caffe11576c11aa111adbdbadeff70ce66b1dd/nefertari/authentication/models.py#L246-L260 | [
"def",
"cache_request_user",
"(",
"user_cls",
",",
"request",
",",
"user_id",
")",
":",
"pk_field",
"=",
"user_cls",
".",
"pk_field",
"(",
")",
"user",
"=",
"getattr",
"(",
"request",
",",
"'_user'",
",",
"None",
")",
"if",
"user",
"is",
"None",
"or",
... | c7caffe11576c11aa111adbdbadeff70ce66b1dd |
train | AuthModelMethodsMixin.get_token_credentials | Get api token for user with username of :username:
Used by Token-based auth as `credentials_callback` kwarg. | nefertari/authentication/models.py | def get_token_credentials(cls, username, request):
""" Get api token for user with username of :username:
Used by Token-based auth as `credentials_callback` kwarg.
"""
try:
user = cls.get_item(username=username)
except Exception as ex:
log.error(str(ex))
... | def get_token_credentials(cls, username, request):
""" Get api token for user with username of :username:
Used by Token-based auth as `credentials_callback` kwarg.
"""
try:
user = cls.get_item(username=username)
except Exception as ex:
log.error(str(ex))
... | [
"Get",
"api",
"token",
"for",
"user",
"with",
"username",
"of",
":",
"username",
":"
] | ramses-tech/nefertari | python | https://github.com/ramses-tech/nefertari/blob/c7caffe11576c11aa111adbdbadeff70ce66b1dd/nefertari/authentication/models.py#L42-L54 | [
"def",
"get_token_credentials",
"(",
"cls",
",",
"username",
",",
"request",
")",
":",
"try",
":",
"user",
"=",
"cls",
".",
"get_item",
"(",
"username",
"=",
"username",
")",
"except",
"Exception",
"as",
"ex",
":",
"log",
".",
"error",
"(",
"str",
"(",... | c7caffe11576c11aa111adbdbadeff70ce66b1dd |
train | AuthModelMethodsMixin.get_groups_by_token | Get user's groups if user with :username: exists and their api key
token equals :token:
Used by Token-based authentication as `check` kwarg. | nefertari/authentication/models.py | def get_groups_by_token(cls, username, token, request):
""" Get user's groups if user with :username: exists and their api key
token equals :token:
Used by Token-based authentication as `check` kwarg.
"""
try:
user = cls.get_item(username=username)
except Exc... | def get_groups_by_token(cls, username, token, request):
""" Get user's groups if user with :username: exists and their api key
token equals :token:
Used by Token-based authentication as `check` kwarg.
"""
try:
user = cls.get_item(username=username)
except Exc... | [
"Get",
"user",
"s",
"groups",
"if",
"user",
"with",
":",
"username",
":",
"exists",
"and",
"their",
"api",
"key",
"token",
"equals",
":",
"token",
":"
] | ramses-tech/nefertari | python | https://github.com/ramses-tech/nefertari/blob/c7caffe11576c11aa111adbdbadeff70ce66b1dd/nefertari/authentication/models.py#L57-L71 | [
"def",
"get_groups_by_token",
"(",
"cls",
",",
"username",
",",
"token",
",",
"request",
")",
":",
"try",
":",
"user",
"=",
"cls",
".",
"get_item",
"(",
"username",
"=",
"username",
")",
"except",
"Exception",
"as",
"ex",
":",
"log",
".",
"error",
"(",... | c7caffe11576c11aa111adbdbadeff70ce66b1dd |
train | AuthModelMethodsMixin.authenticate_by_password | Authenticate user with login and password from :params:
Used both by Token and Ticket-based auths (called from views). | nefertari/authentication/models.py | def authenticate_by_password(cls, params):
""" Authenticate user with login and password from :params:
Used both by Token and Ticket-based auths (called from views).
"""
def verify_password(user, password):
return crypt.check(user.password, password)
success = False... | def authenticate_by_password(cls, params):
""" Authenticate user with login and password from :params:
Used both by Token and Ticket-based auths (called from views).
"""
def verify_password(user, password):
return crypt.check(user.password, password)
success = False... | [
"Authenticate",
"user",
"with",
"login",
"and",
"password",
"from",
":",
"params",
":"
] | ramses-tech/nefertari | python | https://github.com/ramses-tech/nefertari/blob/c7caffe11576c11aa111adbdbadeff70ce66b1dd/nefertari/authentication/models.py#L74-L94 | [
"def",
"authenticate_by_password",
"(",
"cls",
",",
"params",
")",
":",
"def",
"verify_password",
"(",
"user",
",",
"password",
")",
":",
"return",
"crypt",
".",
"check",
"(",
"user",
".",
"password",
",",
"password",
")",
"success",
"=",
"False",
"user",
... | c7caffe11576c11aa111adbdbadeff70ce66b1dd |
train | AuthModelMethodsMixin.get_groups_by_userid | Return group identifiers of user with id :userid:
Used by Ticket-based auth as `callback` kwarg. | nefertari/authentication/models.py | def get_groups_by_userid(cls, userid, request):
""" Return group identifiers of user with id :userid:
Used by Ticket-based auth as `callback` kwarg.
"""
try:
cache_request_user(cls, request, userid)
except Exception as ex:
log.error(str(ex))
f... | def get_groups_by_userid(cls, userid, request):
""" Return group identifiers of user with id :userid:
Used by Ticket-based auth as `callback` kwarg.
"""
try:
cache_request_user(cls, request, userid)
except Exception as ex:
log.error(str(ex))
f... | [
"Return",
"group",
"identifiers",
"of",
"user",
"with",
"id",
":",
"userid",
":"
] | ramses-tech/nefertari | python | https://github.com/ramses-tech/nefertari/blob/c7caffe11576c11aa111adbdbadeff70ce66b1dd/nefertari/authentication/models.py#L97-L109 | [
"def",
"get_groups_by_userid",
"(",
"cls",
",",
"userid",
",",
"request",
")",
":",
"try",
":",
"cache_request_user",
"(",
"cls",
",",
"request",
",",
"userid",
")",
"except",
"Exception",
"as",
"ex",
":",
"log",
".",
"error",
"(",
"str",
"(",
"ex",
")... | c7caffe11576c11aa111adbdbadeff70ce66b1dd |
train | AuthModelMethodsMixin.create_account | Create auth user instance with data from :params:.
Used by both Token and Ticket-based auths to register a user (
called from views). | nefertari/authentication/models.py | def create_account(cls, params):
""" Create auth user instance with data from :params:.
Used by both Token and Ticket-based auths to register a user (
called from views).
"""
user_params = dictset(params).subset(
['username', 'email', 'password'])
try:
... | def create_account(cls, params):
""" Create auth user instance with data from :params:.
Used by both Token and Ticket-based auths to register a user (
called from views).
"""
user_params = dictset(params).subset(
['username', 'email', 'password'])
try:
... | [
"Create",
"auth",
"user",
"instance",
"with",
"data",
"from",
":",
"params",
":",
"."
] | ramses-tech/nefertari | python | https://github.com/ramses-tech/nefertari/blob/c7caffe11576c11aa111adbdbadeff70ce66b1dd/nefertari/authentication/models.py#L112-L125 | [
"def",
"create_account",
"(",
"cls",
",",
"params",
")",
":",
"user_params",
"=",
"dictset",
"(",
"params",
")",
".",
"subset",
"(",
"[",
"'username'",
",",
"'email'",
",",
"'password'",
"]",
")",
"try",
":",
"return",
"cls",
".",
"get_or_create",
"(",
... | c7caffe11576c11aa111adbdbadeff70ce66b1dd |
train | AuthModelMethodsMixin.get_authuser_by_userid | Get user by ID.
Used by Ticket-based auth. Is added as request method to populate
`request.user`. | nefertari/authentication/models.py | def get_authuser_by_userid(cls, request):
""" Get user by ID.
Used by Ticket-based auth. Is added as request method to populate
`request.user`.
"""
userid = authenticated_userid(request)
if userid:
cache_request_user(cls, request, userid)
return r... | def get_authuser_by_userid(cls, request):
""" Get user by ID.
Used by Ticket-based auth. Is added as request method to populate
`request.user`.
"""
userid = authenticated_userid(request)
if userid:
cache_request_user(cls, request, userid)
return r... | [
"Get",
"user",
"by",
"ID",
"."
] | ramses-tech/nefertari | python | https://github.com/ramses-tech/nefertari/blob/c7caffe11576c11aa111adbdbadeff70ce66b1dd/nefertari/authentication/models.py#L128-L137 | [
"def",
"get_authuser_by_userid",
"(",
"cls",
",",
"request",
")",
":",
"userid",
"=",
"authenticated_userid",
"(",
"request",
")",
"if",
"userid",
":",
"cache_request_user",
"(",
"cls",
",",
"request",
",",
"userid",
")",
"return",
"request",
".",
"_user"
] | c7caffe11576c11aa111adbdbadeff70ce66b1dd |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.