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 | Controller.run | The core method for starting the application. Will setup logging,
toggle the runtime state flag, block on loop, then call shutdown.
Redefine this method if you intend to use an IO Loop or some other
long running process. | helper/controller.py | def run(self):
"""The core method for starting the application. Will setup logging,
toggle the runtime state flag, block on loop, then call shutdown.
Redefine this method if you intend to use an IO Loop or some other
long running process.
"""
LOGGER.info('%s v%s started... | def run(self):
"""The core method for starting the application. Will setup logging,
toggle the runtime state flag, block on loop, then call shutdown.
Redefine this method if you intend to use an IO Loop or some other
long running process.
"""
LOGGER.info('%s v%s started... | [
"The",
"core",
"method",
"for",
"starting",
"the",
"application",
".",
"Will",
"setup",
"logging",
"toggle",
"the",
"runtime",
"state",
"flag",
"block",
"on",
"loop",
"then",
"call",
"shutdown",
"."
] | gmr/helper | python | https://github.com/gmr/helper/blob/fe8e45fc8eabf619429b2940c682c252ee33c082/helper/controller.py#L245-L266 | [
"def",
"run",
"(",
"self",
")",
":",
"LOGGER",
".",
"info",
"(",
"'%s v%s started'",
",",
"self",
".",
"APPNAME",
",",
"self",
".",
"VERSION",
")",
"self",
".",
"setup",
"(",
")",
"while",
"not",
"any",
"(",
"[",
"self",
".",
"is_stopping",
",",
"s... | fe8e45fc8eabf619429b2940c682c252ee33c082 |
train | Controller.start | Important:
Do not extend this method, rather redefine Controller.run | helper/controller.py | def start(self):
"""Important:
Do not extend this method, rather redefine Controller.run
"""
for signum in [signal.SIGHUP, signal.SIGTERM,
signal.SIGUSR1, signal.SIGUSR2]:
signal.signal(signum, self._on_signal)
self.run() | def start(self):
"""Important:
Do not extend this method, rather redefine Controller.run
"""
for signum in [signal.SIGHUP, signal.SIGTERM,
signal.SIGUSR1, signal.SIGUSR2]:
signal.signal(signum, self._on_signal)
self.run() | [
"Important",
":"
] | gmr/helper | python | https://github.com/gmr/helper/blob/fe8e45fc8eabf619429b2940c682c252ee33c082/helper/controller.py#L268-L277 | [
"def",
"start",
"(",
"self",
")",
":",
"for",
"signum",
"in",
"[",
"signal",
".",
"SIGHUP",
",",
"signal",
".",
"SIGTERM",
",",
"signal",
".",
"SIGUSR1",
",",
"signal",
".",
"SIGUSR2",
"]",
":",
"signal",
".",
"signal",
"(",
"signum",
",",
"self",
... | fe8e45fc8eabf619429b2940c682c252ee33c082 |
train | Controller.set_state | Set the runtime state of the Controller. Use the internal constants
to ensure proper state values:
- :attr:`Controller.STATE_INITIALIZING`
- :attr:`Controller.STATE_ACTIVE`
- :attr:`Controller.STATE_IDLE`
- :attr:`Controller.STATE_SLEEPING`
- :attr:`Controller.STATE_STOP... | helper/controller.py | def set_state(self, state):
"""Set the runtime state of the Controller. Use the internal constants
to ensure proper state values:
- :attr:`Controller.STATE_INITIALIZING`
- :attr:`Controller.STATE_ACTIVE`
- :attr:`Controller.STATE_IDLE`
- :attr:`Controller.STATE_SLEEPING`... | def set_state(self, state):
"""Set the runtime state of the Controller. Use the internal constants
to ensure proper state values:
- :attr:`Controller.STATE_INITIALIZING`
- :attr:`Controller.STATE_ACTIVE`
- :attr:`Controller.STATE_IDLE`
- :attr:`Controller.STATE_SLEEPING`... | [
"Set",
"the",
"runtime",
"state",
"of",
"the",
"Controller",
".",
"Use",
"the",
"internal",
"constants",
"to",
"ensure",
"proper",
"state",
"values",
":"
] | gmr/helper | python | https://github.com/gmr/helper/blob/fe8e45fc8eabf619429b2940c682c252ee33c082/helper/controller.py#L279-L332 | [
"def",
"set_state",
"(",
"self",
",",
"state",
")",
":",
"if",
"state",
"==",
"self",
".",
"_state",
":",
"return",
"elif",
"state",
"not",
"in",
"self",
".",
"_STATES",
".",
"keys",
"(",
")",
":",
"raise",
"ValueError",
"(",
"'Invalid state {}'",
".",... | fe8e45fc8eabf619429b2940c682c252ee33c082 |
train | Controller.stop | Override to implement shutdown steps. | helper/controller.py | def stop(self):
"""Override to implement shutdown steps."""
LOGGER.info('Attempting to stop the process')
self.set_state(self.STATE_STOP_REQUESTED)
# Call shutdown for classes to add shutdown steps
self.shutdown()
# Wait for the current run to finish
while self.... | def stop(self):
"""Override to implement shutdown steps."""
LOGGER.info('Attempting to stop the process')
self.set_state(self.STATE_STOP_REQUESTED)
# Call shutdown for classes to add shutdown steps
self.shutdown()
# Wait for the current run to finish
while self.... | [
"Override",
"to",
"implement",
"shutdown",
"steps",
"."
] | gmr/helper | python | https://github.com/gmr/helper/blob/fe8e45fc8eabf619429b2940c682c252ee33c082/helper/controller.py#L342-L363 | [
"def",
"stop",
"(",
"self",
")",
":",
"LOGGER",
".",
"info",
"(",
"'Attempting to stop the process'",
")",
"self",
".",
"set_state",
"(",
"self",
".",
"STATE_STOP_REQUESTED",
")",
"# Call shutdown for classes to add shutdown steps",
"self",
".",
"shutdown",
"(",
")"... | fe8e45fc8eabf619429b2940c682c252ee33c082 |
train | parse_ts | parse timestamp.
:param ts: timestamp in ISO8601 format
:return: tbd!!! | gcdt/servicediscovery.py | def parse_ts(ts):
"""
parse timestamp.
:param ts: timestamp in ISO8601 format
:return: tbd!!!
"""
# ISO8601 = '%Y-%m-%dT%H:%M:%SZ'
# ISO8601_MS = '%Y-%m-%dT%H:%M:%S.%fZ'
# RFC1123 = '%a, %d %b %Y %H:%M:%S %Z'
dt = maya.parse(ts.strip())
return dt.datetime(naive=True) | def parse_ts(ts):
"""
parse timestamp.
:param ts: timestamp in ISO8601 format
:return: tbd!!!
"""
# ISO8601 = '%Y-%m-%dT%H:%M:%SZ'
# ISO8601_MS = '%Y-%m-%dT%H:%M:%S.%fZ'
# RFC1123 = '%a, %d %b %Y %H:%M:%S %Z'
dt = maya.parse(ts.strip())
return dt.datetime(naive=True) | [
"parse",
"timestamp",
".",
":",
"param",
"ts",
":",
"timestamp",
"in",
"ISO8601",
"format",
":",
"return",
":",
"tbd!!!"
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/servicediscovery.py#L18-L29 | [
"def",
"parse_ts",
"(",
"ts",
")",
":",
"# ISO8601 = '%Y-%m-%dT%H:%M:%SZ'",
"# ISO8601_MS = '%Y-%m-%dT%H:%M:%S.%fZ'",
"# RFC1123 = '%a, %d %b %Y %H:%M:%S %Z'",
"dt",
"=",
"maya",
".",
"parse",
"(",
"ts",
".",
"strip",
"(",
")",
")",
"return",
"dt",
".",
"datetime",
... | cd67cf416371337b83cb9ca3f696277125703339 |
train | get_outputs_for_stack | Read environment from ENV and mangle it to a (lower case) representation
Note: gcdt.servicediscovery get_outputs_for_stack((awsclient, stack_name)
is used in many cloudformation.py templates!
:param awsclient:
:param stack_name:
:return: dictionary containing the stack outputs | gcdt/servicediscovery.py | def get_outputs_for_stack(awsclient, stack_name):
"""
Read environment from ENV and mangle it to a (lower case) representation
Note: gcdt.servicediscovery get_outputs_for_stack((awsclient, stack_name)
is used in many cloudformation.py templates!
:param awsclient:
:param stack_name:
:return:... | def get_outputs_for_stack(awsclient, stack_name):
"""
Read environment from ENV and mangle it to a (lower case) representation
Note: gcdt.servicediscovery get_outputs_for_stack((awsclient, stack_name)
is used in many cloudformation.py templates!
:param awsclient:
:param stack_name:
:return:... | [
"Read",
"environment",
"from",
"ENV",
"and",
"mangle",
"it",
"to",
"a",
"(",
"lower",
"case",
")",
"representation",
"Note",
":",
"gcdt",
".",
"servicediscovery",
"get_outputs_for_stack",
"((",
"awsclient",
"stack_name",
")",
"is",
"used",
"in",
"many",
"cloud... | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/servicediscovery.py#L33-L49 | [
"def",
"get_outputs_for_stack",
"(",
"awsclient",
",",
"stack_name",
")",
":",
"client_cf",
"=",
"awsclient",
".",
"get_client",
"(",
"'cloudformation'",
")",
"response",
"=",
"client_cf",
".",
"describe_stacks",
"(",
"StackName",
"=",
"stack_name",
")",
"if",
"... | cd67cf416371337b83cb9ca3f696277125703339 |
train | get_base_ami | DEPRECATED!!!
return the latest version of our base AMI
we can't use tags for this, so we have only the name as resource
note: this functionality is deprecated since this only works for "old"
baseami. | gcdt/servicediscovery.py | def get_base_ami(awsclient, owners):
"""
DEPRECATED!!!
return the latest version of our base AMI
we can't use tags for this, so we have only the name as resource
note: this functionality is deprecated since this only works for "old"
baseami.
"""
client_ec2 = awsclient.get_client('ec2')
... | def get_base_ami(awsclient, owners):
"""
DEPRECATED!!!
return the latest version of our base AMI
we can't use tags for this, so we have only the name as resource
note: this functionality is deprecated since this only works for "old"
baseami.
"""
client_ec2 = awsclient.get_client('ec2')
... | [
"DEPRECATED!!!",
"return",
"the",
"latest",
"version",
"of",
"our",
"base",
"AMI",
"we",
"can",
"t",
"use",
"tags",
"for",
"this",
"so",
"we",
"have",
"only",
"the",
"name",
"as",
"resource",
"note",
":",
"this",
"functionality",
"is",
"deprecated",
"since... | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/servicediscovery.py#L71-L107 | [
"def",
"get_base_ami",
"(",
"awsclient",
",",
"owners",
")",
":",
"client_ec2",
"=",
"awsclient",
".",
"get_client",
"(",
"'ec2'",
")",
"image_filter",
"=",
"[",
"{",
"'Name'",
":",
"'state'",
",",
"'Values'",
":",
"[",
"'available'",
",",
"]",
"}",
",",... | cd67cf416371337b83cb9ca3f696277125703339 |
train | _add_default_arguments | Add the default arguments to the parser.
:param argparse.ArgumentParser parser: The argument parser | helper/parser.py | def _add_default_arguments(parser):
"""Add the default arguments to the parser.
:param argparse.ArgumentParser parser: The argument parser
"""
parser.add_argument('-c', '--config', action='store', dest='config',
help='Path to the configuration file')
parser.add_argument('-f... | def _add_default_arguments(parser):
"""Add the default arguments to the parser.
:param argparse.ArgumentParser parser: The argument parser
"""
parser.add_argument('-c', '--config', action='store', dest='config',
help='Path to the configuration file')
parser.add_argument('-f... | [
"Add",
"the",
"default",
"arguments",
"to",
"the",
"parser",
"."
] | gmr/helper | python | https://github.com/gmr/helper/blob/fe8e45fc8eabf619429b2940c682c252ee33c082/helper/parser.py#L62-L71 | [
"def",
"_add_default_arguments",
"(",
"parser",
")",
":",
"parser",
".",
"add_argument",
"(",
"'-c'",
",",
"'--config'",
",",
"action",
"=",
"'store'",
",",
"dest",
"=",
"'config'",
",",
"help",
"=",
"'Path to the configuration file'",
")",
"parser",
".",
"add... | fe8e45fc8eabf619429b2940c682c252ee33c082 |
train | _str | Ensures that the val is the default str() type for python2 or 3 | flask_mwoauth/__init__.py | def _str(val):
"""
Ensures that the val is the default str() type for python2 or 3
"""
if str == bytes:
if isinstance(val, str):
return val
else:
return str(val)
else:
if isinstance(val, str):
return val
else:
return str... | def _str(val):
"""
Ensures that the val is the default str() type for python2 or 3
"""
if str == bytes:
if isinstance(val, str):
return val
else:
return str(val)
else:
if isinstance(val, str):
return val
else:
return str... | [
"Ensures",
"that",
"the",
"val",
"is",
"the",
"default",
"str",
"()",
"type",
"for",
"python2",
"or",
"3"
] | valhallasw/flask-mwoauth | python | https://github.com/valhallasw/flask-mwoauth/blob/216aa9c1ead07d99a9e11deb7642e33a70aa59d7/flask_mwoauth/__init__.py#L174-L187 | [
"def",
"_str",
"(",
"val",
")",
":",
"if",
"str",
"==",
"bytes",
":",
"if",
"isinstance",
"(",
"val",
",",
"str",
")",
":",
"return",
"val",
"else",
":",
"return",
"str",
"(",
"val",
")",
"else",
":",
"if",
"isinstance",
"(",
"val",
",",
"str",
... | 216aa9c1ead07d99a9e11deb7642e33a70aa59d7 |
train | MWOAuth._prepare_long_request | Use requests.Request and requests.PreparedRequest to produce the
body (and boundary value) of a multipart/form-data; POST request as
detailed in https://www.mediawiki.org/wiki/API:Edit#Large_texts | flask_mwoauth/__init__.py | def _prepare_long_request(self, url, api_query):
"""
Use requests.Request and requests.PreparedRequest to produce the
body (and boundary value) of a multipart/form-data; POST request as
detailed in https://www.mediawiki.org/wiki/API:Edit#Large_texts
"""
partlist = []
... | def _prepare_long_request(self, url, api_query):
"""
Use requests.Request and requests.PreparedRequest to produce the
body (and boundary value) of a multipart/form-data; POST request as
detailed in https://www.mediawiki.org/wiki/API:Edit#Large_texts
"""
partlist = []
... | [
"Use",
"requests",
".",
"Request",
"and",
"requests",
".",
"PreparedRequest",
"to",
"produce",
"the",
"body",
"(",
"and",
"boundary",
"value",
")",
"of",
"a",
"multipart",
"/",
"form",
"-",
"data",
";",
"POST",
"request",
"as",
"detailed",
"in",
"https",
... | valhallasw/flask-mwoauth | python | https://github.com/valhallasw/flask-mwoauth/blob/216aa9c1ead07d99a9e11deb7642e33a70aa59d7/flask_mwoauth/__init__.py#L93-L122 | [
"def",
"_prepare_long_request",
"(",
"self",
",",
"url",
",",
"api_query",
")",
":",
"partlist",
"=",
"[",
"]",
"for",
"k",
",",
"v",
"in",
"iteritems",
"(",
"api_query",
")",
":",
"if",
"k",
"in",
"(",
"'title'",
",",
"'text'",
",",
"'summary'",
")"... | 216aa9c1ead07d99a9e11deb7642e33a70aa59d7 |
train | MWOAuth.request | e.g. {'action': 'query', 'meta': 'userinfo'}. format=json not required
function returns a python dict that resembles the api's json response | flask_mwoauth/__init__.py | def request(self, api_query, url=None):
"""
e.g. {'action': 'query', 'meta': 'userinfo'}. format=json not required
function returns a python dict that resembles the api's json response
"""
api_query['format'] = 'json'
if url is not None:
api_url = url + "/api.... | def request(self, api_query, url=None):
"""
e.g. {'action': 'query', 'meta': 'userinfo'}. format=json not required
function returns a python dict that resembles the api's json response
"""
api_query['format'] = 'json'
if url is not None:
api_url = url + "/api.... | [
"e",
".",
"g",
".",
"{",
"action",
":",
"query",
"meta",
":",
"userinfo",
"}",
".",
"format",
"=",
"json",
"not",
"required",
"function",
"returns",
"a",
"python",
"dict",
"that",
"resembles",
"the",
"api",
"s",
"json",
"response"
] | valhallasw/flask-mwoauth | python | https://github.com/valhallasw/flask-mwoauth/blob/216aa9c1ead07d99a9e11deb7642e33a70aa59d7/flask_mwoauth/__init__.py#L124-L158 | [
"def",
"request",
"(",
"self",
",",
"api_query",
",",
"url",
"=",
"None",
")",
":",
"api_query",
"[",
"'format'",
"]",
"=",
"'json'",
"if",
"url",
"is",
"not",
"None",
":",
"api_url",
"=",
"url",
"+",
"\"/api.php\"",
"else",
":",
"api_url",
"=",
"sel... | 216aa9c1ead07d99a9e11deb7642e33a70aa59d7 |
train | dump | Convert a single Physical Information Object, or a list of such objects, into a JSON-encoded text file.
:param pif: Object or list of objects to serialize.
:param fp: File-like object supporting .write() method to write the serialized object(s) to.
:param kwargs: Any options available to json.dump(). | pypif/pif.py | def dump(pif, fp, **kwargs):
"""
Convert a single Physical Information Object, or a list of such objects, into a JSON-encoded text file.
:param pif: Object or list of objects to serialize.
:param fp: File-like object supporting .write() method to write the serialized object(s) to.
:param kwargs: An... | def dump(pif, fp, **kwargs):
"""
Convert a single Physical Information Object, or a list of such objects, into a JSON-encoded text file.
:param pif: Object or list of objects to serialize.
:param fp: File-like object supporting .write() method to write the serialized object(s) to.
:param kwargs: An... | [
"Convert",
"a",
"single",
"Physical",
"Information",
"Object",
"or",
"a",
"list",
"of",
"such",
"objects",
"into",
"a",
"JSON",
"-",
"encoded",
"text",
"file",
"."
] | CitrineInformatics/pypif | python | https://github.com/CitrineInformatics/pypif/blob/938348a8ff7b10b330770cccaaeb2109922f681b/pypif/pif.py#L8-L16 | [
"def",
"dump",
"(",
"pif",
",",
"fp",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"json",
".",
"dump",
"(",
"pif",
",",
"fp",
",",
"cls",
"=",
"PifEncoder",
",",
"*",
"*",
"kwargs",
")"
] | 938348a8ff7b10b330770cccaaeb2109922f681b |
train | load | Convert content in a JSON-encoded text file to a Physical Information Object or a list of such objects.
:param fp: File-like object supporting .read() method to deserialize from.
:param class_: Subclass of :class:`.Pio` to produce, if not unambiguous
:param kwargs: Any options available to json.load().
... | pypif/pif.py | def load(fp, class_=None, **kwargs):
"""
Convert content in a JSON-encoded text file to a Physical Information Object or a list of such objects.
:param fp: File-like object supporting .read() method to deserialize from.
:param class_: Subclass of :class:`.Pio` to produce, if not unambiguous
:param ... | def load(fp, class_=None, **kwargs):
"""
Convert content in a JSON-encoded text file to a Physical Information Object or a list of such objects.
:param fp: File-like object supporting .read() method to deserialize from.
:param class_: Subclass of :class:`.Pio` to produce, if not unambiguous
:param ... | [
"Convert",
"content",
"in",
"a",
"JSON",
"-",
"encoded",
"text",
"file",
"to",
"a",
"Physical",
"Information",
"Object",
"or",
"a",
"list",
"of",
"such",
"objects",
"."
] | CitrineInformatics/pypif | python | https://github.com/CitrineInformatics/pypif/blob/938348a8ff7b10b330770cccaaeb2109922f681b/pypif/pif.py#L29-L38 | [
"def",
"load",
"(",
"fp",
",",
"class_",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"loado",
"(",
"json",
".",
"load",
"(",
"fp",
",",
"*",
"*",
"kwargs",
")",
",",
"class_",
"=",
"class_",
")"
] | 938348a8ff7b10b330770cccaaeb2109922f681b |
train | loads | Convert content in a JSON-encoded string to a Physical Information Object or a list of such objects.
:param s: String to deserialize.
:param class_: Subclass of :class:`.Pio` to produce, if not unambiguous
:param kwargs: Any options available to json.loads().
:return: Single object derived from :class:... | pypif/pif.py | def loads(s, class_=None, **kwargs):
"""
Convert content in a JSON-encoded string to a Physical Information Object or a list of such objects.
:param s: String to deserialize.
:param class_: Subclass of :class:`.Pio` to produce, if not unambiguous
:param kwargs: Any options available to json.loads()... | def loads(s, class_=None, **kwargs):
"""
Convert content in a JSON-encoded string to a Physical Information Object or a list of such objects.
:param s: String to deserialize.
:param class_: Subclass of :class:`.Pio` to produce, if not unambiguous
:param kwargs: Any options available to json.loads()... | [
"Convert",
"content",
"in",
"a",
"JSON",
"-",
"encoded",
"string",
"to",
"a",
"Physical",
"Information",
"Object",
"or",
"a",
"list",
"of",
"such",
"objects",
"."
] | CitrineInformatics/pypif | python | https://github.com/CitrineInformatics/pypif/blob/938348a8ff7b10b330770cccaaeb2109922f681b/pypif/pif.py#L41-L50 | [
"def",
"loads",
"(",
"s",
",",
"class_",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"loado",
"(",
"json",
".",
"loads",
"(",
"s",
",",
"*",
"*",
"kwargs",
")",
",",
"class_",
"=",
"class_",
")"
] | 938348a8ff7b10b330770cccaaeb2109922f681b |
train | loado | Convert a dictionary or a list of dictionaries into a single Physical Information Object or a list of such objects.
:param obj: Dictionary or list to convert to Physical Information Objects.
:param class_: Subclass of :class:`.Pio` to produce, if not unambiguous
:return: Single object derived from :class:`... | pypif/pif.py | def loado(obj, class_=None):
"""
Convert a dictionary or a list of dictionaries into a single Physical Information Object or a list of such objects.
:param obj: Dictionary or list to convert to Physical Information Objects.
:param class_: Subclass of :class:`.Pio` to produce, if not unambiguous
:re... | def loado(obj, class_=None):
"""
Convert a dictionary or a list of dictionaries into a single Physical Information Object or a list of such objects.
:param obj: Dictionary or list to convert to Physical Information Objects.
:param class_: Subclass of :class:`.Pio` to produce, if not unambiguous
:re... | [
"Convert",
"a",
"dictionary",
"or",
"a",
"list",
"of",
"dictionaries",
"into",
"a",
"single",
"Physical",
"Information",
"Object",
"or",
"a",
"list",
"of",
"such",
"objects",
"."
] | CitrineInformatics/pypif | python | https://github.com/CitrineInformatics/pypif/blob/938348a8ff7b10b330770cccaaeb2109922f681b/pypif/pif.py#L53-L66 | [
"def",
"loado",
"(",
"obj",
",",
"class_",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"list",
")",
":",
"return",
"[",
"_dict_to_pio",
"(",
"i",
",",
"class_",
"=",
"class_",
")",
"for",
"i",
"in",
"obj",
"]",
"elif",
"isinstance",... | 938348a8ff7b10b330770cccaaeb2109922f681b |
train | _dict_to_pio | Convert a single dictionary object to a Physical Information Object.
:param d: Dictionary to convert.
:param class_: Subclass of :class:`.Pio` to produce, if not unambiguous
:return: Single object derived from :class:`.Pio`. | pypif/pif.py | def _dict_to_pio(d, class_=None):
"""
Convert a single dictionary object to a Physical Information Object.
:param d: Dictionary to convert.
:param class_: Subclass of :class:`.Pio` to produce, if not unambiguous
:return: Single object derived from :class:`.Pio`.
"""
d = keys_to_snake_case(d... | def _dict_to_pio(d, class_=None):
"""
Convert a single dictionary object to a Physical Information Object.
:param d: Dictionary to convert.
:param class_: Subclass of :class:`.Pio` to produce, if not unambiguous
:return: Single object derived from :class:`.Pio`.
"""
d = keys_to_snake_case(d... | [
"Convert",
"a",
"single",
"dictionary",
"object",
"to",
"a",
"Physical",
"Information",
"Object",
"."
] | CitrineInformatics/pypif | python | https://github.com/CitrineInformatics/pypif/blob/938348a8ff7b10b330770cccaaeb2109922f681b/pypif/pif.py#L69-L90 | [
"def",
"_dict_to_pio",
"(",
"d",
",",
"class_",
"=",
"None",
")",
":",
"d",
"=",
"keys_to_snake_case",
"(",
"d",
")",
"if",
"class_",
":",
"return",
"class_",
"(",
"*",
"*",
"d",
")",
"if",
"'category'",
"not",
"in",
"d",
":",
"raise",
"ValueError",
... | 938348a8ff7b10b330770cccaaeb2109922f681b |
train | get_command | Utility function to extract command from docopt arguments.
:param arguments:
:return: command | gcdt/gcdt_cmd_dispatcher.py | def get_command(arguments):
"""Utility function to extract command from docopt arguments.
:param arguments:
:return: command
"""
cmds = list(filter(lambda k: not (k.startswith('-') or
k.startswith('<')) and arguments[k],
arguments.keys()))
if l... | def get_command(arguments):
"""Utility function to extract command from docopt arguments.
:param arguments:
:return: command
"""
cmds = list(filter(lambda k: not (k.startswith('-') or
k.startswith('<')) and arguments[k],
arguments.keys()))
if l... | [
"Utility",
"function",
"to",
"extract",
"command",
"from",
"docopt",
"arguments",
"."
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/gcdt_cmd_dispatcher.py#L101-L112 | [
"def",
"get_command",
"(",
"arguments",
")",
":",
"cmds",
"=",
"list",
"(",
"filter",
"(",
"lambda",
"k",
":",
"not",
"(",
"k",
".",
"startswith",
"(",
"'-'",
")",
"or",
"k",
".",
"startswith",
"(",
"'<'",
")",
")",
"and",
"arguments",
"[",
"k",
... | cd67cf416371337b83cb9ca3f696277125703339 |
train | cmd.dispatch | Dispatch arguments parsed by docopt to the cmd with matching spec.
:param arguments:
:param kwargs:
:return: exit_code | gcdt/gcdt_cmd_dispatcher.py | def dispatch(cls, arguments, **kwargs):
"""Dispatch arguments parsed by docopt to the cmd with matching spec.
:param arguments:
:param kwargs:
:return: exit_code
"""
# first match wins
# spec: all '-' elements must match, all others are False;
# '<s... | def dispatch(cls, arguments, **kwargs):
"""Dispatch arguments parsed by docopt to the cmd with matching spec.
:param arguments:
:param kwargs:
:return: exit_code
"""
# first match wins
# spec: all '-' elements must match, all others are False;
# '<s... | [
"Dispatch",
"arguments",
"parsed",
"by",
"docopt",
"to",
"the",
"cmd",
"with",
"matching",
"spec",
"."
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/gcdt_cmd_dispatcher.py#L42-L98 | [
"def",
"dispatch",
"(",
"cls",
",",
"arguments",
",",
"*",
"*",
"kwargs",
")",
":",
"# first match wins",
"# spec: all '-' elements must match, all others are False;",
"# '<sth>' elements are converted to call args on order of",
"# appearance",
"#",
"# kwargs are provid... | cd67cf416371337b83cb9ca3f696277125703339 |
train | StackLookup.get_att | Retrieves an attribute from an existing stack
:param parameter: The output parameter which should be retrieved
:param as_reference: Is the parameter a reference (Default) or a string
:return: Value of parameter to retrieve | gcdt/kumo_util.py | def get_att(self, parameter, as_reference=True):
"""Retrieves an attribute from an existing stack
:param parameter: The output parameter which should be retrieved
:param as_reference: Is the parameter a reference (Default) or a string
:return: Value of parameter to retrieve
"""
... | def get_att(self, parameter, as_reference=True):
"""Retrieves an attribute from an existing stack
:param parameter: The output parameter which should be retrieved
:param as_reference: Is the parameter a reference (Default) or a string
:return: Value of parameter to retrieve
"""
... | [
"Retrieves",
"an",
"attribute",
"from",
"an",
"existing",
"stack",
":",
"param",
"parameter",
":",
"The",
"output",
"parameter",
"which",
"should",
"be",
"retrieved",
":",
"param",
"as_reference",
":",
"Is",
"the",
"parameter",
"a",
"reference",
"(",
"Default"... | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/kumo_util.py#L64-L79 | [
"def",
"get_att",
"(",
"self",
",",
"parameter",
",",
"as_reference",
"=",
"True",
")",
":",
"if",
"as_reference",
":",
"return",
"troposphere",
".",
"GetAtt",
"(",
"self",
".",
"__custom_stack_obj",
",",
"troposphere",
".",
"Ref",
"(",
"parameter",
")",
"... | cd67cf416371337b83cb9ca3f696277125703339 |
train | S3EventSource._get_notification_spec | if 'key_filters' in self._config:
filters_spec = {'Key': {'FilterRules': [] } }
# I do not think this is a useful structure:
for filter in self._config['key_filters']:
if 'type' in filter and 'value' in filter and filter['type'] in ('prefix', 'suffix'):
... | gcdt/event_source/s3.py | def _get_notification_spec(self, lambda_arn):
lambda_name = base.get_lambda_name(lambda_arn)
notification_spec = {
'Id': self._make_notification_id(lambda_name),
'Events': [e for e in self._config['events']],
'LambdaFunctionArn': lambda_arn
}
# Add S3... | def _get_notification_spec(self, lambda_arn):
lambda_name = base.get_lambda_name(lambda_arn)
notification_spec = {
'Id': self._make_notification_id(lambda_name),
'Events': [e for e in self._config['events']],
'LambdaFunctionArn': lambda_arn
}
# Add S3... | [
"if",
"key_filters",
"in",
"self",
".",
"_config",
":",
"filters_spec",
"=",
"{",
"Key",
":",
"{",
"FilterRules",
":",
"[]",
"}",
"}",
"#",
"I",
"do",
"not",
"think",
"this",
"is",
"a",
"useful",
"structure",
":",
"for",
"filter",
"in",
"self",
".",
... | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/event_source/s3.py#L51-L80 | [
"def",
"_get_notification_spec",
"(",
"self",
",",
"lambda_arn",
")",
":",
"lambda_name",
"=",
"base",
".",
"get_lambda_name",
"(",
"lambda_arn",
")",
"notification_spec",
"=",
"{",
"'Id'",
":",
"self",
".",
"_make_notification_id",
"(",
"lambda_name",
")",
",",... | cd67cf416371337b83cb9ca3f696277125703339 |
train | ArmKernel.convert_representation | Return the proper representation for the given integer | iarm_kernel/iarmkernel.py | def convert_representation(self, i):
"""
Return the proper representation for the given integer
"""
if self.number_representation == 'unsigned':
return i
elif self.number_representation == 'signed':
if i & (1 << self.interpreter._bit_width - 1):
... | def convert_representation(self, i):
"""
Return the proper representation for the given integer
"""
if self.number_representation == 'unsigned':
return i
elif self.number_representation == 'signed':
if i & (1 << self.interpreter._bit_width - 1):
... | [
"Return",
"the",
"proper",
"representation",
"for",
"the",
"given",
"integer"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm_kernel/iarmkernel.py#L40-L52 | [
"def",
"convert_representation",
"(",
"self",
",",
"i",
")",
":",
"if",
"self",
".",
"number_representation",
"==",
"'unsigned'",
":",
"return",
"i",
"elif",
"self",
".",
"number_representation",
"==",
"'signed'",
":",
"if",
"i",
"&",
"(",
"1",
"<<",
"self... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | ArmKernel.magic_generate_random | Set the generate random flag, unset registers and memory will return a random value.
Usage:
Call the magic by itself or with `true` to have registers and memory return a random value
if they are unset and read from, much like how real hardware would work.
Defaults to False, or to not ge... | iarm_kernel/iarmkernel.py | def magic_generate_random(self, line):
"""
Set the generate random flag, unset registers and memory will return a random value.
Usage:
Call the magic by itself or with `true` to have registers and memory return a random value
if they are unset and read from, much like how real h... | def magic_generate_random(self, line):
"""
Set the generate random flag, unset registers and memory will return a random value.
Usage:
Call the magic by itself or with `true` to have registers and memory return a random value
if they are unset and read from, much like how real h... | [
"Set",
"the",
"generate",
"random",
"flag",
"unset",
"registers",
"and",
"memory",
"will",
"return",
"a",
"random",
"value",
"."
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm_kernel/iarmkernel.py#L54-L81 | [
"def",
"magic_generate_random",
"(",
"self",
",",
"line",
")",
":",
"line",
"=",
"line",
".",
"strip",
"(",
")",
".",
"lower",
"(",
")",
"if",
"not",
"line",
"or",
"line",
"==",
"'true'",
":",
"self",
".",
"interpreter",
".",
"generate_random",
"=",
... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | ArmKernel.magic_postpone_execution | Postpone execution of instructions until explicitly run
Usage:
Call this magic with `true` or nothing to postpone execution,
or call with `false` to execute each instruction when evaluated.
This defaults to True.
Note that each cell is executed only executed after all lines in
... | iarm_kernel/iarmkernel.py | def magic_postpone_execution(self, line):
"""
Postpone execution of instructions until explicitly run
Usage:
Call this magic with `true` or nothing to postpone execution,
or call with `false` to execute each instruction when evaluated.
This defaults to True.
Not... | def magic_postpone_execution(self, line):
"""
Postpone execution of instructions until explicitly run
Usage:
Call this magic with `true` or nothing to postpone execution,
or call with `false` to execute each instruction when evaluated.
This defaults to True.
Not... | [
"Postpone",
"execution",
"of",
"instructions",
"until",
"explicitly",
"run"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm_kernel/iarmkernel.py#L83-L113 | [
"def",
"magic_postpone_execution",
"(",
"self",
",",
"line",
")",
":",
"line",
"=",
"line",
".",
"strip",
"(",
")",
".",
"lower",
"(",
")",
"if",
"not",
"line",
"or",
"line",
"==",
"'true'",
":",
"self",
".",
"interpreter",
".",
"postpone_execution",
"... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | ArmKernel.magic_register | Print out the current value of a register
Usage:
Pass in the register, or a list of registers separated by spaces
A list of registeres can be entered by separating them by a hyphen
`%reg R1`
or
`%reg R0 R5 R6`
or
`%reg R8-R12` | iarm_kernel/iarmkernel.py | def magic_register(self, line):
"""
Print out the current value of a register
Usage:
Pass in the register, or a list of registers separated by spaces
A list of registeres can be entered by separating them by a hyphen
`%reg R1`
or
`%reg R0 R5 R6`
... | def magic_register(self, line):
"""
Print out the current value of a register
Usage:
Pass in the register, or a list of registers separated by spaces
A list of registeres can be entered by separating them by a hyphen
`%reg R1`
or
`%reg R0 R5 R6`
... | [
"Print",
"out",
"the",
"current",
"value",
"of",
"a",
"register"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm_kernel/iarmkernel.py#L148-L181 | [
"def",
"magic_register",
"(",
"self",
",",
"line",
")",
":",
"message",
"=",
"\"\"",
"for",
"reg",
"in",
"[",
"i",
".",
"strip",
"(",
")",
"for",
"i",
"in",
"line",
".",
"replace",
"(",
"','",
",",
"''",
")",
".",
"split",
"(",
")",
"]",
":",
... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | ArmKernel.magic_memory | Print out the current value of memory
Usage:
Pass in the byte of memory to read, separated by spaced
A list of memory contents can be entered by separating them by a hyphen
`%mem 4 5`
or
`%mem 8-12` | iarm_kernel/iarmkernel.py | def magic_memory(self, line):
"""
Print out the current value of memory
Usage:
Pass in the byte of memory to read, separated by spaced
A list of memory contents can be entered by separating them by a hyphen
`%mem 4 5`
or
`%mem 8-12`
"""
#... | def magic_memory(self, line):
"""
Print out the current value of memory
Usage:
Pass in the byte of memory to read, separated by spaced
A list of memory contents can be entered by separating them by a hyphen
`%mem 4 5`
or
`%mem 8-12`
"""
#... | [
"Print",
"out",
"the",
"current",
"value",
"of",
"memory"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm_kernel/iarmkernel.py#L183-L215 | [
"def",
"magic_memory",
"(",
"self",
",",
"line",
")",
":",
"# TODO add support for directives",
"message",
"=",
"\"\"",
"for",
"address",
"in",
"[",
"i",
".",
"strip",
"(",
")",
"for",
"i",
"in",
"line",
".",
"replace",
"(",
"','",
",",
"''",
")",
".",... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | ArmKernel.magic_run | Run the current program
Usage:
Call with a numbe rto run that many steps,
or call with no arguments to run to the end of the current program
`%run`
or
`%run 1` | iarm_kernel/iarmkernel.py | def magic_run(self, line):
"""
Run the current program
Usage:
Call with a numbe rto run that many steps,
or call with no arguments to run to the end of the current program
`%run`
or
`%run 1`
"""
i = float('inf')
if line.strip():
... | def magic_run(self, line):
"""
Run the current program
Usage:
Call with a numbe rto run that many steps,
or call with no arguments to run to the end of the current program
`%run`
or
`%run 1`
"""
i = float('inf')
if line.strip():
... | [
"Run",
"the",
"current",
"program"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm_kernel/iarmkernel.py#L217-L254 | [
"def",
"magic_run",
"(",
"self",
",",
"line",
")",
":",
"i",
"=",
"float",
"(",
"'inf'",
")",
"if",
"line",
".",
"strip",
"(",
")",
":",
"i",
"=",
"int",
"(",
"line",
")",
"try",
":",
"with",
"warnings",
".",
"catch_warnings",
"(",
"record",
"=",... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | ArmKernel.magic_help | Print out the help for magics
Usage:
Call help with no arguments to list all magics,
or call it with a magic to print out it's help info.
`%help`
or
`%help run | iarm_kernel/iarmkernel.py | def magic_help(self, line):
"""
Print out the help for magics
Usage:
Call help with no arguments to list all magics,
or call it with a magic to print out it's help info.
`%help`
or
`%help run
"""
line = line.strip()
if not line:
... | def magic_help(self, line):
"""
Print out the help for magics
Usage:
Call help with no arguments to list all magics,
or call it with a magic to print out it's help info.
`%help`
or
`%help run
"""
line = line.strip()
if not line:
... | [
"Print",
"out",
"the",
"help",
"for",
"magics"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm_kernel/iarmkernel.py#L256-L283 | [
"def",
"magic_help",
"(",
"self",
",",
"line",
")",
":",
"line",
"=",
"line",
".",
"strip",
"(",
")",
"if",
"not",
"line",
":",
"for",
"magic",
"in",
"self",
".",
"magics",
":",
"stream_content",
"=",
"{",
"'name'",
":",
"'stdout'",
",",
"'text'",
... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | export_to_swagger | Export the API design as swagger file.
:param api_name:
:param stage_name:
:param api_description:
:param lambdas:
:param custom_hostname:
:param custom_base_path: | gcdt/yugen_core.py | def export_to_swagger(awsclient, api_name, stage_name, api_description,
lambdas, custom_hostname=False, custom_base_path=False):
"""Export the API design as swagger file.
:param api_name:
:param stage_name:
:param api_description:
:param lambdas:
:param custom_hos... | def export_to_swagger(awsclient, api_name, stage_name, api_description,
lambdas, custom_hostname=False, custom_base_path=False):
"""Export the API design as swagger file.
:param api_name:
:param stage_name:
:param api_description:
:param lambdas:
:param custom_hos... | [
"Export",
"the",
"API",
"design",
"as",
"swagger",
"file",
".",
":",
"param",
"api_name",
":",
":",
"param",
"stage_name",
":",
":",
"param",
"api_description",
":",
":",
"param",
"lambdas",
":",
":",
"param",
"custom_hostname",
":",
":",
"param",
"custom_... | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/yugen_core.py#L21-L54 | [
"def",
"export_to_swagger",
"(",
"awsclient",
",",
"api_name",
",",
"stage_name",
",",
"api_description",
",",
"lambdas",
",",
"custom_hostname",
"=",
"False",
",",
"custom_base_path",
"=",
"False",
")",
":",
"print",
"(",
"'Exporting to swagger...'",
")",
"api",
... | cd67cf416371337b83cb9ca3f696277125703339 |
train | list_apis | List APIs in account. | gcdt/yugen_core.py | def list_apis(awsclient):
"""List APIs in account."""
client_api = awsclient.get_client('apigateway')
apis = client_api.get_rest_apis()['items']
for api in apis:
print(json2table(api)) | def list_apis(awsclient):
"""List APIs in account."""
client_api = awsclient.get_client('apigateway')
apis = client_api.get_rest_apis()['items']
for api in apis:
print(json2table(api)) | [
"List",
"APIs",
"in",
"account",
"."
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/yugen_core.py#L57-L64 | [
"def",
"list_apis",
"(",
"awsclient",
")",
":",
"client_api",
"=",
"awsclient",
".",
"get_client",
"(",
"'apigateway'",
")",
"apis",
"=",
"client_api",
".",
"get_rest_apis",
"(",
")",
"[",
"'items'",
"]",
"for",
"api",
"in",
"apis",
":",
"print",
"(",
"j... | cd67cf416371337b83cb9ca3f696277125703339 |
train | deploy_api | Deploy API Gateway to AWS cloud.
:param awsclient:
:param api_name:
:param api_description:
:param stage_name:
:param api_key:
:param lambdas:
:param cache_cluster_enabled:
:param cache_cluster_size:
:param method_settings: | gcdt/yugen_core.py | def deploy_api(awsclient, api_name, api_description, stage_name, api_key,
lambdas, cache_cluster_enabled, cache_cluster_size, method_settings=None):
"""Deploy API Gateway to AWS cloud.
:param awsclient:
:param api_name:
:param api_description:
:param stage_name:
:param api_key:
... | def deploy_api(awsclient, api_name, api_description, stage_name, api_key,
lambdas, cache_cluster_enabled, cache_cluster_size, method_settings=None):
"""Deploy API Gateway to AWS cloud.
:param awsclient:
:param api_name:
:param api_description:
:param stage_name:
:param api_key:
... | [
"Deploy",
"API",
"Gateway",
"to",
"AWS",
"cloud",
"."
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/yugen_core.py#L67-L113 | [
"def",
"deploy_api",
"(",
"awsclient",
",",
"api_name",
",",
"api_description",
",",
"stage_name",
",",
"api_key",
",",
"lambdas",
",",
"cache_cluster_enabled",
",",
"cache_cluster_size",
",",
"method_settings",
"=",
"None",
")",
":",
"if",
"not",
"_api_exists",
... | cd67cf416371337b83cb9ca3f696277125703339 |
train | delete_api | Delete the API.
:param api_name: | gcdt/yugen_core.py | def delete_api(awsclient, api_name):
"""Delete the API.
:param api_name:
"""
_sleep()
client_api = awsclient.get_client('apigateway')
print('deleting api: %s' % api_name)
api = _api_by_name(awsclient, api_name)
if api is not None:
print(json2table(api))
response = cli... | def delete_api(awsclient, api_name):
"""Delete the API.
:param api_name:
"""
_sleep()
client_api = awsclient.get_client('apigateway')
print('deleting api: %s' % api_name)
api = _api_by_name(awsclient, api_name)
if api is not None:
print(json2table(api))
response = cli... | [
"Delete",
"the",
"API",
"."
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/yugen_core.py#L116-L136 | [
"def",
"delete_api",
"(",
"awsclient",
",",
"api_name",
")",
":",
"_sleep",
"(",
")",
"client_api",
"=",
"awsclient",
".",
"get_client",
"(",
"'apigateway'",
")",
"print",
"(",
"'deleting api: %s'",
"%",
"api_name",
")",
"api",
"=",
"_api_by_name",
"(",
"aws... | cd67cf416371337b83cb9ca3f696277125703339 |
train | create_api_key | Create a new API key as reference for api.conf.
:param api_name:
:param api_key_name:
:return: api_key | gcdt/yugen_core.py | def create_api_key(awsclient, api_name, api_key_name):
"""Create a new API key as reference for api.conf.
:param api_name:
:param api_key_name:
:return: api_key
"""
_sleep()
client_api = awsclient.get_client('apigateway')
print('create api key: %s' % api_key_name)
response = client... | def create_api_key(awsclient, api_name, api_key_name):
"""Create a new API key as reference for api.conf.
:param api_name:
:param api_key_name:
:return: api_key
"""
_sleep()
client_api = awsclient.get_client('apigateway')
print('create api key: %s' % api_key_name)
response = client... | [
"Create",
"a",
"new",
"API",
"key",
"as",
"reference",
"for",
"api",
".",
"conf",
"."
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/yugen_core.py#L139-L159 | [
"def",
"create_api_key",
"(",
"awsclient",
",",
"api_name",
",",
"api_key_name",
")",
":",
"_sleep",
"(",
")",
"client_api",
"=",
"awsclient",
".",
"get_client",
"(",
"'apigateway'",
")",
"print",
"(",
"'create api key: %s'",
"%",
"api_key_name",
")",
"response"... | cd67cf416371337b83cb9ca3f696277125703339 |
train | delete_api_key | Remove API key.
:param api_key: | gcdt/yugen_core.py | def delete_api_key(awsclient, api_key):
"""Remove API key.
:param api_key:
"""
_sleep()
client_api = awsclient.get_client('apigateway')
print('delete api key: %s' % api_key)
response = client_api.delete_api_key(
apiKey=api_key
)
print(json2table(response)) | def delete_api_key(awsclient, api_key):
"""Remove API key.
:param api_key:
"""
_sleep()
client_api = awsclient.get_client('apigateway')
print('delete api key: %s' % api_key)
response = client_api.delete_api_key(
apiKey=api_key
)
print(json2table(response)) | [
"Remove",
"API",
"key",
"."
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/yugen_core.py#L162-L175 | [
"def",
"delete_api_key",
"(",
"awsclient",
",",
"api_key",
")",
":",
"_sleep",
"(",
")",
"client_api",
"=",
"awsclient",
".",
"get_client",
"(",
"'apigateway'",
")",
"print",
"(",
"'delete api key: %s'",
"%",
"api_key",
")",
"response",
"=",
"client_api",
".",... | cd67cf416371337b83cb9ca3f696277125703339 |
train | list_api_keys | Print the defined API keys. | gcdt/yugen_core.py | def list_api_keys(awsclient):
"""Print the defined API keys.
"""
_sleep()
client_api = awsclient.get_client('apigateway')
print('listing api keys')
response = client_api.get_api_keys()['items']
for item in response:
print(json2table(item)) | def list_api_keys(awsclient):
"""Print the defined API keys.
"""
_sleep()
client_api = awsclient.get_client('apigateway')
print('listing api keys')
response = client_api.get_api_keys()['items']
for item in response:
print(json2table(item)) | [
"Print",
"the",
"defined",
"API",
"keys",
"."
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/yugen_core.py#L178-L188 | [
"def",
"list_api_keys",
"(",
"awsclient",
")",
":",
"_sleep",
"(",
")",
"client_api",
"=",
"awsclient",
".",
"get_client",
"(",
"'apigateway'",
")",
"print",
"(",
"'listing api keys'",
")",
"response",
"=",
"client_api",
".",
"get_api_keys",
"(",
")",
"[",
"... | cd67cf416371337b83cb9ca3f696277125703339 |
train | deploy_custom_domain | Add custom domain to your API.
:param api_name:
:param api_target_stage:
:param api_base_path:
:param domain_name:
:param route_53_record:
:param ssl_cert:
:param cert_name:
:param cert_arn:
:param hosted_zone_id:
:return: exit_code | gcdt/yugen_core.py | def deploy_custom_domain(awsclient, api_name, api_target_stage,
api_base_path, domain_name, route_53_record,
cert_name, cert_arn, hosted_zone_id, ensure_cname):
"""Add custom domain to your API.
:param api_name:
:param api_target_stage:
:param api_base_... | def deploy_custom_domain(awsclient, api_name, api_target_stage,
api_base_path, domain_name, route_53_record,
cert_name, cert_arn, hosted_zone_id, ensure_cname):
"""Add custom domain to your API.
:param api_name:
:param api_target_stage:
:param api_base_... | [
"Add",
"custom",
"domain",
"to",
"your",
"API",
"."
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/yugen_core.py#L191-L249 | [
"def",
"deploy_custom_domain",
"(",
"awsclient",
",",
"api_name",
",",
"api_target_stage",
",",
"api_base_path",
",",
"domain_name",
",",
"route_53_record",
",",
"cert_name",
",",
"cert_arn",
",",
"hosted_zone_id",
",",
"ensure_cname",
")",
":",
"api_base_path",
"="... | cd67cf416371337b83cb9ca3f696277125703339 |
train | get_lambdas | Get the list of lambda functions.
:param config:
:param add_arn:
:return: list containing lambda entries | gcdt/yugen_core.py | def get_lambdas(awsclient, config, add_arn=False):
"""Get the list of lambda functions.
:param config:
:param add_arn:
:return: list containing lambda entries
"""
if 'lambda' in config:
client_lambda = awsclient.get_client('lambda')
lambda_entries = config['lambda'].get('entries... | def get_lambdas(awsclient, config, add_arn=False):
"""Get the list of lambda functions.
:param config:
:param add_arn:
:return: list containing lambda entries
"""
if 'lambda' in config:
client_lambda = awsclient.get_client('lambda')
lambda_entries = config['lambda'].get('entries... | [
"Get",
"the",
"list",
"of",
"lambda",
"functions",
"."
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/yugen_core.py#L252-L277 | [
"def",
"get_lambdas",
"(",
"awsclient",
",",
"config",
",",
"add_arn",
"=",
"False",
")",
":",
"if",
"'lambda'",
"in",
"config",
":",
"client_lambda",
"=",
"awsclient",
".",
"get_client",
"(",
"'lambda'",
")",
"lambda_entries",
"=",
"config",
"[",
"'lambda'"... | cd67cf416371337b83cb9ca3f696277125703339 |
train | _update_stage | Helper to apply method_settings to stage
:param awsclient:
:param api_id:
:param stage_name:
:param method_settings:
:return: | gcdt/yugen_core.py | def _update_stage(awsclient, api_id, stage_name, method_settings):
"""Helper to apply method_settings to stage
:param awsclient:
:param api_id:
:param stage_name:
:param method_settings:
:return:
"""
# settings docs in response: https://botocore.readthedocs.io/en/latest/reference/servic... | def _update_stage(awsclient, api_id, stage_name, method_settings):
"""Helper to apply method_settings to stage
:param awsclient:
:param api_id:
:param stage_name:
:param method_settings:
:return:
"""
# settings docs in response: https://botocore.readthedocs.io/en/latest/reference/servic... | [
"Helper",
"to",
"apply",
"method_settings",
"to",
"stage"
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/yugen_core.py#L461-L479 | [
"def",
"_update_stage",
"(",
"awsclient",
",",
"api_id",
",",
"stage_name",
",",
"method_settings",
")",
":",
"# settings docs in response: https://botocore.readthedocs.io/en/latest/reference/services/apigateway.html#APIGateway.Client.update_stage",
"client_api",
"=",
"awsclient",
".... | cd67cf416371337b83cb9ca3f696277125703339 |
train | _convert_method_settings_into_operations | Helper to handle the conversion of method_settings to operations
:param method_settings:
:return: list of operations | gcdt/yugen_core.py | def _convert_method_settings_into_operations(method_settings=None):
"""Helper to handle the conversion of method_settings to operations
:param method_settings:
:return: list of operations
"""
# operations docs here: https://tools.ietf.org/html/rfc6902#section-4
operations = []
if method_set... | def _convert_method_settings_into_operations(method_settings=None):
"""Helper to handle the conversion of method_settings to operations
:param method_settings:
:return: list of operations
"""
# operations docs here: https://tools.ietf.org/html/rfc6902#section-4
operations = []
if method_set... | [
"Helper",
"to",
"handle",
"the",
"conversion",
"of",
"method_settings",
"to",
"operations"
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/yugen_core.py#L503-L524 | [
"def",
"_convert_method_settings_into_operations",
"(",
"method_settings",
"=",
"None",
")",
":",
"# operations docs here: https://tools.ietf.org/html/rfc6902#section-4",
"operations",
"=",
"[",
"]",
"if",
"method_settings",
":",
"for",
"method",
"in",
"method_settings",
".",... | cd67cf416371337b83cb9ca3f696277125703339 |
train | generate_settings | This command is run when ``default_path`` doesn't exist, or ``init`` is
run and returns a string representing the default data to put into their
settings file. | salmon/core/runner.py | def generate_settings():
"""
This command is run when ``default_path`` doesn't exist, or ``init`` is
run and returns a string representing the default data to put into their
settings file.
"""
conf_file = os.path.join(os.path.dirname(base_settings.__file__),
'example... | def generate_settings():
"""
This command is run when ``default_path`` doesn't exist, or ``init`` is
run and returns a string representing the default data to put into their
settings file.
"""
conf_file = os.path.join(os.path.dirname(base_settings.__file__),
'example... | [
"This",
"command",
"is",
"run",
"when",
"default_path",
"doesn",
"t",
"exist",
"or",
"init",
"is",
"run",
"and",
"returns",
"a",
"string",
"representing",
"the",
"default",
"data",
"to",
"put",
"into",
"their",
"settings",
"file",
"."
] | lincolnloop/salmon | python | https://github.com/lincolnloop/salmon/blob/62a965ad9716707ea1db4afb5d9646766f29b64b/salmon/core/runner.py#L11-L28 | [
"def",
"generate_settings",
"(",
")",
":",
"conf_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"base_settings",
".",
"__file__",
")",
",",
"'example'",
",",
"'conf.py'",
")",
"conf_template",
"=",
"open",
"(",
... | 62a965ad9716707ea1db4afb5d9646766f29b64b |
train | configure_app | Builds up the settings using the same method as logan | salmon/core/runner.py | def configure_app(**kwargs):
"""Builds up the settings using the same method as logan"""
sys_args = sys.argv
args, command, command_args = parse_args(sys_args[1:])
parser = OptionParser()
parser.add_option('--config', metavar='CONFIG')
(options, logan_args) = parser.parse_args(args)
config_p... | def configure_app(**kwargs):
"""Builds up the settings using the same method as logan"""
sys_args = sys.argv
args, command, command_args = parse_args(sys_args[1:])
parser = OptionParser()
parser.add_option('--config', metavar='CONFIG')
(options, logan_args) = parser.parse_args(args)
config_p... | [
"Builds",
"up",
"the",
"settings",
"using",
"the",
"same",
"method",
"as",
"logan"
] | lincolnloop/salmon | python | https://github.com/lincolnloop/salmon/blob/62a965ad9716707ea1db4afb5d9646766f29b64b/salmon/core/runner.py#L42-L50 | [
"def",
"configure_app",
"(",
"*",
"*",
"kwargs",
")",
":",
"sys_args",
"=",
"sys",
".",
"argv",
"args",
",",
"command",
",",
"command_args",
"=",
"parse_args",
"(",
"sys_args",
"[",
"1",
":",
"]",
")",
"parser",
"=",
"OptionParser",
"(",
")",
"parser",... | 62a965ad9716707ea1db4afb5d9646766f29b64b |
train | Metric._reset_changes | Stores current values for comparison later | salmon/metrics/models.py | def _reset_changes(self):
"""Stores current values for comparison later"""
self._original = {}
if self.last_updated is not None:
self._original['last_updated'] = self.last_updated | def _reset_changes(self):
"""Stores current values for comparison later"""
self._original = {}
if self.last_updated is not None:
self._original['last_updated'] = self.last_updated | [
"Stores",
"current",
"values",
"for",
"comparison",
"later"
] | lincolnloop/salmon | python | https://github.com/lincolnloop/salmon/blob/62a965ad9716707ea1db4afb5d9646766f29b64b/salmon/metrics/models.py#L62-L66 | [
"def",
"_reset_changes",
"(",
"self",
")",
":",
"self",
".",
"_original",
"=",
"{",
"}",
"if",
"self",
".",
"last_updated",
"is",
"not",
"None",
":",
"self",
".",
"_original",
"[",
"'last_updated'",
"]",
"=",
"self",
".",
"last_updated"
] | 62a965ad9716707ea1db4afb5d9646766f29b64b |
train | Metric.whisper_filename | Build a file path to the Whisper database | salmon/metrics/models.py | def whisper_filename(self):
"""Build a file path to the Whisper database"""
source_name = self.source_id and self.source.name or ''
return get_valid_filename("{0}__{1}.wsp".format(source_name,
self.name)) | def whisper_filename(self):
"""Build a file path to the Whisper database"""
source_name = self.source_id and self.source.name or ''
return get_valid_filename("{0}__{1}.wsp".format(source_name,
self.name)) | [
"Build",
"a",
"file",
"path",
"to",
"the",
"Whisper",
"database"
] | lincolnloop/salmon | python | https://github.com/lincolnloop/salmon/blob/62a965ad9716707ea1db4afb5d9646766f29b64b/salmon/metrics/models.py#L69-L73 | [
"def",
"whisper_filename",
"(",
"self",
")",
":",
"source_name",
"=",
"self",
".",
"source_id",
"and",
"self",
".",
"source",
".",
"name",
"or",
"''",
"return",
"get_valid_filename",
"(",
"\"{0}__{1}.wsp\"",
".",
"format",
"(",
"source_name",
",",
"self",
".... | 62a965ad9716707ea1db4afb5d9646766f29b64b |
train | Metric.get_value_display | Human friendly value output | salmon/metrics/models.py | def get_value_display(self):
"""Human friendly value output"""
if self.display_as == 'percentage':
return '{0}%'.format(self.latest_value)
if self.display_as == 'boolean':
return bool(self.latest_value)
if self.display_as == 'byte':
return defaultfilte... | def get_value_display(self):
"""Human friendly value output"""
if self.display_as == 'percentage':
return '{0}%'.format(self.latest_value)
if self.display_as == 'boolean':
return bool(self.latest_value)
if self.display_as == 'byte':
return defaultfilte... | [
"Human",
"friendly",
"value",
"output"
] | lincolnloop/salmon | python | https://github.com/lincolnloop/salmon/blob/62a965ad9716707ea1db4afb5d9646766f29b64b/salmon/metrics/models.py#L95-L105 | [
"def",
"get_value_display",
"(",
"self",
")",
":",
"if",
"self",
".",
"display_as",
"==",
"'percentage'",
":",
"return",
"'{0}%'",
".",
"format",
"(",
"self",
".",
"latest_value",
")",
"if",
"self",
".",
"display_as",
"==",
"'boolean'",
":",
"return",
"boo... | 62a965ad9716707ea1db4afb5d9646766f29b64b |
train | Metric.time_between_updates | Time between current `last_updated` and previous `last_updated` | salmon/metrics/models.py | def time_between_updates(self):
"""Time between current `last_updated` and previous `last_updated`"""
if 'last_updated' not in self._original:
return 0
last_update = self._original['last_updated']
this_update = self.last_updated
return this_update - last_update | def time_between_updates(self):
"""Time between current `last_updated` and previous `last_updated`"""
if 'last_updated' not in self._original:
return 0
last_update = self._original['last_updated']
this_update = self.last_updated
return this_update - last_update | [
"Time",
"between",
"current",
"last_updated",
"and",
"previous",
"last_updated"
] | lincolnloop/salmon | python | https://github.com/lincolnloop/salmon/blob/62a965ad9716707ea1db4afb5d9646766f29b64b/salmon/metrics/models.py#L107-L113 | [
"def",
"time_between_updates",
"(",
"self",
")",
":",
"if",
"'last_updated'",
"not",
"in",
"self",
".",
"_original",
":",
"return",
"0",
"last_update",
"=",
"self",
".",
"_original",
"[",
"'last_updated'",
"]",
"this_update",
"=",
"self",
".",
"last_updated",
... | 62a965ad9716707ea1db4afb5d9646766f29b64b |
train | Metric.do_transform | Apply the transformation (if it exists) to the latest_value | salmon/metrics/models.py | def do_transform(self):
"""Apply the transformation (if it exists) to the latest_value"""
if not self.transform:
return
try:
self.latest_value = utils.Transform(
expr=self.transform, value=self.latest_value,
timedelta=self.time_between_upda... | def do_transform(self):
"""Apply the transformation (if it exists) to the latest_value"""
if not self.transform:
return
try:
self.latest_value = utils.Transform(
expr=self.transform, value=self.latest_value,
timedelta=self.time_between_upda... | [
"Apply",
"the",
"transformation",
"(",
"if",
"it",
"exists",
")",
"to",
"the",
"latest_value"
] | lincolnloop/salmon | python | https://github.com/lincolnloop/salmon/blob/62a965ad9716707ea1db4afb5d9646766f29b64b/salmon/metrics/models.py#L115-L126 | [
"def",
"do_transform",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"transform",
":",
"return",
"try",
":",
"self",
".",
"latest_value",
"=",
"utils",
".",
"Transform",
"(",
"expr",
"=",
"self",
".",
"transform",
",",
"value",
"=",
"self",
".",
"... | 62a965ad9716707ea1db4afb5d9646766f29b64b |
train | Metric.do_counter_conversion | Update latest value to the diff between it and the previous value | salmon/metrics/models.py | def do_counter_conversion(self):
"""Update latest value to the diff between it and the previous value"""
if self.is_counter:
if self._previous_counter_value is None:
prev_value = self.latest_value
else:
prev_value = self._previous_counter_value
... | def do_counter_conversion(self):
"""Update latest value to the diff between it and the previous value"""
if self.is_counter:
if self._previous_counter_value is None:
prev_value = self.latest_value
else:
prev_value = self._previous_counter_value
... | [
"Update",
"latest",
"value",
"to",
"the",
"diff",
"between",
"it",
"and",
"the",
"previous",
"value"
] | lincolnloop/salmon | python | https://github.com/lincolnloop/salmon/blob/62a965ad9716707ea1db4afb5d9646766f29b64b/salmon/metrics/models.py#L128-L136 | [
"def",
"do_counter_conversion",
"(",
"self",
")",
":",
"if",
"self",
".",
"is_counter",
":",
"if",
"self",
".",
"_previous_counter_value",
"is",
"None",
":",
"prev_value",
"=",
"self",
".",
"latest_value",
"else",
":",
"prev_value",
"=",
"self",
".",
"_previ... | 62a965ad9716707ea1db4afb5d9646766f29b64b |
train | InstanceSourceGroupRegistry.source_group_receiver | Relay source group signals to the appropriate spec strategy. | imagekit_cropper/registry.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
# Ignore signals from unregistered groups.
if source_gro... | def source_group_receiver(self, sender, source, signal, **kwargs):
"""
Relay source group signals to the appropriate spec strategy.
"""
from imagekit.cachefiles import ImageCacheFile
source_group = sender
# Ignore signals from unregistered groups.
if source_gro... | [
"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/registry.py#L46-L68 | [
"def",
"source_group_receiver",
"(",
"self",
",",
"sender",
",",
"source",
",",
"signal",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
"imagekit",
".",
"cachefiles",
"import",
"ImageCacheFile",
"source_group",
"=",
"sender",
"# Ignore signals from unregistered groups.... | c1c2dc5c3c4724492052e5d244e9de1cc362dbcc |
train | Transform.replace_variable | Substitute variables with numeric values | salmon/metrics/utils.py | def replace_variable(self, variable):
"""Substitute variables with numeric values"""
if variable == 'x':
return self.value
if variable == 't':
return self.timedelta
raise ValueError("Invalid variable %s", variable) | def replace_variable(self, variable):
"""Substitute variables with numeric values"""
if variable == 'x':
return self.value
if variable == 't':
return self.timedelta
raise ValueError("Invalid variable %s", variable) | [
"Substitute",
"variables",
"with",
"numeric",
"values"
] | lincolnloop/salmon | python | https://github.com/lincolnloop/salmon/blob/62a965ad9716707ea1db4afb5d9646766f29b64b/salmon/metrics/utils.py#L17-L23 | [
"def",
"replace_variable",
"(",
"self",
",",
"variable",
")",
":",
"if",
"variable",
"==",
"'x'",
":",
"return",
"self",
".",
"value",
"if",
"variable",
"==",
"'t'",
":",
"return",
"self",
".",
"timedelta",
"raise",
"ValueError",
"(",
"\"Invalid variable %s\... | 62a965ad9716707ea1db4afb5d9646766f29b64b |
train | Transform.result | Evaluate expression and return result | salmon/metrics/utils.py | def result(self):
"""Evaluate expression and return result"""
# Module(body=[Expr(value=...)])
return self.eval_(ast.parse(self.expr).body[0].value) | def result(self):
"""Evaluate expression and return result"""
# Module(body=[Expr(value=...)])
return self.eval_(ast.parse(self.expr).body[0].value) | [
"Evaluate",
"expression",
"and",
"return",
"result"
] | lincolnloop/salmon | python | https://github.com/lincolnloop/salmon/blob/62a965ad9716707ea1db4afb5d9646766f29b64b/salmon/metrics/utils.py#L25-L28 | [
"def",
"result",
"(",
"self",
")",
":",
"# Module(body=[Expr(value=...)])",
"return",
"self",
".",
"eval_",
"(",
"ast",
".",
"parse",
"(",
"self",
".",
"expr",
")",
".",
"body",
"[",
"0",
"]",
".",
"value",
")"
] | 62a965ad9716707ea1db4afb5d9646766f29b64b |
train | People.get_people | 获取用户信息
:param user_alias: 用户ID
:return: | dbapi/People.py | def get_people(self, user_alias=None):
"""
获取用户信息
:param user_alias: 用户ID
:return:
"""
user_alias = user_alias or self.api.user_alias
content = self.api.req(API_PEOPLE_HOME % user_alias).content
xml = self.api.to_xml(re.sub(b'<br />', b'\n', cont... | def get_people(self, user_alias=None):
"""
获取用户信息
:param user_alias: 用户ID
:return:
"""
user_alias = user_alias or self.api.user_alias
content = self.api.req(API_PEOPLE_HOME % user_alias).content
xml = self.api.to_xml(re.sub(b'<br />', b'\n', cont... | [
"获取用户信息",
":",
"param",
"user_alias",
":",
"用户ID",
":",
"return",
":"
] | acrazing/dbapi | python | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/People.py#L16-L59 | [
"def",
"get_people",
"(",
"self",
",",
"user_alias",
"=",
"None",
")",
":",
"user_alias",
"=",
"user_alias",
"or",
"self",
".",
"api",
".",
"user_alias",
"content",
"=",
"self",
".",
"api",
".",
"req",
"(",
"API_PEOPLE_HOME",
"%",
"user_alias",
")",
".",... | 8c1f85cb1a051daf7be1fc97a62c4499983e9898 |
train | email_login | Given a request, an email and optionally some additional data, ensure that
a user with the email address exists, and authenticate & login them right
away if the user is active.
Returns a tuple consisting of ``(user, created)`` upon success or ``(None,
None)`` when authentication fails. | authlib/views.py | def email_login(request, *, email, **kwargs):
"""
Given a request, an email and optionally some additional data, ensure that
a user with the email address exists, and authenticate & login them right
away if the user is active.
Returns a tuple consisting of ``(user, created)`` upon success or ``(Non... | def email_login(request, *, email, **kwargs):
"""
Given a request, an email and optionally some additional data, ensure that
a user with the email address exists, and authenticate & login them right
away if the user is active.
Returns a tuple consisting of ``(user, created)`` upon success or ``(Non... | [
"Given",
"a",
"request",
"an",
"email",
"and",
"optionally",
"some",
"additional",
"data",
"ensure",
"that",
"a",
"user",
"with",
"the",
"email",
"address",
"exists",
"and",
"authenticate",
"&",
"login",
"them",
"right",
"away",
"if",
"the",
"user",
"is",
... | matthiask/django-authlib | python | https://github.com/matthiask/django-authlib/blob/a142da7e27fe9d30f34a84b12f24f686f9d2c8e1/authlib/views.py#L54-L68 | [
"def",
"email_login",
"(",
"request",
",",
"*",
",",
"email",
",",
"*",
"*",
"kwargs",
")",
":",
"_u",
",",
"created",
"=",
"auth",
".",
"get_user_model",
"(",
")",
".",
"_default_manager",
".",
"get_or_create",
"(",
"email",
"=",
"email",
")",
"user",... | a142da7e27fe9d30f34a84b12f24f686f9d2c8e1 |
train | dashboard | Shows the latest results for each source | salmon/metrics/views.py | def dashboard(request):
"""Shows the latest results for each source"""
sources = (models.Source.objects.all().prefetch_related('metric_set')
.order_by('name'))
metrics = SortedDict([(src, src.metric_set.all()) for src in sources])
no_source_metrics = models.Metr... | def dashboard(request):
"""Shows the latest results for each source"""
sources = (models.Source.objects.all().prefetch_related('metric_set')
.order_by('name'))
metrics = SortedDict([(src, src.metric_set.all()) for src in sources])
no_source_metrics = models.Metr... | [
"Shows",
"the",
"latest",
"results",
"for",
"each",
"source"
] | lincolnloop/salmon | python | https://github.com/lincolnloop/salmon/blob/62a965ad9716707ea1db4afb5d9646766f29b64b/salmon/metrics/views.py#L32-L48 | [
"def",
"dashboard",
"(",
"request",
")",
":",
"sources",
"=",
"(",
"models",
".",
"Source",
".",
"objects",
".",
"all",
"(",
")",
".",
"prefetch_related",
"(",
"'metric_set'",
")",
".",
"order_by",
"(",
"'name'",
")",
")",
"metrics",
"=",
"SortedDict",
... | 62a965ad9716707ea1db4afb5d9646766f29b64b |
train | WhisperDatabase._create | Create the Whisper file on disk | salmon/core/graph.py | def _create(self):
"""Create the Whisper file on disk"""
if not os.path.exists(settings.SALMON_WHISPER_DB_PATH):
os.makedirs(settings.SALMON_WHISPER_DB_PATH)
archives = [whisper.parseRetentionDef(retentionDef)
for retentionDef in settings.ARCHIVES.split(",")]
... | def _create(self):
"""Create the Whisper file on disk"""
if not os.path.exists(settings.SALMON_WHISPER_DB_PATH):
os.makedirs(settings.SALMON_WHISPER_DB_PATH)
archives = [whisper.parseRetentionDef(retentionDef)
for retentionDef in settings.ARCHIVES.split(",")]
... | [
"Create",
"the",
"Whisper",
"file",
"on",
"disk"
] | lincolnloop/salmon | python | https://github.com/lincolnloop/salmon/blob/62a965ad9716707ea1db4afb5d9646766f29b64b/salmon/core/graph.py#L18-L26 | [
"def",
"_create",
"(",
"self",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"settings",
".",
"SALMON_WHISPER_DB_PATH",
")",
":",
"os",
".",
"makedirs",
"(",
"settings",
".",
"SALMON_WHISPER_DB_PATH",
")",
"archives",
"=",
"[",
"whisper",
... | 62a965ad9716707ea1db4afb5d9646766f29b64b |
train | WhisperDatabase._update | This method store in the datapoints in the current database.
:datapoints: is a list of tupple with the epoch timestamp and value
[(1368977629,10)] | salmon/core/graph.py | def _update(self, datapoints):
"""
This method store in the datapoints in the current database.
:datapoints: is a list of tupple with the epoch timestamp and value
[(1368977629,10)]
"""
if len(datapoints) == 1:
timestamp, value = datapoints[0]
... | def _update(self, datapoints):
"""
This method store in the datapoints in the current database.
:datapoints: is a list of tupple with the epoch timestamp and value
[(1368977629,10)]
"""
if len(datapoints) == 1:
timestamp, value = datapoints[0]
... | [
"This",
"method",
"store",
"in",
"the",
"datapoints",
"in",
"the",
"current",
"database",
"."
] | lincolnloop/salmon | python | https://github.com/lincolnloop/salmon/blob/62a965ad9716707ea1db4afb5d9646766f29b64b/salmon/core/graph.py#L31-L42 | [
"def",
"_update",
"(",
"self",
",",
"datapoints",
")",
":",
"if",
"len",
"(",
"datapoints",
")",
"==",
"1",
":",
"timestamp",
",",
"value",
"=",
"datapoints",
"[",
"0",
"]",
"whisper",
".",
"update",
"(",
"self",
".",
"path",
",",
"value",
",",
"ti... | 62a965ad9716707ea1db4afb5d9646766f29b64b |
train | WhisperDatabase.fetch | This method fetch data from the database according to the period
given
fetch(path, fromTime, untilTime=None)
fromTime is an datetime
untilTime is also an datetime, but defaults to now.
Returns a tuple of (timeInfo, valueList)
where timeInfo is itself a tuple of (fromTi... | salmon/core/graph.py | def fetch(self, from_time, until_time=None):
"""
This method fetch data from the database according to the period
given
fetch(path, fromTime, untilTime=None)
fromTime is an datetime
untilTime is also an datetime, but defaults to now.
Returns a tuple of (timeInf... | def fetch(self, from_time, until_time=None):
"""
This method fetch data from the database according to the period
given
fetch(path, fromTime, untilTime=None)
fromTime is an datetime
untilTime is also an datetime, but defaults to now.
Returns a tuple of (timeInf... | [
"This",
"method",
"fetch",
"data",
"from",
"the",
"database",
"according",
"to",
"the",
"period",
"given"
] | lincolnloop/salmon | python | https://github.com/lincolnloop/salmon/blob/62a965ad9716707ea1db4afb5d9646766f29b64b/salmon/core/graph.py#L44-L70 | [
"def",
"fetch",
"(",
"self",
",",
"from_time",
",",
"until_time",
"=",
"None",
")",
":",
"until_time",
"=",
"until_time",
"or",
"datetime",
".",
"now",
"(",
")",
"time_info",
",",
"values",
"=",
"whisper",
".",
"fetch",
"(",
"self",
".",
"path",
",",
... | 62a965ad9716707ea1db4afb5d9646766f29b64b |
train | build_list_result | 构建带翻页的列表
:param results: 已获取的数据列表
:param xml: 原始页面xml
:return: {'results': list, 'count': int, 'next_start': int|None}
如果count与results长度不同,则有更多
如果next_start不为None,则可以到下一页 | dbapi/utils.py | def build_list_result(results, xml):
"""
构建带翻页的列表
:param results: 已获取的数据列表
:param xml: 原始页面xml
:return: {'results': list, 'count': int, 'next_start': int|None}
如果count与results长度不同,则有更多
如果next_start不为None,则可以到下一页
"""
xml_count = xml.xpath('//div[@class="paginator"... | def build_list_result(results, xml):
"""
构建带翻页的列表
:param results: 已获取的数据列表
:param xml: 原始页面xml
:return: {'results': list, 'count': int, 'next_start': int|None}
如果count与results长度不同,则有更多
如果next_start不为None,则可以到下一页
"""
xml_count = xml.xpath('//div[@class="paginator"... | [
"构建带翻页的列表",
":",
"param",
"results",
":",
"已获取的数据列表",
":",
"param",
"xml",
":",
"原始页面xml",
":",
"return",
":",
"{",
"results",
":",
"list",
"count",
":",
"int",
"next_start",
":",
"int|None",
"}",
"如果count与results长度不同,则有更多",
"如果next_start不为None,则可以到下一页"
] | acrazing/dbapi | python | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/utils.py#L25-L39 | [
"def",
"build_list_result",
"(",
"results",
",",
"xml",
")",
":",
"xml_count",
"=",
"xml",
".",
"xpath",
"(",
"'//div[@class=\"paginator\"]/span[@class=\"count\"]/text()'",
")",
"xml_next",
"=",
"xml",
".",
"xpath",
"(",
"'//div[@class=\"paginator\"]/span[@class=\"next\"]... | 8c1f85cb1a051daf7be1fc97a62c4499983e9898 |
train | Arithmetic.ADCS | ADCS [Ra,] Rb, Rc
Add Rb and Rc + the carry bit and store the result in Ra
Ra, Rb, and Rc must be low registers
if Ra is omitted, then it is assumed to be Rb | iarm/arm_instructions/arithmetic.py | def ADCS(self, params):
"""
ADCS [Ra,] Rb, Rc
Add Rb and Rc + the carry bit and store the result in Ra
Ra, Rb, and Rc must be low registers
if Ra is omitted, then it is assumed to be Rb
"""
# This instruction allows for an optional destination register
# ... | def ADCS(self, params):
"""
ADCS [Ra,] Rb, Rc
Add Rb and Rc + the carry bit and store the result in Ra
Ra, Rb, and Rc must be low registers
if Ra is omitted, then it is assumed to be Rb
"""
# This instruction allows for an optional destination register
# ... | [
"ADCS",
"[",
"Ra",
"]",
"Rb",
"Rc"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/arithmetic.py#L6-L35 | [
"def",
"ADCS",
"(",
"self",
",",
"params",
")",
":",
"# This instruction allows for an optional destination register",
"# If it is omitted, then it is assumed to be Rb",
"# As defined in http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0662b/index.html",
"try",
":",
"Ra",
"... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | Arithmetic.ADD | ADD [Rx,] Ry, [Rz, PC]
ADD [Rx,] [SP, PC], #imm10_4
ADD [SP,] SP, #imm9_4
Add Ry and Rz and store the result in Rx
Rx, Ry, and Rz can be any register
If Rx is omitted, then it is assumed to be Ry | iarm/arm_instructions/arithmetic.py | def ADD(self, params):
"""
ADD [Rx,] Ry, [Rz, PC]
ADD [Rx,] [SP, PC], #imm10_4
ADD [SP,] SP, #imm9_4
Add Ry and Rz and store the result in Rx
Rx, Ry, and Rz can be any register
If Rx is omitted, then it is assumed to be Ry
"""
# This instruction a... | def ADD(self, params):
"""
ADD [Rx,] Ry, [Rz, PC]
ADD [Rx,] [SP, PC], #imm10_4
ADD [SP,] SP, #imm9_4
Add Ry and Rz and store the result in Rx
Rx, Ry, and Rz can be any register
If Rx is omitted, then it is assumed to be Ry
"""
# This instruction a... | [
"ADD",
"[",
"Rx",
"]",
"Ry",
"[",
"Rz",
"PC",
"]",
"ADD",
"[",
"Rx",
"]",
"[",
"SP",
"PC",
"]",
"#imm10_4",
"ADD",
"[",
"SP",
"]",
"SP",
"#imm9_4"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/arithmetic.py#L37-L80 | [
"def",
"ADD",
"(",
"self",
",",
"params",
")",
":",
"# This instruction allows for an optional destination register",
"# If it is omitted, then it is assumed to be Rb",
"# As defined in http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0662b/index.html",
"# TODO can we have ADD SP... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | Arithmetic.CMN | CMN Ra, Rb
Add the two registers and set the NZCV flags
The result is discarded
Ra and Rb must be low registers | iarm/arm_instructions/arithmetic.py | def CMN(self, params):
"""
CMN Ra, Rb
Add the two registers and set the NZCV flags
The result is discarded
Ra and Rb must be low registers
"""
Ra, Rb = self.get_two_parameters(self.TWO_PARAMETER_COMMA_SEPARATED, params)
self.check_arguments(low_registers... | def CMN(self, params):
"""
CMN Ra, Rb
Add the two registers and set the NZCV flags
The result is discarded
Ra and Rb must be low registers
"""
Ra, Rb = self.get_two_parameters(self.TWO_PARAMETER_COMMA_SEPARATED, params)
self.check_arguments(low_registers... | [
"CMN",
"Ra",
"Rb"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/arithmetic.py#L132-L149 | [
"def",
"CMN",
"(",
"self",
",",
"params",
")",
":",
"Ra",
",",
"Rb",
"=",
"self",
".",
"get_two_parameters",
"(",
"self",
".",
"TWO_PARAMETER_COMMA_SEPARATED",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"low_registers",
"=",
"(",
"Ra",
",",
... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | Arithmetic.CMP | CMP Rm, Rn
CMP Rm, #imm8
Subtract Rn or imm8 from Rm, set the NZCV flags, and discard the result
Rm and Rn can be R0-R14 | iarm/arm_instructions/arithmetic.py | def CMP(self, params):
"""
CMP Rm, Rn
CMP Rm, #imm8
Subtract Rn or imm8 from Rm, set the NZCV flags, and discard the result
Rm and Rn can be R0-R14
"""
Rm, Rn = self.get_two_parameters(self.TWO_PARAMETER_COMMA_SEPARATED, params)
if self.is_register(Rn):
... | def CMP(self, params):
"""
CMP Rm, Rn
CMP Rm, #imm8
Subtract Rn or imm8 from Rm, set the NZCV flags, and discard the result
Rm and Rn can be R0-R14
"""
Rm, Rn = self.get_two_parameters(self.TWO_PARAMETER_COMMA_SEPARATED, params)
if self.is_register(Rn):
... | [
"CMP",
"Rm",
"Rn",
"CMP",
"Rm",
"#imm8"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/arithmetic.py#L151-L177 | [
"def",
"CMP",
"(",
"self",
",",
"params",
")",
":",
"Rm",
",",
"Rn",
"=",
"self",
".",
"get_two_parameters",
"(",
"self",
".",
"TWO_PARAMETER_COMMA_SEPARATED",
",",
"params",
")",
"if",
"self",
".",
"is_register",
"(",
"Rn",
")",
":",
"# CMP Rm, Rn",
"se... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | Arithmetic.MULS | MULS Ra, Rb, Ra
Multiply Rb and Ra together and store the result in Ra.
Set the NZ flags.
Ra and Rb must be low registers
The first and last operand must be the same register | iarm/arm_instructions/arithmetic.py | def MULS(self, params):
"""
MULS Ra, Rb, Ra
Multiply Rb and Ra together and store the result in Ra.
Set the NZ flags.
Ra and Rb must be low registers
The first and last operand must be the same register
"""
Ra, Rb, Rc = self.get_three_parameters(self.THRE... | def MULS(self, params):
"""
MULS Ra, Rb, Ra
Multiply Rb and Ra together and store the result in Ra.
Set the NZ flags.
Ra and Rb must be low registers
The first and last operand must be the same register
"""
Ra, Rb, Rc = self.get_three_parameters(self.THRE... | [
"MULS",
"Ra",
"Rb",
"Ra"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/arithmetic.py#L179-L199 | [
"def",
"MULS",
"(",
"self",
",",
"params",
")",
":",
"Ra",
",",
"Rb",
",",
"Rc",
"=",
"self",
".",
"get_three_parameters",
"(",
"self",
".",
"THREE_PARAMETER_COMMA_SEPARATED",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"low_registers",
"=",
"... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | Arithmetic.RSBS | RSBS [Ra,] Rb, #0
Subtract Rb from zero (0 - Rb) and store the result in Ra
Set the NZCV flags
Ra and Rb must be low registers
if Ra is omitted, then it is assumed to be Rb | iarm/arm_instructions/arithmetic.py | def RSBS(self, params):
"""
RSBS [Ra,] Rb, #0
Subtract Rb from zero (0 - Rb) and store the result in Ra
Set the NZCV flags
Ra and Rb must be low registers
if Ra is omitted, then it is assumed to be Rb
"""
# This instruction allows for an optional destinat... | def RSBS(self, params):
"""
RSBS [Ra,] Rb, #0
Subtract Rb from zero (0 - Rb) and store the result in Ra
Set the NZCV flags
Ra and Rb must be low registers
if Ra is omitted, then it is assumed to be Rb
"""
# This instruction allows for an optional destinat... | [
"RSBS",
"[",
"Ra",
"]",
"Rb",
"#0"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/arithmetic.py#L212-L240 | [
"def",
"RSBS",
"(",
"self",
",",
"params",
")",
":",
"# This instruction allows for an optional destination register",
"# If it is omitted, then it is assumed to be Rb",
"# As defined in http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0662b/index.html",
"try",
":",
"Ra",
"... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | Arithmetic.SUB | SUB [SP,] SP, #imm9_4
Subtract an immediate from the Stack Pointer
The first SP is optional | iarm/arm_instructions/arithmetic.py | def SUB(self, params):
"""
SUB [SP,] SP, #imm9_4
Subtract an immediate from the Stack Pointer
The first SP is optional
"""
# This instruction allows for an optional destination register
# If it is omitted, then it is assumed to be Rb
# As defined in http:... | def SUB(self, params):
"""
SUB [SP,] SP, #imm9_4
Subtract an immediate from the Stack Pointer
The first SP is optional
"""
# This instruction allows for an optional destination register
# If it is omitted, then it is assumed to be Rb
# As defined in http:... | [
"SUB",
"[",
"SP",
"]",
"SP",
"#imm9_4"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/arithmetic.py#L273-L299 | [
"def",
"SUB",
"(",
"self",
",",
"params",
")",
":",
"# This instruction allows for an optional destination register",
"# If it is omitted, then it is assumed to be Rb",
"# As defined in http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0662b/index.html",
"try",
":",
"Ra",
",... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | Arithmetic.SUBS | SUBS [Ra,] Rb, Rc
SUBS [Ra,] Rb, #imm3
SUBS [Ra,] Ra, #imm8
Subtract Rc or an immediate from Rb and store the result in Ra
Ra, Rb, and Rc must be low registers
If Ra is omitted, then it is assumed to be Rb | iarm/arm_instructions/arithmetic.py | def SUBS(self, params):
"""
SUBS [Ra,] Rb, Rc
SUBS [Ra,] Rb, #imm3
SUBS [Ra,] Ra, #imm8
Subtract Rc or an immediate from Rb and store the result in Ra
Ra, Rb, and Rc must be low registers
If Ra is omitted, then it is assumed to be Rb
"""
# This in... | def SUBS(self, params):
"""
SUBS [Ra,] Rb, Rc
SUBS [Ra,] Rb, #imm3
SUBS [Ra,] Ra, #imm8
Subtract Rc or an immediate from Rb and store the result in Ra
Ra, Rb, and Rc must be low registers
If Ra is omitted, then it is assumed to be Rb
"""
# This in... | [
"SUBS",
"[",
"Ra",
"]",
"Rb",
"Rc",
"SUBS",
"[",
"Ra",
"]",
"Rb",
"#imm3",
"SUBS",
"[",
"Ra",
"]",
"Ra",
"#imm8"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/arithmetic.py#L301-L347 | [
"def",
"SUBS",
"(",
"self",
",",
"params",
")",
":",
"# This instruction allows for an optional destination register",
"# If it is omitted, then it is assumed to be Rb",
"# As defined in http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0662b/index.html",
"try",
":",
"Ra",
"... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | initialize | Adds SERVICE_NAME, SERVICE_ENVIRONMENT, and DEFAULT_TAGS to the template
:param template:
:param service_name:
:param environment:
:return: | gcdt/kumo_particle_helper.py | def initialize(template, service_name, environment='dev'):
"""Adds SERVICE_NAME, SERVICE_ENVIRONMENT, and DEFAULT_TAGS to the template
:param template:
:param service_name:
:param environment:
:return:
"""
template.SERVICE_NAME = os.getenv('SERVICE_NAME', service_name)
template.SERVICE_... | def initialize(template, service_name, environment='dev'):
"""Adds SERVICE_NAME, SERVICE_ENVIRONMENT, and DEFAULT_TAGS to the template
:param template:
:param service_name:
:param environment:
:return:
"""
template.SERVICE_NAME = os.getenv('SERVICE_NAME', service_name)
template.SERVICE_... | [
"Adds",
"SERVICE_NAME",
"SERVICE_ENVIRONMENT",
"and",
"DEFAULT_TAGS",
"to",
"the",
"template"
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/kumo_particle_helper.py#L14-L29 | [
"def",
"initialize",
"(",
"template",
",",
"service_name",
",",
"environment",
"=",
"'dev'",
")",
":",
"template",
".",
"SERVICE_NAME",
"=",
"os",
".",
"getenv",
"(",
"'SERVICE_NAME'",
",",
"service_name",
")",
"template",
".",
"SERVICE_ENVIRONMENT",
"=",
"os"... | cd67cf416371337b83cb9ca3f696277125703339 |
train | get_dist | Get dist for installed version of dist_name avoiding pkg_resources cache | gcdt/package_utils.py | def get_dist(dist_name, lookup_dirs=None):
"""Get dist for installed version of dist_name avoiding pkg_resources cache
"""
# note: based on pip/utils/__init__.py, get_installed_version(...)
# Create a requirement that we'll look for inside of setuptools.
req = pkg_resources.Requirement.parse(dist_n... | def get_dist(dist_name, lookup_dirs=None):
"""Get dist for installed version of dist_name avoiding pkg_resources cache
"""
# note: based on pip/utils/__init__.py, get_installed_version(...)
# Create a requirement that we'll look for inside of setuptools.
req = pkg_resources.Requirement.parse(dist_n... | [
"Get",
"dist",
"for",
"installed",
"version",
"of",
"dist_name",
"avoiding",
"pkg_resources",
"cache"
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/package_utils.py#L8-L24 | [
"def",
"get_dist",
"(",
"dist_name",
",",
"lookup_dirs",
"=",
"None",
")",
":",
"# note: based on pip/utils/__init__.py, get_installed_version(...)",
"# Create a requirement that we'll look for inside of setuptools.",
"req",
"=",
"pkg_resources",
".",
"Requirement",
".",
"parse",... | cd67cf416371337b83cb9ca3f696277125703339 |
train | get_package_versions | Get the package version information (=SetuptoolsVersion) which is
comparable.
note: we use the pip list_command implementation for this
:param package: name of the package
:return: installed version, latest available version | gcdt/package_utils.py | def get_package_versions(package):
"""Get the package version information (=SetuptoolsVersion) which is
comparable.
note: we use the pip list_command implementation for this
:param package: name of the package
:return: installed version, latest available version
"""
list_command = ListComma... | def get_package_versions(package):
"""Get the package version information (=SetuptoolsVersion) which is
comparable.
note: we use the pip list_command implementation for this
:param package: name of the package
:return: installed version, latest available version
"""
list_command = ListComma... | [
"Get",
"the",
"package",
"version",
"information",
"(",
"=",
"SetuptoolsVersion",
")",
"which",
"is",
"comparable",
".",
"note",
":",
"we",
"use",
"the",
"pip",
"list_command",
"implementation",
"for",
"this"
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/package_utils.py#L27-L43 | [
"def",
"get_package_versions",
"(",
"package",
")",
":",
"list_command",
"=",
"ListCommand",
"(",
")",
"options",
",",
"args",
"=",
"list_command",
".",
"parse_args",
"(",
"[",
"]",
")",
"packages",
"=",
"[",
"get_dist",
"(",
"package",
")",
"]",
"dists",
... | cd67cf416371337b83cb9ca3f696277125703339 |
train | _load_hooks | Load hook module and register signals.
:param path: Absolute or relative path to module.
:return: module | gcdt/gcdt_lifecycle.py | def _load_hooks(path):
"""Load hook module and register signals.
:param path: Absolute or relative path to module.
:return: module
"""
module = imp.load_source(os.path.splitext(os.path.basename(path))[0], path)
if not check_hook_mechanism_is_intact(module):
# no hooks - do nothing
... | def _load_hooks(path):
"""Load hook module and register signals.
:param path: Absolute or relative path to module.
:return: module
"""
module = imp.load_source(os.path.splitext(os.path.basename(path))[0], path)
if not check_hook_mechanism_is_intact(module):
# no hooks - do nothing
... | [
"Load",
"hook",
"module",
"and",
"register",
"signals",
"."
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/gcdt_lifecycle.py#L29-L43 | [
"def",
"_load_hooks",
"(",
"path",
")",
":",
"module",
"=",
"imp",
".",
"load_source",
"(",
"os",
".",
"path",
".",
"splitext",
"(",
"os",
".",
"path",
".",
"basename",
"(",
"path",
")",
")",
"[",
"0",
"]",
",",
"path",
")",
"if",
"not",
"check_h... | cd67cf416371337b83cb9ca3f696277125703339 |
train | lifecycle | Tool lifecycle which provides hooks into the different stages of the
command execution. See signals for hook details. | gcdt/gcdt_lifecycle.py | def lifecycle(awsclient, env, tool, command, arguments):
"""Tool lifecycle which provides hooks into the different stages of the
command execution. See signals for hook details.
"""
log.debug('### init')
load_plugins()
context = get_context(awsclient, env, tool, command, arguments)
# every t... | def lifecycle(awsclient, env, tool, command, arguments):
"""Tool lifecycle which provides hooks into the different stages of the
command execution. See signals for hook details.
"""
log.debug('### init')
load_plugins()
context = get_context(awsclient, env, tool, command, arguments)
# every t... | [
"Tool",
"lifecycle",
"which",
"provides",
"hooks",
"into",
"the",
"different",
"stages",
"of",
"the",
"command",
"execution",
".",
"See",
"signals",
"for",
"hook",
"details",
"."
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/gcdt_lifecycle.py#L48-L171 | [
"def",
"lifecycle",
"(",
"awsclient",
",",
"env",
",",
"tool",
",",
"command",
",",
"arguments",
")",
":",
"log",
".",
"debug",
"(",
"'### init'",
")",
"load_plugins",
"(",
")",
"context",
"=",
"get_context",
"(",
"awsclient",
",",
"env",
",",
"tool",
... | cd67cf416371337b83cb9ca3f696277125703339 |
train | main | gcdt tools parametrized main function to initiate gcdt lifecycle.
:param doc: docopt string
:param tool: gcdt tool (gcdt, kumo, tenkai, ramuda, yugen)
:param dispatch_only: list of commands which do not use gcdt lifecycle
:return: exit_code | gcdt/gcdt_lifecycle.py | def main(doc, tool, dispatch_only=None):
"""gcdt tools parametrized main function to initiate gcdt lifecycle.
:param doc: docopt string
:param tool: gcdt tool (gcdt, kumo, tenkai, ramuda, yugen)
:param dispatch_only: list of commands which do not use gcdt lifecycle
:return: exit_code
"""
# ... | def main(doc, tool, dispatch_only=None):
"""gcdt tools parametrized main function to initiate gcdt lifecycle.
:param doc: docopt string
:param tool: gcdt tool (gcdt, kumo, tenkai, ramuda, yugen)
:param dispatch_only: list of commands which do not use gcdt lifecycle
:return: exit_code
"""
# ... | [
"gcdt",
"tools",
"parametrized",
"main",
"function",
"to",
"initiate",
"gcdt",
"lifecycle",
"."
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/gcdt_lifecycle.py#L174-L217 | [
"def",
"main",
"(",
"doc",
",",
"tool",
",",
"dispatch_only",
"=",
"None",
")",
":",
"# Use signal handler to throw exception which can be caught to allow",
"# graceful exit.",
"# here: https://stackoverflow.com/questions/26414704/how-does-a-python-process-exit-gracefully-after-receiving... | cd67cf416371337b83cb9ca3f696277125703339 |
train | DataMovement.MOV | MOV Rx, Ry
MOV PC, Ry
Move the value of Ry into Rx or PC | iarm/arm_instructions/data_movement.py | def MOV(self, params):
"""
MOV Rx, Ry
MOV PC, Ry
Move the value of Ry into Rx or PC
"""
Rx, Ry = self.get_two_parameters(self.TWO_PARAMETER_COMMA_SEPARATED, params)
self.check_arguments(any_registers=(Rx, Ry))
def MOV_func():
self.register[R... | def MOV(self, params):
"""
MOV Rx, Ry
MOV PC, Ry
Move the value of Ry into Rx or PC
"""
Rx, Ry = self.get_two_parameters(self.TWO_PARAMETER_COMMA_SEPARATED, params)
self.check_arguments(any_registers=(Rx, Ry))
def MOV_func():
self.register[R... | [
"MOV",
"Rx",
"Ry",
"MOV",
"PC",
"Ry"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/data_movement.py#L11-L25 | [
"def",
"MOV",
"(",
"self",
",",
"params",
")",
":",
"Rx",
",",
"Ry",
"=",
"self",
".",
"get_two_parameters",
"(",
"self",
".",
"TWO_PARAMETER_COMMA_SEPARATED",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"any_registers",
"=",
"(",
"Rx",
",",
... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | DataMovement.MOVS | MOVS Ra, Rb
MOVS Ra, #imm8
Move the value of Rb or imm8 into Ra
Ra and Rb must be low registers | iarm/arm_instructions/data_movement.py | def MOVS(self, params):
"""
MOVS Ra, Rb
MOVS Ra, #imm8
Move the value of Rb or imm8 into Ra
Ra and Rb must be low registers
"""
Ra, Rb = self.get_two_parameters(self.TWO_PARAMETER_COMMA_SEPARATED, params)
if self.is_immediate(Rb):
self.check_... | def MOVS(self, params):
"""
MOVS Ra, Rb
MOVS Ra, #imm8
Move the value of Rb or imm8 into Ra
Ra and Rb must be low registers
"""
Ra, Rb = self.get_two_parameters(self.TWO_PARAMETER_COMMA_SEPARATED, params)
if self.is_immediate(Rb):
self.check_... | [
"MOVS",
"Ra",
"Rb",
"MOVS",
"Ra",
"#imm8"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/data_movement.py#L27-L57 | [
"def",
"MOVS",
"(",
"self",
",",
"params",
")",
":",
"Ra",
",",
"Rb",
"=",
"self",
".",
"get_two_parameters",
"(",
"self",
".",
"TWO_PARAMETER_COMMA_SEPARATED",
",",
"params",
")",
"if",
"self",
".",
"is_immediate",
"(",
"Rb",
")",
":",
"self",
".",
"c... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | DataMovement.MRS | MRS Rj, Rspecial
Copy the value of Rspecial to Rj
Rspecial can be APSR, IPSR, or EPSR | iarm/arm_instructions/data_movement.py | def MRS(self, params):
"""
MRS Rj, Rspecial
Copy the value of Rspecial to Rj
Rspecial can be APSR, IPSR, or EPSR
"""
Rj, Rspecial = self.get_two_parameters(self.TWO_PARAMETER_COMMA_SEPARATED, params)
self.check_arguments(LR_or_general_purpose_registers=(Rj,), sp... | def MRS(self, params):
"""
MRS Rj, Rspecial
Copy the value of Rspecial to Rj
Rspecial can be APSR, IPSR, or EPSR
"""
Rj, Rspecial = self.get_two_parameters(self.TWO_PARAMETER_COMMA_SEPARATED, params)
self.check_arguments(LR_or_general_purpose_registers=(Rj,), sp... | [
"MRS",
"Rj",
"Rspecial"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/data_movement.py#L59-L79 | [
"def",
"MRS",
"(",
"self",
",",
"params",
")",
":",
"Rj",
",",
"Rspecial",
"=",
"self",
".",
"get_two_parameters",
"(",
"self",
".",
"TWO_PARAMETER_COMMA_SEPARATED",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"LR_or_general_purpose_registers",
"=",... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | DataMovement.MSR | MSR Rspecial, Rj
Copy the value of Rj to Rspecial
Rspecial can be APSR, IPSR, or EPSR | iarm/arm_instructions/data_movement.py | def MSR(self, params):
"""
MSR Rspecial, Rj
Copy the value of Rj to Rspecial
Rspecial can be APSR, IPSR, or EPSR
"""
Rspecial, Rj = self.get_two_parameters(self.TWO_PARAMETER_COMMA_SEPARATED, params)
self.check_arguments(LR_or_general_purpose_registers=(Rj,), sp... | def MSR(self, params):
"""
MSR Rspecial, Rj
Copy the value of Rj to Rspecial
Rspecial can be APSR, IPSR, or EPSR
"""
Rspecial, Rj = self.get_two_parameters(self.TWO_PARAMETER_COMMA_SEPARATED, params)
self.check_arguments(LR_or_general_purpose_registers=(Rj,), sp... | [
"MSR",
"Rspecial",
"Rj"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/data_movement.py#L81-L103 | [
"def",
"MSR",
"(",
"self",
",",
"params",
")",
":",
"Rspecial",
",",
"Rj",
"=",
"self",
".",
"get_two_parameters",
"(",
"self",
".",
"TWO_PARAMETER_COMMA_SEPARATED",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"LR_or_general_purpose_registers",
"=",... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | DataMovement.MVNS | MVNS Ra, Rb
Negate the value in Rb and store it in Ra
Ra and Rb must be a low register | iarm/arm_instructions/data_movement.py | def MVNS(self, params):
"""
MVNS Ra, Rb
Negate the value in Rb and store it in Ra
Ra and Rb must be a low register
"""
Ra, Rb = self.get_two_parameters(self.TWO_PARAMETER_COMMA_SEPARATED, params)
self.check_arguments(low_registers=(Ra, Rb))
def MVNS_fun... | def MVNS(self, params):
"""
MVNS Ra, Rb
Negate the value in Rb and store it in Ra
Ra and Rb must be a low register
"""
Ra, Rb = self.get_two_parameters(self.TWO_PARAMETER_COMMA_SEPARATED, params)
self.check_arguments(low_registers=(Ra, Rb))
def MVNS_fun... | [
"MVNS",
"Ra",
"Rb"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/data_movement.py#L105-L120 | [
"def",
"MVNS",
"(",
"self",
",",
"params",
")",
":",
"Ra",
",",
"Rb",
"=",
"self",
".",
"get_two_parameters",
"(",
"self",
".",
"TWO_PARAMETER_COMMA_SEPARATED",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"low_registers",
"=",
"(",
"Ra",
",",
... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | DataMovement.REV | REV Ra, Rb
Reverse the byte order in register Rb and store the result in Ra | iarm/arm_instructions/data_movement.py | def REV(self, params):
"""
REV Ra, Rb
Reverse the byte order in register Rb and store the result in Ra
"""
Ra, Rb = self.get_two_parameters(self.TWO_PARAMETER_COMMA_SEPARATED, params)
self.check_arguments(low_registers=(Ra, Rb))
def REV_func():
self... | def REV(self, params):
"""
REV Ra, Rb
Reverse the byte order in register Rb and store the result in Ra
"""
Ra, Rb = self.get_two_parameters(self.TWO_PARAMETER_COMMA_SEPARATED, params)
self.check_arguments(low_registers=(Ra, Rb))
def REV_func():
self... | [
"REV",
"Ra",
"Rb"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/data_movement.py#L122-L138 | [
"def",
"REV",
"(",
"self",
",",
"params",
")",
":",
"Ra",
",",
"Rb",
"=",
"self",
".",
"get_two_parameters",
"(",
"self",
".",
"TWO_PARAMETER_COMMA_SEPARATED",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"low_registers",
"=",
"(",
"Ra",
",",
... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | DataMovement.REV16 | REV16 Ra, Rb
Reverse the byte order of the half words in register Rb and store the result in Ra | iarm/arm_instructions/data_movement.py | def REV16(self, params):
"""
REV16 Ra, Rb
Reverse the byte order of the half words in register Rb and store the result in Ra
"""
Ra, Rb = self.get_two_parameters(self.TWO_PARAMETER_COMMA_SEPARATED, params)
self.check_arguments(low_registers=(Ra, Rb))
def REV16_... | def REV16(self, params):
"""
REV16 Ra, Rb
Reverse the byte order of the half words in register Rb and store the result in Ra
"""
Ra, Rb = self.get_two_parameters(self.TWO_PARAMETER_COMMA_SEPARATED, params)
self.check_arguments(low_registers=(Ra, Rb))
def REV16_... | [
"REV16",
"Ra",
"Rb"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/data_movement.py#L140-L154 | [
"def",
"REV16",
"(",
"self",
",",
"params",
")",
":",
"Ra",
",",
"Rb",
"=",
"self",
".",
"get_two_parameters",
"(",
"self",
".",
"TWO_PARAMETER_COMMA_SEPARATED",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"low_registers",
"=",
"(",
"Ra",
",",... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | DataMovement.REVSH | REVSH
Reverse the byte order in the lower half word in Rb and store the result in Ra.
If the result of the result is signed, then sign extend | iarm/arm_instructions/data_movement.py | def REVSH(self, params):
"""
REVSH
Reverse the byte order in the lower half word in Rb and store the result in Ra.
If the result of the result is signed, then sign extend
"""
Ra, Rb = self.get_two_parameters(r'\s*([^\s,]*),\s*([^\s,]*)(,\s*[^\s,]*)*\s*', params)
... | def REVSH(self, params):
"""
REVSH
Reverse the byte order in the lower half word in Rb and store the result in Ra.
If the result of the result is signed, then sign extend
"""
Ra, Rb = self.get_two_parameters(r'\s*([^\s,]*),\s*([^\s,]*)(,\s*[^\s,]*)*\s*', params)
... | [
"REVSH"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/data_movement.py#L156-L173 | [
"def",
"REVSH",
"(",
"self",
",",
"params",
")",
":",
"Ra",
",",
"Rb",
"=",
"self",
".",
"get_two_parameters",
"(",
"r'\\s*([^\\s,]*),\\s*([^\\s,]*)(,\\s*[^\\s,]*)*\\s*'",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"low_registers",
"=",
"(",
"Ra",
... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | DataMovement.SXTB | STXB Ra, Rb
Sign extend the byte in Rb and store the result in Ra | iarm/arm_instructions/data_movement.py | def SXTB(self, params):
"""
STXB Ra, Rb
Sign extend the byte in Rb and store the result in Ra
"""
Ra, Rb = self.get_two_parameters(r'\s*([^\s,]*),\s*([^\s,]*)(,\s*[^\s,]*)*\s*', params)
self.check_arguments(low_registers=(Ra, Rb))
def SXTB_func():
i... | def SXTB(self, params):
"""
STXB Ra, Rb
Sign extend the byte in Rb and store the result in Ra
"""
Ra, Rb = self.get_two_parameters(r'\s*([^\s,]*),\s*([^\s,]*)(,\s*[^\s,]*)*\s*', params)
self.check_arguments(low_registers=(Ra, Rb))
def SXTB_func():
i... | [
"STXB",
"Ra",
"Rb"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/data_movement.py#L175-L191 | [
"def",
"SXTB",
"(",
"self",
",",
"params",
")",
":",
"Ra",
",",
"Rb",
"=",
"self",
".",
"get_two_parameters",
"(",
"r'\\s*([^\\s,]*),\\s*([^\\s,]*)(,\\s*[^\\s,]*)*\\s*'",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"low_registers",
"=",
"(",
"Ra",
... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | DataMovement.SXTH | STXH Ra, Rb
Sign extend the half word in Rb and store the result in Ra | iarm/arm_instructions/data_movement.py | def SXTH(self, params):
"""
STXH Ra, Rb
Sign extend the half word in Rb and store the result in Ra
"""
Ra, Rb = self.get_two_parameters(r'\s*([^\s,]*),\s*([^\s,]*)(,\s*[^\s,]*)*\s*', params)
self.check_arguments(low_registers=(Ra, Rb))
def SXTH_func():
... | def SXTH(self, params):
"""
STXH Ra, Rb
Sign extend the half word in Rb and store the result in Ra
"""
Ra, Rb = self.get_two_parameters(r'\s*([^\s,]*),\s*([^\s,]*)(,\s*[^\s,]*)*\s*', params)
self.check_arguments(low_registers=(Ra, Rb))
def SXTH_func():
... | [
"STXH",
"Ra",
"Rb"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/data_movement.py#L193-L209 | [
"def",
"SXTH",
"(",
"self",
",",
"params",
")",
":",
"Ra",
",",
"Rb",
"=",
"self",
".",
"get_two_parameters",
"(",
"r'\\s*([^\\s,]*),\\s*([^\\s,]*)(,\\s*[^\\s,]*)*\\s*'",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"low_registers",
"=",
"(",
"Ra",
... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | DataMovement.UXTB | UTXB Ra, Rb
Zero extend the byte in Rb and store the result in Ra | iarm/arm_instructions/data_movement.py | def UXTB(self, params):
"""
UTXB Ra, Rb
Zero extend the byte in Rb and store the result in Ra
"""
Ra, Rb = self.get_two_parameters(r'\s*([^\s,]*),\s*([^\s,]*)(,\s*[^\s,]*)*\s*', params)
self.check_arguments(low_registers=(Ra, Rb))
def UXTB_func():
s... | def UXTB(self, params):
"""
UTXB Ra, Rb
Zero extend the byte in Rb and store the result in Ra
"""
Ra, Rb = self.get_two_parameters(r'\s*([^\s,]*),\s*([^\s,]*)(,\s*[^\s,]*)*\s*', params)
self.check_arguments(low_registers=(Ra, Rb))
def UXTB_func():
s... | [
"UTXB",
"Ra",
"Rb"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/data_movement.py#L211-L224 | [
"def",
"UXTB",
"(",
"self",
",",
"params",
")",
":",
"Ra",
",",
"Rb",
"=",
"self",
".",
"get_two_parameters",
"(",
"r'\\s*([^\\s,]*),\\s*([^\\s,]*)(,\\s*[^\\s,]*)*\\s*'",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"low_registers",
"=",
"(",
"Ra",
... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | DataMovement.UXTH | UTXH Ra, Rb
Zero extend the half word in Rb and store the result in Ra | iarm/arm_instructions/data_movement.py | def UXTH(self, params):
"""
UTXH Ra, Rb
Zero extend the half word in Rb and store the result in Ra
"""
Ra, Rb = self.get_two_parameters(r'\s*([^\s,]*),\s*([^\s,]*)(,\s*[^\s,]*)*\s*', params)
self.check_arguments(low_registers=(Ra, Rb))
def UXTH_func():
... | def UXTH(self, params):
"""
UTXH Ra, Rb
Zero extend the half word in Rb and store the result in Ra
"""
Ra, Rb = self.get_two_parameters(r'\s*([^\s,]*),\s*([^\s,]*)(,\s*[^\s,]*)*\s*', params)
self.check_arguments(low_registers=(Ra, Rb))
def UXTH_func():
... | [
"UTXH",
"Ra",
"Rb"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/data_movement.py#L226-L239 | [
"def",
"UXTH",
"(",
"self",
",",
"params",
")",
":",
"Ra",
",",
"Rb",
"=",
"self",
".",
"get_two_parameters",
"(",
"r'\\s*([^\\s,]*),\\s*([^\\s,]*)(,\\s*[^\\s,]*)*\\s*'",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"low_registers",
"=",
"(",
"Ra",
... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | _get_event_type | Get type of event e.g. 's3', 'events', 'kinesis',...
:param evt_source:
:return: | gcdt/ramuda_wire.py | def _get_event_type(evt_source):
"""Get type of event e.g. 's3', 'events', 'kinesis',...
:param evt_source:
:return:
"""
if 'schedule' in evt_source:
return 'events'
elif 'pattern' in evt_source:
return 'events'
elif 'log_group_name_prefix' in evt_source:
return 'clo... | def _get_event_type(evt_source):
"""Get type of event e.g. 's3', 'events', 'kinesis',...
:param evt_source:
:return:
"""
if 'schedule' in evt_source:
return 'events'
elif 'pattern' in evt_source:
return 'events'
elif 'log_group_name_prefix' in evt_source:
return 'clo... | [
"Get",
"type",
"of",
"event",
"e",
".",
"g",
".",
"s3",
"events",
"kinesis",
"..."
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/ramuda_wire.py#L28-L43 | [
"def",
"_get_event_type",
"(",
"evt_source",
")",
":",
"if",
"'schedule'",
"in",
"evt_source",
":",
"return",
"'events'",
"elif",
"'pattern'",
"in",
"evt_source",
":",
"return",
"'events'",
"elif",
"'log_group_name_prefix'",
"in",
"evt_source",
":",
"return",
"'cl... | cd67cf416371337b83cb9ca3f696277125703339 |
train | _get_event_source_obj | Given awsclient, event_source dictionary item
create an event_source object of the appropriate event type
to schedule this event, and return the object. | gcdt/ramuda_wire.py | def _get_event_source_obj(awsclient, evt_source):
"""
Given awsclient, event_source dictionary item
create an event_source object of the appropriate event type
to schedule this event, and return the object.
"""
event_source_map = {
'dynamodb': event_source.dynamodb_stream.DynamoDBStreamE... | def _get_event_source_obj(awsclient, evt_source):
"""
Given awsclient, event_source dictionary item
create an event_source object of the appropriate event type
to schedule this event, and return the object.
"""
event_source_map = {
'dynamodb': event_source.dynamodb_stream.DynamoDBStreamE... | [
"Given",
"awsclient",
"event_source",
"dictionary",
"item",
"create",
"an",
"event_source",
"object",
"of",
"the",
"appropriate",
"event",
"type",
"to",
"schedule",
"this",
"event",
"and",
"return",
"the",
"object",
"."
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/ramuda_wire.py#L84-L106 | [
"def",
"_get_event_source_obj",
"(",
"awsclient",
",",
"evt_source",
")",
":",
"event_source_map",
"=",
"{",
"'dynamodb'",
":",
"event_source",
".",
"dynamodb_stream",
".",
"DynamoDBStreamEventSource",
",",
"'kinesis'",
":",
"event_source",
".",
"kinesis",
".",
"Kin... | cd67cf416371337b83cb9ca3f696277125703339 |
train | _add_event_source | Given an event_source dictionary, create the object and add the event source. | gcdt/ramuda_wire.py | def _add_event_source(awsclient, evt_source, lambda_arn):
"""
Given an event_source dictionary, create the object and add the event source.
"""
event_source_obj = _get_event_source_obj(awsclient, evt_source)
# (where zappa goes like remove, add)
# we go with update and add like this:
if eve... | def _add_event_source(awsclient, evt_source, lambda_arn):
"""
Given an event_source dictionary, create the object and add the event source.
"""
event_source_obj = _get_event_source_obj(awsclient, evt_source)
# (where zappa goes like remove, add)
# we go with update and add like this:
if eve... | [
"Given",
"an",
"event_source",
"dictionary",
"create",
"the",
"object",
"and",
"add",
"the",
"event",
"source",
"."
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/ramuda_wire.py#L109-L120 | [
"def",
"_add_event_source",
"(",
"awsclient",
",",
"evt_source",
",",
"lambda_arn",
")",
":",
"event_source_obj",
"=",
"_get_event_source_obj",
"(",
"awsclient",
",",
"evt_source",
")",
"# (where zappa goes like remove, add)",
"# we go with update and add like this:",
"if",
... | cd67cf416371337b83cb9ca3f696277125703339 |
train | _remove_event_source | Given an event_source dictionary, create the object and remove the event source. | gcdt/ramuda_wire.py | def _remove_event_source(awsclient, evt_source, lambda_arn):
"""
Given an event_source dictionary, create the object and remove the event source.
"""
event_source_obj = _get_event_source_obj(awsclient, evt_source)
if event_source_obj.exists(lambda_arn):
event_source_obj.remove(lambda_arn) | def _remove_event_source(awsclient, evt_source, lambda_arn):
"""
Given an event_source dictionary, create the object and remove the event source.
"""
event_source_obj = _get_event_source_obj(awsclient, evt_source)
if event_source_obj.exists(lambda_arn):
event_source_obj.remove(lambda_arn) | [
"Given",
"an",
"event_source",
"dictionary",
"create",
"the",
"object",
"and",
"remove",
"the",
"event",
"source",
"."
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/ramuda_wire.py#L123-L129 | [
"def",
"_remove_event_source",
"(",
"awsclient",
",",
"evt_source",
",",
"lambda_arn",
")",
":",
"event_source_obj",
"=",
"_get_event_source_obj",
"(",
"awsclient",
",",
"evt_source",
")",
"if",
"event_source_obj",
".",
"exists",
"(",
"lambda_arn",
")",
":",
"even... | cd67cf416371337b83cb9ca3f696277125703339 |
train | _get_event_source_status | Given an event_source dictionary, create the object and get the event source status. | gcdt/ramuda_wire.py | def _get_event_source_status(awsclient, evt_source, lambda_arn):
"""
Given an event_source dictionary, create the object and get the event source status.
"""
event_source_obj = _get_event_source_obj(awsclient, evt_source)
return event_source_obj.status(lambda_arn) | def _get_event_source_status(awsclient, evt_source, lambda_arn):
"""
Given an event_source dictionary, create the object and get the event source status.
"""
event_source_obj = _get_event_source_obj(awsclient, evt_source)
return event_source_obj.status(lambda_arn) | [
"Given",
"an",
"event_source",
"dictionary",
"create",
"the",
"object",
"and",
"get",
"the",
"event",
"source",
"status",
"."
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/ramuda_wire.py#L132-L137 | [
"def",
"_get_event_source_status",
"(",
"awsclient",
",",
"evt_source",
",",
"lambda_arn",
")",
":",
"event_source_obj",
"=",
"_get_event_source_obj",
"(",
"awsclient",
",",
"evt_source",
")",
"return",
"event_source_obj",
".",
"status",
"(",
"lambda_arn",
")"
] | cd67cf416371337b83cb9ca3f696277125703339 |
train | unwire | Unwire a list of event from an AWS Lambda function.
'events' is a list of dictionaries, where the dict must contains the
'schedule' of the event as string, and an optional 'name' and 'description'.
:param awsclient:
:param events: list of events
:param lambda_name:
:param alias_name:
:retu... | gcdt/ramuda_wire.py | def unwire(awsclient, events, lambda_name, alias_name=ALIAS_NAME):
"""Unwire a list of event from an AWS Lambda function.
'events' is a list of dictionaries, where the dict must contains the
'schedule' of the event as string, and an optional 'name' and 'description'.
:param awsclient:
:param event... | def unwire(awsclient, events, lambda_name, alias_name=ALIAS_NAME):
"""Unwire a list of event from an AWS Lambda function.
'events' is a list of dictionaries, where the dict must contains the
'schedule' of the event as string, and an optional 'name' and 'description'.
:param awsclient:
:param event... | [
"Unwire",
"a",
"list",
"of",
"event",
"from",
"an",
"AWS",
"Lambda",
"function",
"."
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/ramuda_wire.py#L140-L181 | [
"def",
"unwire",
"(",
"awsclient",
",",
"events",
",",
"lambda_name",
",",
"alias_name",
"=",
"ALIAS_NAME",
")",
":",
"if",
"not",
"lambda_exists",
"(",
"awsclient",
",",
"lambda_name",
")",
":",
"log",
".",
"error",
"(",
"colored",
".",
"red",
"(",
"'Th... | cd67cf416371337b83cb9ca3f696277125703339 |
train | wire_deprecated | Deprecated! Please use wire!
:param awsclient:
:param function_name:
:param s3_event_sources: dictionary
:param time_event_sources:
:param alias_name:
:return: exit_code | gcdt/ramuda_wire.py | def wire_deprecated(awsclient, function_name, s3_event_sources=None,
time_event_sources=None,
alias_name=ALIAS_NAME):
"""Deprecated! Please use wire!
:param awsclient:
:param function_name:
:param s3_event_sources: dictionary
:param time_event_sources:
:... | def wire_deprecated(awsclient, function_name, s3_event_sources=None,
time_event_sources=None,
alias_name=ALIAS_NAME):
"""Deprecated! Please use wire!
:param awsclient:
:param function_name:
:param s3_event_sources: dictionary
:param time_event_sources:
:... | [
"Deprecated!",
"Please",
"use",
"wire!"
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/ramuda_wire.py#L191-L235 | [
"def",
"wire_deprecated",
"(",
"awsclient",
",",
"function_name",
",",
"s3_event_sources",
"=",
"None",
",",
"time_event_sources",
"=",
"None",
",",
"alias_name",
"=",
"ALIAS_NAME",
")",
":",
"if",
"not",
"lambda_exists",
"(",
"awsclient",
",",
"function_name",
... | cd67cf416371337b83cb9ca3f696277125703339 |
train | unwire_deprecated | Deprecated! Please use unwire!
:param awsclient:
:param function_name:
:param s3_event_sources: dictionary
:param time_event_sources:
:param alias_name:
:return: exit_code | gcdt/ramuda_wire.py | def unwire_deprecated(awsclient, function_name, s3_event_sources=None,
time_event_sources=None, alias_name=ALIAS_NAME):
"""Deprecated! Please use unwire!
:param awsclient:
:param function_name:
:param s3_event_sources: dictionary
:param time_event_sources:
:param alias_nam... | def unwire_deprecated(awsclient, function_name, s3_event_sources=None,
time_event_sources=None, alias_name=ALIAS_NAME):
"""Deprecated! Please use unwire!
:param awsclient:
:param function_name:
:param s3_event_sources: dictionary
:param time_event_sources:
:param alias_nam... | [
"Deprecated!",
"Please",
"use",
"unwire!"
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/ramuda_wire.py#L238-L313 | [
"def",
"unwire_deprecated",
"(",
"awsclient",
",",
"function_name",
",",
"s3_event_sources",
"=",
"None",
",",
"time_event_sources",
"=",
"None",
",",
"alias_name",
"=",
"ALIAS_NAME",
")",
":",
"if",
"not",
"lambda_exists",
"(",
"awsclient",
",",
"function_name",
... | cd67cf416371337b83cb9ca3f696277125703339 |
train | _lambda_add_s3_event_source | Use only prefix OR suffix
:param arn:
:param event:
:param bucket:
:param prefix:
:param suffix:
:return: | gcdt/ramuda_wire.py | def _lambda_add_s3_event_source(awsclient, arn, event, bucket, prefix,
suffix):
"""Use only prefix OR suffix
:param arn:
:param event:
:param bucket:
:param prefix:
:param suffix:
:return:
"""
json_data = {
'LambdaFunctionConfigurations': [{
... | def _lambda_add_s3_event_source(awsclient, arn, event, bucket, prefix,
suffix):
"""Use only prefix OR suffix
:param arn:
:param event:
:param bucket:
:param prefix:
:param suffix:
:return:
"""
json_data = {
'LambdaFunctionConfigurations': [{
... | [
"Use",
"only",
"prefix",
"OR",
"suffix"
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/ramuda_wire.py#L616-L665 | [
"def",
"_lambda_add_s3_event_source",
"(",
"awsclient",
",",
"arn",
",",
"event",
",",
"bucket",
",",
"prefix",
",",
"suffix",
")",
":",
"json_data",
"=",
"{",
"'LambdaFunctionConfigurations'",
":",
"[",
"{",
"'LambdaFunctionArn'",
":",
"arn",
",",
"'Id'",
":"... | cd67cf416371337b83cb9ca3f696277125703339 |
train | find_eigen | r'''
Try to find the Eigen library. If successful the include directory is returned. | cppmat/__init__.py | def find_eigen(hint=None):
r'''
Try to find the Eigen library. If successful the include directory is returned.
'''
# search with pkgconfig
# ---------------------
try:
import pkgconfig
if pkgconfig.installed('eigen3','>3.0.0'):
return pkgconfig.parse('eigen3')['include_dirs'][0]
except:
... | def find_eigen(hint=None):
r'''
Try to find the Eigen library. If successful the include directory is returned.
'''
# search with pkgconfig
# ---------------------
try:
import pkgconfig
if pkgconfig.installed('eigen3','>3.0.0'):
return pkgconfig.parse('eigen3')['include_dirs'][0]
except:
... | [
"r",
"Try",
"to",
"find",
"the",
"Eigen",
"library",
".",
"If",
"successful",
"the",
"include",
"directory",
"is",
"returned",
"."
] | tdegeus/cppmat | python | https://github.com/tdegeus/cppmat/blob/0d5031d08ce621a4d3e9c396779d99fd5203aa00/cppmat/__init__.py#L109-L157 | [
"def",
"find_eigen",
"(",
"hint",
"=",
"None",
")",
":",
"# search with pkgconfig",
"# ---------------------",
"try",
":",
"import",
"pkgconfig",
"if",
"pkgconfig",
".",
"installed",
"(",
"'eigen3'",
",",
"'>3.0.0'",
")",
":",
"return",
"pkgconfig",
".",
"parse"... | 0d5031d08ce621a4d3e9c396779d99fd5203aa00 |
train | check_and_format_logs_params | Helper to read the params for the logs command | gcdt/ramuda_utils.py | def check_and_format_logs_params(start, end, tail):
"""Helper to read the params for the logs command"""
def _decode_duration_type(duration_type):
durations = {'m': 'minutes', 'h': 'hours', 'd': 'days', 'w': 'weeks'}
return durations[duration_type]
if not start:
if tail:
... | def check_and_format_logs_params(start, end, tail):
"""Helper to read the params for the logs command"""
def _decode_duration_type(duration_type):
durations = {'m': 'minutes', 'h': 'hours', 'd': 'days', 'w': 'weeks'}
return durations[duration_type]
if not start:
if tail:
... | [
"Helper",
"to",
"read",
"the",
"params",
"for",
"the",
"logs",
"command"
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/ramuda_utils.py#L201-L227 | [
"def",
"check_and_format_logs_params",
"(",
"start",
",",
"end",
",",
"tail",
")",
":",
"def",
"_decode_duration_type",
"(",
"duration_type",
")",
":",
"durations",
"=",
"{",
"'m'",
":",
"'minutes'",
",",
"'h'",
":",
"'hours'",
",",
"'d'",
":",
"'days'",
"... | cd67cf416371337b83cb9ca3f696277125703339 |
train | upload_file_to_s3 | Upload a file to AWS S3 bucket.
:param awsclient:
:param bucket:
:param key:
:param filename:
:return: | gcdt/s3.py | def upload_file_to_s3(awsclient, bucket, key, filename):
"""Upload a file to AWS S3 bucket.
:param awsclient:
:param bucket:
:param key:
:param filename:
:return:
"""
client_s3 = awsclient.get_client('s3')
transfer = S3Transfer(client_s3)
# Upload /tmp/myfile to s3://bucket/key ... | def upload_file_to_s3(awsclient, bucket, key, filename):
"""Upload a file to AWS S3 bucket.
:param awsclient:
:param bucket:
:param key:
:param filename:
:return:
"""
client_s3 = awsclient.get_client('s3')
transfer = S3Transfer(client_s3)
# Upload /tmp/myfile to s3://bucket/key ... | [
"Upload",
"a",
"file",
"to",
"AWS",
"S3",
"bucket",
"."
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/s3.py#L73-L89 | [
"def",
"upload_file_to_s3",
"(",
"awsclient",
",",
"bucket",
",",
"key",
",",
"filename",
")",
":",
"client_s3",
"=",
"awsclient",
".",
"get_client",
"(",
"'s3'",
")",
"transfer",
"=",
"S3Transfer",
"(",
"client_s3",
")",
"# Upload /tmp/myfile to s3://bucket/key a... | cd67cf416371337b83cb9ca3f696277125703339 |
train | remove_file_from_s3 | Remove a file from an AWS S3 bucket.
:param awsclient:
:param bucket:
:param key:
:return: | gcdt/s3.py | def remove_file_from_s3(awsclient, bucket, key):
"""Remove a file from an AWS S3 bucket.
:param awsclient:
:param bucket:
:param key:
:return:
"""
client_s3 = awsclient.get_client('s3')
response = client_s3.delete_object(Bucket=bucket, Key=key) | def remove_file_from_s3(awsclient, bucket, key):
"""Remove a file from an AWS S3 bucket.
:param awsclient:
:param bucket:
:param key:
:return:
"""
client_s3 = awsclient.get_client('s3')
response = client_s3.delete_object(Bucket=bucket, Key=key) | [
"Remove",
"a",
"file",
"from",
"an",
"AWS",
"S3",
"bucket",
"."
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/s3.py#L92-L101 | [
"def",
"remove_file_from_s3",
"(",
"awsclient",
",",
"bucket",
",",
"key",
")",
":",
"client_s3",
"=",
"awsclient",
".",
"get_client",
"(",
"'s3'",
")",
"response",
"=",
"client_s3",
".",
"delete_object",
"(",
"Bucket",
"=",
"bucket",
",",
"Key",
"=",
"key... | cd67cf416371337b83cb9ca3f696277125703339 |
train | ls | List bucket contents
:param awsclient:
:param bucket:
:param prefix:
:return: | gcdt/s3.py | def ls(awsclient, bucket, prefix=None):
"""List bucket contents
:param awsclient:
:param bucket:
:param prefix:
:return:
"""
# this works until 1000 keys!
params = {'Bucket': bucket}
if prefix:
params['Prefix'] = prefix
client_s3 = awsclient.get_client('s3')
objects ... | def ls(awsclient, bucket, prefix=None):
"""List bucket contents
:param awsclient:
:param bucket:
:param prefix:
:return:
"""
# this works until 1000 keys!
params = {'Bucket': bucket}
if prefix:
params['Prefix'] = prefix
client_s3 = awsclient.get_client('s3')
objects ... | [
"List",
"bucket",
"contents"
] | glomex/gcdt | python | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/s3.py#L104-L120 | [
"def",
"ls",
"(",
"awsclient",
",",
"bucket",
",",
"prefix",
"=",
"None",
")",
":",
"# this works until 1000 keys!",
"params",
"=",
"{",
"'Bucket'",
":",
"bucket",
"}",
"if",
"prefix",
":",
"params",
"[",
"'Prefix'",
"]",
"=",
"prefix",
"client_s3",
"=",
... | cd67cf416371337b83cb9ca3f696277125703339 |
train | Logic.ORRS | ORRS [Ra,] Ra, Rb
OR Ra and Rb together and store the result in Ra
The equivalent of `Ra = Ra | Rc`
Updates NZ flags
Ra and Rb must be low registers
The first register is optional | iarm/arm_instructions/logic.py | def ORRS(self, params):
"""
ORRS [Ra,] Ra, Rb
OR Ra and Rb together and store the result in Ra
The equivalent of `Ra = Ra | Rc`
Updates NZ flags
Ra and Rb must be low registers
The first register is optional
"""
# This instruction allows for an op... | def ORRS(self, params):
"""
ORRS [Ra,] Ra, Rb
OR Ra and Rb together and store the result in Ra
The equivalent of `Ra = Ra | Rc`
Updates NZ flags
Ra and Rb must be low registers
The first register is optional
"""
# This instruction allows for an op... | [
"ORRS",
"[",
"Ra",
"]",
"Ra",
"Rb"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/logic.py#L93-L120 | [
"def",
"ORRS",
"(",
"self",
",",
"params",
")",
":",
"# This instruction allows for an optional destination register",
"# If it is omitted, then it is assumed to be Rb",
"# As defined in http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0662b/index.html",
"try",
":",
"Ra",
"... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | Logic.TST | TST Ra, Rb
AND Ra and Rb together and update the NZ flag. The result is not set
The equivalent of `Ra & Rc`
Ra and Rb must be low registers | iarm/arm_instructions/logic.py | def TST(self, params):
"""
TST Ra, Rb
AND Ra and Rb together and update the NZ flag. The result is not set
The equivalent of `Ra & Rc`
Ra and Rb must be low registers
"""
Ra, Rb = self.get_two_parameters(self.TWO_PARAMETER_COMMA_SEPARATED, params)
self.c... | def TST(self, params):
"""
TST Ra, Rb
AND Ra and Rb together and update the NZ flag. The result is not set
The equivalent of `Ra & Rc`
Ra and Rb must be low registers
"""
Ra, Rb = self.get_two_parameters(self.TWO_PARAMETER_COMMA_SEPARATED, params)
self.c... | [
"TST",
"Ra",
"Rb"
] | DeepHorizons/iarm | python | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/logic.py#L122-L138 | [
"def",
"TST",
"(",
"self",
",",
"params",
")",
":",
"Ra",
",",
"Rb",
"=",
"self",
".",
"get_two_parameters",
"(",
"self",
".",
"TWO_PARAMETER_COMMA_SEPARATED",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"low_registers",
"=",
"(",
"Ra",
",",
... | b913c9fd577b793a6bbced78b78a5d8d7cd88de4 |
train | render_to_mail | Renders a mail and returns the resulting ``EmailMultiAlternatives``
instance
* ``template``: The base name of the text and HTML (optional) version of
the mail.
* ``context``: The context used to render the mail. This context instance
should contain everything required.
* Additional keyword ... | authlib/email.py | def render_to_mail(template, context, **kwargs):
"""
Renders a mail and returns the resulting ``EmailMultiAlternatives``
instance
* ``template``: The base name of the text and HTML (optional) version of
the mail.
* ``context``: The context used to render the mail. This context instance
... | def render_to_mail(template, context, **kwargs):
"""
Renders a mail and returns the resulting ``EmailMultiAlternatives``
instance
* ``template``: The base name of the text and HTML (optional) version of
the mail.
* ``context``: The context used to render the mail. This context instance
... | [
"Renders",
"a",
"mail",
"and",
"returns",
"the",
"resulting",
"EmailMultiAlternatives",
"instance"
] | matthiask/django-authlib | python | https://github.com/matthiask/django-authlib/blob/a142da7e27fe9d30f34a84b12f24f686f9d2c8e1/authlib/email.py#L14-L61 | [
"def",
"render_to_mail",
"(",
"template",
",",
"context",
",",
"*",
"*",
"kwargs",
")",
":",
"lines",
"=",
"iter",
"(",
"line",
".",
"rstrip",
"(",
")",
"for",
"line",
"in",
"render_to_string",
"(",
"\"%s.txt\"",
"%",
"template",
",",
"context",
")",
"... | a142da7e27fe9d30f34a84b12f24f686f9d2c8e1 |
train | get_confirmation_url | Returns the confirmation URL | authlib/email.py | def get_confirmation_url(email, request, name="email_registration_confirm", **kwargs):
"""
Returns the confirmation URL
"""
return request.build_absolute_uri(
reverse(name, kwargs={"code": get_confirmation_code(email, request, **kwargs)})
) | def get_confirmation_url(email, request, name="email_registration_confirm", **kwargs):
"""
Returns the confirmation URL
"""
return request.build_absolute_uri(
reverse(name, kwargs={"code": get_confirmation_code(email, request, **kwargs)})
) | [
"Returns",
"the",
"confirmation",
"URL"
] | matthiask/django-authlib | python | https://github.com/matthiask/django-authlib/blob/a142da7e27fe9d30f34a84b12f24f686f9d2c8e1/authlib/email.py#L81-L87 | [
"def",
"get_confirmation_url",
"(",
"email",
",",
"request",
",",
"name",
"=",
"\"email_registration_confirm\"",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"request",
".",
"build_absolute_uri",
"(",
"reverse",
"(",
"name",
",",
"kwargs",
"=",
"{",
"\"code\""... | a142da7e27fe9d30f34a84b12f24f686f9d2c8e1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.