nwo stringlengths 5 106 | sha stringlengths 40 40 | path stringlengths 4 174 | language stringclasses 1
value | identifier stringlengths 1 140 | parameters stringlengths 0 87.7k | argument_list stringclasses 1
value | return_statement stringlengths 0 426k | docstring stringlengths 0 64.3k | docstring_summary stringlengths 0 26.3k | docstring_tokens list | function stringlengths 18 4.83M | function_tokens list | url stringlengths 83 304 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
google/grr | 8ad8a4d2c5a93c92729206b7771af19d92d4f915 | grr/core/executables/python_hacks/modify_network.py | python | MsgUser | (msg) | return ('', 'Command not available for this version.', -1) | Sends a message to a user.
Args:
msg: Message to be displaied to user.
Returns:
res which is a tuple of (stdout, stderr, exit_status, time_taken). | Sends a message to a user. | [
"Sends",
"a",
"message",
"to",
"a",
"user",
"."
] | def MsgUser(msg):
"""Sends a message to a user.
Args:
msg: Message to be displaied to user.
Returns:
res which is a tuple of (stdout, stderr, exit_status, time_taken).
"""
msg_tested_versions = ['xp', 'vista', '2008', '2003']
msg_args = ['/c', '%SystemRoot%\\System32\\msg.exe', '*', '/TIME:0']
h... | [
"def",
"MsgUser",
"(",
"msg",
")",
":",
"msg_tested_versions",
"=",
"[",
"'xp'",
",",
"'vista'",
",",
"'2008'",
",",
"'2003'",
"]",
"msg_args",
"=",
"[",
"'/c'",
",",
"'%SystemRoot%\\\\System32\\\\msg.exe'",
",",
"'*'",
",",
"'/TIME:0'",
"]",
"host_version",
... | https://github.com/google/grr/blob/8ad8a4d2c5a93c92729206b7771af19d92d4f915/grr/core/executables/python_hacks/modify_network.py#L76-L98 | |
soeaver/Pytorch_Mask_RCNN | aaee46490340cec83c2fbd72471c4020786c5266 | lib/pycocotools/coco.py | python | COCO.getImgIds | (self, imgIds=[], catIds=[]) | return list(ids) | Get img ids that satisfy given filter conditions.
:param imgIds (int array) : get imgs for given ids
:param catIds (int array) : get imgs with all given cats
:return: ids (int array) : integer array of img ids | Get img ids that satisfy given filter conditions.
:param imgIds (int array) : get imgs for given ids
:param catIds (int array) : get imgs with all given cats
:return: ids (int array) : integer array of img ids | [
"Get",
"img",
"ids",
"that",
"satisfy",
"given",
"filter",
"conditions",
".",
":",
"param",
"imgIds",
"(",
"int",
"array",
")",
":",
"get",
"imgs",
"for",
"given",
"ids",
":",
"param",
"catIds",
"(",
"int",
"array",
")",
":",
"get",
"imgs",
"with",
"... | def getImgIds(self, imgIds=[], catIds=[]):
'''
Get img ids that satisfy given filter conditions.
:param imgIds (int array) : get imgs for given ids
:param catIds (int array) : get imgs with all given cats
:return: ids (int array) : integer array of img ids
'''
im... | [
"def",
"getImgIds",
"(",
"self",
",",
"imgIds",
"=",
"[",
"]",
",",
"catIds",
"=",
"[",
"]",
")",
":",
"imgIds",
"=",
"imgIds",
"if",
"type",
"(",
"imgIds",
")",
"==",
"list",
"else",
"[",
"imgIds",
"]",
"catIds",
"=",
"catIds",
"if",
"type",
"("... | https://github.com/soeaver/Pytorch_Mask_RCNN/blob/aaee46490340cec83c2fbd72471c4020786c5266/lib/pycocotools/coco.py#L174-L193 | |
erdewit/ib_insync | 9674fe974c07ca3afaf70673ae296f1d19f028dc | ib_insync/ib.py | python | IB.managedAccounts | (self) | return list(self.wrapper.accounts) | List of account names. | List of account names. | [
"List",
"of",
"account",
"names",
"."
] | def managedAccounts(self) -> List[str]:
"""List of account names."""
return list(self.wrapper.accounts) | [
"def",
"managedAccounts",
"(",
"self",
")",
"->",
"List",
"[",
"str",
"]",
":",
"return",
"list",
"(",
"self",
".",
"wrapper",
".",
"accounts",
")"
] | https://github.com/erdewit/ib_insync/blob/9674fe974c07ca3afaf70673ae296f1d19f028dc/ib_insync/ib.py#L375-L377 | |
donnemartin/data-science-ipython-notebooks | 5b3c00d462c6e9200315afe46d0093948621eb95 | scikit-learn/fig_code/data.py | python | sample_light_curve | (phased=True) | return (t, y, dy) | [] | def sample_light_curve(phased=True):
from astroML.datasets import fetch_LINEAR_sample
data = fetch_LINEAR_sample()
t, y, dy = data[18525697].T
if phased:
P_best = 0.580313015651
t /= P_best
return (t, y, dy) | [
"def",
"sample_light_curve",
"(",
"phased",
"=",
"True",
")",
":",
"from",
"astroML",
".",
"datasets",
"import",
"fetch_LINEAR_sample",
"data",
"=",
"fetch_LINEAR_sample",
"(",
")",
"t",
",",
"y",
",",
"dy",
"=",
"data",
"[",
"18525697",
"]",
".",
"T",
"... | https://github.com/donnemartin/data-science-ipython-notebooks/blob/5b3c00d462c6e9200315afe46d0093948621eb95/scikit-learn/fig_code/data.py#L25-L34 | |||
mozillazg/pypy | 2ff5cd960c075c991389f842c6d59e71cf0cb7d0 | lib-python/2.7/lib-tk/Tkinter.py | python | Misc._displayof | (self, displayof) | return () | Internal function. | Internal function. | [
"Internal",
"function",
"."
] | def _displayof(self, displayof):
"""Internal function."""
if displayof:
return ('-displayof', displayof)
if displayof is None:
return ('-displayof', self._w)
return () | [
"def",
"_displayof",
"(",
"self",
",",
"displayof",
")",
":",
"if",
"displayof",
":",
"return",
"(",
"'-displayof'",
",",
"displayof",
")",
"if",
"displayof",
"is",
"None",
":",
"return",
"(",
"'-displayof'",
",",
"self",
".",
"_w",
")",
"return",
"(",
... | https://github.com/mozillazg/pypy/blob/2ff5cd960c075c991389f842c6d59e71cf0cb7d0/lib-python/2.7/lib-tk/Tkinter.py#L1151-L1157 | |
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_vendored_deps/library/oc_obj.py | python | Yedit.separator | (self) | return self._separator | getter method for separator | getter method for separator | [
"getter",
"method",
"for",
"separator"
] | def separator(self):
''' getter method for separator '''
return self._separator | [
"def",
"separator",
"(",
"self",
")",
":",
"return",
"self",
".",
"_separator"
] | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_vendored_deps/library/oc_obj.py#L191-L193 | |
libtcod/python-tcod | e12c4172baa9efdfd74aff6ee9bab8454a835248 | tcod/libtcodpy.py | python | map_is_transparent | (m: tcod.map.Map, x: int, y: int) | return bool(lib.TCOD_map_is_transparent(m.map_c, x, y)) | .. note::
This function is slow.
.. deprecated:: 4.5
Use :any:`tcod.map.Map.transparent` to check this property. | .. note::
This function is slow.
.. deprecated:: 4.5
Use :any:`tcod.map.Map.transparent` to check this property. | [
"..",
"note",
"::",
"This",
"function",
"is",
"slow",
".",
"..",
"deprecated",
"::",
"4",
".",
"5",
"Use",
":",
"any",
":",
"tcod",
".",
"map",
".",
"Map",
".",
"transparent",
"to",
"check",
"this",
"property",
"."
] | def map_is_transparent(m: tcod.map.Map, x: int, y: int) -> bool:
"""
.. note::
This function is slow.
.. deprecated:: 4.5
Use :any:`tcod.map.Map.transparent` to check this property.
"""
return bool(lib.TCOD_map_is_transparent(m.map_c, x, y)) | [
"def",
"map_is_transparent",
"(",
"m",
":",
"tcod",
".",
"map",
".",
"Map",
",",
"x",
":",
"int",
",",
"y",
":",
"int",
")",
"->",
"bool",
":",
"return",
"bool",
"(",
"lib",
".",
"TCOD_map_is_transparent",
"(",
"m",
".",
"map_c",
",",
"x",
",",
"... | https://github.com/libtcod/python-tcod/blob/e12c4172baa9efdfd74aff6ee9bab8454a835248/tcod/libtcodpy.py#L3299-L3306 | |
openedx/ecommerce | db6c774e239e5aa65e5a6151995073d364e8c896 | ecommerce/enterprise/conditions.py | python | EnterpriseCustomerCondition.is_satisfied | (self, offer, basket) | return True | Determines if a user is eligible for an enterprise customer offer
based on their association with the enterprise customer.
It also filter out the offer if the `enterprise_customer_catalog_uuid`
value set on the offer condition does not match with the basket catalog
value when explicitly... | Determines if a user is eligible for an enterprise customer offer
based on their association with the enterprise customer. | [
"Determines",
"if",
"a",
"user",
"is",
"eligible",
"for",
"an",
"enterprise",
"customer",
"offer",
"based",
"on",
"their",
"association",
"with",
"the",
"enterprise",
"customer",
"."
] | def is_satisfied(self, offer, basket): # pylint: disable=unused-argument
"""
Determines if a user is eligible for an enterprise customer offer
based on their association with the enterprise customer.
It also filter out the offer if the `enterprise_customer_catalog_uuid`
value s... | [
"def",
"is_satisfied",
"(",
"self",
",",
"offer",
",",
"basket",
")",
":",
"# pylint: disable=unused-argument",
"if",
"not",
"basket",
".",
"owner",
":",
"# An anonymous user is never linked to any EnterpriseCustomer.",
"return",
"False",
"enterprise_in_condition",
"=",
"... | https://github.com/openedx/ecommerce/blob/db6c774e239e5aa65e5a6151995073d364e8c896/ecommerce/enterprise/conditions.py#L108-L285 | |
biopython/biopython | 2dd97e71762af7b046d7f7f8a4f1e38db6b06c86 | Bio/MarkovModel.py | python | MarkovModel.__str__ | (self) | return handle.read() | Create a string representation of the MarkovModel object. | Create a string representation of the MarkovModel object. | [
"Create",
"a",
"string",
"representation",
"of",
"the",
"MarkovModel",
"object",
"."
] | def __str__(self):
"""Create a string representation of the MarkovModel object."""
from io import StringIO
handle = StringIO()
save(self, handle)
handle.seek(0)
return handle.read() | [
"def",
"__str__",
"(",
"self",
")",
":",
"from",
"io",
"import",
"StringIO",
"handle",
"=",
"StringIO",
"(",
")",
"save",
"(",
"self",
",",
"handle",
")",
"handle",
".",
"seek",
"(",
"0",
")",
"return",
"handle",
".",
"read",
"(",
")"
] | https://github.com/biopython/biopython/blob/2dd97e71762af7b046d7f7f8a4f1e38db6b06c86/Bio/MarkovModel.py#L81-L88 | |
golismero/golismero | 7d605b937e241f51c1ca4f47b20f755eeefb9d76 | thirdparty_libs/nltk/app/wordnet_app.py | python | page_from_word | (word) | return page_from_reference(Reference(word)) | Return a HTML page for the given word.
:param word: The currently active word
:type word: str
:return: A tuple (page,word), where page is the new current HTML page
to be sent to the browser and
word is the new current word
:rtype: A tuple (str,str) | Return a HTML page for the given word. | [
"Return",
"a",
"HTML",
"page",
"for",
"the",
"given",
"word",
"."
] | def page_from_word(word):
"""
Return a HTML page for the given word.
:param word: The currently active word
:type word: str
:return: A tuple (page,word), where page is the new current HTML page
to be sent to the browser and
word is the new current word
:rtype: A tuple ... | [
"def",
"page_from_word",
"(",
"word",
")",
":",
"return",
"page_from_reference",
"(",
"Reference",
"(",
"word",
")",
")"
] | https://github.com/golismero/golismero/blob/7d605b937e241f51c1ca4f47b20f755eeefb9d76/thirdparty_libs/nltk/app/wordnet_app.py#L739-L750 | |
etetoolkit/ete | 2b207357dc2a40ccad7bfd8f54964472c72e4726 | ete3/treeview/faces.py | python | ProfileFace.draw_bar_profile | (self) | [] | def draw_bar_profile(self):
# Calculate vector
mean_vector = self.node.profile
deviation_vector = self.node.deviation
# If no vector, skip
if mean_vector is None:
return
colors = self.get_color_gradient()
vlength = len(mean_vector)
# pixels p... | [
"def",
"draw_bar_profile",
"(",
"self",
")",
":",
"# Calculate vector",
"mean_vector",
"=",
"self",
".",
"node",
".",
"profile",
"deviation_vector",
"=",
"self",
".",
"node",
".",
"deviation",
"# If no vector, skip",
"if",
"mean_vector",
"is",
"None",
":",
"retu... | https://github.com/etetoolkit/ete/blob/2b207357dc2a40ccad7bfd8f54964472c72e4726/ete3/treeview/faces.py#L530-L616 | ||||
naftaliharris/tauthon | 5587ceec329b75f7caf6d65a036db61ac1bae214 | Lib/_abcoll.py | python | MutableSet.clear | (self) | This is slow (creates N new iterators!) but effective. | This is slow (creates N new iterators!) but effective. | [
"This",
"is",
"slow",
"(",
"creates",
"N",
"new",
"iterators!",
")",
"but",
"effective",
"."
] | def clear(self):
"""This is slow (creates N new iterators!) but effective."""
try:
while True:
self.pop()
except KeyError:
pass | [
"def",
"clear",
"(",
"self",
")",
":",
"try",
":",
"while",
"True",
":",
"self",
".",
"pop",
"(",
")",
"except",
"KeyError",
":",
"pass"
] | https://github.com/naftaliharris/tauthon/blob/5587ceec329b75f7caf6d65a036db61ac1bae214/Lib/_abcoll.py#L489-L495 | ||
IronLanguages/ironpython3 | 7a7bb2a872eeab0d1009fc8a6e24dca43f65b693 | Src/StdLib/Lib/mailbox.py | python | MH.__init__ | (self, path, factory=None, create=True) | Initialize an MH instance. | Initialize an MH instance. | [
"Initialize",
"an",
"MH",
"instance",
"."
] | def __init__(self, path, factory=None, create=True):
"""Initialize an MH instance."""
Mailbox.__init__(self, path, factory, create)
if not os.path.exists(self._path):
if create:
os.mkdir(self._path, 0o700)
os.close(os.open(os.path.join(self._path, '.mh... | [
"def",
"__init__",
"(",
"self",
",",
"path",
",",
"factory",
"=",
"None",
",",
"create",
"=",
"True",
")",
":",
"Mailbox",
".",
"__init__",
"(",
"self",
",",
"path",
",",
"factory",
",",
"create",
")",
"if",
"not",
"os",
".",
"path",
".",
"exists",... | https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/mailbox.py#L933-L943 | ||
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/setuptools/_vendor/pyparsing.py | python | Regex.__init__ | ( self, pattern, flags=0) | The parameters C{pattern} and C{flags} are passed to the C{re.compile()} function as-is. See the Python C{re} module for an explanation of the acceptable patterns and flags. | The parameters C{pattern} and C{flags} are passed to the C{re.compile()} function as-is. See the Python C{re} module for an explanation of the acceptable patterns and flags. | [
"The",
"parameters",
"C",
"{",
"pattern",
"}",
"and",
"C",
"{",
"flags",
"}",
"are",
"passed",
"to",
"the",
"C",
"{",
"re",
".",
"compile",
"()",
"}",
"function",
"as",
"-",
"is",
".",
"See",
"the",
"Python",
"C",
"{",
"re",
"}",
"module",
"for",... | def __init__( self, pattern, flags=0):
"""The parameters C{pattern} and C{flags} are passed to the C{re.compile()} function as-is. See the Python C{re} module for an explanation of the acceptable patterns and flags."""
super(Regex,self).__init__()
if isinstance(pattern, basestring):
... | [
"def",
"__init__",
"(",
"self",
",",
"pattern",
",",
"flags",
"=",
"0",
")",
":",
"super",
"(",
"Regex",
",",
"self",
")",
".",
"__init__",
"(",
")",
"if",
"isinstance",
"(",
"pattern",
",",
"basestring",
")",
":",
"if",
"not",
"pattern",
":",
"war... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/setuptools/_vendor/pyparsing.py#L2738-L2770 | ||
openedx/edx-platform | 68dd185a0ab45862a2a61e0f803d7e03d2be71b5 | lms/djangoapps/discussion/rest_api/api.py | python | delete_thread | (request, thread_id) | Delete a thread.
Arguments:
request: The django request object used for build_absolute_uri and
determining the requesting user.
thread_id: The id for the thread to delete
Raises:
PermissionDenied: if user does not have permission to delete thread | Delete a thread. | [
"Delete",
"a",
"thread",
"."
] | def delete_thread(request, thread_id):
"""
Delete a thread.
Arguments:
request: The django request object used for build_absolute_uri and
determining the requesting user.
thread_id: The id for the thread to delete
Raises:
PermissionDenied: if user does not have per... | [
"def",
"delete_thread",
"(",
"request",
",",
"thread_id",
")",
":",
"cc_thread",
",",
"context",
"=",
"_get_thread_and_context",
"(",
"request",
",",
"thread_id",
")",
"if",
"can_delete",
"(",
"cc_thread",
",",
"context",
")",
":",
"cc_thread",
".",
"delete",
... | https://github.com/openedx/edx-platform/blob/68dd185a0ab45862a2a61e0f803d7e03d2be71b5/lms/djangoapps/discussion/rest_api/api.py#L1296-L1317 | ||
sherlock-project/sherlock | a3e2f7c214509046c6f92ca4b3a755ef1763afa1 | sherlock/result.py | python | QueryResult.__str__ | (self) | return status | Convert Object To String.
Keyword Arguments:
self -- This object.
Return Value:
Nicely formatted string to get information about this object. | Convert Object To String. | [
"Convert",
"Object",
"To",
"String",
"."
] | def __str__(self):
"""Convert Object To String.
Keyword Arguments:
self -- This object.
Return Value:
Nicely formatted string to get information about this object.
"""
status = str(self.status)
if self.context is not None:
#... | [
"def",
"__str__",
"(",
"self",
")",
":",
"status",
"=",
"str",
"(",
"self",
".",
"status",
")",
"if",
"self",
".",
"context",
"is",
"not",
"None",
":",
"# There is extra context information available about the results.",
"# Append it to the normal response text.",
"st... | https://github.com/sherlock-project/sherlock/blob/a3e2f7c214509046c6f92ca4b3a755ef1763afa1/sherlock/result.py#L73-L88 | |
JaniceWuo/MovieRecommend | 4c86db64ca45598917d304f535413df3bc9fea65 | movierecommend/venv1/Lib/site-packages/django/template/loader_tags.py | python | BlockNode.super | (self) | return '' | [] | def super(self):
if not hasattr(self, 'context'):
raise TemplateSyntaxError(
"'%s' object has no attribute 'context'. Did you use "
"{{ block.super }} in a base template?" % self.__class__.__name__
)
render_context = self.context.render_context
... | [
"def",
"super",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'context'",
")",
":",
"raise",
"TemplateSyntaxError",
"(",
"\"'%s' object has no attribute 'context'. Did you use \"",
"\"{{ block.super }} in a base template?\"",
"%",
"self",
".",
"__cla... | https://github.com/JaniceWuo/MovieRecommend/blob/4c86db64ca45598917d304f535413df3bc9fea65/movierecommend/venv1/Lib/site-packages/django/template/loader_tags.py#L77-L87 | |||
Pymol-Scripts/Pymol-script-repo | bcd7bb7812dc6db1595953dfa4471fa15fb68c77 | modules/pdb2pqr/contrib/ZSI-2.1-a1/ZSI/wstools/XMLSchema.py | python | DOMAdapter.__init__ | (self, node=None) | Reset all instance variables.
element -- DOM document, node, or None | Reset all instance variables.
element -- DOM document, node, or None | [
"Reset",
"all",
"instance",
"variables",
".",
"element",
"--",
"DOM",
"document",
"node",
"or",
"None"
] | def __init__(self, node=None):
"""Reset all instance variables.
element -- DOM document, node, or None
"""
if hasattr(node, 'documentElement'):
self.__node = node.documentElement
else:
self.__node = node
self.__attributes = None | [
"def",
"__init__",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"if",
"hasattr",
"(",
"node",
",",
"'documentElement'",
")",
":",
"self",
".",
"__node",
"=",
"node",
".",
"documentElement",
"else",
":",
"self",
".",
"__node",
"=",
"node",
"self",
... | https://github.com/Pymol-Scripts/Pymol-script-repo/blob/bcd7bb7812dc6db1595953dfa4471fa15fb68c77/modules/pdb2pqr/contrib/ZSI-2.1-a1/ZSI/wstools/XMLSchema.py#L224-L232 | ||
brianwrf/hackUtils | 168123350d93b040fa0c437c9d59faf8fa65d8e6 | bs4/element.py | python | PageElement.insert_before | (self, predecessor) | Makes the given element the immediate predecessor of this one.
The two elements will have the same parent, and the given element
will be immediately before this one. | Makes the given element the immediate predecessor of this one. | [
"Makes",
"the",
"given",
"element",
"the",
"immediate",
"predecessor",
"of",
"this",
"one",
"."
] | def insert_before(self, predecessor):
"""Makes the given element the immediate predecessor of this one.
The two elements will have the same parent, and the given element
will be immediately before this one.
"""
if self is predecessor:
raise ValueError("Can't insert a... | [
"def",
"insert_before",
"(",
"self",
",",
"predecessor",
")",
":",
"if",
"self",
"is",
"predecessor",
":",
"raise",
"ValueError",
"(",
"\"Can't insert an element before itself.\"",
")",
"parent",
"=",
"self",
".",
"parent",
"if",
"parent",
"is",
"None",
":",
"... | https://github.com/brianwrf/hackUtils/blob/168123350d93b040fa0c437c9d59faf8fa65d8e6/bs4/element.py#L340-L357 | ||
mediacloud/backend | d36b489e4fbe6e44950916a04d9543a1d6cd5df0 | apps/common/src/python/mediawords/util/web/user_agent/response/response.py | python | Response.header | (self, name: str) | return self.headers().get(name) | Return HTTP header, e.g. "text/html; charset=UTF-8' for "Content-Type" parameter. | Return HTTP header, e.g. "text/html; charset=UTF-8' for "Content-Type" parameter. | [
"Return",
"HTTP",
"header",
"e",
".",
"g",
".",
"text",
"/",
"html",
";",
"charset",
"=",
"UTF",
"-",
"8",
"for",
"Content",
"-",
"Type",
"parameter",
"."
] | def header(self, name: str) -> Union[str, None]:
"""Return HTTP header, e.g. "text/html; charset=UTF-8' for "Content-Type" parameter."""
name = decode_object_from_bytes_if_needed(name)
if name is None:
raise McUserAgentResponseException("Header's name is None.")
if len(name) ... | [
"def",
"header",
"(",
"self",
",",
"name",
":",
"str",
")",
"->",
"Union",
"[",
"str",
",",
"None",
"]",
":",
"name",
"=",
"decode_object_from_bytes_if_needed",
"(",
"name",
")",
"if",
"name",
"is",
"None",
":",
"raise",
"McUserAgentResponseException",
"("... | https://github.com/mediacloud/backend/blob/d36b489e4fbe6e44950916a04d9543a1d6cd5df0/apps/common/src/python/mediawords/util/web/user_agent/response/response.py#L107-L115 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/tellstick/__init__.py | python | TellstickDevice.turn_on | (self, **kwargs) | Turn the switch on. | Turn the switch on. | [
"Turn",
"the",
"switch",
"on",
"."
] | def turn_on(self, **kwargs):
"""Turn the switch on."""
self._change_device_state(True, self._parse_ha_data(kwargs)) | [
"def",
"turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_change_device_state",
"(",
"True",
",",
"self",
".",
"_parse_ha_data",
"(",
"kwargs",
")",
")"
] | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/tellstick/__init__.py#L248-L250 | ||
owid/covid-19-data | 936aeae6cfbdc0163939ed7bd8ecdbb2582c0a92 | scripts/src/cowidev/vax/cmd/generate_dataset.py | python | Bucket.__init__ | (self, **kwargs) | [] | def __init__(self, **kwargs):
self._dict = kwargs
self.__dict__.update(kwargs) | [
"def",
"__init__",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_dict",
"=",
"kwargs",
"self",
".",
"__dict__",
".",
"update",
"(",
"kwargs",
")"
] | https://github.com/owid/covid-19-data/blob/936aeae6cfbdc0163939ed7bd8ecdbb2582c0a92/scripts/src/cowidev/vax/cmd/generate_dataset.py#L25-L27 | ||||
poppy-project/pypot | c5d384fe23eef9f6ec98467f6f76626cdf20afb9 | pypot/dynamixel/io/io_320.py | python | Dxl320IO.set_joint_mode | (self, ids) | [] | def set_joint_mode(self, ids):
self.set_control_mode(dict(zip(ids, repeat('joint')))) | [
"def",
"set_joint_mode",
"(",
"self",
",",
"ids",
")",
":",
"self",
".",
"set_control_mode",
"(",
"dict",
"(",
"zip",
"(",
"ids",
",",
"repeat",
"(",
"'joint'",
")",
")",
")",
")"
] | https://github.com/poppy-project/pypot/blob/c5d384fe23eef9f6ec98467f6f76626cdf20afb9/pypot/dynamixel/io/io_320.py#L15-L16 | ||||
number5/cloud-init | 19948dbaf40309355e1a2dbef116efb0ce66245c | cloudinit/util.py | python | parse_mount_info | (path, mountinfo_lines, log=LOG, get_mnt_opts=False) | return None | Return the mount information for PATH given the lines from
/proc/$$/mountinfo. | Return the mount information for PATH given the lines from
/proc/$$/mountinfo. | [
"Return",
"the",
"mount",
"information",
"for",
"PATH",
"given",
"the",
"lines",
"from",
"/",
"proc",
"/",
"$$",
"/",
"mountinfo",
"."
] | def parse_mount_info(path, mountinfo_lines, log=LOG, get_mnt_opts=False):
"""Return the mount information for PATH given the lines from
/proc/$$/mountinfo."""
path_elements = [e for e in path.split("/") if e]
devpth = None
fs_type = None
match_mount_point = None
match_mount_point_elements =... | [
"def",
"parse_mount_info",
"(",
"path",
",",
"mountinfo_lines",
",",
"log",
"=",
"LOG",
",",
"get_mnt_opts",
"=",
"False",
")",
":",
"path_elements",
"=",
"[",
"e",
"for",
"e",
"in",
"path",
".",
"split",
"(",
"\"/\"",
")",
"if",
"e",
"]",
"devpth",
... | https://github.com/number5/cloud-init/blob/19948dbaf40309355e1a2dbef116efb0ce66245c/cloudinit/util.py#L2349-L2424 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/Python-2.7.9/Demo/tkinter/guido/svkill.py | python | Kill.do_leave | (self, e) | [] | def do_leave(self, e):
e.widget.select_clear('0', 'end') | [
"def",
"do_leave",
"(",
"self",
",",
"e",
")",
":",
"e",
".",
"widget",
".",
"select_clear",
"(",
"'0'",
",",
"'end'",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Demo/tkinter/guido/svkill.py#L59-L60 | ||||
google-research/meta-dataset | c67dd2bb66fb2a4ce7e4e9906878e13d9b851eb5 | meta_dataset/data/utils.py | python | get_label_counts | (labels) | return counts | Creates a JSON compatible dictionary of image per class counts. | Creates a JSON compatible dictionary of image per class counts. | [
"Creates",
"a",
"JSON",
"compatible",
"dictionary",
"of",
"image",
"per",
"class",
"counts",
"."
] | def get_label_counts(labels):
"""Creates a JSON compatible dictionary of image per class counts."""
# JSON does not support integer keys.
counts = {str(k): v for k, v in collections.Counter(labels.numpy()).items()}
return counts | [
"def",
"get_label_counts",
"(",
"labels",
")",
":",
"# JSON does not support integer keys.",
"counts",
"=",
"{",
"str",
"(",
"k",
")",
":",
"v",
"for",
"k",
",",
"v",
"in",
"collections",
".",
"Counter",
"(",
"labels",
".",
"numpy",
"(",
")",
")",
".",
... | https://github.com/google-research/meta-dataset/blob/c67dd2bb66fb2a4ce7e4e9906878e13d9b851eb5/meta_dataset/data/utils.py#L32-L36 | |
NiaOrg/NiaPy | 08f24ffc79fe324bc9c66ee7186ef98633026005 | niapy/problems/styblinski_tang.py | python | StyblinskiTang.latex_code | () | return r'''$f(\mathbf{x}) = \frac{1}{2} \sum_{i=1}^D \left(
x_i^4 - 16x_i^2 + 5x_i \right) $''' | r"""Return the latex code of the problem.
Returns:
str: Latex code. | r"""Return the latex code of the problem. | [
"r",
"Return",
"the",
"latex",
"code",
"of",
"the",
"problem",
"."
] | def latex_code():
r"""Return the latex code of the problem.
Returns:
str: Latex code.
"""
return r'''$f(\mathbf{x}) = \frac{1}{2} \sum_{i=1}^D \left(
x_i^4 - 16x_i^2 + 5x_i \right) $''' | [
"def",
"latex_code",
"(",
")",
":",
"return",
"r'''$f(\\mathbf{x}) = \\frac{1}{2} \\sum_{i=1}^D \\left(\n x_i^4 - 16x_i^2 + 5x_i \\right) $'''"
] | https://github.com/NiaOrg/NiaPy/blob/08f24ffc79fe324bc9c66ee7186ef98633026005/niapy/problems/styblinski_tang.py#L66-L74 | |
pyqt/examples | 843bb982917cecb2350b5f6d7f42c9b7fb142ec1 | src/pyqt-official/opengl/overpainting.py | python | GLWidget.animate | (self) | [] | def animate(self):
for bubble in self.bubbles:
bubble.move(self.rect())
self.update() | [
"def",
"animate",
"(",
"self",
")",
":",
"for",
"bubble",
"in",
"self",
".",
"bubbles",
":",
"bubble",
".",
"move",
"(",
"self",
".",
"rect",
"(",
")",
")",
"self",
".",
"update",
"(",
")"
] | https://github.com/pyqt/examples/blob/843bb982917cecb2350b5f6d7f42c9b7fb142ec1/src/pyqt-official/opengl/overpainting.py#L328-L332 | ||||
dmlc/dgl | 8d14a739bc9e446d6c92ef83eafe5782398118de | python/dgl/_deprecate/graph.py | python | DGLBaseGraph.idtype | (self) | return getattr(F, self._graph.dtype) | Return the dtype of the graph index
Returns
---------
backend dtype object
th.int32/th.int64 or tf.int32/tf.int64 etc. | Return the dtype of the graph index | [
"Return",
"the",
"dtype",
"of",
"the",
"graph",
"index"
] | def idtype(self):
"""Return the dtype of the graph index
Returns
---------
backend dtype object
th.int32/th.int64 or tf.int32/tf.int64 etc.
"""
return getattr(F, self._graph.dtype) | [
"def",
"idtype",
"(",
"self",
")",
":",
"return",
"getattr",
"(",
"F",
",",
"self",
".",
"_graph",
".",
"dtype",
")"
] | https://github.com/dmlc/dgl/blob/8d14a739bc9e446d6c92ef83eafe5782398118de/python/dgl/_deprecate/graph.py#L801-L809 | |
scipy-lectures/scipy-lecture-notes | 7c91eb4afc4b7f0c77bd022e3bd0c33a4c9a1f50 | advanced/debugging/to_debug_solution.py | python | apply_optimizer | (optimizer, func, a, b) | return optimizer(func, a, b, full_output=True)[1].function_calls | Return the number of function calls given an root-finding optimizer,
a function and upper and lower bounds. | Return the number of function calls given an root-finding optimizer,
a function and upper and lower bounds. | [
"Return",
"the",
"number",
"of",
"function",
"calls",
"given",
"an",
"root",
"-",
"finding",
"optimizer",
"a",
"function",
"and",
"upper",
"and",
"lower",
"bounds",
"."
] | def apply_optimizer(optimizer, func, a, b):
""" Return the number of function calls given an root-finding optimizer,
a function and upper and lower bounds.
"""
return optimizer(func, a, b, full_output=True)[1].function_calls | [
"def",
"apply_optimizer",
"(",
"optimizer",
",",
"func",
",",
"a",
",",
"b",
")",
":",
"return",
"optimizer",
"(",
"func",
",",
"a",
",",
"b",
",",
"full_output",
"=",
"True",
")",
"[",
"1",
"]",
".",
"function_calls"
] | https://github.com/scipy-lectures/scipy-lecture-notes/blob/7c91eb4afc4b7f0c77bd022e3bd0c33a4c9a1f50/advanced/debugging/to_debug_solution.py#L31-L35 | |
pytransitions/transitions | 9663094f4566c016b11563e7a7d6d3802593845c | transitions/core.py | python | Machine.callback | (self, func, event_data) | Trigger a callback function with passed event_data parameters. In case func is a string,
the callable will be resolved from the passed model in event_data. This function is not intended to
be called directly but through state and transition callback definitions.
Args:
func (s... | Trigger a callback function with passed event_data parameters. In case func is a string,
the callable will be resolved from the passed model in event_data. This function is not intended to
be called directly but through state and transition callback definitions.
Args:
func (s... | [
"Trigger",
"a",
"callback",
"function",
"with",
"passed",
"event_data",
"parameters",
".",
"In",
"case",
"func",
"is",
"a",
"string",
"the",
"callable",
"will",
"be",
"resolved",
"from",
"the",
"passed",
"model",
"in",
"event_data",
".",
"This",
"function",
... | def callback(self, func, event_data):
""" Trigger a callback function with passed event_data parameters. In case func is a string,
the callable will be resolved from the passed model in event_data. This function is not intended to
be called directly but through state and transition callb... | [
"def",
"callback",
"(",
"self",
",",
"func",
",",
"event_data",
")",
":",
"func",
"=",
"self",
".",
"resolve_callable",
"(",
"func",
",",
"event_data",
")",
"if",
"self",
".",
"send_event",
":",
"func",
"(",
"event_data",
")",
"else",
":",
"func",
"(",... | https://github.com/pytransitions/transitions/blob/9663094f4566c016b11563e7a7d6d3802593845c/transitions/core.py#L1126-L1144 | ||
serverdensity/sd-agent | 66f0031b6be369c28e69414eb6172b5685a5110e | checks/libs/thread_pool.py | python | Pool.map | (self, func, iterable, chunksize=None) | return self.map_async(func, iterable, chunksize).get() | A parallel equivalent of the map() builtin function. It
blocks till the result is ready.
This method chops the iterable into a number of chunks which
it submits to the process pool as separate tasks. The
(approximate) size of these chunks can be specified by setting
chunksize to... | A parallel equivalent of the map() builtin function. It
blocks till the result is ready. | [
"A",
"parallel",
"equivalent",
"of",
"the",
"map",
"()",
"builtin",
"function",
".",
"It",
"blocks",
"till",
"the",
"result",
"is",
"ready",
"."
] | def map(self, func, iterable, chunksize=None):
"""A parallel equivalent of the map() builtin function. It
blocks till the result is ready.
This method chops the iterable into a number of chunks which
it submits to the process pool as separate tasks. The
(approximate) size of the... | [
"def",
"map",
"(",
"self",
",",
"func",
",",
"iterable",
",",
"chunksize",
"=",
"None",
")",
":",
"return",
"self",
".",
"map_async",
"(",
"func",
",",
"iterable",
",",
"chunksize",
")",
".",
"get",
"(",
")"
] | https://github.com/serverdensity/sd-agent/blob/66f0031b6be369c28e69414eb6172b5685a5110e/checks/libs/thread_pool.py#L102-L110 | |
aiidateam/aiida-core | c743a335480f8bb3a5e4ebd2463a31f9f3b9f9b2 | aiida/transports/transport.py | python | Transport.putfile | (self, localpath, remotepath, *args, **kwargs) | Put a file from local src to remote dst.
src must be an absolute path (dst not necessarily))
:param str localpath: absolute path to local file
:param str remotepath: path to remote file | Put a file from local src to remote dst.
src must be an absolute path (dst not necessarily)) | [
"Put",
"a",
"file",
"from",
"local",
"src",
"to",
"remote",
"dst",
".",
"src",
"must",
"be",
"an",
"absolute",
"path",
"(",
"dst",
"not",
"necessarily",
"))"
] | def putfile(self, localpath, remotepath, *args, **kwargs):
"""
Put a file from local src to remote dst.
src must be an absolute path (dst not necessarily))
:param str localpath: absolute path to local file
:param str remotepath: path to remote file
""" | [
"def",
"putfile",
"(",
"self",
",",
"localpath",
",",
"remotepath",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":"
] | https://github.com/aiidateam/aiida-core/blob/c743a335480f8bb3a5e4ebd2463a31f9f3b9f9b2/aiida/transports/transport.py#L625-L632 | ||
plotly/plotly.py | cfad7862594b35965c0e000813bd7805e8494a5b | packages/python/plotly/plotly/graph_objs/_heatmapgl.py | python | Heatmapgl.uirevision | (self) | return self["uirevision"] | Controls persistence of some user-driven changes to the trace:
`constraintrange` in `parcoords` traces, as well as some
`editable: true` modifications such as `name` and
`colorbar.title`. Defaults to `layout.uirevision`. Note that
other user-driven trace attribute changes are controlled ... | Controls persistence of some user-driven changes to the trace:
`constraintrange` in `parcoords` traces, as well as some
`editable: true` modifications such as `name` and
`colorbar.title`. Defaults to `layout.uirevision`. Note that
other user-driven trace attribute changes are controlled ... | [
"Controls",
"persistence",
"of",
"some",
"user",
"-",
"driven",
"changes",
"to",
"the",
"trace",
":",
"constraintrange",
"in",
"parcoords",
"traces",
"as",
"well",
"as",
"some",
"editable",
":",
"true",
"modifications",
"such",
"as",
"name",
"and",
"colorbar",... | def uirevision(self):
"""
Controls persistence of some user-driven changes to the trace:
`constraintrange` in `parcoords` traces, as well as some
`editable: true` modifications such as `name` and
`colorbar.title`. Defaults to `layout.uirevision`. Note that
other user-driv... | [
"def",
"uirevision",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"uirevision\"",
"]"
] | https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/_heatmapgl.py#L960-L984 | |
tensortrade-org/tensortrade | 019128713afd37590e3958a56db3ab0a3e6abe4c | tensortrade/env/default/renderers.py | python | MatplotlibTradingChart.save | (self) | Saves the rendering of the `TradingEnv`. | Saves the rendering of the `TradingEnv`. | [
"Saves",
"the",
"rendering",
"of",
"the",
"TradingEnv",
"."
] | def save(self) -> None:
"""Saves the rendering of the `TradingEnv`.
"""
if not self._save_format:
return
else:
valid_formats = ['png', 'jpeg', 'svg', 'pdf']
_check_valid_format(valid_formats, self._save_format)
_check_path(self._path)
... | [
"def",
"save",
"(",
"self",
")",
"->",
"None",
":",
"if",
"not",
"self",
".",
"_save_format",
":",
"return",
"else",
":",
"valid_formats",
"=",
"[",
"'png'",
",",
"'jpeg'",
",",
"'svg'",
",",
"'pdf'",
"]",
"_check_valid_format",
"(",
"valid_formats",
","... | https://github.com/tensortrade-org/tensortrade/blob/019128713afd37590e3958a56db3ab0a3e6abe4c/tensortrade/env/default/renderers.py#L734-L746 | ||
eshapard/AnkiHabitica | b0ac7375ab0b2542b72dda801f84b49bd1e61ad2 | AnkiHabitica/logging/handlers.py | python | QueueListener._monitor | (self) | Monitor the queue for records, and ask the handler
to deal with them.
This method runs on a separate, internal thread.
The thread will terminate if it sees a sentinel object in the queue. | Monitor the queue for records, and ask the handler
to deal with them. | [
"Monitor",
"the",
"queue",
"for",
"records",
"and",
"ask",
"the",
"handler",
"to",
"deal",
"with",
"them",
"."
] | def _monitor(self):
"""
Monitor the queue for records, and ask the handler
to deal with them.
This method runs on a separate, internal thread.
The thread will terminate if it sees a sentinel object in the queue.
"""
q = self.queue
has_task_done = hasattr(... | [
"def",
"_monitor",
"(",
"self",
")",
":",
"q",
"=",
"self",
".",
"queue",
"has_task_done",
"=",
"hasattr",
"(",
"q",
",",
"'task_done'",
")",
"while",
"True",
":",
"try",
":",
"record",
"=",
"self",
".",
"dequeue",
"(",
"True",
")",
"if",
"record",
... | https://github.com/eshapard/AnkiHabitica/blob/b0ac7375ab0b2542b72dda801f84b49bd1e61ad2/AnkiHabitica/logging/handlers.py#L1464-L1483 | ||
arakashic/chromatica.nvim | 962f2a18b4d67dd4cd00c67db96bb46f2f5ca5c1 | rplugin/python3/clang/cindex.py | python | TranslationUnit.from_ast_file | (cls, filename, index=None) | return cls(ptr=ptr, index=index) | Create a TranslationUnit instance from a saved AST file.
A previously-saved AST file (provided with -emit-ast or
TranslationUnit.save()) is loaded from the filename specified.
If the file cannot be loaded, a TranslationUnitLoadError will be
raised.
index is optional and is the... | Create a TranslationUnit instance from a saved AST file. | [
"Create",
"a",
"TranslationUnit",
"instance",
"from",
"a",
"saved",
"AST",
"file",
"."
] | def from_ast_file(cls, filename, index=None):
"""Create a TranslationUnit instance from a saved AST file.
A previously-saved AST file (provided with -emit-ast or
TranslationUnit.save()) is loaded from the filename specified.
If the file cannot be loaded, a TranslationUnitLoadError will... | [
"def",
"from_ast_file",
"(",
"cls",
",",
"filename",
",",
"index",
"=",
"None",
")",
":",
"if",
"index",
"is",
"None",
":",
"index",
"=",
"Index",
".",
"create",
"(",
")",
"ptr",
"=",
"conf",
".",
"lib",
".",
"clang_createTranslationUnit",
"(",
"index"... | https://github.com/arakashic/chromatica.nvim/blob/962f2a18b4d67dd4cd00c67db96bb46f2f5ca5c1/rplugin/python3/clang/cindex.py#L2851-L2872 | |
hankcs/HanLP | 6c02812969c4827d74b404c3ad4207f71ca9165a | hanlp/utils/file_read_backwards/file_read_backwards.py | python | FileReadBackwardsIterator.closed | (self) | return self.__fp.closed | The status of the file handler.
:return: True if the file handler is still opened. False otherwise.
Args:
Returns: | The status of the file handler.
:return: True if the file handler is still opened. False otherwise. | [
"The",
"status",
"of",
"the",
"file",
"handler",
".",
":",
"return",
":",
"True",
"if",
"the",
"file",
"handler",
"is",
"still",
"opened",
".",
"False",
"otherwise",
"."
] | def closed(self):
"""The status of the file handler.
:return: True if the file handler is still opened. False otherwise.
Args:
Returns:
"""
return self.__fp.closed | [
"def",
"closed",
"(",
"self",
")",
":",
"return",
"self",
".",
"__fp",
".",
"closed"
] | https://github.com/hankcs/HanLP/blob/6c02812969c4827d74b404c3ad4207f71ca9165a/hanlp/utils/file_read_backwards/file_read_backwards.py#L132-L142 | |
WerWolv/EdiZon_CheatsConfigsAndScripts | d16d36c7509c01dca770f402babd83ff2e9ae6e7 | Scripts/lib/python3.5/xml/sax/handler.py | python | ContentHandler.ignorableWhitespace | (self, whitespace) | Receive notification of ignorable whitespace in element content.
Validating Parsers must use this method to report each chunk
of ignorable whitespace (see the W3C XML 1.0 recommendation,
section 2.10): non-validating parsers may also use this method
if they are capable of parsing and us... | Receive notification of ignorable whitespace in element content. | [
"Receive",
"notification",
"of",
"ignorable",
"whitespace",
"in",
"element",
"content",
"."
] | def ignorableWhitespace(self, whitespace):
"""Receive notification of ignorable whitespace in element content.
Validating Parsers must use this method to report each chunk
of ignorable whitespace (see the W3C XML 1.0 recommendation,
section 2.10): non-validating parsers may also use thi... | [
"def",
"ignorableWhitespace",
"(",
"self",
",",
"whitespace",
")",
":"
] | https://github.com/WerWolv/EdiZon_CheatsConfigsAndScripts/blob/d16d36c7509c01dca770f402babd83ff2e9ae6e7/Scripts/lib/python3.5/xml/sax/handler.py#L168-L180 | ||
KalleHallden/AutoTimer | 2d954216700c4930baa154e28dbddc34609af7ce | env/lib/python2.7/site-packages/pip/_vendor/urllib3/packages/rfc3986/_mixin.py | python | URIMixin.authority_is_valid | (self, require=False) | return validators.authority_is_valid(
self.authority,
host=self.host,
require=require,
) | Determine if the authority component is valid.
.. deprecated:: 1.1.0
Use the :class:`~rfc3986.validators.Validator` object instead.
:param bool require:
Set to ``True`` to require the presence of this component.
:returns:
``True`` if the authority is valid.... | Determine if the authority component is valid. | [
"Determine",
"if",
"the",
"authority",
"component",
"is",
"valid",
"."
] | def authority_is_valid(self, require=False):
"""Determine if the authority component is valid.
.. deprecated:: 1.1.0
Use the :class:`~rfc3986.validators.Validator` object instead.
:param bool require:
Set to ``True`` to require the presence of this component.
:... | [
"def",
"authority_is_valid",
"(",
"self",
",",
"require",
"=",
"False",
")",
":",
"warnings",
".",
"warn",
"(",
"\"Please use rfc3986.validators.Validator instead. \"",
"\"This method will be eventually removed.\"",
",",
"DeprecationWarning",
")",
"try",
":",
"self",
".",... | https://github.com/KalleHallden/AutoTimer/blob/2d954216700c4930baa154e28dbddc34609af7ce/env/lib/python2.7/site-packages/pip/_vendor/urllib3/packages/rfc3986/_mixin.py#L125-L151 | |
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_openshift/library/oc_env.py | python | OCEnv.get | (self) | return result | return environment variables | return environment variables | [
"return",
"environment",
"variables"
] | def get(self):
'''return environment variables '''
result = self._get(self.kind, self.name)
if result['returncode'] == 0:
if self.kind == 'dc':
self.resource = DeploymentConfig(content=result['results'][0])
result['results'] = self.resource.get(OCEnv.c... | [
"def",
"get",
"(",
"self",
")",
":",
"result",
"=",
"self",
".",
"_get",
"(",
"self",
".",
"kind",
",",
"self",
".",
"name",
")",
"if",
"result",
"[",
"'returncode'",
"]",
"==",
"0",
":",
"if",
"self",
".",
"kind",
"==",
"'dc'",
":",
"self",
".... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_openshift/library/oc_env.py#L1874-L1881 | |
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/full/lib2to3/btm_utils.py | python | reduce_tree | (node, parent=None) | return new_node | Internal function. Reduces a compiled pattern tree to an
intermediate representation suitable for feeding the
automaton. This also trims off any optional pattern elements(like
[a], a*). | Internal function. Reduces a compiled pattern tree to an
intermediate representation suitable for feeding the
automaton. This also trims off any optional pattern elements(like
[a], a*). | [
"Internal",
"function",
".",
"Reduces",
"a",
"compiled",
"pattern",
"tree",
"to",
"an",
"intermediate",
"representation",
"suitable",
"for",
"feeding",
"the",
"automaton",
".",
"This",
"also",
"trims",
"off",
"any",
"optional",
"pattern",
"elements",
"(",
"like"... | def reduce_tree(node, parent=None):
"""
Internal function. Reduces a compiled pattern tree to an
intermediate representation suitable for feeding the
automaton. This also trims off any optional pattern elements(like
[a], a*).
"""
new_node = None
#switch on the node type
if node.type... | [
"def",
"reduce_tree",
"(",
"node",
",",
"parent",
"=",
"None",
")",
":",
"new_node",
"=",
"None",
"#switch on the node type",
"if",
"node",
".",
"type",
"==",
"syms",
".",
"Matcher",
":",
"#skip",
"node",
"=",
"node",
".",
"children",
"[",
"0",
"]",
"i... | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/lib2to3/btm_utils.py#L103-L234 | |
golismero/golismero | 7d605b937e241f51c1ca4f47b20f755eeefb9d76 | thirdparty_libs/nltk/inference/mace.py | python | MaceCommand.__init__ | (self, goal=None, assumptions=None, max_models=500, model_builder=None) | :param goal: Input expression to prove
:type goal: sem.Expression
:param assumptions: Input expressions to use as assumptions in
the proof.
:type assumptions: list(sem.Expression)
:param max_models: The maximum number of models that Mace will try before
simply ret... | :param goal: Input expression to prove
:type goal: sem.Expression
:param assumptions: Input expressions to use as assumptions in
the proof.
:type assumptions: list(sem.Expression)
:param max_models: The maximum number of models that Mace will try before
simply ret... | [
":",
"param",
"goal",
":",
"Input",
"expression",
"to",
"prove",
":",
"type",
"goal",
":",
"sem",
".",
"Expression",
":",
"param",
"assumptions",
":",
"Input",
"expressions",
"to",
"use",
"as",
"assumptions",
"in",
"the",
"proof",
".",
":",
"type",
"assu... | def __init__(self, goal=None, assumptions=None, max_models=500, model_builder=None):
"""
:param goal: Input expression to prove
:type goal: sem.Expression
:param assumptions: Input expressions to use as assumptions in
the proof.
:type assumptions: list(sem.Expression)... | [
"def",
"__init__",
"(",
"self",
",",
"goal",
"=",
"None",
",",
"assumptions",
"=",
"None",
",",
"max_models",
"=",
"500",
",",
"model_builder",
"=",
"None",
")",
":",
"if",
"model_builder",
"is",
"not",
"None",
":",
"assert",
"isinstance",
"(",
"model_bu... | https://github.com/golismero/golismero/blob/7d605b937e241f51c1ca4f47b20f755eeefb9d76/thirdparty_libs/nltk/inference/mace.py#L31-L47 | ||
openstack/manila | 142990edc027e14839d5deaf4954dd6fc88de15e | manila/share/drivers/netapp/dataontap/cluster_mode/lib_multi_svm.py | python | NetAppCmodeMultiSVMFileStorageLibrary.teardown_server | (self, server_details, security_services=None) | Teardown share server. | Teardown share server. | [
"Teardown",
"share",
"server",
"."
] | def teardown_server(self, server_details, security_services=None):
"""Teardown share server."""
vserver = server_details.get(
'vserver_name') if server_details else None
if not vserver:
LOG.warning("Vserver not specified for share server being "
"... | [
"def",
"teardown_server",
"(",
"self",
",",
"server_details",
",",
"security_services",
"=",
"None",
")",
":",
"vserver",
"=",
"server_details",
".",
"get",
"(",
"'vserver_name'",
")",
"if",
"server_details",
"else",
"None",
"if",
"not",
"vserver",
":",
"LOG",... | https://github.com/openstack/manila/blob/142990edc027e14839d5deaf4954dd6fc88de15e/manila/share/drivers/netapp/dataontap/cluster_mode/lib_multi_svm.py#L459-L476 | ||
xonsh/xonsh | b76d6f994f22a4078f602f8b386f4ec280c8461f | xonsh/platform.py | python | seps | () | return s | String of all path separators. | String of all path separators. | [
"String",
"of",
"all",
"path",
"separators",
"."
] | def seps():
"""String of all path separators."""
s = os.path.sep
if os.path.altsep is not None:
s += os.path.altsep
return s | [
"def",
"seps",
"(",
")",
":",
"s",
"=",
"os",
".",
"path",
".",
"sep",
"if",
"os",
".",
"path",
".",
"altsep",
"is",
"not",
"None",
":",
"s",
"+=",
"os",
".",
"path",
".",
"altsep",
"return",
"s"
] | https://github.com/xonsh/xonsh/blob/b76d6f994f22a4078f602f8b386f4ec280c8461f/xonsh/platform.py#L232-L237 | |
wei-tim/YOWO | b9504a5e0f8806761e4974029887ed7ede83f2f9 | datasets/ava_evaluation/label_map_util.py | python | create_category_index | (categories) | return category_index | Creates dictionary of COCO compatible categories keyed by category id.
Args:
categories: a list of dicts, each of which has the following keys:
'id': (required) an integer id uniquely identifying this category.
'name': (required) string representing category name
e.g., 'cat', 'dog', 'pizza'.
... | Creates dictionary of COCO compatible categories keyed by category id. | [
"Creates",
"dictionary",
"of",
"COCO",
"compatible",
"categories",
"keyed",
"by",
"category",
"id",
"."
] | def create_category_index(categories):
"""Creates dictionary of COCO compatible categories keyed by category id.
Args:
categories: a list of dicts, each of which has the following keys:
'id': (required) an integer id uniquely identifying this category.
'name': (required) string representing categ... | [
"def",
"create_category_index",
"(",
"categories",
")",
":",
"category_index",
"=",
"{",
"}",
"for",
"cat",
"in",
"categories",
":",
"category_index",
"[",
"cat",
"[",
"\"id\"",
"]",
"]",
"=",
"cat",
"return",
"category_index"
] | https://github.com/wei-tim/YOWO/blob/b9504a5e0f8806761e4974029887ed7ede83f2f9/datasets/ava_evaluation/label_map_util.py#L43-L59 | |
HymanLiuTS/flaskTs | 286648286976e85d9b9a5873632331efcafe0b21 | flasky/lib/python2.7/site-packages/pip/_vendor/distlib/metadata.py | python | _best_version | (fields) | return '2.0' | Detect the best version depending on the fields used. | Detect the best version depending on the fields used. | [
"Detect",
"the",
"best",
"version",
"depending",
"on",
"the",
"fields",
"used",
"."
] | def _best_version(fields):
"""Detect the best version depending on the fields used."""
def _has_marker(keys, markers):
for marker in markers:
if marker in keys:
return True
return False
keys = []
for key, value in fields.items():
if value in ([], 'UNK... | [
"def",
"_best_version",
"(",
"fields",
")",
":",
"def",
"_has_marker",
"(",
"keys",
",",
"markers",
")",
":",
"for",
"marker",
"in",
"markers",
":",
"if",
"marker",
"in",
"keys",
":",
"return",
"True",
"return",
"False",
"keys",
"=",
"[",
"]",
"for",
... | https://github.com/HymanLiuTS/flaskTs/blob/286648286976e85d9b9a5873632331efcafe0b21/flasky/lib/python2.7/site-packages/pip/_vendor/distlib/metadata.py#L115-L169 | |
cloudera/impyla | 0c736af4cad2bade9b8e313badc08ec50e81c948 | impala/_thrift_gen/hive_metastore/ThriftHiveMetastore.py | python | get_metastore_db_uuid_result.__repr__ | (self) | return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) | [] | def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) | [
"def",
"__repr__",
"(",
"self",
")",
":",
"L",
"=",
"[",
"'%s=%r'",
"%",
"(",
"key",
",",
"value",
")",
"for",
"key",
",",
"value",
"in",
"self",
".",
"__dict__",
".",
"items",
"(",
")",
"]",
"return",
"'%s(%s)'",
"%",
"(",
"self",
".",
"__class_... | https://github.com/cloudera/impyla/blob/0c736af4cad2bade9b8e313badc08ec50e81c948/impala/_thrift_gen/hive_metastore/ThriftHiveMetastore.py#L34964-L34967 | |||
zyfra/ebonite | b01b662c43709d152940f488574d78ff25f89ecf | src/ebonite/core/objects/wrapper.py | python | WrapperArtifactCollection.bytes_dict | (self) | Calls :meth:`~ebonite.core.objects.wrapper.ModelWrapper.dump` to get model artifacts bytes dict
:return: dict artifact name -> bytes | Calls :meth:`~ebonite.core.objects.wrapper.ModelWrapper.dump` to get model artifacts bytes dict
:return: dict artifact name -> bytes | [
"Calls",
":",
"meth",
":",
"~ebonite",
".",
"core",
".",
"objects",
".",
"wrapper",
".",
"ModelWrapper",
".",
"dump",
"to",
"get",
"model",
"artifacts",
"bytes",
"dict",
":",
"return",
":",
"dict",
"artifact",
"name",
"-",
">",
"bytes"
] | def bytes_dict(self) -> typing.Dict[str, bytes]:
"""
Calls :meth:`~ebonite.core.objects.wrapper.ModelWrapper.dump` to get model artifacts bytes dict
:return: dict artifact name -> bytes
"""
with self.wrapper.dump() as art:
return art.bytes_dict() | [
"def",
"bytes_dict",
"(",
"self",
")",
"->",
"typing",
".",
"Dict",
"[",
"str",
",",
"bytes",
"]",
":",
"with",
"self",
".",
"wrapper",
".",
"dump",
"(",
")",
"as",
"art",
":",
"return",
"art",
".",
"bytes_dict",
"(",
")"
] | https://github.com/zyfra/ebonite/blob/b01b662c43709d152940f488574d78ff25f89ecf/src/ebonite/core/objects/wrapper.py#L280-L286 | ||
kuri65536/python-for-android | 26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891 | python-build/python-libs/gdata/build/lib/gdata/tlslite/integration/SMTP_TLS.py | python | SMTP_TLS.starttls | (self,
username=None, password=None, sharedKey=None,
certChain=None, privateKey=None,
cryptoID=None, protocol=None,
x509Fingerprint=None,
x509TrustList=None, x509CommonName=None,
settings=None) | return (resp, reply) | Puts the connection to the SMTP server into TLS mode.
If the server supports TLS, this will encrypt the rest of the SMTP
session.
For client authentication, use one of these argument
combinations:
- username, password (SRP)
- username, sharedKey (shared-key)
... | Puts the connection to the SMTP server into TLS mode. | [
"Puts",
"the",
"connection",
"to",
"the",
"SMTP",
"server",
"into",
"TLS",
"mode",
"."
] | def starttls(self,
username=None, password=None, sharedKey=None,
certChain=None, privateKey=None,
cryptoID=None, protocol=None,
x509Fingerprint=None,
x509TrustList=None, x509CommonName=None,
settings=None):
"""... | [
"def",
"starttls",
"(",
"self",
",",
"username",
"=",
"None",
",",
"password",
"=",
"None",
",",
"sharedKey",
"=",
"None",
",",
"certChain",
"=",
"None",
",",
"privateKey",
"=",
"None",
",",
"cryptoID",
"=",
"None",
",",
"protocol",
"=",
"None",
",",
... | https://github.com/kuri65536/python-for-android/blob/26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891/python-build/python-libs/gdata/build/lib/gdata/tlslite/integration/SMTP_TLS.py#L10-L114 | |
piergiaj/representation-flow-cvpr19 | b9dcb0a7750732210bccf84dbe6044cc33b48c17 | kinetics_2p1d_model.py | python | Block3D.__init__ | (self, inputs, filters, block_fn, blocks, strides, is_training, name,
data_format='channels_last', non_local=0) | Creates one group of blocks for the ResNet model.
Args:
inputs: `Tensor` of size `[batch, channels, height, width]`.
filters: `int` number of filters for the first convolution of the layer.
block_fn: `function` for the block to use within the model
blocks: `int` number of blocks contained in the ... | Creates one group of blocks for the ResNet model.
Args:
inputs: `Tensor` of size `[batch, channels, height, width]`.
filters: `int` number of filters for the first convolution of the layer.
block_fn: `function` for the block to use within the model
blocks: `int` number of blocks contained in the ... | [
"Creates",
"one",
"group",
"of",
"blocks",
"for",
"the",
"ResNet",
"model",
".",
"Args",
":",
"inputs",
":",
"Tensor",
"of",
"size",
"[",
"batch",
"channels",
"height",
"width",
"]",
".",
"filters",
":",
"int",
"number",
"of",
"filters",
"for",
"the",
... | def __init__(self, inputs, filters, block_fn, blocks, strides, is_training, name,
data_format='channels_last', non_local=0):
"""Creates one group of blocks for the ResNet model.
Args:
inputs: `Tensor` of size `[batch, channels, height, width]`.
filters: `int` number of filters for ... | [
"def",
"__init__",
"(",
"self",
",",
"inputs",
",",
"filters",
",",
"block_fn",
",",
"blocks",
",",
"strides",
",",
"is_training",
",",
"name",
",",
"data_format",
"=",
"'channels_last'",
",",
"non_local",
"=",
"0",
")",
":",
"super",
"(",
"Block3D",
","... | https://github.com/piergiaj/representation-flow-cvpr19/blob/b9dcb0a7750732210bccf84dbe6044cc33b48c17/kinetics_2p1d_model.py#L121-L152 | ||
django-extensions/django-extensions | f67ff680cd6d7264cdce05309b537ac2e1ee4a70 | django_extensions/mongodb/models.py | python | ActivatorModelManager.active | (self) | return super().get_queryset().filter(status=1) | Return active instances of ActivatorModel:
SomeModel.objects.active() | Return active instances of ActivatorModel: | [
"Return",
"active",
"instances",
"of",
"ActivatorModel",
":"
] | def active(self):
"""
Return active instances of ActivatorModel:
SomeModel.objects.active()
"""
return super().get_queryset().filter(status=1) | [
"def",
"active",
"(",
"self",
")",
":",
"return",
"super",
"(",
")",
".",
"get_queryset",
"(",
")",
".",
"filter",
"(",
"status",
"=",
"1",
")"
] | https://github.com/django-extensions/django-extensions/blob/f67ff680cd6d7264cdce05309b537ac2e1ee4a70/django_extensions/mongodb/models.py#L50-L56 | |
KiCad/kicad-library-utils | d55f6966e9d96d313b05368b6d418995d89a78a6 | pcb/rules/G1_7.py | python | Rule.fix | (self) | Proceeds the fixing of the rule, if possible. | Proceeds the fixing of the rule, if possible. | [
"Proceeds",
"the",
"fixing",
"of",
"the",
"rule",
"if",
"possible",
"."
] | def fix(self):
"""
Proceeds the fixing of the rule, if possible.
"""
self.success("Line endings will be corrected on save") | [
"def",
"fix",
"(",
"self",
")",
":",
"self",
".",
"success",
"(",
"\"Line endings will be corrected on save\"",
")"
] | https://github.com/KiCad/kicad-library-utils/blob/d55f6966e9d96d313b05368b6d418995d89a78a6/pcb/rules/G1_7.py#L24-L29 | ||
TobyPDE/FRRN | 20041107a4625106d6acef1dcc903d4352220d3e | dltools/data.py | python | DataProvider.next | (self) | return self._queue.get() | Returns the next batch.
Returns:
A tuple consisting of image and target. | Returns the next batch. | [
"Returns",
"the",
"next",
"batch",
"."
] | def next(self):
"""Returns the next batch.
Returns:
A tuple consisting of image and target.
"""
return self._queue.get() | [
"def",
"next",
"(",
"self",
")",
":",
"return",
"self",
".",
"_queue",
".",
"get",
"(",
")"
] | https://github.com/TobyPDE/FRRN/blob/20041107a4625106d6acef1dcc903d4352220d3e/dltools/data.py#L192-L198 | |
benoitc/offset | b8561635a4cb44a9f47d086163f4d0b58bb8fd74 | offset/core/util.py | python | nanotime | (s=None) | return time.time() * 1000000000 | convert seconds to nanoseconds. If s is None, current time is
returned | convert seconds to nanoseconds. If s is None, current time is
returned | [
"convert",
"seconds",
"to",
"nanoseconds",
".",
"If",
"s",
"is",
"None",
"current",
"time",
"is",
"returned"
] | def nanotime(s=None):
""" convert seconds to nanoseconds. If s is None, current time is
returned """
if s is not None:
return s * 1000000000
return time.time() * 1000000000 | [
"def",
"nanotime",
"(",
"s",
"=",
"None",
")",
":",
"if",
"s",
"is",
"not",
"None",
":",
"return",
"s",
"*",
"1000000000",
"return",
"time",
".",
"time",
"(",
")",
"*",
"1000000000"
] | https://github.com/benoitc/offset/blob/b8561635a4cb44a9f47d086163f4d0b58bb8fd74/offset/core/util.py#L23-L28 | |
lyft/python-blessclient | 437ae7ccee77d3612a25d9a34ae62ae6c7d0b79e | blessclient/client.py | python | get_kmsauth_token | (creds, config, username, cache) | return token | [] | def get_kmsauth_token(creds, config, username, cache):
cache_key = 'kmsauth-{}'.format(config['awsregion'])
kmsauth_cache = cache.get(cache_key)
if kmsauth_cache:
expiration = time.strptime(
kmsauth_cache['Expiration'], '%Y%m%dT%H%M%SZ')
if expiration > time.gmtime() and kmsauth_... | [
"def",
"get_kmsauth_token",
"(",
"creds",
",",
"config",
",",
"username",
",",
"cache",
")",
":",
"cache_key",
"=",
"'kmsauth-{}'",
".",
"format",
"(",
"config",
"[",
"'awsregion'",
"]",
")",
"kmsauth_cache",
"=",
"cache",
".",
"get",
"(",
"cache_key",
")"... | https://github.com/lyft/python-blessclient/blob/437ae7ccee77d3612a25d9a34ae62ae6c7d0b79e/blessclient/client.py#L235-L268 | |||
iclavera/learning_to_adapt | bd7d99ba402521c96631e7d09714128f549db0f1 | learning_to_adapt/mujoco_py/mjtypes.py | python | MjModelWrapper.key_act | (self, value) | [] | def key_act(self, value):
val_ptr = np.array(value, dtype=np.float64).ctypes.data_as(POINTER(c_double))
memmove(self._wrapped.contents.key_act, val_ptr, self.nkey*self.na * sizeof(c_double)) | [
"def",
"key_act",
"(",
"self",
",",
"value",
")",
":",
"val_ptr",
"=",
"np",
".",
"array",
"(",
"value",
",",
"dtype",
"=",
"np",
".",
"float64",
")",
".",
"ctypes",
".",
"data_as",
"(",
"POINTER",
"(",
"c_double",
")",
")",
"memmove",
"(",
"self",... | https://github.com/iclavera/learning_to_adapt/blob/bd7d99ba402521c96631e7d09714128f549db0f1/learning_to_adapt/mujoco_py/mjtypes.py#L5898-L5900 | ||||
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/min/_weakrefset.py | python | WeakSet.__eq__ | (self, other) | return self.data == set(map(ref, other)) | [] | def __eq__(self, other):
if not isinstance(other, self.__class__):
return NotImplemented
return self.data == set(map(ref, other)) | [
"def",
"__eq__",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"isinstance",
"(",
"other",
",",
"self",
".",
"__class__",
")",
":",
"return",
"NotImplemented",
"return",
"self",
".",
"data",
"==",
"set",
"(",
"map",
"(",
"ref",
",",
"other",
")",... | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/min/_weakrefset.py#L174-L177 | |||
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/rings/number_field/number_field_rel.py | python | NumberField_relative.polynomial | (self) | For a relative number field, ``polynomial()`` is deliberately
not implemented. Either :meth:`~relative_polynomial` or
:meth:`~absolute_polynomial` must be used.
EXAMPLES::
sage: K.<a> = NumberFieldTower([x^2 + x + 1, x^3 + x + 1])
sage: K.polynomial()
Trace... | For a relative number field, ``polynomial()`` is deliberately
not implemented. Either :meth:`~relative_polynomial` or
:meth:`~absolute_polynomial` must be used. | [
"For",
"a",
"relative",
"number",
"field",
"polynomial",
"()",
"is",
"deliberately",
"not",
"implemented",
".",
"Either",
":",
"meth",
":",
"~relative_polynomial",
"or",
":",
"meth",
":",
"~absolute_polynomial",
"must",
"be",
"used",
"."
] | def polynomial(self):
"""
For a relative number field, ``polynomial()`` is deliberately
not implemented. Either :meth:`~relative_polynomial` or
:meth:`~absolute_polynomial` must be used.
EXAMPLES::
sage: K.<a> = NumberFieldTower([x^2 + x + 1, x^3 + x + 1])
... | [
"def",
"polynomial",
"(",
"self",
")",
":",
"raise",
"NotImplementedError",
"(",
"\"For a relative number field L you must use either L.relative_polynomial() or L.absolute_polynomial() as appropriate\"",
")"
] | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/rings/number_field/number_field_rel.py#L1924-L1938 | ||
sideeffects/SideFXLabs | 956bc1eef6710882ae8d3a31b4a33dd631a56d5f | scripts/python/sidefxedu.py | python | Quickmarks.listQuickmarks | (self, keyword=SIDEFXEDU_QUICKMARK_KEY) | return qmlist | [] | def listQuickmarks(self, keyword=SIDEFXEDU_QUICKMARK_KEY):
qmlist = [key for key in hou.node('/').userDataDict().keys() if keyword in key]
return qmlist | [
"def",
"listQuickmarks",
"(",
"self",
",",
"keyword",
"=",
"SIDEFXEDU_QUICKMARK_KEY",
")",
":",
"qmlist",
"=",
"[",
"key",
"for",
"key",
"in",
"hou",
".",
"node",
"(",
"'/'",
")",
".",
"userDataDict",
"(",
")",
".",
"keys",
"(",
")",
"if",
"keyword",
... | https://github.com/sideeffects/SideFXLabs/blob/956bc1eef6710882ae8d3a31b4a33dd631a56d5f/scripts/python/sidefxedu.py#L93-L95 | |||
mihaip/mail-trends | 312b5be7f8f0a5933b05c75e229eda8e44c3c920 | mail.py | python | Mail.GetMessageInfos | (self) | return self.__UidFetch(
"ALL",
"(UID FLAGS INTERNALDATE RFC822.SIZE RFC822.HEADER)",
self.__max_messages) | [] | def GetMessageInfos(self):
return self.__UidFetch(
"ALL",
"(UID FLAGS INTERNALDATE RFC822.SIZE RFC822.HEADER)",
self.__max_messages) | [
"def",
"GetMessageInfos",
"(",
"self",
")",
":",
"return",
"self",
".",
"__UidFetch",
"(",
"\"ALL\"",
",",
"\"(UID FLAGS INTERNALDATE RFC822.SIZE RFC822.HEADER)\"",
",",
"self",
".",
"__max_messages",
")"
] | https://github.com/mihaip/mail-trends/blob/312b5be7f8f0a5933b05c75e229eda8e44c3c920/mail.py#L74-L78 | |||
jhpyle/docassemble | b90c84e57af59aa88b3404d44d0b125c70f832cc | docassemble_base/docassemble/base/functions.py | python | single_to_double_newlines | (text) | return re.sub(r'[\n\r]+', r'\n\n', str(text)) | Converts single newlines to double newlines. | Converts single newlines to double newlines. | [
"Converts",
"single",
"newlines",
"to",
"double",
"newlines",
"."
] | def single_to_double_newlines(text):
"""Converts single newlines to double newlines."""
return re.sub(r'[\n\r]+', r'\n\n', str(text)) | [
"def",
"single_to_double_newlines",
"(",
"text",
")",
":",
"return",
"re",
".",
"sub",
"(",
"r'[\\n\\r]+'",
",",
"r'\\n\\n'",
",",
"str",
"(",
"text",
")",
")"
] | https://github.com/jhpyle/docassemble/blob/b90c84e57af59aa88b3404d44d0b125c70f832cc/docassemble_base/docassemble/base/functions.py#L4781-L4783 | |
thiagopena/djangoSIGE | e32186b27bfd8acf21b0fa400e699cb5c73e5433 | djangosige/apps/financeiro/models/lancamento.py | python | Entrada.get_tipo | (self) | return 'Entrada' | [] | def get_tipo(self):
return 'Entrada' | [
"def",
"get_tipo",
"(",
"self",
")",
":",
"return",
"'Entrada'"
] | https://github.com/thiagopena/djangoSIGE/blob/e32186b27bfd8acf21b0fa400e699cb5c73e5433/djangosige/apps/financeiro/models/lancamento.py#L72-L73 | |||
trezor/python-trezor | 2813522b05cef4e0e545a101f8b3559a3183b45b | trezorlib/transport/protocol.py | python | Protocol.__init__ | (self, handle: Handle) | [] | def __init__(self, handle: Handle) -> None:
self.handle = handle
self.session_counter = 0 | [
"def",
"__init__",
"(",
"self",
",",
"handle",
":",
"Handle",
")",
"->",
"None",
":",
"self",
".",
"handle",
"=",
"handle",
"self",
".",
"session_counter",
"=",
"0"
] | https://github.com/trezor/python-trezor/blob/2813522b05cef4e0e545a101f8b3559a3183b45b/trezorlib/transport/protocol.py#L84-L86 | ||||
algorhythms/LeetCode | 3fb14aeea62a960442e47dfde9f964c7ffce32be | 784 Letter Case Permutation.py | python | Solution.letterCasePermutation | (self, S: str) | return [
"".join(e)
for e in self.ret
] | dfs | dfs | [
"dfs"
] | def letterCasePermutation(self, S: str) -> List[str]:
"""
dfs
"""
# S_lst = S.split() # error
S_lst = list(S)
self.dfs([], S_lst, 0)
return [
"".join(e)
for e in self.ret
] | [
"def",
"letterCasePermutation",
"(",
"self",
",",
"S",
":",
"str",
")",
"->",
"List",
"[",
"str",
"]",
":",
"# S_lst = S.split() # error",
"S_lst",
"=",
"list",
"(",
"S",
")",
"self",
".",
"dfs",
"(",
"[",
"]",
",",
"S_lst",
",",
"0",
")",
"return",... | https://github.com/algorhythms/LeetCode/blob/3fb14aeea62a960442e47dfde9f964c7ffce32be/784 Letter Case Permutation.py#L28-L38 | |
celery/django-celery-results | 5f47db6d532733624ca57e68cf2eb328c7be350e | django_celery_results/managers.py | python | ResultManager.delete_expired | (self, expires) | Delete all expired results. | Delete all expired results. | [
"Delete",
"all",
"expired",
"results",
"."
] | def delete_expired(self, expires):
"""Delete all expired results."""
with transaction.atomic():
raw_delete(queryset=self.get_all_expired(expires)) | [
"def",
"delete_expired",
"(",
"self",
",",
"expires",
")",
":",
"with",
"transaction",
".",
"atomic",
"(",
")",
":",
"raw_delete",
"(",
"queryset",
"=",
"self",
".",
"get_all_expired",
"(",
"expires",
")",
")"
] | https://github.com/celery/django-celery-results/blob/5f47db6d532733624ca57e68cf2eb328c7be350e/django_celery_results/managers.py#L88-L91 | ||
peterdsharpe/AeroSandbox | ded68b0465f2bfdcaf4bc90abd8c91be0addcaba | aerosandbox/library/mass_structural.py | python | mass_surface_balsa_monokote_cf | (
chord,
span,
mean_t_over_c=0.08
) | return (monokote_mass + ribs_mass + spar_mass) * 1.2 | Estimates the mass of a lifting surface constructed with balsa-monokote-carbon-fiber construction techniques.
Warning: Not well validated; spar sizing is a guessed scaling and not based on structural analysis.
:param chord: wing mean chord [m]
:param span: wing span [m]
:param mean_t_over_c: wing thickn... | Estimates the mass of a lifting surface constructed with balsa-monokote-carbon-fiber construction techniques.
Warning: Not well validated; spar sizing is a guessed scaling and not based on structural analysis.
:param chord: wing mean chord [m]
:param span: wing span [m]
:param mean_t_over_c: wing thickn... | [
"Estimates",
"the",
"mass",
"of",
"a",
"lifting",
"surface",
"constructed",
"with",
"balsa",
"-",
"monokote",
"-",
"carbon",
"-",
"fiber",
"construction",
"techniques",
".",
"Warning",
":",
"Not",
"well",
"validated",
";",
"spar",
"sizing",
"is",
"a",
"guess... | def mass_surface_balsa_monokote_cf(
chord,
span,
mean_t_over_c=0.08
):
"""
Estimates the mass of a lifting surface constructed with balsa-monokote-carbon-fiber construction techniques.
Warning: Not well validated; spar sizing is a guessed scaling and not based on structural analysis.... | [
"def",
"mass_surface_balsa_monokote_cf",
"(",
"chord",
",",
"span",
",",
"mean_t_over_c",
"=",
"0.08",
")",
":",
"mean_t",
"=",
"chord",
"*",
"mean_t_over_c",
"### Balsa wood + Monokote + a 1\" dia CF tube spar.",
"monokote_mass",
"=",
"0.061",
"*",
"chord",
"*",
"spa... | https://github.com/peterdsharpe/AeroSandbox/blob/ded68b0465f2bfdcaf4bc90abd8c91be0addcaba/aerosandbox/library/mass_structural.py#L197-L227 | |
gee-community/gee_tools | d7b35174933739f3aeee439d622e5fab57b6dd2d | geetools/batch/image.py | python | toAsset | (image, assetPath, name=None, to='Folder', scale=None,
region=None, create=True, verbose=False, **kwargs) | return task | This function can create folders and ImageCollections on the fly.
The rest is the same to Export.image.toAsset. You can pass the same
params as the original function
:param image: the image to upload
:type image: ee.Image
:param assetPath: path to upload the image (only PATH, without
filena... | This function can create folders and ImageCollections on the fly.
The rest is the same to Export.image.toAsset. You can pass the same
params as the original function | [
"This",
"function",
"can",
"create",
"folders",
"and",
"ImageCollections",
"on",
"the",
"fly",
".",
"The",
"rest",
"is",
"the",
"same",
"to",
"Export",
".",
"image",
".",
"toAsset",
".",
"You",
"can",
"pass",
"the",
"same",
"params",
"as",
"the",
"origin... | def toAsset(image, assetPath, name=None, to='Folder', scale=None,
region=None, create=True, verbose=False, **kwargs):
""" This function can create folders and ImageCollections on the fly.
The rest is the same to Export.image.toAsset. You can pass the same
params as the original function
:pa... | [
"def",
"toAsset",
"(",
"image",
",",
"assetPath",
",",
"name",
"=",
"None",
",",
"to",
"=",
"'Folder'",
",",
"scale",
"=",
"None",
",",
"region",
"=",
"None",
",",
"create",
"=",
"True",
",",
"verbose",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
... | https://github.com/gee-community/gee_tools/blob/d7b35174933739f3aeee439d622e5fab57b6dd2d/geetools/batch/image.py#L81-L147 | |
elfi-dev/elfi | 07ac0ed5e81d5d5fb42de63db3cf9ccc9135b88c | elfi/methods/results.py | python | SmcSample.summary | (self, all=False) | Print a verbose summary of contained results.
Parameters
----------
all : bool, optional
Whether to print the summary for all populations separately,
or just the final population (default). | Print a verbose summary of contained results. | [
"Print",
"a",
"verbose",
"summary",
"of",
"contained",
"results",
"."
] | def summary(self, all=False):
"""Print a verbose summary of contained results.
Parameters
----------
all : bool, optional
Whether to print the summary for all populations separately,
or just the final population (default).
"""
super(SmcSample, se... | [
"def",
"summary",
"(",
"self",
",",
"all",
"=",
"False",
")",
":",
"super",
"(",
"SmcSample",
",",
"self",
")",
".",
"summary",
"(",
")",
"if",
"all",
":",
"for",
"i",
",",
"pop",
"in",
"enumerate",
"(",
"self",
".",
"populations",
")",
":",
"pri... | https://github.com/elfi-dev/elfi/blob/07ac0ed5e81d5d5fb42de63db3cf9ccc9135b88c/elfi/methods/results.py#L362-L377 | ||
FederatedAI/FATE | 32540492623568ecd1afcb367360133616e02fa3 | python/federatedml/ensemble/basic_algorithms/decision_tree/hetero/hetero_fast_decision_tree_host.py | python | HeteroFastDecisionTreeHost.layered_mode_fit | (self) | [] | def layered_mode_fit(self):
LOGGER.info('running layered mode')
self.initialize_node_plan()
self.init_compressor_and_sync_gh()
for dep in range(self.max_depth):
tree_action, layer_target_host_id = self.get_node_plan(dep)
# for split point masking
s... | [
"def",
"layered_mode_fit",
"(",
"self",
")",
":",
"LOGGER",
".",
"info",
"(",
"'running layered mode'",
")",
"self",
".",
"initialize_node_plan",
"(",
")",
"self",
".",
"init_compressor_and_sync_gh",
"(",
")",
"for",
"dep",
"in",
"range",
"(",
"self",
".",
"... | https://github.com/FederatedAI/FATE/blob/32540492623568ecd1afcb367360133616e02fa3/python/federatedml/ensemble/basic_algorithms/decision_tree/hetero/hetero_fast_decision_tree_host.py#L482-L525 | ||||
82Flex/DCRM | 9568676a3f7c2c6ddd6ca32686aeefdbf6272dcb | suit/templatetags/suit_list.py | python | result_row_attrs | (context, cl, row_index) | return dict_to_attrs(attrs) | Returns row attributes based on object instance | Returns row attributes based on object instance | [
"Returns",
"row",
"attributes",
"based",
"on",
"object",
"instance"
] | def result_row_attrs(context, cl, row_index):
"""
Returns row attributes based on object instance
"""
row_index -= 1
attrs = {
'class': 'row1' if row_index % 2 == 0 else 'row2'
}
suit_row_attributes = getattr(cl.model_admin, 'suit_row_attributes', None)
if not suit_row_attributes... | [
"def",
"result_row_attrs",
"(",
"context",
",",
"cl",
",",
"row_index",
")",
":",
"row_index",
"-=",
"1",
"attrs",
"=",
"{",
"'class'",
":",
"'row1'",
"if",
"row_index",
"%",
"2",
"==",
"0",
"else",
"'row2'",
"}",
"suit_row_attributes",
"=",
"getattr",
"... | https://github.com/82Flex/DCRM/blob/9568676a3f7c2c6ddd6ca32686aeefdbf6272dcb/suit/templatetags/suit_list.py#L13-L40 | |
nicolargo/glances | 00c65933ae1d0ebd3e72dc30fc3c215a83dfaae2 | glances/plugins/glances_system.py | python | Plugin.msg_curse | (self, args=None, max_width=None) | return ret | Return the string to display in the curse interface. | Return the string to display in the curse interface. | [
"Return",
"the",
"string",
"to",
"display",
"in",
"the",
"curse",
"interface",
"."
] | def msg_curse(self, args=None, max_width=None):
"""Return the string to display in the curse interface."""
# Init the return message
ret = []
# Build the string message
if args.client:
# Client mode
if args.cs_status.lower() == "connected":
... | [
"def",
"msg_curse",
"(",
"self",
",",
"args",
"=",
"None",
",",
"max_width",
"=",
"None",
")",
":",
"# Init the return message",
"ret",
"=",
"[",
"]",
"# Build the string message",
"if",
"args",
".",
"client",
":",
"# Client mode",
"if",
"args",
".",
"cs_sta... | https://github.com/nicolargo/glances/blob/00c65933ae1d0ebd3e72dc30fc3c215a83dfaae2/glances/plugins/glances_system.py#L173-L207 | |
hyperledger/aries-cloudagent-python | 2f36776e99f6053ae92eed8123b5b1b2e891c02a | aries_cloudagent/messaging/responder.py | python | MockResponder.send_webhook | (self, topic: str, payload: dict) | Send an outbound message. | Send an outbound message. | [
"Send",
"an",
"outbound",
"message",
"."
] | async def send_webhook(self, topic: str, payload: dict):
"""Send an outbound message."""
raise Exception(
"responder.send_webhook is deprecated; please use the event bus instead."
) | [
"async",
"def",
"send_webhook",
"(",
"self",
",",
"topic",
":",
"str",
",",
"payload",
":",
"dict",
")",
":",
"raise",
"Exception",
"(",
"\"responder.send_webhook is deprecated; please use the event bus instead.\"",
")"
] | https://github.com/hyperledger/aries-cloudagent-python/blob/2f36776e99f6053ae92eed8123b5b1b2e891c02a/aries_cloudagent/messaging/responder.py#L160-L164 | ||
007gzs/dingtalk-sdk | 7979da2e259fdbc571728cae2425a04dbc65850a | dingtalk/client/api/taobao.py | python | TbTaoBaoKe.taobao_tbk_item_get | (
self,
fields,
q='',
cat='',
itemloc='',
sort='',
is_tmall='',
is_overseas='',
start_price='',
end_price='',
start_tk_rate='',
end_tk_rate='',
platform='',
... | return self._top_request(
"taobao.tbk.item.get",
{
"fields": fields,
"q": q,
"cat": cat,
"itemloc": itemloc,
"sort": sort,
"is_tmall": is_tmall,
"is_overseas": is_overseas,
... | 淘宝客商品查询
文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=24515
:param fields: 需返回的字段列表
:param q: 查询词
:param cat: 后台类目ID,用,分割,最大10个,该ID可以通过taobao.itemcats.get接口获取到
:param itemloc: 所在地
:param sort: 排序_des(降序),排序_asc(升序),销量(total_sales),淘客佣金比率(tk_rate), 累计推广量(tk_total_... | 淘宝客商品查询
文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=24515 | [
"淘宝客商品查询",
"文档地址:https",
":",
"//",
"open",
"-",
"doc",
".",
"dingtalk",
".",
"com",
"/",
"docs",
"/",
"api",
".",
"htm?apiId",
"=",
"24515"
] | def taobao_tbk_item_get(
self,
fields,
q='',
cat='',
itemloc='',
sort='',
is_tmall='',
is_overseas='',
start_price='',
end_price='',
start_tk_rate='',
end_tk_rate='',
... | [
"def",
"taobao_tbk_item_get",
"(",
"self",
",",
"fields",
",",
"q",
"=",
"''",
",",
"cat",
"=",
"''",
",",
"itemloc",
"=",
"''",
",",
"sort",
"=",
"''",
",",
"is_tmall",
"=",
"''",
",",
"is_overseas",
"=",
"''",
",",
"start_price",
"=",
"''",
",",
... | https://github.com/007gzs/dingtalk-sdk/blob/7979da2e259fdbc571728cae2425a04dbc65850a/dingtalk/client/api/taobao.py#L19367-L19421 | |
aiguofer/gspread-pandas | d04e57d4977712ccdd404bb34f1b7ae0468a1447 | gspread_pandas/util.py | python | chunks | (lst, chunk_size) | Chunk a list into specified chunk sizes. | Chunk a list into specified chunk sizes. | [
"Chunk",
"a",
"list",
"into",
"specified",
"chunk",
"sizes",
"."
] | def chunks(lst, chunk_size):
"""Chunk a list into specified chunk sizes."""
for i in range(0, len(lst), chunk_size):
yield lst[i : i + chunk_size] | [
"def",
"chunks",
"(",
"lst",
",",
"chunk_size",
")",
":",
"for",
"i",
"in",
"range",
"(",
"0",
",",
"len",
"(",
"lst",
")",
",",
"chunk_size",
")",
":",
"yield",
"lst",
"[",
"i",
":",
"i",
"+",
"chunk_size",
"]"
] | https://github.com/aiguofer/gspread-pandas/blob/d04e57d4977712ccdd404bb34f1b7ae0468a1447/gspread_pandas/util.py#L147-L150 | ||
NordicSemiconductor/pc-nrfutil | d08e742128f2a3dac522601bc6b9f9b2b63952df | nordicsemi/dfu/package.py | python | Package.calculate_sha256_hash | (firmware_filename) | return sha256[31::-1] | [] | def calculate_sha256_hash(firmware_filename):
read_buffer = 4096
digest = hashlib.sha256()
with open(firmware_filename, 'rb') as firmware_file:
while True:
data = firmware_file.read(read_buffer)
if data:
digest.update(data)
... | [
"def",
"calculate_sha256_hash",
"(",
"firmware_filename",
")",
":",
"read_buffer",
"=",
"4096",
"digest",
"=",
"hashlib",
".",
"sha256",
"(",
")",
"with",
"open",
"(",
"firmware_filename",
",",
"'rb'",
")",
"as",
"firmware_file",
":",
"while",
"True",
":",
"... | https://github.com/NordicSemiconductor/pc-nrfutil/blob/d08e742128f2a3dac522601bc6b9f9b2b63952df/nordicsemi/dfu/package.py#L531-L547 | |||
blindfuzzy/LHF | 51568ee159d0f5b46944a29c1e6786f9fffe1fb3 | Modules/IPy.py | python | _count1Bits | (num) | return ret | Find the highest bit set to 1 in an integer. | Find the highest bit set to 1 in an integer. | [
"Find",
"the",
"highest",
"bit",
"set",
"to",
"1",
"in",
"an",
"integer",
"."
] | def _count1Bits(num):
"""Find the highest bit set to 1 in an integer."""
ret = 0
while num > 0:
num = num >> 1
ret += 1
return ret | [
"def",
"_count1Bits",
"(",
"num",
")",
":",
"ret",
"=",
"0",
"while",
"num",
">",
"0",
":",
"num",
"=",
"num",
">>",
"1",
"ret",
"+=",
"1",
"return",
"ret"
] | https://github.com/blindfuzzy/LHF/blob/51568ee159d0f5b46944a29c1e6786f9fffe1fb3/Modules/IPy.py#L1517-L1523 | |
midgetspy/Sick-Beard | 171a607e41b7347a74cc815f6ecce7968d9acccf | cherrypy/lib/httputil.py | python | protocol_from_http | (protocol_str) | return int(protocol_str[5]), int(protocol_str[7]) | Return a protocol tuple from the given 'HTTP/x.y' string. | Return a protocol tuple from the given 'HTTP/x.y' string. | [
"Return",
"a",
"protocol",
"tuple",
"from",
"the",
"given",
"HTTP",
"/",
"x",
".",
"y",
"string",
"."
] | def protocol_from_http(protocol_str):
"""Return a protocol tuple from the given 'HTTP/x.y' string."""
return int(protocol_str[5]), int(protocol_str[7]) | [
"def",
"protocol_from_http",
"(",
"protocol_str",
")",
":",
"return",
"int",
"(",
"protocol_str",
"[",
"5",
"]",
")",
",",
"int",
"(",
"protocol_str",
"[",
"7",
"]",
")"
] | https://github.com/midgetspy/Sick-Beard/blob/171a607e41b7347a74cc815f6ecce7968d9acccf/cherrypy/lib/httputil.py#L40-L42 | |
sametmax/Django--an-app-at-a-time | 99eddf12ead76e6dfbeb09ce0bae61e282e22f8a | ignore_this_directory/django/utils/formats.py | python | get_format | (format_type, lang=None, use_l10n=None) | return val | For a specific format type, return the format for the current
language (locale). Default to the format in the settings.
format_type is the name of the format, e.g. 'DATE_FORMAT'.
If use_l10n is provided and is not None, it forces the value to
be localized (or not), overriding the value of settings.USE_... | For a specific format type, return the format for the current
language (locale). Default to the format in the settings.
format_type is the name of the format, e.g. 'DATE_FORMAT'. | [
"For",
"a",
"specific",
"format",
"type",
"return",
"the",
"format",
"for",
"the",
"current",
"language",
"(",
"locale",
")",
".",
"Default",
"to",
"the",
"format",
"in",
"the",
"settings",
".",
"format_type",
"is",
"the",
"name",
"of",
"the",
"format",
... | def get_format(format_type, lang=None, use_l10n=None):
"""
For a specific format type, return the format for the current
language (locale). Default to the format in the settings.
format_type is the name of the format, e.g. 'DATE_FORMAT'.
If use_l10n is provided and is not None, it forces the value ... | [
"def",
"get_format",
"(",
"format_type",
",",
"lang",
"=",
"None",
",",
"use_l10n",
"=",
"None",
")",
":",
"use_l10n",
"=",
"use_l10n",
"or",
"(",
"use_l10n",
"is",
"None",
"and",
"settings",
".",
"USE_L10N",
")",
"if",
"use_l10n",
"and",
"lang",
"is",
... | https://github.com/sametmax/Django--an-app-at-a-time/blob/99eddf12ead76e6dfbeb09ce0bae61e282e22f8a/ignore_this_directory/django/utils/formats.py#L99-L138 | |
saltstack/salt | fae5bc757ad0f1716483ce7ae180b451545c2058 | salt/modules/nix.py | python | _run | (cmd) | return __salt__["cmd.run_all"](
cmd, env={"HOME": os.path.expanduser("~{}".format(__opts__["user"]))}
) | Just a convenience function for ``__salt__['cmd.run_all'](cmd)`` | Just a convenience function for ``__salt__['cmd.run_all'](cmd)`` | [
"Just",
"a",
"convenience",
"function",
"for",
"__salt__",
"[",
"cmd",
".",
"run_all",
"]",
"(",
"cmd",
")"
] | def _run(cmd):
"""
Just a convenience function for ``__salt__['cmd.run_all'](cmd)``
"""
return __salt__["cmd.run_all"](
cmd, env={"HOME": os.path.expanduser("~{}".format(__opts__["user"]))}
) | [
"def",
"_run",
"(",
"cmd",
")",
":",
"return",
"__salt__",
"[",
"\"cmd.run_all\"",
"]",
"(",
"cmd",
",",
"env",
"=",
"{",
"\"HOME\"",
":",
"os",
".",
"path",
".",
"expanduser",
"(",
"\"~{}\"",
".",
"format",
"(",
"__opts__",
"[",
"\"user\"",
"]",
")"... | https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/modules/nix.py#L51-L57 | |
vcheckzen/FODI | 3bb23644938a33c3fdfb9611a622e35ed4ce6532 | back-end-py/main/3rd/Crypto/Protocol/SecretSharing.py | python | _Element.__init__ | (self, encoded_value) | Initialize the element to a certain value.
The value passed as parameter is internally encoded as
a 128-bit integer, where each bit represents a polynomial
coefficient. The LSB is the constant coefficient. | Initialize the element to a certain value. | [
"Initialize",
"the",
"element",
"to",
"a",
"certain",
"value",
"."
] | def __init__(self, encoded_value):
"""Initialize the element to a certain value.
The value passed as parameter is internally encoded as
a 128-bit integer, where each bit represents a polynomial
coefficient. The LSB is the constant coefficient.
"""
if is_native_int(encod... | [
"def",
"__init__",
"(",
"self",
",",
"encoded_value",
")",
":",
"if",
"is_native_int",
"(",
"encoded_value",
")",
":",
"self",
".",
"_value",
"=",
"encoded_value",
"elif",
"len",
"(",
"encoded_value",
")",
"==",
"16",
":",
"self",
".",
"_value",
"=",
"by... | https://github.com/vcheckzen/FODI/blob/3bb23644938a33c3fdfb9611a622e35ed4ce6532/back-end-py/main/3rd/Crypto/Protocol/SecretSharing.py#L82-L95 | ||
skylander86/lambda-text-extractor | 6da52d077a2fc571e38bfe29c33ae68f6443cd5a | lib-linux_x64/odf/opendocument.py | python | OpenDocument._parseoneelement | (self, top, stylenamelist) | return stylenamelist | Finds references to style objects in master-styles
and add the style name to the style list if not already there.
Recursive
@return the list of style names as unicode strings | Finds references to style objects in master-styles
and add the style name to the style list if not already there.
Recursive | [
"Finds",
"references",
"to",
"style",
"objects",
"in",
"master",
"-",
"styles",
"and",
"add",
"the",
"style",
"name",
"to",
"the",
"style",
"list",
"if",
"not",
"already",
"there",
".",
"Recursive"
] | def _parseoneelement(self, top, stylenamelist):
"""
Finds references to style objects in master-styles
and add the style name to the style list if not already there.
Recursive
@return the list of style names as unicode strings
"""
for e in top.childNodes:
... | [
"def",
"_parseoneelement",
"(",
"self",
",",
"top",
",",
"stylenamelist",
")",
":",
"for",
"e",
"in",
"top",
".",
"childNodes",
":",
"if",
"e",
".",
"nodeType",
"==",
"element",
".",
"Node",
".",
"ELEMENT_NODE",
":",
"for",
"styleref",
"in",
"(",
"(",
... | https://github.com/skylander86/lambda-text-extractor/blob/6da52d077a2fc571e38bfe29c33ae68f6443cd5a/lib-linux_x64/odf/opendocument.py#L330-L358 | |
dropbox/dropbox-sdk-python | 015437429be224732990041164a21a0501235db1 | dropbox/team_log.py | python | EventTypeArg.is_paper_doc_trashed | (self) | return self._tag == 'paper_doc_trashed' | Check if the union tag is ``paper_doc_trashed``.
:rtype: bool | Check if the union tag is ``paper_doc_trashed``. | [
"Check",
"if",
"the",
"union",
"tag",
"is",
"paper_doc_trashed",
"."
] | def is_paper_doc_trashed(self):
"""
Check if the union tag is ``paper_doc_trashed``.
:rtype: bool
"""
return self._tag == 'paper_doc_trashed' | [
"def",
"is_paper_doc_trashed",
"(",
"self",
")",
":",
"return",
"self",
".",
"_tag",
"==",
"'paper_doc_trashed'"
] | https://github.com/dropbox/dropbox-sdk-python/blob/015437429be224732990041164a21a0501235db1/dropbox/team_log.py#L41487-L41493 | |
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/rings/polynomial/ore_polynomial_ring.py | python | OrePolynomialRing._coerce_map_from_base_ring | (self) | return OrePolynomialBaseringInjection(self.base_ring(), self) | Return a coercion map from the base ring of ``self``.
EXAMPLES::
sage: R.<t> = ZZ[]
sage: S.<x> = OrePolynomialRing(R, R.hom([t + 1]))
sage: S.coerce_map_from(R)
Ore Polynomial base injection morphism:
From: Univariate Polynomial Ring in t over Int... | Return a coercion map from the base ring of ``self``. | [
"Return",
"a",
"coercion",
"map",
"from",
"the",
"base",
"ring",
"of",
"self",
"."
] | def _coerce_map_from_base_ring(self):
"""
Return a coercion map from the base ring of ``self``.
EXAMPLES::
sage: R.<t> = ZZ[]
sage: S.<x> = OrePolynomialRing(R, R.hom([t + 1]))
sage: S.coerce_map_from(R)
Ore Polynomial base injection morphism:
... | [
"def",
"_coerce_map_from_base_ring",
"(",
"self",
")",
":",
"return",
"OrePolynomialBaseringInjection",
"(",
"self",
".",
"base_ring",
"(",
")",
",",
"self",
")"
] | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/rings/polynomial/ore_polynomial_ring.py#L495-L517 | |
openedx/edx-platform | 68dd185a0ab45862a2a61e0f803d7e03d2be71b5 | common/lib/xmodule/xmodule/modulestore/split_mongo/split_draft.py | python | DraftVersioningModuleStore.get_block_original_usage | (self, usage_key) | return super().get_block_original_usage(usage_key) | If a block was inherited into another structure using copy_from_template,
this will return the original block usage locator from which the
copy was inherited. | If a block was inherited into another structure using copy_from_template,
this will return the original block usage locator from which the
copy was inherited. | [
"If",
"a",
"block",
"was",
"inherited",
"into",
"another",
"structure",
"using",
"copy_from_template",
"this",
"will",
"return",
"the",
"original",
"block",
"usage",
"locator",
"from",
"which",
"the",
"copy",
"was",
"inherited",
"."
] | def get_block_original_usage(self, usage_key):
"""
If a block was inherited into another structure using copy_from_template,
this will return the original block usage locator from which the
copy was inherited.
"""
usage_key = self._map_revision_to_branch(usage_key)
... | [
"def",
"get_block_original_usage",
"(",
"self",
",",
"usage_key",
")",
":",
"usage_key",
"=",
"self",
".",
"_map_revision_to_branch",
"(",
"usage_key",
")",
"return",
"super",
"(",
")",
".",
"get_block_original_usage",
"(",
"usage_key",
")"
] | https://github.com/openedx/edx-platform/blob/68dd185a0ab45862a2a61e0f803d7e03d2be71b5/common/lib/xmodule/xmodule/modulestore/split_mongo/split_draft.py#L310-L317 | |
clinton-hall/nzbToMedia | 27669389216902d1085660167e7bda0bd8527ecf | libs/common/mutagen/dsf.py | python | _DSFID3.save | (self, filething, v2_version=4, v23_sep='/', padding=None) | Save ID3v2 data to the DSF file | Save ID3v2 data to the DSF file | [
"Save",
"ID3v2",
"data",
"to",
"the",
"DSF",
"file"
] | def save(self, filething, v2_version=4, v23_sep='/', padding=None):
"""Save ID3v2 data to the DSF file"""
fileobj = filething.fileobj
fileobj.seek(0)
dsd_header = DSDChunk(fileobj)
if dsd_header.offset_metdata_chunk == 0:
# create a new ID3 chunk at the end of the f... | [
"def",
"save",
"(",
"self",
",",
"filething",
",",
"v2_version",
"=",
"4",
",",
"v23_sep",
"=",
"'/'",
",",
"padding",
"=",
"None",
")",
":",
"fileobj",
"=",
"filething",
".",
"fileobj",
"fileobj",
".",
"seek",
"(",
"0",
")",
"dsd_header",
"=",
"DSDC... | https://github.com/clinton-hall/nzbToMedia/blob/27669389216902d1085660167e7bda0bd8527ecf/libs/common/mutagen/dsf.py#L202-L230 | ||
tendenci/tendenci | 0f2c348cc0e7d41bc56f50b00ce05544b083bf1d | tendenci/apps/photos/search_indexes.py | python | PhotoSetIndex.prepare_order | (self, obj) | return obj.update_dt | [] | def prepare_order(self, obj):
return obj.update_dt | [
"def",
"prepare_order",
"(",
"self",
",",
"obj",
")",
":",
"return",
"obj",
".",
"update_dt"
] | https://github.com/tendenci/tendenci/blob/0f2c348cc0e7d41bc56f50b00ce05544b083bf1d/tendenci/apps/photos/search_indexes.py#L27-L28 | |||
glinscott/fishtest | 8d2b823a63fbe7be169a2177a130018c389d7aea | worker/packages/urllib3/filepost.py | python | iter_fields | (fields) | return ((k, v) for k, v in fields) | .. deprecated:: 1.6
Iterate over fields.
The addition of :class:`~urllib3.fields.RequestField` makes this function
obsolete. Instead, use :func:`iter_field_objects`, which returns
:class:`~urllib3.fields.RequestField` objects.
Supports list of (k, v) tuples and dicts. | .. deprecated:: 1.6 | [
"..",
"deprecated",
"::",
"1",
".",
"6"
] | def iter_fields(fields):
"""
.. deprecated:: 1.6
Iterate over fields.
The addition of :class:`~urllib3.fields.RequestField` makes this function
obsolete. Instead, use :func:`iter_field_objects`, which returns
:class:`~urllib3.fields.RequestField` objects.
Supports list of (k, v) tuples an... | [
"def",
"iter_fields",
"(",
"fields",
")",
":",
"if",
"isinstance",
"(",
"fields",
",",
"dict",
")",
":",
"return",
"(",
"(",
"k",
",",
"v",
")",
"for",
"k",
",",
"v",
"in",
"six",
".",
"iteritems",
"(",
"fields",
")",
")",
"return",
"(",
"(",
"... | https://github.com/glinscott/fishtest/blob/8d2b823a63fbe7be169a2177a130018c389d7aea/worker/packages/urllib3/filepost.py#L45-L60 | |
vyos/vyos-1x | 6e8a8934a7d4e1b21d7c828e372303683b499b56 | python/vyos/ifconfig/interface.py | python | Interface.set_port_isolation | (self, on_or_off) | Controls whether a given port will be isolated, which means it will be
able to communicate with non-isolated ports only. By default this flag
is off.
Use enable=1 to enable or enable=0 to disable
Example:
>>> from vyos.ifconfig import Interface
>>> Interface('eth1').set... | Controls whether a given port will be isolated, which means it will be
able to communicate with non-isolated ports only. By default this flag
is off. | [
"Controls",
"whether",
"a",
"given",
"port",
"will",
"be",
"isolated",
"which",
"means",
"it",
"will",
"be",
"able",
"to",
"communicate",
"with",
"non",
"-",
"isolated",
"ports",
"only",
".",
"By",
"default",
"this",
"flag",
"is",
"off",
"."
] | def set_port_isolation(self, on_or_off):
"""
Controls whether a given port will be isolated, which means it will be
able to communicate with non-isolated ports only. By default this flag
is off.
Use enable=1 to enable or enable=0 to disable
Example:
>>> from vyo... | [
"def",
"set_port_isolation",
"(",
"self",
",",
"on_or_off",
")",
":",
"self",
".",
"set_interface",
"(",
"'bridge_port_isolation'",
",",
"on_or_off",
")"
] | https://github.com/vyos/vyos-1x/blob/6e8a8934a7d4e1b21d7c828e372303683b499b56/python/vyos/ifconfig/interface.py#L945-L957 | ||
samuelclay/NewsBlur | 2c45209df01a1566ea105e04d499367f32ac9ad2 | apps/social/views.py | python | load_follow_requests | (request) | return {
'request_profiles': request_profiles,
} | [] | def load_follow_requests(request):
user = get_user(request.user)
follow_request_users = MFollowRequest.objects.filter(followee_user_id=user.pk)
follow_request_user_ids = [f.follower_user_id for f in follow_request_users]
request_profiles = MSocialProfile.profiles(follow_request_user_ids)
request_pro... | [
"def",
"load_follow_requests",
"(",
"request",
")",
":",
"user",
"=",
"get_user",
"(",
"request",
".",
"user",
")",
"follow_request_users",
"=",
"MFollowRequest",
".",
"objects",
".",
"filter",
"(",
"followee_user_id",
"=",
"user",
".",
"pk",
")",
"follow_requ... | https://github.com/samuelclay/NewsBlur/blob/2c45209df01a1566ea105e04d499367f32ac9ad2/apps/social/views.py#L1035-L1049 | |||
samuelclay/NewsBlur | 2c45209df01a1566ea105e04d499367f32ac9ad2 | apps/rss_feeds/models.py | python | Feed.count_errors_in_history | (self, exception_type='feed', status_code=None, fetch_history=None) | return errors, non_errors | [] | def count_errors_in_history(self, exception_type='feed', status_code=None, fetch_history=None):
if not fetch_history:
fetch_history = MFetchHistory.feed(self.pk)
fh = fetch_history[exception_type + '_fetch_history']
non_errors = [h for h in fh if h['status_code'] and int(h['status_co... | [
"def",
"count_errors_in_history",
"(",
"self",
",",
"exception_type",
"=",
"'feed'",
",",
"status_code",
"=",
"None",
",",
"fetch_history",
"=",
"None",
")",
":",
"if",
"not",
"fetch_history",
":",
"fetch_history",
"=",
"MFetchHistory",
".",
"feed",
"(",
"self... | https://github.com/samuelclay/NewsBlur/blob/2c45209df01a1566ea105e04d499367f32ac9ad2/apps/rss_feeds/models.py#L740-L768 | |||
asyml/texar-pytorch | b83d3ec17e19da08fc5f81996d02f91176e55e54 | texar/torch/modules/classifiers/gpt2_classifier.py | python | GPT2Classifier.output_size | (self) | return logit_dim | r"""The feature size of :meth:`forward` output :attr:`logits`.
If :attr:`logits` size is only determined by input
(i.e. if ``num_classes`` == 1), the feature size is equal to ``-1``.
Otherwise it is equal to last dimension value of :attr:`logits` size. | r"""The feature size of :meth:`forward` output :attr:`logits`.
If :attr:`logits` size is only determined by input
(i.e. if ``num_classes`` == 1), the feature size is equal to ``-1``.
Otherwise it is equal to last dimension value of :attr:`logits` size. | [
"r",
"The",
"feature",
"size",
"of",
":",
"meth",
":",
"forward",
"output",
":",
"attr",
":",
"logits",
".",
"If",
":",
"attr",
":",
"logits",
"size",
"is",
"only",
"determined",
"by",
"input",
"(",
"i",
".",
"e",
".",
"if",
"num_classes",
"==",
"1... | def output_size(self) -> int:
r"""The feature size of :meth:`forward` output :attr:`logits`.
If :attr:`logits` size is only determined by input
(i.e. if ``num_classes`` == 1), the feature size is equal to ``-1``.
Otherwise it is equal to last dimension value of :attr:`logits` size.
... | [
"def",
"output_size",
"(",
"self",
")",
"->",
"int",
":",
"if",
"self",
".",
"_hparams",
".",
"num_classes",
"==",
"1",
":",
"logit_dim",
"=",
"-",
"1",
"elif",
"self",
".",
"_hparams",
".",
"num_classes",
">",
"1",
":",
"logit_dim",
"=",
"self",
"."... | https://github.com/asyml/texar-pytorch/blob/b83d3ec17e19da08fc5f81996d02f91176e55e54/texar/torch/modules/classifiers/gpt2_classifier.py#L279-L295 | |
Net-ng/kansha | 85b5816da126b1c7098707c98f217d8b2e524ff2 | kansha/services/actionlog/comp.py | python | ActionLog.add_history | (self, user, action, data) | user is App User | user is App User | [
"user",
"is",
"App",
"User"
] | def add_history(self, user, action, data):
'''user is App User'''
DataHistory.add_history(
self.board.data,
self.card and self.card.data,
user.data, action, data
) | [
"def",
"add_history",
"(",
"self",
",",
"user",
",",
"action",
",",
"data",
")",
":",
"DataHistory",
".",
"add_history",
"(",
"self",
".",
"board",
".",
"data",
",",
"self",
".",
"card",
"and",
"self",
".",
"card",
".",
"data",
",",
"user",
".",
"d... | https://github.com/Net-ng/kansha/blob/85b5816da126b1c7098707c98f217d8b2e524ff2/kansha/services/actionlog/comp.py#L39-L45 | ||
cagbal/ros_people_object_detection_tensorflow | 982ffd4a54b8059638f5cd4aa167299c7fc9e61f | src/object_detection/utils/visualization_utils.py | python | draw_keypoints_on_image | (image,
keypoints,
color='red',
radius=2,
use_normalized_coordinates=True) | Draws keypoints on an image.
Args:
image: a PIL.Image object.
keypoints: a numpy array with shape [num_keypoints, 2].
color: color to draw the keypoints with. Default is red.
radius: keypoint radius. Default value is 2.
use_normalized_coordinates: if True (default), treat keypoint values as
... | Draws keypoints on an image. | [
"Draws",
"keypoints",
"on",
"an",
"image",
"."
] | def draw_keypoints_on_image(image,
keypoints,
color='red',
radius=2,
use_normalized_coordinates=True):
"""Draws keypoints on an image.
Args:
image: a PIL.Image object.
keypoints: a numpy array wi... | [
"def",
"draw_keypoints_on_image",
"(",
"image",
",",
"keypoints",
",",
"color",
"=",
"'red'",
",",
"radius",
"=",
"2",
",",
"use_normalized_coordinates",
"=",
"True",
")",
":",
"draw",
"=",
"ImageDraw",
".",
"Draw",
"(",
"image",
")",
"im_width",
",",
"im_... | https://github.com/cagbal/ros_people_object_detection_tensorflow/blob/982ffd4a54b8059638f5cd4aa167299c7fc9e61f/src/object_detection/utils/visualization_utils.py#L467-L492 | ||
ohmyadd/wetland | 76d296ec66dc438606e2455a848619d446f4a4b7 | paramiko/transport.py | python | SecurityOptions.digests | (self) | return self._transport._preferred_macs | Digest (one-way hash) algorithms | Digest (one-way hash) algorithms | [
"Digest",
"(",
"one",
"-",
"way",
"hash",
")",
"algorithms"
] | def digests(self):
"""Digest (one-way hash) algorithms"""
return self._transport._preferred_macs | [
"def",
"digests",
"(",
"self",
")",
":",
"return",
"self",
".",
"_transport",
".",
"_preferred_macs"
] | https://github.com/ohmyadd/wetland/blob/76d296ec66dc438606e2455a848619d446f4a4b7/paramiko/transport.py#L2617-L2619 | |
OpenXenManager/openxenmanager | 1cb5c1cb13358ba584856e99a94f9669d17670ff | src/OXM/window_host.py | python | oxcWindowHost.on_btlogoutuser_clicked | (self, widget, data=None) | Press "Logout User" on Users tab | Press "Logout User" on Users tab | [
"Press",
"Logout",
"User",
"on",
"Users",
"tab"
] | def on_btlogoutuser_clicked(self, widget, data=None):
"""
Press "Logout User" on Users tab
"""
pass | [
"def",
"on_btlogoutuser_clicked",
"(",
"self",
",",
"widget",
",",
"data",
"=",
"None",
")",
":",
"pass"
] | https://github.com/OpenXenManager/openxenmanager/blob/1cb5c1cb13358ba584856e99a94f9669d17670ff/src/OXM/window_host.py#L59-L63 | ||
makerbot/ReplicatorG | d6f2b07785a5a5f1e172fb87cb4303b17c575d5d | skein_engines/skeinforge-50/fabmetheus_utilities/gcodec.py | python | getDoubleFromCharacterSplitLine | (character, splitLine) | Get the double value of the string after the first occurence of the character in the split line. | Get the double value of the string after the first occurence of the character in the split line. | [
"Get",
"the",
"double",
"value",
"of",
"the",
"string",
"after",
"the",
"first",
"occurence",
"of",
"the",
"character",
"in",
"the",
"split",
"line",
"."
] | def getDoubleFromCharacterSplitLine(character, splitLine):
'Get the double value of the string after the first occurence of the character in the split line.'
indexOfCharacter = getIndexOfStartingWithSecond(character, splitLine)
if indexOfCharacter < 0:
return None
floatString = splitLine[indexOfCharacter][1 :]
t... | [
"def",
"getDoubleFromCharacterSplitLine",
"(",
"character",
",",
"splitLine",
")",
":",
"indexOfCharacter",
"=",
"getIndexOfStartingWithSecond",
"(",
"character",
",",
"splitLine",
")",
"if",
"indexOfCharacter",
"<",
"0",
":",
"return",
"None",
"floatString",
"=",
"... | https://github.com/makerbot/ReplicatorG/blob/d6f2b07785a5a5f1e172fb87cb4303b17c575d5d/skein_engines/skeinforge-50/fabmetheus_utilities/gcodec.py#L77-L86 | ||
JetBrains/python-skeletons | 95ad24b666e475998e5d1cc02ed53a2188036167 | numpy/core/__init__.py | python | int8.__lt__ | (self, *args, **kwargs) | Return self<value. | Return self<value. | [
"Return",
"self<value",
"."
] | def __lt__(self, *args, **kwargs): # real signature unknown
""" Return self<value. """
pass | [
"def",
"__lt__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# real signature unknown",
"pass"
] | https://github.com/JetBrains/python-skeletons/blob/95ad24b666e475998e5d1cc02ed53a2188036167/numpy/core/__init__.py#L1180-L1182 | ||
riptideio/pymodbus | c5772b35ae3f29d1947f3ab453d8d00df846459f | pymodbus/client/asynchronous/tornado/__init__.py | python | SerialIOStream.close_fd | (self) | Closes a serial Fd
:return: | Closes a serial Fd
:return: | [
"Closes",
"a",
"serial",
"Fd",
":",
"return",
":"
] | def close_fd(self):
"""
Closes a serial Fd
:return:
"""
if self.connection:
self.connection.close()
self.connection = None | [
"def",
"close_fd",
"(",
"self",
")",
":",
"if",
"self",
".",
"connection",
":",
"self",
".",
"connection",
".",
"close",
"(",
")",
"self",
".",
"connection",
"=",
"None"
] | https://github.com/riptideio/pymodbus/blob/c5772b35ae3f29d1947f3ab453d8d00df846459f/pymodbus/client/asynchronous/tornado/__init__.py#L265-L272 | ||
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | Python-2.7.13/Lib/logging/__init__.py | python | captureWarnings | (capture) | If capture is true, redirect all warnings to the logging package.
If capture is False, ensure that warnings are not redirected to logging
but to their original destinations. | If capture is true, redirect all warnings to the logging package.
If capture is False, ensure that warnings are not redirected to logging
but to their original destinations. | [
"If",
"capture",
"is",
"true",
"redirect",
"all",
"warnings",
"to",
"the",
"logging",
"package",
".",
"If",
"capture",
"is",
"False",
"ensure",
"that",
"warnings",
"are",
"not",
"redirected",
"to",
"logging",
"but",
"to",
"their",
"original",
"destinations",
... | def captureWarnings(capture):
"""
If capture is true, redirect all warnings to the logging package.
If capture is False, ensure that warnings are not redirected to logging
but to their original destinations.
"""
global _warnings_showwarning
if capture:
if _warnings_showwarning is Non... | [
"def",
"captureWarnings",
"(",
"capture",
")",
":",
"global",
"_warnings_showwarning",
"if",
"capture",
":",
"if",
"_warnings_showwarning",
"is",
"None",
":",
"_warnings_showwarning",
"=",
"warnings",
".",
"showwarning",
"warnings",
".",
"showwarning",
"=",
"_showwa... | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/logging/__init__.py#L1730-L1744 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.