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 |
|---|---|---|---|---|---|---|---|---|---|---|
collectiveacuity/labPack | labpack/databases/couchbase.py | syncGatewayClient.exists | def exists(self, doc_id, rev_id=''):
'''
a method to determine if document exists
:param doc_id: string with id of document in bucket
:param rev_id: [optional] string with revision id of document in bucket
:return: boolean indicating existence of docume... | python | def exists(self, doc_id, rev_id=''):
'''
a method to determine if document exists
:param doc_id: string with id of document in bucket
:param rev_id: [optional] string with revision id of document in bucket
:return: boolean indicating existence of docume... | [
"def",
"exists",
"(",
"self",
",",
"doc_id",
",",
"rev_id",
"=",
"''",
")",
":",
"title",
"=",
"'%s.exists'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"# validate inputs",
"input_fields",
"=",
"{",
"'doc_id'",
":",
"doc_id",
",",
"'rev_id'",
":",
... | a method to determine if document exists
:param doc_id: string with id of document in bucket
:param rev_id: [optional] string with revision id of document in bucket
:return: boolean indicating existence of document | [
"a",
"method",
"to",
"determine",
"if",
"document",
"exists",
":",
"param",
"doc_id",
":",
"string",
"with",
"id",
"of",
"document",
"in",
"bucket",
":",
"param",
"rev_id",
":",
"[",
"optional",
"]",
"string",
"with",
"revision",
"id",
"of",
"document",
... | train | https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/databases/couchbase.py#L695-L725 |
collectiveacuity/labPack | labpack/databases/couchbase.py | syncGatewayClient.list | def list(self, query_criteria=None, uid='_all_users', all_versions=False, previous_id='', purge_deleted=False):
'''
a generator method for retrieving documents from the bucket
:param query_criteria: [optional] dictionary with valid jsonmodel query criteria
:param ... | python | def list(self, query_criteria=None, uid='_all_users', all_versions=False, previous_id='', purge_deleted=False):
'''
a generator method for retrieving documents from the bucket
:param query_criteria: [optional] dictionary with valid jsonmodel query criteria
:param ... | [
"def",
"list",
"(",
"self",
",",
"query_criteria",
"=",
"None",
",",
"uid",
"=",
"'_all_users'",
",",
"all_versions",
"=",
"False",
",",
"previous_id",
"=",
"''",
",",
"purge_deleted",
"=",
"False",
")",
":",
"title",
"=",
"'%s.list'",
"%",
"self",
".",
... | a generator method for retrieving documents from the bucket
:param query_criteria: [optional] dictionary with valid jsonmodel query criteria
:param uid: [optional] string with uid of design document to update
:param all_versions: boolean to include previous revisions in query
... | [
"a",
"generator",
"method",
"for",
"retrieving",
"documents",
"from",
"the",
"bucket",
":",
"param",
"query_criteria",
":",
"[",
"optional",
"]",
"dictionary",
"with",
"valid",
"jsonmodel",
"query",
"criteria",
":",
"param",
"uid",
":",
"[",
"optional",
"]",
... | train | https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/databases/couchbase.py#L727-L903 |
collectiveacuity/labPack | labpack/databases/couchbase.py | syncGatewayClient.create | def create(self, doc_details):
'''
a method to create a new document in the collection
:param doc_details: dictionary with document details and user id value
:return: dictionary with document details and _id and _rev values
'''
# https://developer.couchbase... | python | def create(self, doc_details):
'''
a method to create a new document in the collection
:param doc_details: dictionary with document details and user id value
:return: dictionary with document details and _id and _rev values
'''
# https://developer.couchbase... | [
"def",
"create",
"(",
"self",
",",
"doc_details",
")",
":",
"# https://developer.couchbase.com/documentation/mobile/1.5/references/sync-gateway/admin-rest-api/index.html#/document/post__db___doc_",
"title",
"=",
"'%s.create'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"# va... | a method to create a new document in the collection
:param doc_details: dictionary with document details and user id value
:return: dictionary with document details and _id and _rev values | [
"a",
"method",
"to",
"create",
"a",
"new",
"document",
"in",
"the",
"collection"
] | train | https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/databases/couchbase.py#L905-L936 |
collectiveacuity/labPack | labpack/databases/couchbase.py | syncGatewayClient.purge | def purge(self, doc_ids):
'''
a method to remove docs from the collection
:param doc_ids: string or list of strings with document ids to purge
:return: list of strings of doc ids purged
'''
# https://developer.couchbase.com/documentation/mobile... | python | def purge(self, doc_ids):
'''
a method to remove docs from the collection
:param doc_ids: string or list of strings with document ids to purge
:return: list of strings of doc ids purged
'''
# https://developer.couchbase.com/documentation/mobile... | [
"def",
"purge",
"(",
"self",
",",
"doc_ids",
")",
":",
"# https://developer.couchbase.com/documentation/mobile/1.5/references/sync-gateway/admin-rest-api/index.html#/document/post__db___purge",
"title",
"=",
"'%s.purge'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"# ingest ... | a method to remove docs from the collection
:param doc_ids: string or list of strings with document ids to purge
:return: list of strings of doc ids purged | [
"a",
"method",
"to",
"remove",
"docs",
"from",
"the",
"collection",
":",
"param",
"doc_ids",
":",
"string",
"or",
"list",
"of",
"strings",
"with",
"document",
"ids",
"to",
"purge",
":",
"return",
":",
"list",
"of",
"strings",
"of",
"doc",
"ids",
"purged"... | train | https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/databases/couchbase.py#L1038-L1081 |
collectiveacuity/labPack | labpack/databases/couchbase.py | syncGatewayClient.remove | def remove(self):
'''
a method to remove the entire bucket from the database
:return: string with confirmation message
'''
# https://developer.couchbase.com/documentation/mobile/1.5/references/sync-gateway/admin-rest-api/index.html#/database/delete__db__
title =... | python | def remove(self):
'''
a method to remove the entire bucket from the database
:return: string with confirmation message
'''
# https://developer.couchbase.com/documentation/mobile/1.5/references/sync-gateway/admin-rest-api/index.html#/database/delete__db__
title =... | [
"def",
"remove",
"(",
"self",
")",
":",
"# https://developer.couchbase.com/documentation/mobile/1.5/references/sync-gateway/admin-rest-api/index.html#/database/delete__db__",
"title",
"=",
"'%s.remove'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"# validate admin access",
"if... | a method to remove the entire bucket from the database
:return: string with confirmation message | [
"a",
"method",
"to",
"remove",
"the",
"entire",
"bucket",
"from",
"the",
"database"
] | train | https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/databases/couchbase.py#L1083-L1125 |
Zsailer/yerkes | yerkes/base.py | EmptyPalette.to_chart | def to_chart(self):
"""Write color palette to Altair Chart.
"""
encoding, properties = {}, {}
if self.orientation == "horizontal":
# Set the axis
encoding["x"] = alt.X(
"hex",
axis=None,
scale=alt.Scale(zero=False, ... | python | def to_chart(self):
"""Write color palette to Altair Chart.
"""
encoding, properties = {}, {}
if self.orientation == "horizontal":
# Set the axis
encoding["x"] = alt.X(
"hex",
axis=None,
scale=alt.Scale(zero=False, ... | [
"def",
"to_chart",
"(",
"self",
")",
":",
"encoding",
",",
"properties",
"=",
"{",
"}",
",",
"{",
"}",
"if",
"self",
".",
"orientation",
"==",
"\"horizontal\"",
":",
"# Set the axis",
"encoding",
"[",
"\"x\"",
"]",
"=",
"alt",
".",
"X",
"(",
"\"hex\"",... | Write color palette to Altair Chart. | [
"Write",
"color",
"palette",
"to",
"Altair",
"Chart",
"."
] | train | https://github.com/Zsailer/yerkes/blob/0434e3b2ee124736e6ece63077430eac8eb6ac09/yerkes/base.py#L60-L98 |
Zsailer/yerkes | yerkes/base.py | EmptyPalette._repr_mimebundle_ | def _repr_mimebundle_(self, *args, **kwargs):
"""Return a MIME bundle for display in Jupyter frontends."""
chart = self.to_chart()
dct = chart.to_dict()
return alt.renderers.get()(dct) | python | def _repr_mimebundle_(self, *args, **kwargs):
"""Return a MIME bundle for display in Jupyter frontends."""
chart = self.to_chart()
dct = chart.to_dict()
return alt.renderers.get()(dct) | [
"def",
"_repr_mimebundle_",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"chart",
"=",
"self",
".",
"to_chart",
"(",
")",
"dct",
"=",
"chart",
".",
"to_dict",
"(",
")",
"return",
"alt",
".",
"renderers",
".",
"get",
"(",
")",
... | Return a MIME bundle for display in Jupyter frontends. | [
"Return",
"a",
"MIME",
"bundle",
"for",
"display",
"in",
"Jupyter",
"frontends",
"."
] | train | https://github.com/Zsailer/yerkes/blob/0434e3b2ee124736e6ece63077430eac8eb6ac09/yerkes/base.py#L100-L104 |
sassoo/goldman | goldman/middleware/rate_limit/__init__.py | Middleware.process_request | def process_request(self, req, resp):
""" Process the request before routing it. """
key = req.env['REMOTE_PORT'] + req.env['REMOTE_ADDR']
val = self.cache.get(key, 0)
if val == self.count:
abort(exceptions.TooManyRequests(headers=self._error_headers))
else:
... | python | def process_request(self, req, resp):
""" Process the request before routing it. """
key = req.env['REMOTE_PORT'] + req.env['REMOTE_ADDR']
val = self.cache.get(key, 0)
if val == self.count:
abort(exceptions.TooManyRequests(headers=self._error_headers))
else:
... | [
"def",
"process_request",
"(",
"self",
",",
"req",
",",
"resp",
")",
":",
"key",
"=",
"req",
".",
"env",
"[",
"'REMOTE_PORT'",
"]",
"+",
"req",
".",
"env",
"[",
"'REMOTE_ADDR'",
"]",
"val",
"=",
"self",
".",
"cache",
".",
"get",
"(",
"key",
",",
... | Process the request before routing it. | [
"Process",
"the",
"request",
"before",
"routing",
"it",
"."
] | train | https://github.com/sassoo/goldman/blob/b72540c9ad06b5c68aadb1b4fa8cb0b716260bf2/goldman/middleware/rate_limit/__init__.py#L51-L60 |
jason2506/HTMLMinifier | HTMLMinifier/parser.py | Parser._enter_newline | def _enter_newline(self):
"""
Remove the trailing spaces in the current line, and then mark that the
leading spaces of the next line need to be removed.
.. seealso::
`CSS Text Module Level 3 - The White Space Processing Rules
<http://www.w3.org/TR/css3-text/#white... | python | def _enter_newline(self):
"""
Remove the trailing spaces in the current line, and then mark that the
leading spaces of the next line need to be removed.
.. seealso::
`CSS Text Module Level 3 - The White Space Processing Rules
<http://www.w3.org/TR/css3-text/#white... | [
"def",
"_enter_newline",
"(",
"self",
")",
":",
"last_text_idx",
"=",
"self",
".",
"_last_text_idx",
"if",
"last_text_idx",
">=",
"0",
":",
"buf",
"=",
"self",
".",
"_buffer",
"buf",
"[",
"last_text_idx",
"]",
"=",
"buf",
"[",
"last_text_idx",
"]",
".",
... | Remove the trailing spaces in the current line, and then mark that the
leading spaces of the next line need to be removed.
.. seealso::
`CSS Text Module Level 3 - The White Space Processing Rules
<http://www.w3.org/TR/css3-text/#white-space-phase-2>`_ | [
"Remove",
"the",
"trailing",
"spaces",
"in",
"the",
"current",
"line",
"and",
"then",
"mark",
"that",
"the",
"leading",
"spaces",
"of",
"the",
"next",
"line",
"need",
"to",
"be",
"removed",
"."
] | train | https://github.com/jason2506/HTMLMinifier/blob/9a6a41834b7753ac465f301f0d6b470b90920fad/HTMLMinifier/parser.py#L102-L117 |
jason2506/HTMLMinifier | HTMLMinifier/parser.py | Parser.handle_comment | def handle_comment(self, comment):
"""
Remove comment except IE conditional comment.
.. seealso::
`About conditional comments
<http://msdn.microsoft.com/en-us/library/ms537512.ASPX>`_
"""
match = _COND_COMMENT_PATTERN.match(comment)
if match is no... | python | def handle_comment(self, comment):
"""
Remove comment except IE conditional comment.
.. seealso::
`About conditional comments
<http://msdn.microsoft.com/en-us/library/ms537512.ASPX>`_
"""
match = _COND_COMMENT_PATTERN.match(comment)
if match is no... | [
"def",
"handle_comment",
"(",
"self",
",",
"comment",
")",
":",
"match",
"=",
"_COND_COMMENT_PATTERN",
".",
"match",
"(",
"comment",
")",
"if",
"match",
"is",
"not",
"None",
":",
"cond",
"=",
"match",
".",
"group",
"(",
"1",
")",
"content",
"=",
"match... | Remove comment except IE conditional comment.
.. seealso::
`About conditional comments
<http://msdn.microsoft.com/en-us/library/ms537512.ASPX>`_ | [
"Remove",
"comment",
"except",
"IE",
"conditional",
"comment",
"."
] | train | https://github.com/jason2506/HTMLMinifier/blob/9a6a41834b7753ac465f301f0d6b470b90920fad/HTMLMinifier/parser.py#L136-L156 |
jason2506/HTMLMinifier | HTMLMinifier/parser.py | Parser.handle_startendtag | def handle_startendtag(self, tag, attrs):
"""
Normalize the tag with trailing '/' character (such as `<img ... />`).
The trailing '/' character has no effect on void elements, but on
foreign elements it marks the start tag as self-closing.
.. seealso::
`HTML5 - Start... | python | def handle_startendtag(self, tag, attrs):
"""
Normalize the tag with trailing '/' character (such as `<img ... />`).
The trailing '/' character has no effect on void elements, but on
foreign elements it marks the start tag as self-closing.
.. seealso::
`HTML5 - Start... | [
"def",
"handle_startendtag",
"(",
"self",
",",
"tag",
",",
"attrs",
")",
":",
"is_foreign",
"=",
"tag",
"not",
"in",
"_VOID_ELEMENTS",
"self",
".",
"_append_tag",
"(",
"tag",
",",
"attrs",
",",
"closing",
"=",
"is_foreign",
")",
"if",
"tag",
"in",
"_BLOC... | Normalize the tag with trailing '/' character (such as `<img ... />`).
The trailing '/' character has no effect on void elements, but on
foreign elements it marks the start tag as self-closing.
.. seealso::
`HTML5 - Start tags
<http://www.w3.org/TR/html5-author/syntax.ht... | [
"Normalize",
"the",
"tag",
"with",
"trailing",
"/",
"character",
"(",
"such",
"as",
"<img",
"...",
"/",
">",
")",
"."
] | train | https://github.com/jason2506/HTMLMinifier/blob/9a6a41834b7753ac465f301f0d6b470b90920fad/HTMLMinifier/parser.py#L189-L205 |
jason2506/HTMLMinifier | HTMLMinifier/parser.py | Parser.handle_data | def handle_data(self, data):
"""
Any space immediately following another collapsible space will be
collapsed.
.. seealso::
`CSS Text Module Level 3 - The White Space Processing Rules
<http://www.w3.org/TR/css3-text/#egbidiwscollapse>`_
"""
tag_sta... | python | def handle_data(self, data):
"""
Any space immediately following another collapsible space will be
collapsed.
.. seealso::
`CSS Text Module Level 3 - The White Space Processing Rules
<http://www.w3.org/TR/css3-text/#egbidiwscollapse>`_
"""
tag_sta... | [
"def",
"handle_data",
"(",
"self",
",",
"data",
")",
":",
"tag_stack",
"=",
"self",
".",
"_tag_stack",
"if",
"tag_stack",
"and",
"tag_stack",
"[",
"-",
"1",
"]",
"in",
"_RM_WS_ELEMENTS",
":",
"# just ignore the content of this element",
"assert",
"data",
".",
... | Any space immediately following another collapsible space will be
collapsed.
.. seealso::
`CSS Text Module Level 3 - The White Space Processing Rules
<http://www.w3.org/TR/css3-text/#egbidiwscollapse>`_ | [
"Any",
"space",
"immediately",
"following",
"another",
"collapsible",
"space",
"will",
"be",
"collapsed",
"."
] | train | https://github.com/jason2506/HTMLMinifier/blob/9a6a41834b7753ac465f301f0d6b470b90920fad/HTMLMinifier/parser.py#L207-L241 |
tommilligan/pypersonalassistant | pypersonalassistant/secure.py | secure.edit_credentials | def edit_credentials(self, credential=None, already_set=True):
"""
Edit the credentials used by the :py:class:`~pypersonalassistant.secure.secure` class.
.. note :: User input is required.
By default, unset credentials will be displayed.
:param string credentia... | python | def edit_credentials(self, credential=None, already_set=True):
"""
Edit the credentials used by the :py:class:`~pypersonalassistant.secure.secure` class.
.. note :: User input is required.
By default, unset credentials will be displayed.
:param string credentia... | [
"def",
"edit_credentials",
"(",
"self",
",",
"credential",
"=",
"None",
",",
"already_set",
"=",
"True",
")",
":",
"# get user input of credentials",
"# save and reload credentials.json",
"credentials_required",
"=",
"self",
".",
"_CREDENTIALS_REQUIRED",
"if",
"credential... | Edit the credentials used by the :py:class:`~pypersonalassistant.secure.secure` class.
.. note :: User input is required.
By default, unset credentials will be displayed.
:param string credential: A specific credential to edit.
:param bool already_set: If `False` will ... | [
"Edit",
"the",
"credentials",
"used",
"by",
"the",
":",
"py",
":",
"class",
":",
"~pypersonalassistant",
".",
"secure",
".",
"secure",
"class",
".",
"..",
"note",
"::",
"User",
"input",
"is",
"required",
"."
] | train | https://github.com/tommilligan/pypersonalassistant/blob/123903189be3f3d73a6f480de5e4442ffd099058/pypersonalassistant/secure.py#L140-L176 |
tommilligan/pypersonalassistant | pypersonalassistant/secure.py | secure.twilio_SMS | def twilio_SMS(self, from_, to, body):
"""
Send an SMS message from your `twilio`_ account.
.. _twilio: https://www.twilio.com/
Login will be performed using stored credentials.
* *stored credential name: TWILIO_ACCOUNT_SID*
* *stored credential name: TWILIO_AU... | python | def twilio_SMS(self, from_, to, body):
"""
Send an SMS message from your `twilio`_ account.
.. _twilio: https://www.twilio.com/
Login will be performed using stored credentials.
* *stored credential name: TWILIO_ACCOUNT_SID*
* *stored credential name: TWILIO_AU... | [
"def",
"twilio_SMS",
"(",
"self",
",",
"from_",
",",
"to",
",",
"body",
")",
":",
"logging",
".",
"debug",
"(",
"'Texting from Twilio'",
")",
"client",
"=",
"TwilioRestClient",
"(",
"self",
".",
"_credentials",
"[",
"'TWILIO_ACCOUNT_SID'",
"]",
",",
"self",
... | Send an SMS message from your `twilio`_ account.
.. _twilio: https://www.twilio.com/
Login will be performed using stored credentials.
* *stored credential name: TWILIO_ACCOUNT_SID*
* *stored credential name: TWILIO_AUTH_TOKEN*
:param string from_: The phone n... | [
"Send",
"an",
"SMS",
"message",
"from",
"your",
"twilio",
"_",
"account",
"."
] | train | https://github.com/tommilligan/pypersonalassistant/blob/123903189be3f3d73a6f480de5e4442ffd099058/pypersonalassistant/secure.py#L188-L211 |
tommilligan/pypersonalassistant | pypersonalassistant/secure.py | secure.SMS | def SMS(self, to, body):
"""
Quickly send an SMS from a default number. Calls :py:meth:`twilio_SMS`.
* *stored credential name: TWILIO_PHONE_NUMBER*
:param string to: The phone number to send the SMS message to. Full international format.
:param string body: The... | python | def SMS(self, to, body):
"""
Quickly send an SMS from a default number. Calls :py:meth:`twilio_SMS`.
* *stored credential name: TWILIO_PHONE_NUMBER*
:param string to: The phone number to send the SMS message to. Full international format.
:param string body: The... | [
"def",
"SMS",
"(",
"self",
",",
"to",
",",
"body",
")",
":",
"logging",
".",
"debug",
"(",
"'Texting someone'",
")",
"return",
"self",
".",
"twilio_SMS",
"(",
"self",
".",
"_credentials",
"[",
"'TWILIO_PHONE_NUMBER'",
"]",
",",
"to",
",",
"body",
")"
] | Quickly send an SMS from a default number. Calls :py:meth:`twilio_SMS`.
* *stored credential name: TWILIO_PHONE_NUMBER*
:param string to: The phone number to send the SMS message to. Full international format.
:param string body: The content of the SMS message. | [
"Quickly",
"send",
"an",
"SMS",
"from",
"a",
"default",
"number",
".",
"Calls",
":",
"py",
":",
"meth",
":",
"twilio_SMS",
".",
"*",
"*",
"stored",
"credential",
"name",
":",
"TWILIO_PHONE_NUMBER",
"*",
":",
"param",
"string",
"to",
":",
"The",
"phone",
... | train | https://github.com/tommilligan/pypersonalassistant/blob/123903189be3f3d73a6f480de5e4442ffd099058/pypersonalassistant/secure.py#L213-L223 |
tommilligan/pypersonalassistant | pypersonalassistant/secure.py | secure.SMS_me | def SMS_me(self, body):
"""
Quickly send an SMS to yourself. Calls :py:meth:`SMS`.
* *stored credential name: PERSONAL_PHONE_NUMBER*
:param string body: The content of the SMS message.
"""
logging.debug('Texting myself')
return self.text(self._c... | python | def SMS_me(self, body):
"""
Quickly send an SMS to yourself. Calls :py:meth:`SMS`.
* *stored credential name: PERSONAL_PHONE_NUMBER*
:param string body: The content of the SMS message.
"""
logging.debug('Texting myself')
return self.text(self._c... | [
"def",
"SMS_me",
"(",
"self",
",",
"body",
")",
":",
"logging",
".",
"debug",
"(",
"'Texting myself'",
")",
"return",
"self",
".",
"text",
"(",
"self",
".",
"_credentials",
"[",
"'PERSONAL_PHONE_NUMBER'",
"]",
",",
"body",
")"
] | Quickly send an SMS to yourself. Calls :py:meth:`SMS`.
* *stored credential name: PERSONAL_PHONE_NUMBER*
:param string body: The content of the SMS message. | [
"Quickly",
"send",
"an",
"SMS",
"to",
"yourself",
".",
"Calls",
":",
"py",
":",
"meth",
":",
"SMS",
".",
"*",
"*",
"stored",
"credential",
"name",
":",
"PERSONAL_PHONE_NUMBER",
"*",
":",
"param",
"string",
"body",
":",
"The",
"content",
"of",
"the",
"S... | train | https://github.com/tommilligan/pypersonalassistant/blob/123903189be3f3d73a6f480de5e4442ffd099058/pypersonalassistant/secure.py#L225-L234 |
tommilligan/pypersonalassistant | pypersonalassistant/secure.py | secure.gmail_email | def gmail_email(self, from_, to, msg):
"""
Send an email from your `gmail`_ account.
.. _gmail: https://mail.google.com/
msg can either be:
* A string, in which case:
* At the first newline (\\n) the string will be split into subjec... | python | def gmail_email(self, from_, to, msg):
"""
Send an email from your `gmail`_ account.
.. _gmail: https://mail.google.com/
msg can either be:
* A string, in which case:
* At the first newline (\\n) the string will be split into subjec... | [
"def",
"gmail_email",
"(",
"self",
",",
"from_",
",",
"to",
",",
"msg",
")",
":",
"logging",
".",
"debug",
"(",
"'Emailing from Gmail'",
")",
"smtpConn",
"=",
"smtplib",
".",
"SMTP",
"(",
"'smtp.gmail.com'",
",",
"587",
")",
"smtpConn",
".",
"ehlo",
"(",... | Send an email from your `gmail`_ account.
.. _gmail: https://mail.google.com/
msg can either be:
* A string, in which case:
* At the first newline (\\n) the string will be split into subject and body
* If no newline is present, the enti... | [
"Send",
"an",
"email",
"from",
"your",
"gmail",
"_",
"account",
".",
"..",
"_gmail",
":",
"https",
":",
"//",
"mail",
".",
"google",
".",
"com",
"/",
"msg",
"can",
"either",
"be",
":",
"*",
"A",
"string",
"in",
"which",
"case",
":",
"*",
"At",
"t... | train | https://github.com/tommilligan/pypersonalassistant/blob/123903189be3f3d73a6f480de5e4442ffd099058/pypersonalassistant/secure.py#L238-L289 |
tommilligan/pypersonalassistant | pypersonalassistant/secure.py | secure.email | def email(self, to, msg):
"""
Quickly send an email from a default address. Calls :py:meth:`gmail_email`.
* *stored credential name: GMAIL_EMAIL*
:param string to: The email address to send the email to.
:param msg: The content of the email. See :py:meth:`gmail_... | python | def email(self, to, msg):
"""
Quickly send an email from a default address. Calls :py:meth:`gmail_email`.
* *stored credential name: GMAIL_EMAIL*
:param string to: The email address to send the email to.
:param msg: The content of the email. See :py:meth:`gmail_... | [
"def",
"email",
"(",
"self",
",",
"to",
",",
"msg",
")",
":",
"logging",
".",
"debug",
"(",
"'Emailing someone'",
")",
"return",
"self",
".",
"gmail_email",
"(",
"self",
".",
"_credentials",
"[",
"'GMAIL_EMAIL'",
"]",
",",
"to",
",",
"msg",
")"
] | Quickly send an email from a default address. Calls :py:meth:`gmail_email`.
* *stored credential name: GMAIL_EMAIL*
:param string to: The email address to send the email to.
:param msg: The content of the email. See :py:meth:`gmail_email`. | [
"Quickly",
"send",
"an",
"email",
"from",
"a",
"default",
"address",
".",
"Calls",
":",
"py",
":",
"meth",
":",
"gmail_email",
".",
"*",
"*",
"stored",
"credential",
"name",
":",
"GMAIL_EMAIL",
"*",
":",
"param",
"string",
"to",
":",
"The",
"email",
"a... | train | https://github.com/tommilligan/pypersonalassistant/blob/123903189be3f3d73a6f480de5e4442ffd099058/pypersonalassistant/secure.py#L291-L301 |
tommilligan/pypersonalassistant | pypersonalassistant/secure.py | secure.email_me | def email_me(self, msg):
"""
Quickly send an email to yourself. Calls :py:meth:`email`.
* *stored credential name: PERSONAL_EMAIL*
:param msg: The content of the email. See :py:meth:`gmail_email`.
"""
logging.debug('Emailing myself')
return self... | python | def email_me(self, msg):
"""
Quickly send an email to yourself. Calls :py:meth:`email`.
* *stored credential name: PERSONAL_EMAIL*
:param msg: The content of the email. See :py:meth:`gmail_email`.
"""
logging.debug('Emailing myself')
return self... | [
"def",
"email_me",
"(",
"self",
",",
"msg",
")",
":",
"logging",
".",
"debug",
"(",
"'Emailing myself'",
")",
"return",
"self",
".",
"email",
"(",
"self",
".",
"_credentials",
"[",
"'PERSONAL_EMAIL'",
"]",
",",
"msg",
")"
] | Quickly send an email to yourself. Calls :py:meth:`email`.
* *stored credential name: PERSONAL_EMAIL*
:param msg: The content of the email. See :py:meth:`gmail_email`. | [
"Quickly",
"send",
"an",
"email",
"to",
"yourself",
".",
"Calls",
":",
"py",
":",
"meth",
":",
"email",
".",
"*",
"*",
"stored",
"credential",
"name",
":",
"PERSONAL_EMAIL",
"*",
":",
"param",
"msg",
":",
"The",
"content",
"of",
"the",
"email",
".",
... | train | https://github.com/tommilligan/pypersonalassistant/blob/123903189be3f3d73a6f480de5e4442ffd099058/pypersonalassistant/secure.py#L303-L312 |
pip-services3-python/pip-services3-components-python | pip_services3_components/auth/CredentialResolver.py | CredentialResolver.configure | def configure(self, config):
"""
Configures component by passing configuration parameters.
:param config: configuration parameters to be set.
"""
credentials = CredentialParams.many_from_config(config)
for credential in credentials:
self._credentials.append(c... | python | def configure(self, config):
"""
Configures component by passing configuration parameters.
:param config: configuration parameters to be set.
"""
credentials = CredentialParams.many_from_config(config)
for credential in credentials:
self._credentials.append(c... | [
"def",
"configure",
"(",
"self",
",",
"config",
")",
":",
"credentials",
"=",
"CredentialParams",
".",
"many_from_config",
"(",
"config",
")",
"for",
"credential",
"in",
"credentials",
":",
"self",
".",
"_credentials",
".",
"append",
"(",
"credential",
")"
] | Configures component by passing configuration parameters.
:param config: configuration parameters to be set. | [
"Configures",
"component",
"by",
"passing",
"configuration",
"parameters",
"."
] | train | https://github.com/pip-services3-python/pip-services3-components-python/blob/1de9c1bb544cf1891111e9a5f5d67653f62c9b52/pip_services3_components/auth/CredentialResolver.py#L79-L87 |
mehmetg/streak_client | streak_client/streak_client.py | StreakClientBaseObject._get_req_fp | def _get_req_fp(self, op):
'''Decisions on what verb to use and content headers happen here
Args:
op a string specifying a http verb'''
if(op):
op = op.lower()
if op == 'get':
return requests.get, None
if op == 'put':
return requests.put, {'Content-Type': 'application/x-www-form-urlencoded'... | python | def _get_req_fp(self, op):
'''Decisions on what verb to use and content headers happen here
Args:
op a string specifying a http verb'''
if(op):
op = op.lower()
if op == 'get':
return requests.get, None
if op == 'put':
return requests.put, {'Content-Type': 'application/x-www-form-urlencoded'... | [
"def",
"_get_req_fp",
"(",
"self",
",",
"op",
")",
":",
"if",
"(",
"op",
")",
":",
"op",
"=",
"op",
".",
"lower",
"(",
")",
"if",
"op",
"==",
"'get'",
":",
"return",
"requests",
".",
"get",
",",
"None",
"if",
"op",
"==",
"'put'",
":",
"return",... | Decisions on what verb to use and content headers happen here
Args:
op a string specifying a http verb | [
"Decisions",
"on",
"what",
"verb",
"to",
"use",
"and",
"content",
"headers",
"happen",
"here",
"Args",
":",
"op",
"a",
"string",
"specifying",
"a",
"http",
"verb"
] | train | https://github.com/mehmetg/streak_client/blob/46575510b4e4163a4a3cc06f7283a1ae377cdce6/streak_client/streak_client.py#L32-L47 |
mehmetg/streak_client | streak_client/streak_client.py | StreakClientBaseObject._req | def _req(self, op, uri, payload = None):
'''HTTP reequest wrapper with data packaging fucntionality
Args:
op http verb in str
uri address of the request
payload data to be sent in dict format (default: None)
If not provided no data is sent
return code and req response dict (single or lis... | python | def _req(self, op, uri, payload = None):
'''HTTP reequest wrapper with data packaging fucntionality
Args:
op http verb in str
uri address of the request
payload data to be sent in dict format (default: None)
If not provided no data is sent
return code and req response dict (single or lis... | [
"def",
"_req",
"(",
"self",
",",
"op",
",",
"uri",
",",
"payload",
"=",
"None",
")",
":",
"if",
"DEBUG",
":",
"print",
"(",
"(",
"'uri'",
",",
"uri",
")",
")",
"req_fp",
",",
"content_type",
"=",
"self",
".",
"_get_req_fp",
"(",
"op",
")",
"if",
... | HTTP reequest wrapper with data packaging fucntionality
Args:
op http verb in str
uri address of the request
payload data to be sent in dict format (default: None)
If not provided no data is sent
return code and req response dict (single or list) | [
"HTTP",
"reequest",
"wrapper",
"with",
"data",
"packaging",
"fucntionality",
"Args",
":",
"op",
"http",
"verb",
"in",
"str",
"uri",
"address",
"of",
"the",
"request",
"payload",
"data",
"to",
"be",
"sent",
"in",
"dict",
"format",
"(",
"default",
":",
"None... | train | https://github.com/mehmetg/streak_client/blob/46575510b4e4163a4a3cc06f7283a1ae377cdce6/streak_client/streak_client.py#L49-L80 |
mehmetg/streak_client | streak_client/streak_client.py | StreakClient._parse_req | def _parse_req(self, req):
'''Parses a request object for relevant debugging information. Only works
if DEBUG is enabled.
Args:
req requests req object
'''
if DEBUG:
if req.status_code != requests.codes.ok:
print(("code: {}".format(req.status_code)))
print(("response {}".format(req.json())))
... | python | def _parse_req(self, req):
'''Parses a request object for relevant debugging information. Only works
if DEBUG is enabled.
Args:
req requests req object
'''
if DEBUG:
if req.status_code != requests.codes.ok:
print(("code: {}".format(req.status_code)))
print(("response {}".format(req.json())))
... | [
"def",
"_parse_req",
"(",
"self",
",",
"req",
")",
":",
"if",
"DEBUG",
":",
"if",
"req",
".",
"status_code",
"!=",
"requests",
".",
"codes",
".",
"ok",
":",
"print",
"(",
"(",
"\"code: {}\"",
".",
"format",
"(",
"req",
".",
"status_code",
")",
")",
... | Parses a request object for relevant debugging information. Only works
if DEBUG is enabled.
Args:
req requests req object | [
"Parses",
"a",
"request",
"object",
"for",
"relevant",
"debugging",
"information",
".",
"Only",
"works",
"if",
"DEBUG",
"is",
"enabled",
".",
"Args",
":",
"req",
"requests",
"req",
"object"
] | train | https://github.com/mehmetg/streak_client/blob/46575510b4e4163a4a3cc06f7283a1ae377cdce6/streak_client/streak_client.py#L140-L151 |
mehmetg/streak_client | streak_client/streak_client.py | StreakClient.get_user | def get_user(self, key = None):
'''Get user information from the server and update the attribute
Args:
key user key (default: me)
return (status code for the get request, dict user data)
'''
if key:
uri = self.api_uri + "/users/" + key
else:
uri = self.api_uri + "/users/me"
return self._re... | python | def get_user(self, key = None):
'''Get user information from the server and update the attribute
Args:
key user key (default: me)
return (status code for the get request, dict user data)
'''
if key:
uri = self.api_uri + "/users/" + key
else:
uri = self.api_uri + "/users/me"
return self._re... | [
"def",
"get_user",
"(",
"self",
",",
"key",
"=",
"None",
")",
":",
"if",
"key",
":",
"uri",
"=",
"self",
".",
"api_uri",
"+",
"\"/users/\"",
"+",
"key",
"else",
":",
"uri",
"=",
"self",
".",
"api_uri",
"+",
"\"/users/me\"",
"return",
"self",
".",
"... | Get user information from the server and update the attribute
Args:
key user key (default: me)
return (status code for the get request, dict user data) | [
"Get",
"user",
"information",
"from",
"the",
"server",
"and",
"update",
"the",
"attribute",
"Args",
":",
"key",
"user",
"key",
"(",
"default",
":",
"me",
")",
"return",
"(",
"status",
"code",
"for",
"the",
"get",
"request",
"dict",
"user",
"data",
")"
] | train | https://github.com/mehmetg/streak_client/blob/46575510b4e4163a4a3cc06f7283a1ae377cdce6/streak_client/streak_client.py#L160-L171 |
mehmetg/streak_client | streak_client/streak_client.py | StreakClient.delete_pipeline | def delete_pipeline(self, pipeline_key):
'''Deletes the pipeline specified by the key
Args:
returns (status code for the DELETE request, success message dict)
expect (200 , {'success': 'true'}) for successful execution}
'''
if pipeline_key:
uri = '/'.join([
self.api_uri,
self.pipeline... | python | def delete_pipeline(self, pipeline_key):
'''Deletes the pipeline specified by the key
Args:
returns (status code for the DELETE request, success message dict)
expect (200 , {'success': 'true'}) for successful execution}
'''
if pipeline_key:
uri = '/'.join([
self.api_uri,
self.pipeline... | [
"def",
"delete_pipeline",
"(",
"self",
",",
"pipeline_key",
")",
":",
"if",
"pipeline_key",
":",
"uri",
"=",
"'/'",
".",
"join",
"(",
"[",
"self",
".",
"api_uri",
",",
"self",
".",
"pipelines_suffix",
",",
"pipeline_key",
"]",
")",
"return",
"self",
".",... | Deletes the pipeline specified by the key
Args:
returns (status code for the DELETE request, success message dict)
expect (200 , {'success': 'true'}) for successful execution} | [
"Deletes",
"the",
"pipeline",
"specified",
"by",
"the",
"key",
"Args",
":",
"returns",
"(",
"status",
"code",
"for",
"the",
"DELETE",
"request",
"success",
"message",
"dict",
")",
"expect",
"(",
"200",
"{",
"success",
":",
"true",
"}",
")",
"for",
"succe... | train | https://github.com/mehmetg/streak_client/blob/46575510b4e4163a4a3cc06f7283a1ae377cdce6/streak_client/streak_client.py#L206-L220 |
mehmetg/streak_client | streak_client/streak_client.py | StreakClient.delete_all_pipelines | def delete_all_pipelines(self):
'''Deletes all pipelines
Args:
returns OK for overall success or last error code, resp data.
'''
code, data = self.get_pipeline()
if code == requests.codes.ok:
for pl_data in data:
c, d = self.delete_pipeline(pl_data['pipelineKey'])
if c != requests.codes.ok:
... | python | def delete_all_pipelines(self):
'''Deletes all pipelines
Args:
returns OK for overall success or last error code, resp data.
'''
code, data = self.get_pipeline()
if code == requests.codes.ok:
for pl_data in data:
c, d = self.delete_pipeline(pl_data['pipelineKey'])
if c != requests.codes.ok:
... | [
"def",
"delete_all_pipelines",
"(",
"self",
")",
":",
"code",
",",
"data",
"=",
"self",
".",
"get_pipeline",
"(",
")",
"if",
"code",
"==",
"requests",
".",
"codes",
".",
"ok",
":",
"for",
"pl_data",
"in",
"data",
":",
"c",
",",
"d",
"=",
"self",
".... | Deletes all pipelines
Args:
returns OK for overall success or last error code, resp data. | [
"Deletes",
"all",
"pipelines",
"Args",
":",
"returns",
"OK",
"for",
"overall",
"success",
"or",
"last",
"error",
"code",
"resp",
"data",
"."
] | train | https://github.com/mehmetg/streak_client/blob/46575510b4e4163a4a3cc06f7283a1ae377cdce6/streak_client/streak_client.py#L222-L234 |
mehmetg/streak_client | streak_client/streak_client.py | StreakClient.create_pipeline | def create_pipeline(self, name, description, **kwargs):
'''Creates a pipeline with the provided attributes.
Args:
name required name string
kwargs {name, description, orgWide, aclEntries} user
specifiable ones only
return (status code, pipeline_dict) (as created)
'''
#req sanity check
if not (nam... | python | def create_pipeline(self, name, description, **kwargs):
'''Creates a pipeline with the provided attributes.
Args:
name required name string
kwargs {name, description, orgWide, aclEntries} user
specifiable ones only
return (status code, pipeline_dict) (as created)
'''
#req sanity check
if not (nam... | [
"def",
"create_pipeline",
"(",
"self",
",",
"name",
",",
"description",
",",
"*",
"*",
"kwargs",
")",
":",
"#req sanity check",
"if",
"not",
"(",
"name",
"and",
"description",
")",
":",
"return",
"requests",
".",
"codes",
".",
"bad_request",
",",
"None",
... | Creates a pipeline with the provided attributes.
Args:
name required name string
kwargs {name, description, orgWide, aclEntries} user
specifiable ones only
return (status code, pipeline_dict) (as created) | [
"Creates",
"a",
"pipeline",
"with",
"the",
"provided",
"attributes",
".",
"Args",
":",
"name",
"required",
"name",
"string",
"kwargs",
"{",
"name",
"description",
"orgWide",
"aclEntries",
"}",
"user",
"specifiable",
"ones",
"only",
"return",
"(",
"status",
"co... | train | https://github.com/mehmetg/streak_client/blob/46575510b4e4163a4a3cc06f7283a1ae377cdce6/streak_client/streak_client.py#L236-L257 |
mehmetg/streak_client | streak_client/streak_client.py | StreakClient.update_pipeline | def update_pipeline(self, pipeline):
'''Updates a pipeline with the provided attributes.
Args:
key required identifier for the pipeline
pipeline StreakPipeline object
return (status code, pipeline_dict)
'''
#req sanity check
payload = None
if type(pipeline) is not StreakPipeline:
return requ... | python | def update_pipeline(self, pipeline):
'''Updates a pipeline with the provided attributes.
Args:
key required identifier for the pipeline
pipeline StreakPipeline object
return (status code, pipeline_dict)
'''
#req sanity check
payload = None
if type(pipeline) is not StreakPipeline:
return requ... | [
"def",
"update_pipeline",
"(",
"self",
",",
"pipeline",
")",
":",
"#req sanity check",
"payload",
"=",
"None",
"if",
"type",
"(",
"pipeline",
")",
"is",
"not",
"StreakPipeline",
":",
"return",
"requests",
".",
"codes",
".",
"bad_request",
",",
"None",
"paylo... | Updates a pipeline with the provided attributes.
Args:
key required identifier for the pipeline
pipeline StreakPipeline object
return (status code, pipeline_dict) | [
"Updates",
"a",
"pipeline",
"with",
"the",
"provided",
"attributes",
".",
"Args",
":",
"key",
"required",
"identifier",
"for",
"the",
"pipeline",
"pipeline",
"StreakPipeline",
"object",
"return",
"(",
"status",
"code",
"pipeline_dict",
")"
] | train | https://github.com/mehmetg/streak_client/blob/46575510b4e4163a4a3cc06f7283a1ae377cdce6/streak_client/streak_client.py#L259-L284 |
mehmetg/streak_client | streak_client/streak_client.py | StreakClient.get_box | def get_box(self, box_key = None, sort_by = None):
'''Gets a list of one/all box objects. Performs a single GET.
To go deeper individual boxes need to be polled for their contents.
This is a directory for what we could ask for.
Args:
box_key key for the target box (default: None i.e. ALL)
sort_by in des... | python | def get_box(self, box_key = None, sort_by = None):
'''Gets a list of one/all box objects. Performs a single GET.
To go deeper individual boxes need to be polled for their contents.
This is a directory for what we could ask for.
Args:
box_key key for the target box (default: None i.e. ALL)
sort_by in des... | [
"def",
"get_box",
"(",
"self",
",",
"box_key",
"=",
"None",
",",
"sort_by",
"=",
"None",
")",
":",
"uri",
"=",
"'/'",
".",
"join",
"(",
"[",
"self",
".",
"api_uri",
",",
"self",
".",
"boxes_suffix",
"]",
")",
"if",
"box_key",
":",
"uri",
"=",
"'/... | Gets a list of one/all box objects. Performs a single GET.
To go deeper individual boxes need to be polled for their contents.
This is a directory for what we could ask for.
Args:
box_key key for the target box (default: None i.e. ALL)
sort_by in desc order by 'creationTimestamp' or 'lastUpdatedTimestamp'... | [
"Gets",
"a",
"list",
"of",
"one",
"/",
"all",
"box",
"objects",
".",
"Performs",
"a",
"single",
"GET",
".",
"To",
"go",
"deeper",
"individual",
"boxes",
"need",
"to",
"be",
"polled",
"for",
"their",
"contents",
".",
"This",
"is",
"a",
"directory",
"for... | train | https://github.com/mehmetg/streak_client/blob/46575510b4e4163a4a3cc06f7283a1ae377cdce6/streak_client/streak_client.py#L288-L312 |
mehmetg/streak_client | streak_client/streak_client.py | StreakClient.get_pipeline_boxes | def get_pipeline_boxes(self, pipeline_key, sort_by = None):
'''Gets a list of all box objects in a pipeline. Performs a single GET.
Args:
pipeline_key key for pipeline
sort_by in desc order by 'creationTimestamp' or 'lastUpdatedTimestamp'
Not sure if it is supported
returns (status code for the ... | python | def get_pipeline_boxes(self, pipeline_key, sort_by = None):
'''Gets a list of all box objects in a pipeline. Performs a single GET.
Args:
pipeline_key key for pipeline
sort_by in desc order by 'creationTimestamp' or 'lastUpdatedTimestamp'
Not sure if it is supported
returns (status code for the ... | [
"def",
"get_pipeline_boxes",
"(",
"self",
",",
"pipeline_key",
",",
"sort_by",
"=",
"None",
")",
":",
"if",
"not",
"pipeline_key",
":",
"return",
"requests",
".",
"codes",
".",
"bad_request",
",",
"None",
"uri",
"=",
"'/'",
".",
"join",
"(",
"[",
"self",... | Gets a list of all box objects in a pipeline. Performs a single GET.
Args:
pipeline_key key for pipeline
sort_by in desc order by 'creationTimestamp' or 'lastUpdatedTimestamp'
Not sure if it is supported
returns (status code for the GET request, dict of boxes) | [
"Gets",
"a",
"list",
"of",
"all",
"box",
"objects",
"in",
"a",
"pipeline",
".",
"Performs",
"a",
"single",
"GET",
".",
"Args",
":",
"pipeline_key",
"key",
"for",
"pipeline",
"sort_by",
"in",
"desc",
"order",
"by",
"creationTimestamp",
"or",
"lastUpdatedTimes... | train | https://github.com/mehmetg/streak_client/blob/46575510b4e4163a4a3cc06f7283a1ae377cdce6/streak_client/streak_client.py#L314-L338 |
mehmetg/streak_client | streak_client/streak_client.py | StreakClient.delete_box | def delete_box(self, key):
'''Deletes the box specified by the key
Args:
returns (status code for the DELETE request, success message dict)
'''
if key:
uri = self.box_root_uri + '/' + key
return self._req('delete', uri)
else:
return requests.codes.bad_request, None | python | def delete_box(self, key):
'''Deletes the box specified by the key
Args:
returns (status code for the DELETE request, success message dict)
'''
if key:
uri = self.box_root_uri + '/' + key
return self._req('delete', uri)
else:
return requests.codes.bad_request, None | [
"def",
"delete_box",
"(",
"self",
",",
"key",
")",
":",
"if",
"key",
":",
"uri",
"=",
"self",
".",
"box_root_uri",
"+",
"'/'",
"+",
"key",
"return",
"self",
".",
"_req",
"(",
"'delete'",
",",
"uri",
")",
"else",
":",
"return",
"requests",
".",
"cod... | Deletes the box specified by the key
Args:
returns (status code for the DELETE request, success message dict) | [
"Deletes",
"the",
"box",
"specified",
"by",
"the",
"key",
"Args",
":",
"returns",
"(",
"status",
"code",
"for",
"the",
"DELETE",
"request",
"success",
"message",
"dict",
")"
] | train | https://github.com/mehmetg/streak_client/blob/46575510b4e4163a4a3cc06f7283a1ae377cdce6/streak_client/streak_client.py#L340-L349 |
mehmetg/streak_client | streak_client/streak_client.py | StreakClient.create_pipeline_box | def create_pipeline_box(self, pipeline_key, name, **kwargs):
'''Creates a box int the pipeline specified with the provided attributes.
Args:
name required name string
kwargs {...} see StreakBox object for details
return (status code, box dict)
'''
#req sanity check
if not (pipeline_key and name):
... | python | def create_pipeline_box(self, pipeline_key, name, **kwargs):
'''Creates a box int the pipeline specified with the provided attributes.
Args:
name required name string
kwargs {...} see StreakBox object for details
return (status code, box dict)
'''
#req sanity check
if not (pipeline_key and name):
... | [
"def",
"create_pipeline_box",
"(",
"self",
",",
"pipeline_key",
",",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"#req sanity check",
"if",
"not",
"(",
"pipeline_key",
"and",
"name",
")",
":",
"return",
"requests",
".",
"codes",
".",
"bad_request",
",",
"No... | Creates a box int the pipeline specified with the provided attributes.
Args:
name required name string
kwargs {...} see StreakBox object for details
return (status code, box dict) | [
"Creates",
"a",
"box",
"int",
"the",
"pipeline",
"specified",
"with",
"the",
"provided",
"attributes",
".",
"Args",
":",
"name",
"required",
"name",
"string",
"kwargs",
"{",
"...",
"}",
"see",
"StreakBox",
"object",
"for",
"details",
"return",
"(",
"status",... | train | https://github.com/mehmetg/streak_client/blob/46575510b4e4163a4a3cc06f7283a1ae377cdce6/streak_client/streak_client.py#L351-L375 |
mehmetg/streak_client | streak_client/streak_client.py | StreakClient.update_box | def update_box(self, box):
'''Updates a box with the provided attributes.
Args:
box StreakBox object with updated info
return (status code, box in dict form)
'''
#req sanity check
payload = None
if type(box) is not StreakBox:
return requests.codes.bad_request, None
payload = box.to_dict(rw = T... | python | def update_box(self, box):
'''Updates a box with the provided attributes.
Args:
box StreakBox object with updated info
return (status code, box in dict form)
'''
#req sanity check
payload = None
if type(box) is not StreakBox:
return requests.codes.bad_request, None
payload = box.to_dict(rw = T... | [
"def",
"update_box",
"(",
"self",
",",
"box",
")",
":",
"#req sanity check",
"payload",
"=",
"None",
"if",
"type",
"(",
"box",
")",
"is",
"not",
"StreakBox",
":",
"return",
"requests",
".",
"codes",
".",
"bad_request",
",",
"None",
"payload",
"=",
"box",... | Updates a box with the provided attributes.
Args:
box StreakBox object with updated info
return (status code, box in dict form) | [
"Updates",
"a",
"box",
"with",
"the",
"provided",
"attributes",
".",
"Args",
":",
"box",
"StreakBox",
"object",
"with",
"updated",
"info",
"return",
"(",
"status",
"code",
"box",
"in",
"dict",
"form",
")"
] | train | https://github.com/mehmetg/streak_client/blob/46575510b4e4163a4a3cc06f7283a1ae377cdce6/streak_client/streak_client.py#L377-L397 |
mehmetg/streak_client | streak_client/streak_client.py | StreakClient.search | def search(self, kw):
'''Takes a keyword and returns the search results.
Works for boxes only?
Args:
kw keyword (str) to search for.
return (code, list(dicts))
'''
if not kw:
return requests.codes.bad_request, None
code, data = self._req('get', self.search_uri + kw)
return code, data | python | def search(self, kw):
'''Takes a keyword and returns the search results.
Works for boxes only?
Args:
kw keyword (str) to search for.
return (code, list(dicts))
'''
if not kw:
return requests.codes.bad_request, None
code, data = self._req('get', self.search_uri + kw)
return code, data | [
"def",
"search",
"(",
"self",
",",
"kw",
")",
":",
"if",
"not",
"kw",
":",
"return",
"requests",
".",
"codes",
".",
"bad_request",
",",
"None",
"code",
",",
"data",
"=",
"self",
".",
"_req",
"(",
"'get'",
",",
"self",
".",
"search_uri",
"+",
"kw",
... | Takes a keyword and returns the search results.
Works for boxes only?
Args:
kw keyword (str) to search for.
return (code, list(dicts)) | [
"Takes",
"a",
"keyword",
"and",
"returns",
"the",
"search",
"results",
".",
"Works",
"for",
"boxes",
"only?",
"Args",
":",
"kw",
"keyword",
"(",
"str",
")",
"to",
"search",
"for",
".",
"return",
"(",
"code",
"list",
"(",
"dicts",
"))"
] | train | https://github.com/mehmetg/streak_client/blob/46575510b4e4163a4a3cc06f7283a1ae377cdce6/streak_client/streak_client.py#L401-L413 |
mehmetg/streak_client | streak_client/streak_client.py | StreakClient.get_snippet | def get_snippet(self, snippet_key = None):
'''Get all/one specific snippet by its key
Args:
key snippet key (default: None i.e. ALL)
return (status code, snippet dict or list thereof)
'''
uri = '/'.join([
self.api_uri,
self.snippets_suffix
])
if snippet_key:
uri = '/'.join([
... | python | def get_snippet(self, snippet_key = None):
'''Get all/one specific snippet by its key
Args:
key snippet key (default: None i.e. ALL)
return (status code, snippet dict or list thereof)
'''
uri = '/'.join([
self.api_uri,
self.snippets_suffix
])
if snippet_key:
uri = '/'.join([
... | [
"def",
"get_snippet",
"(",
"self",
",",
"snippet_key",
"=",
"None",
")",
":",
"uri",
"=",
"'/'",
".",
"join",
"(",
"[",
"self",
".",
"api_uri",
",",
"self",
".",
"snippets_suffix",
"]",
")",
"if",
"snippet_key",
":",
"uri",
"=",
"'/'",
".",
"join",
... | Get all/one specific snippet by its key
Args:
key snippet key (default: None i.e. ALL)
return (status code, snippet dict or list thereof) | [
"Get",
"all",
"/",
"one",
"specific",
"snippet",
"by",
"its",
"key",
"Args",
":",
"key",
"snippet",
"key",
"(",
"default",
":",
"None",
"i",
".",
"e",
".",
"ALL",
")",
"return",
"(",
"status",
"code",
"snippet",
"dict",
"or",
"list",
"thereof",
")"
] | train | https://github.com/mehmetg/streak_client/blob/46575510b4e4163a4a3cc06f7283a1ae377cdce6/streak_client/streak_client.py#L417-L435 |
mehmetg/streak_client | streak_client/streak_client.py | StreakClient.get_pipeline_stage | def get_pipeline_stage(self, pipeline_key, stage_key = None, sort_by = None):
'''Gets a list of one/all stage objects in a pipeline. Performs a single GET.
Args:
pipeline_key key for pipeline
stage_key key for stage (default: None i.e. ALL)
sort_by in desc order by 'creationTimestamp' or 'lastUpdatedTi... | python | def get_pipeline_stage(self, pipeline_key, stage_key = None, sort_by = None):
'''Gets a list of one/all stage objects in a pipeline. Performs a single GET.
Args:
pipeline_key key for pipeline
stage_key key for stage (default: None i.e. ALL)
sort_by in desc order by 'creationTimestamp' or 'lastUpdatedTi... | [
"def",
"get_pipeline_stage",
"(",
"self",
",",
"pipeline_key",
",",
"stage_key",
"=",
"None",
",",
"sort_by",
"=",
"None",
")",
":",
"if",
"not",
"pipeline_key",
":",
"return",
"requests",
".",
"codes",
".",
"bad_request",
",",
"None",
"uri",
"=",
"'/'",
... | Gets a list of one/all stage objects in a pipeline. Performs a single GET.
Args:
pipeline_key key for pipeline
stage_key key for stage (default: None i.e. ALL)
sort_by in desc order by 'creationTimestamp' or 'lastUpdatedTimestamp'
may or may not be supported
returns (status code for the GET r... | [
"Gets",
"a",
"list",
"of",
"one",
"/",
"all",
"stage",
"objects",
"in",
"a",
"pipeline",
".",
"Performs",
"a",
"single",
"GET",
".",
"Args",
":",
"pipeline_key",
"key",
"for",
"pipeline",
"stage_key",
"key",
"for",
"stage",
"(",
"default",
":",
"None",
... | train | https://github.com/mehmetg/streak_client/blob/46575510b4e4163a4a3cc06f7283a1ae377cdce6/streak_client/streak_client.py#L439-L477 |
mehmetg/streak_client | streak_client/streak_client.py | StreakClient.create_pipeline_stage | def create_pipeline_stage(self, pipeline_key, name, **kwargs):
'''Creates a pipeline stage with the provided attributes.
Args:
name required name string
kwargs {..} see StreakStage object for details
return (status code, stage dict)
'''
#req sanity check
if not (pipeline_key and name):
return requ... | python | def create_pipeline_stage(self, pipeline_key, name, **kwargs):
'''Creates a pipeline stage with the provided attributes.
Args:
name required name string
kwargs {..} see StreakStage object for details
return (status code, stage dict)
'''
#req sanity check
if not (pipeline_key and name):
return requ... | [
"def",
"create_pipeline_stage",
"(",
"self",
",",
"pipeline_key",
",",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"#req sanity check",
"if",
"not",
"(",
"pipeline_key",
"and",
"name",
")",
":",
"return",
"requests",
".",
"codes",
".",
"bad_request",
",",
"... | Creates a pipeline stage with the provided attributes.
Args:
name required name string
kwargs {..} see StreakStage object for details
return (status code, stage dict) | [
"Creates",
"a",
"pipeline",
"stage",
"with",
"the",
"provided",
"attributes",
".",
"Args",
":",
"name",
"required",
"name",
"string",
"kwargs",
"{",
"..",
"}",
"see",
"StreakStage",
"object",
"for",
"details",
"return",
"(",
"status",
"code",
"stage",
"dict"... | train | https://github.com/mehmetg/streak_client/blob/46575510b4e4163a4a3cc06f7283a1ae377cdce6/streak_client/streak_client.py#L479-L502 |
mehmetg/streak_client | streak_client/streak_client.py | StreakClient.delete_pipeline_stage | def delete_pipeline_stage(self, pipeline_key, stage_key, sort_by = None):
'''Deletes a stage in the pipeline by stage key and pipeline key
Args:
pipeline_key key for pipeline
stage_key key for stage
sort_by in desc order by 'creationTimestamp' or 'lastUpdatedTimestamp'
returns (status code for the ... | python | def delete_pipeline_stage(self, pipeline_key, stage_key, sort_by = None):
'''Deletes a stage in the pipeline by stage key and pipeline key
Args:
pipeline_key key for pipeline
stage_key key for stage
sort_by in desc order by 'creationTimestamp' or 'lastUpdatedTimestamp'
returns (status code for the ... | [
"def",
"delete_pipeline_stage",
"(",
"self",
",",
"pipeline_key",
",",
"stage_key",
",",
"sort_by",
"=",
"None",
")",
":",
"if",
"not",
"(",
"pipeline_key",
"and",
"stage_key",
")",
":",
"return",
"requests",
".",
"codes",
".",
"bad_request",
",",
"None",
... | Deletes a stage in the pipeline by stage key and pipeline key
Args:
pipeline_key key for pipeline
stage_key key for stage
sort_by in desc order by 'creationTimestamp' or 'lastUpdatedTimestamp'
returns (status code for the GET request, dict of op report) | [
"Deletes",
"a",
"stage",
"in",
"the",
"pipeline",
"by",
"stage",
"key",
"and",
"pipeline",
"key",
"Args",
":",
"pipeline_key",
"key",
"for",
"pipeline",
"stage_key",
"key",
"for",
"stage",
"sort_by",
"in",
"desc",
"order",
"by",
"creationTimestamp",
"or",
"l... | train | https://github.com/mehmetg/streak_client/blob/46575510b4e4163a4a3cc06f7283a1ae377cdce6/streak_client/streak_client.py#L504-L525 |
mehmetg/streak_client | streak_client/streak_client.py | StreakClient.update_pipeline_stage | def update_pipeline_stage(self, stage):
'''Updates a box with the provided attributes.
Args:
pipeline_key reqiured identifier for the pipeline
stage StreakStage object
kwargs {name}
return (status code, stage dict)
'''
#req sanity check
payload = None
if type(stage) is not StreakStage:
... | python | def update_pipeline_stage(self, stage):
'''Updates a box with the provided attributes.
Args:
pipeline_key reqiured identifier for the pipeline
stage StreakStage object
kwargs {name}
return (status code, stage dict)
'''
#req sanity check
payload = None
if type(stage) is not StreakStage:
... | [
"def",
"update_pipeline_stage",
"(",
"self",
",",
"stage",
")",
":",
"#req sanity check",
"payload",
"=",
"None",
"if",
"type",
"(",
"stage",
")",
"is",
"not",
"StreakStage",
":",
"return",
"requests",
".",
"codes",
".",
"bad_request",
",",
"None",
"payload"... | Updates a box with the provided attributes.
Args:
pipeline_key reqiured identifier for the pipeline
stage StreakStage object
kwargs {name}
return (status code, stage dict) | [
"Updates",
"a",
"box",
"with",
"the",
"provided",
"attributes",
".",
"Args",
":",
"pipeline_key",
"reqiured",
"identifier",
"for",
"the",
"pipeline",
"stage",
"StreakStage",
"object",
"kwargs",
"{",
"name",
"}",
"return",
"(",
"status",
"code",
"stage",
"dict"... | train | https://github.com/mehmetg/streak_client/blob/46575510b4e4163a4a3cc06f7283a1ae377cdce6/streak_client/streak_client.py#L527-L557 |
mehmetg/streak_client | streak_client/streak_client.py | StreakClient._create_field | def _create_field(self, uri , name, field_type, **kwargs):
'''Creates a field with the provided attributes.
Args:
uri base uri for the field (pipeline or box uri)
name required name string
field_type required type string [TEXT_INPUT, DATE or PERSON]
kwargs {}
return (status code, field dict)
'''
... | python | def _create_field(self, uri , name, field_type, **kwargs):
'''Creates a field with the provided attributes.
Args:
uri base uri for the field (pipeline or box uri)
name required name string
field_type required type string [TEXT_INPUT, DATE or PERSON]
kwargs {}
return (status code, field dict)
'''
... | [
"def",
"_create_field",
"(",
"self",
",",
"uri",
",",
"name",
",",
"field_type",
",",
"*",
"*",
"kwargs",
")",
":",
"#req sanity check",
"if",
"not",
"(",
"name",
"and",
"(",
"field_type",
"in",
"[",
"'TEXT_INPUT'",
",",
"'DATE'",
",",
"'PERSON'",
"]",
... | Creates a field with the provided attributes.
Args:
uri base uri for the field (pipeline or box uri)
name required name string
field_type required type string [TEXT_INPUT, DATE or PERSON]
kwargs {}
return (status code, field dict) | [
"Creates",
"a",
"field",
"with",
"the",
"provided",
"attributes",
".",
"Args",
":",
"uri",
"base",
"uri",
"for",
"the",
"field",
"(",
"pipeline",
"or",
"box",
"uri",
")",
"name",
"required",
"name",
"string",
"field_type",
"required",
"type",
"string",
"["... | train | https://github.com/mehmetg/streak_client/blob/46575510b4e4163a4a3cc06f7283a1ae377cdce6/streak_client/streak_client.py#L561-L583 |
mehmetg/streak_client | streak_client/streak_client.py | StreakClient._update_field | def _update_field(self, uri, field):
'''Updates a field with the provided attributes.
Args:
key reqiured identifier for the pipeline or box
field StreakField object
kwargs {name, type} see StreakField for details
return (status code, field dict)
'''
#req sanity check
payload = None
if typ... | python | def _update_field(self, uri, field):
'''Updates a field with the provided attributes.
Args:
key reqiured identifier for the pipeline or box
field StreakField object
kwargs {name, type} see StreakField for details
return (status code, field dict)
'''
#req sanity check
payload = None
if typ... | [
"def",
"_update_field",
"(",
"self",
",",
"uri",
",",
"field",
")",
":",
"#req sanity check",
"payload",
"=",
"None",
"if",
"type",
"(",
"field",
")",
"is",
"not",
"StreakField",
":",
"return",
"requests",
".",
"codes",
".",
"bad_request",
",",
"None",
"... | Updates a field with the provided attributes.
Args:
key reqiured identifier for the pipeline or box
field StreakField object
kwargs {name, type} see StreakField for details
return (status code, field dict) | [
"Updates",
"a",
"field",
"with",
"the",
"provided",
"attributes",
".",
"Args",
":",
"key",
"reqiured",
"identifier",
"for",
"the",
"pipeline",
"or",
"box",
"field",
"StreakField",
"object",
"kwargs",
"{",
"name",
"type",
"}",
"see",
"StreakField",
"for",
"de... | train | https://github.com/mehmetg/streak_client/blob/46575510b4e4163a4a3cc06f7283a1ae377cdce6/streak_client/streak_client.py#L585-L613 |
mehmetg/streak_client | streak_client/streak_client.py | StreakClient.get_pipeline_field | def get_pipeline_field(self, pipeline_key, field_key = None):
'''Gets one/all field in a pipeline
Args:
pipeline_key key for pipeline
field_key key for field (default: None i.e. ALL)
returns status code, field dict or list thereof
'''
uri = '/'.join([
self.api_uri,
self.pipelines_s... | python | def get_pipeline_field(self, pipeline_key, field_key = None):
'''Gets one/all field in a pipeline
Args:
pipeline_key key for pipeline
field_key key for field (default: None i.e. ALL)
returns status code, field dict or list thereof
'''
uri = '/'.join([
self.api_uri,
self.pipelines_s... | [
"def",
"get_pipeline_field",
"(",
"self",
",",
"pipeline_key",
",",
"field_key",
"=",
"None",
")",
":",
"uri",
"=",
"'/'",
".",
"join",
"(",
"[",
"self",
".",
"api_uri",
",",
"self",
".",
"pipelines_suffix",
",",
"pipeline_key",
",",
"self",
".",
"fields... | Gets one/all field in a pipeline
Args:
pipeline_key key for pipeline
field_key key for field (default: None i.e. ALL)
returns status code, field dict or list thereof | [
"Gets",
"one",
"/",
"all",
"field",
"in",
"a",
"pipeline",
"Args",
":",
"pipeline_key",
"key",
"for",
"pipeline",
"field_key",
"key",
"for",
"field",
"(",
"default",
":",
"None",
"i",
".",
"e",
".",
"ALL",
")",
"returns",
"status",
"code",
"field",
"di... | train | https://github.com/mehmetg/streak_client/blob/46575510b4e4163a4a3cc06f7283a1ae377cdce6/streak_client/streak_client.py#L615-L631 |
mehmetg/streak_client | streak_client/streak_client.py | StreakClient.create_pipeline_field | def create_pipeline_field(self, pipeline_key, name, field_type, **kwargs):
'''Creates a pipeline field with the provided attributes.
Args:
pipeline_key specifying the pipeline to add the field to
name required name string
field_type required type string [TEXT_INPUT, DATE or PERSON]
kwargs {}
ret... | python | def create_pipeline_field(self, pipeline_key, name, field_type, **kwargs):
'''Creates a pipeline field with the provided attributes.
Args:
pipeline_key specifying the pipeline to add the field to
name required name string
field_type required type string [TEXT_INPUT, DATE or PERSON]
kwargs {}
ret... | [
"def",
"create_pipeline_field",
"(",
"self",
",",
"pipeline_key",
",",
"name",
",",
"field_type",
",",
"*",
"*",
"kwargs",
")",
":",
"uri",
"=",
"'/'",
".",
"join",
"(",
"[",
"self",
".",
"api_uri",
",",
"self",
".",
"pipelines_suffix",
",",
"pipeline_ke... | Creates a pipeline field with the provided attributes.
Args:
pipeline_key specifying the pipeline to add the field to
name required name string
field_type required type string [TEXT_INPUT, DATE or PERSON]
kwargs {}
return (status code, field dict) | [
"Creates",
"a",
"pipeline",
"field",
"with",
"the",
"provided",
"attributes",
".",
"Args",
":",
"pipeline_key",
"specifying",
"the",
"pipeline",
"to",
"add",
"the",
"field",
"to",
"name",
"required",
"name",
"string",
"field_type",
"required",
"type",
"string",
... | train | https://github.com/mehmetg/streak_client/blob/46575510b4e4163a4a3cc06f7283a1ae377cdce6/streak_client/streak_client.py#L633-L651 |
mehmetg/streak_client | streak_client/streak_client.py | StreakClient.update_pipeline_field | def update_pipeline_field(self, pipeline_key, field):
'''Upates pipeline field as specified
Args:
pipeline_key key for pipeline where the fields lives
field StreakField object with fresh data
returns (status code, updated field dict)
'''
uri = '/'.join([
self.api_uri,
self.pipelines... | python | def update_pipeline_field(self, pipeline_key, field):
'''Upates pipeline field as specified
Args:
pipeline_key key for pipeline where the fields lives
field StreakField object with fresh data
returns (status code, updated field dict)
'''
uri = '/'.join([
self.api_uri,
self.pipelines... | [
"def",
"update_pipeline_field",
"(",
"self",
",",
"pipeline_key",
",",
"field",
")",
":",
"uri",
"=",
"'/'",
".",
"join",
"(",
"[",
"self",
".",
"api_uri",
",",
"self",
".",
"pipelines_suffix",
",",
"pipeline_key",
",",
"self",
".",
"fields_suffix",
"]",
... | Upates pipeline field as specified
Args:
pipeline_key key for pipeline where the fields lives
field StreakField object with fresh data
returns (status code, updated field dict) | [
"Upates",
"pipeline",
"field",
"as",
"specified",
"Args",
":",
"pipeline_key",
"key",
"for",
"pipeline",
"where",
"the",
"fields",
"lives",
"field",
"StreakField",
"object",
"with",
"fresh",
"data",
"returns",
"(",
"status",
"code",
"updated",
"field",
"dict",
... | train | https://github.com/mehmetg/streak_client/blob/46575510b4e4163a4a3cc06f7283a1ae377cdce6/streak_client/streak_client.py#L653-L666 |
mehmetg/streak_client | streak_client/streak_client.py | StreakClient.get_box_field | def get_box_field(self, box_key, field_key = None):
'''Gets one/all field in a box
Args:
box_key key for pipeline
field_key key for field (default: None i.e. ALL)
returns status code, field dict or list thereof
'''
#does not work
self._raise_unimplemented_error()
uri = '/'.join([self.api... | python | def get_box_field(self, box_key, field_key = None):
'''Gets one/all field in a box
Args:
box_key key for pipeline
field_key key for field (default: None i.e. ALL)
returns status code, field dict or list thereof
'''
#does not work
self._raise_unimplemented_error()
uri = '/'.join([self.api... | [
"def",
"get_box_field",
"(",
"self",
",",
"box_key",
",",
"field_key",
"=",
"None",
")",
":",
"#does not work",
"self",
".",
"_raise_unimplemented_error",
"(",
")",
"uri",
"=",
"'/'",
".",
"join",
"(",
"[",
"self",
".",
"api_uri",
",",
"self",
".",
"boxe... | Gets one/all field in a box
Args:
box_key key for pipeline
field_key key for field (default: None i.e. ALL)
returns status code, field dict or list thereof | [
"Gets",
"one",
"/",
"all",
"field",
"in",
"a",
"box",
"Args",
":",
"box_key",
"key",
"for",
"pipeline",
"field_key",
"key",
"for",
"field",
"(",
"default",
":",
"None",
"i",
".",
"e",
".",
"ALL",
")",
"returns",
"status",
"code",
"field",
"dict",
"or... | train | https://github.com/mehmetg/streak_client/blob/46575510b4e4163a4a3cc06f7283a1ae377cdce6/streak_client/streak_client.py#L685-L703 |
mehmetg/streak_client | streak_client/streak_client.py | StreakClient.create_box_field | def create_box_field(self, box_key, name, field_type, **kwargs):
'''Creates a box field with the provided attributes.
Args:
box_key specifying the box to add the field to
name required name string
field_type required type string [TEXT_INPUT, DATE or PERSON]
kwargs {}
return (status code, fie... | python | def create_box_field(self, box_key, name, field_type, **kwargs):
'''Creates a box field with the provided attributes.
Args:
box_key specifying the box to add the field to
name required name string
field_type required type string [TEXT_INPUT, DATE or PERSON]
kwargs {}
return (status code, fie... | [
"def",
"create_box_field",
"(",
"self",
",",
"box_key",
",",
"name",
",",
"field_type",
",",
"*",
"*",
"kwargs",
")",
":",
"#does not work",
"self",
".",
"_raise_unimplemented_error",
"(",
")",
"uri",
"=",
"'/'",
".",
"join",
"(",
"[",
"self",
".",
"api_... | Creates a box field with the provided attributes.
Args:
box_key specifying the box to add the field to
name required name string
field_type required type string [TEXT_INPUT, DATE or PERSON]
kwargs {}
return (status code, field dict) | [
"Creates",
"a",
"box",
"field",
"with",
"the",
"provided",
"attributes",
".",
"Args",
":",
"box_key",
"specifying",
"the",
"box",
"to",
"add",
"the",
"field",
"to",
"name",
"required",
"name",
"string",
"field_type",
"required",
"type",
"string",
"[",
"TEXT_... | train | https://github.com/mehmetg/streak_client/blob/46575510b4e4163a4a3cc06f7283a1ae377cdce6/streak_client/streak_client.py#L705-L725 |
mehmetg/streak_client | streak_client/streak_client.py | StreakClient.update_box_field | def update_box_field(self, box_key, field):
'''Upates box field as specified
Args:
box_key key for pipeline where the fields lives
field StreakField object with fresh data
returns (status code, updated field dict)
'''
#does not work
self._raise_unimplemented_error()
uri = '/'.join([self.... | python | def update_box_field(self, box_key, field):
'''Upates box field as specified
Args:
box_key key for pipeline where the fields lives
field StreakField object with fresh data
returns (status code, updated field dict)
'''
#does not work
self._raise_unimplemented_error()
uri = '/'.join([self.... | [
"def",
"update_box_field",
"(",
"self",
",",
"box_key",
",",
"field",
")",
":",
"#does not work",
"self",
".",
"_raise_unimplemented_error",
"(",
")",
"uri",
"=",
"'/'",
".",
"join",
"(",
"[",
"self",
".",
"api_uri",
",",
"self",
".",
"boxes_suffix",
",",
... | Upates box field as specified
Args:
box_key key for pipeline where the fields lives
field StreakField object with fresh data
returns (status code, updated field dict) | [
"Upates",
"box",
"field",
"as",
"specified",
"Args",
":",
"box_key",
"key",
"for",
"pipeline",
"where",
"the",
"fields",
"lives",
"field",
"StreakField",
"object",
"with",
"fresh",
"data",
"returns",
"(",
"status",
"code",
"updated",
"field",
"dict",
")"
] | train | https://github.com/mehmetg/streak_client/blob/46575510b4e4163a4a3cc06f7283a1ae377cdce6/streak_client/streak_client.py#L727-L742 |
mehmetg/streak_client | streak_client/streak_client.py | StreakClient._get_newsfeeds | def _get_newsfeeds(self, uri, detail_level = None):
'''General purpose function to get newsfeeds
Args:
uri uri for the feed base
detail_level arguments for req str ['ALL', 'CONDENSED']
return list of feed dicts parse at your convenience
'''
if detail_level:
if detail_level not in ['ALL', 'CON... | python | def _get_newsfeeds(self, uri, detail_level = None):
'''General purpose function to get newsfeeds
Args:
uri uri for the feed base
detail_level arguments for req str ['ALL', 'CONDENSED']
return list of feed dicts parse at your convenience
'''
if detail_level:
if detail_level not in ['ALL', 'CON... | [
"def",
"_get_newsfeeds",
"(",
"self",
",",
"uri",
",",
"detail_level",
"=",
"None",
")",
":",
"if",
"detail_level",
":",
"if",
"detail_level",
"not",
"in",
"[",
"'ALL'",
",",
"'CONDENSED'",
"]",
":",
"return",
"requests",
".",
"codes",
".",
"bad_request",
... | General purpose function to get newsfeeds
Args:
uri uri for the feed base
detail_level arguments for req str ['ALL', 'CONDENSED']
return list of feed dicts parse at your convenience | [
"General",
"purpose",
"function",
"to",
"get",
"newsfeeds",
"Args",
":",
"uri",
"uri",
"for",
"the",
"feed",
"base",
"detail_level",
"arguments",
"for",
"req",
"str",
"[",
"ALL",
"CONDENSED",
"]",
"return",
"list",
"of",
"feed",
"dicts",
"parse",
"at",
"yo... | train | https://github.com/mehmetg/streak_client/blob/46575510b4e4163a4a3cc06f7283a1ae377cdce6/streak_client/streak_client.py#L764-L776 |
mehmetg/streak_client | streak_client/streak_client.py | StreakClient.get_pipeline_newsfeeds | def get_pipeline_newsfeeds(self, pipeline_key, detail_level = None):
'''Function to get newsfeed for a pipeline
Args:
pipeline_key pipeline key
detail_level arguments for req str ['ALL', 'CONDENSED']
return list of feed dicts parse at your convenience
'''
uri = '/'.join([
self.api_uri,
... | python | def get_pipeline_newsfeeds(self, pipeline_key, detail_level = None):
'''Function to get newsfeed for a pipeline
Args:
pipeline_key pipeline key
detail_level arguments for req str ['ALL', 'CONDENSED']
return list of feed dicts parse at your convenience
'''
uri = '/'.join([
self.api_uri,
... | [
"def",
"get_pipeline_newsfeeds",
"(",
"self",
",",
"pipeline_key",
",",
"detail_level",
"=",
"None",
")",
":",
"uri",
"=",
"'/'",
".",
"join",
"(",
"[",
"self",
".",
"api_uri",
",",
"self",
".",
"pipelines_suffix",
",",
"pipeline_key",
",",
"self",
".",
... | Function to get newsfeed for a pipeline
Args:
pipeline_key pipeline key
detail_level arguments for req str ['ALL', 'CONDENSED']
return list of feed dicts parse at your convenience | [
"Function",
"to",
"get",
"newsfeed",
"for",
"a",
"pipeline",
"Args",
":",
"pipeline_key",
"pipeline",
"key",
"detail_level",
"arguments",
"for",
"req",
"str",
"[",
"ALL",
"CONDENSED",
"]",
"return",
"list",
"of",
"feed",
"dicts",
"parse",
"at",
"your",
"conv... | train | https://github.com/mehmetg/streak_client/blob/46575510b4e4163a4a3cc06f7283a1ae377cdce6/streak_client/streak_client.py#L778-L791 |
mehmetg/streak_client | streak_client/streak_client.py | StreakClient.get_box_newsfeeds | def get_box_newsfeeds(self, box_key, detail_level = None):
'''Function to get newsfeed for a pipeline
Args:
box pipeline key
detail_level arguments for req str ['ALL', 'CONDENSED']
return list of feed dicts parse at your convenience
'''
uri = '/'.join([
self.api_uri,
self.boxes_suffi... | python | def get_box_newsfeeds(self, box_key, detail_level = None):
'''Function to get newsfeed for a pipeline
Args:
box pipeline key
detail_level arguments for req str ['ALL', 'CONDENSED']
return list of feed dicts parse at your convenience
'''
uri = '/'.join([
self.api_uri,
self.boxes_suffi... | [
"def",
"get_box_newsfeeds",
"(",
"self",
",",
"box_key",
",",
"detail_level",
"=",
"None",
")",
":",
"uri",
"=",
"'/'",
".",
"join",
"(",
"[",
"self",
".",
"api_uri",
",",
"self",
".",
"boxes_suffix",
",",
"box_key",
",",
"self",
".",
"newsfeed_suffix",
... | Function to get newsfeed for a pipeline
Args:
box pipeline key
detail_level arguments for req str ['ALL', 'CONDENSED']
return list of feed dicts parse at your convenience | [
"Function",
"to",
"get",
"newsfeed",
"for",
"a",
"pipeline",
"Args",
":",
"box",
"pipeline",
"key",
"detail_level",
"arguments",
"for",
"req",
"str",
"[",
"ALL",
"CONDENSED",
"]",
"return",
"list",
"of",
"feed",
"dicts",
"parse",
"at",
"your",
"convenience"
... | train | https://github.com/mehmetg/streak_client/blob/46575510b4e4163a4a3cc06f7283a1ae377cdce6/streak_client/streak_client.py#L793-L806 |
mehmetg/streak_client | streak_client/streak_client.py | StreakClient.get_thread | def get_thread(self, thread_key):
'''Gets a thread specified by thread_key
Args:
thread_key thread to get
returns a thread dict
'''
uri = '/'.join([self.api_uri,
self.threads_suffix,
thread_key
])
return self._req('get', uri) | python | def get_thread(self, thread_key):
'''Gets a thread specified by thread_key
Args:
thread_key thread to get
returns a thread dict
'''
uri = '/'.join([self.api_uri,
self.threads_suffix,
thread_key
])
return self._req('get', uri) | [
"def",
"get_thread",
"(",
"self",
",",
"thread_key",
")",
":",
"uri",
"=",
"'/'",
".",
"join",
"(",
"[",
"self",
".",
"api_uri",
",",
"self",
".",
"threads_suffix",
",",
"thread_key",
"]",
")",
"return",
"self",
".",
"_req",
"(",
"'get'",
",",
"uri",... | Gets a thread specified by thread_key
Args:
thread_key thread to get
returns a thread dict | [
"Gets",
"a",
"thread",
"specified",
"by",
"thread_key",
"Args",
":",
"thread_key",
"thread",
"to",
"get",
"returns",
"a",
"thread",
"dict"
] | train | https://github.com/mehmetg/streak_client/blob/46575510b4e4163a4a3cc06f7283a1ae377cdce6/streak_client/streak_client.py#L810-L820 |
mehmetg/streak_client | streak_client/streak_client.py | StreakClient.get_box_threads | def get_box_threads(self, box_key):
'''Gets all threads in a specified box
Args:
box_key box to look in
returns a list of thread dicts
'''
uri = '/'.join([
self.api_uri,
self.boxes_suffix,
box_key,
self.threads_suffix
])
return self._req('get', uri) | python | def get_box_threads(self, box_key):
'''Gets all threads in a specified box
Args:
box_key box to look in
returns a list of thread dicts
'''
uri = '/'.join([
self.api_uri,
self.boxes_suffix,
box_key,
self.threads_suffix
])
return self._req('get', uri) | [
"def",
"get_box_threads",
"(",
"self",
",",
"box_key",
")",
":",
"uri",
"=",
"'/'",
".",
"join",
"(",
"[",
"self",
".",
"api_uri",
",",
"self",
".",
"boxes_suffix",
",",
"box_key",
",",
"self",
".",
"threads_suffix",
"]",
")",
"return",
"self",
".",
... | Gets all threads in a specified box
Args:
box_key box to look in
returns a list of thread dicts | [
"Gets",
"all",
"threads",
"in",
"a",
"specified",
"box",
"Args",
":",
"box_key",
"box",
"to",
"look",
"in",
"returns",
"a",
"list",
"of",
"thread",
"dicts"
] | train | https://github.com/mehmetg/streak_client/blob/46575510b4e4163a4a3cc06f7283a1ae377cdce6/streak_client/streak_client.py#L822-L834 |
mehmetg/streak_client | streak_client/streak_client.py | StreakClient.create_box_comments | def create_box_comments(self, box_key, message, **kwargs):
'''Creates a comments in a box with the provided attributes.
Args:
box_key key for box
message message string
kwargs {} see StreakComment object for more information
return (status code, comment dict)
'''
uri = '/'.join([
self.... | python | def create_box_comments(self, box_key, message, **kwargs):
'''Creates a comments in a box with the provided attributes.
Args:
box_key key for box
message message string
kwargs {} see StreakComment object for more information
return (status code, comment dict)
'''
uri = '/'.join([
self.... | [
"def",
"create_box_comments",
"(",
"self",
",",
"box_key",
",",
"message",
",",
"*",
"*",
"kwargs",
")",
":",
"uri",
"=",
"'/'",
".",
"join",
"(",
"[",
"self",
".",
"api_uri",
",",
"self",
".",
"boxes_suffix",
",",
"box_key",
",",
"self",
".",
"comme... | Creates a comments in a box with the provided attributes.
Args:
box_key key for box
message message string
kwargs {} see StreakComment object for more information
return (status code, comment dict) | [
"Creates",
"a",
"comments",
"in",
"a",
"box",
"with",
"the",
"provided",
"attributes",
".",
"Args",
":",
"box_key",
"key",
"for",
"box",
"message",
"message",
"string",
"kwargs",
"{}",
"see",
"StreakComment",
"object",
"for",
"more",
"information",
"return",
... | train | https://github.com/mehmetg/streak_client/blob/46575510b4e4163a4a3cc06f7283a1ae377cdce6/streak_client/streak_client.py#L838-L864 |
mehmetg/streak_client | streak_client/streak_client.py | StreakClient.get_box_comments | def get_box_comments(self, box_key):
'''Gets comments in a box with the provided attributes.
Args:
box_key key for box
return (status code, list of comment dicts)
'''
uri = '/'.join([
self.api_uri,
self.boxes_suffix,
box_key,
self.comments_suffix
])
return self._req('ge... | python | def get_box_comments(self, box_key):
'''Gets comments in a box with the provided attributes.
Args:
box_key key for box
return (status code, list of comment dicts)
'''
uri = '/'.join([
self.api_uri,
self.boxes_suffix,
box_key,
self.comments_suffix
])
return self._req('ge... | [
"def",
"get_box_comments",
"(",
"self",
",",
"box_key",
")",
":",
"uri",
"=",
"'/'",
".",
"join",
"(",
"[",
"self",
".",
"api_uri",
",",
"self",
".",
"boxes_suffix",
",",
"box_key",
",",
"self",
".",
"comments_suffix",
"]",
")",
"return",
"self",
".",
... | Gets comments in a box with the provided attributes.
Args:
box_key key for box
return (status code, list of comment dicts) | [
"Gets",
"comments",
"in",
"a",
"box",
"with",
"the",
"provided",
"attributes",
".",
"Args",
":",
"box_key",
"key",
"for",
"box",
"return",
"(",
"status",
"code",
"list",
"of",
"comment",
"dicts",
")"
] | train | https://github.com/mehmetg/streak_client/blob/46575510b4e4163a4a3cc06f7283a1ae377cdce6/streak_client/streak_client.py#L866-L878 |
mehmetg/streak_client | streak_client/streak_client.py | StreakClient.delete_box_comment | def delete_box_comment(self, box_key, comment_key):
'''Deletes comment in a box with the comment_key
Args:
box_key key for box
return (status code, list of comment dicts)
'''
#does not work
self._raise_unimplemented_error()
uri = '/'.join([self.api_uri,
self.boxes_suffix,
box_key,
... | python | def delete_box_comment(self, box_key, comment_key):
'''Deletes comment in a box with the comment_key
Args:
box_key key for box
return (status code, list of comment dicts)
'''
#does not work
self._raise_unimplemented_error()
uri = '/'.join([self.api_uri,
self.boxes_suffix,
box_key,
... | [
"def",
"delete_box_comment",
"(",
"self",
",",
"box_key",
",",
"comment_key",
")",
":",
"#does not work",
"self",
".",
"_raise_unimplemented_error",
"(",
")",
"uri",
"=",
"'/'",
".",
"join",
"(",
"[",
"self",
".",
"api_uri",
",",
"self",
".",
"boxes_suffix",... | Deletes comment in a box with the comment_key
Args:
box_key key for box
return (status code, list of comment dicts) | [
"Deletes",
"comment",
"in",
"a",
"box",
"with",
"the",
"comment_key",
"Args",
":",
"box_key",
"key",
"for",
"box",
"return",
"(",
"status",
"code",
"list",
"of",
"comment",
"dicts",
")"
] | train | https://github.com/mehmetg/streak_client/blob/46575510b4e4163a4a3cc06f7283a1ae377cdce6/streak_client/streak_client.py#L880-L895 |
mehmetg/streak_client | streak_client/streak_client.py | StreakClient.create_box_reminder | def create_box_reminder(self, box_key, message, remind_date, remind_follwers, **kwargs):
'''Creates a reminder with the provided attributes.
Args:
box_key specifying the box to add the field to
message message for the reminder
remind_date date to remind on in ticks.
remind_followers true/false
... | python | def create_box_reminder(self, box_key, message, remind_date, remind_follwers, **kwargs):
'''Creates a reminder with the provided attributes.
Args:
box_key specifying the box to add the field to
message message for the reminder
remind_date date to remind on in ticks.
remind_followers true/false
... | [
"def",
"create_box_reminder",
"(",
"self",
",",
"box_key",
",",
"message",
",",
"remind_date",
",",
"remind_follwers",
",",
"*",
"*",
"kwargs",
")",
":",
"uri",
"=",
"'/'",
".",
"join",
"(",
"[",
"self",
".",
"api_uri",
",",
"self",
".",
"boxes_suffix",
... | Creates a reminder with the provided attributes.
Args:
box_key specifying the box to add the field to
message message for the reminder
remind_date date to remind on in ticks.
remind_followers true/false
kwargs {..} see StreakReminder object for details
return (status code, reminder dic... | [
"Creates",
"a",
"reminder",
"with",
"the",
"provided",
"attributes",
".",
"Args",
":",
"box_key",
"specifying",
"the",
"box",
"to",
"add",
"the",
"field",
"to",
"message",
"message",
"for",
"the",
"reminder",
"remind_date",
"date",
"to",
"remind",
"on",
"in"... | train | https://github.com/mehmetg/streak_client/blob/46575510b4e4163a4a3cc06f7283a1ae377cdce6/streak_client/streak_client.py#L899-L923 |
mehmetg/streak_client | streak_client/streak_client.py | StreakClient.update_reminder | def update_reminder(self, reminder):
'''Creates a reminder with the provided attributes.
Args:
reminder updated reminder of StreakReminder type
return (status code, reminder dict)
'''
uri = '/'.join([self.api_uri,
self.reminders_suffix,
])
#req sanity check
payload = None
if type(rem... | python | def update_reminder(self, reminder):
'''Creates a reminder with the provided attributes.
Args:
reminder updated reminder of StreakReminder type
return (status code, reminder dict)
'''
uri = '/'.join([self.api_uri,
self.reminders_suffix,
])
#req sanity check
payload = None
if type(rem... | [
"def",
"update_reminder",
"(",
"self",
",",
"reminder",
")",
":",
"uri",
"=",
"'/'",
".",
"join",
"(",
"[",
"self",
".",
"api_uri",
",",
"self",
".",
"reminders_suffix",
",",
"]",
")",
"#req sanity check",
"payload",
"=",
"None",
"if",
"type",
"(",
"re... | Creates a reminder with the provided attributes.
Args:
reminder updated reminder of StreakReminder type
return (status code, reminder dict) | [
"Creates",
"a",
"reminder",
"with",
"the",
"provided",
"attributes",
".",
"Args",
":",
"reminder",
"updated",
"reminder",
"of",
"StreakReminder",
"type",
"return",
"(",
"status",
"code",
"reminder",
"dict",
")"
] | train | https://github.com/mehmetg/streak_client/blob/46575510b4e4163a4a3cc06f7283a1ae377cdce6/streak_client/streak_client.py#L925-L948 |
mehmetg/streak_client | streak_client/streak_client.py | StreakClient.get_box_reminders | def get_box_reminders(self, box_key):
'''Gets all reminders for a box
Args:
reminder updated reminder of StreakReminder type
return (status code, reminder dict)
'''
#required sanity check
if box_key:
return requests.codes.bad_request, None
uri = '/'.join([self.api_uri,
self.boxes_suffix, ... | python | def get_box_reminders(self, box_key):
'''Gets all reminders for a box
Args:
reminder updated reminder of StreakReminder type
return (status code, reminder dict)
'''
#required sanity check
if box_key:
return requests.codes.bad_request, None
uri = '/'.join([self.api_uri,
self.boxes_suffix, ... | [
"def",
"get_box_reminders",
"(",
"self",
",",
"box_key",
")",
":",
"#required sanity check",
"if",
"box_key",
":",
"return",
"requests",
".",
"codes",
".",
"bad_request",
",",
"None",
"uri",
"=",
"'/'",
".",
"join",
"(",
"[",
"self",
".",
"api_uri",
",",
... | Gets all reminders for a box
Args:
reminder updated reminder of StreakReminder type
return (status code, reminder dict) | [
"Gets",
"all",
"reminders",
"for",
"a",
"box",
"Args",
":",
"reminder",
"updated",
"reminder",
"of",
"StreakReminder",
"type",
"return",
"(",
"status",
"code",
"reminder",
"dict",
")"
] | train | https://github.com/mehmetg/streak_client/blob/46575510b4e4163a4a3cc06f7283a1ae377cdce6/streak_client/streak_client.py#L950-L966 |
mehmetg/streak_client | streak_client/streak_client.py | StreakClient.get_reminder | def get_reminder(self, reminder_key):
'''Gets one reminder
Args:
reminder_key key for the reminder to get
return (status code, reminder dict)
'''
#required sanity check
if reminder_key:
return requests.codes.bad_request, None
uri = '/'.join([
self.api_uri,
self.reminders_suffix,
... | python | def get_reminder(self, reminder_key):
'''Gets one reminder
Args:
reminder_key key for the reminder to get
return (status code, reminder dict)
'''
#required sanity check
if reminder_key:
return requests.codes.bad_request, None
uri = '/'.join([
self.api_uri,
self.reminders_suffix,
... | [
"def",
"get_reminder",
"(",
"self",
",",
"reminder_key",
")",
":",
"#required sanity check",
"if",
"reminder_key",
":",
"return",
"requests",
".",
"codes",
".",
"bad_request",
",",
"None",
"uri",
"=",
"'/'",
".",
"join",
"(",
"[",
"self",
".",
"api_uri",
"... | Gets one reminder
Args:
reminder_key key for the reminder to get
return (status code, reminder dict) | [
"Gets",
"one",
"reminder",
"Args",
":",
"reminder_key",
"key",
"for",
"the",
"reminder",
"to",
"get",
"return",
"(",
"status",
"code",
"reminder",
"dict",
")"
] | train | https://github.com/mehmetg/streak_client/blob/46575510b4e4163a4a3cc06f7283a1ae377cdce6/streak_client/streak_client.py#L968-L984 |
mehmetg/streak_client | streak_client/streak_client.py | StreakClient.get_file | def get_file(self, file_key):
'''Gets file information
Args:
file_key key for the file to get
return (status code, dict of file info)
'''
uri = '/'.join([
self.api_uri,
self.files_suffix,
file_key
])
return self._req('get', uri) | python | def get_file(self, file_key):
'''Gets file information
Args:
file_key key for the file to get
return (status code, dict of file info)
'''
uri = '/'.join([
self.api_uri,
self.files_suffix,
file_key
])
return self._req('get', uri) | [
"def",
"get_file",
"(",
"self",
",",
"file_key",
")",
":",
"uri",
"=",
"'/'",
".",
"join",
"(",
"[",
"self",
".",
"api_uri",
",",
"self",
".",
"files_suffix",
",",
"file_key",
"]",
")",
"return",
"self",
".",
"_req",
"(",
"'get'",
",",
"uri",
")"
] | Gets file information
Args:
file_key key for the file to get
return (status code, dict of file info) | [
"Gets",
"file",
"information",
"Args",
":",
"file_key",
"key",
"for",
"the",
"file",
"to",
"get",
"return",
"(",
"status",
"code",
"dict",
"of",
"file",
"info",
")"
] | train | https://github.com/mehmetg/streak_client/blob/46575510b4e4163a4a3cc06f7283a1ae377cdce6/streak_client/streak_client.py#L1004-L1016 |
mehmetg/streak_client | streak_client/streak_client.py | StreakClient.get_file_contents | def get_file_contents(self, file_key):
'''Gets file contents
Args:
file_key key for the file
return (status code, ?)
'''
#does not work
self._raise_unimplemented_error()
uri = '/'.join([self.api_uri,
self.files_suffix,
file_key,
self.file_contents_suffix,
])
return sel... | python | def get_file_contents(self, file_key):
'''Gets file contents
Args:
file_key key for the file
return (status code, ?)
'''
#does not work
self._raise_unimplemented_error()
uri = '/'.join([self.api_uri,
self.files_suffix,
file_key,
self.file_contents_suffix,
])
return sel... | [
"def",
"get_file_contents",
"(",
"self",
",",
"file_key",
")",
":",
"#does not work",
"self",
".",
"_raise_unimplemented_error",
"(",
")",
"uri",
"=",
"'/'",
".",
"join",
"(",
"[",
"self",
".",
"api_uri",
",",
"self",
".",
"files_suffix",
",",
"file_key",
... | Gets file contents
Args:
file_key key for the file
return (status code, ?) | [
"Gets",
"file",
"contents",
"Args",
":",
"file_key",
"key",
"for",
"the",
"file",
"return",
"(",
"status",
"code",
"?",
")"
] | train | https://github.com/mehmetg/streak_client/blob/46575510b4e4163a4a3cc06f7283a1ae377cdce6/streak_client/streak_client.py#L1018-L1032 |
mehmetg/streak_client | streak_client/streak_client.py | StreakClient.get_file_link | def get_file_link(self, file_key):
'''Gets link to file
Args:
file_key key for the file
return (status code, ?)
'''
#does not work
self._raise_unimplemented_error()
uri = '/'.join([self.api_uri,
self.files_suffix,
file_key,
self.file_link_suffix,
])
return self._req('get... | python | def get_file_link(self, file_key):
'''Gets link to file
Args:
file_key key for the file
return (status code, ?)
'''
#does not work
self._raise_unimplemented_error()
uri = '/'.join([self.api_uri,
self.files_suffix,
file_key,
self.file_link_suffix,
])
return self._req('get... | [
"def",
"get_file_link",
"(",
"self",
",",
"file_key",
")",
":",
"#does not work",
"self",
".",
"_raise_unimplemented_error",
"(",
")",
"uri",
"=",
"'/'",
".",
"join",
"(",
"[",
"self",
".",
"api_uri",
",",
"self",
".",
"files_suffix",
",",
"file_key",
",",... | Gets link to file
Args:
file_key key for the file
return (status code, ?) | [
"Gets",
"link",
"to",
"file",
"Args",
":",
"file_key",
"key",
"for",
"the",
"file",
"return",
"(",
"status",
"code",
"?",
")"
] | train | https://github.com/mehmetg/streak_client/blob/46575510b4e4163a4a3cc06f7283a1ae377cdce6/streak_client/streak_client.py#L1034-L1048 |
mehmetg/streak_client | streak_client/streak_client.py | StreakClient.get_box_files | def get_box_files(self, box_key):
'''Gets to file infos in a single box.
Args:
box_key key for the file
return (status code, list of file info dicts)
'''
uri = '/'.join([self.api_uri,
self.boxes_suffix,
box_key,
self.files_suffix
])
return self._req('get', uri) | python | def get_box_files(self, box_key):
'''Gets to file infos in a single box.
Args:
box_key key for the file
return (status code, list of file info dicts)
'''
uri = '/'.join([self.api_uri,
self.boxes_suffix,
box_key,
self.files_suffix
])
return self._req('get', uri) | [
"def",
"get_box_files",
"(",
"self",
",",
"box_key",
")",
":",
"uri",
"=",
"'/'",
".",
"join",
"(",
"[",
"self",
".",
"api_uri",
",",
"self",
".",
"boxes_suffix",
",",
"box_key",
",",
"self",
".",
"files_suffix",
"]",
")",
"return",
"self",
".",
"_re... | Gets to file infos in a single box.
Args:
box_key key for the file
return (status code, list of file info dicts) | [
"Gets",
"to",
"file",
"infos",
"in",
"a",
"single",
"box",
".",
"Args",
":",
"box_key",
"key",
"for",
"the",
"file",
"return",
"(",
"status",
"code",
"list",
"of",
"file",
"info",
"dicts",
")"
] | train | https://github.com/mehmetg/streak_client/blob/46575510b4e4163a4a3cc06f7283a1ae377cdce6/streak_client/streak_client.py#L1050-L1062 |
delfick/aws_syncr | aws_syncr/formatter.py | MergedOptionStringFormatter.get_string | def get_string(self, key):
"""Get a string from all_options"""
# Massive hack, lol
if key.startswith("lambda."):
key = "lambda.items.{0}".format(key[7:])
if key.startswith("apigateway."):
key = "apigateway.items.{0}".format(key[11:])
# Make sure key is i... | python | def get_string(self, key):
"""Get a string from all_options"""
# Massive hack, lol
if key.startswith("lambda."):
key = "lambda.items.{0}".format(key[7:])
if key.startswith("apigateway."):
key = "apigateway.items.{0}".format(key[11:])
# Make sure key is i... | [
"def",
"get_string",
"(",
"self",
",",
"key",
")",
":",
"# Massive hack, lol",
"if",
"key",
".",
"startswith",
"(",
"\"lambda.\"",
")",
":",
"key",
"=",
"\"lambda.items.{0}\"",
".",
"format",
"(",
"key",
"[",
"7",
":",
"]",
")",
"if",
"key",
".",
"star... | Get a string from all_options | [
"Get",
"a",
"string",
"from",
"all_options"
] | train | https://github.com/delfick/aws_syncr/blob/8cd214b27c1eee98dfba4632cbb8bc0ae36356bd/aws_syncr/formatter.py#L50-L66 |
delfick/aws_syncr | aws_syncr/formatter.py | MergedOptionStringFormatter.special_get_field | def special_get_field(self, value, args, kwargs, format_spec=None):
"""Also take the spec into account"""
if value in self.chain:
raise BadOptionFormat("Recursive option", chain=self.chain + [value]) | python | def special_get_field(self, value, args, kwargs, format_spec=None):
"""Also take the spec into account"""
if value in self.chain:
raise BadOptionFormat("Recursive option", chain=self.chain + [value]) | [
"def",
"special_get_field",
"(",
"self",
",",
"value",
",",
"args",
",",
"kwargs",
",",
"format_spec",
"=",
"None",
")",
":",
"if",
"value",
"in",
"self",
".",
"chain",
":",
"raise",
"BadOptionFormat",
"(",
"\"Recursive option\"",
",",
"chain",
"=",
"self"... | Also take the spec into account | [
"Also",
"take",
"the",
"spec",
"into",
"account"
] | train | https://github.com/delfick/aws_syncr/blob/8cd214b27c1eee98dfba4632cbb8bc0ae36356bd/aws_syncr/formatter.py#L68-L71 |
incuna/incuna-auth | incuna_auth/middleware/permission_feincms.py | FeinCMSPermissionMiddleware._get_page_from_path | def _get_page_from_path(self, path):
"""
Fetches the FeinCMS Page object that the path points to.
Override this to deal with different types of object from Page.
"""
from feincms.module.page.models import Page
try:
return Page.objects.best_match_for_path(path... | python | def _get_page_from_path(self, path):
"""
Fetches the FeinCMS Page object that the path points to.
Override this to deal with different types of object from Page.
"""
from feincms.module.page.models import Page
try:
return Page.objects.best_match_for_path(path... | [
"def",
"_get_page_from_path",
"(",
"self",
",",
"path",
")",
":",
"from",
"feincms",
".",
"module",
".",
"page",
".",
"models",
"import",
"Page",
"try",
":",
"return",
"Page",
".",
"objects",
".",
"best_match_for_path",
"(",
"path",
")",
"except",
"Page",
... | Fetches the FeinCMS Page object that the path points to.
Override this to deal with different types of object from Page. | [
"Fetches",
"the",
"FeinCMS",
"Page",
"object",
"that",
"the",
"path",
"points",
"to",
"."
] | train | https://github.com/incuna/incuna-auth/blob/949ccd922da15a4b5de17b9595cc8f5114d5385c/incuna_auth/middleware/permission_feincms.py#L31-L41 |
incuna/incuna-auth | incuna_auth/middleware/permission_feincms.py | FeinCMSPermissionMiddleware._get_resource_access_state | def _get_resource_access_state(self, request):
"""
Returns the FeinCMS resource's access_state, following any INHERITed values.
Will return None if the resource has an access state that should never be
protected. It should not be possible to protect a resource with an access_state
... | python | def _get_resource_access_state(self, request):
"""
Returns the FeinCMS resource's access_state, following any INHERITed values.
Will return None if the resource has an access state that should never be
protected. It should not be possible to protect a resource with an access_state
... | [
"def",
"_get_resource_access_state",
"(",
"self",
",",
"request",
")",
":",
"feincms_page",
"=",
"self",
".",
"_get_page_from_path",
"(",
"request",
".",
"path_info",
".",
"lstrip",
"(",
"'/'",
")",
")",
"if",
"not",
"feincms_page",
":",
"return",
"None",
"#... | Returns the FeinCMS resource's access_state, following any INHERITed values.
Will return None if the resource has an access state that should never be
protected. It should not be possible to protect a resource with an access_state
of STATE_ALL_ALLOWED, or an access_state of STATE_INHERIT and no... | [
"Returns",
"the",
"FeinCMS",
"resource",
"s",
"access_state",
"following",
"any",
"INHERITed",
"values",
"."
] | train | https://github.com/incuna/incuna-auth/blob/949ccd922da15a4b5de17b9595cc8f5114d5385c/incuna_auth/middleware/permission_feincms.py#L43-L70 |
incuna/incuna-auth | incuna_auth/middleware/permission_feincms.py | FeinCMSPermissionMiddleware.is_resource_protected | def is_resource_protected(self, request, **kwargs):
"""
Determines if a resource should be protected.
Returns true if and only if the resource's access_state matches an entry in
the return value of get_protected_states().
"""
access_state = self._get_resource_access_stat... | python | def is_resource_protected(self, request, **kwargs):
"""
Determines if a resource should be protected.
Returns true if and only if the resource's access_state matches an entry in
the return value of get_protected_states().
"""
access_state = self._get_resource_access_stat... | [
"def",
"is_resource_protected",
"(",
"self",
",",
"request",
",",
"*",
"*",
"kwargs",
")",
":",
"access_state",
"=",
"self",
".",
"_get_resource_access_state",
"(",
"request",
")",
"protected_states",
"=",
"self",
".",
"get_protected_states",
"(",
")",
"return",... | Determines if a resource should be protected.
Returns true if and only if the resource's access_state matches an entry in
the return value of get_protected_states(). | [
"Determines",
"if",
"a",
"resource",
"should",
"be",
"protected",
"."
] | train | https://github.com/incuna/incuna-auth/blob/949ccd922da15a4b5de17b9595cc8f5114d5385c/incuna_auth/middleware/permission_feincms.py#L72-L81 |
matthewdeanmartin/jiggle_version | jiggle_version/commands.py | bump_version | def bump_version(project, source, force_init): # type: (str, str, bool, bool) ->int
"""
Entry point
:return:
"""
file_opener = FileOpener()
# logger.debug("Starting version jiggler...")
jiggler = JiggleVersion(project, source, file_opener, force_init)
logger.debug(
"Current, ne... | python | def bump_version(project, source, force_init): # type: (str, str, bool, bool) ->int
"""
Entry point
:return:
"""
file_opener = FileOpener()
# logger.debug("Starting version jiggler...")
jiggler = JiggleVersion(project, source, file_opener, force_init)
logger.debug(
"Current, ne... | [
"def",
"bump_version",
"(",
"project",
",",
"source",
",",
"force_init",
")",
":",
"# type: (str, str, bool, bool) ->int",
"file_opener",
"=",
"FileOpener",
"(",
")",
"# logger.debug(\"Starting version jiggler...\")",
"jiggler",
"=",
"JiggleVersion",
"(",
"project",
",",
... | Entry point
:return: | [
"Entry",
"point",
":",
"return",
":"
] | train | https://github.com/matthewdeanmartin/jiggle_version/blob/963656a0a47b7162780a5f6c8f4b8bbbebc148f5/jiggle_version/commands.py#L26-L47 |
matthewdeanmartin/jiggle_version | jiggle_version/commands.py | find_version | def find_version(project, source, force_init): # type: (str, str, bool) ->None
"""
Entry point to just find a version and print next
:return:
"""
# quiet! no noise
file_opener = FileOpener()
finder = FindVersion(project, source, file_opener, force_init=force_init)
if finder.PROJECT is N... | python | def find_version(project, source, force_init): # type: (str, str, bool) ->None
"""
Entry point to just find a version and print next
:return:
"""
# quiet! no noise
file_opener = FileOpener()
finder = FindVersion(project, source, file_opener, force_init=force_init)
if finder.PROJECT is N... | [
"def",
"find_version",
"(",
"project",
",",
"source",
",",
"force_init",
")",
":",
"# type: (str, str, bool) ->None",
"# quiet! no noise",
"file_opener",
"=",
"FileOpener",
"(",
")",
"finder",
"=",
"FindVersion",
"(",
"project",
",",
"source",
",",
"file_opener",
... | Entry point to just find a version and print next
:return: | [
"Entry",
"point",
"to",
"just",
"find",
"a",
"version",
"and",
"print",
"next",
":",
"return",
":"
] | train | https://github.com/matthewdeanmartin/jiggle_version/blob/963656a0a47b7162780a5f6c8f4b8bbbebc148f5/jiggle_version/commands.py#L50-L71 |
delfick/aws_syncr | aws_syncr/differ.py | Differ.compare_two_documents | def compare_two_documents(kls, doc1, doc2):
"""Compare two documents by converting them into json objects and back to strings and compare"""
first = doc1
if isinstance(doc1, string_types):
try:
first = json.loads(doc1)
except (ValueError, TypeError) as err... | python | def compare_two_documents(kls, doc1, doc2):
"""Compare two documents by converting them into json objects and back to strings and compare"""
first = doc1
if isinstance(doc1, string_types):
try:
first = json.loads(doc1)
except (ValueError, TypeError) as err... | [
"def",
"compare_two_documents",
"(",
"kls",
",",
"doc1",
",",
"doc2",
")",
":",
"first",
"=",
"doc1",
"if",
"isinstance",
"(",
"doc1",
",",
"string_types",
")",
":",
"try",
":",
"first",
"=",
"json",
".",
"loads",
"(",
"doc1",
")",
"except",
"(",
"Va... | Compare two documents by converting them into json objects and back to strings and compare | [
"Compare",
"two",
"documents",
"by",
"converting",
"them",
"into",
"json",
"objects",
"and",
"back",
"to",
"strings",
"and",
"compare"
] | train | https://github.com/delfick/aws_syncr/blob/8cd214b27c1eee98dfba4632cbb8bc0ae36356bd/aws_syncr/differ.py#L11-L62 |
johnnoone/facts | facts/contribs/__init__.py | facter_info | def facter_info():
"""Returns data from facter.
"""
with suppress(FileNotFoundError): # facter may not be installed
proc = subprocess.Popen(['facter', '--yaml'],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
stdout, stderr =... | python | def facter_info():
"""Returns data from facter.
"""
with suppress(FileNotFoundError): # facter may not be installed
proc = subprocess.Popen(['facter', '--yaml'],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
stdout, stderr =... | [
"def",
"facter_info",
"(",
")",
":",
"with",
"suppress",
"(",
"FileNotFoundError",
")",
":",
"# facter may not be installed",
"proc",
"=",
"subprocess",
".",
"Popen",
"(",
"[",
"'facter'",
",",
"'--yaml'",
"]",
",",
"stdout",
"=",
"subprocess",
".",
"PIPE",
... | Returns data from facter. | [
"Returns",
"data",
"from",
"facter",
"."
] | train | https://github.com/johnnoone/facts/blob/82d38a46c15d9c01200445526f4c0d1825fc1e51/facts/contribs/__init__.py#L8-L19 |
jrheard/madison_wcb | madison_wcb/wcb.py | initialize | def initialize():
"""IMPORTANT: Call this function at the beginning of your program."""
try:
requests.get('http://localhost:4242/poll')
state['connected_to_bot'] = True
except requests.exceptions.ConnectionError:
state['connected_to_bot'] = False
# set up turtle
state['windo... | python | def initialize():
"""IMPORTANT: Call this function at the beginning of your program."""
try:
requests.get('http://localhost:4242/poll')
state['connected_to_bot'] = True
except requests.exceptions.ConnectionError:
state['connected_to_bot'] = False
# set up turtle
state['windo... | [
"def",
"initialize",
"(",
")",
":",
"try",
":",
"requests",
".",
"get",
"(",
"'http://localhost:4242/poll'",
")",
"state",
"[",
"'connected_to_bot'",
"]",
"=",
"True",
"except",
"requests",
".",
"exceptions",
".",
"ConnectionError",
":",
"state",
"[",
"'connec... | IMPORTANT: Call this function at the beginning of your program. | [
"IMPORTANT",
":",
"Call",
"this",
"function",
"at",
"the",
"beginning",
"of",
"your",
"program",
"."
] | train | https://github.com/jrheard/madison_wcb/blob/545e92e13c8fb46e0d805edef6b6146ab25373e9/madison_wcb/wcb.py#L31-L49 |
jrheard/madison_wcb | madison_wcb/wcb.py | get_color | def get_color(index):
"""Dips the brush in paint.
Arguments:
index - an integer between 0 and 7, inclusive. Tells the bot which color you want.
"""
if index in range(0, 8):
# Send the turtle to the top-left corner of the window to imitate the position of the WCB's brush.
state['... | python | def get_color(index):
"""Dips the brush in paint.
Arguments:
index - an integer between 0 and 7, inclusive. Tells the bot which color you want.
"""
if index in range(0, 8):
# Send the turtle to the top-left corner of the window to imitate the position of the WCB's brush.
state['... | [
"def",
"get_color",
"(",
"index",
")",
":",
"if",
"index",
"in",
"range",
"(",
"0",
",",
"8",
")",
":",
"# Send the turtle to the top-left corner of the window to imitate the position of the WCB's brush.",
"state",
"[",
"'turtle'",
"]",
".",
"goto",
"(",
"-",
"WCB_W... | Dips the brush in paint.
Arguments:
index - an integer between 0 and 7, inclusive. Tells the bot which color you want. | [
"Dips",
"the",
"brush",
"in",
"paint",
"."
] | train | https://github.com/jrheard/madison_wcb/blob/545e92e13c8fb46e0d805edef6b6146ab25373e9/madison_wcb/wcb.py#L66-L85 |
jrheard/madison_wcb | madison_wcb/wcb.py | move_to | def move_to(x, y):
"""Moves the brush to a particular position.
Arguments:
x - a number between -250 and 250.
y - a number between -180 and 180.
"""
_make_cnc_request("coord/{0}/{1}".format(x, y))
state['turtle'].goto(x, y) | python | def move_to(x, y):
"""Moves the brush to a particular position.
Arguments:
x - a number between -250 and 250.
y - a number between -180 and 180.
"""
_make_cnc_request("coord/{0}/{1}".format(x, y))
state['turtle'].goto(x, y) | [
"def",
"move_to",
"(",
"x",
",",
"y",
")",
":",
"_make_cnc_request",
"(",
"\"coord/{0}/{1}\"",
".",
"format",
"(",
"x",
",",
"y",
")",
")",
"state",
"[",
"'turtle'",
"]",
".",
"goto",
"(",
"x",
",",
"y",
")"
] | Moves the brush to a particular position.
Arguments:
x - a number between -250 and 250.
y - a number between -180 and 180. | [
"Moves",
"the",
"brush",
"to",
"a",
"particular",
"position",
"."
] | train | https://github.com/jrheard/madison_wcb/blob/545e92e13c8fb46e0d805edef6b6146ab25373e9/madison_wcb/wcb.py#L101-L109 |
jrheard/madison_wcb | madison_wcb/wcb.py | turn_left | def turn_left(relative_angle):
"""Turns the brush's "turtle" to the left.
Arguments:
relative_angle - a number like 10.
A bigger number makes the turtle turn farther to the left.
"""
assert int(relative_angle) == relative_angle, "turn_left() only accepts integers, but you gave it " ... | python | def turn_left(relative_angle):
"""Turns the brush's "turtle" to the left.
Arguments:
relative_angle - a number like 10.
A bigger number makes the turtle turn farther to the left.
"""
assert int(relative_angle) == relative_angle, "turn_left() only accepts integers, but you gave it " ... | [
"def",
"turn_left",
"(",
"relative_angle",
")",
":",
"assert",
"int",
"(",
"relative_angle",
")",
"==",
"relative_angle",
",",
"\"turn_left() only accepts integers, but you gave it \"",
"+",
"str",
"(",
"relative_angle",
")",
"_make_cnc_request",
"(",
"\"move.left./\"",
... | Turns the brush's "turtle" to the left.
Arguments:
relative_angle - a number like 10.
A bigger number makes the turtle turn farther to the left. | [
"Turns",
"the",
"brush",
"s",
"turtle",
"to",
"the",
"left",
"."
] | train | https://github.com/jrheard/madison_wcb/blob/545e92e13c8fb46e0d805edef6b6146ab25373e9/madison_wcb/wcb.py#L135-L145 |
jrheard/madison_wcb | madison_wcb/wcb.py | turn_right | def turn_right(relative_angle):
"""Turns the brush's "turtle" to the right.
Arguments:
relative_angle - a number like 10.
A bigger number makes the turtle turn farther to the right.
"""
assert int(relative_angle) == relative_angle, "turn_right() only accepts integers, but you gave i... | python | def turn_right(relative_angle):
"""Turns the brush's "turtle" to the right.
Arguments:
relative_angle - a number like 10.
A bigger number makes the turtle turn farther to the right.
"""
assert int(relative_angle) == relative_angle, "turn_right() only accepts integers, but you gave i... | [
"def",
"turn_right",
"(",
"relative_angle",
")",
":",
"assert",
"int",
"(",
"relative_angle",
")",
"==",
"relative_angle",
",",
"\"turn_right() only accepts integers, but you gave it \"",
"+",
"str",
"(",
"relative_angle",
")",
"_make_cnc_request",
"(",
"\"move.right./\""... | Turns the brush's "turtle" to the right.
Arguments:
relative_angle - a number like 10.
A bigger number makes the turtle turn farther to the right. | [
"Turns",
"the",
"brush",
"s",
"turtle",
"to",
"the",
"right",
"."
] | train | https://github.com/jrheard/madison_wcb/blob/545e92e13c8fb46e0d805edef6b6146ab25373e9/madison_wcb/wcb.py#L147-L157 |
rosenbrockc/acorn | acorn/logging/descriptors.py | describe | def describe(o):
"""Describes the object using developer-specified attributes specific to
each main object type.
Returns:
dict: keys are specific attributes tailored to the specific object type,
though `fqdn` is common to all descriptions; values are the corresponding
attribute valu... | python | def describe(o):
"""Describes the object using developer-specified attributes specific to
each main object type.
Returns:
dict: keys are specific attributes tailored to the specific object type,
though `fqdn` is common to all descriptions; values are the corresponding
attribute valu... | [
"def",
"describe",
"(",
"o",
")",
":",
"#First, we need to determine the fqdn, so that we can lookup the format for",
"#this object in the config file for the package.",
"from",
"inspect",
"import",
"getmodule",
"from",
"acorn",
".",
"logging",
".",
"decoration",
"import",
"_fq... | Describes the object using developer-specified attributes specific to
each main object type.
Returns:
dict: keys are specific attributes tailored to the specific object type,
though `fqdn` is common to all descriptions; values are the corresponding
attribute values which are *simple* ty... | [
"Describes",
"the",
"object",
"using",
"developer",
"-",
"specified",
"attributes",
"specific",
"to",
"each",
"main",
"object",
"type",
"."
] | train | https://github.com/rosenbrockc/acorn/blob/9a44d1a1ad8bfc2c54a6b56d9efe54433a797820/acorn/logging/descriptors.py#L10-L46 |
rosenbrockc/acorn | acorn/logging/descriptors.py | _obj_getattr | def _obj_getattr(obj, fqdn, start=1):
"""Returns the attribute specified by the fqdn list from obj.
"""
node = obj
for chain in fqdn.split('.')[start:]:
if hasattr(node, chain):
node = getattr(node, chain)
else:
node = None
break
return node | python | def _obj_getattr(obj, fqdn, start=1):
"""Returns the attribute specified by the fqdn list from obj.
"""
node = obj
for chain in fqdn.split('.')[start:]:
if hasattr(node, chain):
node = getattr(node, chain)
else:
node = None
break
return node | [
"def",
"_obj_getattr",
"(",
"obj",
",",
"fqdn",
",",
"start",
"=",
"1",
")",
":",
"node",
"=",
"obj",
"for",
"chain",
"in",
"fqdn",
".",
"split",
"(",
"'.'",
")",
"[",
"start",
":",
"]",
":",
"if",
"hasattr",
"(",
"node",
",",
"chain",
")",
":"... | Returns the attribute specified by the fqdn list from obj. | [
"Returns",
"the",
"attribute",
"specified",
"by",
"the",
"fqdn",
"list",
"from",
"obj",
"."
] | train | https://github.com/rosenbrockc/acorn/blob/9a44d1a1ad8bfc2c54a6b56d9efe54433a797820/acorn/logging/descriptors.py#L48-L58 |
rosenbrockc/acorn | acorn/logging/descriptors.py | _package_transform | def _package_transform(package, fqdn, start=1, *args, **kwargs):
"""Applies the specified package transform with `fqdn` to the package.
Args:
package: imported package object.
fqdn (str): fully-qualified domain name of function in the package. If it
does not include the package name, ... | python | def _package_transform(package, fqdn, start=1, *args, **kwargs):
"""Applies the specified package transform with `fqdn` to the package.
Args:
package: imported package object.
fqdn (str): fully-qualified domain name of function in the package. If it
does not include the package name, ... | [
"def",
"_package_transform",
"(",
"package",
",",
"fqdn",
",",
"start",
"=",
"1",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"#Our only difficulty here is that package names can be chained. We ignore",
"#the first item since that was already checked for us by the ca... | Applies the specified package transform with `fqdn` to the package.
Args:
package: imported package object.
fqdn (str): fully-qualified domain name of function in the package. If it
does not include the package name, then set `start=0`.
start (int): in the '.'-split list of identi... | [
"Applies",
"the",
"specified",
"package",
"transform",
"with",
"fqdn",
"to",
"the",
"package",
"."
] | train | https://github.com/rosenbrockc/acorn/blob/9a44d1a1ad8bfc2c54a6b56d9efe54433a797820/acorn/logging/descriptors.py#L60-L81 |
rosenbrockc/acorn | acorn/logging/descriptors.py | _instance_transform | def _instance_transform(fqdn, o, *args, **kwargs):
"""Applies an instance method with name `fqdn` to `o`.
Args:
fqdn (str): fully-qualified domain name of the object.
o: object to apply instance method to.
"""
return _package_transform(o, fqdn, start=0, *args, **kwargs) | python | def _instance_transform(fqdn, o, *args, **kwargs):
"""Applies an instance method with name `fqdn` to `o`.
Args:
fqdn (str): fully-qualified domain name of the object.
o: object to apply instance method to.
"""
return _package_transform(o, fqdn, start=0, *args, **kwargs) | [
"def",
"_instance_transform",
"(",
"fqdn",
",",
"o",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_package_transform",
"(",
"o",
",",
"fqdn",
",",
"start",
"=",
"0",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | Applies an instance method with name `fqdn` to `o`.
Args:
fqdn (str): fully-qualified domain name of the object.
o: object to apply instance method to. | [
"Applies",
"an",
"instance",
"method",
"with",
"name",
"fqdn",
"to",
"o",
"."
] | train | https://github.com/rosenbrockc/acorn/blob/9a44d1a1ad8bfc2c54a6b56d9efe54433a797820/acorn/logging/descriptors.py#L117-L124 |
rosenbrockc/acorn | acorn/logging/descriptors.py | _array_convert | def _array_convert(a):
"""Converts the specified value to a list if it is a :class:`numpy.ndarray`;
otherwise it is just returned as is.
"""
from numpy import ndarray
if isinstance(a, ndarray):
larr = a.tolist()
if len(larr) == 1:
return larr[0]
else:
... | python | def _array_convert(a):
"""Converts the specified value to a list if it is a :class:`numpy.ndarray`;
otherwise it is just returned as is.
"""
from numpy import ndarray
if isinstance(a, ndarray):
larr = a.tolist()
if len(larr) == 1:
return larr[0]
else:
... | [
"def",
"_array_convert",
"(",
"a",
")",
":",
"from",
"numpy",
"import",
"ndarray",
"if",
"isinstance",
"(",
"a",
",",
"ndarray",
")",
":",
"larr",
"=",
"a",
".",
"tolist",
"(",
")",
"if",
"len",
"(",
"larr",
")",
"==",
"1",
":",
"return",
"larr",
... | Converts the specified value to a list if it is a :class:`numpy.ndarray`;
otherwise it is just returned as is. | [
"Converts",
"the",
"specified",
"value",
"to",
"a",
"list",
"if",
"it",
"is",
"a",
":",
"class",
":",
"numpy",
".",
"ndarray",
";",
"otherwise",
"it",
"is",
"just",
"returned",
"as",
"is",
"."
] | train | https://github.com/rosenbrockc/acorn/blob/9a44d1a1ad8bfc2c54a6b56d9efe54433a797820/acorn/logging/descriptors.py#L126-L138 |
rosenbrockc/acorn | acorn/logging/descriptors.py | json_describe | def json_describe(o, fqdn, descriptor=None):
"""Describes the specified object using the directives in the JSON
`descriptor`, if available.
Args:
o: object to describe.
fqdn (str): fully-qualified domain name of the object.
descriptor (dict): keys are attributes of `o`; values are t... | python | def json_describe(o, fqdn, descriptor=None):
"""Describes the specified object using the directives in the JSON
`descriptor`, if available.
Args:
o: object to describe.
fqdn (str): fully-qualified domain name of the object.
descriptor (dict): keys are attributes of `o`; values are t... | [
"def",
"json_describe",
"(",
"o",
",",
"fqdn",
",",
"descriptor",
"=",
"None",
")",
":",
"if",
"descriptor",
"is",
"None",
"or",
"not",
"isinstance",
"(",
"descriptor",
",",
"dict",
")",
":",
"return",
"{",
"\"fqdn\"",
":",
"fqdn",
"}",
"else",
":",
... | Describes the specified object using the directives in the JSON
`descriptor`, if available.
Args:
o: object to describe.
fqdn (str): fully-qualified domain name of the object.
descriptor (dict): keys are attributes of `o`; values are transform
functions to apply to the attribu... | [
"Describes",
"the",
"specified",
"object",
"using",
"the",
"directives",
"in",
"the",
"JSON",
"descriptor",
"if",
"available",
"."
] | train | https://github.com/rosenbrockc/acorn/blob/9a44d1a1ad8bfc2c54a6b56d9efe54433a797820/acorn/logging/descriptors.py#L140-L211 |
dayski/requestlogs | requestlogs/mongo.py | MongoConnection.get_database_name | def get_database_name(self):
"""
extract database from connection string
"""
uri_dict = uri_parser.parse_uri(self.host)
database = uri_dict.get('database', None)
if not database:
raise "database name is missing"
return database | python | def get_database_name(self):
"""
extract database from connection string
"""
uri_dict = uri_parser.parse_uri(self.host)
database = uri_dict.get('database', None)
if not database:
raise "database name is missing"
return database | [
"def",
"get_database_name",
"(",
"self",
")",
":",
"uri_dict",
"=",
"uri_parser",
".",
"parse_uri",
"(",
"self",
".",
"host",
")",
"database",
"=",
"uri_dict",
".",
"get",
"(",
"'database'",
",",
"None",
")",
"if",
"not",
"database",
":",
"raise",
"\"dat... | extract database from connection string | [
"extract",
"database",
"from",
"connection",
"string"
] | train | https://github.com/dayski/requestlogs/blob/c22bba4ddfe2a514c1cec08cf49b2e29373db537/requestlogs/mongo.py#L35-L43 |
dayski/requestlogs | requestlogs/mongo.py | MongoConnection.find | def find(self, start, end, limit=50, *args, **kwargs):
"""
find by creation date, using start and end dates as range
"""
# check if spec has been specified, build on top of it
fc = kwargs.get('spec', dict())
# filter _id on start and end dates
fc['_id'] = {'$gte'... | python | def find(self, start, end, limit=50, *args, **kwargs):
"""
find by creation date, using start and end dates as range
"""
# check if spec has been specified, build on top of it
fc = kwargs.get('spec', dict())
# filter _id on start and end dates
fc['_id'] = {'$gte'... | [
"def",
"find",
"(",
"self",
",",
"start",
",",
"end",
",",
"limit",
"=",
"50",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# check if spec has been specified, build on top of it",
"fc",
"=",
"kwargs",
".",
"get",
"(",
"'spec'",
",",
"dict",
"("... | find by creation date, using start and end dates as range | [
"find",
"by",
"creation",
"date",
"using",
"start",
"and",
"end",
"dates",
"as",
"range"
] | train | https://github.com/dayski/requestlogs/blob/c22bba4ddfe2a514c1cec08cf49b2e29373db537/requestlogs/mongo.py#L62-L78 |
dayski/requestlogs | requestlogs/mongo.py | MongoConnection.save | def save(self, data, *args, **kwargs):
"""
inserts data (dict or list of dicts)
expected kwargs:
collection_name: by default uses MONGODB_DEFAULT_COLLECTION
w: by default set to 0 to disable write acknowledgement
assumes that data has been verified / validated
... | python | def save(self, data, *args, **kwargs):
"""
inserts data (dict or list of dicts)
expected kwargs:
collection_name: by default uses MONGODB_DEFAULT_COLLECTION
w: by default set to 0 to disable write acknowledgement
assumes that data has been verified / validated
... | [
"def",
"save",
"(",
"self",
",",
"data",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"collection_name",
"=",
"kwargs",
".",
"get",
"(",
"'collection_name'",
",",
"MONGODB_DEFAULT_COLLECTION",
")",
"w",
"=",
"kwargs",
".",
"get",
"(... | inserts data (dict or list of dicts)
expected kwargs:
collection_name: by default uses MONGODB_DEFAULT_COLLECTION
w: by default set to 0 to disable write acknowledgement
assumes that data has been verified / validated | [
"inserts",
"data",
"(",
"dict",
"or",
"list",
"of",
"dicts",
")",
"expected",
"kwargs",
":",
"collection_name",
":",
"by",
"default",
"uses",
"MONGODB_DEFAULT_COLLECTION",
"w",
":",
"by",
"default",
"set",
"to",
"0",
"to",
"disable",
"write",
"acknowledgement"... | train | https://github.com/dayski/requestlogs/blob/c22bba4ddfe2a514c1cec08cf49b2e29373db537/requestlogs/mongo.py#L80-L102 |
sassoo/goldman | goldman/stores/postgres/store.py | handle_exc | def handle_exc(exc):
""" Given a database exception determine how to fail
Attempt to lookup a known error & abort on a meaningful
error. Otherwise issue a generic DatabaseUnavailable exception.
:param exc: psycopg2 exception
"""
err = ERRORS_TABLE.get(exc.pgcode)
if err:
abort(ex... | python | def handle_exc(exc):
""" Given a database exception determine how to fail
Attempt to lookup a known error & abort on a meaningful
error. Otherwise issue a generic DatabaseUnavailable exception.
:param exc: psycopg2 exception
"""
err = ERRORS_TABLE.get(exc.pgcode)
if err:
abort(ex... | [
"def",
"handle_exc",
"(",
"exc",
")",
":",
"err",
"=",
"ERRORS_TABLE",
".",
"get",
"(",
"exc",
".",
"pgcode",
")",
"if",
"err",
":",
"abort",
"(",
"exceptions",
".",
"InvalidQueryParams",
"(",
"*",
"*",
"{",
"'detail'",
":",
"err",
",",
"'parameter'",
... | Given a database exception determine how to fail
Attempt to lookup a known error & abort on a meaningful
error. Otherwise issue a generic DatabaseUnavailable exception.
:param exc: psycopg2 exception | [
"Given",
"a",
"database",
"exception",
"determine",
"how",
"to",
"fail"
] | train | https://github.com/sassoo/goldman/blob/b72540c9ad06b5c68aadb1b4fa8cb0b716260bf2/goldman/stores/postgres/store.py#L56-L73 |
sassoo/goldman | goldman/stores/postgres/store.py | Store.dirty_vals | def dirty_vals(model):
""" Get the models dirty values in a friendly SQL format
This will be a string of comma separated field
names in a format for psycopg to substitute with
parameterized inputs.
An example, if the `rid` & `created` fields are
dirty then they'll be co... | python | def dirty_vals(model):
""" Get the models dirty values in a friendly SQL format
This will be a string of comma separated field
names in a format for psycopg to substitute with
parameterized inputs.
An example, if the `rid` & `created` fields are
dirty then they'll be co... | [
"def",
"dirty_vals",
"(",
"model",
")",
":",
"vals",
"=",
"[",
"]",
"for",
"field",
"in",
"model",
".",
"dirty_fields",
":",
"vals",
".",
"append",
"(",
"'%({0})s'",
".",
"format",
"(",
"field",
")",
")",
"vals",
"=",
"', '",
".",
"join",
"(",
"val... | Get the models dirty values in a friendly SQL format
This will be a string of comma separated field
names in a format for psycopg to substitute with
parameterized inputs.
An example, if the `rid` & `created` fields are
dirty then they'll be converted into:
'%(rid)s... | [
"Get",
"the",
"models",
"dirty",
"values",
"in",
"a",
"friendly",
"SQL",
"format"
] | train | https://github.com/sassoo/goldman/blob/b72540c9ad06b5c68aadb1b4fa8cb0b716260bf2/goldman/stores/postgres/store.py#L101-L123 |
sassoo/goldman | goldman/stores/postgres/store.py | Store.field_cols | def field_cols(model):
""" Get the models columns in a friendly SQL format
This will be a string of comma separated field
names prefixed by the models resource type.
TIP: to_manys are not located on the table in Postgres
& are instead application references, so any referen... | python | def field_cols(model):
""" Get the models columns in a friendly SQL format
This will be a string of comma separated field
names prefixed by the models resource type.
TIP: to_manys are not located on the table in Postgres
& are instead application references, so any referen... | [
"def",
"field_cols",
"(",
"model",
")",
":",
"to_many",
"=",
"model",
".",
"to_many",
"cols",
"=",
"[",
"f",
"for",
"f",
"in",
"model",
".",
"all_fields",
"if",
"f",
"not",
"in",
"to_many",
"]",
"cols",
"=",
"', '",
".",
"join",
"(",
"cols",
")",
... | Get the models columns in a friendly SQL format
This will be a string of comma separated field
names prefixed by the models resource type.
TIP: to_manys are not located on the table in Postgres
& are instead application references, so any reference
to there column nam... | [
"Get",
"the",
"models",
"columns",
"in",
"a",
"friendly",
"SQL",
"format"
] | train | https://github.com/sassoo/goldman/blob/b72540c9ad06b5c68aadb1b4fa8cb0b716260bf2/goldman/stores/postgres/store.py#L126-L143 |
sassoo/goldman | goldman/stores/postgres/store.py | Store.filters_query | def filters_query(filters):
""" Turn the tuple of filters into SQL WHERE statements
The key (column name) & operator have already been vetted
so they can be trusted but the value could still be evil
so it MUST be a parameterized input!
That is done by creating a param dict wher... | python | def filters_query(filters):
""" Turn the tuple of filters into SQL WHERE statements
The key (column name) & operator have already been vetted
so they can be trusted but the value could still be evil
so it MUST be a parameterized input!
That is done by creating a param dict wher... | [
"def",
"filters_query",
"(",
"filters",
")",
":",
"def",
"_cast_val",
"(",
"filtr",
")",
":",
"\"\"\" Perform any needed casting on the filter value\n\n This could be tasks like including '%' signs at\n certain anchor points based on the filter or\n even wrap... | Turn the tuple of filters into SQL WHERE statements
The key (column name) & operator have already been vetted
so they can be trusted but the value could still be evil
so it MUST be a parameterized input!
That is done by creating a param dict where they key name
& val look like:... | [
"Turn",
"the",
"tuple",
"of",
"filters",
"into",
"SQL",
"WHERE",
"statements"
] | train | https://github.com/sassoo/goldman/blob/b72540c9ad06b5c68aadb1b4fa8cb0b716260bf2/goldman/stores/postgres/store.py#L146-L262 |
sassoo/goldman | goldman/stores/postgres/store.py | Store.sorts_query | def sorts_query(sortables):
""" Turn the Sortables into a SQL ORDER BY query """
stmts = []
for sortable in sortables:
if sortable.desc:
stmts.append('{} DESC'.format(sortable.field))
else:
stmts.append('{} ASC'.format(sortable.field))
... | python | def sorts_query(sortables):
""" Turn the Sortables into a SQL ORDER BY query """
stmts = []
for sortable in sortables:
if sortable.desc:
stmts.append('{} DESC'.format(sortable.field))
else:
stmts.append('{} ASC'.format(sortable.field))
... | [
"def",
"sorts_query",
"(",
"sortables",
")",
":",
"stmts",
"=",
"[",
"]",
"for",
"sortable",
"in",
"sortables",
":",
"if",
"sortable",
".",
"desc",
":",
"stmts",
".",
"append",
"(",
"'{} DESC'",
".",
"format",
"(",
"sortable",
".",
"field",
")",
")",
... | Turn the Sortables into a SQL ORDER BY query | [
"Turn",
"the",
"Sortables",
"into",
"a",
"SQL",
"ORDER",
"BY",
"query"
] | train | https://github.com/sassoo/goldman/blob/b72540c9ad06b5c68aadb1b4fa8cb0b716260bf2/goldman/stores/postgres/store.py#L274-L285 |
sassoo/goldman | goldman/stores/postgres/store.py | Store.create | def create(self, model):
""" Given a model object instance create it """
signals.pre_create.send(model.__class__, model=model)
signals.pre_save.send(model.__class__, model=model)
param = self.to_pg(model)
query = """
INSERT INTO {table} ({dirty_cols})
... | python | def create(self, model):
""" Given a model object instance create it """
signals.pre_create.send(model.__class__, model=model)
signals.pre_save.send(model.__class__, model=model)
param = self.to_pg(model)
query = """
INSERT INTO {table} ({dirty_cols})
... | [
"def",
"create",
"(",
"self",
",",
"model",
")",
":",
"signals",
".",
"pre_create",
".",
"send",
"(",
"model",
".",
"__class__",
",",
"model",
"=",
"model",
")",
"signals",
".",
"pre_save",
".",
"send",
"(",
"model",
".",
"__class__",
",",
"model",
"... | Given a model object instance create it | [
"Given",
"a",
"model",
"object",
"instance",
"create",
"it"
] | train | https://github.com/sassoo/goldman/blob/b72540c9ad06b5c68aadb1b4fa8cb0b716260bf2/goldman/stores/postgres/store.py#L296-L321 |
sassoo/goldman | goldman/stores/postgres/store.py | Store.delete | def delete(self, model):
""" Given a model object instance delete it """
signals.pre_delete.send(model.__class__, model=model)
param = {'rid_value': self.to_pg(model)[model.rid_field]}
query = """
DELETE FROM {table}
WHERE {rid_field} = %(rid_value)s
... | python | def delete(self, model):
""" Given a model object instance delete it """
signals.pre_delete.send(model.__class__, model=model)
param = {'rid_value': self.to_pg(model)[model.rid_field]}
query = """
DELETE FROM {table}
WHERE {rid_field} = %(rid_value)s
... | [
"def",
"delete",
"(",
"self",
",",
"model",
")",
":",
"signals",
".",
"pre_delete",
".",
"send",
"(",
"model",
".",
"__class__",
",",
"model",
"=",
"model",
")",
"param",
"=",
"{",
"'rid_value'",
":",
"self",
".",
"to_pg",
"(",
"model",
")",
"[",
"... | Given a model object instance delete it | [
"Given",
"a",
"model",
"object",
"instance",
"delete",
"it"
] | train | https://github.com/sassoo/goldman/blob/b72540c9ad06b5c68aadb1b4fa8cb0b716260bf2/goldman/stores/postgres/store.py#L323-L345 |
sassoo/goldman | goldman/stores/postgres/store.py | Store.find | def find(self, rtype, key, val):
""" Given a resource type & a single key/val find the model
A single instantiated model object found by the key/val
will be returned if a match is found in the database.
If no record can be found then return None.
WARN: This isn't for complex qu... | python | def find(self, rtype, key, val):
""" Given a resource type & a single key/val find the model
A single instantiated model object found by the key/val
will be returned if a match is found in the database.
If no record can be found then return None.
WARN: This isn't for complex qu... | [
"def",
"find",
"(",
"self",
",",
"rtype",
",",
"key",
",",
"val",
")",
":",
"model",
"=",
"rtype_to_model",
"(",
"rtype",
")",
"param",
"=",
"{",
"'key'",
":",
"key",
",",
"'val'",
":",
"val",
"}",
"query",
"=",
"\"\"\"\n SELECT {cols} FRO... | Given a resource type & a single key/val find the model
A single instantiated model object found by the key/val
will be returned if a match is found in the database.
If no record can be found then return None.
WARN: This isn't for complex queries! Use search() instead.
:return... | [
"Given",
"a",
"resource",
"type",
"&",
"a",
"single",
"key",
"/",
"val",
"find",
"the",
"model"
] | train | https://github.com/sassoo/goldman/blob/b72540c9ad06b5c68aadb1b4fa8cb0b716260bf2/goldman/stores/postgres/store.py#L347-L379 |
sassoo/goldman | goldman/stores/postgres/store.py | Store.query | def query(self, query, param=None):
""" Perform a SQL based query
This will abort on a failure to communicate with
the database.
:query: string query
:params: parameters for the query
:return: RecordList from psycopg2
"""
with self.conn.cursor() as curs... | python | def query(self, query, param=None):
""" Perform a SQL based query
This will abort on a failure to communicate with
the database.
:query: string query
:params: parameters for the query
:return: RecordList from psycopg2
"""
with self.conn.cursor() as curs... | [
"def",
"query",
"(",
"self",
",",
"query",
",",
"param",
"=",
"None",
")",
":",
"with",
"self",
".",
"conn",
".",
"cursor",
"(",
")",
"as",
"curs",
":",
"print",
"'XXX QUERY'",
",",
"curs",
".",
"mogrify",
"(",
"query",
",",
"param",
")",
"try",
... | Perform a SQL based query
This will abort on a failure to communicate with
the database.
:query: string query
:params: parameters for the query
:return: RecordList from psycopg2 | [
"Perform",
"a",
"SQL",
"based",
"query"
] | train | https://github.com/sassoo/goldman/blob/b72540c9ad06b5c68aadb1b4fa8cb0b716260bf2/goldman/stores/postgres/store.py#L381-L407 |
sassoo/goldman | goldman/stores/postgres/store.py | Store.search | def search(self, rtype, **kwargs):
""" Search for the model by assorted criteria
Quite a bit needs to happen for a search processing!
The breakdown is we need to apply the query parameters
where applicable. These include pagination, sorting,
& filtering.
Additionally, ... | python | def search(self, rtype, **kwargs):
""" Search for the model by assorted criteria
Quite a bit needs to happen for a search processing!
The breakdown is we need to apply the query parameters
where applicable. These include pagination, sorting,
& filtering.
Additionally, ... | [
"def",
"search",
"(",
"self",
",",
"rtype",
",",
"*",
"*",
"kwargs",
")",
":",
"model",
"=",
"rtype_to_model",
"(",
"rtype",
")",
"param",
"=",
"{",
"}",
"pages",
"=",
"self",
".",
"pages_query",
"(",
"kwargs",
".",
"get",
"(",
"'pages'",
")",
")",... | Search for the model by assorted criteria
Quite a bit needs to happen for a search processing!
The breakdown is we need to apply the query parameters
where applicable. These include pagination, sorting,
& filtering.
Additionally, models can declare there own static
fil... | [
"Search",
"for",
"the",
"model",
"by",
"assorted",
"criteria"
] | train | https://github.com/sassoo/goldman/blob/b72540c9ad06b5c68aadb1b4fa8cb0b716260bf2/goldman/stores/postgres/store.py#L409-L470 |
sassoo/goldman | goldman/stores/postgres/store.py | Store.update | def update(self, model):
""" Given a model object instance update it """
signals.pre_update.send(model.__class__, model=model)
signals.pre_save.send(model.__class__, model=model)
param = self.to_pg(model)
param['rid_value'] = param[model.rid_field]
query = """
... | python | def update(self, model):
""" Given a model object instance update it """
signals.pre_update.send(model.__class__, model=model)
signals.pre_save.send(model.__class__, model=model)
param = self.to_pg(model)
param['rid_value'] = param[model.rid_field]
query = """
... | [
"def",
"update",
"(",
"self",
",",
"model",
")",
":",
"signals",
".",
"pre_update",
".",
"send",
"(",
"model",
".",
"__class__",
",",
"model",
"=",
"model",
")",
"signals",
".",
"pre_save",
".",
"send",
"(",
"model",
".",
"__class__",
",",
"model",
"... | Given a model object instance update it | [
"Given",
"a",
"model",
"object",
"instance",
"update",
"it"
] | train | https://github.com/sassoo/goldman/blob/b72540c9ad06b5c68aadb1b4fa8cb0b716260bf2/goldman/stores/postgres/store.py#L472-L501 |
pip-services3-python/pip-services3-components-python | pip_services3_components/log/CachedLogger.py | CachedLogger._write | def _write(self, level, correlation_id, ex, message):
"""
Writes a log message to the logger destination.
:param level: a log level.
:param correlation_id: (optional) transaction id to trace execution through call chain.
:param ex: an error object associated with this message.... | python | def _write(self, level, correlation_id, ex, message):
"""
Writes a log message to the logger destination.
:param level: a log level.
:param correlation_id: (optional) transaction id to trace execution through call chain.
:param ex: an error object associated with this message.... | [
"def",
"_write",
"(",
"self",
",",
"level",
",",
"correlation_id",
",",
"ex",
",",
"message",
")",
":",
"error",
"=",
"ErrorDescriptionFactory",
".",
"create",
"(",
"ex",
")",
"if",
"ex",
"!=",
"None",
"else",
"None",
"source",
"=",
"socket",
".",
"get... | Writes a log message to the logger destination.
:param level: a log level.
:param correlation_id: (optional) transaction id to trace execution through call chain.
:param ex: an error object associated with this message.
:param message: a human-readable message to log. | [
"Writes",
"a",
"log",
"message",
"to",
"the",
"logger",
"destination",
"."
] | train | https://github.com/pip-services3-python/pip-services3-components-python/blob/1de9c1bb544cf1891111e9a5f5d67653f62c9b52/pip_services3_components/log/CachedLogger.py#L55-L77 |
pip-services3-python/pip-services3-components-python | pip_services3_components/log/CachedLogger.py | CachedLogger.clear | def clear(self):
"""
Clears (removes) all cached log messages.
"""
self._lock.acquire()
try:
self._cache = []
self._updated = False
finally:
self._lock.release() | python | def clear(self):
"""
Clears (removes) all cached log messages.
"""
self._lock.acquire()
try:
self._cache = []
self._updated = False
finally:
self._lock.release() | [
"def",
"clear",
"(",
"self",
")",
":",
"self",
".",
"_lock",
".",
"acquire",
"(",
")",
"try",
":",
"self",
".",
"_cache",
"=",
"[",
"]",
"self",
".",
"_updated",
"=",
"False",
"finally",
":",
"self",
".",
"_lock",
".",
"release",
"(",
")"
] | Clears (removes) all cached log messages. | [
"Clears",
"(",
"removes",
")",
"all",
"cached",
"log",
"messages",
"."
] | train | https://github.com/pip-services3-python/pip-services3-components-python/blob/1de9c1bb544cf1891111e9a5f5d67653f62c9b52/pip_services3_components/log/CachedLogger.py#L98-L107 |
evfredericksen/pynacea | pynhost/pynhost/regex_range.py | regex_for_range | def regex_for_range(min_, max_):
"""
> regex_for_range(12, 345)
'1[2-9]|[2-9]\d|[1-2]\d{2}|3[0-3]\d|34[0-5]'
"""
positive_subpatterns = []
negative_subpatterns = []
max_ -= 1
if min_ < 0:
min__ = 1
if max_ < 0:
min__ = abs(max_)
max__ = abs(min_)
... | python | def regex_for_range(min_, max_):
"""
> regex_for_range(12, 345)
'1[2-9]|[2-9]\d|[1-2]\d{2}|3[0-3]\d|34[0-5]'
"""
positive_subpatterns = []
negative_subpatterns = []
max_ -= 1
if min_ < 0:
min__ = 1
if max_ < 0:
min__ = abs(max_)
max__ = abs(min_)
... | [
"def",
"regex_for_range",
"(",
"min_",
",",
"max_",
")",
":",
"positive_subpatterns",
"=",
"[",
"]",
"negative_subpatterns",
"=",
"[",
"]",
"max_",
"-=",
"1",
"if",
"min_",
"<",
"0",
":",
"min__",
"=",
"1",
"if",
"max_",
"<",
"0",
":",
"min__",
"=",
... | > regex_for_range(12, 345)
'1[2-9]|[2-9]\d|[1-2]\d{2}|3[0-3]\d|34[0-5]' | [
">",
"regex_for_range",
"(",
"12",
"345",
")",
"1",
"[",
"2",
"-",
"9",
"]",
"|",
"[",
"2",
"-",
"9",
"]",
"\\",
"d|",
"[",
"1",
"-",
"2",
"]",
"\\",
"d",
"{",
"2",
"}",
"|3",
"[",
"0",
"-",
"3",
"]",
"\\",
"d|34",
"[",
"0",
"-",
"5",... | train | https://github.com/evfredericksen/pynacea/blob/63ee0e6695209048bf2571aa2c3770f502e29b0a/pynhost/pynhost/regex_range.py#L24-L49 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.