repository_name stringlengths 7 55 | func_path_in_repository stringlengths 4 223 | func_name stringlengths 1 134 | whole_func_string stringlengths 75 104k | language stringclasses 1
value | func_code_string stringlengths 75 104k | func_code_tokens listlengths 19 28.4k | func_documentation_string stringlengths 1 46.9k | func_documentation_tokens listlengths 1 1.97k | split_name stringclasses 1
value | func_code_url stringlengths 87 315 |
|---|---|---|---|---|---|---|---|---|---|---|
acrazing/dbapi | dbapi/Group.py | Group.list_reced_topics | def list_reced_topics(self, user_alias=None, start=0):
"""
推荐的话题列表
:param user_alias: 指定用户,默认当前
:param start: 翻页
:return: 带下一页的列表
"""
user_alias = user_alias or self.api.user_alias
xml = self.api.xml(API_GROUP_LIST_USER_RECED_TOPICS % user_alias, ... | python | def list_reced_topics(self, user_alias=None, start=0):
"""
推荐的话题列表
:param user_alias: 指定用户,默认当前
:param start: 翻页
:return: 带下一页的列表
"""
user_alias = user_alias or self.api.user_alias
xml = self.api.xml(API_GROUP_LIST_USER_RECED_TOPICS % user_alias, ... | [
"def",
"list_reced_topics",
"(",
"self",
",",
"user_alias",
"=",
"None",
",",
"start",
"=",
"0",
")",
":",
"user_alias",
"=",
"user_alias",
"or",
"self",
".",
"api",
".",
"user_alias",
"xml",
"=",
"self",
".",
"api",
".",
"xml",
"(",
"API_GROUP_LIST_USER... | 推荐的话题列表
:param user_alias: 指定用户,默认当前
:param start: 翻页
:return: 带下一页的列表 | [
"推荐的话题列表",
":",
"param",
"user_alias",
":",
"指定用户,默认当前",
":",
"param",
"start",
":",
"翻页",
":",
"return",
":",
"带下一页的列表"
] | train | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/Group.py#L287-L297 |
acrazing/dbapi | dbapi/Group.py | Group.add_topic | def add_topic(self, group_alias, title, content):
"""
创建话题(小心验证码~)
:param group_alias: 小组ID
:param title: 标题
:param content: 内容
:return: bool
"""
xml = self.api.req(API_GROUP_ADD_TOPIC % group_alias, 'post', data={
'ck': self.api.ck(),... | python | def add_topic(self, group_alias, title, content):
"""
创建话题(小心验证码~)
:param group_alias: 小组ID
:param title: 标题
:param content: 内容
:return: bool
"""
xml = self.api.req(API_GROUP_ADD_TOPIC % group_alias, 'post', data={
'ck': self.api.ck(),... | [
"def",
"add_topic",
"(",
"self",
",",
"group_alias",
",",
"title",
",",
"content",
")",
":",
"xml",
"=",
"self",
".",
"api",
".",
"req",
"(",
"API_GROUP_ADD_TOPIC",
"%",
"group_alias",
",",
"'post'",
",",
"data",
"=",
"{",
"'ck'",
":",
"self",
".",
"... | 创建话题(小心验证码~)
:param group_alias: 小组ID
:param title: 标题
:param content: 内容
:return: bool | [
"创建话题(小心验证码~)",
":",
"param",
"group_alias",
":",
"小组ID",
":",
"param",
"title",
":",
"标题",
":",
"param",
"content",
":",
"内容",
":",
"return",
":",
"bool"
] | train | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/Group.py#L299-L314 |
acrazing/dbapi | dbapi/Group.py | Group.remove_topic | def remove_topic(self, topic_id):
"""
删除话题(需要先删除所有评论,使用默认参数)
:param topic_id: 话题ID
:return: None
"""
comment_start = 0
while comment_start is not None:
comments = self.list_comments(topic_id, comment_start)
for comment in comments[... | python | def remove_topic(self, topic_id):
"""
删除话题(需要先删除所有评论,使用默认参数)
:param topic_id: 话题ID
:return: None
"""
comment_start = 0
while comment_start is not None:
comments = self.list_comments(topic_id, comment_start)
for comment in comments[... | [
"def",
"remove_topic",
"(",
"self",
",",
"topic_id",
")",
":",
"comment_start",
"=",
"0",
"while",
"comment_start",
"is",
"not",
"None",
":",
"comments",
"=",
"self",
".",
"list_comments",
"(",
"topic_id",
",",
"comment_start",
")",
"for",
"comment",
"in",
... | 删除话题(需要先删除所有评论,使用默认参数)
:param topic_id: 话题ID
:return: None | [
"删除话题(需要先删除所有评论,使用默认参数)",
":",
"param",
"topic_id",
":",
"话题ID",
":",
"return",
":",
"None"
] | train | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/Group.py#L343-L356 |
acrazing/dbapi | dbapi/Group.py | Group.update_topic | def update_topic(self, topic_id, title, content):
"""
更新话题
:param topic_id: 话题ID
:param title: 标题
:param content: 内容
:return: bool
"""
xml = self.api.req(API_GROUP_UPDATE_TOPIC % topic_id, 'post', data={
'ck': self.api.ck(),
... | python | def update_topic(self, topic_id, title, content):
"""
更新话题
:param topic_id: 话题ID
:param title: 标题
:param content: 内容
:return: bool
"""
xml = self.api.req(API_GROUP_UPDATE_TOPIC % topic_id, 'post', data={
'ck': self.api.ck(),
... | [
"def",
"update_topic",
"(",
"self",
",",
"topic_id",
",",
"title",
",",
"content",
")",
":",
"xml",
"=",
"self",
".",
"api",
".",
"req",
"(",
"API_GROUP_UPDATE_TOPIC",
"%",
"topic_id",
",",
"'post'",
",",
"data",
"=",
"{",
"'ck'",
":",
"self",
".",
"... | 更新话题
:param topic_id: 话题ID
:param title: 标题
:param content: 内容
:return: bool | [
"更新话题",
":",
"param",
"topic_id",
":",
"话题ID",
":",
"param",
"title",
":",
"标题",
":",
"param",
"content",
":",
"内容",
":",
"return",
":",
"bool"
] | train | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/Group.py#L358-L373 |
acrazing/dbapi | dbapi/Group.py | Group.list_comments | def list_comments(self, topic_id, start=0):
"""
回复列表
:param topic_id: 话题ID
:param start: 翻页
:return: 带下一页的列表
"""
xml = self.api.xml(API_GROUP_GET_TOPIC % topic_id, params={'start': start})
xml_results = xml.xpath('//ul[@id="comments"]/li')
... | python | def list_comments(self, topic_id, start=0):
"""
回复列表
:param topic_id: 话题ID
:param start: 翻页
:return: 带下一页的列表
"""
xml = self.api.xml(API_GROUP_GET_TOPIC % topic_id, params={'start': start})
xml_results = xml.xpath('//ul[@id="comments"]/li')
... | [
"def",
"list_comments",
"(",
"self",
",",
"topic_id",
",",
"start",
"=",
"0",
")",
":",
"xml",
"=",
"self",
".",
"api",
".",
"xml",
"(",
"API_GROUP_GET_TOPIC",
"%",
"topic_id",
",",
"params",
"=",
"{",
"'start'",
":",
"start",
"}",
")",
"xml_results",
... | 回复列表
:param topic_id: 话题ID
:param start: 翻页
:return: 带下一页的列表 | [
"回复列表",
":",
"param",
"topic_id",
":",
"话题ID",
":",
"param",
"start",
":",
"翻页",
":",
"return",
":",
"带下一页的列表"
] | train | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/Group.py#L411-L444 |
acrazing/dbapi | dbapi/Group.py | Group.add_comment | def add_comment(self, topic_id, content, reply_id=None):
"""
添加评论
:param topic_id: 话题ID
:param content: 内容
:param reply_id: 回复ID
:return: None
"""
return self.api.req(API_GROUP_ADD_COMMENT % topic_id, 'post', data={
'ck': self.api.ck()... | python | def add_comment(self, topic_id, content, reply_id=None):
"""
添加评论
:param topic_id: 话题ID
:param content: 内容
:param reply_id: 回复ID
:return: None
"""
return self.api.req(API_GROUP_ADD_COMMENT % topic_id, 'post', data={
'ck': self.api.ck()... | [
"def",
"add_comment",
"(",
"self",
",",
"topic_id",
",",
"content",
",",
"reply_id",
"=",
"None",
")",
":",
"return",
"self",
".",
"api",
".",
"req",
"(",
"API_GROUP_ADD_COMMENT",
"%",
"topic_id",
",",
"'post'",
",",
"data",
"=",
"{",
"'ck'",
":",
"sel... | 添加评论
:param topic_id: 话题ID
:param content: 内容
:param reply_id: 回复ID
:return: None | [
"添加评论",
":",
"param",
"topic_id",
":",
"话题ID",
":",
"param",
"content",
":",
"内容",
":",
"param",
"reply_id",
":",
"回复ID",
":",
"return",
":",
"None"
] | train | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/Group.py#L446-L461 |
acrazing/dbapi | dbapi/Group.py | Group.remove_comment | def remove_comment(self, topic_id, comment_id, reason='0', other=None):
"""
删除评论(自己发的话题所有的都可以删除,否则只能删自己发的)
:param topic_id: 话题ID
:param comment_id: 评论ID
:param reason: 原因 0/1/2 (内容不符/反动/其它)
:param other: 其它原因的具体(2)
:return: None
"""
params... | python | def remove_comment(self, topic_id, comment_id, reason='0', other=None):
"""
删除评论(自己发的话题所有的都可以删除,否则只能删自己发的)
:param topic_id: 话题ID
:param comment_id: 评论ID
:param reason: 原因 0/1/2 (内容不符/反动/其它)
:param other: 其它原因的具体(2)
:return: None
"""
params... | [
"def",
"remove_comment",
"(",
"self",
",",
"topic_id",
",",
"comment_id",
",",
"reason",
"=",
"'0'",
",",
"other",
"=",
"None",
")",
":",
"params",
"=",
"{",
"'cid'",
":",
"comment_id",
"}",
"data",
"=",
"{",
"'cid'",
":",
"comment_id",
",",
"'ck'",
... | 删除评论(自己发的话题所有的都可以删除,否则只能删自己发的)
:param topic_id: 话题ID
:param comment_id: 评论ID
:param reason: 原因 0/1/2 (内容不符/反动/其它)
:param other: 其它原因的具体(2)
:return: None | [
"删除评论(自己发的话题所有的都可以删除,否则只能删自己发的)",
":",
"param",
"topic_id",
":",
"话题ID",
":",
"param",
"comment_id",
":",
"评论ID",
":",
"param",
"reason",
":",
"原因",
"0",
"/",
"1",
"/",
"2",
"(内容不符",
"/",
"反动",
"/",
"其它)",
":",
"param",
"other",
":",
"其它原因的具体",
"(",
"2... | train | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/Group.py#L463-L479 |
acrazing/dbapi | dbapi/Group.py | Group.list_user_comments | def list_user_comments(self, topic_id, user_alias=None):
"""
列出用户在话题下的所有回复
:param topic_id: 话题ID
:param user_alias: 用户ID,默认当前
:return: 纯列表
"""
user_alias = user_alias or self.api.user_alias
comment_start = 0
results = []
while comm... | python | def list_user_comments(self, topic_id, user_alias=None):
"""
列出用户在话题下的所有回复
:param topic_id: 话题ID
:param user_alias: 用户ID,默认当前
:return: 纯列表
"""
user_alias = user_alias or self.api.user_alias
comment_start = 0
results = []
while comm... | [
"def",
"list_user_comments",
"(",
"self",
",",
"topic_id",
",",
"user_alias",
"=",
"None",
")",
":",
"user_alias",
"=",
"user_alias",
"or",
"self",
".",
"api",
".",
"user_alias",
"comment_start",
"=",
"0",
"results",
"=",
"[",
"]",
"while",
"comment_start",
... | 列出用户在话题下的所有回复
:param topic_id: 话题ID
:param user_alias: 用户ID,默认当前
:return: 纯列表 | [
"列出用户在话题下的所有回复",
":",
"param",
"topic_id",
":",
"话题ID",
":",
"param",
"user_alias",
":",
"用户ID,默认当前",
":",
"return",
":",
"纯列表"
] | train | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/Group.py#L481-L496 |
acrazing/dbapi | dbapi/Group.py | Group.remove_commented_topic | def remove_commented_topic(self, topic_id):
"""
删除回复的话题(删除所有自己发布的评论)
:param topic_id: 话题ID
:return: None
"""
return [self.remove_comment(topic_id, item['id']) for item in self.list_user_comments(topic_id)] | python | def remove_commented_topic(self, topic_id):
"""
删除回复的话题(删除所有自己发布的评论)
:param topic_id: 话题ID
:return: None
"""
return [self.remove_comment(topic_id, item['id']) for item in self.list_user_comments(topic_id)] | [
"def",
"remove_commented_topic",
"(",
"self",
",",
"topic_id",
")",
":",
"return",
"[",
"self",
".",
"remove_comment",
"(",
"topic_id",
",",
"item",
"[",
"'id'",
"]",
")",
"for",
"item",
"in",
"self",
".",
"list_user_comments",
"(",
"topic_id",
")",
"]"
] | 删除回复的话题(删除所有自己发布的评论)
:param topic_id: 话题ID
:return: None | [
"删除回复的话题(删除所有自己发布的评论)",
":",
"param",
"topic_id",
":",
"话题ID",
":",
"return",
":",
"None"
] | train | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/Group.py#L498-L505 |
clarkperkins/click-shell | click_shell/decorators.py | shell | def shell(name=None, **attrs):
"""Creates a new :class:`Shell` with a function as callback. This
works otherwise the same as :func:`command` just that the `cls`
parameter is set to :class:`Shell`.
"""
attrs.setdefault('cls', Shell)
return click.command(name, **attrs) | python | def shell(name=None, **attrs):
"""Creates a new :class:`Shell` with a function as callback. This
works otherwise the same as :func:`command` just that the `cls`
parameter is set to :class:`Shell`.
"""
attrs.setdefault('cls', Shell)
return click.command(name, **attrs) | [
"def",
"shell",
"(",
"name",
"=",
"None",
",",
"*",
"*",
"attrs",
")",
":",
"attrs",
".",
"setdefault",
"(",
"'cls'",
",",
"Shell",
")",
"return",
"click",
".",
"command",
"(",
"name",
",",
"*",
"*",
"attrs",
")"
] | Creates a new :class:`Shell` with a function as callback. This
works otherwise the same as :func:`command` just that the `cls`
parameter is set to :class:`Shell`. | [
"Creates",
"a",
"new",
":",
"class",
":",
"Shell",
"with",
"a",
"function",
"as",
"callback",
".",
"This",
"works",
"otherwise",
"the",
"same",
"as",
":",
"func",
":",
"command",
"just",
"that",
"the",
"cls",
"parameter",
"is",
"set",
"to",
":",
"class... | train | https://github.com/clarkperkins/click-shell/blob/8d6e1a492176bc79e029d714f19d3156409656ea/click_shell/decorators.py#L12-L18 |
glomex/gcdt | gcdt/gcdt_logging.py | getLogger | def getLogger(name):
"""This is used by gcdt plugins to get a logger with the right level."""
logger = logging.getLogger(name)
# note: the level might be adjusted via '-v' option
logger.setLevel(logging_config['loggers']['gcdt']['level'])
return logger | python | def getLogger(name):
"""This is used by gcdt plugins to get a logger with the right level."""
logger = logging.getLogger(name)
# note: the level might be adjusted via '-v' option
logger.setLevel(logging_config['loggers']['gcdt']['level'])
return logger | [
"def",
"getLogger",
"(",
"name",
")",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"name",
")",
"# note: the level might be adjusted via '-v' option",
"logger",
".",
"setLevel",
"(",
"logging_config",
"[",
"'loggers'",
"]",
"[",
"'gcdt'",
"]",
"[",
"'le... | This is used by gcdt plugins to get a logger with the right level. | [
"This",
"is",
"used",
"by",
"gcdt",
"plugins",
"to",
"get",
"a",
"logger",
"with",
"the",
"right",
"level",
"."
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/gcdt_logging.py#L70-L75 |
bernieke/python-magento | magento/magento_api.py | MagentoAPI._discover | def _discover(self):
"""Discovers methods in the XML-RPC API and creates attributes for them
on this object. Enables stuff like "magento.cart.create(...)" to work
without having to define Python methods for each XML-RPC equivalent.
"""
self._resources = {}
resources = se... | python | def _discover(self):
"""Discovers methods in the XML-RPC API and creates attributes for them
on this object. Enables stuff like "magento.cart.create(...)" to work
without having to define Python methods for each XML-RPC equivalent.
"""
self._resources = {}
resources = se... | [
"def",
"_discover",
"(",
"self",
")",
":",
"self",
".",
"_resources",
"=",
"{",
"}",
"resources",
"=",
"self",
".",
"_client",
".",
"resources",
"(",
"self",
".",
"_session_id",
")",
"for",
"resource",
"in",
"resources",
":",
"self",
".",
"_resources",
... | Discovers methods in the XML-RPC API and creates attributes for them
on this object. Enables stuff like "magento.cart.create(...)" to work
without having to define Python methods for each XML-RPC equivalent. | [
"Discovers",
"methods",
"in",
"the",
"XML",
"-",
"RPC",
"API",
"and",
"creates",
"attributes",
"for",
"them",
"on",
"this",
"object",
".",
"Enables",
"stuff",
"like",
"magento",
".",
"cart",
".",
"create",
"(",
"...",
")",
"to",
"work",
"without",
"havin... | train | https://github.com/bernieke/python-magento/blob/bfd23e233905b1b1491a7c07b9d833dfebd70456/magento/magento_api.py#L73-L84 |
bernieke/python-magento | magento/magento_api.py | MagentoAPI.keep_session_alive | def keep_session_alive(self):
"""If the session expired, logs back in."""
try:
self.resources()
except xmlrpclib.Fault as fault:
if fault.faultCode == 5:
self.login()
else:
raise | python | def keep_session_alive(self):
"""If the session expired, logs back in."""
try:
self.resources()
except xmlrpclib.Fault as fault:
if fault.faultCode == 5:
self.login()
else:
raise | [
"def",
"keep_session_alive",
"(",
"self",
")",
":",
"try",
":",
"self",
".",
"resources",
"(",
")",
"except",
"xmlrpclib",
".",
"Fault",
"as",
"fault",
":",
"if",
"fault",
".",
"faultCode",
"==",
"5",
":",
"self",
".",
"login",
"(",
")",
"else",
":",... | If the session expired, logs back in. | [
"If",
"the",
"session",
"expired",
"logs",
"back",
"in",
"."
] | train | https://github.com/bernieke/python-magento/blob/bfd23e233905b1b1491a7c07b9d833dfebd70456/magento/magento_api.py#L118-L127 |
bernieke/python-magento | magento/magento_api.py | MagentoAPI.help | def help(self):
"""Prints discovered resources and their associated methods. Nice when
noodling in the terminal to wrap your head around Magento's insanity.
"""
print('Resources:')
print('')
for name in sorted(self._resources.keys()):
methods = sorted(self._r... | python | def help(self):
"""Prints discovered resources and their associated methods. Nice when
noodling in the terminal to wrap your head around Magento's insanity.
"""
print('Resources:')
print('')
for name in sorted(self._resources.keys()):
methods = sorted(self._r... | [
"def",
"help",
"(",
"self",
")",
":",
"print",
"(",
"'Resources:'",
")",
"print",
"(",
"''",
")",
"for",
"name",
"in",
"sorted",
"(",
"self",
".",
"_resources",
".",
"keys",
"(",
")",
")",
":",
"methods",
"=",
"sorted",
"(",
"self",
".",
"_resource... | Prints discovered resources and their associated methods. Nice when
noodling in the terminal to wrap your head around Magento's insanity. | [
"Prints",
"discovered",
"resources",
"and",
"their",
"associated",
"methods",
".",
"Nice",
"when",
"noodling",
"in",
"the",
"terminal",
"to",
"wrap",
"your",
"head",
"around",
"Magento",
"s",
"insanity",
"."
] | train | https://github.com/bernieke/python-magento/blob/bfd23e233905b1b1491a7c07b9d833dfebd70456/magento/magento_api.py#L156-L165 |
gmr/helper | helper/setupext.py | RunCommand.run | def run(self):
"""Import the controller and run it.
This mimics the processing done by :func:`helper.start`
when a controller is run in the foreground. A new instance
of ``self.controller`` is created and run until a keyboard
interrupt occurs or the controller stops on its own ... | python | def run(self):
"""Import the controller and run it.
This mimics the processing done by :func:`helper.start`
when a controller is run in the foreground. A new instance
of ``self.controller`` is created and run until a keyboard
interrupt occurs or the controller stops on its own ... | [
"def",
"run",
"(",
"self",
")",
":",
"segments",
"=",
"self",
".",
"controller",
".",
"split",
"(",
"'.'",
")",
"controller_class",
"=",
"reduce",
"(",
"getattr",
",",
"segments",
"[",
"1",
":",
"]",
",",
"__import__",
"(",
"'.'",
".",
"join",
"(",
... | Import the controller and run it.
This mimics the processing done by :func:`helper.start`
when a controller is run in the foreground. A new instance
of ``self.controller`` is created and run until a keyboard
interrupt occurs or the controller stops on its own accord. | [
"Import",
"the",
"controller",
"and",
"run",
"it",
"."
] | train | https://github.com/gmr/helper/blob/fe8e45fc8eabf619429b2940c682c252ee33c082/helper/setupext.py#L50-L70 |
kz26/dottorrent | dottorrent/__init__.py | Torrent.get_info | def get_info(self):
"""
Scans the input path and automatically determines the optimal
piece size based on ~1500 pieces (up to MAX_PIECE_SIZE) along
with other basic info, including total size (in bytes), the
total number of files, piece size (in bytes), and resulting
numb... | python | def get_info(self):
"""
Scans the input path and automatically determines the optimal
piece size based on ~1500 pieces (up to MAX_PIECE_SIZE) along
with other basic info, including total size (in bytes), the
total number of files, piece size (in bytes), and resulting
numb... | [
"def",
"get_info",
"(",
"self",
")",
":",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"self",
".",
"path",
")",
":",
"total_size",
"=",
"os",
".",
"path",
".",
"getsize",
"(",
"self",
".",
"path",
")",
"total_files",
"=",
"1",
"elif",
"os",
".",... | Scans the input path and automatically determines the optimal
piece size based on ~1500 pieces (up to MAX_PIECE_SIZE) along
with other basic info, including total size (in bytes), the
total number of files, piece size (in bytes), and resulting
number of pieces. If ``piece_size`` has alre... | [
"Scans",
"the",
"input",
"path",
"and",
"automatically",
"determines",
"the",
"optimal",
"piece",
"size",
"based",
"on",
"~1500",
"pieces",
"(",
"up",
"to",
"MAX_PIECE_SIZE",
")",
"along",
"with",
"other",
"basic",
"info",
"including",
"total",
"size",
"(",
... | train | https://github.com/kz26/dottorrent/blob/fea5714efe0cde2a55eabfb387295781a78d84bb/dottorrent/__init__.py#L154-L192 |
kz26/dottorrent | dottorrent/__init__.py | Torrent.generate | def generate(self, callback=None):
"""
Computes and stores piece data. Returns ``True`` on success, ``False``
otherwise.
:param callback: progress/cancellation callable with method
signature ``(filename, pieces_completed, pieces_total)``.
Useful for reporting pro... | python | def generate(self, callback=None):
"""
Computes and stores piece data. Returns ``True`` on success, ``False``
otherwise.
:param callback: progress/cancellation callable with method
signature ``(filename, pieces_completed, pieces_total)``.
Useful for reporting pro... | [
"def",
"generate",
"(",
"self",
",",
"callback",
"=",
"None",
")",
":",
"files",
"=",
"[",
"]",
"single_file",
"=",
"os",
".",
"path",
".",
"isfile",
"(",
"self",
".",
"path",
")",
"if",
"single_file",
":",
"files",
".",
"append",
"(",
"(",
"self",... | Computes and stores piece data. Returns ``True`` on success, ``False``
otherwise.
:param callback: progress/cancellation callable with method
signature ``(filename, pieces_completed, pieces_total)``.
Useful for reporting progress if dottorrent is used in a
GUI/thread... | [
"Computes",
"and",
"stores",
"piece",
"data",
".",
"Returns",
"True",
"on",
"success",
"False",
"otherwise",
"."
] | train | https://github.com/kz26/dottorrent/blob/fea5714efe0cde2a55eabfb387295781a78d84bb/dottorrent/__init__.py#L194-L311 |
kz26/dottorrent | dottorrent/__init__.py | Torrent.info_hash_base32 | def info_hash_base32(self):
"""
Returns the base32 info hash of the torrent. Useful for generating
magnet links.
.. note:: ``generate()`` must be called first.
"""
if getattr(self, '_data', None):
return b32encode(sha1(bencode(self._data['info'])).digest())
... | python | def info_hash_base32(self):
"""
Returns the base32 info hash of the torrent. Useful for generating
magnet links.
.. note:: ``generate()`` must be called first.
"""
if getattr(self, '_data', None):
return b32encode(sha1(bencode(self._data['info'])).digest())
... | [
"def",
"info_hash_base32",
"(",
"self",
")",
":",
"if",
"getattr",
"(",
"self",
",",
"'_data'",
",",
"None",
")",
":",
"return",
"b32encode",
"(",
"sha1",
"(",
"bencode",
"(",
"self",
".",
"_data",
"[",
"'info'",
"]",
")",
")",
".",
"digest",
"(",
... | Returns the base32 info hash of the torrent. Useful for generating
magnet links.
.. note:: ``generate()`` must be called first. | [
"Returns",
"the",
"base32",
"info",
"hash",
"of",
"the",
"torrent",
".",
"Useful",
"for",
"generating",
"magnet",
"links",
"."
] | train | https://github.com/kz26/dottorrent/blob/fea5714efe0cde2a55eabfb387295781a78d84bb/dottorrent/__init__.py#L327-L337 |
kz26/dottorrent | dottorrent/__init__.py | Torrent.info_hash | def info_hash(self):
"""
:return: The SHA-1 info hash of the torrent. Useful for generating
magnet links.
.. note:: ``generate()`` must be called first.
"""
if getattr(self, '_data', None):
return sha1(bencode(self._data['info'])).hexdigest()
else... | python | def info_hash(self):
"""
:return: The SHA-1 info hash of the torrent. Useful for generating
magnet links.
.. note:: ``generate()`` must be called first.
"""
if getattr(self, '_data', None):
return sha1(bencode(self._data['info'])).hexdigest()
else... | [
"def",
"info_hash",
"(",
"self",
")",
":",
"if",
"getattr",
"(",
"self",
",",
"'_data'",
",",
"None",
")",
":",
"return",
"sha1",
"(",
"bencode",
"(",
"self",
".",
"_data",
"[",
"'info'",
"]",
")",
")",
".",
"hexdigest",
"(",
")",
"else",
":",
"r... | :return: The SHA-1 info hash of the torrent. Useful for generating
magnet links.
.. note:: ``generate()`` must be called first. | [
":",
"return",
":",
"The",
"SHA",
"-",
"1",
"info",
"hash",
"of",
"the",
"torrent",
".",
"Useful",
"for",
"generating",
"magnet",
"links",
"."
] | train | https://github.com/kz26/dottorrent/blob/fea5714efe0cde2a55eabfb387295781a78d84bb/dottorrent/__init__.py#L340-L350 |
acrazing/dbapi | dbapi/base.py | BaseAPI.req | def req(self, url, method='get', params=None, data=None, auth=False):
"""
请求API
:type url: str
:param url: API
:type method: str
:param method: HTTP METHOD
:type params: dict
:param params: query
:type data: dict
... | python | def req(self, url, method='get', params=None, data=None, auth=False):
"""
请求API
:type url: str
:param url: API
:type method: str
:param method: HTTP METHOD
:type params: dict
:param params: query
:type data: dict
... | [
"def",
"req",
"(",
"self",
",",
"url",
",",
"method",
"=",
"'get'",
",",
"params",
"=",
"None",
",",
"data",
"=",
"None",
",",
"auth",
"=",
"False",
")",
":",
"self",
".",
"logger",
".",
"debug",
"(",
"'fetch api<%s:%s>'",
"%",
"(",
"method",
",",
... | 请求API
:type url: str
:param url: API
:type method: str
:param method: HTTP METHOD
:type params: dict
:param params: query
:type data: dict
:param data: body
:type auth: bool
:param auth: if True and sess... | [
"请求API"
] | train | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/base.py#L71-L104 |
acrazing/dbapi | dbapi/base.py | BaseAPI.json | def json(self, url, method='get', params=None, data=None):
"""
请求并返回json
:type url: str
:param url: API
:type method: str
:param method: HTTP METHOD
:type params: dict
:param params: query
:type data: di... | python | def json(self, url, method='get', params=None, data=None):
"""
请求并返回json
:type url: str
:param url: API
:type method: str
:param method: HTTP METHOD
:type params: dict
:param params: query
:type data: di... | [
"def",
"json",
"(",
"self",
",",
"url",
",",
"method",
"=",
"'get'",
",",
"params",
"=",
"None",
",",
"data",
"=",
"None",
")",
":",
"r",
"=",
"self",
".",
"req",
"(",
"url",
",",
"method",
",",
"params",
",",
"data",
")",
"return",
"r",
".",
... | 请求并返回json
:type url: str
:param url: API
:type method: str
:param method: HTTP METHOD
:type params: dict
:param params: query
:type data: dict
:param data: body
:rtype: dict
:return: | [
"请求并返回json",
":",
"type",
"url",
":",
"str",
":",
"param",
"url",
":",
"API",
":",
"type",
"method",
":",
"str",
":",
"param",
"method",
":",
"HTTP",
"METHOD",
":",
"type",
"params",
":",
"dict",
":",
"param",
"params",
":",
"query",
":",
"type",
"... | train | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/base.py#L106-L127 |
acrazing/dbapi | dbapi/base.py | BaseAPI.xml | def xml(self, url, method='get', params=None, data=None):
"""
请求并返回xml
:type url: str
:param url: API
:type method: str
:param method: HTTP METHOD
:type params: dict
:param params: query
:type data: dict
... | python | def xml(self, url, method='get', params=None, data=None):
"""
请求并返回xml
:type url: str
:param url: API
:type method: str
:param method: HTTP METHOD
:type params: dict
:param params: query
:type data: dict
... | [
"def",
"xml",
"(",
"self",
",",
"url",
",",
"method",
"=",
"'get'",
",",
"params",
"=",
"None",
",",
"data",
"=",
"None",
")",
":",
"r",
"=",
"self",
".",
"req",
"(",
"url",
",",
"method",
",",
"params",
",",
"data",
")",
"# this is required for av... | 请求并返回xml
:type url: str
:param url: API
:type method: str
:param method: HTTP METHOD
:type params: dict
:param params: query
:type data: dict
:param data: body
:rtype: html.HtmlElement
:return: | [
"请求并返回xml",
":",
"type",
"url",
":",
"str",
":",
"param",
"url",
":",
"API",
":",
"type",
"method",
":",
"str",
":",
"param",
"method",
":",
"HTTP",
"METHOD",
":",
"type",
"params",
":",
"dict",
":",
"param",
"params",
":",
"query",
":",
"type",
"d... | train | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/base.py#L133-L154 |
acrazing/dbapi | dbapi/base.py | BaseAPI.persist | def persist(self):
"""
持久化会话信息
"""
with open(self.persist_file, 'w+') as f:
json.dump({
'cookies': self.cookies,
'user_alias': self.user_alias,
}, f, indent=2)
self.logger.debug('persist session to <%s>' % self.persist_f... | python | def persist(self):
"""
持久化会话信息
"""
with open(self.persist_file, 'w+') as f:
json.dump({
'cookies': self.cookies,
'user_alias': self.user_alias,
}, f, indent=2)
self.logger.debug('persist session to <%s>' % self.persist_f... | [
"def",
"persist",
"(",
"self",
")",
":",
"with",
"open",
"(",
"self",
".",
"persist_file",
",",
"'w+'",
")",
"as",
"f",
":",
"json",
".",
"dump",
"(",
"{",
"'cookies'",
":",
"self",
".",
"cookies",
",",
"'user_alias'",
":",
"self",
".",
"user_alias",... | 持久化会话信息 | [
"持久化会话信息"
] | train | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/base.py#L156-L165 |
acrazing/dbapi | dbapi/base.py | BaseAPI.load | def load(self):
"""
加载会话信息
"""
if not os.path.isfile(self.persist_file):
return
with open(self.persist_file, 'r') as f:
cfg = json.load(f) or {}
self.cookies = cfg.get('cookies', {})
self.user_alias = cfg.get('user_alias') or None
... | python | def load(self):
"""
加载会话信息
"""
if not os.path.isfile(self.persist_file):
return
with open(self.persist_file, 'r') as f:
cfg = json.load(f) or {}
self.cookies = cfg.get('cookies', {})
self.user_alias = cfg.get('user_alias') or None
... | [
"def",
"load",
"(",
"self",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"self",
".",
"persist_file",
")",
":",
"return",
"with",
"open",
"(",
"self",
".",
"persist_file",
",",
"'r'",
")",
"as",
"f",
":",
"cfg",
"=",
"json",
".",... | 加载会话信息 | [
"加载会话信息"
] | train | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/base.py#L167-L177 |
acrazing/dbapi | dbapi/base.py | BaseAPI.flush | def flush(self):
"""
更新会话信息,主要是ck, user_alias
"""
if 'dbcl2' not in self.cookies:
return
r = self.req(API_ACCOUNT_HOME)
if RE_SESSION_EXPIRE.search(r.url):
return self.expire()
self.cookies.update(dict(r.cookies))
self.user_alias = ... | python | def flush(self):
"""
更新会话信息,主要是ck, user_alias
"""
if 'dbcl2' not in self.cookies:
return
r = self.req(API_ACCOUNT_HOME)
if RE_SESSION_EXPIRE.search(r.url):
return self.expire()
self.cookies.update(dict(r.cookies))
self.user_alias = ... | [
"def",
"flush",
"(",
"self",
")",
":",
"if",
"'dbcl2'",
"not",
"in",
"self",
".",
"cookies",
":",
"return",
"r",
"=",
"self",
".",
"req",
"(",
"API_ACCOUNT_HOME",
")",
"if",
"RE_SESSION_EXPIRE",
".",
"search",
"(",
"r",
".",
"url",
")",
":",
"return"... | 更新会话信息,主要是ck, user_alias | [
"更新会话信息,主要是ck",
"user_alias"
] | train | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/base.py#L187-L199 |
acrazing/dbapi | dbapi/base.py | BaseAPI.login | def login(self, username, password):
"""
登录
:type username: str
:param username: 用户名(手机号或者邮箱)
:type password: str
:param password: 密码
"""
r0 = self.req(API_HOME)
time.sleep(1)
cookies = dict(r0.cookies)
data = {
... | python | def login(self, username, password):
"""
登录
:type username: str
:param username: 用户名(手机号或者邮箱)
:type password: str
:param password: 密码
"""
r0 = self.req(API_HOME)
time.sleep(1)
cookies = dict(r0.cookies)
data = {
... | [
"def",
"login",
"(",
"self",
",",
"username",
",",
"password",
")",
":",
"r0",
"=",
"self",
".",
"req",
"(",
"API_HOME",
")",
"time",
".",
"sleep",
"(",
"1",
")",
"cookies",
"=",
"dict",
"(",
"r0",
".",
"cookies",
")",
"data",
"=",
"{",
"'source'... | 登录
:type username: str
:param username: 用户名(手机号或者邮箱)
:type password: str
:param password: 密码 | [
"登录",
":",
"type",
"username",
":",
"str",
":",
"param",
"username",
":",
"用户名(手机号或者邮箱)",
":",
"type",
"password",
":",
"str",
":",
"param",
"password",
":",
"密码"
] | train | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/base.py#L201-L228 |
acrazing/dbapi | dbapi/base.py | BaseAPI.use | def use(self, cookies):
"""
如果遭遇验证码,用这个接口
:type cookies: str|dict
:param cookies: cookie字符串或者字典
:return: self
"""
self.cookies = dict([item.split('=', 1) for item in re.split(r'; *', cookies)]) \
if isinstance(cookies, str) else cookies
... | python | def use(self, cookies):
"""
如果遭遇验证码,用这个接口
:type cookies: str|dict
:param cookies: cookie字符串或者字典
:return: self
"""
self.cookies = dict([item.split('=', 1) for item in re.split(r'; *', cookies)]) \
if isinstance(cookies, str) else cookies
... | [
"def",
"use",
"(",
"self",
",",
"cookies",
")",
":",
"self",
".",
"cookies",
"=",
"dict",
"(",
"[",
"item",
".",
"split",
"(",
"'='",
",",
"1",
")",
"for",
"item",
"in",
"re",
".",
"split",
"(",
"r'; *'",
",",
"cookies",
")",
"]",
")",
"if",
... | 如果遭遇验证码,用这个接口
:type cookies: str|dict
:param cookies: cookie字符串或者字典
:return: self | [
"如果遭遇验证码,用这个接口",
":",
"type",
"cookies",
":",
"str|dict",
":",
"param",
"cookies",
":",
"cookie字符串或者字典",
":",
"return",
":",
"self"
] | train | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/base.py#L230-L242 |
acrazing/dbapi | dbapi/base.py | BaseAPI.logout | def logout(self):
"""
登出会话
:return: self
"""
self.req(API_ACCOUNT_LOGOUT % self.ck())
self.cookies = {}
self.user_alias = None
self.persist() | python | def logout(self):
"""
登出会话
:return: self
"""
self.req(API_ACCOUNT_LOGOUT % self.ck())
self.cookies = {}
self.user_alias = None
self.persist() | [
"def",
"logout",
"(",
"self",
")",
":",
"self",
".",
"req",
"(",
"API_ACCOUNT_LOGOUT",
"%",
"self",
".",
"ck",
"(",
")",
")",
"self",
".",
"cookies",
"=",
"{",
"}",
"self",
".",
"user_alias",
"=",
"None",
"self",
".",
"persist",
"(",
")"
] | 登出会话
:return: self | [
"登出会话",
":",
"return",
":",
"self"
] | train | https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/base.py#L244-L253 |
glomex/gcdt | gcdt/tenkai_core.py | deploy | def deploy(awsclient, applicationName, deploymentGroupName,
deploymentConfigName, bucket, bundlefile):
"""Upload bundle and deploy to deployment group.
This includes the bundle-action.
:param applicationName:
:param deploymentGroupName:
:param deploymentConfigName:
:param bucket:
... | python | def deploy(awsclient, applicationName, deploymentGroupName,
deploymentConfigName, bucket, bundlefile):
"""Upload bundle and deploy to deployment group.
This includes the bundle-action.
:param applicationName:
:param deploymentGroupName:
:param deploymentConfigName:
:param bucket:
... | [
"def",
"deploy",
"(",
"awsclient",
",",
"applicationName",
",",
"deploymentGroupName",
",",
"deploymentConfigName",
",",
"bucket",
",",
"bundlefile",
")",
":",
"etag",
",",
"version",
"=",
"upload_file_to_s3",
"(",
"awsclient",
",",
"bucket",
",",
"_build_bundle_k... | Upload bundle and deploy to deployment group.
This includes the bundle-action.
:param applicationName:
:param deploymentGroupName:
:param deploymentConfigName:
:param bucket:
:param bundlefile:
:return: deploymentId from create_deployment | [
"Upload",
"bundle",
"and",
"deploy",
"to",
"deployment",
"group",
".",
"This",
"includes",
"the",
"bundle",
"-",
"action",
"."
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/tenkai_core.py#L18-L61 |
glomex/gcdt | gcdt/tenkai_core.py | output_deployment_status | def output_deployment_status(awsclient, deployment_id, iterations=100):
"""Wait until an deployment is in an steady state and output information.
:param deployment_id:
:param iterations:
:return: exit_code
"""
counter = 0
steady_states = ['Succeeded', 'Failed', 'Stopped']
client_codedep... | python | def output_deployment_status(awsclient, deployment_id, iterations=100):
"""Wait until an deployment is in an steady state and output information.
:param deployment_id:
:param iterations:
:return: exit_code
"""
counter = 0
steady_states = ['Succeeded', 'Failed', 'Stopped']
client_codedep... | [
"def",
"output_deployment_status",
"(",
"awsclient",
",",
"deployment_id",
",",
"iterations",
"=",
"100",
")",
":",
"counter",
"=",
"0",
"steady_states",
"=",
"[",
"'Succeeded'",
",",
"'Failed'",
",",
"'Stopped'",
"]",
"client_codedeploy",
"=",
"awsclient",
".",... | Wait until an deployment is in an steady state and output information.
:param deployment_id:
:param iterations:
:return: exit_code | [
"Wait",
"until",
"an",
"deployment",
"is",
"in",
"an",
"steady",
"state",
"and",
"output",
"information",
"."
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/tenkai_core.py#L69-L100 |
glomex/gcdt | gcdt/tenkai_core.py | stop_deployment | def stop_deployment(awsclient, deployment_id):
"""stop tenkai deployment.
:param awsclient:
:param deployment_id:
"""
log.info('Deployment: %s - stopping active deployment.', deployment_id)
client_codedeploy = awsclient.get_client('codedeploy')
response = client_codedeploy.stop_deployment(... | python | def stop_deployment(awsclient, deployment_id):
"""stop tenkai deployment.
:param awsclient:
:param deployment_id:
"""
log.info('Deployment: %s - stopping active deployment.', deployment_id)
client_codedeploy = awsclient.get_client('codedeploy')
response = client_codedeploy.stop_deployment(... | [
"def",
"stop_deployment",
"(",
"awsclient",
",",
"deployment_id",
")",
":",
"log",
".",
"info",
"(",
"'Deployment: %s - stopping active deployment.'",
",",
"deployment_id",
")",
"client_codedeploy",
"=",
"awsclient",
".",
"get_client",
"(",
"'codedeploy'",
")",
"respo... | stop tenkai deployment.
:param awsclient:
:param deployment_id: | [
"stop",
"tenkai",
"deployment",
"."
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/tenkai_core.py#L103-L115 |
glomex/gcdt | gcdt/tenkai_core.py | _list_deployment_instances | def _list_deployment_instances(awsclient, deployment_id):
"""list deployment instances.
:param awsclient:
:param deployment_id:
"""
client_codedeploy = awsclient.get_client('codedeploy')
instances = []
next_token = None
# TODO refactor generic exhaust_function from this
while True... | python | def _list_deployment_instances(awsclient, deployment_id):
"""list deployment instances.
:param awsclient:
:param deployment_id:
"""
client_codedeploy = awsclient.get_client('codedeploy')
instances = []
next_token = None
# TODO refactor generic exhaust_function from this
while True... | [
"def",
"_list_deployment_instances",
"(",
"awsclient",
",",
"deployment_id",
")",
":",
"client_codedeploy",
"=",
"awsclient",
".",
"get_client",
"(",
"'codedeploy'",
")",
"instances",
"=",
"[",
"]",
"next_token",
"=",
"None",
"# TODO refactor generic exhaust_function fr... | list deployment instances.
:param awsclient:
:param deployment_id: | [
"list",
"deployment",
"instances",
"."
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/tenkai_core.py#L118-L141 |
glomex/gcdt | gcdt/tenkai_core.py | _get_deployment_instance_summary | def _get_deployment_instance_summary(awsclient, deployment_id, instance_id):
"""instance summary.
:param awsclient:
:param deployment_id:
:param instance_id:
return: status, last_event
"""
client_codedeploy = awsclient.get_client('codedeploy')
request = {
'deploymentId': deploym... | python | def _get_deployment_instance_summary(awsclient, deployment_id, instance_id):
"""instance summary.
:param awsclient:
:param deployment_id:
:param instance_id:
return: status, last_event
"""
client_codedeploy = awsclient.get_client('codedeploy')
request = {
'deploymentId': deploym... | [
"def",
"_get_deployment_instance_summary",
"(",
"awsclient",
",",
"deployment_id",
",",
"instance_id",
")",
":",
"client_codedeploy",
"=",
"awsclient",
".",
"get_client",
"(",
"'codedeploy'",
")",
"request",
"=",
"{",
"'deploymentId'",
":",
"deployment_id",
",",
"'i... | instance summary.
:param awsclient:
:param deployment_id:
:param instance_id:
return: status, last_event | [
"instance",
"summary",
"."
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/tenkai_core.py#L144-L159 |
glomex/gcdt | gcdt/tenkai_core.py | _get_deployment_instance_diagnostics | def _get_deployment_instance_diagnostics(awsclient, deployment_id, instance_id):
"""Gets you the diagnostics details for the first 'Failed' event.
:param awsclient:
:param deployment_id:
:param instance_id:
return: None or (error_code, script_name, message, log_tail)
"""
client_codedeploy =... | python | def _get_deployment_instance_diagnostics(awsclient, deployment_id, instance_id):
"""Gets you the diagnostics details for the first 'Failed' event.
:param awsclient:
:param deployment_id:
:param instance_id:
return: None or (error_code, script_name, message, log_tail)
"""
client_codedeploy =... | [
"def",
"_get_deployment_instance_diagnostics",
"(",
"awsclient",
",",
"deployment_id",
",",
"instance_id",
")",
":",
"client_codedeploy",
"=",
"awsclient",
".",
"get_client",
"(",
"'codedeploy'",
")",
"request",
"=",
"{",
"'deploymentId'",
":",
"deployment_id",
",",
... | Gets you the diagnostics details for the first 'Failed' event.
:param awsclient:
:param deployment_id:
:param instance_id:
return: None or (error_code, script_name, message, log_tail) | [
"Gets",
"you",
"the",
"diagnostics",
"details",
"for",
"the",
"first",
"Failed",
"event",
"."
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/tenkai_core.py#L162-L183 |
glomex/gcdt | gcdt/tenkai_core.py | output_deployment_summary | def output_deployment_summary(awsclient, deployment_id):
"""summary
:param awsclient:
:param deployment_id:
"""
log.info('\ndeployment summary:')
log.info('%-22s %-12s %s', 'Instance ID', 'Status', 'Most recent event')
for instance_id in _list_deployment_instances(awsclient, deployment_id):... | python | def output_deployment_summary(awsclient, deployment_id):
"""summary
:param awsclient:
:param deployment_id:
"""
log.info('\ndeployment summary:')
log.info('%-22s %-12s %s', 'Instance ID', 'Status', 'Most recent event')
for instance_id in _list_deployment_instances(awsclient, deployment_id):... | [
"def",
"output_deployment_summary",
"(",
"awsclient",
",",
"deployment_id",
")",
":",
"log",
".",
"info",
"(",
"'\\ndeployment summary:'",
")",
"log",
".",
"info",
"(",
"'%-22s %-12s %s'",
",",
"'Instance ID'",
",",
"'Status'",
",",
"'Most recent event'",
")",
"fo... | summary
:param awsclient:
:param deployment_id: | [
"summary"
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/tenkai_core.py#L186-L198 |
glomex/gcdt | gcdt/tenkai_core.py | output_deployment_diagnostics | def output_deployment_diagnostics(awsclient, deployment_id, log_group, start_time=None):
"""diagnostics
:param awsclient:
:param deployment_id:
"""
headline = False
for instance_id in _list_deployment_instances(awsclient, deployment_id):
diagnostics = _get_deployment_instance_diagnostic... | python | def output_deployment_diagnostics(awsclient, deployment_id, log_group, start_time=None):
"""diagnostics
:param awsclient:
:param deployment_id:
"""
headline = False
for instance_id in _list_deployment_instances(awsclient, deployment_id):
diagnostics = _get_deployment_instance_diagnostic... | [
"def",
"output_deployment_diagnostics",
"(",
"awsclient",
",",
"deployment_id",
",",
"log_group",
",",
"start_time",
"=",
"None",
")",
":",
"headline",
"=",
"False",
"for",
"instance_id",
"in",
"_list_deployment_instances",
"(",
"awsclient",
",",
"deployment_id",
")... | diagnostics
:param awsclient:
:param deployment_id: | [
"diagnostics"
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/tenkai_core.py#L201-L232 |
thombashi/typepy | typepy/type/_base.py | AbstractType.is_type | def is_type(self):
"""
:return:
:rtype: bool
"""
if self.__is_type_result is not None:
return self.__is_type_result
self.__is_type_result = self.__is_type()
return self.__is_type_result | python | def is_type(self):
"""
:return:
:rtype: bool
"""
if self.__is_type_result is not None:
return self.__is_type_result
self.__is_type_result = self.__is_type()
return self.__is_type_result | [
"def",
"is_type",
"(",
"self",
")",
":",
"if",
"self",
".",
"__is_type_result",
"is",
"not",
"None",
":",
"return",
"self",
".",
"__is_type_result",
"self",
".",
"__is_type_result",
"=",
"self",
".",
"__is_type",
"(",
")",
"return",
"self",
".",
"__is_type... | :return:
:rtype: bool | [
":",
"return",
":",
":",
"rtype",
":",
"bool"
] | train | https://github.com/thombashi/typepy/blob/8209d1df4f2a7f196a9fa4bfb0708c5ff648461f/typepy/type/_base.py#L63-L74 |
thombashi/typepy | typepy/type/_base.py | AbstractType.validate | def validate(self, error_message=None):
"""
:raises TypeError:
If the value is not matched the type that the class represented.
"""
if self.is_type():
return
if not error_message:
error_message = "invalid value type"
raise TypeError(... | python | def validate(self, error_message=None):
"""
:raises TypeError:
If the value is not matched the type that the class represented.
"""
if self.is_type():
return
if not error_message:
error_message = "invalid value type"
raise TypeError(... | [
"def",
"validate",
"(",
"self",
",",
"error_message",
"=",
"None",
")",
":",
"if",
"self",
".",
"is_type",
"(",
")",
":",
"return",
"if",
"not",
"error_message",
":",
"error_message",
"=",
"\"invalid value type\"",
"raise",
"TypeError",
"(",
"\"{}: expected={}... | :raises TypeError:
If the value is not matched the type that the class represented. | [
":",
"raises",
"TypeError",
":",
"If",
"the",
"value",
"is",
"not",
"matched",
"the",
"type",
"that",
"the",
"class",
"represented",
"."
] | train | https://github.com/thombashi/typepy/blob/8209d1df4f2a7f196a9fa4bfb0708c5ff648461f/typepy/type/_base.py#L93-L107 |
thombashi/typepy | typepy/type/_base.py | AbstractType.convert | def convert(self):
"""
:return: Converted value.
:raises typepy.TypeConversionError:
If the value cannot convert.
"""
if self.is_type():
return self.force_convert()
raise TypeConversionError(
"failed to convert from {} to {}".format(t... | python | def convert(self):
"""
:return: Converted value.
:raises typepy.TypeConversionError:
If the value cannot convert.
"""
if self.is_type():
return self.force_convert()
raise TypeConversionError(
"failed to convert from {} to {}".format(t... | [
"def",
"convert",
"(",
"self",
")",
":",
"if",
"self",
".",
"is_type",
"(",
")",
":",
"return",
"self",
".",
"force_convert",
"(",
")",
"raise",
"TypeConversionError",
"(",
"\"failed to convert from {} to {}\"",
".",
"format",
"(",
"type",
"(",
"self",
".",
... | :return: Converted value.
:raises typepy.TypeConversionError:
If the value cannot convert. | [
":",
"return",
":",
"Converted",
"value",
".",
":",
"raises",
"typepy",
".",
"TypeConversionError",
":",
"If",
"the",
"value",
"cannot",
"convert",
"."
] | train | https://github.com/thombashi/typepy/blob/8209d1df4f2a7f196a9fa4bfb0708c5ff648461f/typepy/type/_base.py#L109-L121 |
jay-johnson/celery-loaders | celery_loaders/work_tasks/always_fails_tasks.py | always_fails | def always_fails(
self,
work_dict):
"""always_fails
:param work_dict: dictionary for key/values
"""
label = "always_fails"
log.info(("task - {} - start "
"work_dict={}")
.format(label,
work_dict))
raise Exception(
wo... | python | def always_fails(
self,
work_dict):
"""always_fails
:param work_dict: dictionary for key/values
"""
label = "always_fails"
log.info(("task - {} - start "
"work_dict={}")
.format(label,
work_dict))
raise Exception(
wo... | [
"def",
"always_fails",
"(",
"self",
",",
"work_dict",
")",
":",
"label",
"=",
"\"always_fails\"",
"log",
".",
"info",
"(",
"(",
"\"task - {} - start \"",
"\"work_dict={}\"",
")",
".",
"format",
"(",
"label",
",",
"work_dict",
")",
")",
"raise",
"Exception",
... | always_fails
:param work_dict: dictionary for key/values | [
"always_fails"
] | train | https://github.com/jay-johnson/celery-loaders/blob/aca8169c774582af42a377c27cb3980020080814/celery_loaders/work_tasks/always_fails_tasks.py#L14-L37 |
glomex/gcdt | gcdt/iam.py | IAMRoleAndPolicies.name_build | def name_build(self, name, is_policy=False, prefix=True):
"""
Build name from prefix and name + type
:param name: Name of the role/policy
:param is_policy: True if policy should be added as suffix
:param prefix: True if prefix should be added
:return: Joined name
... | python | def name_build(self, name, is_policy=False, prefix=True):
"""
Build name from prefix and name + type
:param name: Name of the role/policy
:param is_policy: True if policy should be added as suffix
:param prefix: True if prefix should be added
:return: Joined name
... | [
"def",
"name_build",
"(",
"self",
",",
"name",
",",
"is_policy",
"=",
"False",
",",
"prefix",
"=",
"True",
")",
":",
"str",
"=",
"name",
"# Add prefix",
"if",
"prefix",
":",
"str",
"=",
"self",
".",
"__role_name_prefix",
"+",
"str",
"# Add policy suffix",
... | Build name from prefix and name + type
:param name: Name of the role/policy
:param is_policy: True if policy should be added as suffix
:param prefix: True if prefix should be added
:return: Joined name | [
"Build",
"name",
"from",
"prefix",
"and",
"name",
"+",
"type",
":",
"param",
"name",
":",
"Name",
"of",
"the",
"role",
"/",
"policy",
":",
"param",
"is_policy",
":",
"True",
"if",
"policy",
"should",
"be",
"added",
"as",
"suffix",
":",
"param",
"prefix... | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/iam.py#L47-L65 |
glomex/gcdt | gcdt/iam.py | IAMRoleAndPolicies.name_strip | def name_strip(self, name, is_policy=False, prefix=True):
"""
Transforms name to AWS valid characters and adds prefix and type
:param name: Name of the role/policy
:param is_policy: True if policy should be added as suffix
:param prefix: True if prefix should be added
:re... | python | def name_strip(self, name, is_policy=False, prefix=True):
"""
Transforms name to AWS valid characters and adds prefix and type
:param name: Name of the role/policy
:param is_policy: True if policy should be added as suffix
:param prefix: True if prefix should be added
:re... | [
"def",
"name_strip",
"(",
"self",
",",
"name",
",",
"is_policy",
"=",
"False",
",",
"prefix",
"=",
"True",
")",
":",
"str",
"=",
"self",
".",
"name_build",
"(",
"name",
",",
"is_policy",
",",
"prefix",
")",
"str",
"=",
"str",
".",
"title",
"(",
")"... | Transforms name to AWS valid characters and adds prefix and type
:param name: Name of the role/policy
:param is_policy: True if policy should be added as suffix
:param prefix: True if prefix should be added
:return: Transformed and joined name | [
"Transforms",
"name",
"to",
"AWS",
"valid",
"characters",
"and",
"adds",
"prefix",
"and",
"type",
":",
"param",
"name",
":",
"Name",
"of",
"the",
"role",
"/",
"policy",
":",
"param",
"is_policy",
":",
"True",
"if",
"policy",
"should",
"be",
"added",
"as"... | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/iam.py#L67-L78 |
glomex/gcdt | gcdt/iam.py | IAMRoleAndPolicies.build_policy | def build_policy(self, name, statements, roles, is_managed_policy=False):
"""
Generate policy for IAM cloudformation template
:param name: Name of the policy
:param statements: The "rules" the policy should have
:param roles: The roles associated with this policy
:param i... | python | def build_policy(self, name, statements, roles, is_managed_policy=False):
"""
Generate policy for IAM cloudformation template
:param name: Name of the policy
:param statements: The "rules" the policy should have
:param roles: The roles associated with this policy
:param i... | [
"def",
"build_policy",
"(",
"self",
",",
"name",
",",
"statements",
",",
"roles",
",",
"is_managed_policy",
"=",
"False",
")",
":",
"if",
"is_managed_policy",
":",
"policy",
"=",
"ManagedPolicy",
"(",
"self",
".",
"name_strip",
"(",
"name",
",",
"True",
")... | Generate policy for IAM cloudformation template
:param name: Name of the policy
:param statements: The "rules" the policy should have
:param roles: The roles associated with this policy
:param is_managed_policy: True if managed policy
:return: Ref to new policy | [
"Generate",
"policy",
"for",
"IAM",
"cloudformation",
"template",
":",
"param",
"name",
":",
"Name",
"of",
"the",
"policy",
":",
"param",
"statements",
":",
"The",
"rules",
"the",
"policy",
"should",
"have",
":",
"param",
"roles",
":",
"The",
"roles",
"ass... | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/iam.py#L80-L111 |
glomex/gcdt | gcdt/iam.py | IAMRoleAndPolicies.build_policy_bucket | def build_policy_bucket(self, bucket, name, statements):
"""
Generate bucket policy for S3 bucket
:param bucket: The bucket to attach policy to
:param name: The name of the bucket (to generate policy name from it)
:param statements: The "rules" the policy should have
:ret... | python | def build_policy_bucket(self, bucket, name, statements):
"""
Generate bucket policy for S3 bucket
:param bucket: The bucket to attach policy to
:param name: The name of the bucket (to generate policy name from it)
:param statements: The "rules" the policy should have
:ret... | [
"def",
"build_policy_bucket",
"(",
"self",
",",
"bucket",
",",
"name",
",",
"statements",
")",
":",
"policy",
"=",
"self",
".",
"__template",
".",
"add_resource",
"(",
"BucketPolicy",
"(",
"self",
".",
"name_strip",
"(",
"name",
",",
"True",
",",
"False",
... | Generate bucket policy for S3 bucket
:param bucket: The bucket to attach policy to
:param name: The name of the bucket (to generate policy name from it)
:param statements: The "rules" the policy should have
:return: Ref to new policy | [
"Generate",
"bucket",
"policy",
"for",
"S3",
"bucket",
":",
"param",
"bucket",
":",
"The",
"bucket",
"to",
"attach",
"policy",
"to",
":",
"param",
"name",
":",
"The",
"name",
"of",
"the",
"bucket",
"(",
"to",
"generate",
"policy",
"name",
"from",
"it",
... | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/iam.py#L113-L136 |
glomex/gcdt | gcdt/iam.py | IAMRoleAndPolicies.build_role | def build_role(self, name, policies=False):
"""
Generate role for IAM cloudformation template
:param name: Name of role
:param policies: List of policies to attach to this role (False = none)
:return: Ref to new role
"""
# Build role template
if policies:
... | python | def build_role(self, name, policies=False):
"""
Generate role for IAM cloudformation template
:param name: Name of role
:param policies: List of policies to attach to this role (False = none)
:return: Ref to new role
"""
# Build role template
if policies:
... | [
"def",
"build_role",
"(",
"self",
",",
"name",
",",
"policies",
"=",
"False",
")",
":",
"# Build role template",
"if",
"policies",
":",
"role",
"=",
"self",
".",
"__template",
".",
"add_resource",
"(",
"Role",
"(",
"self",
".",
"name_strip",
"(",
"name",
... | Generate role for IAM cloudformation template
:param name: Name of role
:param policies: List of policies to attach to this role (False = none)
:return: Ref to new role | [
"Generate",
"role",
"for",
"IAM",
"cloudformation",
"template",
":",
"param",
"name",
":",
"Name",
"of",
"role",
":",
"param",
"policies",
":",
"List",
"of",
"policies",
"to",
"attach",
"to",
"this",
"role",
"(",
"False",
"=",
"none",
")",
":",
"return",... | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/iam.py#L138-L188 |
glomex/gcdt | gcdt/iam.py | IAMRoleAndPolicies.build_bucket | def build_bucket(self, name, lifecycle_configuration=False,
use_plain_name=False):
"""
Generate S3 bucket statement
:param name: Name of the bucket
:param lifecycle_configuration: Additional lifecycle configuration (default=False)
:param use_plain_name: Just ... | python | def build_bucket(self, name, lifecycle_configuration=False,
use_plain_name=False):
"""
Generate S3 bucket statement
:param name: Name of the bucket
:param lifecycle_configuration: Additional lifecycle configuration (default=False)
:param use_plain_name: Just ... | [
"def",
"build_bucket",
"(",
"self",
",",
"name",
",",
"lifecycle_configuration",
"=",
"False",
",",
"use_plain_name",
"=",
"False",
")",
":",
"if",
"use_plain_name",
":",
"name_aws",
"=",
"name_bucket",
"=",
"name",
"name_aws",
"=",
"name_aws",
".",
"title",
... | Generate S3 bucket statement
:param name: Name of the bucket
:param lifecycle_configuration: Additional lifecycle configuration (default=False)
:param use_plain_name: Just use the given name and do not add prefix
:return: Ref to new bucket | [
"Generate",
"S3",
"bucket",
"statement",
":",
"param",
"name",
":",
"Name",
"of",
"the",
"bucket",
":",
"param",
"lifecycle_configuration",
":",
"Additional",
"lifecycle",
"configuration",
"(",
"default",
"=",
"False",
")",
":",
"param",
"use_plain_name",
":",
... | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/iam.py#L190-L221 |
DeepHorizons/iarm | iarm/arm_instructions/directives.py | Directives.directive_SPACE | def directive_SPACE(self, label, params):
"""
label SPACE num
Allocate space on the stack. `num` is the number of bytes to allocate
"""
# TODO allow equations
params = params.strip()
try:
self.convert_to_integer(params)
except ValueError:
... | python | def directive_SPACE(self, label, params):
"""
label SPACE num
Allocate space on the stack. `num` is the number of bytes to allocate
"""
# TODO allow equations
params = params.strip()
try:
self.convert_to_integer(params)
except ValueError:
... | [
"def",
"directive_SPACE",
"(",
"self",
",",
"label",
",",
"params",
")",
":",
"# TODO allow equations",
"params",
"=",
"params",
".",
"strip",
"(",
")",
"try",
":",
"self",
".",
"convert_to_integer",
"(",
"params",
")",
"except",
"ValueError",
":",
"warnings... | label SPACE num
Allocate space on the stack. `num` is the number of bytes to allocate | [
"label",
"SPACE",
"num"
] | train | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/directives.py#L63-L81 |
DeepHorizons/iarm | iarm/arm_instructions/directives.py | Directives.directive_DCD | def directive_DCD(self, label, params):
"""
label DCD value[, value ...]
Allocate a word space in read only memory for the value or list of values
"""
# TODO make this read only
# TODO check for param size
# TODO can take any length comma separated values (VAL ... | python | def directive_DCD(self, label, params):
"""
label DCD value[, value ...]
Allocate a word space in read only memory for the value or list of values
"""
# TODO make this read only
# TODO check for param size
# TODO can take any length comma separated values (VAL ... | [
"def",
"directive_DCD",
"(",
"self",
",",
"label",
",",
"params",
")",
":",
"# TODO make this read only",
"# TODO check for param size",
"# TODO can take any length comma separated values (VAL DCD 1, 0x2, 3, 4",
"params",
"=",
"params",
".",
"strip",
"(",
")",
"try",
":",
... | label DCD value[, value ...]
Allocate a word space in read only memory for the value or list of values | [
"label",
"DCD",
"value",
"[",
"value",
"...",
"]"
] | train | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/directives.py#L92-L118 |
DeepHorizons/iarm | iarm/arm_instructions/directives.py | Directives.directive_DCH | def directive_DCH(self, label, params):
"""
label DCH value[, value ...]
Allocate a half word space in read only memory for the value or list of values
"""
# TODO make this read only
# TODO check for word size
# Align address
if self.space_pointer % 2 ... | python | def directive_DCH(self, label, params):
"""
label DCH value[, value ...]
Allocate a half word space in read only memory for the value or list of values
"""
# TODO make this read only
# TODO check for word size
# Align address
if self.space_pointer % 2 ... | [
"def",
"directive_DCH",
"(",
"self",
",",
"label",
",",
"params",
")",
":",
"# TODO make this read only",
"# TODO check for word size",
"# Align address",
"if",
"self",
".",
"space_pointer",
"%",
"2",
"!=",
"0",
":",
"self",
".",
"space_pointer",
"+=",
"self",
"... | label DCH value[, value ...]
Allocate a half word space in read only memory for the value or list of values | [
"label",
"DCH",
"value",
"[",
"value",
"...",
"]"
] | train | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/directives.py#L120-L137 |
DeepHorizons/iarm | iarm/arm_instructions/directives.py | Directives.directive_DCB | def directive_DCB(self, label, params):
"""
label DCB value[, value ...]
Allocate a byte space in read only memory for the value or list of values
"""
# TODO make this read only
# TODO check for byte size
self.labels[label] = self.space_pointer
if param... | python | def directive_DCB(self, label, params):
"""
label DCB value[, value ...]
Allocate a byte space in read only memory for the value or list of values
"""
# TODO make this read only
# TODO check for byte size
self.labels[label] = self.space_pointer
if param... | [
"def",
"directive_DCB",
"(",
"self",
",",
"label",
",",
"params",
")",
":",
"# TODO make this read only",
"# TODO check for byte size",
"self",
".",
"labels",
"[",
"label",
"]",
"=",
"self",
".",
"space_pointer",
"if",
"params",
"in",
"self",
".",
"equates",
"... | label DCB value[, value ...]
Allocate a byte space in read only memory for the value or list of values | [
"label",
"DCB",
"value",
"[",
"value",
"...",
"]"
] | train | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/directives.py#L139-L151 |
jay-johnson/celery-loaders | celery_loaders/work_tasks/get_celery_app.py | get_celery_app | def get_celery_app(
name=os.getenv(
"CELERY_NAME",
"worker"),
auth_url=os.getenv(
"BROKER_URL",
"redis://localhost:6379/9"),
backend_url=os.getenv(
"BACKEND_URL",
"redis://localhost:6379/10"),
include_tasks=[],
... | python | def get_celery_app(
name=os.getenv(
"CELERY_NAME",
"worker"),
auth_url=os.getenv(
"BROKER_URL",
"redis://localhost:6379/9"),
backend_url=os.getenv(
"BACKEND_URL",
"redis://localhost:6379/10"),
include_tasks=[],
... | [
"def",
"get_celery_app",
"(",
"name",
"=",
"os",
".",
"getenv",
"(",
"\"CELERY_NAME\"",
",",
"\"worker\"",
")",
",",
"auth_url",
"=",
"os",
".",
"getenv",
"(",
"\"BROKER_URL\"",
",",
"\"redis://localhost:6379/9\"",
")",
",",
"backend_url",
"=",
"os",
".",
"g... | get_celery_app
:param name: name for this app
:param auth_url: celery broker
:param backend_url: celery backend
:param include_tasks: list of modules containing tasks to add
:param ssl_options: security options dictionary
:param trasport_options: transport options dictionary
:param path_to_... | [
"get_celery_app"
] | train | https://github.com/jay-johnson/celery-loaders/blob/aca8169c774582af42a377c27cb3980020080814/celery_loaders/work_tasks/get_celery_app.py#L10-L81 |
DeepHorizons/iarm | iarm/cpu.py | RegisterCpu.check_arguments | def check_arguments(self, **kwargs):
"""
Determine if the parameters meet the specifications
kwargs contains lists grouped by their parameter
rules are defined by methods starting with 'rule_'
:param kwargs:
:return:
"""
for key in kwargs:
if k... | python | def check_arguments(self, **kwargs):
"""
Determine if the parameters meet the specifications
kwargs contains lists grouped by their parameter
rules are defined by methods starting with 'rule_'
:param kwargs:
:return:
"""
for key in kwargs:
if k... | [
"def",
"check_arguments",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"key",
"in",
"kwargs",
":",
"if",
"key",
"in",
"self",
".",
"_rules",
":",
"for",
"val",
"in",
"kwargs",
"[",
"key",
"]",
":",
"self",
".",
"_rules",
"[",
"key",
"]"... | Determine if the parameters meet the specifications
kwargs contains lists grouped by their parameter
rules are defined by methods starting with 'rule_'
:param kwargs:
:return: | [
"Determine",
"if",
"the",
"parameters",
"meet",
"the",
"specifications",
"kwargs",
"contains",
"lists",
"grouped",
"by",
"their",
"parameter",
"rules",
"are",
"defined",
"by",
"methods",
"starting",
"with",
"rule_",
":",
"param",
"kwargs",
":",
":",
"return",
... | train | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/cpu.py#L60-L73 |
DeepHorizons/iarm | iarm/cpu.py | RandomValueDict.link | def link(self, key1, key2):
"""
Make these two keys have the same value
:param key1:
:param key2:
:return:
"""
# TODO make this have more than one key linked
# TODO Maybe make the value a set?
self._linked_keys[key1] = key2
self._linked_key... | python | def link(self, key1, key2):
"""
Make these two keys have the same value
:param key1:
:param key2:
:return:
"""
# TODO make this have more than one key linked
# TODO Maybe make the value a set?
self._linked_keys[key1] = key2
self._linked_key... | [
"def",
"link",
"(",
"self",
",",
"key1",
",",
"key2",
")",
":",
"# TODO make this have more than one key linked",
"# TODO Maybe make the value a set?",
"self",
".",
"_linked_keys",
"[",
"key1",
"]",
"=",
"key2",
"self",
".",
"_linked_keys",
"[",
"key2",
"]",
"=",
... | Make these two keys have the same value
:param key1:
:param key2:
:return: | [
"Make",
"these",
"two",
"keys",
"have",
"the",
"same",
"value",
":",
"param",
"key1",
":",
":",
"param",
"key2",
":",
":",
"return",
":"
] | train | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/cpu.py#L130-L140 |
ninapavlich/django-imagekit-cropper | imagekit_cropper/utils.py | instance_ik_model_receiver | def instance_ik_model_receiver(fn):
"""
A method decorator that filters out sign_original_specals coming from models that don't
have fields that function as ImageFieldSourceGroup sources.
"""
@wraps(fn)
def receiver(self, sender, **kwargs):
# print 'inspect.isclass(sender? %s'%(inspect.... | python | def instance_ik_model_receiver(fn):
"""
A method decorator that filters out sign_original_specals coming from models that don't
have fields that function as ImageFieldSourceGroup sources.
"""
@wraps(fn)
def receiver(self, sender, **kwargs):
# print 'inspect.isclass(sender? %s'%(inspect.... | [
"def",
"instance_ik_model_receiver",
"(",
"fn",
")",
":",
"@",
"wraps",
"(",
"fn",
")",
"def",
"receiver",
"(",
"self",
",",
"sender",
",",
"*",
"*",
"kwargs",
")",
":",
"# print 'inspect.isclass(sender? %s'%(inspect.isclass(sender))",
"if",
"not",
"inspect",
".... | A method decorator that filters out sign_original_specals coming from models that don't
have fields that function as ImageFieldSourceGroup sources. | [
"A",
"method",
"decorator",
"that",
"filters",
"out",
"sign_original_specals",
"coming",
"from",
"models",
"that",
"don",
"t",
"have",
"fields",
"that",
"function",
"as",
"ImageFieldSourceGroup",
"sources",
"."
] | train | https://github.com/ninapavlich/django-imagekit-cropper/blob/c1c2dc5c3c4724492052e5d244e9de1cc362dbcc/imagekit_cropper/utils.py#L32-L50 |
ninapavlich/django-imagekit-cropper | imagekit_cropper/utils.py | InstanceSourceGroupRegistry.source_group_receiver | def source_group_receiver(self, sender, source, signal, **kwargs):
"""
Relay source group signals to the appropriate spec strategy.
"""
from imagekit.cachefiles import ImageCacheFile
source_group = sender
instance = kwargs['instance']
# Ignore signals from unre... | python | def source_group_receiver(self, sender, source, signal, **kwargs):
"""
Relay source group signals to the appropriate spec strategy.
"""
from imagekit.cachefiles import ImageCacheFile
source_group = sender
instance = kwargs['instance']
# Ignore signals from unre... | [
"def",
"source_group_receiver",
"(",
"self",
",",
"sender",
",",
"source",
",",
"signal",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
"imagekit",
".",
"cachefiles",
"import",
"ImageCacheFile",
"source_group",
"=",
"sender",
"instance",
"=",
"kwargs",
"[",
"'i... | Relay source group signals to the appropriate spec strategy. | [
"Relay",
"source",
"group",
"signals",
"to",
"the",
"appropriate",
"spec",
"strategy",
"."
] | train | https://github.com/ninapavlich/django-imagekit-cropper/blob/c1c2dc5c3c4724492052e5d244e9de1cc362dbcc/imagekit_cropper/utils.py#L87-L114 |
ninapavlich/django-imagekit-cropper | imagekit_cropper/utils.py | InstanceModelSignalRouter.update_source_hashes | def update_source_hashes(self, instance):
"""
Stores hashes of the source image files so that they can be compared
later to see whether the source image has changed (and therefore whether
the spec file needs to be regenerated).
"""
self.init_instance(instance)
in... | python | def update_source_hashes(self, instance):
"""
Stores hashes of the source image files so that they can be compared
later to see whether the source image has changed (and therefore whether
the spec file needs to be regenerated).
"""
self.init_instance(instance)
in... | [
"def",
"update_source_hashes",
"(",
"self",
",",
"instance",
")",
":",
"self",
".",
"init_instance",
"(",
"instance",
")",
"instance",
".",
"_ik",
"[",
"'source_hashes'",
"]",
"=",
"dict",
"(",
"(",
"attname",
",",
"hash",
"(",
"getattr",
"(",
"instance",
... | Stores hashes of the source image files so that they can be compared
later to see whether the source image has changed (and therefore whether
the spec file needs to be regenerated). | [
"Stores",
"hashes",
"of",
"the",
"source",
"image",
"files",
"so",
"that",
"they",
"can",
"be",
"compared",
"later",
"to",
"see",
"whether",
"the",
"source",
"image",
"has",
"changed",
"(",
"and",
"therefore",
"whether",
"the",
"spec",
"file",
"needs",
"to... | train | https://github.com/ninapavlich/django-imagekit-cropper/blob/c1c2dc5c3c4724492052e5d244e9de1cc362dbcc/imagekit_cropper/utils.py#L134-L145 |
ninapavlich/django-imagekit-cropper | imagekit_cropper/utils.py | InstanceModelSignalRouter.get_source_fields | def get_source_fields(self, instance):
"""
Returns a list of the source fields for the given instance.
"""
return set(src.image_field
for src in self._source_groups
if isinstance(instance, src.model_class)) | python | def get_source_fields(self, instance):
"""
Returns a list of the source fields for the given instance.
"""
return set(src.image_field
for src in self._source_groups
if isinstance(instance, src.model_class)) | [
"def",
"get_source_fields",
"(",
"self",
",",
"instance",
")",
":",
"return",
"set",
"(",
"src",
".",
"image_field",
"for",
"src",
"in",
"self",
".",
"_source_groups",
"if",
"isinstance",
"(",
"instance",
",",
"src",
".",
"model_class",
")",
")"
] | Returns a list of the source fields for the given instance. | [
"Returns",
"a",
"list",
"of",
"the",
"source",
"fields",
"for",
"the",
"given",
"instance",
"."
] | train | https://github.com/ninapavlich/django-imagekit-cropper/blob/c1c2dc5c3c4724492052e5d244e9de1cc362dbcc/imagekit_cropper/utils.py#L147-L153 |
jay-johnson/celery-loaders | celery_loaders/work_tasks/custom_task.py | CustomTask.on_success | def on_success(self, retval, task_id, args, kwargs):
"""on_success
http://docs.celeryproject.org/en/latest/reference/celery.app.task.html
:param retval: return value
:param task_id: celery task id
:param args: arguments passed into task
:param kwargs: keyword arguments ... | python | def on_success(self, retval, task_id, args, kwargs):
"""on_success
http://docs.celeryproject.org/en/latest/reference/celery.app.task.html
:param retval: return value
:param task_id: celery task id
:param args: arguments passed into task
:param kwargs: keyword arguments ... | [
"def",
"on_success",
"(",
"self",
",",
"retval",
",",
"task_id",
",",
"args",
",",
"kwargs",
")",
":",
"log",
".",
"info",
"(",
"(",
"\"{} SUCCESS - retval={} task_id={} \"",
"\"args={} kwargs={}\"",
")",
".",
"format",
"(",
"self",
".",
"log_label",
",",
"r... | on_success
http://docs.celeryproject.org/en/latest/reference/celery.app.task.html
:param retval: return value
:param task_id: celery task id
:param args: arguments passed into task
:param kwargs: keyword arguments passed into task | [
"on_success"
] | train | https://github.com/jay-johnson/celery-loaders/blob/aca8169c774582af42a377c27cb3980020080814/celery_loaders/work_tasks/custom_task.py#L14-L32 |
jay-johnson/celery-loaders | celery_loaders/work_tasks/custom_task.py | CustomTask.on_failure | def on_failure(self, exc, task_id, args, kwargs, einfo):
"""on_failure
http://docs.celeryproject.org/en/latest/userguide/tasks.html#task-inheritance
:param exc: exception
:param task_id: task id
:param args: arguments passed into task
:param kwargs: keyword arguments pa... | python | def on_failure(self, exc, task_id, args, kwargs, einfo):
"""on_failure
http://docs.celeryproject.org/en/latest/userguide/tasks.html#task-inheritance
:param exc: exception
:param task_id: task id
:param args: arguments passed into task
:param kwargs: keyword arguments pa... | [
"def",
"on_failure",
"(",
"self",
",",
"exc",
",",
"task_id",
",",
"args",
",",
"kwargs",
",",
"einfo",
")",
":",
"use_exc",
"=",
"str",
"(",
"exc",
")",
"log",
".",
"error",
"(",
"(",
"\"{} FAIL - exc={} \"",
"\"args={} kwargs={}\"",
")",
".",
"format",... | on_failure
http://docs.celeryproject.org/en/latest/userguide/tasks.html#task-inheritance
:param exc: exception
:param task_id: task id
:param args: arguments passed into task
:param kwargs: keyword arguments passed into task
:param einfo: exception info | [
"on_failure"
] | train | https://github.com/jay-johnson/celery-loaders/blob/aca8169c774582af42a377c27cb3980020080814/celery_loaders/work_tasks/custom_task.py#L35-L54 |
glomex/gcdt | gcdt/gcdt_signals.py | check_hook_mechanism_is_intact | def check_hook_mechanism_is_intact(module):
"""Check if the hook configuration is absent or has both register AND deregister.
:param module:
:return: True if valid plugin / module.
"""
result = True
if check_register_present(module):
result = not result
if check_deregister_present(m... | python | def check_hook_mechanism_is_intact(module):
"""Check if the hook configuration is absent or has both register AND deregister.
:param module:
:return: True if valid plugin / module.
"""
result = True
if check_register_present(module):
result = not result
if check_deregister_present(m... | [
"def",
"check_hook_mechanism_is_intact",
"(",
"module",
")",
":",
"result",
"=",
"True",
"if",
"check_register_present",
"(",
"module",
")",
":",
"result",
"=",
"not",
"result",
"if",
"check_deregister_present",
"(",
"module",
")",
":",
"result",
"=",
"not",
"... | Check if the hook configuration is absent or has both register AND deregister.
:param module:
:return: True if valid plugin / module. | [
"Check",
"if",
"the",
"hook",
"configuration",
"is",
"absent",
"or",
"has",
"both",
"register",
"AND",
"deregister",
"."
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/gcdt_signals.py#L59-L70 |
glomex/gcdt | gcdt/kumo_viz.py | cfn_viz | def cfn_viz(template, parameters={}, outputs={}, out=sys.stdout):
"""Render dot output for cloudformation.template in json format.
"""
known_sg, open_sg = _analyze_sg(template['Resources'])
(graph, edges) = _extract_graph(template.get('Description', ''),
template['Res... | python | def cfn_viz(template, parameters={}, outputs={}, out=sys.stdout):
"""Render dot output for cloudformation.template in json format.
"""
known_sg, open_sg = _analyze_sg(template['Resources'])
(graph, edges) = _extract_graph(template.get('Description', ''),
template['Res... | [
"def",
"cfn_viz",
"(",
"template",
",",
"parameters",
"=",
"{",
"}",
",",
"outputs",
"=",
"{",
"}",
",",
"out",
"=",
"sys",
".",
"stdout",
")",
":",
"known_sg",
",",
"open_sg",
"=",
"_analyze_sg",
"(",
"template",
"[",
"'Resources'",
"]",
")",
"(",
... | Render dot output for cloudformation.template in json format. | [
"Render",
"dot",
"output",
"for",
"cloudformation",
".",
"template",
"in",
"json",
"format",
"."
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/kumo_viz.py#L30-L41 |
glomex/gcdt | gcdt/kumo_viz.py | _get_fillcolor | def _get_fillcolor(resource_type, properties, known_sg=[], open_sg=[]):
"""Determine fillcolor for resources (public ones in this case)
"""
fillcolor = None
# check security groups
if 'SecurityGroups' in properties:
# check for external security groups
for sg in properties['SecurityG... | python | def _get_fillcolor(resource_type, properties, known_sg=[], open_sg=[]):
"""Determine fillcolor for resources (public ones in this case)
"""
fillcolor = None
# check security groups
if 'SecurityGroups' in properties:
# check for external security groups
for sg in properties['SecurityG... | [
"def",
"_get_fillcolor",
"(",
"resource_type",
",",
"properties",
",",
"known_sg",
"=",
"[",
"]",
",",
"open_sg",
"=",
"[",
"]",
")",
":",
"fillcolor",
"=",
"None",
"# check security groups",
"if",
"'SecurityGroups'",
"in",
"properties",
":",
"# check for extern... | Determine fillcolor for resources (public ones in this case) | [
"Determine",
"fillcolor",
"for",
"resources",
"(",
"public",
"ones",
"in",
"this",
"case",
")"
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/kumo_viz.py#L109-L133 |
glomex/gcdt | gcdt/kumo_viz.py | svg_output | def svg_output(dotfile, outfile='cloudformation.svg'):
"""Render template into svg file using the dot command (must be installed).
:param dotfile: path to the dotfile
:param outfile: filename for the output file
:return:
"""
try:
cmd = ['dot', '-Tsvg', '-o' + outfile, dotfile]
s... | python | def svg_output(dotfile, outfile='cloudformation.svg'):
"""Render template into svg file using the dot command (must be installed).
:param dotfile: path to the dotfile
:param outfile: filename for the output file
:return:
"""
try:
cmd = ['dot', '-Tsvg', '-o' + outfile, dotfile]
s... | [
"def",
"svg_output",
"(",
"dotfile",
",",
"outfile",
"=",
"'cloudformation.svg'",
")",
":",
"try",
":",
"cmd",
"=",
"[",
"'dot'",
",",
"'-Tsvg'",
",",
"'-o'",
"+",
"outfile",
",",
"dotfile",
"]",
"subprocess",
".",
"check_output",
"(",
"cmd",
",",
"stder... | Render template into svg file using the dot command (must be installed).
:param dotfile: path to the dotfile
:param outfile: filename for the output file
:return: | [
"Render",
"template",
"into",
"svg",
"file",
"using",
"the",
"dot",
"command",
"(",
"must",
"be",
"installed",
")",
"."
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/kumo_viz.py#L238-L254 |
gmr/helper | helper/__init__.py | start | def start(controller_class):
"""Start the Helper controller either in the foreground or as a daemon
process.
:param controller_class: The controller class handle to create and run
:type controller_class: callable
"""
args = parser.parse()
obj = controller_class(args, platform.operating_sys... | python | def start(controller_class):
"""Start the Helper controller either in the foreground or as a daemon
process.
:param controller_class: The controller class handle to create and run
:type controller_class: callable
"""
args = parser.parse()
obj = controller_class(args, platform.operating_sys... | [
"def",
"start",
"(",
"controller_class",
")",
":",
"args",
"=",
"parser",
".",
"parse",
"(",
")",
"obj",
"=",
"controller_class",
"(",
"args",
",",
"platform",
".",
"operating_system",
"(",
")",
")",
"if",
"args",
".",
"foreground",
":",
"try",
":",
"o... | Start the Helper controller either in the foreground or as a daemon
process.
:param controller_class: The controller class handle to create and run
:type controller_class: callable | [
"Start",
"the",
"Helper",
"controller",
"either",
"in",
"the",
"foreground",
"or",
"as",
"a",
"daemon",
"process",
"."
] | train | https://github.com/gmr/helper/blob/fe8e45fc8eabf619429b2940c682c252ee33c082/helper/__init__.py#L149-L171 |
DeepHorizons/iarm | iarm/arm.py | Arm.run | def run(self, steps=float('inf')):
"""
Run to the current end of the program or a number of steps
:return:
"""
while len(self.program) > (self.register['PC'] - 1):
steps -= 1
if steps < 0:
break
self.program[self.register['PC'] ... | python | def run(self, steps=float('inf')):
"""
Run to the current end of the program or a number of steps
:return:
"""
while len(self.program) > (self.register['PC'] - 1):
steps -= 1
if steps < 0:
break
self.program[self.register['PC'] ... | [
"def",
"run",
"(",
"self",
",",
"steps",
"=",
"float",
"(",
"'inf'",
")",
")",
":",
"while",
"len",
"(",
"self",
".",
"program",
")",
">",
"(",
"self",
".",
"register",
"[",
"'PC'",
"]",
"-",
"1",
")",
":",
"steps",
"-=",
"1",
"if",
"steps",
... | Run to the current end of the program or a number of steps
:return: | [
"Run",
"to",
"the",
"current",
"end",
"of",
"the",
"program",
"or",
"a",
"number",
"of",
"steps",
":",
"return",
":"
] | train | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm.py#L91-L101 |
CitrineInformatics/pypif | pypif/obj/common/pio.py | Pio._validate_type | def _validate_type(self, name, obj, *args):
"""
Helper function that checks the input object type against each in a list of classes. This function
also allows the input value to be equal to None.
:param name: Name of the object.
:param obj: Object to check the type of.
:... | python | def _validate_type(self, name, obj, *args):
"""
Helper function that checks the input object type against each in a list of classes. This function
also allows the input value to be equal to None.
:param name: Name of the object.
:param obj: Object to check the type of.
:... | [
"def",
"_validate_type",
"(",
"self",
",",
"name",
",",
"obj",
",",
"*",
"args",
")",
":",
"if",
"obj",
"is",
"None",
":",
"return",
"for",
"arg",
"in",
"args",
":",
"if",
"isinstance",
"(",
"obj",
",",
"arg",
")",
":",
"return",
"raise",
"TypeErro... | Helper function that checks the input object type against each in a list of classes. This function
also allows the input value to be equal to None.
:param name: Name of the object.
:param obj: Object to check the type of.
:param args: List of classes.
:raises TypeError: if the i... | [
"Helper",
"function",
"that",
"checks",
"the",
"input",
"object",
"type",
"against",
"each",
"in",
"a",
"list",
"of",
"classes",
".",
"This",
"function",
"also",
"allows",
"the",
"input",
"value",
"to",
"be",
"equal",
"to",
"None",
"."
] | train | https://github.com/CitrineInformatics/pypif/blob/938348a8ff7b10b330770cccaaeb2109922f681b/pypif/obj/common/pio.py#L36-L52 |
CitrineInformatics/pypif | pypif/obj/common/pio.py | Pio._validate_list_type | def _validate_list_type(self, name, obj, *args):
"""
Helper function that checks the input object type against each in a list of classes, or if the input object
is a list, each value that it contains against that list.
:param name: Name of the object.
:param obj: Object to check... | python | def _validate_list_type(self, name, obj, *args):
"""
Helper function that checks the input object type against each in a list of classes, or if the input object
is a list, each value that it contains against that list.
:param name: Name of the object.
:param obj: Object to check... | [
"def",
"_validate_list_type",
"(",
"self",
",",
"name",
",",
"obj",
",",
"*",
"args",
")",
":",
"if",
"obj",
"is",
"None",
":",
"return",
"if",
"isinstance",
"(",
"obj",
",",
"list",
")",
":",
"for",
"i",
"in",
"obj",
":",
"self",
".",
"_validate_t... | Helper function that checks the input object type against each in a list of classes, or if the input object
is a list, each value that it contains against that list.
:param name: Name of the object.
:param obj: Object to check the type of.
:param args: List of classes.
:raises T... | [
"Helper",
"function",
"that",
"checks",
"the",
"input",
"object",
"type",
"against",
"each",
"in",
"a",
"list",
"of",
"classes",
"or",
"if",
"the",
"input",
"object",
"is",
"a",
"list",
"each",
"value",
"that",
"it",
"contains",
"against",
"that",
"list",
... | train | https://github.com/CitrineInformatics/pypif/blob/938348a8ff7b10b330770cccaaeb2109922f681b/pypif/obj/common/pio.py#L69-L85 |
CitrineInformatics/pypif | pypif/obj/common/pio.py | Pio._validate_nested_list_type | def _validate_nested_list_type(self, name, obj, nested_level, *args):
"""
Helper function that checks the input object as a list then recursively until nested_level is 1.
:param name: Name of the object.
:param obj: Object to check the type of.
:param nested_level: Integer with ... | python | def _validate_nested_list_type(self, name, obj, nested_level, *args):
"""
Helper function that checks the input object as a list then recursively until nested_level is 1.
:param name: Name of the object.
:param obj: Object to check the type of.
:param nested_level: Integer with ... | [
"def",
"_validate_nested_list_type",
"(",
"self",
",",
"name",
",",
"obj",
",",
"nested_level",
",",
"*",
"args",
")",
":",
"if",
"nested_level",
"<=",
"1",
":",
"self",
".",
"_validate_list_type",
"(",
"name",
",",
"obj",
",",
"*",
"args",
")",
"else",
... | Helper function that checks the input object as a list then recursively until nested_level is 1.
:param name: Name of the object.
:param obj: Object to check the type of.
:param nested_level: Integer with the current nested level.
:param args: List of classes.
:raises TypeError:... | [
"Helper",
"function",
"that",
"checks",
"the",
"input",
"object",
"as",
"a",
"list",
"then",
"recursively",
"until",
"nested_level",
"is",
"1",
"."
] | train | https://github.com/CitrineInformatics/pypif/blob/938348a8ff7b10b330770cccaaeb2109922f681b/pypif/obj/common/pio.py#L87-L106 |
DeepHorizons/iarm | iarm/arm_instructions/unconditional_branch.py | UnconditionalBranch.B | def B(self, params):
"""
B label
Unconditional branch to the address at label
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# TODO check if label is within +- 2 KB
# B label
def B_func... | python | def B(self, params):
"""
B label
Unconditional branch to the address at label
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# TODO check if label is within +- 2 KB
# B label
def B_func... | [
"def",
"B",
"(",
"self",
",",
"params",
")",
":",
"label",
"=",
"self",
".",
"get_one_parameter",
"(",
"self",
".",
"ONE_PARAMETER",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"label_exists",
"=",
"(",
"label",
",",
")",
")",
"# TODO check ... | B label
Unconditional branch to the address at label | [
"B",
"label"
] | train | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/unconditional_branch.py#L6-L23 |
DeepHorizons/iarm | iarm/arm_instructions/unconditional_branch.py | UnconditionalBranch.BL | def BL(self, params):
"""
BL label
Branch to the label, storing the next instruction in the Link Register
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# TODO check if label is within +- 16 MB
... | python | def BL(self, params):
"""
BL label
Branch to the label, storing the next instruction in the Link Register
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# TODO check if label is within +- 16 MB
... | [
"def",
"BL",
"(",
"self",
",",
"params",
")",
":",
"label",
"=",
"self",
".",
"get_one_parameter",
"(",
"self",
".",
"ONE_PARAMETER",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"label_exists",
"=",
"(",
"label",
",",
")",
")",
"# TODO check... | BL label
Branch to the label, storing the next instruction in the Link Register | [
"BL",
"label"
] | train | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/unconditional_branch.py#L33-L49 |
DeepHorizons/iarm | iarm/arm_instructions/unconditional_branch.py | UnconditionalBranch.BLX | def BLX(self, params):
"""
BLX Rj
Branch to the address in Rj, storing the next instruction in the Link Register
"""
Rj = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(LR_or_general_purpose_registers=(Rj,))
def BLX_func():
... | python | def BLX(self, params):
"""
BLX Rj
Branch to the address in Rj, storing the next instruction in the Link Register
"""
Rj = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(LR_or_general_purpose_registers=(Rj,))
def BLX_func():
... | [
"def",
"BLX",
"(",
"self",
",",
"params",
")",
":",
"Rj",
"=",
"self",
".",
"get_one_parameter",
"(",
"self",
".",
"ONE_PARAMETER",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"LR_or_general_purpose_registers",
"=",
"(",
"Rj",
",",
")",
")",
... | BLX Rj
Branch to the address in Rj, storing the next instruction in the Link Register | [
"BLX",
"Rj"
] | train | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/unconditional_branch.py#L51-L65 |
DeepHorizons/iarm | iarm/arm_instructions/unconditional_branch.py | UnconditionalBranch.BX | def BX(self, params):
"""
BX Rj
Jump to the address in the Link Register
"""
Rj = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(LR_or_general_purpose_registers=(Rj,))
def BX_func():
self.register['PC'] = self.register[Rj]
... | python | def BX(self, params):
"""
BX Rj
Jump to the address in the Link Register
"""
Rj = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(LR_or_general_purpose_registers=(Rj,))
def BX_func():
self.register['PC'] = self.register[Rj]
... | [
"def",
"BX",
"(",
"self",
",",
"params",
")",
":",
"Rj",
"=",
"self",
".",
"get_one_parameter",
"(",
"self",
".",
"ONE_PARAMETER",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"LR_or_general_purpose_registers",
"=",
"(",
"Rj",
",",
")",
")",
... | BX Rj
Jump to the address in the Link Register | [
"BX",
"Rj"
] | train | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/unconditional_branch.py#L67-L80 |
clarkperkins/click-shell | click_shell/version.py | get_version | def get_version(version):
"""
Returns a PEP 440-compliant version number from VERSION.
Created by modifying django.utils.version.get_version
"""
# Now build the two parts of the version number:
# major = X.Y[.Z]
# sub = .devN - for development releases
# | {a|b|rc}N - for alpha, be... | python | def get_version(version):
"""
Returns a PEP 440-compliant version number from VERSION.
Created by modifying django.utils.version.get_version
"""
# Now build the two parts of the version number:
# major = X.Y[.Z]
# sub = .devN - for development releases
# | {a|b|rc}N - for alpha, be... | [
"def",
"get_version",
"(",
"version",
")",
":",
"# Now build the two parts of the version number:",
"# major = X.Y[.Z]",
"# sub = .devN - for development releases",
"# | {a|b|rc}N - for alpha, beta and rc releases",
"# | .postN - for post-release releases",
"assert",
"len",
"(",
... | Returns a PEP 440-compliant version number from VERSION.
Created by modifying django.utils.version.get_version | [
"Returns",
"a",
"PEP",
"440",
"-",
"compliant",
"version",
"number",
"from",
"VERSION",
"."
] | train | https://github.com/clarkperkins/click-shell/blob/8d6e1a492176bc79e029d714f19d3156409656ea/click_shell/version.py#L15-L54 |
clarkperkins/click-shell | click_shell/version.py | get_git_changeset | def get_git_changeset():
"""Returns a numeric identifier of the latest git changeset.
The result is the UTC timestamp of the changeset in YYYYMMDDHHMMSS format.
This value isn't guaranteed to be unique, but collisions are very unlikely,
so it's sufficient for generating the development version numbers.... | python | def get_git_changeset():
"""Returns a numeric identifier of the latest git changeset.
The result is the UTC timestamp of the changeset in YYYYMMDDHHMMSS format.
This value isn't guaranteed to be unique, but collisions are very unlikely,
so it's sufficient for generating the development version numbers.... | [
"def",
"get_git_changeset",
"(",
")",
":",
"repo_dir",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"os",
".",
"path",
".",
"abspath",
"(",
"__file__",
")",
")",
"git_log",
"=",
"subprocess",
".",
"Popen",
"(",
"'git log --pretty=format:%ct --quiet -1 HEAD'",
... | Returns a numeric identifier of the latest git changeset.
The result is the UTC timestamp of the changeset in YYYYMMDDHHMMSS format.
This value isn't guaranteed to be unique, but collisions are very unlikely,
so it's sufficient for generating the development version numbers. | [
"Returns",
"a",
"numeric",
"identifier",
"of",
"the",
"latest",
"git",
"changeset",
"."
] | train | https://github.com/clarkperkins/click-shell/blob/8d6e1a492176bc79e029d714f19d3156409656ea/click_shell/version.py#L58-L74 |
glomex/gcdt | gcdt/kumo_core.py | load_cloudformation_template | def load_cloudformation_template(path=None):
"""Load cloudformation template from path.
:param path: Absolute or relative path of cloudformation template. Defaults to cwd.
:return: module, success
"""
if not path:
path = os.path.abspath('cloudformation.py')
else:
path = os.path.... | python | def load_cloudformation_template(path=None):
"""Load cloudformation template from path.
:param path: Absolute or relative path of cloudformation template. Defaults to cwd.
:return: module, success
"""
if not path:
path = os.path.abspath('cloudformation.py')
else:
path = os.path.... | [
"def",
"load_cloudformation_template",
"(",
"path",
"=",
"None",
")",
":",
"if",
"not",
"path",
":",
"path",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"'cloudformation.py'",
")",
"else",
":",
"path",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"pat... | Load cloudformation template from path.
:param path: Absolute or relative path of cloudformation template. Defaults to cwd.
:return: module, success | [
"Load",
"cloudformation",
"template",
"from",
"path",
"."
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/kumo_core.py#L28-L64 |
glomex/gcdt | gcdt/kumo_core.py | get_parameter_diff | def get_parameter_diff(awsclient, config):
"""get differences between local config and currently active config
"""
client_cf = awsclient.get_client('cloudformation')
try:
stack_name = config['stack']['StackName']
if stack_name:
response = client_cf.describe_stacks(StackName=s... | python | def get_parameter_diff(awsclient, config):
"""get differences between local config and currently active config
"""
client_cf = awsclient.get_client('cloudformation')
try:
stack_name = config['stack']['StackName']
if stack_name:
response = client_cf.describe_stacks(StackName=s... | [
"def",
"get_parameter_diff",
"(",
"awsclient",
",",
"config",
")",
":",
"client_cf",
"=",
"awsclient",
".",
"get_client",
"(",
"'cloudformation'",
")",
"try",
":",
"stack_name",
"=",
"config",
"[",
"'stack'",
"]",
"[",
"'StackName'",
"]",
"if",
"stack_name",
... | get differences between local config and currently active config | [
"get",
"differences",
"between",
"local",
"config",
"and",
"currently",
"active",
"config"
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/kumo_core.py#L67-L120 |
glomex/gcdt | gcdt/kumo_core.py | call_pre_hook | def call_pre_hook(awsclient, cloudformation):
"""Invoke the pre_hook BEFORE the config is read.
:param awsclient:
:param cloudformation:
"""
# TODO: this is deprecated!! move this to glomex_config_reader
# no config available
if not hasattr(cloudformation, 'pre_hook'):
# hook is not... | python | def call_pre_hook(awsclient, cloudformation):
"""Invoke the pre_hook BEFORE the config is read.
:param awsclient:
:param cloudformation:
"""
# TODO: this is deprecated!! move this to glomex_config_reader
# no config available
if not hasattr(cloudformation, 'pre_hook'):
# hook is not... | [
"def",
"call_pre_hook",
"(",
"awsclient",
",",
"cloudformation",
")",
":",
"# TODO: this is deprecated!! move this to glomex_config_reader",
"# no config available",
"if",
"not",
"hasattr",
"(",
"cloudformation",
",",
"'pre_hook'",
")",
":",
"# hook is not present",
"return",... | Invoke the pre_hook BEFORE the config is read.
:param awsclient:
:param cloudformation: | [
"Invoke",
"the",
"pre_hook",
"BEFORE",
"the",
"config",
"is",
"read",
"."
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/kumo_core.py#L123-L139 |
glomex/gcdt | gcdt/kumo_core.py | deploy_stack | def deploy_stack(awsclient, context, conf, cloudformation, override_stack_policy=False):
"""Deploy the stack to AWS cloud. Does either create or update the stack.
:param conf:
:param override_stack_policy:
:return: exit_code
"""
stack_name = _get_stack_name(conf)
parameters = _generate_para... | python | def deploy_stack(awsclient, context, conf, cloudformation, override_stack_policy=False):
"""Deploy the stack to AWS cloud. Does either create or update the stack.
:param conf:
:param override_stack_policy:
:return: exit_code
"""
stack_name = _get_stack_name(conf)
parameters = _generate_para... | [
"def",
"deploy_stack",
"(",
"awsclient",
",",
"context",
",",
"conf",
",",
"cloudformation",
",",
"override_stack_policy",
"=",
"False",
")",
":",
"stack_name",
"=",
"_get_stack_name",
"(",
"conf",
")",
"parameters",
"=",
"_generate_parameters",
"(",
"conf",
")"... | Deploy the stack to AWS cloud. Does either create or update the stack.
:param conf:
:param override_stack_policy:
:return: exit_code | [
"Deploy",
"the",
"stack",
"to",
"AWS",
"cloud",
".",
"Does",
"either",
"create",
"or",
"update",
"the",
"stack",
"."
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/kumo_core.py#L322-L344 |
glomex/gcdt | gcdt/kumo_core.py | delete_stack | def delete_stack(awsclient, conf, feedback=True):
"""Delete the stack from AWS cloud.
:param awsclient:
:param conf:
:param feedback: print out stack events (defaults to True)
"""
client_cf = awsclient.get_client('cloudformation')
stack_name = _get_stack_name(conf)
last_event = _get_sta... | python | def delete_stack(awsclient, conf, feedback=True):
"""Delete the stack from AWS cloud.
:param awsclient:
:param conf:
:param feedback: print out stack events (defaults to True)
"""
client_cf = awsclient.get_client('cloudformation')
stack_name = _get_stack_name(conf)
last_event = _get_sta... | [
"def",
"delete_stack",
"(",
"awsclient",
",",
"conf",
",",
"feedback",
"=",
"True",
")",
":",
"client_cf",
"=",
"awsclient",
".",
"get_client",
"(",
"'cloudformation'",
")",
"stack_name",
"=",
"_get_stack_name",
"(",
"conf",
")",
"last_event",
"=",
"_get_stack... | Delete the stack from AWS cloud.
:param awsclient:
:param conf:
:param feedback: print out stack events (defaults to True) | [
"Delete",
"the",
"stack",
"from",
"AWS",
"cloud",
"."
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/kumo_core.py#L526-L543 |
glomex/gcdt | gcdt/kumo_core.py | list_stacks | def list_stacks(awsclient):
"""Print out the list of stacks deployed at AWS cloud.
:param awsclient:
:return:
"""
client_cf = awsclient.get_client('cloudformation')
response = client_cf.list_stacks(
StackStatusFilter=[
'CREATE_IN_PROGRESS', 'CREATE_COMPLETE', 'ROLLBACK_IN_PR... | python | def list_stacks(awsclient):
"""Print out the list of stacks deployed at AWS cloud.
:param awsclient:
:return:
"""
client_cf = awsclient.get_client('cloudformation')
response = client_cf.list_stacks(
StackStatusFilter=[
'CREATE_IN_PROGRESS', 'CREATE_COMPLETE', 'ROLLBACK_IN_PR... | [
"def",
"list_stacks",
"(",
"awsclient",
")",
":",
"client_cf",
"=",
"awsclient",
".",
"get_client",
"(",
"'cloudformation'",
")",
"response",
"=",
"client_cf",
".",
"list_stacks",
"(",
"StackStatusFilter",
"=",
"[",
"'CREATE_IN_PROGRESS'",
",",
"'CREATE_COMPLETE'",
... | Print out the list of stacks deployed at AWS cloud.
:param awsclient:
:return: | [
"Print",
"out",
"the",
"list",
"of",
"stacks",
"deployed",
"at",
"AWS",
"cloud",
"."
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/kumo_core.py#L554-L580 |
glomex/gcdt | gcdt/kumo_core.py | describe_change_set | def describe_change_set(awsclient, change_set_name, stack_name):
"""Print out the change_set to console.
This needs to run create_change_set first.
:param awsclient:
:param change_set_name:
:param stack_name:
"""
client = awsclient.get_client('cloudformation')
status = None
while s... | python | def describe_change_set(awsclient, change_set_name, stack_name):
"""Print out the change_set to console.
This needs to run create_change_set first.
:param awsclient:
:param change_set_name:
:param stack_name:
"""
client = awsclient.get_client('cloudformation')
status = None
while s... | [
"def",
"describe_change_set",
"(",
"awsclient",
",",
"change_set_name",
",",
"stack_name",
")",
":",
"client",
"=",
"awsclient",
".",
"get_client",
"(",
"'cloudformation'",
")",
"status",
"=",
"None",
"while",
"status",
"not",
"in",
"[",
"'CREATE_COMPLETE'",
","... | Print out the change_set to console.
This needs to run create_change_set first.
:param awsclient:
:param change_set_name:
:param stack_name: | [
"Print",
"out",
"the",
"change_set",
"to",
"console",
".",
"This",
"needs",
"to",
"run",
"create_change_set",
"first",
"."
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/kumo_core.py#L608-L629 |
glomex/gcdt | gcdt/kumo_core.py | delete_change_set | def delete_change_set(awsclient, change_set_name, stack_name):
"""Delete specified change set. Currently we only use this during
automated regression testing. But we have plans so lets locate this
functionality here
:param awsclient:
:param change_set_name:
:param stack_name:
"""
client... | python | def delete_change_set(awsclient, change_set_name, stack_name):
"""Delete specified change set. Currently we only use this during
automated regression testing. But we have plans so lets locate this
functionality here
:param awsclient:
:param change_set_name:
:param stack_name:
"""
client... | [
"def",
"delete_change_set",
"(",
"awsclient",
",",
"change_set_name",
",",
"stack_name",
")",
":",
"client",
"=",
"awsclient",
".",
"get_client",
"(",
"'cloudformation'",
")",
"response",
"=",
"client",
".",
"delete_change_set",
"(",
"ChangeSetName",
"=",
"change_... | Delete specified change set. Currently we only use this during
automated regression testing. But we have plans so lets locate this
functionality here
:param awsclient:
:param change_set_name:
:param stack_name: | [
"Delete",
"specified",
"change",
"set",
".",
"Currently",
"we",
"only",
"use",
"this",
"during",
"automated",
"regression",
"testing",
".",
"But",
"we",
"have",
"plans",
"so",
"lets",
"locate",
"this",
"functionality",
"here"
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/kumo_core.py#L632-L645 |
glomex/gcdt | gcdt/kumo_core.py | write_template_to_file | def write_template_to_file(conf, template_body):
"""Writes the template to disk
"""
template_file_name = _get_stack_name(conf) + '-generated-cf-template.json'
with open(template_file_name, 'w') as opened_file:
opened_file.write(template_body)
print('wrote cf-template for %s to disk: %s' % (
... | python | def write_template_to_file(conf, template_body):
"""Writes the template to disk
"""
template_file_name = _get_stack_name(conf) + '-generated-cf-template.json'
with open(template_file_name, 'w') as opened_file:
opened_file.write(template_body)
print('wrote cf-template for %s to disk: %s' % (
... | [
"def",
"write_template_to_file",
"(",
"conf",
",",
"template_body",
")",
":",
"template_file_name",
"=",
"_get_stack_name",
"(",
"conf",
")",
"+",
"'-generated-cf-template.json'",
"with",
"open",
"(",
"template_file_name",
",",
"'w'",
")",
"as",
"opened_file",
":",
... | Writes the template to disk | [
"Writes",
"the",
"template",
"to",
"disk"
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/kumo_core.py#L658-L666 |
glomex/gcdt | gcdt/kumo_core.py | generate_template | def generate_template(context, config, cloudformation):
"""call cloudformation to generate the template (json format).
:param context:
:param config:
:param cloudformation:
:return:
"""
spec = inspect.getargspec(cloudformation.generate_template)[0]
if len(spec) == 0:
return clou... | python | def generate_template(context, config, cloudformation):
"""call cloudformation to generate the template (json format).
:param context:
:param config:
:param cloudformation:
:return:
"""
spec = inspect.getargspec(cloudformation.generate_template)[0]
if len(spec) == 0:
return clou... | [
"def",
"generate_template",
"(",
"context",
",",
"config",
",",
"cloudformation",
")",
":",
"spec",
"=",
"inspect",
".",
"getargspec",
"(",
"cloudformation",
".",
"generate_template",
")",
"[",
"0",
"]",
"if",
"len",
"(",
"spec",
")",
"==",
"0",
":",
"re... | call cloudformation to generate the template (json format).
:param context:
:param config:
:param cloudformation:
:return: | [
"call",
"cloudformation",
"to",
"generate",
"the",
"template",
"(",
"json",
"format",
")",
"."
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/kumo_core.py#L669-L683 |
glomex/gcdt | gcdt/kumo_core.py | info | def info(awsclient, config, format=None):
"""
collect info and output to console
:param awsclient:
:param config:
:param json: True / False to use json format as output
:return:
"""
if format is None:
format = 'tabular'
stack_name = _get_stack_name(config)
client_cfn = a... | python | def info(awsclient, config, format=None):
"""
collect info and output to console
:param awsclient:
:param config:
:param json: True / False to use json format as output
:return:
"""
if format is None:
format = 'tabular'
stack_name = _get_stack_name(config)
client_cfn = a... | [
"def",
"info",
"(",
"awsclient",
",",
"config",
",",
"format",
"=",
"None",
")",
":",
"if",
"format",
"is",
"None",
":",
"format",
"=",
"'tabular'",
"stack_name",
"=",
"_get_stack_name",
"(",
"config",
")",
"client_cfn",
"=",
"awsclient",
".",
"get_client"... | collect info and output to console
:param awsclient:
:param config:
:param json: True / False to use json format as output
:return: | [
"collect",
"info",
"and",
"output",
"to",
"console"
] | train | https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/kumo_core.py#L686-L719 |
DeepHorizons/iarm | iarm/arm_instructions/conditional_branch.py | ConditionalBranch.BCC | def BCC(self, params):
"""
BCC label
Branch to the instruction at label if the C flag is not set
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BCC label
def BCC_func():
if not se... | python | def BCC(self, params):
"""
BCC label
Branch to the instruction at label if the C flag is not set
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BCC label
def BCC_func():
if not se... | [
"def",
"BCC",
"(",
"self",
",",
"params",
")",
":",
"label",
"=",
"self",
".",
"get_one_parameter",
"(",
"self",
".",
"ONE_PARAMETER",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"label_exists",
"=",
"(",
"label",
",",
")",
")",
"# BCC label... | BCC label
Branch to the instruction at label if the C flag is not set | [
"BCC",
"label"
] | train | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/conditional_branch.py#L5-L20 |
DeepHorizons/iarm | iarm/arm_instructions/conditional_branch.py | ConditionalBranch.BCS | def BCS(self, params):
"""
BCS label
Branch to the instruction at label if the C flag is set
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BCS label
def BCS_func():
if self.is_C_... | python | def BCS(self, params):
"""
BCS label
Branch to the instruction at label if the C flag is set
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BCS label
def BCS_func():
if self.is_C_... | [
"def",
"BCS",
"(",
"self",
",",
"params",
")",
":",
"label",
"=",
"self",
".",
"get_one_parameter",
"(",
"self",
".",
"ONE_PARAMETER",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"label_exists",
"=",
"(",
"label",
",",
")",
")",
"# BCS label... | BCS label
Branch to the instruction at label if the C flag is set | [
"BCS",
"label"
] | train | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/conditional_branch.py#L22-L37 |
DeepHorizons/iarm | iarm/arm_instructions/conditional_branch.py | ConditionalBranch.BEQ | def BEQ(self, params):
"""
BEQ label
Branch to the instruction at label if the Z flag is set
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BEQ label
def BEQ_func():
if self.is_Z_... | python | def BEQ(self, params):
"""
BEQ label
Branch to the instruction at label if the Z flag is set
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BEQ label
def BEQ_func():
if self.is_Z_... | [
"def",
"BEQ",
"(",
"self",
",",
"params",
")",
":",
"label",
"=",
"self",
".",
"get_one_parameter",
"(",
"self",
".",
"ONE_PARAMETER",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"label_exists",
"=",
"(",
"label",
",",
")",
")",
"# BEQ label... | BEQ label
Branch to the instruction at label if the Z flag is set | [
"BEQ",
"label"
] | train | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/conditional_branch.py#L39-L54 |
DeepHorizons/iarm | iarm/arm_instructions/conditional_branch.py | ConditionalBranch.BGE | def BGE(self, params):
"""
BGE label
Branch to the instruction at label if the N flag is the same as the V flag
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BGE label
def BGE_func():
... | python | def BGE(self, params):
"""
BGE label
Branch to the instruction at label if the N flag is the same as the V flag
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BGE label
def BGE_func():
... | [
"def",
"BGE",
"(",
"self",
",",
"params",
")",
":",
"label",
"=",
"self",
".",
"get_one_parameter",
"(",
"self",
".",
"ONE_PARAMETER",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"label_exists",
"=",
"(",
"label",
",",
")",
")",
"# BGE label... | BGE label
Branch to the instruction at label if the N flag is the same as the V flag | [
"BGE",
"label"
] | train | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/conditional_branch.py#L56-L71 |
DeepHorizons/iarm | iarm/arm_instructions/conditional_branch.py | ConditionalBranch.BGT | def BGT(self, params):
"""
BGT label
Branch to the instruction at label if the N flag is the same as the V flag and the Z flag is not set
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BGT label
... | python | def BGT(self, params):
"""
BGT label
Branch to the instruction at label if the N flag is the same as the V flag and the Z flag is not set
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BGT label
... | [
"def",
"BGT",
"(",
"self",
",",
"params",
")",
":",
"label",
"=",
"self",
".",
"get_one_parameter",
"(",
"self",
".",
"ONE_PARAMETER",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"label_exists",
"=",
"(",
"label",
",",
")",
")",
"# BGT label... | BGT label
Branch to the instruction at label if the N flag is the same as the V flag and the Z flag is not set | [
"BGT",
"label"
] | train | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/conditional_branch.py#L73-L88 |
DeepHorizons/iarm | iarm/arm_instructions/conditional_branch.py | ConditionalBranch.BHI | def BHI(self, params):
"""
BHI label
Branch to the instruction at label if the C flag is set and the Z flag is not set
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BHI label
def BHI_func():... | python | def BHI(self, params):
"""
BHI label
Branch to the instruction at label if the C flag is set and the Z flag is not set
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BHI label
def BHI_func():... | [
"def",
"BHI",
"(",
"self",
",",
"params",
")",
":",
"label",
"=",
"self",
".",
"get_one_parameter",
"(",
"self",
".",
"ONE_PARAMETER",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"label_exists",
"=",
"(",
"label",
",",
")",
")",
"# BHI label... | BHI label
Branch to the instruction at label if the C flag is set and the Z flag is not set | [
"BHI",
"label"
] | train | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/conditional_branch.py#L90-L105 |
DeepHorizons/iarm | iarm/arm_instructions/conditional_branch.py | ConditionalBranch.BHS | def BHS(self, params):
"""
BHS label
Branch to the instruction at label if the C flag is set
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BHS label
def BHS_func():
if self.is_C_... | python | def BHS(self, params):
"""
BHS label
Branch to the instruction at label if the C flag is set
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BHS label
def BHS_func():
if self.is_C_... | [
"def",
"BHS",
"(",
"self",
",",
"params",
")",
":",
"label",
"=",
"self",
".",
"get_one_parameter",
"(",
"self",
".",
"ONE_PARAMETER",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"label_exists",
"=",
"(",
"label",
",",
")",
")",
"# BHS label... | BHS label
Branch to the instruction at label if the C flag is set | [
"BHS",
"label"
] | train | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/conditional_branch.py#L107-L122 |
DeepHorizons/iarm | iarm/arm_instructions/conditional_branch.py | ConditionalBranch.BLE | def BLE(self, params):
"""
BLE label
Branch to the instruction at label if the Z flag is set or if the N flag is not the same as the V flag
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BLE label
... | python | def BLE(self, params):
"""
BLE label
Branch to the instruction at label if the Z flag is set or if the N flag is not the same as the V flag
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BLE label
... | [
"def",
"BLE",
"(",
"self",
",",
"params",
")",
":",
"label",
"=",
"self",
".",
"get_one_parameter",
"(",
"self",
".",
"ONE_PARAMETER",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"label_exists",
"=",
"(",
"label",
",",
")",
")",
"# BLE label... | BLE label
Branch to the instruction at label if the Z flag is set or if the N flag is not the same as the V flag | [
"BLE",
"label"
] | train | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/conditional_branch.py#L124-L139 |
DeepHorizons/iarm | iarm/arm_instructions/conditional_branch.py | ConditionalBranch.BLO | def BLO(self, params):
"""
BLO label
Branch to the instruction at label if the C flag is not set
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BLO label
def BLO_func():
if not se... | python | def BLO(self, params):
"""
BLO label
Branch to the instruction at label if the C flag is not set
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BLO label
def BLO_func():
if not se... | [
"def",
"BLO",
"(",
"self",
",",
"params",
")",
":",
"label",
"=",
"self",
".",
"get_one_parameter",
"(",
"self",
".",
"ONE_PARAMETER",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"label_exists",
"=",
"(",
"label",
",",
")",
")",
"# BLO label... | BLO label
Branch to the instruction at label if the C flag is not set | [
"BLO",
"label"
] | train | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/conditional_branch.py#L141-L156 |
DeepHorizons/iarm | iarm/arm_instructions/conditional_branch.py | ConditionalBranch.BLS | def BLS(self, params):
"""
BLS label
Branch to the instruction at label if the C flag is not set or the Z flag is set
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BLS label
def BLS_func():
... | python | def BLS(self, params):
"""
BLS label
Branch to the instruction at label if the C flag is not set or the Z flag is set
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BLS label
def BLS_func():
... | [
"def",
"BLS",
"(",
"self",
",",
"params",
")",
":",
"label",
"=",
"self",
".",
"get_one_parameter",
"(",
"self",
".",
"ONE_PARAMETER",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"label_exists",
"=",
"(",
"label",
",",
")",
")",
"# BLS label... | BLS label
Branch to the instruction at label if the C flag is not set or the Z flag is set | [
"BLS",
"label"
] | train | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/conditional_branch.py#L158-L173 |
DeepHorizons/iarm | iarm/arm_instructions/conditional_branch.py | ConditionalBranch.BLT | def BLT(self, params):
"""
BLT label
Branch to the instruction at label if the N flag is not the same as the V flag
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BLT label
def BLT_func():
... | python | def BLT(self, params):
"""
BLT label
Branch to the instruction at label if the N flag is not the same as the V flag
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BLT label
def BLT_func():
... | [
"def",
"BLT",
"(",
"self",
",",
"params",
")",
":",
"label",
"=",
"self",
".",
"get_one_parameter",
"(",
"self",
".",
"ONE_PARAMETER",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"label_exists",
"=",
"(",
"label",
",",
")",
")",
"# BLT label... | BLT label
Branch to the instruction at label if the N flag is not the same as the V flag | [
"BLT",
"label"
] | train | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/conditional_branch.py#L175-L190 |
DeepHorizons/iarm | iarm/arm_instructions/conditional_branch.py | ConditionalBranch.BMI | def BMI(self, params):
"""
BMI label
Branch to the instruction at label if the N flag is set
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BMI label
def BMI_func():
if self.is_N_... | python | def BMI(self, params):
"""
BMI label
Branch to the instruction at label if the N flag is set
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BMI label
def BMI_func():
if self.is_N_... | [
"def",
"BMI",
"(",
"self",
",",
"params",
")",
":",
"label",
"=",
"self",
".",
"get_one_parameter",
"(",
"self",
".",
"ONE_PARAMETER",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"label_exists",
"=",
"(",
"label",
",",
")",
")",
"# BMI label... | BMI label
Branch to the instruction at label if the N flag is set | [
"BMI",
"label"
] | train | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/conditional_branch.py#L192-L207 |
DeepHorizons/iarm | iarm/arm_instructions/conditional_branch.py | ConditionalBranch.BNE | def BNE(self, params):
"""
BNE label
Branch to the instruction at label if the Z flag is not set
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BNE label
def BNE_func():
if not se... | python | def BNE(self, params):
"""
BNE label
Branch to the instruction at label if the Z flag is not set
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BNE label
def BNE_func():
if not se... | [
"def",
"BNE",
"(",
"self",
",",
"params",
")",
":",
"label",
"=",
"self",
".",
"get_one_parameter",
"(",
"self",
".",
"ONE_PARAMETER",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"label_exists",
"=",
"(",
"label",
",",
")",
")",
"# BNE label... | BNE label
Branch to the instruction at label if the Z flag is not set | [
"BNE",
"label"
] | train | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/conditional_branch.py#L209-L224 |
DeepHorizons/iarm | iarm/arm_instructions/conditional_branch.py | ConditionalBranch.BPL | def BPL(self, params):
"""
BPL label
Branch to the instruction at label if the N flag is set
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BPL label
def BPL_func():
if not self.i... | python | def BPL(self, params):
"""
BPL label
Branch to the instruction at label if the N flag is set
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BPL label
def BPL_func():
if not self.i... | [
"def",
"BPL",
"(",
"self",
",",
"params",
")",
":",
"label",
"=",
"self",
".",
"get_one_parameter",
"(",
"self",
".",
"ONE_PARAMETER",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"label_exists",
"=",
"(",
"label",
",",
")",
")",
"# BPL label... | BPL label
Branch to the instruction at label if the N flag is set | [
"BPL",
"label"
] | train | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/conditional_branch.py#L226-L241 |
DeepHorizons/iarm | iarm/arm_instructions/conditional_branch.py | ConditionalBranch.BVC | def BVC(self, params):
"""
BVC label
Branch to the instruction at label if the V flag is not set
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BVC label
def BVC_func():
if not se... | python | def BVC(self, params):
"""
BVC label
Branch to the instruction at label if the V flag is not set
"""
label = self.get_one_parameter(self.ONE_PARAMETER, params)
self.check_arguments(label_exists=(label,))
# BVC label
def BVC_func():
if not se... | [
"def",
"BVC",
"(",
"self",
",",
"params",
")",
":",
"label",
"=",
"self",
".",
"get_one_parameter",
"(",
"self",
".",
"ONE_PARAMETER",
",",
"params",
")",
"self",
".",
"check_arguments",
"(",
"label_exists",
"=",
"(",
"label",
",",
")",
")",
"# BVC label... | BVC label
Branch to the instruction at label if the V flag is not set | [
"BVC",
"label"
] | train | https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/conditional_branch.py#L243-L258 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.