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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/whoosh/automata/fsa.py | python | DMNode.tuple | (self) | return arcs, self.final | [] | def tuple(self):
arcs = tuple(sorted(iteritems(self.arcs)))
return arcs, self.final | [
"def",
"tuple",
"(",
"self",
")",
":",
"arcs",
"=",
"tuple",
"(",
"sorted",
"(",
"iteritems",
"(",
"self",
".",
"arcs",
")",
")",
")",
"return",
"arcs",
",",
"self",
".",
"final"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/whoosh/automata/fsa.py#L644-L646 | |||
PiStuffing/Quadcopter | fa3a2e7b0d37d54ff5acc32c6752d3a31834240e | Quadcopter.py | python | I2C.readList | (self, reg, length) | return result | Reads a byte array value from the I2C device. The content depends on the device. The | Reads a byte array value from the I2C device. The content depends on the device. The | [
"Reads",
"a",
"byte",
"array",
"value",
"from",
"the",
"I2C",
"device",
".",
"The",
"content",
"depends",
"on",
"the",
"device",
".",
"The"
] | def readList(self, reg, length):
"Reads a byte array value from the I2C device. The content depends on the device. The "
"FIFO read return sequential values from the same register. For all other, sequestial"
"regester values are returned"
result = self.bus.read_i2c_block_data(self.addr... | [
"def",
"readList",
"(",
"self",
",",
"reg",
",",
"length",
")",
":",
"\"FIFO read return sequential values from the same register. For all other, sequestial\"",
"\"regester values are returned\"",
"result",
"=",
"self",
".",
"bus",
".",
"read_i2c_block_data",
"(",
"self",
... | https://github.com/PiStuffing/Quadcopter/blob/fa3a2e7b0d37d54ff5acc32c6752d3a31834240e/Quadcopter.py#L98-L103 | |
Blizzard/heroprotocol | 3d36eaf44fc4c8ff3331c2ae2f1dc08a94535f1c | heroprotocol/versions/protocol59988.py | python | decode_replay_initdata | (contents) | return decoder.instance(replay_initdata_typeid) | Decodes and return the replay init data from the contents byte string. | Decodes and return the replay init data from the contents byte string. | [
"Decodes",
"and",
"return",
"the",
"replay",
"init",
"data",
"from",
"the",
"contents",
"byte",
"string",
"."
] | def decode_replay_initdata(contents):
"""Decodes and return the replay init data from the contents byte string."""
decoder = BitPackedDecoder(contents, typeinfos)
return decoder.instance(replay_initdata_typeid) | [
"def",
"decode_replay_initdata",
"(",
"contents",
")",
":",
"decoder",
"=",
"BitPackedDecoder",
"(",
"contents",
",",
"typeinfos",
")",
"return",
"decoder",
".",
"instance",
"(",
"replay_initdata_typeid",
")"
] | https://github.com/Blizzard/heroprotocol/blob/3d36eaf44fc4c8ff3331c2ae2f1dc08a94535f1c/heroprotocol/versions/protocol59988.py#L445-L448 | |
Ekultek/Zeus-Scanner | 21b87563062326cd480669f2922f650173a2a18e | var/search/__init__.py | python | SetBrowser.set_browser | (self) | return browser | set the browser settings | set the browser settings | [
"set",
"the",
"browser",
"settings"
] | def set_browser(self):
"""
set the browser settings
"""
profile = webdriver.FirefoxProfile()
try:
if not self.tor:
logger.info(set_color(
"setting the browser"
))
profile.set_preference("general.usera... | [
"def",
"set_browser",
"(",
"self",
")",
":",
"profile",
"=",
"webdriver",
".",
"FirefoxProfile",
"(",
")",
"try",
":",
"if",
"not",
"self",
".",
"tor",
":",
"logger",
".",
"info",
"(",
"set_color",
"(",
"\"setting the browser\"",
")",
")",
"profile",
"."... | https://github.com/Ekultek/Zeus-Scanner/blob/21b87563062326cd480669f2922f650173a2a18e/var/search/__init__.py#L123-L155 | |
imageio/imageio | 51f552ba5ed4aa771f205a2798e1fd3859fb2942 | imageio/core/imopen.py | python | imopen | (
uri,
io_mode: str,
*,
plugin: Union[str, Any] = None,
legacy_mode: bool = True,
**kwargs,
) | Open an ImageResource.
.. warning::
This warning is for pypy users. If you are not using a context manager,
remember to deconstruct the returned plugin to avoid leaking the file
handle to an unclosed file.
Parameters
----------
uri : str or pathlib.Path or bytes or file or Requ... | Open an ImageResource. | [
"Open",
"an",
"ImageResource",
"."
] | def imopen(
uri,
io_mode: str,
*,
plugin: Union[str, Any] = None,
legacy_mode: bool = True,
**kwargs,
) -> Any:
"""Open an ImageResource.
.. warning::
This warning is for pypy users. If you are not using a context manager,
remember to deconstruct the returned plugin to a... | [
"def",
"imopen",
"(",
"uri",
",",
"io_mode",
":",
"str",
",",
"*",
",",
"plugin",
":",
"Union",
"[",
"str",
",",
"Any",
"]",
"=",
"None",
",",
"legacy_mode",
":",
"bool",
"=",
"True",
",",
"*",
"*",
"kwargs",
",",
")",
"->",
"Any",
":",
"if",
... | https://github.com/imageio/imageio/blob/51f552ba5ed4aa771f205a2798e1fd3859fb2942/imageio/core/imopen.py#L64-L277 | ||
linxid/Machine_Learning_Study_Path | 558e82d13237114bbb8152483977806fc0c222af | Machine Learning In Action/Chapter8-Regression/venv/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/distlib/scripts.py | python | ScriptMaker._write_script | (self, names, shebang, script_bytes, filenames, ext) | [] | def _write_script(self, names, shebang, script_bytes, filenames, ext):
use_launcher = self.add_launchers and self._is_nt
linesep = os.linesep.encode('utf-8')
if not use_launcher:
script_bytes = shebang + linesep + script_bytes
else: # pragma: no cover
if ext == '... | [
"def",
"_write_script",
"(",
"self",
",",
"names",
",",
"shebang",
",",
"script_bytes",
",",
"filenames",
",",
"ext",
")",
":",
"use_launcher",
"=",
"self",
".",
"add_launchers",
"and",
"self",
".",
"_is_nt",
"linesep",
"=",
"os",
".",
"linesep",
".",
"e... | https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter8-Regression/venv/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/distlib/scripts.py#L205-L253 | ||||
viewfinderco/viewfinder | 453845b5d64ab5b3b826c08b02546d1ca0a07c14 | backend/op/viewfinder_op.py | python | ViewfinderOperation._CheckCopyTargets | (cls, action, client, user_id, viewpoint_id, target_ep_dicts) | Compiles a list of target episode and post ids that do not exist or are removed. These
episodes and posts will not be copied as part of the operation.
Returns the set of target episode and post ids that will be (re)created by the caller. | Compiles a list of target episode and post ids that do not exist or are removed. These
episodes and posts will not be copied as part of the operation. | [
"Compiles",
"a",
"list",
"of",
"target",
"episode",
"and",
"post",
"ids",
"that",
"do",
"not",
"exist",
"or",
"are",
"removed",
".",
"These",
"episodes",
"and",
"posts",
"will",
"not",
"be",
"copied",
"as",
"part",
"of",
"the",
"operation",
"."
] | def _CheckCopyTargets(cls, action, client, user_id, viewpoint_id, target_ep_dicts):
"""Compiles a list of target episode and post ids that do not exist or are removed. These
episodes and posts will not be copied as part of the operation.
Returns the set of target episode and post ids that will be (re)creat... | [
"def",
"_CheckCopyTargets",
"(",
"cls",
",",
"action",
",",
"client",
",",
"user_id",
",",
"viewpoint_id",
",",
"target_ep_dicts",
")",
":",
"# Gather db keys for all target episodes and posts.",
"episode_keys",
"=",
"[",
"]",
"post_keys",
"=",
"[",
"]",
"for",
"e... | https://github.com/viewfinderco/viewfinder/blob/453845b5d64ab5b3b826c08b02546d1ca0a07c14/backend/op/viewfinder_op.py#L192-L246 | ||
zzzeek/sqlalchemy | fc5c54fcd4d868c2a4c7ac19668d72f506fe821e | lib/sqlalchemy/orm/relationships.py | python | JoinCondition.primaryjoin_reverse_remote | (self) | Return the primaryjoin condition suitable for the
"reverse" direction.
If the primaryjoin was delivered here with pre-existing
"remote" annotations, the local/remote annotations
are reversed. Otherwise, the local/remote annotations
are removed. | Return the primaryjoin condition suitable for the
"reverse" direction. | [
"Return",
"the",
"primaryjoin",
"condition",
"suitable",
"for",
"the",
"reverse",
"direction",
"."
] | def primaryjoin_reverse_remote(self):
"""Return the primaryjoin condition suitable for the
"reverse" direction.
If the primaryjoin was delivered here with pre-existing
"remote" annotations, the local/remote annotations
are reversed. Otherwise, the local/remote annotations
... | [
"def",
"primaryjoin_reverse_remote",
"(",
"self",
")",
":",
"if",
"self",
".",
"_has_remote_annotations",
":",
"def",
"replace",
"(",
"element",
")",
":",
"if",
"\"remote\"",
"in",
"element",
".",
"_annotations",
":",
"v",
"=",
"dict",
"(",
"element",
".",
... | https://github.com/zzzeek/sqlalchemy/blob/fc5c54fcd4d868c2a4c7ac19668d72f506fe821e/lib/sqlalchemy/orm/relationships.py#L2829-L2861 | ||
urwid/urwid | e2423b5069f51d318ea1ac0f355a0efe5448f7eb | urwid/vterm.py | python | TermCanvas.carriage_return | (self) | [] | def carriage_return(self):
self.set_term_cursor(0, self.term_cursor[1]) | [
"def",
"carriage_return",
"(",
"self",
")",
":",
"self",
".",
"set_term_cursor",
"(",
"0",
",",
"self",
".",
"term_cursor",
"[",
"1",
"]",
")"
] | https://github.com/urwid/urwid/blob/e2423b5069f51d318ea1ac0f355a0efe5448f7eb/urwid/vterm.py#L752-L753 | ||||
LabPy/lantz | 3e878e3f765a4295b0089d04e241d4beb7b8a65b | lantz/drivers/andor/ccd.py | python | CCD.getbool | (self, strcommand) | return result.value | Run command and get Bool return value. | Run command and get Bool return value. | [
"Run",
"command",
"and",
"get",
"Bool",
"return",
"value",
"."
] | def getbool(self, strcommand):
"""Run command and get Bool return value.
"""
result = ct.c_bool()
command = ct.c_wchar_p(strcommand)
self.lib.AT_GetBool(self.AT_H, command, ct.addressof(result))
return result.value | [
"def",
"getbool",
"(",
"self",
",",
"strcommand",
")",
":",
"result",
"=",
"ct",
".",
"c_bool",
"(",
")",
"command",
"=",
"ct",
".",
"c_wchar_p",
"(",
"strcommand",
")",
"self",
".",
"lib",
".",
"AT_GetBool",
"(",
"self",
".",
"AT_H",
",",
"command",... | https://github.com/LabPy/lantz/blob/3e878e3f765a4295b0089d04e241d4beb7b8a65b/lantz/drivers/andor/ccd.py#L1832-L1838 | |
uuvsimulator/uuv_simulator | bfb40cb153684a0703173117b6bbf4258e8e71c5 | tools/cpplint.py | python | FindNextMultiLineCommentStart | (lines, lineix) | return len(lines) | Find the beginning marker for a multiline comment. | Find the beginning marker for a multiline comment. | [
"Find",
"the",
"beginning",
"marker",
"for",
"a",
"multiline",
"comment",
"."
] | def FindNextMultiLineCommentStart(lines, lineix):
"""Find the beginning marker for a multiline comment."""
while lineix < len(lines):
if lines[lineix].strip().startswith('/*'):
# Only return this marker if the comment goes beyond this line
if lines[lineix].strip().find('*/', 2) < 0:
return l... | [
"def",
"FindNextMultiLineCommentStart",
"(",
"lines",
",",
"lineix",
")",
":",
"while",
"lineix",
"<",
"len",
"(",
"lines",
")",
":",
"if",
"lines",
"[",
"lineix",
"]",
".",
"strip",
"(",
")",
".",
"startswith",
"(",
"'/*'",
")",
":",
"# Only return this... | https://github.com/uuvsimulator/uuv_simulator/blob/bfb40cb153684a0703173117b6bbf4258e8e71c5/tools/cpplint.py#L860-L868 | |
uqfoundation/multiprocess | 028cc73f02655e6451d92e5147d19d8c10aebe50 | py3.11/multiprocess/process.py | python | BaseProcess.exitcode | (self) | return self._popen.poll() | Return exit code of process or `None` if it has yet to stop | Return exit code of process or `None` if it has yet to stop | [
"Return",
"exit",
"code",
"of",
"process",
"or",
"None",
"if",
"it",
"has",
"yet",
"to",
"stop"
] | def exitcode(self):
'''
Return exit code of process or `None` if it has yet to stop
'''
self._check_closed()
if self._popen is None:
return self._popen
return self._popen.poll() | [
"def",
"exitcode",
"(",
"self",
")",
":",
"self",
".",
"_check_closed",
"(",
")",
"if",
"self",
".",
"_popen",
"is",
"None",
":",
"return",
"self",
".",
"_popen",
"return",
"self",
".",
"_popen",
".",
"poll",
"(",
")"
] | https://github.com/uqfoundation/multiprocess/blob/028cc73f02655e6451d92e5147d19d8c10aebe50/py3.11/multiprocess/process.py#L225-L232 | |
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | Python-2.7.13/Lib/lib-tk/Tix.py | python | FileSelectBox.apply_filter | (self) | [] | def apply_filter(self): # name of subwidget is same as command
self.tk.call(self._w, 'filter') | [
"def",
"apply_filter",
"(",
"self",
")",
":",
"# name of subwidget is same as command",
"self",
".",
"tk",
".",
"call",
"(",
"self",
".",
"_w",
",",
"'filter'",
")"
] | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/lib-tk/Tix.py#L807-L808 | ||||
geyang/ml_logger | aa02d230b43a379846f854ad91842e524f5cdbce | ml_logger/helpers/__init__.py | python | sample | (stream, k) | :param stream:
:param k: the reservoir size
:return: | [] | def sample(stream, k):
"""
:param stream:
:param k: the reservoir size
:return:
"""
reservoir = []
for count, d in enumerate(stream):
if count < k:
reservoir.append((count, d))
else:
ind = randint(0, count)
if ind < k:
res... | [
"def",
"sample",
"(",
"stream",
",",
"k",
")",
":",
"reservoir",
"=",
"[",
"]",
"for",
"count",
",",
"d",
"in",
"enumerate",
"(",
"stream",
")",
":",
"if",
"count",
"<",
"k",
":",
"reservoir",
".",
"append",
"(",
"(",
"count",
",",
"d",
")",
")... | https://github.com/geyang/ml_logger/blob/aa02d230b43a379846f854ad91842e524f5cdbce/ml_logger/helpers/__init__.py#L114-L131 | |||
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_openshift/src/ansible/oc_clusterrole.py | python | main | () | ansible oc module for clusterrole | ansible oc module for clusterrole | [
"ansible",
"oc",
"module",
"for",
"clusterrole"
] | def main():
'''
ansible oc module for clusterrole
'''
module = AnsibleModule(
argument_spec=dict(
kubeconfig=dict(default='/etc/origin/master/admin.kubeconfig', type='str'),
state=dict(default='present', type='str',
choices=['present', 'absent', 'l... | [
"def",
"main",
"(",
")",
":",
"module",
"=",
"AnsibleModule",
"(",
"argument_spec",
"=",
"dict",
"(",
"kubeconfig",
"=",
"dict",
"(",
"default",
"=",
"'/etc/origin/master/admin.kubeconfig'",
",",
"type",
"=",
"'str'",
")",
",",
"state",
"=",
"dict",
"(",
"... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_openshift/src/ansible/oc_clusterrole.py#L4-L26 | ||
heynemann/r3 | cc6b4eb55c7ae30a8f75af2be165504565dbeb79 | r3/app/handlers/stream.py | python | StreamHandler.get | (self, job_key) | [] | def get(self, job_key):
arguments = self.request.arguments
job_id = uuid4()
job_date = datetime.now()
job_type_input_queue = JOB_TYPE_KEY % job_key
self.redis.sadd(job_type_input_queue, str(job_id))
try:
start = time.time()
input_stream = self.ap... | [
"def",
"get",
"(",
"self",
",",
"job_key",
")",
":",
"arguments",
"=",
"self",
".",
"request",
".",
"arguments",
"job_id",
"=",
"uuid4",
"(",
")",
"job_date",
"=",
"datetime",
".",
"now",
"(",
")",
"job_type_input_queue",
"=",
"JOB_TYPE_KEY",
"%",
"job_k... | https://github.com/heynemann/r3/blob/cc6b4eb55c7ae30a8f75af2be165504565dbeb79/r3/app/handlers/stream.py#L30-L100 | ||||
python/cpython | e13cdca0f5224ec4e23bdd04bb3120506964bc8b | Lib/email/message.py | python | Message.get_filename | (self, failobj=None) | return utils.collapse_rfc2231_value(filename).strip() | Return the filename associated with the payload if present.
The filename is extracted from the Content-Disposition header's
`filename' parameter, and it is unquoted. If that header is missing
the `filename' parameter, this method falls back to looking for the
`name' parameter. | Return the filename associated with the payload if present. | [
"Return",
"the",
"filename",
"associated",
"with",
"the",
"payload",
"if",
"present",
"."
] | def get_filename(self, failobj=None):
"""Return the filename associated with the payload if present.
The filename is extracted from the Content-Disposition header's
`filename' parameter, and it is unquoted. If that header is missing
the `filename' parameter, this method falls back to l... | [
"def",
"get_filename",
"(",
"self",
",",
"failobj",
"=",
"None",
")",
":",
"missing",
"=",
"object",
"(",
")",
"filename",
"=",
"self",
".",
"get_param",
"(",
"'filename'",
",",
"missing",
",",
"'content-disposition'",
")",
"if",
"filename",
"is",
"missing... | https://github.com/python/cpython/blob/e13cdca0f5224ec4e23bdd04bb3120506964bc8b/Lib/email/message.py#L806-L820 | |
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/rings/asymptotic/growth_group.py | python | GenericGrowthGroup.extended_by_non_growth_group | (self) | return cartesian_product((self, self.non_growth_group())) | r"""
Extend to a cartesian product of this growth group
and a suitable non growth group.
OUTPUT:
A group group.
EXAMPLES::
sage: from sage.rings.asymptotic.growth_group import GrowthGroup
sage: GrowthGroup('(QQ_+)^x').extended_by_non_growth_group()
... | r"""
Extend to a cartesian product of this growth group
and a suitable non growth group. | [
"r",
"Extend",
"to",
"a",
"cartesian",
"product",
"of",
"this",
"growth",
"group",
"and",
"a",
"suitable",
"non",
"growth",
"group",
"."
] | def extended_by_non_growth_group(self):
r"""
Extend to a cartesian product of this growth group
and a suitable non growth group.
OUTPUT:
A group group.
EXAMPLES::
sage: from sage.rings.asymptotic.growth_group import GrowthGroup
sage: GrowthGrou... | [
"def",
"extended_by_non_growth_group",
"(",
"self",
")",
":",
"from",
"sage",
".",
"categories",
".",
"cartesian_product",
"import",
"cartesian_product",
"return",
"cartesian_product",
"(",
"(",
"self",
",",
"self",
".",
"non_growth_group",
"(",
")",
")",
")"
] | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/rings/asymptotic/growth_group.py#L2620-L2648 | |
IdentityPython/pysaml2 | 6badb32d212257bd83ffcc816f9b625f68281b47 | src/saml2/metadata.py | python | do_contact_person_info | (ava) | return cper | Create a ContactPerson instance from configuration information. | Create a ContactPerson instance from configuration information. | [
"Create",
"a",
"ContactPerson",
"instance",
"from",
"configuration",
"information",
"."
] | def do_contact_person_info(ava):
"""Create a ContactPerson instance from configuration information."""
cper = md.ContactPerson()
cper.loadd(ava)
if not cper.contact_type:
cper.contact_type = "technical"
return cper | [
"def",
"do_contact_person_info",
"(",
"ava",
")",
":",
"cper",
"=",
"md",
".",
"ContactPerson",
"(",
")",
"cper",
".",
"loadd",
"(",
"ava",
")",
"if",
"not",
"cper",
".",
"contact_type",
":",
"cper",
".",
"contact_type",
"=",
"\"technical\"",
"return",
"... | https://github.com/IdentityPython/pysaml2/blob/6badb32d212257bd83ffcc816f9b625f68281b47/src/saml2/metadata.py#L155-L161 | |
pik-copan/pyunicorn | b18316fc08ef34b434a1a4d69dfe3e57e24435ee | pyunicorn/climate/coupled_climate_network.py | python | CoupledClimateNetwork.internal_betweenness_1 | (self) | return (ib[self.nodes_1], ib[self.nodes_2]) | Return the internal betweenness sequences for layer 1.
Gives the normalized number of shortest paths only between nodes from
layer 1, in which a node :math:`i` is contained. :math:`i` can be
member of any of the two layers. This is equivalent to the
inter-regional / inter-group betweenn... | Return the internal betweenness sequences for layer 1. | [
"Return",
"the",
"internal",
"betweenness",
"sequences",
"for",
"layer",
"1",
"."
] | def internal_betweenness_1(self):
"""
Return the internal betweenness sequences for layer 1.
Gives the normalized number of shortest paths only between nodes from
layer 1, in which a node :math:`i` is contained. :math:`i` can be
member of any of the two layers. This is equivalen... | [
"def",
"internal_betweenness_1",
"(",
"self",
")",
":",
"ib",
"=",
"self",
".",
"internal_betweenness",
"(",
"self",
".",
"nodes_1",
")",
"return",
"(",
"ib",
"[",
"self",
".",
"nodes_1",
"]",
",",
"ib",
"[",
"self",
".",
"nodes_2",
"]",
")"
] | https://github.com/pik-copan/pyunicorn/blob/b18316fc08ef34b434a1a4d69dfe3e57e24435ee/pyunicorn/climate/coupled_climate_network.py#L620-L635 | |
withdk/badusb2-mitm-poc | db2bfdb1dc9ad371aa665b292183c45577adfbaa | GoodFETMAXUSB.py | python | GoodFETMAXUSB.vbus_off | (self) | Turn off the target device's power. | Turn off the target device's power. | [
"Turn",
"off",
"the",
"target",
"device",
"s",
"power",
"."
] | def vbus_off(self):
"""Turn off the target device's power."""
self.wreg(rIOPINS2,0x00); | [
"def",
"vbus_off",
"(",
"self",
")",
":",
"self",
".",
"wreg",
"(",
"rIOPINS2",
",",
"0x00",
")"
] | https://github.com/withdk/badusb2-mitm-poc/blob/db2bfdb1dc9ad371aa665b292183c45577adfbaa/GoodFETMAXUSB.py#L624-L626 | ||
EasonLiao/CudaTree | fcd9c7f4dbac00c105bbfbff9f55db1d29747fc7 | cudatree/util.py | python | test_diff | (x, y) | return (np.count_nonzero(diff), x.size) | Test how many elements betweenn array
x and y are different. | Test how many elements betweenn array
x and y are different. | [
"Test",
"how",
"many",
"elements",
"betweenn",
"array",
"x",
"and",
"y",
"are",
"different",
"."
] | def test_diff(x, y):
""" Test how many elements betweenn array
x and y are different. """
assert isinstance(x, np.ndarray)
assert isinstance(y, np.ndarray)
assert x.size == y.size
diff = x - y
return (np.count_nonzero(diff), x.size) | [
"def",
"test_diff",
"(",
"x",
",",
"y",
")",
":",
"assert",
"isinstance",
"(",
"x",
",",
"np",
".",
"ndarray",
")",
"assert",
"isinstance",
"(",
"y",
",",
"np",
".",
"ndarray",
")",
"assert",
"x",
".",
"size",
"==",
"y",
".",
"size",
"diff",
"=",... | https://github.com/EasonLiao/CudaTree/blob/fcd9c7f4dbac00c105bbfbff9f55db1d29747fc7/cudatree/util.py#L107-L114 | |
wenwei202/terngrad | ec4f75e9a3a1e1c4b2e6494d830fbdfdd2e03ddc | terngrad/inception/slim/variables.py | python | get_variables_to_restore | () | return tf.get_collection(VARIABLES_TO_RESTORE)[:] | Gets the list of variables to restore.
Returns:
a copied list of variables. | Gets the list of variables to restore. | [
"Gets",
"the",
"list",
"of",
"variables",
"to",
"restore",
"."
] | def get_variables_to_restore():
"""Gets the list of variables to restore.
Returns:
a copied list of variables.
"""
return tf.get_collection(VARIABLES_TO_RESTORE)[:] | [
"def",
"get_variables_to_restore",
"(",
")",
":",
"return",
"tf",
".",
"get_collection",
"(",
"VARIABLES_TO_RESTORE",
")",
"[",
":",
"]"
] | https://github.com/wenwei202/terngrad/blob/ec4f75e9a3a1e1c4b2e6494d830fbdfdd2e03ddc/terngrad/inception/slim/variables.py#L130-L136 | |
Qiskit/qiskit-terra | b66030e3b9192efdd3eb95cf25c6545fe0a13da4 | qiskit/quantum_info/operators/channel/transformations.py | python | _to_choi | (rep, data, input_dim, output_dim) | Transform a QuantumChannel to the Choi representation. | Transform a QuantumChannel to the Choi representation. | [
"Transform",
"a",
"QuantumChannel",
"to",
"the",
"Choi",
"representation",
"."
] | def _to_choi(rep, data, input_dim, output_dim):
"""Transform a QuantumChannel to the Choi representation."""
if rep == "Choi":
return data
if rep == "Operator":
return _from_operator("Choi", data, input_dim, output_dim)
if rep == "SuperOp":
return _superop_to_choi(data, input_dim... | [
"def",
"_to_choi",
"(",
"rep",
",",
"data",
",",
"input_dim",
",",
"output_dim",
")",
":",
"if",
"rep",
"==",
"\"Choi\"",
":",
"return",
"data",
"if",
"rep",
"==",
"\"Operator\"",
":",
"return",
"_from_operator",
"(",
"\"Choi\"",
",",
"data",
",",
"input... | https://github.com/Qiskit/qiskit-terra/blob/b66030e3b9192efdd3eb95cf25c6545fe0a13da4/qiskit/quantum_info/operators/channel/transformations.py#L49-L66 | ||
cuthbertLab/music21 | bd30d4663e52955ed922c10fdf541419d8c67671 | music21/chord/__init__.py | python | Chord.isConsonant | (self) | returns True if the chord is
one pitch
two pitches: uses :meth:`~music21.interval.Interval.isConsonant()` , which
checks if interval is a major or minor third or sixth or perfect fifth.
three pitches: if chord is a major or minor triad not in second inversion.
... | returns True if the chord is
one pitch
two pitches: uses :meth:`~music21.interval.Interval.isConsonant()` , which
checks if interval is a major or minor third or sixth or perfect fifth.
three pitches: if chord is a major or minor triad not in second inversion. | [
"returns",
"True",
"if",
"the",
"chord",
"is",
"one",
"pitch",
"two",
"pitches",
":",
"uses",
":",
"meth",
":",
"~music21",
".",
"interval",
".",
"Interval",
".",
"isConsonant",
"()",
"which",
"checks",
"if",
"interval",
"is",
"a",
"major",
"or",
"minor"... | def isConsonant(self):
# noinspection PyShadowingNames
'''
returns True if the chord is
one pitch
two pitches: uses :meth:`~music21.interval.Interval.isConsonant()` , which
checks if interval is a major or minor third or sixth or perfect fifth.
... | [
"def",
"isConsonant",
"(",
"self",
")",
":",
"# noinspection PyShadowingNames",
"c2",
"=",
"self",
".",
"removeRedundantPitchNames",
"(",
"inPlace",
"=",
"False",
")",
"if",
"len",
"(",
"c2",
".",
"pitches",
")",
"==",
"1",
":",
"return",
"True",
"elif",
"... | https://github.com/cuthbertLab/music21/blob/bd30d4663e52955ed922c10fdf541419d8c67671/music21/chord/__init__.py#L2213-L2311 | ||
hpdang/pdfinator | 64f656e7efce2580b59c72292cf890e5e34b0475 | pdfinator.py | python | makePdf | (pdffilename,filenamelist, pagetype, gap) | return 0 | [] | def makePdf(pdffilename,filenamelist, pagetype, gap):
(pagewidth,pageheight)=GetPaperSize(pagetype)
rpagewidth = pagewidth-2*gap
rpageheight = pageheight-2*gap
pageaspect=float(rpageheight)/rpagewidth
#first go through the file list, find size and dimensions, and convert any that need converting t... | [
"def",
"makePdf",
"(",
"pdffilename",
",",
"filenamelist",
",",
"pagetype",
",",
"gap",
")",
":",
"(",
"pagewidth",
",",
"pageheight",
")",
"=",
"GetPaperSize",
"(",
"pagetype",
")",
"rpagewidth",
"=",
"pagewidth",
"-",
"2",
"*",
"gap",
"rpageheight",
"=",... | https://github.com/hpdang/pdfinator/blob/64f656e7efce2580b59c72292cf890e5e34b0475/pdfinator.py#L451-L607 | |||
Scarygami/mirror-api | 497783f6d721b24b793c1fcd8c71d0c7d11956d4 | lib/apiclient/http.py | python | MediaFileUpload.__init__ | (self, filename, mimetype=None, chunksize=DEFAULT_CHUNK_SIZE,
resumable=False) | Constructor.
Args:
filename: string, Name of the file.
mimetype: string, Mime-type of the file. If None then a mime-type will be
guessed from the file extension.
chunksize: int, File will be uploaded in chunks of this many bytes. Only
used if resumable=True. Pass in a value of -1 ... | Constructor. | [
"Constructor",
"."
] | def __init__(self, filename, mimetype=None, chunksize=DEFAULT_CHUNK_SIZE,
resumable=False):
"""Constructor.
Args:
filename: string, Name of the file.
mimetype: string, Mime-type of the file. If None then a mime-type will be
guessed from the file extension.
chunksize: in... | [
"def",
"__init__",
"(",
"self",
",",
"filename",
",",
"mimetype",
"=",
"None",
",",
"chunksize",
"=",
"DEFAULT_CHUNK_SIZE",
",",
"resumable",
"=",
"False",
")",
":",
"self",
".",
"_filename",
"=",
"filename",
"fd",
"=",
"open",
"(",
"self",
".",
"_filena... | https://github.com/Scarygami/mirror-api/blob/497783f6d721b24b793c1fcd8c71d0c7d11956d4/lib/apiclient/http.py#L405-L426 | ||
Juniper/py-junos-eznc | fd81d476e37ac1a234b503ab77f76ec658d04590 | lib/jnpr/junos/factory/view.py | python | View.asview | (self, view_cls) | return view_cls(self._table, self._xml) | create a new View object for this item | create a new View object for this item | [
"create",
"a",
"new",
"View",
"object",
"for",
"this",
"item"
] | def asview(self, view_cls):
"""create a new View object for this item"""
return view_cls(self._table, self._xml) | [
"def",
"asview",
"(",
"self",
",",
"view_cls",
")",
":",
"return",
"view_cls",
"(",
"self",
".",
"_table",
",",
"self",
".",
"_xml",
")"
] | https://github.com/Juniper/py-junos-eznc/blob/fd81d476e37ac1a234b503ab77f76ec658d04590/lib/jnpr/junos/factory/view.py#L213-L215 | |
nipy/nitime | d2d558386040a3075a1eeb018f305df175ccffe0 | nitime/analysis/spectral.py | python | FilterAnalyzer.fir | (self) | return sig | Filter the time-series using an FIR digital filter. Filtering is done
back and forth (using scipy.signal.filtfilt) to achieve zero phase
delay | Filter the time-series using an FIR digital filter. Filtering is done
back and forth (using scipy.signal.filtfilt) to achieve zero phase
delay | [
"Filter",
"the",
"time",
"-",
"series",
"using",
"an",
"FIR",
"digital",
"filter",
".",
"Filtering",
"is",
"done",
"back",
"and",
"forth",
"(",
"using",
"scipy",
".",
"signal",
".",
"filtfilt",
")",
"to",
"achieve",
"zero",
"phase",
"delay"
] | def fir(self):
"""
Filter the time-series using an FIR digital filter. Filtering is done
back and forth (using scipy.signal.filtfilt) to achieve zero phase
delay
"""
#Passband and stop-band are expressed as fraction of the Nyquist
#frequency:
if self.ub is... | [
"def",
"fir",
"(",
"self",
")",
":",
"#Passband and stop-band are expressed as fraction of the Nyquist",
"#frequency:",
"if",
"self",
".",
"ub",
"is",
"not",
"None",
":",
"ub_frac",
"=",
"self",
".",
"ub",
"/",
"(",
"self",
".",
"sampling_rate",
"/",
"2.",
")"... | https://github.com/nipy/nitime/blob/d2d558386040a3075a1eeb018f305df175ccffe0/nitime/analysis/spectral.py#L347-L397 | |
django-nonrel/django-nonrel | 4fbfe7344481a5eab8698f79207f09124310131b | django/contrib/gis/geos/prototypes/geom.py | python | bin_constructor | (func) | return func | Generates a prototype for binary construction (HEX, WKB) GEOS routines. | Generates a prototype for binary construction (HEX, WKB) GEOS routines. | [
"Generates",
"a",
"prototype",
"for",
"binary",
"construction",
"(",
"HEX",
"WKB",
")",
"GEOS",
"routines",
"."
] | def bin_constructor(func):
"Generates a prototype for binary construction (HEX, WKB) GEOS routines."
func.argtypes = [c_char_p, c_size_t]
func.restype = GEOM_PTR
func.errcheck = check_geom
return func | [
"def",
"bin_constructor",
"(",
"func",
")",
":",
"func",
".",
"argtypes",
"=",
"[",
"c_char_p",
",",
"c_size_t",
"]",
"func",
".",
"restype",
"=",
"GEOM_PTR",
"func",
".",
"errcheck",
"=",
"check_geom",
"return",
"func"
] | https://github.com/django-nonrel/django-nonrel/blob/4fbfe7344481a5eab8698f79207f09124310131b/django/contrib/gis/geos/prototypes/geom.py#L21-L26 | |
JDAI-CV/Partial-Person-ReID | fb94dbfbec1105bbc22a442702bc6e385427d416 | fastreid/engine/defaults.py | python | DefaultPredictor.__call__ | (self, image) | Args:
image (torch.tensor): an image tensor of shape (B, C, H, W).
Returns:
predictions (torch.tensor): the output features of the model | Args:
image (torch.tensor): an image tensor of shape (B, C, H, W).
Returns:
predictions (torch.tensor): the output features of the model | [
"Args",
":",
"image",
"(",
"torch",
".",
"tensor",
")",
":",
"an",
"image",
"tensor",
"of",
"shape",
"(",
"B",
"C",
"H",
"W",
")",
".",
"Returns",
":",
"predictions",
"(",
"torch",
".",
"tensor",
")",
":",
"the",
"output",
"features",
"of",
"the",
... | def __call__(self, image):
"""
Args:
image (torch.tensor): an image tensor of shape (B, C, H, W).
Returns:
predictions (torch.tensor): the output features of the model
"""
with torch.no_grad(): # https://github.com/sphinx-doc/sphinx/issues/4258
... | [
"def",
"__call__",
"(",
"self",
",",
"image",
")",
":",
"with",
"torch",
".",
"no_grad",
"(",
")",
":",
"# https://github.com/sphinx-doc/sphinx/issues/4258",
"image",
"=",
"image",
".",
"to",
"(",
"self",
".",
"device",
")",
"inputs",
"=",
"{",
"\"images\"",... | https://github.com/JDAI-CV/Partial-Person-ReID/blob/fb94dbfbec1105bbc22a442702bc6e385427d416/fastreid/engine/defaults.py#L145-L159 | ||
PaddlePaddle/PaddleX | 2bab73f81ab54e328204e7871e6ae4a82e719f5d | static/paddlex/cv/models/utils/detection_eval.py | python | fixed_linspace | (start,
stop,
num=50,
endpoint=True,
retstep=False,
dtype=None,
axis=0) | return backup_linspace(start, stop, num, endpoint, retstep, dtype, axis) | [] | def fixed_linspace(start,
stop,
num=50,
endpoint=True,
retstep=False,
dtype=None,
axis=0):
num = int(num)
return backup_linspace(start, stop, num, endpoint, retstep, dtype, axis) | [
"def",
"fixed_linspace",
"(",
"start",
",",
"stop",
",",
"num",
"=",
"50",
",",
"endpoint",
"=",
"True",
",",
"retstep",
"=",
"False",
",",
"dtype",
"=",
"None",
",",
"axis",
"=",
"0",
")",
":",
"num",
"=",
"int",
"(",
"num",
")",
"return",
"back... | https://github.com/PaddlePaddle/PaddleX/blob/2bab73f81ab54e328204e7871e6ae4a82e719f5d/static/paddlex/cv/models/utils/detection_eval.py#L30-L38 | |||
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/full/inspect.py | python | isroutine | (object) | return (isbuiltin(object)
or isfunction(object)
or ismethod(object)
or ismethoddescriptor(object)) | Return true if the object is any kind of function or method. | Return true if the object is any kind of function or method. | [
"Return",
"true",
"if",
"the",
"object",
"is",
"any",
"kind",
"of",
"function",
"or",
"method",
"."
] | def isroutine(object):
"""Return true if the object is any kind of function or method."""
return (isbuiltin(object)
or isfunction(object)
or ismethod(object)
or ismethoddescriptor(object)) | [
"def",
"isroutine",
"(",
"object",
")",
":",
"return",
"(",
"isbuiltin",
"(",
"object",
")",
"or",
"isfunction",
"(",
"object",
")",
"or",
"ismethod",
"(",
"object",
")",
"or",
"ismethoddescriptor",
"(",
"object",
")",
")"
] | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/inspect.py#L413-L418 | |
skyfielders/python-skyfield | 0e68757a5c1081f784c58fd7a76635c6deb98451 | skyfield/precessionlib.py | python | compute_precession | (jd_tdb) | return rot3 | Return the rotation matrices for precessing to an array of epochs.
`jd_tdb` - array of TDB Julian dates
The array returned has the shape `(3, 3, n)` where `n` is the number
of dates that have been provided as input. | Return the rotation matrices for precessing to an array of epochs. | [
"Return",
"the",
"rotation",
"matrices",
"for",
"precessing",
"to",
"an",
"array",
"of",
"epochs",
"."
] | def compute_precession(jd_tdb):
"""Return the rotation matrices for precessing to an array of epochs.
`jd_tdb` - array of TDB Julian dates
The array returned has the shape `(3, 3, n)` where `n` is the number
of dates that have been provided as input.
"""
eps0 = 84381.406
# 't' is time in... | [
"def",
"compute_precession",
"(",
"jd_tdb",
")",
":",
"eps0",
"=",
"84381.406",
"# 't' is time in TDB centuries.",
"t",
"=",
"(",
"jd_tdb",
"-",
"T0",
")",
"/",
"36525.0",
"# Numerical coefficients of psi_a, omega_a, and chi_a, along with",
"# epsilon_0, the obliquity at J200... | https://github.com/skyfielders/python-skyfield/blob/0e68757a5c1081f784c58fd7a76635c6deb98451/skyfield/precessionlib.py#L5-L69 | |
graalvm/mx | 29c0debab406352df3af246be2f8973be5db69ae | mx_benchmark.py | python | BenchmarkExecutor.benchmark | (self, mxBenchmarkArgs, bmSuiteArgs, returnSuiteAndResults=False) | Run a benchmark suite. | Run a benchmark suite. | [
"Run",
"a",
"benchmark",
"suite",
"."
] | def benchmark(self, mxBenchmarkArgs, bmSuiteArgs, returnSuiteAndResults=False):
"""Run a benchmark suite."""
parser = ArgumentParser(
prog="mx benchmark",
add_help=False,
description=benchmark.__doc__,
epilog="Note: parsers used by different suites have ad... | [
"def",
"benchmark",
"(",
"self",
",",
"mxBenchmarkArgs",
",",
"bmSuiteArgs",
",",
"returnSuiteAndResults",
"=",
"False",
")",
":",
"parser",
"=",
"ArgumentParser",
"(",
"prog",
"=",
"\"mx benchmark\"",
",",
"add_help",
"=",
"False",
",",
"description",
"=",
"b... | https://github.com/graalvm/mx/blob/29c0debab406352df3af246be2f8973be5db69ae/mx_benchmark.py#L2575-L2758 | ||
johnboxall/django-ab | 0c2444636db2b00b25a23ad62e4b8ac7e43690bd | abs.py | python | AB.convert | (self, exp) | Update the test active on the request for this experiment. | Update the test active on the request for this experiment. | [
"Update",
"the",
"test",
"active",
"on",
"the",
"request",
"for",
"this",
"experiment",
"."
] | def convert(self, exp):
"""Update the test active on the request for this experiment."""
key = self.get_experiment_key(exp)
test_id = self.request.session[key]["id"]
test = Test.objects.get(pk=test_id)
test.conversions = test.conversions + 1
test.save()
s... | [
"def",
"convert",
"(",
"self",
",",
"exp",
")",
":",
"key",
"=",
"self",
".",
"get_experiment_key",
"(",
"exp",
")",
"test_id",
"=",
"self",
".",
"request",
".",
"session",
"[",
"key",
"]",
"[",
"\"id\"",
"]",
"test",
"=",
"Test",
".",
"objects",
"... | https://github.com/johnboxall/django-ab/blob/0c2444636db2b00b25a23ad62e4b8ac7e43690bd/abs.py#L81-L90 | ||
bytefish/facerec | 4071e1e79a50dbf1d1f2e061d24448576e5ac37d | py/facerec/feature.py | python | SpatialHistogram.__init__ | (self, lbp_operator=ExtendedLBP(), sz = (8,8)) | [] | def __init__(self, lbp_operator=ExtendedLBP(), sz = (8,8)):
AbstractFeature.__init__(self)
if not isinstance(lbp_operator, LocalDescriptor):
raise TypeError("Only an operator of type facerec.lbp.LocalDescriptor is a valid lbp_operator.")
self.lbp_operator = lbp_operator
self.... | [
"def",
"__init__",
"(",
"self",
",",
"lbp_operator",
"=",
"ExtendedLBP",
"(",
")",
",",
"sz",
"=",
"(",
"8",
",",
"8",
")",
")",
":",
"AbstractFeature",
".",
"__init__",
"(",
"self",
")",
"if",
"not",
"isinstance",
"(",
"lbp_operator",
",",
"LocalDescr... | https://github.com/bytefish/facerec/blob/4071e1e79a50dbf1d1f2e061d24448576e5ac37d/py/facerec/feature.py#L235-L240 | ||||
usablica/liaar | e965121bcf8c3b935917db5db3adc9b12e7761d8 | liaar/lib/app.py | python | get_methods | (app_name, resource_name) | return methods_list | Get all methods of given resource name | Get all methods of given resource name | [
"Get",
"all",
"methods",
"of",
"given",
"resource",
"name"
] | def get_methods(app_name, resource_name):
'''
Get all methods of given resource name
'''
methods_list = []
resource_abs_path = path.get_resource_abs_path(app_name, resource_name)
for method_name in os.listdir(resource_abs_path):
name_re = re.match('^(.+)\.json$', method_name)
i... | [
"def",
"get_methods",
"(",
"app_name",
",",
"resource_name",
")",
":",
"methods_list",
"=",
"[",
"]",
"resource_abs_path",
"=",
"path",
".",
"get_resource_abs_path",
"(",
"app_name",
",",
"resource_name",
")",
"for",
"method_name",
"in",
"os",
".",
"listdir",
... | https://github.com/usablica/liaar/blob/e965121bcf8c3b935917db5db3adc9b12e7761d8/liaar/lib/app.py#L108-L121 | |
arviz-devs/arviz | 17b1a48b577ba9776a31e7e57a8a8af63e826901 | arviz/data/io_cmdstanpy.py | python | CmdStanPyConverter.constant_data_to_xarray | (self) | return dict_to_dataset(
self.constant_data,
library=self.cmdstanpy,
coords=self.coords,
dims=self.dims,
default_dims=[],
index_origin=self.index_origin,
) | Convert constant data to xarray. | Convert constant data to xarray. | [
"Convert",
"constant",
"data",
"to",
"xarray",
"."
] | def constant_data_to_xarray(self):
"""Convert constant data to xarray."""
return dict_to_dataset(
self.constant_data,
library=self.cmdstanpy,
coords=self.coords,
dims=self.dims,
default_dims=[],
index_origin=self.index_origin,
... | [
"def",
"constant_data_to_xarray",
"(",
"self",
")",
":",
"return",
"dict_to_dataset",
"(",
"self",
".",
"constant_data",
",",
"library",
"=",
"self",
".",
"cmdstanpy",
",",
"coords",
"=",
"self",
".",
"coords",
",",
"dims",
"=",
"self",
".",
"dims",
",",
... | https://github.com/arviz-devs/arviz/blob/17b1a48b577ba9776a31e7e57a8a8af63e826901/arviz/data/io_cmdstanpy.py#L422-L431 | |
huawei-noah/vega | d9f13deede7f2b584e4b1d32ffdb833856129989 | vega/algorithms/nas/modnas/data_provider/base.py | python | DataProviderBase.reset_train_iter | (self) | Reset train iterator. | Reset train iterator. | [
"Reset",
"train",
"iterator",
"."
] | def reset_train_iter(self):
"""Reset train iterator."""
raise NotImplementedError | [
"def",
"reset_train_iter",
"(",
"self",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/huawei-noah/vega/blob/d9f13deede7f2b584e4b1d32ffdb833856129989/vega/algorithms/nas/modnas/data_provider/base.py#L42-L44 | ||
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/graphite/__init__.py | python | GraphiteFeeder.run | (self) | Run the process to export the data. | Run the process to export the data. | [
"Run",
"the",
"process",
"to",
"export",
"the",
"data",
"."
] | def run(self):
"""Run the process to export the data."""
while True:
if (event := self._queue.get()) == self._quit_object:
_LOGGER.debug("Event processing thread stopped")
self._queue.task_done()
return
if event.event_type == EVENT_... | [
"def",
"run",
"(",
"self",
")",
":",
"while",
"True",
":",
"if",
"(",
"event",
":=",
"self",
".",
"_queue",
".",
"get",
"(",
")",
")",
"==",
"self",
".",
"_quit_object",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Event processing thread stopped\"",
")",
"se... | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/graphite/__init__.py#L151-L182 | ||
wxWidgets/Phoenix | b2199e299a6ca6d866aa6f3d0888499136ead9d6 | demo/agw/MacLargeDemo.py | python | MacRenderer.DrawProgressBar | (self, dc, x, y, w, h, percent) | Draws a progress bar in the (x,y,w,h) box that represents a progress of
'percent'. The progress bar is only horizontal and it's height is constant
(PIPE_HEIGHT). The 'h' parameter is used to vertically center the progress
bar in the allotted space.
The drawing is speed-optimized. Two bi... | Draws a progress bar in the (x,y,w,h) box that represents a progress of
'percent'. The progress bar is only horizontal and it's height is constant
(PIPE_HEIGHT). The 'h' parameter is used to vertically center the progress
bar in the allotted space. | [
"Draws",
"a",
"progress",
"bar",
"in",
"the",
"(",
"x",
"y",
"w",
"h",
")",
"box",
"that",
"represents",
"a",
"progress",
"of",
"percent",
".",
"The",
"progress",
"bar",
"is",
"only",
"horizontal",
"and",
"it",
"s",
"height",
"is",
"constant",
"(",
"... | def DrawProgressBar(self, dc, x, y, w, h, percent):
"""
Draws a progress bar in the (x,y,w,h) box that represents a progress of
'percent'. The progress bar is only horizontal and it's height is constant
(PIPE_HEIGHT). The 'h' parameter is used to vertically center the progress
ba... | [
"def",
"DrawProgressBar",
"(",
"self",
",",
"dc",
",",
"x",
",",
"y",
",",
"w",
",",
"h",
",",
"percent",
")",
":",
"# Create two pipes",
"if",
"self",
".",
"DONE_BITMAP",
"is",
"None",
":",
"self",
".",
"DONE_BITMAP",
"=",
"wx",
".",
"Bitmap",
"(",
... | https://github.com/wxWidgets/Phoenix/blob/b2199e299a6ca6d866aa6f3d0888499136ead9d6/demo/agw/MacLargeDemo.py#L197-L246 | ||
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/twitter/notify.py | python | TwitterNotificationService.log_error_resp_append | (resp) | Log error response, during upload append phase. | Log error response, during upload append phase. | [
"Log",
"error",
"response",
"during",
"upload",
"append",
"phase",
"."
] | def log_error_resp_append(resp):
"""Log error response, during upload append phase."""
obj = json.loads(resp.text)
error_message = obj["errors"][0]["message"]
error_code = obj["errors"][0]["code"]
_LOGGER.error(
"Error %s: %s (Code %s)", resp.status_code, error_messag... | [
"def",
"log_error_resp_append",
"(",
"resp",
")",
":",
"obj",
"=",
"json",
".",
"loads",
"(",
"resp",
".",
"text",
")",
"error_message",
"=",
"obj",
"[",
"\"errors\"",
"]",
"[",
"0",
"]",
"[",
"\"message\"",
"]",
"error_code",
"=",
"obj",
"[",
"\"error... | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/twitter/notify.py#L255-L262 | ||
sethmlarson/virtualbox-python | 984a6e2cb0e8996f4df40f4444c1528849f1c70d | virtualbox/library.py | python | IBIOSSettings.smbios_uuid_little_endian | (self) | return ret | Get or set bool value for 'SMBIOSUuidLittleEndian'
Flag to control whether the SMBIOS system UUID is presented in little endian
form to the guest as mandated by the SMBIOS spec chapter 7.2.1.
Before VirtualBox version 6.1 it was always presented in big endian form
and to retain the old b... | Get or set bool value for 'SMBIOSUuidLittleEndian'
Flag to control whether the SMBIOS system UUID is presented in little endian
form to the guest as mandated by the SMBIOS spec chapter 7.2.1.
Before VirtualBox version 6.1 it was always presented in big endian form
and to retain the old b... | [
"Get",
"or",
"set",
"bool",
"value",
"for",
"SMBIOSUuidLittleEndian",
"Flag",
"to",
"control",
"whether",
"the",
"SMBIOS",
"system",
"UUID",
"is",
"presented",
"in",
"little",
"endian",
"form",
"to",
"the",
"guest",
"as",
"mandated",
"by",
"the",
"SMBIOS",
"... | def smbios_uuid_little_endian(self):
"""Get or set bool value for 'SMBIOSUuidLittleEndian'
Flag to control whether the SMBIOS system UUID is presented in little endian
form to the guest as mandated by the SMBIOS spec chapter 7.2.1.
Before VirtualBox version 6.1 it was always presented in... | [
"def",
"smbios_uuid_little_endian",
"(",
"self",
")",
":",
"ret",
"=",
"self",
".",
"_get_attr",
"(",
"\"SMBIOSUuidLittleEndian\"",
")",
"return",
"ret"
] | https://github.com/sethmlarson/virtualbox-python/blob/984a6e2cb0e8996f4df40f4444c1528849f1c70d/virtualbox/library.py#L13475-L13484 | |
biolab/orange3 | 41685e1c7b1d1babe680113685a2d44bcc9fec0b | Orange/widgets/visualize/owfreeviz.py | python | OWFreeVizGraph.update_radius | (self) | [] | def update_radius(self):
self.update_circle()
self.update_anchors() | [
"def",
"update_radius",
"(",
"self",
")",
":",
"self",
".",
"update_circle",
"(",
")",
"self",
".",
"update_anchors",
"(",
")"
] | https://github.com/biolab/orange3/blob/41685e1c7b1d1babe680113685a2d44bcc9fec0b/Orange/widgets/visualize/owfreeviz.py#L64-L66 | ||||
Yelp/kafka-utils | 74831206648512db1a29426c6ebb428b33820d04 | kafka_utils/kafka_cluster_manager/cluster_info/stats.py | python | get_broker_weights | (brokers) | return [broker.weight for broker in brokers] | Get a list containing the weight of each broker | Get a list containing the weight of each broker | [
"Get",
"a",
"list",
"containing",
"the",
"weight",
"of",
"each",
"broker"
] | def get_broker_weights(brokers):
"""Get a list containing the weight of each broker"""
return [broker.weight for broker in brokers] | [
"def",
"get_broker_weights",
"(",
"brokers",
")",
":",
"return",
"[",
"broker",
".",
"weight",
"for",
"broker",
"in",
"brokers",
"]"
] | https://github.com/Yelp/kafka-utils/blob/74831206648512db1a29426c6ebb428b33820d04/kafka_utils/kafka_cluster_manager/cluster_info/stats.py#L147-L149 | |
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | ansible/roles/lib_gcloud/library/gcloud_dm_resource_builder.py | python | NetworkInterface.get_instance_interface | (self) | return {'accessConfigs': self.access_config,
'network': self._network_link,
'subnetwork': self._subnet_link,
} | return in vminstance format | return in vminstance format | [
"return",
"in",
"vminstance",
"format"
] | def get_instance_interface(self):
'''return in vminstance format'''
return {'accessConfigs': self.access_config,
'network': self._network_link,
'subnetwork': self._subnet_link,
} | [
"def",
"get_instance_interface",
"(",
"self",
")",
":",
"return",
"{",
"'accessConfigs'",
":",
"self",
".",
"access_config",
",",
"'network'",
":",
"self",
".",
"_network_link",
",",
"'subnetwork'",
":",
"self",
".",
"_subnet_link",
",",
"}"
] | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/ansible/roles/lib_gcloud/library/gcloud_dm_resource_builder.py#L1077-L1082 | |
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | ansible/roles/lib_openshift_3.2/library/oadm_router.py | python | Router.service | (self, config) | setter for property service | setter for property service | [
"setter",
"for",
"property",
"service"
] | def service(self, config):
''' setter for property service '''
self.svc = config | [
"def",
"service",
"(",
"self",
",",
"config",
")",
":",
"self",
".",
"svc",
"=",
"config"
] | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/ansible/roles/lib_openshift_3.2/library/oadm_router.py#L1936-L1938 | ||
Source-Python-Dev-Team/Source.Python | d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb | addons/source-python/Python3/multiprocessing/connection.py | python | _ConnectionBase.recv_bytes | (self, maxlength=None) | return buf.getvalue() | Receive bytes data as a bytes object. | Receive bytes data as a bytes object. | [
"Receive",
"bytes",
"data",
"as",
"a",
"bytes",
"object",
"."
] | def recv_bytes(self, maxlength=None):
"""
Receive bytes data as a bytes object.
"""
self._check_closed()
self._check_readable()
if maxlength is not None and maxlength < 0:
raise ValueError("negative maxlength")
buf = self._recv_bytes(maxlength)
... | [
"def",
"recv_bytes",
"(",
"self",
",",
"maxlength",
"=",
"None",
")",
":",
"self",
".",
"_check_closed",
"(",
")",
"self",
".",
"_check_readable",
"(",
")",
"if",
"maxlength",
"is",
"not",
"None",
"and",
"maxlength",
"<",
"0",
":",
"raise",
"ValueError",... | https://github.com/Source-Python-Dev-Team/Source.Python/blob/d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb/addons/source-python/Python3/multiprocessing/connection.py#L208-L219 | |
Abjad/abjad | d0646dfbe83db3dc5ab268f76a0950712b87b7fd | abjad/parsers/parser.py | python | LilyPondSyntacticalDefinition.p_full_markup__MARKUP__markup_top | (self, p) | full_markup : MARKUP markup_top | full_markup : MARKUP markup_top | [
"full_markup",
":",
"MARKUP",
"markup_top"
] | def p_full_markup__MARKUP__markup_top(self, p):
"full_markup : MARKUP markup_top"
# assert isinstance(p[2], list), repr(p[2])
# item = (str, MarkupCommand)
# assert all(isinstance(_, item) for _ in p[2]), repr(p[2])
# p[0] = _markups.Markup(p[2])
string = " ".join([str(_)... | [
"def",
"p_full_markup__MARKUP__markup_top",
"(",
"self",
",",
"p",
")",
":",
"# assert isinstance(p[2], list), repr(p[2])",
"# item = (str, MarkupCommand)",
"# assert all(isinstance(_, item) for _ in p[2]), repr(p[2])",
"# p[0] = _markups.Markup(p[2])",
"string",
"=",
"\" \"",
".",
"... | https://github.com/Abjad/abjad/blob/d0646dfbe83db3dc5ab268f76a0950712b87b7fd/abjad/parsers/parser.py#L4855-L4865 | ||
pyparallel/pyparallel | 11e8c6072d48c8f13641925d17b147bf36ee0ba3 | Lib/site-packages/pyzmq-14.7.0-py3.3-win-amd64.egg/zmq/log/handlers.py | python | PUBHandler.emit | (self, record) | Emit a log message on my socket. | Emit a log message on my socket. | [
"Emit",
"a",
"log",
"message",
"on",
"my",
"socket",
"."
] | def emit(self, record):
"""Emit a log message on my socket."""
try:
topic, record.msg = record.msg.split(TOPIC_DELIM,1)
except Exception:
topic = ""
try:
bmsg = cast_bytes(self.format(record))
except Exception:
self.handleError(reco... | [
"def",
"emit",
"(",
"self",
",",
"record",
")",
":",
"try",
":",
"topic",
",",
"record",
".",
"msg",
"=",
"record",
".",
"msg",
".",
"split",
"(",
"TOPIC_DELIM",
",",
"1",
")",
"except",
"Exception",
":",
"topic",
"=",
"\"\"",
"try",
":",
"bmsg",
... | https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/site-packages/pyzmq-14.7.0-py3.3-win-amd64.egg/zmq/log/handlers.py#L87-L111 | ||
kubernetes-client/python | 47b9da9de2d02b2b7a34fbe05afb44afd130d73a | kubernetes/client/models/v1_photon_persistent_disk_volume_source.py | python | V1PhotonPersistentDiskVolumeSource.pd_id | (self) | return self._pd_id | Gets the pd_id of this V1PhotonPersistentDiskVolumeSource. # noqa: E501
ID that identifies Photon Controller persistent disk # noqa: E501
:return: The pd_id of this V1PhotonPersistentDiskVolumeSource. # noqa: E501
:rtype: str | Gets the pd_id of this V1PhotonPersistentDiskVolumeSource. # noqa: E501 | [
"Gets",
"the",
"pd_id",
"of",
"this",
"V1PhotonPersistentDiskVolumeSource",
".",
"#",
"noqa",
":",
"E501"
] | def pd_id(self):
"""Gets the pd_id of this V1PhotonPersistentDiskVolumeSource. # noqa: E501
ID that identifies Photon Controller persistent disk # noqa: E501
:return: The pd_id of this V1PhotonPersistentDiskVolumeSource. # noqa: E501
:rtype: str
"""
return self._pd_i... | [
"def",
"pd_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_pd_id"
] | https://github.com/kubernetes-client/python/blob/47b9da9de2d02b2b7a34fbe05afb44afd130d73a/kubernetes/client/models/v1_photon_persistent_disk_volume_source.py#L83-L91 | |
DataDog/integrations-core | 934674b29d94b70ccc008f76ea172d0cdae05e1e | etcd/datadog_checks/etcd/etcd.py | python | Etcd.check_post_v3 | (self) | [] | def check_post_v3(self):
scraper_config = self.get_scraper_config(self.instance)
if 'prometheus_url' not in scraper_config:
raise ConfigurationError('You have to define at least one `prometheus_url`.')
if not scraper_config.get('metrics_mapper'):
raise ConfigurationErro... | [
"def",
"check_post_v3",
"(",
"self",
")",
":",
"scraper_config",
"=",
"self",
".",
"get_scraper_config",
"(",
"self",
".",
"instance",
")",
"if",
"'prometheus_url'",
"not",
"in",
"scraper_config",
":",
"raise",
"ConfigurationError",
"(",
"'You have to define at leas... | https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/etcd/datadog_checks/etcd/etcd.py#L140-L160 | ||||
deepdrive/deepdrive | 11adb9480ffeba832231e15eb545ec9aba1f7d65 | vendor/tensorflow/models/research/slim/nets/mobilenet/mobilenet.py | python | mobilenet | (inputs,
num_classes=1001,
prediction_fn=slim.softmax,
reuse=None,
scope='Mobilenet',
base_only=False,
**mobilenet_args) | return logits, end_points | Mobilenet model for classification, supports both V1 and V2.
Note: default mode is inference, use mobilenet.training_scope to create
training network.
Args:
inputs: a tensor of shape [batch_size, height, width, channels].
num_classes: number of predicted classes. If 0 or None, the logits layer
is... | Mobilenet model for classification, supports both V1 and V2. | [
"Mobilenet",
"model",
"for",
"classification",
"supports",
"both",
"V1",
"and",
"V2",
"."
] | def mobilenet(inputs,
num_classes=1001,
prediction_fn=slim.softmax,
reuse=None,
scope='Mobilenet',
base_only=False,
**mobilenet_args):
"""Mobilenet model for classification, supports both V1 and V2.
Note: default mode is inference,... | [
"def",
"mobilenet",
"(",
"inputs",
",",
"num_classes",
"=",
"1001",
",",
"prediction_fn",
"=",
"slim",
".",
"softmax",
",",
"reuse",
"=",
"None",
",",
"scope",
"=",
"'Mobilenet'",
",",
"base_only",
"=",
"False",
",",
"*",
"*",
"mobilenet_args",
")",
":",... | https://github.com/deepdrive/deepdrive/blob/11adb9480ffeba832231e15eb545ec9aba1f7d65/vendor/tensorflow/models/research/slim/nets/mobilenet/mobilenet.py#L356-L437 | |
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/categories/graded_modules.py | python | GradedModulesCategory.__init__ | (self, base_category) | EXAMPLES::
sage: C = GradedAlgebras(QQ)
sage: C
Category of graded algebras over Rational Field
sage: C.base_category()
Category of algebras over Rational Field
sage: sorted(C.super_categories(), key=str)
[Category of filtered algebras... | EXAMPLES:: | [
"EXAMPLES",
"::"
] | def __init__(self, base_category):
"""
EXAMPLES::
sage: C = GradedAlgebras(QQ)
sage: C
Category of graded algebras over Rational Field
sage: C.base_category()
Category of algebras over Rational Field
sage: sorted(C.super_categories... | [
"def",
"__init__",
"(",
"self",
",",
"base_category",
")",
":",
"super",
"(",
"GradedModulesCategory",
",",
"self",
")",
".",
"__init__",
"(",
"base_category",
",",
"base_category",
".",
"base_ring",
"(",
")",
")"
] | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/categories/graded_modules.py#L18-L45 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/urllib3/util/selectors.py | python | BaseSelector.register | (self, fileobj, events, data=None) | return key | Register a file object for a set of events to monitor. | Register a file object for a set of events to monitor. | [
"Register",
"a",
"file",
"object",
"for",
"a",
"set",
"of",
"events",
"to",
"monitor",
"."
] | def register(self, fileobj, events, data=None):
""" Register a file object for a set of events to monitor. """
if (not events) or (events & ~(EVENT_READ | EVENT_WRITE)):
raise ValueError("Invalid events: {0!r}".format(events))
key = SelectorKey(fileobj, self._fileobj_lookup(fileobj)... | [
"def",
"register",
"(",
"self",
",",
"fileobj",
",",
"events",
",",
"data",
"=",
"None",
")",
":",
"if",
"(",
"not",
"events",
")",
"or",
"(",
"events",
"&",
"~",
"(",
"EVENT_READ",
"|",
"EVENT_WRITE",
")",
")",
":",
"raise",
"ValueError",
"(",
"\"... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/urllib3/util/selectors.py#L192-L204 | |
PySimpleGUI/PySimpleGUI | 6c0d1fb54f493d45e90180b322fbbe70f7a5af3c | PySimpleGUIWx/PySimpleGUIWx.py | python | Window._ReadNonBlocking | (self) | return BuildResults(self, False, self) | [] | def _ReadNonBlocking(self):
if self.TKrootDestroyed:
return None, None
if not self.Shown:
self.Show(non_blocking=True)
else:
# event = wx.Event()
# self.App.QueueEvent(event)
timer = wx.Timer(self.App)
self.App.Bind(wx.EVT_T... | [
"def",
"_ReadNonBlocking",
"(",
"self",
")",
":",
"if",
"self",
".",
"TKrootDestroyed",
":",
"return",
"None",
",",
"None",
"if",
"not",
"self",
".",
"Shown",
":",
"self",
".",
"Show",
"(",
"non_blocking",
"=",
"True",
")",
"else",
":",
"# event = wx.Eve... | https://github.com/PySimpleGUI/PySimpleGUI/blob/6c0d1fb54f493d45e90180b322fbbe70f7a5af3c/PySimpleGUIWx/PySimpleGUIWx.py#L3166-L3189 | |||
danirus/django-comments-xtd | c2ec50226d219d98fe0faeae4e66e8a676b47e5b | docs/extensions.py | python | setup | (app) | [] | def setup(app):
app.add_crossref_type(
directivename = "setting",
rolename = "setting",
indextemplate = "pair: %s; setting",
)
app.add_crossref_type(
directivename = "templatetag",
rolename = "ttag",
indextemplate = "pair: %s; template tag"
)
... | [
"def",
"setup",
"(",
"app",
")",
":",
"app",
".",
"add_crossref_type",
"(",
"directivename",
"=",
"\"setting\"",
",",
"rolename",
"=",
"\"setting\"",
",",
"indextemplate",
"=",
"\"pair: %s; setting\"",
",",
")",
"app",
".",
"add_crossref_type",
"(",
"directivena... | https://github.com/danirus/django-comments-xtd/blob/c2ec50226d219d98fe0faeae4e66e8a676b47e5b/docs/extensions.py#L1-L21 | ||||
s-leger/archipack | 5a6243bf1edf08a6b429661ce291dacb551e5f8a | pygeos/op_buffer.py | python | BufferSubGraph.compareTo | (self, other) | return 0 | * BufferSubgraphs are compared on the x-value of their rightmost
* Coordinate.
*
* This defines a partial ordering on the graphs such that:
*
* g1 >= g2 <=>= Ring(g2) does not contain Ring(g1)
*
* where Polygon(g) is the buffer polygon that is built from g.... | * BufferSubgraphs are compared on the x-value of their rightmost
* Coordinate.
*
* This defines a partial ordering on the graphs such that:
*
* g1 >= g2 <=>= Ring(g2) does not contain Ring(g1)
*
* where Polygon(g) is the buffer polygon that is built from g.... | [
"*",
"BufferSubgraphs",
"are",
"compared",
"on",
"the",
"x",
"-",
"value",
"of",
"their",
"rightmost",
"*",
"Coordinate",
".",
"*",
"*",
"This",
"defines",
"a",
"partial",
"ordering",
"on",
"the",
"graphs",
"such",
"that",
":",
"*",
"*",
"g1",
">",
"="... | def compareTo(self, other) -> int:
"""
* BufferSubgraphs are compared on the x-value of their rightmost
* Coordinate.
*
* This defines a partial ordering on the graphs such that:
*
* g1 >= g2 <=>= Ring(g2) does not contain Ring(g1)
*
* wher... | [
"def",
"compareTo",
"(",
"self",
",",
"other",
")",
"->",
"int",
":",
"if",
"self",
".",
"rightMostCoord",
".",
"x",
"<",
"other",
".",
"rightMostCoord",
".",
"x",
":",
"return",
"-",
"1",
"if",
"self",
".",
"rightMostCoord",
".",
"x",
">",
"other",
... | https://github.com/s-leger/archipack/blob/5a6243bf1edf08a6b429661ce291dacb551e5f8a/pygeos/op_buffer.py#L810-L829 | |
triaquae/triaquae | bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9 | TriAquae/models/Centos_6.4/ecdsa/der.py | python | encode_constructed | (tag, value) | return int2byte(0xa0+tag) + encode_length(len(value)) + value | [] | def encode_constructed(tag, value):
return int2byte(0xa0+tag) + encode_length(len(value)) + value | [
"def",
"encode_constructed",
"(",
"tag",
",",
"value",
")",
":",
"return",
"int2byte",
"(",
"0xa0",
"+",
"tag",
")",
"+",
"encode_length",
"(",
"len",
"(",
"value",
")",
")",
"+",
"value"
] | https://github.com/triaquae/triaquae/blob/bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9/TriAquae/models/Centos_6.4/ecdsa/der.py#L10-L11 | |||
WikidPad/WikidPad | 558109638807bc76b4672922686e416ab2d5f79c | WikidPad/lib/pwiki/customtreectrl.py | python | CustomTreeCtrl.IsBold | (self, item) | return item.IsBold() | Returns whether the item font is bold or not. | Returns whether the item font is bold or not. | [
"Returns",
"whether",
"the",
"item",
"font",
"is",
"bold",
"or",
"not",
"."
] | def IsBold(self, item):
"""Returns whether the item font is bold or not."""
if not item:
raise Exception("\nERROR: Invalid Tree Item. ")
return item.IsBold() | [
"def",
"IsBold",
"(",
"self",
",",
"item",
")",
":",
"if",
"not",
"item",
":",
"raise",
"Exception",
"(",
"\"\\nERROR: Invalid Tree Item. \"",
")",
"return",
"item",
".",
"IsBold",
"(",
")"
] | https://github.com/WikidPad/WikidPad/blob/558109638807bc76b4672922686e416ab2d5f79c/WikidPad/lib/pwiki/customtreectrl.py#L2993-L2999 | |
chromium/web-page-replay | 472351e1122bb1beb936952c7e75ae58bf8a69f1 | third_party/dns/rrset.py | python | RRset.match | (self, name, rdclass, rdtype, covers, deleting=None) | return True | Returns True if this rrset matches the specified class, type,
covers, and deletion state. | Returns True if this rrset matches the specified class, type,
covers, and deletion state. | [
"Returns",
"True",
"if",
"this",
"rrset",
"matches",
"the",
"specified",
"class",
"type",
"covers",
"and",
"deletion",
"state",
"."
] | def match(self, name, rdclass, rdtype, covers, deleting=None):
"""Returns True if this rrset matches the specified class, type,
covers, and deletion state."""
if not super(RRset, self).match(rdclass, rdtype, covers):
return False
if self.name != name or self.deleting != dele... | [
"def",
"match",
"(",
"self",
",",
"name",
",",
"rdclass",
",",
"rdtype",
",",
"covers",
",",
"deleting",
"=",
"None",
")",
":",
"if",
"not",
"super",
"(",
"RRset",
",",
"self",
")",
".",
"match",
"(",
"rdclass",
",",
"rdtype",
",",
"covers",
")",
... | https://github.com/chromium/web-page-replay/blob/472351e1122bb1beb936952c7e75ae58bf8a69f1/third_party/dns/rrset.py#L76-L84 | |
pyparallel/pyparallel | 11e8c6072d48c8f13641925d17b147bf36ee0ba3 | Lib/site-packages/pip-7.1.2-py3.3.egg/pip/_vendor/lockfile/__init__.py | python | LockBase.release | (self) | Release the lock.
If the file is not locked, raise NotLocked. | Release the lock. | [
"Release",
"the",
"lock",
"."
] | def release(self):
"""
Release the lock.
If the file is not locked, raise NotLocked.
"""
raise NotImplemented("implement in subclass") | [
"def",
"release",
"(",
"self",
")",
":",
"raise",
"NotImplemented",
"(",
"\"implement in subclass\"",
")"
] | https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/site-packages/pip-7.1.2-py3.3.egg/pip/_vendor/lockfile/__init__.py#L208-L214 | ||
rll/rllab | ba78e4c16dc492982e648f117875b22af3965579 | sandbox/rocky/tf/distributions/base.py | python | Distribution.kl_sym | (self, old_dist_info_vars, new_dist_info_vars) | Compute the symbolic KL divergence of two distributions | Compute the symbolic KL divergence of two distributions | [
"Compute",
"the",
"symbolic",
"KL",
"divergence",
"of",
"two",
"distributions"
] | def kl_sym(self, old_dist_info_vars, new_dist_info_vars):
"""
Compute the symbolic KL divergence of two distributions
"""
raise NotImplementedError | [
"def",
"kl_sym",
"(",
"self",
",",
"old_dist_info_vars",
",",
"new_dist_info_vars",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/rll/rllab/blob/ba78e4c16dc492982e648f117875b22af3965579/sandbox/rocky/tf/distributions/base.py#L10-L14 | ||
Rapptz/discord.py | 45d498c1b76deaf3b394d17ccf56112fa691d160 | discord/webhook/async_.py | python | WebhookMessage.delete | (self, *, delay: Optional[float] = None) | |coro|
Deletes the message.
Parameters
-----------
delay: Optional[:class:`float`]
If provided, the number of seconds to wait before deleting the message.
The waiting is done in the background and deletion failures are ignored.
Raises
------
... | |coro| | [
"|coro|"
] | async def delete(self, *, delay: Optional[float] = None) -> None:
"""|coro|
Deletes the message.
Parameters
-----------
delay: Optional[:class:`float`]
If provided, the number of seconds to wait before deleting the message.
The waiting is done in the bac... | [
"async",
"def",
"delete",
"(",
"self",
",",
"*",
",",
"delay",
":",
"Optional",
"[",
"float",
"]",
"=",
"None",
")",
"->",
"None",
":",
"if",
"delay",
"is",
"not",
"None",
":",
"async",
"def",
"inner_call",
"(",
"delay",
":",
"float",
"=",
"delay",... | https://github.com/Rapptz/discord.py/blob/45d498c1b76deaf3b394d17ccf56112fa691d160/discord/webhook/async_.py#L716-L748 | ||
google-research/batch-ppo | 3d09705977bae4e7c3eb20339a3b384d2a5531e4 | agents/scripts/utility.py | python | initialize_variables | (sess, saver, logdir, checkpoint=None, resume=None) | Initialize or restore variables from a checkpoint if available.
Args:
sess: Session to initialize variables in.
saver: Saver to restore variables.
logdir: Directory to search for checkpoints.
checkpoint: Specify what checkpoint name to use; defaults to most recent.
resume: Whether to expect recov... | Initialize or restore variables from a checkpoint if available. | [
"Initialize",
"or",
"restore",
"variables",
"from",
"a",
"checkpoint",
"if",
"available",
"."
] | def initialize_variables(sess, saver, logdir, checkpoint=None, resume=None):
"""Initialize or restore variables from a checkpoint if available.
Args:
sess: Session to initialize variables in.
saver: Saver to restore variables.
logdir: Directory to search for checkpoints.
checkpoint: Specify what ch... | [
"def",
"initialize_variables",
"(",
"sess",
",",
"saver",
",",
"logdir",
",",
"checkpoint",
"=",
"None",
",",
"resume",
"=",
"None",
")",
":",
"sess",
".",
"run",
"(",
"tf",
".",
"group",
"(",
"tf",
".",
"local_variables_initializer",
"(",
")",
",",
"t... | https://github.com/google-research/batch-ppo/blob/3d09705977bae4e7c3eb20339a3b384d2a5531e4/agents/scripts/utility.py#L100-L129 | ||
skylander86/lambda-text-extractor | 6da52d077a2fc571e38bfe29c33ae68f6443cd5a | lib-linux_x64/PIL/ImageCms.py | python | getProfileInfo | (profile) | (pyCMS) Gets the internal product information for the given profile.
If profile isn't a valid CmsProfile object or filename to a profile,
a PyCMSError is raised.
If an error occurs while trying to obtain the info tag, a PyCMSError
is raised
Use this function to obtain the information stored in th... | (pyCMS) Gets the internal product information for the given profile. | [
"(",
"pyCMS",
")",
"Gets",
"the",
"internal",
"product",
"information",
"for",
"the",
"given",
"profile",
"."
] | def getProfileInfo(profile):
"""
(pyCMS) Gets the internal product information for the given profile.
If profile isn't a valid CmsProfile object or filename to a profile,
a PyCMSError is raised.
If an error occurs while trying to obtain the info tag, a PyCMSError
is raised
Use this functi... | [
"def",
"getProfileInfo",
"(",
"profile",
")",
":",
"try",
":",
"if",
"not",
"isinstance",
"(",
"profile",
",",
"ImageCmsProfile",
")",
":",
"profile",
"=",
"ImageCmsProfile",
"(",
"profile",
")",
"# add an extra newline to preserve pyCMS compatibility",
"# Python, not... | https://github.com/skylander86/lambda-text-extractor/blob/6da52d077a2fc571e38bfe29c33ae68f6443cd5a/lib-linux_x64/PIL/ImageCms.py#L702-L739 | ||
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/yunjing/v20180228/models.py | python | DescribeImpactedHostsResponse.__init__ | (self) | r"""
:param TotalCount: 记录总数
:type TotalCount: int
:param ImpactedHosts: 漏洞影响机器列表数组
:type ImpactedHosts: list of ImpactedHost
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str | r"""
:param TotalCount: 记录总数
:type TotalCount: int
:param ImpactedHosts: 漏洞影响机器列表数组
:type ImpactedHosts: list of ImpactedHost
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str | [
"r",
":",
"param",
"TotalCount",
":",
"记录总数",
":",
"type",
"TotalCount",
":",
"int",
":",
"param",
"ImpactedHosts",
":",
"漏洞影响机器列表数组",
":",
"type",
"ImpactedHosts",
":",
"list",
"of",
"ImpactedHost",
":",
"param",
"RequestId",
":",
"唯一请求",
"ID,每次请求都会返回。定位问题时需要... | def __init__(self):
r"""
:param TotalCount: 记录总数
:type TotalCount: int
:param ImpactedHosts: 漏洞影响机器列表数组
:type ImpactedHosts: list of ImpactedHost
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.TotalCount ... | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"TotalCount",
"=",
"None",
"self",
".",
"ImpactedHosts",
"=",
"None",
"self",
".",
"RequestId",
"=",
"None"
] | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/yunjing/v20180228/models.py#L2588-L2599 | ||
saltstack/salt | fae5bc757ad0f1716483ce7ae180b451545c2058 | salt/modules/composer.py | python | did_composer_install | (dir) | return False | Test to see if the vendor directory exists in this directory
dir
Directory location of the composer.json file
CLI Example:
.. code-block:: bash
salt '*' composer.did_composer_install /var/www/application | Test to see if the vendor directory exists in this directory | [
"Test",
"to",
"see",
"if",
"the",
"vendor",
"directory",
"exists",
"in",
"this",
"directory"
] | def did_composer_install(dir):
"""
Test to see if the vendor directory exists in this directory
dir
Directory location of the composer.json file
CLI Example:
.. code-block:: bash
salt '*' composer.did_composer_install /var/www/application
"""
lockFile = "{}/vendor".format... | [
"def",
"did_composer_install",
"(",
"dir",
")",
":",
"lockFile",
"=",
"\"{}/vendor\"",
".",
"format",
"(",
"dir",
")",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"lockFile",
")",
":",
"return",
"True",
"return",
"False"
] | https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/modules/composer.py#L38-L54 | |
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/lib/django-1.4/django/contrib/gis/gdal/geometries.py | python | OGRGeometry._get_coord_dim | (self) | return capi.get_coord_dim(self.ptr) | Returns the coordinate dimension of the Geometry. | Returns the coordinate dimension of the Geometry. | [
"Returns",
"the",
"coordinate",
"dimension",
"of",
"the",
"Geometry",
"."
] | def _get_coord_dim(self):
"Returns the coordinate dimension of the Geometry."
if isinstance(self, GeometryCollection) and GDAL_VERSION < (1, 5, 2):
# On GDAL versions prior to 1.5.2, there exists a bug in which
# the coordinate dimension of geometry collections is always 2:
... | [
"def",
"_get_coord_dim",
"(",
"self",
")",
":",
"if",
"isinstance",
"(",
"self",
",",
"GeometryCollection",
")",
"and",
"GDAL_VERSION",
"<",
"(",
"1",
",",
"5",
",",
"2",
")",
":",
"# On GDAL versions prior to 1.5.2, there exists a bug in which",
"# the coordinate d... | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.4/django/contrib/gis/gdal/geometries.py#L202-L212 | |
harvard-lil/capstone | f15c98fce0b50b74616c40f862146d858b54be5d | capstone/capapi/models.py | python | CapUserManager.get_by_natural_key | (self, username) | return self.get(email__iexact=username) | Make user logins case-insensitive, which works because you can't sign up
with the same email with different capitalization anyway. | Make user logins case-insensitive, which works because you can't sign up
with the same email with different capitalization anyway. | [
"Make",
"user",
"logins",
"case",
"-",
"insensitive",
"which",
"works",
"because",
"you",
"can",
"t",
"sign",
"up",
"with",
"the",
"same",
"email",
"with",
"different",
"capitalization",
"anyway",
"."
] | def get_by_natural_key(self, username):
"""
Make user logins case-insensitive, which works because you can't sign up
with the same email with different capitalization anyway.
"""
return self.get(email__iexact=username) | [
"def",
"get_by_natural_key",
"(",
"self",
",",
"username",
")",
":",
"return",
"self",
".",
"get",
"(",
"email__iexact",
"=",
"username",
")"
] | https://github.com/harvard-lil/capstone/blob/f15c98fce0b50b74616c40f862146d858b54be5d/capstone/capapi/models.py#L40-L45 | |
4shadoww/hakkuframework | 409a11fc3819d251f86faa3473439f8c19066a21 | lib/future/backports/email/_parseaddr.py | python | AddrlistClass.getquote | (self) | return self.getdelimited('"', '"\r', False) | Get a quote-delimited fragment from self's field. | Get a quote-delimited fragment from self's field. | [
"Get",
"a",
"quote",
"-",
"delimited",
"fragment",
"from",
"self",
"s",
"field",
"."
] | def getquote(self):
"""Get a quote-delimited fragment from self's field."""
return self.getdelimited('"', '"\r', False) | [
"def",
"getquote",
"(",
"self",
")",
":",
"return",
"self",
".",
"getdelimited",
"(",
"'\"'",
",",
"'\"\\r'",
",",
"False",
")"
] | https://github.com/4shadoww/hakkuframework/blob/409a11fc3819d251f86faa3473439f8c19066a21/lib/future/backports/email/_parseaddr.py#L446-L448 | |
timonwong/OmniMarkupPreviewer | 21921ac7a99d2b5924a2219b33679a5b53621392 | OmniMarkupLib/libs/bottle.py | python | BaseResponse.COOKIES | (self) | return self._cookies | A dict-like SimpleCookie instance. This should not be used directly.
See :meth:`set_cookie`. | A dict-like SimpleCookie instance. This should not be used directly.
See :meth:`set_cookie`. | [
"A",
"dict",
"-",
"like",
"SimpleCookie",
"instance",
".",
"This",
"should",
"not",
"be",
"used",
"directly",
".",
"See",
":",
"meth",
":",
"set_cookie",
"."
] | def COOKIES(self):
""" A dict-like SimpleCookie instance. This should not be used directly.
See :meth:`set_cookie`. """
depr('The COOKIES dict is deprecated. Use `set_cookie()` instead.') # 0.10
if not self._cookies:
self._cookies = SimpleCookie()
return self._coo... | [
"def",
"COOKIES",
"(",
"self",
")",
":",
"depr",
"(",
"'The COOKIES dict is deprecated. Use `set_cookie()` instead.'",
")",
"# 0.10",
"if",
"not",
"self",
".",
"_cookies",
":",
"self",
".",
"_cookies",
"=",
"SimpleCookie",
"(",
")",
"return",
"self",
".",
"_cook... | https://github.com/timonwong/OmniMarkupPreviewer/blob/21921ac7a99d2b5924a2219b33679a5b53621392/OmniMarkupLib/libs/bottle.py#L1406-L1412 | |
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/full/xml/dom/expatbuilder.py | python | FragmentBuilder._getDeclarations | (self) | return s | Re-create the internal subset from the DocumentType node.
This is only needed if we don't already have the
internalSubset as a string. | Re-create the internal subset from the DocumentType node. | [
"Re",
"-",
"create",
"the",
"internal",
"subset",
"from",
"the",
"DocumentType",
"node",
"."
] | def _getDeclarations(self):
"""Re-create the internal subset from the DocumentType node.
This is only needed if we don't already have the
internalSubset as a string.
"""
doctype = self.context.ownerDocument.doctype
s = ""
if doctype:
for i in range(do... | [
"def",
"_getDeclarations",
"(",
"self",
")",
":",
"doctype",
"=",
"self",
".",
"context",
".",
"ownerDocument",
".",
"doctype",
"s",
"=",
"\"\"",
"if",
"doctype",
":",
"for",
"i",
"in",
"range",
"(",
"doctype",
".",
"notations",
".",
"length",
")",
":"... | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/xml/dom/expatbuilder.py#L649-L683 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/IPython/paths.py | python | get_ipython_package_dir | () | return py3compat.cast_unicode(ipdir, fs_encoding) | Get the base directory where IPython itself is installed. | Get the base directory where IPython itself is installed. | [
"Get",
"the",
"base",
"directory",
"where",
"IPython",
"itself",
"is",
"installed",
"."
] | def get_ipython_package_dir():
"""Get the base directory where IPython itself is installed."""
ipdir = os.path.dirname(IPython.__file__)
return py3compat.cast_unicode(ipdir, fs_encoding) | [
"def",
"get_ipython_package_dir",
"(",
")",
":",
"ipdir",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"IPython",
".",
"__file__",
")",
"return",
"py3compat",
".",
"cast_unicode",
"(",
"ipdir",
",",
"fs_encoding",
")"
] | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/IPython/paths.py#L88-L91 | |
linxid/Machine_Learning_Study_Path | 558e82d13237114bbb8152483977806fc0c222af | Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/site-packages/pip/_vendor/packaging/specifiers.py | python | SpecifierSet.__repr__ | (self) | return "<SpecifierSet({0!r}{1})>".format(str(self), pre) | [] | def __repr__(self):
pre = (
", prereleases={0!r}".format(self.prereleases)
if self._prereleases is not None
else ""
)
return "<SpecifierSet({0!r}{1})>".format(str(self), pre) | [
"def",
"__repr__",
"(",
"self",
")",
":",
"pre",
"=",
"(",
"\", prereleases={0!r}\"",
".",
"format",
"(",
"self",
".",
"prereleases",
")",
"if",
"self",
".",
"_prereleases",
"is",
"not",
"None",
"else",
"\"\"",
")",
"return",
"\"<SpecifierSet({0!r}{1})>\"",
... | https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/site-packages/pip/_vendor/packaging/specifiers.py#L612-L619 | |||
bayespy/bayespy | 0e6e6130c888a4295cc9421d61d4ad27b2960ebb | bayespy/plot.py | python | gaussian_mixture_2d | (X, alpha=None, scale=2, fill=False, axes=None, **kwargs) | return | Plot Gaussian mixture as ellipses in 2-D
Parameters
----------
X : Mixture node
alpha : Dirichlet-like node (optional)
Probabilities for the clusters
scale : float (optional)
Scale for the covariance ellipses (by default, 2) | Plot Gaussian mixture as ellipses in 2-D | [
"Plot",
"Gaussian",
"mixture",
"as",
"ellipses",
"in",
"2",
"-",
"D"
] | def gaussian_mixture_2d(X, alpha=None, scale=2, fill=False, axes=None, **kwargs):
"""
Plot Gaussian mixture as ellipses in 2-D
Parameters
----------
X : Mixture node
alpha : Dirichlet-like node (optional)
Probabilities for the clusters
scale : float (optional)
Scale for the... | [
"def",
"gaussian_mixture_2d",
"(",
"X",
",",
"alpha",
"=",
"None",
",",
"scale",
"=",
"2",
",",
"fill",
"=",
"False",
",",
"axes",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"axes",
"is",
"None",
":",
"axes",
"=",
"plt",
".",
"gca",
... | https://github.com/bayespy/bayespy/blob/0e6e6130c888a4295cc9421d61d4ad27b2960ebb/bayespy/plot.py#L442-L516 | |
golismero/golismero | 7d605b937e241f51c1ca4f47b20f755eeefb9d76 | golismero/messaging/notifier.py | python | AuditNotifier.get_plugins_to_notify | (self, data) | return next_plugins | Get the plugins that are ready to handle the given data.
:param data: Data to be handled.
:type data: Data
:returns: Set of plugin IDs.
:rtype: set(str) | Get the plugins that are ready to handle the given data. | [
"Get",
"the",
"plugins",
"that",
"are",
"ready",
"to",
"handle",
"the",
"given",
"data",
"."
] | def get_plugins_to_notify(self, data):
"""
Get the plugins that are ready to handle the given data.
:param data: Data to be handled.
:type data: Data
:returns: Set of plugin IDs.
:rtype: set(str)
"""
# Get the candidate plugins.
next_plugins = s... | [
"def",
"get_plugins_to_notify",
"(",
"self",
",",
"data",
")",
":",
"# Get the candidate plugins.",
"next_plugins",
"=",
"self",
".",
"get_candidate_plugins",
"(",
"data",
")",
"# NOTE: the order of the following to filters is important!",
"# Filter out plugins not belonging to t... | https://github.com/golismero/golismero/blob/7d605b937e241f51c1ca4f47b20f755eeefb9d76/golismero/messaging/notifier.py#L548-L571 | |
Alexey-T/CudaText | 6a8b9a974c5d5029c6c273bde83198c83b3a5fb9 | app/cudatext.app/Contents/Resources/py/sys/requests/api.py | python | put | (url, data=None, **kwargs) | return request('put', url, data=data, **kwargs) | r"""Sends a PUT request.
:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary, list of tuples, bytes, or file-like
object to send in the body of the :class:`Request`.
:param json: (optional) json data to send in the body of the :class:`Request`.
:param \*\*kwa... | r"""Sends a PUT request. | [
"r",
"Sends",
"a",
"PUT",
"request",
"."
] | def put(url, data=None, **kwargs):
r"""Sends a PUT request.
:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary, list of tuples, bytes, or file-like
object to send in the body of the :class:`Request`.
:param json: (optional) json data to send in the body of t... | [
"def",
"put",
"(",
"url",
",",
"data",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"request",
"(",
"'put'",
",",
"url",
",",
"data",
"=",
"data",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/Alexey-T/CudaText/blob/6a8b9a974c5d5029c6c273bde83198c83b3a5fb9/app/cudatext.app/Contents/Resources/py/sys/requests/api.py#L120-L132 | |
ducksboard/libsaas | 615981a3336f65be9d51ae95a48aed9ad3bd1c3c | libsaas/services/basecamp/projects.py | python | Project.calendar_events | (self) | return calendars.CalendarEvents(self) | Return the resource corresponding to all calendar events. | Return the resource corresponding to all calendar events. | [
"Return",
"the",
"resource",
"corresponding",
"to",
"all",
"calendar",
"events",
"."
] | def calendar_events(self):
"""
Return the resource corresponding to all calendar events.
"""
return calendars.CalendarEvents(self) | [
"def",
"calendar_events",
"(",
"self",
")",
":",
"return",
"calendars",
".",
"CalendarEvents",
"(",
"self",
")"
] | https://github.com/ducksboard/libsaas/blob/615981a3336f65be9d51ae95a48aed9ad3bd1c3c/libsaas/services/basecamp/projects.py#L158-L162 | |
KhronosGroup/NNEF-Tools | c913758ca687dab8cb7b49e8f1556819a2d0ca25 | nnef_tools/io/tf/lite/flatbuffers/UnpackOptions.py | python | UnpackOptions.Axis | (self) | return 0 | [] | def Axis(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
if o != 0:
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
return 0 | [
"def",
"Axis",
"(",
"self",
")",
":",
"o",
"=",
"flatbuffers",
".",
"number_types",
".",
"UOffsetTFlags",
".",
"py_type",
"(",
"self",
".",
"_tab",
".",
"Offset",
"(",
"6",
")",
")",
"if",
"o",
"!=",
"0",
":",
"return",
"self",
".",
"_tab",
".",
... | https://github.com/KhronosGroup/NNEF-Tools/blob/c913758ca687dab8cb7b49e8f1556819a2d0ca25/nnef_tools/io/tf/lite/flatbuffers/UnpackOptions.py#L35-L39 | |||
gkrizek/bash-lambda-layer | 703b0ade8174022d44779d823172ab7ac33a5505 | bin/botocore/vendored/requests/models.py | python | PreparedRequest.prepare_cookies | (self, cookies) | Prepares the given HTTP cookie data.
This function eventually generates a ``Cookie`` header from the
given cookies using cookielib. Due to cookielib's design, the header
will not be regenerated if it already exists, meaning this function
can only be called once for the life of the
... | Prepares the given HTTP cookie data. | [
"Prepares",
"the",
"given",
"HTTP",
"cookie",
"data",
"."
] | def prepare_cookies(self, cookies):
"""Prepares the given HTTP cookie data.
This function eventually generates a ``Cookie`` header from the
given cookies using cookielib. Due to cookielib's design, the header
will not be regenerated if it already exists, meaning this function
ca... | [
"def",
"prepare_cookies",
"(",
"self",
",",
"cookies",
")",
":",
"if",
"isinstance",
"(",
"cookies",
",",
"cookielib",
".",
"CookieJar",
")",
":",
"self",
".",
"_cookies",
"=",
"cookies",
"else",
":",
"self",
".",
"_cookies",
"=",
"cookiejar_from_dict",
"(... | https://github.com/gkrizek/bash-lambda-layer/blob/703b0ade8174022d44779d823172ab7ac33a5505/bin/botocore/vendored/requests/models.py#L504-L522 | ||
adamcaudill/EquationGroupLeak | 52fa871c89008566c27159bd48f2a8641260c984 | Firewall/EXPLOITS/EXBA/scapy/modules/p0f.py | python | pkt2uptime | (pkt, HZ=100) | Calculate the date the machine which emitted the packet booted using TCP timestamp
pkt2uptime(pkt, [HZ=100]) | Calculate the date the machine which emitted the packet booted using TCP timestamp
pkt2uptime(pkt, [HZ=100]) | [
"Calculate",
"the",
"date",
"the",
"machine",
"which",
"emitted",
"the",
"packet",
"booted",
"using",
"TCP",
"timestamp",
"pkt2uptime",
"(",
"pkt",
"[",
"HZ",
"=",
"100",
"]",
")"
] | def pkt2uptime(pkt, HZ=100):
"""Calculate the date the machine which emitted the packet booted using TCP timestamp
pkt2uptime(pkt, [HZ=100])"""
if not isinstance(pkt, Packet):
raise TypeError("Not a TCP packet")
if isinstance(pkt,NoPayload):
raise TypeError("Not a TCP packet")
if not is... | [
"def",
"pkt2uptime",
"(",
"pkt",
",",
"HZ",
"=",
"100",
")",
":",
"if",
"not",
"isinstance",
"(",
"pkt",
",",
"Packet",
")",
":",
"raise",
"TypeError",
"(",
"\"Not a TCP packet\"",
")",
"if",
"isinstance",
"(",
"pkt",
",",
"NoPayload",
")",
":",
"raise... | https://github.com/adamcaudill/EquationGroupLeak/blob/52fa871c89008566c27159bd48f2a8641260c984/Firewall/EXPLOITS/EXBA/scapy/modules/p0f.py#L306-L321 | ||
zbyte64/django-hyperadmin | 9ac2ae284b76efb3c50a1c2899f383a27154cb54 | hyperadmin/filters.py | python | BaseChoicesFilter.choices | (self) | return [] | [] | def choices(self):
return [] | [
"def",
"choices",
"(",
"self",
")",
":",
"return",
"[",
"]"
] | https://github.com/zbyte64/django-hyperadmin/blob/9ac2ae284b76efb3c50a1c2899f383a27154cb54/hyperadmin/filters.py#L71-L72 | |||
collinsctk/PyQYT | 7af3673955f94ff1b2df2f94220cd2dab2e252af | ExtentionPackages/scapy/packet.py | python | Packet.post_build | (self, pkt, pay) | return pkt+pay | DEV: called right after the current layer is build. | DEV: called right after the current layer is build. | [
"DEV",
":",
"called",
"right",
"after",
"the",
"current",
"layer",
"is",
"build",
"."
] | def post_build(self, pkt, pay):
"""DEV: called right after the current layer is build."""
return pkt+pay | [
"def",
"post_build",
"(",
"self",
",",
"pkt",
",",
"pay",
")",
":",
"return",
"pkt",
"+",
"pay"
] | https://github.com/collinsctk/PyQYT/blob/7af3673955f94ff1b2df2f94220cd2dab2e252af/ExtentionPackages/scapy/packet.py#L358-L360 | |
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | apps/beeswax/gen-py/hive_metastore/ThriftHiveMetastore.py | python | Client.heartbeat | (self, ids) | Parameters:
- ids | Parameters:
- ids | [
"Parameters",
":",
"-",
"ids"
] | def heartbeat(self, ids):
"""
Parameters:
- ids
"""
self.send_heartbeat(ids)
self.recv_heartbeat() | [
"def",
"heartbeat",
"(",
"self",
",",
"ids",
")",
":",
"self",
".",
"send_heartbeat",
"(",
"ids",
")",
"self",
".",
"recv_heartbeat",
"(",
")"
] | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/apps/beeswax/gen-py/hive_metastore/ThriftHiveMetastore.py#L6456-L6463 | ||
nosmokingbandit/watcher | dadacd21a5790ee609058a98a17fcc8954d24439 | lib/sqlalchemy/orm/session.py | python | Session.dirty | (self) | return util.IdentitySet(
[state.obj()
for state in self._dirty_states
if state not in self._deleted]) | The set of all persistent instances considered dirty.
E.g.::
some_mapped_object in session.dirty
Instances are considered dirty when they were modified but not
deleted.
Note that this 'dirty' calculation is 'optimistic'; most
attribute-setting or collection modifi... | The set of all persistent instances considered dirty. | [
"The",
"set",
"of",
"all",
"persistent",
"instances",
"considered",
"dirty",
"."
] | def dirty(self):
"""The set of all persistent instances considered dirty.
E.g.::
some_mapped_object in session.dirty
Instances are considered dirty when they were modified but not
deleted.
Note that this 'dirty' calculation is 'optimistic'; most
attribute-... | [
"def",
"dirty",
"(",
"self",
")",
":",
"return",
"util",
".",
"IdentitySet",
"(",
"[",
"state",
".",
"obj",
"(",
")",
"for",
"state",
"in",
"self",
".",
"_dirty_states",
"if",
"state",
"not",
"in",
"self",
".",
"_deleted",
"]",
")"
] | https://github.com/nosmokingbandit/watcher/blob/dadacd21a5790ee609058a98a17fcc8954d24439/lib/sqlalchemy/orm/session.py#L2676-L2702 | |
lightforever/mlcomp | c78fdb77ec9c4ec8ff11beea50b90cab20903ad9 | mlcomp/server/back/app.py | python | dag_start | () | [] | def dag_start():
data = request_data()
id = int(data['id'])
supervisor.start_dag(id) | [
"def",
"dag_start",
"(",
")",
":",
"data",
"=",
"request_data",
"(",
")",
"id",
"=",
"int",
"(",
"data",
"[",
"'id'",
"]",
")",
"supervisor",
".",
"start_dag",
"(",
"id",
")"
] | https://github.com/lightforever/mlcomp/blob/c78fdb77ec9c4ec8ff11beea50b90cab20903ad9/mlcomp/server/back/app.py#L855-L858 | ||||
chemlab/chemlab | c8730966316d101e24f39ac3b96b51282aba0abe | chemlab/mviewer/representations/ballandstick.py | python | BallAndStickRepresentation.hide | (self, selections) | return self.hidden_state | Hide objects in this representation. BallAndStickRepresentation
support selections of atoms and bonds.
To hide the first atom and the first bond you can use the
following code::
from chemlab.mviewer.state import Selection
representation.hide({'atoms': Selection([0], sys... | Hide objects in this representation. BallAndStickRepresentation
support selections of atoms and bonds. | [
"Hide",
"objects",
"in",
"this",
"representation",
".",
"BallAndStickRepresentation",
"support",
"selections",
"of",
"atoms",
"and",
"bonds",
"."
] | def hide(self, selections):
'''Hide objects in this representation. BallAndStickRepresentation
support selections of atoms and bonds.
To hide the first atom and the first bond you can use the
following code::
from chemlab.mviewer.state import Selection
represent... | [
"def",
"hide",
"(",
"self",
",",
"selections",
")",
":",
"if",
"'atoms'",
"in",
"selections",
":",
"self",
".",
"hidden_state",
"[",
"'atoms'",
"]",
"=",
"selections",
"[",
"'atoms'",
"]",
"self",
".",
"on_atom_hidden_changed",
"(",
")",
"if",
"'bonds'",
... | https://github.com/chemlab/chemlab/blob/c8730966316d101e24f39ac3b96b51282aba0abe/chemlab/mviewer/representations/ballandstick.py#L279-L310 | |
pculture/miro | d8e4594441939514dd2ac29812bf37087bb3aea5 | tv/lib/eventloop.py | python | idle_iterate | (func, name, args=None, kwargs=None) | Iterate over a generator function using add_idle for each
iteration.
This allows long running functions to be split up into distinct
steps, after each step other idle functions will have a chance to
run.
For example::
def foo(x, y, z):
# do some computation
yield
... | Iterate over a generator function using add_idle for each
iteration. | [
"Iterate",
"over",
"a",
"generator",
"function",
"using",
"add_idle",
"for",
"each",
"iteration",
"."
] | def idle_iterate(func, name, args=None, kwargs=None):
"""Iterate over a generator function using add_idle for each
iteration.
This allows long running functions to be split up into distinct
steps, after each step other idle functions will have a chance to
run.
For example::
def foo(x,... | [
"def",
"idle_iterate",
"(",
"func",
",",
"name",
",",
"args",
"=",
"None",
",",
"kwargs",
"=",
"None",
")",
":",
"if",
"args",
"is",
"None",
":",
"args",
"=",
"(",
")",
"if",
"kwargs",
"is",
"None",
":",
"kwargs",
"=",
"{",
"}",
"iterator",
"=",
... | https://github.com/pculture/miro/blob/d8e4594441939514dd2ac29812bf37087bb3aea5/tv/lib/eventloop.py#L566-L591 | ||
GoogleCloudPlatform/cloudml-samples | efddc4a9898127e55edc0946557aca4bfaf59705 | tensorflow/standard/legacy/criteo_tft/preprocess.py | python | preprocess | (pipeline, training_data, eval_data, predict_data, output_dir,
frequency_threshold, delimiter) | Run pre-processing step as a pipeline.
Args:
pipeline: beam pipeline
training_data: file paths to input csv files.
eval_data: file paths to input csv files.
predict_data: file paths to input csv files.
output_dir: file path to where to write all the output files.
frequency_threshold: frequenc... | Run pre-processing step as a pipeline. | [
"Run",
"pre",
"-",
"processing",
"step",
"as",
"a",
"pipeline",
"."
] | def preprocess(pipeline, training_data, eval_data, predict_data, output_dir,
frequency_threshold, delimiter):
"""Run pre-processing step as a pipeline.
Args:
pipeline: beam pipeline
training_data: file paths to input csv files.
eval_data: file paths to input csv files.
predict_data: ... | [
"def",
"preprocess",
"(",
"pipeline",
",",
"training_data",
",",
"eval_data",
",",
"predict_data",
",",
"output_dir",
",",
"frequency_threshold",
",",
"delimiter",
")",
":",
"# 1) The schema can be either defined in-memory or read from a configuration",
"# file, in this case... | https://github.com/GoogleCloudPlatform/cloudml-samples/blob/efddc4a9898127e55edc0946557aca4bfaf59705/tensorflow/standard/legacy/criteo_tft/preprocess.py#L106-L195 | ||
landlab/landlab | a5dd80b8ebfd03d1ba87ef6c4368c409485f222c | landlab/components/steepness_index/channel_steepness.py | python | SteepnessFinder.steepness_indices | (self) | return self._ksn | Return the array of channel steepness indices.
Nodes not in the channel receive zeros. | Return the array of channel steepness indices. | [
"Return",
"the",
"array",
"of",
"channel",
"steepness",
"indices",
"."
] | def steepness_indices(self):
"""Return the array of channel steepness indices.
Nodes not in the channel receive zeros.
"""
return self._ksn | [
"def",
"steepness_indices",
"(",
"self",
")",
":",
"return",
"self",
".",
"_ksn"
] | https://github.com/landlab/landlab/blob/a5dd80b8ebfd03d1ba87ef6c4368c409485f222c/landlab/components/steepness_index/channel_steepness.py#L514-L519 | |
youtify/youtify | 82cbc4a4ca6283f14f7179d4aeba30ed1ee1fea8 | favorites.py | python | FavoriteHandler.post | (self) | Add a track to the favorite list | Add a track to the favorite list | [
"Add",
"a",
"track",
"to",
"the",
"favorite",
"list"
] | def post(self):
"""Add a track to the favorite list"""
youtify_user_model = get_current_youtify_user_model()
if youtify_user_model == None:
self.error(403)
return
playlist_id = self.request.path.split('/')[-1]
playlist_model = Playlist.get_by_id(int(playl... | [
"def",
"post",
"(",
"self",
")",
":",
"youtify_user_model",
"=",
"get_current_youtify_user_model",
"(",
")",
"if",
"youtify_user_model",
"==",
"None",
":",
"self",
".",
"error",
"(",
"403",
")",
"return",
"playlist_id",
"=",
"self",
".",
"request",
".",
"pat... | https://github.com/youtify/youtify/blob/82cbc4a4ca6283f14f7179d4aeba30ed1ee1fea8/favorites.py#L13-L46 | ||
wxWidgets/Phoenix | b2199e299a6ca6d866aa6f3d0888499136ead9d6 | wx/lib/agw/ultimatelistctrl.py | python | UltimateListItemData.SetSize | (self, width, height) | Sets the item size.
:param `width`: the item width, in pixels;
:param `height`: the item height, in pixels. | Sets the item size. | [
"Sets",
"the",
"item",
"size",
"."
] | def SetSize(self, width, height):
"""
Sets the item size.
:param `width`: the item width, in pixels;
:param `height`: the item height, in pixels.
"""
if width != -1:
self._rect.width = width
if height != -1:
self._rect.height = height | [
"def",
"SetSize",
"(",
"self",
",",
"width",
",",
"height",
")",
":",
"if",
"width",
"!=",
"-",
"1",
":",
"self",
".",
"_rect",
".",
"width",
"=",
"width",
"if",
"height",
"!=",
"-",
"1",
":",
"self",
".",
"_rect",
".",
"height",
"=",
"height"
] | https://github.com/wxWidgets/Phoenix/blob/b2199e299a6ca6d866aa6f3d0888499136ead9d6/wx/lib/agw/ultimatelistctrl.py#L3071-L3082 | ||
biopython/biopython | 2dd97e71762af7b046d7f7f8a4f1e38db6b06c86 | Bio/bgzf.py | python | BgzfWriter.write | (self, data) | Write method for the class. | Write method for the class. | [
"Write",
"method",
"for",
"the",
"class",
"."
] | def write(self, data):
"""Write method for the class."""
# TODO - Check bytes vs unicode
if isinstance(data, str):
# When reading we can't cope with multi-byte characters
# being split between BGZF blocks, so we restrict to a
# single byte encoding - like ASCI... | [
"def",
"write",
"(",
"self",
",",
"data",
")",
":",
"# TODO - Check bytes vs unicode",
"if",
"isinstance",
"(",
"data",
",",
"str",
")",
":",
"# When reading we can't cope with multi-byte characters",
"# being split between BGZF blocks, so we restrict to a",
"# single byte enco... | https://github.com/biopython/biopython/blob/2dd97e71762af7b046d7f7f8a4f1e38db6b06c86/Bio/bgzf.py#L854-L874 | ||
KDD-OpenSource/DeepADoTS | 88c38320141a1062301cc9255f3e0fc111f55e80 | src/algorithms/rnn_ebm.py | python | RecurrentEBM._create_variables | (self, n_visible) | return W, Wuh, Wux, Wxu, Wuu, bu, u0, bh, bx, BH_t, BX_t | [] | def _create_variables(self, n_visible):
W = tf.Variable(tf.random_normal([n_visible, self.n_hidden], stddev=0.01), name='W')
Wuh = tf.Variable(tf.random_normal([self.n_hidden_recurrent, self.n_hidden], stddev=0.01), name='Wuh')
Wux = tf.Variable(tf.random_normal([self.n_hidden_recurrent, n_visib... | [
"def",
"_create_variables",
"(",
"self",
",",
"n_visible",
")",
":",
"W",
"=",
"tf",
".",
"Variable",
"(",
"tf",
".",
"random_normal",
"(",
"[",
"n_visible",
",",
"self",
".",
"n_hidden",
"]",
",",
"stddev",
"=",
"0.01",
")",
",",
"name",
"=",
"'W'",... | https://github.com/KDD-OpenSource/DeepADoTS/blob/88c38320141a1062301cc9255f3e0fc111f55e80/src/algorithms/rnn_ebm.py#L140-L153 | |||
yuxiaokui/Intranet-Penetration | f57678a204840c83cbf3308e3470ae56c5ff514b | proxy/XX-Net/code/default/gae_proxy/server/lib/google/appengine/api/yaml_listener.py | python | EventHandler.SequenceEnd | (self, event, loader) | Handle end of sequence event | Handle end of sequence event | [
"Handle",
"end",
"of",
"sequence",
"event"
] | def SequenceEnd(self, event, loader):
"""Handle end of sequence event""" | [
"def",
"SequenceEnd",
"(",
"self",
",",
"event",
",",
"loader",
")",
":"
] | https://github.com/yuxiaokui/Intranet-Penetration/blob/f57678a204840c83cbf3308e3470ae56c5ff514b/proxy/XX-Net/code/default/gae_proxy/server/lib/google/appengine/api/yaml_listener.py#L76-L77 | ||
befelix/safe_learning | f1aad5a3d2f433993e842aa2e6ca7a9c45ad95d4 | safe_learning/lyapunov.py | python | Lyapunov.lipschitz_lyapunov | (self, states) | Return the local Lipschitz constant at a given state.
Parameters
----------
states : ndarray or Tensor
Returns
-------
lipschitz : float, ndarray or Tensor
If lipschitz_lyapunov is a callable then returns local Lipschitz
constants. Otherwise retu... | Return the local Lipschitz constant at a given state. | [
"Return",
"the",
"local",
"Lipschitz",
"constant",
"at",
"a",
"given",
"state",
"."
] | def lipschitz_lyapunov(self, states):
"""Return the local Lipschitz constant at a given state.
Parameters
----------
states : ndarray or Tensor
Returns
-------
lipschitz : float, ndarray or Tensor
If lipschitz_lyapunov is a callable then returns loca... | [
"def",
"lipschitz_lyapunov",
"(",
"self",
",",
"states",
")",
":",
"if",
"hasattr",
"(",
"self",
".",
"_lipschitz_lyapunov",
",",
"'__call__'",
")",
":",
"return",
"self",
".",
"_lipschitz_lyapunov",
"(",
"states",
")",
"else",
":",
"return",
"self",
".",
... | https://github.com/befelix/safe_learning/blob/f1aad5a3d2f433993e842aa2e6ca7a9c45ad95d4/safe_learning/lyapunov.py#L246-L263 | ||
giampaolo/pyftpdlib | 336b342e854bf5f182ad33db70401070184387a5 | pyftpdlib/handlers.py | python | PassiveDTP.handle_error | (self) | Called to handle any uncaught exceptions. | Called to handle any uncaught exceptions. | [
"Called",
"to",
"handle",
"any",
"uncaught",
"exceptions",
"."
] | def handle_error(self):
"""Called to handle any uncaught exceptions."""
try:
raise
except Exception:
logger.error(traceback.format_exc())
try:
self.close()
except Exception:
logger.critical(traceback.format_exc()) | [
"def",
"handle_error",
"(",
"self",
")",
":",
"try",
":",
"raise",
"except",
"Exception",
":",
"logger",
".",
"error",
"(",
"traceback",
".",
"format_exc",
"(",
")",
")",
"try",
":",
"self",
".",
"close",
"(",
")",
"except",
"Exception",
":",
"logger",... | https://github.com/giampaolo/pyftpdlib/blob/336b342e854bf5f182ad33db70401070184387a5/pyftpdlib/handlers.py#L426-L435 | ||
facebookresearch/Detectron | 1809dd41c1ffc881c0d6b1c16ea38d08894f8b6d | detectron/utils/blob.py | python | im_list_to_blob | (ims) | return blob | Convert a list of images into a network input. Assumes images were
prepared using prep_im_for_blob or equivalent: i.e.
- BGR channel order
- pixel means subtracted
- resized to the desired input size
- float32 numpy ndarray format
Output is a 4D HCHW tensor of the images concatenated alo... | Convert a list of images into a network input. Assumes images were
prepared using prep_im_for_blob or equivalent: i.e.
- BGR channel order
- pixel means subtracted
- resized to the desired input size
- float32 numpy ndarray format
Output is a 4D HCHW tensor of the images concatenated alo... | [
"Convert",
"a",
"list",
"of",
"images",
"into",
"a",
"network",
"input",
".",
"Assumes",
"images",
"were",
"prepared",
"using",
"prep_im_for_blob",
"or",
"equivalent",
":",
"i",
".",
"e",
".",
"-",
"BGR",
"channel",
"order",
"-",
"pixel",
"means",
"subtrac... | def im_list_to_blob(ims):
"""Convert a list of images into a network input. Assumes images were
prepared using prep_im_for_blob or equivalent: i.e.
- BGR channel order
- pixel means subtracted
- resized to the desired input size
- float32 numpy ndarray format
Output is a 4D HCHW tens... | [
"def",
"im_list_to_blob",
"(",
"ims",
")",
":",
"if",
"not",
"isinstance",
"(",
"ims",
",",
"list",
")",
":",
"ims",
"=",
"[",
"ims",
"]",
"max_shape",
"=",
"np",
".",
"array",
"(",
"[",
"im",
".",
"shape",
"for",
"im",
"in",
"ims",
"]",
")",
"... | https://github.com/facebookresearch/Detectron/blob/1809dd41c1ffc881c0d6b1c16ea38d08894f8b6d/detectron/utils/blob.py#L67-L97 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.