nwo stringlengths 5 86 | sha stringlengths 40 40 | path stringlengths 4 189 | language stringclasses 1
value | identifier stringlengths 1 94 | parameters stringlengths 2 4.03k | argument_list stringclasses 1
value | return_statement stringlengths 0 11.5k | docstring stringlengths 1 33.2k | docstring_summary stringlengths 0 5.15k | docstring_tokens list | function stringlengths 34 151k | function_tokens list | url stringlengths 90 278 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectAnnulusAbsorption2.py | python | IndirectAnnulusAbsorption.validateInputs | (self) | return issues | Validate algorithm options. | Validate algorithm options. | [
"Validate",
"algorithm",
"options",
"."
] | def validateInputs(self):
"""
Validate algorithm options.
"""
self._setup()
issues = dict()
if self._use_can_corrections and self._can_chemical_formula == '':
issues['CanChemicalFormula'] = 'Must be set to use can corrections'
if self._use_can_corre... | [
"def",
"validateInputs",
"(",
"self",
")",
":",
"self",
".",
"_setup",
"(",
")",
"issues",
"=",
"dict",
"(",
")",
"if",
"self",
".",
"_use_can_corrections",
"and",
"self",
".",
"_can_chemical_formula",
"==",
"''",
":",
"issues",
"[",
"'CanChemicalFormula'",
... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectAnnulusAbsorption2.py#L394-L419 | |
y123456yz/reading-and-annotate-mongodb-3.6 | 93280293672ca7586dc24af18132aa61e4ed7fcf | mongo/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Tool/tex.py | python | InternalLaTeXAuxAction | (XXXLaTeXAction, target = None, source= None, env=None) | return result | A builder for LaTeX files that checks the output in the aux file
and decides how many times to use LaTeXAction, and BibTeXAction. | A builder for LaTeX files that checks the output in the aux file
and decides how many times to use LaTeXAction, and BibTeXAction. | [
"A",
"builder",
"for",
"LaTeX",
"files",
"that",
"checks",
"the",
"output",
"in",
"the",
"aux",
"file",
"and",
"decides",
"how",
"many",
"times",
"to",
"use",
"LaTeXAction",
"and",
"BibTeXAction",
"."
] | def InternalLaTeXAuxAction(XXXLaTeXAction, target = None, source= None, env=None):
"""A builder for LaTeX files that checks the output in the aux file
and decides how many times to use LaTeXAction, and BibTeXAction."""
global must_rerun_latex
# This routine is called with two actions. In this file for... | [
"def",
"InternalLaTeXAuxAction",
"(",
"XXXLaTeXAction",
",",
"target",
"=",
"None",
",",
"source",
"=",
"None",
",",
"env",
"=",
"None",
")",
":",
"global",
"must_rerun_latex",
"# This routine is called with two actions. In this file for DVI builds",
"# with LaTeXAction and... | https://github.com/y123456yz/reading-and-annotate-mongodb-3.6/blob/93280293672ca7586dc24af18132aa61e4ed7fcf/mongo/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Tool/tex.py#L196-L487 | |
google/earthenterprise | 0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9 | earth_enterprise/src/server/wsgi/serve/push/search/util/search_schema_parser.py | python | SearchSchemaParser.__StartElement | (self, elem) | Start element handler.
Args:
elem: current element. | Start element handler. | [
"Start",
"element",
"handler",
"."
] | def __StartElement(self, elem):
"""Start element handler.
Args:
elem: current element.
"""
self._current_tag = elem.tag
self._element_start(elem) | [
"def",
"__StartElement",
"(",
"self",
",",
"elem",
")",
":",
"self",
".",
"_current_tag",
"=",
"elem",
".",
"tag",
"self",
".",
"_element_start",
"(",
"elem",
")"
] | https://github.com/google/earthenterprise/blob/0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9/earth_enterprise/src/server/wsgi/serve/push/search/util/search_schema_parser.py#L156-L163 | ||
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | buildscripts/resmokelib/suitesconfig.py | python | _get_suite_config | (suite_name_or_path) | return SuiteFinder.get_config_obj(suite_name_or_path) | Attempt to read YAML configuration from 'suite_path' for the suite. | Attempt to read YAML configuration from 'suite_path' for the suite. | [
"Attempt",
"to",
"read",
"YAML",
"configuration",
"from",
"suite_path",
"for",
"the",
"suite",
"."
] | def _get_suite_config(suite_name_or_path):
"""Attempt to read YAML configuration from 'suite_path' for the suite."""
return SuiteFinder.get_config_obj(suite_name_or_path) | [
"def",
"_get_suite_config",
"(",
"suite_name_or_path",
")",
":",
"return",
"SuiteFinder",
".",
"get_config_obj",
"(",
"suite_name_or_path",
")"
] | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/resmokelib/suitesconfig.py#L117-L119 | |
y123456yz/reading-and-annotate-mongodb-3.6 | 93280293672ca7586dc24af18132aa61e4ed7fcf | mongo/buildscripts/git.py | python | Repository.get_merge_base | (self, commit) | return self._callgito("merge-base", ["HEAD", commit]).rstrip() | Get the merge base between 'commit' and HEAD. | Get the merge base between 'commit' and HEAD. | [
"Get",
"the",
"merge",
"base",
"between",
"commit",
"and",
"HEAD",
"."
] | def get_merge_base(self, commit):
"""Get the merge base between 'commit' and HEAD."""
return self._callgito("merge-base", ["HEAD", commit]).rstrip() | [
"def",
"get_merge_base",
"(",
"self",
",",
"commit",
")",
":",
"return",
"self",
".",
"_callgito",
"(",
"\"merge-base\"",
",",
"[",
"\"HEAD\"",
",",
"commit",
"]",
")",
".",
"rstrip",
"(",
")"
] | https://github.com/y123456yz/reading-and-annotate-mongodb-3.6/blob/93280293672ca7586dc24af18132aa61e4ed7fcf/mongo/buildscripts/git.py#L148-L150 | |
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/maximal-rectangle.py | python | Solution2.maximalRectangle | (self, matrix) | return result | :type matrix: List[List[str]]
:rtype: int | :type matrix: List[List[str]]
:rtype: int | [
":",
"type",
"matrix",
":",
"List",
"[",
"List",
"[",
"str",
"]]",
":",
"rtype",
":",
"int"
] | def maximalRectangle(self, matrix):
"""
:type matrix: List[List[str]]
:rtype: int
"""
if not matrix:
return 0
result = 0
m = len(matrix)
n = len(matrix[0])
L = [0 for _ in xrange(n)]
H = [0 for _ in xrange(n)]
R = [n fo... | [
"def",
"maximalRectangle",
"(",
"self",
",",
"matrix",
")",
":",
"if",
"not",
"matrix",
":",
"return",
"0",
"result",
"=",
"0",
"m",
"=",
"len",
"(",
"matrix",
")",
"n",
"=",
"len",
"(",
"matrix",
"[",
"0",
"]",
")",
"L",
"=",
"[",
"0",
"for",
... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/maximal-rectangle.py#L33-L68 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ReflectometryILLSumForeground.py | python | ReflectometryILLSumForeground._directOnly | (self) | return self.getProperty(Prop.DIRECT_FOREGROUND_WS).isDefault | Return true if only the direct beam should be processed. | Return true if only the direct beam should be processed. | [
"Return",
"true",
"if",
"only",
"the",
"direct",
"beam",
"should",
"be",
"processed",
"."
] | def _directOnly(self):
"""Return true if only the direct beam should be processed."""
return self.getProperty(Prop.DIRECT_FOREGROUND_WS).isDefault | [
"def",
"_directOnly",
"(",
"self",
")",
":",
"return",
"self",
".",
"getProperty",
"(",
"Prop",
".",
"DIRECT_FOREGROUND_WS",
")",
".",
"isDefault"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ReflectometryILLSumForeground.py#L214-L216 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/keras/saving/saved_model/utils.py | python | get_training_arg_index | (call_fn) | Returns the index of 'training' in the layer call function arguments.
Args:
call_fn: Call function.
Returns:
- n: index of 'training' in the call function arguments.
- -1: if 'training' is not found in the arguments, but layer.call accepts
variable keyword arguments
- None: if layer does... | Returns the index of 'training' in the layer call function arguments. | [
"Returns",
"the",
"index",
"of",
"training",
"in",
"the",
"layer",
"call",
"function",
"arguments",
"."
] | def get_training_arg_index(call_fn):
"""Returns the index of 'training' in the layer call function arguments.
Args:
call_fn: Call function.
Returns:
- n: index of 'training' in the call function arguments.
- -1: if 'training' is not found in the arguments, but layer.call accepts
variable k... | [
"def",
"get_training_arg_index",
"(",
"call_fn",
")",
":",
"arg_list",
"=",
"tf_inspect",
".",
"getfullargspec",
"(",
"call_fn",
")",
".",
"args",
"if",
"tf_inspect",
".",
"ismethod",
"(",
"call_fn",
")",
":",
"arg_list",
"=",
"arg_list",
"[",
"1",
":",
"]... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/keras/saving/saved_model/utils.py#L143-L161 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/examples/adding_an_op/zero_out_grad_2.py | python | _zero_out_grad | (op, grad) | return [to_zero_grad] | The gradients for `zero_out`.
Args:
op: The `zero_out` `Operation` that we are differentiating, which we can use
to find the inputs and outputs of the original op.
grad: Gradient with respect to the output of the `zero_out` op.
Returns:
Gradients with respect to the input of `zero_out`. | The gradients for `zero_out`. | [
"The",
"gradients",
"for",
"zero_out",
"."
] | def _zero_out_grad(op, grad):
"""The gradients for `zero_out`.
Args:
op: The `zero_out` `Operation` that we are differentiating, which we can use
to find the inputs and outputs of the original op.
grad: Gradient with respect to the output of the `zero_out` op.
Returns:
Gradients with respect t... | [
"def",
"_zero_out_grad",
"(",
"op",
",",
"grad",
")",
":",
"to_zero",
"=",
"op",
".",
"inputs",
"[",
"0",
"]",
"shape",
"=",
"array_ops",
".",
"shape",
"(",
"to_zero",
")",
"index",
"=",
"array_ops",
".",
"zeros_like",
"(",
"shape",
")",
"first_grad",
... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/examples/adding_an_op/zero_out_grad_2.py#L28-L44 | |
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/tools/gyp/pylib/gyp/mac_tool.py | python | MacTool._DetectInputEncoding | (self, file_name) | Reads the first few bytes from file_name and tries to guess the text
encoding. Returns None as a guess if it can't detect it. | Reads the first few bytes from file_name and tries to guess the text
encoding. Returns None as a guess if it can't detect it. | [
"Reads",
"the",
"first",
"few",
"bytes",
"from",
"file_name",
"and",
"tries",
"to",
"guess",
"the",
"text",
"encoding",
".",
"Returns",
"None",
"as",
"a",
"guess",
"if",
"it",
"can",
"t",
"detect",
"it",
"."
] | def _DetectInputEncoding(self, file_name):
"""Reads the first few bytes from file_name and tries to guess the text
encoding. Returns None as a guess if it can't detect it."""
with open(file_name, "rb") as fp:
try:
header = fp.read(3)
except Exception:
... | [
"def",
"_DetectInputEncoding",
"(",
"self",
",",
"file_name",
")",
":",
"with",
"open",
"(",
"file_name",
",",
"\"rb\"",
")",
"as",
"fp",
":",
"try",
":",
"header",
"=",
"fp",
".",
"read",
"(",
"3",
")",
"except",
"Exception",
":",
"return",
"None",
... | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/tools/gyp/pylib/gyp/mac_tool.py#L159-L174 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/aui.py | python | AuiTabArt.SetNormalFont | (*args, **kwargs) | return _aui.AuiTabArt_SetNormalFont(*args, **kwargs) | SetNormalFont(self, Font font) | SetNormalFont(self, Font font) | [
"SetNormalFont",
"(",
"self",
"Font",
"font",
")"
] | def SetNormalFont(*args, **kwargs):
"""SetNormalFont(self, Font font)"""
return _aui.AuiTabArt_SetNormalFont(*args, **kwargs) | [
"def",
"SetNormalFont",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_aui",
".",
"AuiTabArt_SetNormalFont",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/aui.py#L2294-L2296 | |
OPAE/opae-sdk | 221124343c8275243a249eb72d69e0ea2d568d1b | python/opae.admin/opae/admin/tools/fpgasupdate.py | python | do_partial_reconf | (addr, filename) | return (0, output + '\nPartial Reconfiguration OK') | Call out to fpgaconf for Partial Reconfiguration.
addr - the canonical ssss:bb:dd.f of the device to PR.
filename - the GBS file path.
returns a 2-tuple of the process exit status and a message. | Call out to fpgaconf for Partial Reconfiguration. | [
"Call",
"out",
"to",
"fpgaconf",
"for",
"Partial",
"Reconfiguration",
"."
] | def do_partial_reconf(addr, filename):
"""Call out to fpgaconf for Partial Reconfiguration.
addr - the canonical ssss:bb:dd.f of the device to PR.
filename - the GBS file path.
returns a 2-tuple of the process exit status and a message.
"""
conf_args = ['fpgaconf', '--segment', '0x' + addr[:4]... | [
"def",
"do_partial_reconf",
"(",
"addr",
",",
"filename",
")",
":",
"conf_args",
"=",
"[",
"'fpgaconf'",
",",
"'--segment'",
",",
"'0x'",
"+",
"addr",
"[",
":",
"4",
"]",
",",
"'--bus'",
",",
"'0x'",
"+",
"addr",
"[",
"5",
":",
"7",
"]",
",",
"'--d... | https://github.com/OPAE/opae-sdk/blob/221124343c8275243a249eb72d69e0ea2d568d1b/python/opae.admin/opae/admin/tools/fpgasupdate.py#L239-L262 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/stc.py | python | StyledTextCtrl.StyleSetEOLFilled | (*args, **kwargs) | return _stc.StyledTextCtrl_StyleSetEOLFilled(*args, **kwargs) | StyleSetEOLFilled(self, int style, bool filled)
Set a style to have its end of line filled or not. | StyleSetEOLFilled(self, int style, bool filled) | [
"StyleSetEOLFilled",
"(",
"self",
"int",
"style",
"bool",
"filled",
")"
] | def StyleSetEOLFilled(*args, **kwargs):
"""
StyleSetEOLFilled(self, int style, bool filled)
Set a style to have its end of line filled or not.
"""
return _stc.StyledTextCtrl_StyleSetEOLFilled(*args, **kwargs) | [
"def",
"StyleSetEOLFilled",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_stc",
".",
"StyledTextCtrl_StyleSetEOLFilled",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/stc.py#L2562-L2568 | |
cms-sw/cmssw | fd9de012d503d3405420bcbeec0ec879baa57cf2 | CalibMuon/DTCalibration/python/Workflow/DTT0WireWorkflow.py | python | DTT0WireWorkflow.prepare_workflow | (self) | Generalized function to prepare workflow dependent on workflow mode | Generalized function to prepare workflow dependent on workflow mode | [
"Generalized",
"function",
"to",
"prepare",
"workflow",
"dependent",
"on",
"workflow",
"mode"
] | def prepare_workflow(self):
""" Generalized function to prepare workflow dependent on workflow mode"""
function_name = "prepare_" + self.options.workflow_mode + "_" + self.options.command
try:
fill_function = getattr(self, function_name)
except AttributeError:
er... | [
"def",
"prepare_workflow",
"(",
"self",
")",
":",
"function_name",
"=",
"\"prepare_\"",
"+",
"self",
".",
"options",
".",
"workflow_mode",
"+",
"\"_\"",
"+",
"self",
".",
"options",
".",
"command",
"try",
":",
"fill_function",
"=",
"getattr",
"(",
"self",
... | https://github.com/cms-sw/cmssw/blob/fd9de012d503d3405420bcbeec0ec879baa57cf2/CalibMuon/DTCalibration/python/Workflow/DTT0WireWorkflow.py#L21-L33 | ||
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/ops/operations/_grad_ops.py | python | ConcatOffset.__init__ | (self, N=2, axis=0) | Initialize ConcatOffset | Initialize ConcatOffset | [
"Initialize",
"ConcatOffset"
] | def __init__(self, N=2, axis=0):
"""Initialize ConcatOffset""" | [
"def",
"__init__",
"(",
"self",
",",
"N",
"=",
"2",
",",
"axis",
"=",
"0",
")",
":"
] | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/ops/operations/_grad_ops.py#L215-L216 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib-tk/turtle.py | python | TPen.color | (self, *args) | Return or set the pencolor and fillcolor.
Arguments:
Several input formats are allowed.
They use 0, 1, 2, or 3 arguments as follows:
color()
Return the current pencolor and the current fillcolor
as a pair of color specification strings as are returned
... | Return or set the pencolor and fillcolor. | [
"Return",
"or",
"set",
"the",
"pencolor",
"and",
"fillcolor",
"."
] | def color(self, *args):
"""Return or set the pencolor and fillcolor.
Arguments:
Several input formats are allowed.
They use 0, 1, 2, or 3 arguments as follows:
color()
Return the current pencolor and the current fillcolor
as a pair of color specification... | [
"def",
"color",
"(",
"self",
",",
"*",
"args",
")",
":",
"if",
"args",
":",
"l",
"=",
"len",
"(",
"args",
")",
"if",
"l",
"==",
"1",
":",
"pcolor",
"=",
"fcolor",
"=",
"args",
"[",
"0",
"]",
"elif",
"l",
"==",
"2",
":",
"pcolor",
",",
"fcol... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib-tk/turtle.py#L2090-L2134 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/android_platform/development/scripts/stack_core.py | python | PreProcessLog.__init__ | (self, load_vaddrs) | Bind load_vaddrs to the PreProcessLog closure.
Args:
load_vaddrs: LOAD segment min_vaddrs keyed on mapped executable | Bind load_vaddrs to the PreProcessLog closure.
Args:
load_vaddrs: LOAD segment min_vaddrs keyed on mapped executable | [
"Bind",
"load_vaddrs",
"to",
"the",
"PreProcessLog",
"closure",
".",
"Args",
":",
"load_vaddrs",
":",
"LOAD",
"segment",
"min_vaddrs",
"keyed",
"on",
"mapped",
"executable"
] | def __init__(self, load_vaddrs):
"""Bind load_vaddrs to the PreProcessLog closure.
Args:
load_vaddrs: LOAD segment min_vaddrs keyed on mapped executable
"""
self._load_vaddrs = load_vaddrs;
# This is mapping from apk's offset to shared libraries.
self._shared_libraries_mapping = dict()
... | [
"def",
"__init__",
"(",
"self",
",",
"load_vaddrs",
")",
":",
"self",
".",
"_load_vaddrs",
"=",
"load_vaddrs",
"# This is mapping from apk's offset to shared libraries.",
"self",
".",
"_shared_libraries_mapping",
"=",
"dict",
"(",
")",
"# The list of directires in which ins... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/android_platform/development/scripts/stack_core.py#L194-L204 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/Paste/paste/proxy.py | python | parse_headers | (message) | return headers_out | Turn a Message object into a list of WSGI-style headers. | Turn a Message object into a list of WSGI-style headers. | [
"Turn",
"a",
"Message",
"object",
"into",
"a",
"list",
"of",
"WSGI",
"-",
"style",
"headers",
"."
] | def parse_headers(message):
"""
Turn a Message object into a list of WSGI-style headers.
"""
headers_out = []
if six.PY3:
for header, value in message.items():
if header.lower() not in filtered_headers:
headers_out.append((header, value))
else:
for ful... | [
"def",
"parse_headers",
"(",
"message",
")",
":",
"headers_out",
"=",
"[",
"]",
"if",
"six",
".",
"PY3",
":",
"for",
"header",
",",
"value",
"in",
"message",
".",
"items",
"(",
")",
":",
"if",
"header",
".",
"lower",
"(",
")",
"not",
"in",
"filtere... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/Paste/paste/proxy.py#L250-L280 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/ops/losses/util.py | python | get_regularization_losses | (scope=None) | return ops.get_collection(ops.GraphKeys.REGULARIZATION_LOSSES, scope) | Gets the list of regularization losses.
Args:
scope: An optional scope name for filtering the losses to return.
Returns:
A list of regularization losses as Tensors. | Gets the list of regularization losses. | [
"Gets",
"the",
"list",
"of",
"regularization",
"losses",
"."
] | def get_regularization_losses(scope=None):
"""Gets the list of regularization losses.
Args:
scope: An optional scope name for filtering the losses to return.
Returns:
A list of regularization losses as Tensors.
"""
return ops.get_collection(ops.GraphKeys.REGULARIZATION_LOSSES, scope) | [
"def",
"get_regularization_losses",
"(",
"scope",
"=",
"None",
")",
":",
"return",
"ops",
".",
"get_collection",
"(",
"ops",
".",
"GraphKeys",
".",
"REGULARIZATION_LOSSES",
",",
"scope",
")"
] | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/ops/losses/util.py#L59-L68 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/keras/engine/node.py | python | Node.iterate_inbound | (self) | Yields tuples representing the data inbound from other nodes.
Yields:
tuples like: (inbound_layer, node_index, tensor_index, tensor). | Yields tuples representing the data inbound from other nodes. | [
"Yields",
"tuples",
"representing",
"the",
"data",
"inbound",
"from",
"other",
"nodes",
"."
] | def iterate_inbound(self):
"""Yields tuples representing the data inbound from other nodes.
Yields:
tuples like: (inbound_layer, node_index, tensor_index, tensor).
"""
for kt in self.keras_inputs:
keras_history = kt._keras_history
layer = keras_history.layer
node_index = keras_h... | [
"def",
"iterate_inbound",
"(",
"self",
")",
":",
"for",
"kt",
"in",
"self",
".",
"keras_inputs",
":",
"keras_history",
"=",
"kt",
".",
"_keras_history",
"layer",
"=",
"keras_history",
".",
"layer",
"node_index",
"=",
"keras_history",
".",
"node_index",
"tensor... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/keras/engine/node.py#L130-L141 | ||
rodeofx/OpenWalter | 6116fbe3f04f1146c854afbfbdbe944feaee647e | walter/maya/scripts/walterVariantsMenu.py | python | VariantsMenu._createMenu | (self, primPath, index, variantSet) | return VariantSetMenu(primPath, variantSet, self) | Implementation of BaseVariantsMenu. | Implementation of BaseVariantsMenu. | [
"Implementation",
"of",
"BaseVariantsMenu",
"."
] | def _createMenu(self, primPath, index, variantSet):
"""Implementation of BaseVariantsMenu."""
return VariantSetMenu(primPath, variantSet, self) | [
"def",
"_createMenu",
"(",
"self",
",",
"primPath",
",",
"index",
",",
"variantSet",
")",
":",
"return",
"VariantSetMenu",
"(",
"primPath",
",",
"variantSet",
",",
"self",
")"
] | https://github.com/rodeofx/OpenWalter/blob/6116fbe3f04f1146c854afbfbdbe944feaee647e/walter/maya/scripts/walterVariantsMenu.py#L52-L54 | |
generalized-intelligence/GAAS | 29ab17d3e8a4ba18edef3a57c36d8db6329fac73 | deprecated/algorithms/sfm/OpenSfM/opensfm/commands/match_features.py | python | match_candidates_by_order | (images, max_neighbors) | return pairs | Find candidate matching pairs by sequence order. | Find candidate matching pairs by sequence order. | [
"Find",
"candidate",
"matching",
"pairs",
"by",
"sequence",
"order",
"."
] | def match_candidates_by_order(images, max_neighbors):
"""Find candidate matching pairs by sequence order."""
if max_neighbors <= 0:
return set()
n = (max_neighbors + 1) // 2
pairs = set()
for i, image in enumerate(images):
a = max(0, i - n)
b = min(len(images), i + n)
... | [
"def",
"match_candidates_by_order",
"(",
"images",
",",
"max_neighbors",
")",
":",
"if",
"max_neighbors",
"<=",
"0",
":",
"return",
"set",
"(",
")",
"n",
"=",
"(",
"max_neighbors",
"+",
"1",
")",
"//",
"2",
"pairs",
"=",
"set",
"(",
")",
"for",
"i",
... | https://github.com/generalized-intelligence/GAAS/blob/29ab17d3e8a4ba18edef3a57c36d8db6329fac73/deprecated/algorithms/sfm/OpenSfM/opensfm/commands/match_features.py#L145-L158 | |
uncrustify/uncrustify | 719cf9d153a9ec14be8d5f01536121ced71d8bc9 | scripts/option_reducer.py | python | write_config_file2 | (args) | Writes two option lists into a config file
Parameters
----------------------------------------------------------------------------
:param args: list< tuple< str, str > >,
list< tuple< str, str > >, str, int
this function is intended to be called by multiprocessing.pool.map()
... | Writes two option lists into a config file | [
"Writes",
"two",
"option",
"lists",
"into",
"a",
"config",
"file"
] | def write_config_file2(args):
"""
Writes two option lists into a config file
Parameters
----------------------------------------------------------------------------
:param args: list< tuple< str, str > >,
list< tuple< str, str > >, str, int
this function is intended to be ... | [
"def",
"write_config_file2",
"(",
"args",
")",
":",
"config_list0",
",",
"config_list1",
",",
"tmp_dir",
",",
"idx",
"=",
"args",
"with",
"open",
"(",
"\"%s%suncr-r-%d.cfg\"",
"%",
"(",
"tmp_dir",
",",
"os_path_sep",
",",
"idx",
")",
",",
"'w'",
")",
"as",... | https://github.com/uncrustify/uncrustify/blob/719cf9d153a9ec14be8d5f01536121ced71d8bc9/scripts/option_reducer.py#L286-L317 | ||
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Path/PathScripts/PathDressupHoldingTags.py | python | Create | (baseObject, name="DressupTag") | return obj | Create(basePath, name='DressupTag') ... create tag dressup object for the given base path. | Create(basePath, name='DressupTag') ... create tag dressup object for the given base path. | [
"Create",
"(",
"basePath",
"name",
"=",
"DressupTag",
")",
"...",
"create",
"tag",
"dressup",
"object",
"for",
"the",
"given",
"base",
"path",
"."
] | def Create(baseObject, name="DressupTag"):
"""
Create(basePath, name='DressupTag') ... create tag dressup object for the given base path.
"""
if not baseObject.isDerivedFrom("Path::Feature"):
PathLog.error(
translate("Path_DressupTag", "The selected object is not a path") + "\n"
... | [
"def",
"Create",
"(",
"baseObject",
",",
"name",
"=",
"\"DressupTag\"",
")",
":",
"if",
"not",
"baseObject",
".",
"isDerivedFrom",
"(",
"\"Path::Feature\"",
")",
":",
"PathLog",
".",
"error",
"(",
"translate",
"(",
"\"Path_DressupTag\"",
",",
"\"The selected obj... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Path/PathScripts/PathDressupHoldingTags.py#L1383-L1402 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | scripts/Inelastic/Direct/RunDescriptor.py | python | RunList.get_last_ind2sum | (self,sum_runs) | return ind | Get last run number contributing to sum | Get last run number contributing to sum | [
"Get",
"last",
"run",
"number",
"contributing",
"to",
"sum"
] | def get_last_ind2sum(self,sum_runs):
"""Get last run number contributing to sum"""
if self._last_ind2sum >= 0 and self._last_ind2sum < len(self._run_numbers):
ind = self._last_ind2sum
else:
if sum_runs:
ind = len(self._run_numbers) - 1
else:
... | [
"def",
"get_last_ind2sum",
"(",
"self",
",",
"sum_runs",
")",
":",
"if",
"self",
".",
"_last_ind2sum",
">=",
"0",
"and",
"self",
".",
"_last_ind2sum",
"<",
"len",
"(",
"self",
".",
"_run_numbers",
")",
":",
"ind",
"=",
"self",
".",
"_last_ind2sum",
"else... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/Inelastic/Direct/RunDescriptor.py#L287-L297 | |
pskun/finance_news_analysis | 6ac13e32deede37a4cf57bba8b2897941ae3d80d | utils/file_operator.py | python | FileMultiReadWrite.read | (self) | return line | 从文件中读 | 从文件中读 | [
"从文件中读"
] | def read(self):
''' 从文件中读 '''
self.lock()
line = self.file.readline()
if line == "":
line = None
self.unlock()
return line | [
"def",
"read",
"(",
"self",
")",
":",
"self",
".",
"lock",
"(",
")",
"line",
"=",
"self",
".",
"file",
".",
"readline",
"(",
")",
"if",
"line",
"==",
"\"\"",
":",
"line",
"=",
"None",
"self",
".",
"unlock",
"(",
")",
"return",
"line"
] | https://github.com/pskun/finance_news_analysis/blob/6ac13e32deede37a4cf57bba8b2897941ae3d80d/utils/file_operator.py#L46-L53 | |
telefonicaid/fiware-orion | 27c3202b9ddcfb9e3635a0af8d373f76e89b1d24 | scripts/cpplint.py | python | _ClassState.CheckFinished | (self, filename, error) | Checks that all classes have been completely parsed.
Call this when all lines in a file have been processed.
Args:
filename: The name of the current file.
error: The function to call with any errors found. | Checks that all classes have been completely parsed. | [
"Checks",
"that",
"all",
"classes",
"have",
"been",
"completely",
"parsed",
"."
] | def CheckFinished(self, filename, error):
"""Checks that all classes have been completely parsed.
Call this when all lines in a file have been processed.
Args:
filename: The name of the current file.
error: The function to call with any errors found.
"""
if self.classinfo_stack:
#... | [
"def",
"CheckFinished",
"(",
"self",
",",
"filename",
",",
"error",
")",
":",
"if",
"self",
".",
"classinfo_stack",
":",
"# Note: This test can result in false positives if #ifdef constructs",
"# get in the way of brace matching. See the testBuildClass test in",
"# cpplint_unittest... | https://github.com/telefonicaid/fiware-orion/blob/27c3202b9ddcfb9e3635a0af8d373f76e89b1d24/scripts/cpplint.py#L1301-L1315 | ||
domino-team/openwrt-cc | 8b181297c34d14d3ca521cc9f31430d561dbc688 | package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py | python | GetIncludedBuildFiles | (build_file_path, aux_data, included=None) | return included | Return a list of all build files included into build_file_path.
The returned list will contain build_file_path as well as all other files
that it included, either directly or indirectly. Note that the list may
contain files that were included into a conditional section that evaluated
to false and was not merg... | Return a list of all build files included into build_file_path. | [
"Return",
"a",
"list",
"of",
"all",
"build",
"files",
"included",
"into",
"build_file_path",
"."
] | def GetIncludedBuildFiles(build_file_path, aux_data, included=None):
"""Return a list of all build files included into build_file_path.
The returned list will contain build_file_path as well as all other files
that it included, either directly or indirectly. Note that the list may
contain files that were incl... | [
"def",
"GetIncludedBuildFiles",
"(",
"build_file_path",
",",
"aux_data",
",",
"included",
"=",
"None",
")",
":",
"if",
"included",
"==",
"None",
":",
"included",
"=",
"[",
"]",
"if",
"build_file_path",
"in",
"included",
":",
"return",
"included",
"included",
... | https://github.com/domino-team/openwrt-cc/blob/8b181297c34d14d3ca521cc9f31430d561dbc688/package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py#L143-L173 | |
weolar/miniblink49 | 1c4678db0594a4abde23d3ebbcc7cd13c3170777 | third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/coverage/annotate.py | python | AnnotateReporter.report | (self, morfs, config, directory=None) | Run the report.
See `coverage.report()` for arguments. | Run the report. | [
"Run",
"the",
"report",
"."
] | def report(self, morfs, config, directory=None):
"""Run the report.
See `coverage.report()` for arguments.
"""
self.report_files(self.annotate_file, morfs, config, directory) | [
"def",
"report",
"(",
"self",
",",
"morfs",
",",
"config",
",",
"directory",
"=",
"None",
")",
":",
"self",
".",
"report_files",
"(",
"self",
".",
"annotate_file",
",",
"morfs",
",",
"config",
",",
"directory",
")"
] | https://github.com/weolar/miniblink49/blob/1c4678db0594a4abde23d3ebbcc7cd13c3170777/third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/coverage/annotate.py#L36-L42 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/android/appstats.py | python | OutputBeautifier.__PrintHeaderHelper | (self,
snapshot,
show_labels,
show_timestamp,
show_mem,
show_net,
show_trailer) | return ' '.join(titles) | Helper method to concat various header entries together into one header.
This will line up with a entry built by __PrintStatsHelper if the same
values are passed to it. | Helper method to concat various header entries together into one header.
This will line up with a entry built by __PrintStatsHelper if the same
values are passed to it. | [
"Helper",
"method",
"to",
"concat",
"various",
"header",
"entries",
"together",
"into",
"one",
"header",
".",
"This",
"will",
"line",
"up",
"with",
"a",
"entry",
"built",
"by",
"__PrintStatsHelper",
"if",
"the",
"same",
"values",
"are",
"passed",
"to",
"it",... | def __PrintHeaderHelper(self,
snapshot,
show_labels,
show_timestamp,
show_mem,
show_net,
show_trailer):
"""Helper method to concat various header entries togeth... | [
"def",
"__PrintHeaderHelper",
"(",
"self",
",",
"snapshot",
",",
"show_labels",
",",
"show_timestamp",
",",
"show_mem",
",",
"show_net",
",",
"show_trailer",
")",
":",
"titles",
"=",
"[",
"]",
"if",
"show_labels",
":",
"titles",
".",
"append",
"(",
"self",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/android/appstats.py#L675-L701 | |
apple/swift | 469f72fdae2ea828b3b6c0d7d62d7e4cf98c4893 | utils/build_swift/build_swift/presets.py | python | PresetParser.presets | (self) | return self._presets.values() | Returns a list of all parsed presets in the order they were parsed. | Returns a list of all parsed presets in the order they were parsed. | [
"Returns",
"a",
"list",
"of",
"all",
"parsed",
"presets",
"in",
"the",
"order",
"they",
"were",
"parsed",
"."
] | def presets(self):
"""Returns a list of all parsed presets in the order they were parsed.
"""
return self._presets.values() | [
"def",
"presets",
"(",
"self",
")",
":",
"return",
"self",
".",
"_presets",
".",
"values",
"(",
")"
] | https://github.com/apple/swift/blob/469f72fdae2ea828b3b6c0d7d62d7e4cf98c4893/utils/build_swift/build_swift/presets.py#L236-L240 | |
hcdth011/ROS-Hydro-SLAM | 629448eecd2c9a3511158115fa53ea9e4ae41359 | rpg_vikit/vikit_py/src/vikit_py/transformations.py | python | projection_matrix | (point, normal, direction=None,
perspective=None, pseudo=False) | return M | Return matrix to project onto plane defined by point and normal.
Using either perspective point, projection direction, or none of both.
If pseudo is True, perspective projections will preserve relative depth
such that Perspective = dot(Orthogonal, PseudoPerspective).
>>> P = projection_matrix((0, 0, ... | Return matrix to project onto plane defined by point and normal. | [
"Return",
"matrix",
"to",
"project",
"onto",
"plane",
"defined",
"by",
"point",
"and",
"normal",
"."
] | def projection_matrix(point, normal, direction=None,
perspective=None, pseudo=False):
"""Return matrix to project onto plane defined by point and normal.
Using either perspective point, projection direction, or none of both.
If pseudo is True, perspective projections will preserve re... | [
"def",
"projection_matrix",
"(",
"point",
",",
"normal",
",",
"direction",
"=",
"None",
",",
"perspective",
"=",
"None",
",",
"pseudo",
"=",
"False",
")",
":",
"M",
"=",
"numpy",
".",
"identity",
"(",
"4",
")",
"point",
"=",
"numpy",
".",
"array",
"(... | https://github.com/hcdth011/ROS-Hydro-SLAM/blob/629448eecd2c9a3511158115fa53ea9e4ae41359/rpg_vikit/vikit_py/src/vikit_py/transformations.py#L441-L500 | |
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | buildscripts/idl/idl_check_compatibility.py | python | get_field_type | (field: Union[syntax.Field, syntax.Command], idl_file: syntax.IDLParsedSpec,
idl_file_path: str) | return field_type | Resolve and get field type of a field from the IDL file. | Resolve and get field type of a field from the IDL file. | [
"Resolve",
"and",
"get",
"field",
"type",
"of",
"a",
"field",
"from",
"the",
"IDL",
"file",
"."
] | def get_field_type(field: Union[syntax.Field, syntax.Command], idl_file: syntax.IDLParsedSpec,
idl_file_path: str) -> Optional[Union[syntax.Enum, syntax.Struct, syntax.Type]]:
"""Resolve and get field type of a field from the IDL file."""
parser_ctxt = errors.ParserContext(idl_file_path, erro... | [
"def",
"get_field_type",
"(",
"field",
":",
"Union",
"[",
"syntax",
".",
"Field",
",",
"syntax",
".",
"Command",
"]",
",",
"idl_file",
":",
"syntax",
".",
"IDLParsedSpec",
",",
"idl_file_path",
":",
"str",
")",
"->",
"Optional",
"[",
"Union",
"[",
"synta... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/idl/idl_check_compatibility.py#L274-L282 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib2to3/pgen2/parse.py | python | Parser.classify | (self, type, value, context) | return ilabel | Turn a token into a label. (Internal) | Turn a token into a label. (Internal) | [
"Turn",
"a",
"token",
"into",
"a",
"label",
".",
"(",
"Internal",
")"
] | def classify(self, type, value, context):
"""Turn a token into a label. (Internal)"""
if type == token.NAME:
# Keep a listing of all used names
self.used_names.add(value)
# Check for reserved words
ilabel = self.grammar.keywords.get(value)
if ... | [
"def",
"classify",
"(",
"self",
",",
"type",
",",
"value",
",",
"context",
")",
":",
"if",
"type",
"==",
"token",
".",
"NAME",
":",
"# Keep a listing of all used names",
"self",
".",
"used_names",
".",
"add",
"(",
"value",
")",
"# Check for reserved words",
... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib2to3/pgen2/parse.py#L161-L173 | |
gem5/gem5 | 141cc37c2d4b93959d4c249b8f7e6a8b2ef75338 | src/arch/micro_asm.py | python | t_ANY_COMMENT | (t) | r'\#[^\n]*(?=\n) | r'\#[^\n]*(?=\n) | [
"r",
"\\",
"#",
"[",
"^",
"\\",
"n",
"]",
"*",
"(",
"?",
"=",
"\\",
"n",
")"
] | def t_ANY_COMMENT(t):
r'\#[^\n]*(?=\n)' | [
"def",
"t_ANY_COMMENT",
"(",
"t",
")",
":"
] | https://github.com/gem5/gem5/blob/141cc37c2d4b93959d4c249b8f7e6a8b2ef75338/src/arch/micro_asm.py#L207-L208 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/richtext.py | python | TextAttrBorder.SetStyle | (*args, **kwargs) | return _richtext.TextAttrBorder_SetStyle(*args, **kwargs) | SetStyle(self, int style) | SetStyle(self, int style) | [
"SetStyle",
"(",
"self",
"int",
"style",
")"
] | def SetStyle(*args, **kwargs):
"""SetStyle(self, int style)"""
return _richtext.TextAttrBorder_SetStyle(*args, **kwargs) | [
"def",
"SetStyle",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"TextAttrBorder_SetStyle",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/richtext.py#L349-L351 | |
scribusproject/scribus | 41ec7c775a060912cf251682a8b1437f753f80f4 | scribus/plugins/scriptplugin/scripts/FontSample.py | python | create_empty_samplepage | (pageNum, getSizeOnly) | return pageNum | Creates a new page and increments page number by one.
Note getSizeOnly is now evaluated. Will still generate page number increment
but will not actually create the new page or place the number on the page. | Creates a new page and increments page number by one. | [
"Creates",
"a",
"new",
"page",
"and",
"increments",
"page",
"number",
"by",
"one",
"."
] | def create_empty_samplepage(pageNum, getSizeOnly):
"""Creates a new page and increments page number by one.
Note getSizeOnly is now evaluated. Will still generate page number increment
but will not actually create the new page or place the number on the page."""
if not getSizeOnly:
scribus.newP... | [
"def",
"create_empty_samplepage",
"(",
"pageNum",
",",
"getSizeOnly",
")",
":",
"if",
"not",
"getSizeOnly",
":",
"scribus",
".",
"newPage",
"(",
"-",
"1",
")",
"pageNum",
"=",
"pageNum",
"+",
"1",
"set_odd_even",
"(",
"pageNum",
")",
"if",
"not",
"getSizeO... | https://github.com/scribusproject/scribus/blob/41ec7c775a060912cf251682a8b1437f753f80f4/scribus/plugins/scriptplugin/scripts/FontSample.py#L651-L663 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/asyncio/base_events.py | python | BaseEventLoop.set_task_factory | (self, factory) | Set a task factory that will be used by loop.create_task().
If factory is None the default task factory will be set.
If factory is a callable, it should have a signature matching
'(loop, coro)', where 'loop' will be a reference to the active
event loop, 'coro' will be a coroutine objec... | Set a task factory that will be used by loop.create_task(). | [
"Set",
"a",
"task",
"factory",
"that",
"will",
"be",
"used",
"by",
"loop",
".",
"create_task",
"()",
"."
] | def set_task_factory(self, factory):
"""Set a task factory that will be used by loop.create_task().
If factory is None the default task factory will be set.
If factory is a callable, it should have a signature matching
'(loop, coro)', where 'loop' will be a reference to the active
... | [
"def",
"set_task_factory",
"(",
"self",
",",
"factory",
")",
":",
"if",
"factory",
"is",
"not",
"None",
"and",
"not",
"callable",
"(",
"factory",
")",
":",
"raise",
"TypeError",
"(",
"'task factory must be a callable or None'",
")",
"self",
".",
"_task_factory",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/asyncio/base_events.py#L411-L423 | ||
apache/kudu | 90895ce76590f10730ad7aac3613b69d89ff5422 | build-support/check_compatibility.py | python | get_git_hash | (revname) | return check_output(["git", "rev-parse", revname],
cwd=get_repo_dir()).decode('utf-8').strip() | Convert 'revname' to its SHA-1 hash. | Convert 'revname' to its SHA-1 hash. | [
"Convert",
"revname",
"to",
"its",
"SHA",
"-",
"1",
"hash",
"."
] | def get_git_hash(revname):
""" Convert 'revname' to its SHA-1 hash. """
return check_output(["git", "rev-parse", revname],
cwd=get_repo_dir()).decode('utf-8').strip() | [
"def",
"get_git_hash",
"(",
"revname",
")",
":",
"return",
"check_output",
"(",
"[",
"\"git\"",
",",
"\"rev-parse\"",
",",
"revname",
"]",
",",
"cwd",
"=",
"get_repo_dir",
"(",
")",
")",
".",
"decode",
"(",
"'utf-8'",
")",
".",
"strip",
"(",
")"
] | https://github.com/apache/kudu/blob/90895ce76590f10730ad7aac3613b69d89ff5422/build-support/check_compatibility.py#L91-L94 | |
panda3d/panda3d | 833ad89ebad58395d0af0b7ec08538e5e4308265 | samples/networking/01-simple-connection/client.py | python | GameClientRepository.gotCreateReady | (self) | Ready to enter the world. Expand our interest to include
any other zones | Ready to enter the world. Expand our interest to include
any other zones | [
"Ready",
"to",
"enter",
"the",
"world",
".",
"Expand",
"our",
"interest",
"to",
"include",
"any",
"other",
"zones"
] | def gotCreateReady(self):
""" Ready to enter the world. Expand our interest to include
any other zones """
# This method checks whether we actually have a valid doID range
# to create distributed objects yet
if not self.haveCreateAuthority():
# Not ready yet.
... | [
"def",
"gotCreateReady",
"(",
"self",
")",
":",
"# This method checks whether we actually have a valid doID range",
"# to create distributed objects yet",
"if",
"not",
"self",
".",
"haveCreateAuthority",
"(",
")",
":",
"# Not ready yet.",
"return",
"# we are ready now, so ignore ... | https://github.com/panda3d/panda3d/blob/833ad89ebad58395d0af0b7ec08538e5e4308265/samples/networking/01-simple-connection/client.py#L104-L118 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_windows.py | python | TopLevelWindow.GetDefaultSize | (*args, **kwargs) | return _windows_.TopLevelWindow_GetDefaultSize(*args, **kwargs) | GetDefaultSize() -> Size | GetDefaultSize() -> Size | [
"GetDefaultSize",
"()",
"-",
">",
"Size"
] | def GetDefaultSize(*args, **kwargs):
"""GetDefaultSize() -> Size"""
return _windows_.TopLevelWindow_GetDefaultSize(*args, **kwargs) | [
"def",
"GetDefaultSize",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"TopLevelWindow_GetDefaultSize",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_windows.py#L502-L504 | |
bayandin/chromedriver | d40a2092b50f2fca817221eeb5ea093e0e642c10 | util.py | python | MaybeDelete | (path) | Deletes the given file or directory (recurisvely), if it exists. | Deletes the given file or directory (recurisvely), if it exists. | [
"Deletes",
"the",
"given",
"file",
"or",
"directory",
"(",
"recurisvely",
")",
"if",
"it",
"exists",
"."
] | def MaybeDelete(path):
"""Deletes the given file or directory (recurisvely), if it exists."""
if os.path.exists(path):
Delete(path) | [
"def",
"MaybeDelete",
"(",
"path",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"path",
")",
":",
"Delete",
"(",
"path",
")"
] | https://github.com/bayandin/chromedriver/blob/d40a2092b50f2fca817221eeb5ea093e0e642c10/util.py#L111-L114 | ||
hfinkel/llvm-project-cxxjit | 91084ef018240bbb8e24235ff5cd8c355a9c1a1e | compiler-rt/lib/sanitizer_common/scripts/cpplint.py | python | ParseArguments | (args) | return filenames | Parses the command line arguments.
This may set the output format and verbosity level as side-effects.
Args:
args: The command line arguments:
Returns:
The list of filenames to lint. | Parses the command line arguments. | [
"Parses",
"the",
"command",
"line",
"arguments",
"."
] | def ParseArguments(args):
"""Parses the command line arguments.
This may set the output format and verbosity level as side-effects.
Args:
args: The command line arguments:
Returns:
The list of filenames to lint.
"""
try:
(opts, filenames) = getopt.getopt(args, '', ['help', 'output=', 'verbose... | [
"def",
"ParseArguments",
"(",
"args",
")",
":",
"try",
":",
"(",
"opts",
",",
"filenames",
")",
"=",
"getopt",
".",
"getopt",
"(",
"args",
",",
"''",
",",
"[",
"'help'",
",",
"'output='",
",",
"'verbose='",
",",
"'counting='",
",",
"'filter='",
",",
... | https://github.com/hfinkel/llvm-project-cxxjit/blob/91084ef018240bbb8e24235ff5cd8c355a9c1a1e/compiler-rt/lib/sanitizer_common/scripts/cpplint.py#L3949-L4002 | |
yyzybb537/libgo | 4af17b7c67643c4d54aa354dcc77963ea07847d0 | third_party/boost.context/tools/build/src/build/type.py | python | set_scanner | (type, scanner) | Sets a scanner class that will be used for this 'type'. | Sets a scanner class that will be used for this 'type'. | [
"Sets",
"a",
"scanner",
"class",
"that",
"will",
"be",
"used",
"for",
"this",
"type",
"."
] | def set_scanner (type, scanner):
""" Sets a scanner class that will be used for this 'type'.
"""
if __debug__:
from .scanner import Scanner
assert isinstance(type, basestring)
assert issubclass(scanner, Scanner)
validate (type)
__types [type]['scanner'] = scanner | [
"def",
"set_scanner",
"(",
"type",
",",
"scanner",
")",
":",
"if",
"__debug__",
":",
"from",
".",
"scanner",
"import",
"Scanner",
"assert",
"isinstance",
"(",
"type",
",",
"basestring",
")",
"assert",
"issubclass",
"(",
"scanner",
",",
"Scanner",
")",
"val... | https://github.com/yyzybb537/libgo/blob/4af17b7c67643c4d54aa354dcc77963ea07847d0/third_party/boost.context/tools/build/src/build/type.py#L145-L153 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | contrib/gizmos/msw/gizmos.py | python | TreeListColumnInfo.IsShown | (*args, **kwargs) | return _gizmos.TreeListColumnInfo_IsShown(*args, **kwargs) | IsShown(self) -> bool | IsShown(self) -> bool | [
"IsShown",
"(",
"self",
")",
"-",
">",
"bool"
] | def IsShown(*args, **kwargs):
"""IsShown(self) -> bool"""
return _gizmos.TreeListColumnInfo_IsShown(*args, **kwargs) | [
"def",
"IsShown",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gizmos",
".",
"TreeListColumnInfo_IsShown",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/contrib/gizmos/msw/gizmos.py#L428-L430 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_windows.py | python | PrintDialogData.IsOk | (*args, **kwargs) | return _windows_.PrintDialogData_IsOk(*args, **kwargs) | IsOk(self) -> bool | IsOk(self) -> bool | [
"IsOk",
"(",
"self",
")",
"-",
">",
"bool"
] | def IsOk(*args, **kwargs):
"""IsOk(self) -> bool"""
return _windows_.PrintDialogData_IsOk(*args, **kwargs) | [
"def",
"IsOk",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"PrintDialogData_IsOk",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_windows.py#L5146-L5148 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/telemetry/telemetry/core/android_action_runner.py | python | AndroidActionRunner.TurnScreenOff | (self) | If device screen is on, turn screen off.
If the screen is already off, log a warning and return immediately.
Raises:
Timeout: If the screen is on and device fails to turn screen off. | If device screen is on, turn screen off.
If the screen is already off, log a warning and return immediately. | [
"If",
"device",
"screen",
"is",
"on",
"turn",
"screen",
"off",
".",
"If",
"the",
"screen",
"is",
"already",
"off",
"log",
"a",
"warning",
"and",
"return",
"immediately",
"."
] | def TurnScreenOff(self):
"""If device screen is on, turn screen off.
If the screen is already off, log a warning and return immediately.
Raises:
Timeout: If the screen is on and device fails to turn screen off.
"""
def is_screen_off():
return not self._platform_backend.device.IsScreenO... | [
"def",
"TurnScreenOff",
"(",
"self",
")",
":",
"def",
"is_screen_off",
"(",
")",
":",
"return",
"not",
"self",
".",
"_platform_backend",
".",
"device",
".",
"IsScreenOn",
"(",
")",
"self",
".",
"_platform_backend",
".",
"device",
".",
"SetScreen",
"(",
"Fa... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/telemetry/core/android_action_runner.py#L130-L142 | ||
osrf/gazebo | f570338107862253229a0514ffea10deab4f4517 | tools/cpplint.py | python | _ClassState.CheckFinished | (self, filename, error) | Checks that all classes have been completely parsed.
Call this when all lines in a file have been processed.
Args:
filename: The name of the current file.
error: The function to call with any errors found. | Checks that all classes have been completely parsed. | [
"Checks",
"that",
"all",
"classes",
"have",
"been",
"completely",
"parsed",
"."
] | def CheckFinished(self, filename, error):
"""Checks that all classes have been completely parsed.
Call this when all lines in a file have been processed.
Args:
filename: The name of the current file.
error: The function to call with any errors found.
"""
if self.classinfo_stack:
#... | [
"def",
"CheckFinished",
"(",
"self",
",",
"filename",
",",
"error",
")",
":",
"if",
"self",
".",
"classinfo_stack",
":",
"# Note: This test can result in false positives if #ifdef constructs",
"# get in the way of brace matching. See the testBuildClass test in",
"# cpplint_unittest... | https://github.com/osrf/gazebo/blob/f570338107862253229a0514ffea10deab4f4517/tools/cpplint.py#L1286-L1300 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/customtreectrl.py | python | CustomTreeCtrl.OnMouse | (self, event) | Handles a bunch of ``wx.EVT_MOUSE_EVENTS`` events for :class:`CustomTreeCtrl`.
:param `event`: a :class:`MouseEvent` event to be processed. | Handles a bunch of ``wx.EVT_MOUSE_EVENTS`` events for :class:`CustomTreeCtrl`. | [
"Handles",
"a",
"bunch",
"of",
"wx",
".",
"EVT_MOUSE_EVENTS",
"events",
"for",
":",
"class",
":",
"CustomTreeCtrl",
"."
] | def OnMouse(self, event):
"""
Handles a bunch of ``wx.EVT_MOUSE_EVENTS`` events for :class:`CustomTreeCtrl`.
:param `event`: a :class:`MouseEvent` event to be processed.
"""
if not self._anchor:
return
pt = self.CalcUnscrolledPosition(event.GetPosition())
... | [
"def",
"OnMouse",
"(",
"self",
",",
"event",
")",
":",
"if",
"not",
"self",
".",
"_anchor",
":",
"return",
"pt",
"=",
"self",
".",
"CalcUnscrolledPosition",
"(",
"event",
".",
"GetPosition",
"(",
")",
")",
"# Is the mouse over a tree item button?",
"flags",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/customtreectrl.py#L7598-L7968 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/setuptools/py2/pkg_resources/__init__.py | python | ResourceManager.extraction_error | (self) | Give an error message for problems extracting file(s) | Give an error message for problems extracting file(s) | [
"Give",
"an",
"error",
"message",
"for",
"problems",
"extracting",
"file",
"(",
"s",
")"
] | def extraction_error(self):
"""Give an error message for problems extracting file(s)"""
old_exc = sys.exc_info()[1]
cache_path = self.extraction_path or get_default_cache()
tmpl = textwrap.dedent("""
Can't extract file(s) to egg cache
The following error occurr... | [
"def",
"extraction_error",
"(",
"self",
")",
":",
"old_exc",
"=",
"sys",
".",
"exc_info",
"(",
")",
"[",
"1",
"]",
"cache_path",
"=",
"self",
".",
"extraction_path",
"or",
"get_default_cache",
"(",
")",
"tmpl",
"=",
"textwrap",
".",
"dedent",
"(",
"\"\"\... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/setuptools/py2/pkg_resources/__init__.py#L1166-L1192 | ||
mingchen/protobuf-ios | 0958df34558cd54cb7b6e6ca5c8855bf3d475046 | compiler/python/mox.py | python | And.__init__ | (self, *args) | Initialize.
Args:
*args: One or more Comparator | Initialize. | [
"Initialize",
"."
] | def __init__(self, *args):
"""Initialize.
Args:
*args: One or more Comparator
"""
self._comparators = args | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
")",
":",
"self",
".",
"_comparators",
"=",
"args"
] | https://github.com/mingchen/protobuf-ios/blob/0958df34558cd54cb7b6e6ca5c8855bf3d475046/compiler/python/mox.py#L1050-L1057 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_core.py | python | TextAreaBase.GetStyle | (*args, **kwargs) | return _core_.TextAreaBase_GetStyle(*args, **kwargs) | GetStyle(self, long position, wxTextAttr style) -> bool | GetStyle(self, long position, wxTextAttr style) -> bool | [
"GetStyle",
"(",
"self",
"long",
"position",
"wxTextAttr",
"style",
")",
"-",
">",
"bool"
] | def GetStyle(*args, **kwargs):
"""GetStyle(self, long position, wxTextAttr style) -> bool"""
return _core_.TextAreaBase_GetStyle(*args, **kwargs) | [
"def",
"GetStyle",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"TextAreaBase_GetStyle",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_core.py#L13424-L13426 | |
adventuregamestudio/ags | efa89736d868e9dfda4200149d33ba8637746399 | Common/libsrc/freetype-2.1.3/src/tools/docmaker/tohtml.py | python | HtmlFormatter.make_html_para | ( self, words ) | return "<p>" + line + "</p>" | convert a paragraph's words into tagged HTML text, handle xrefs | convert a paragraph's words into tagged HTML text, handle xrefs | [
"convert",
"a",
"paragraph",
"s",
"words",
"into",
"tagged",
"HTML",
"text",
"handle",
"xrefs"
] | def make_html_para( self, words ):
""" convert a paragraph's words into tagged HTML text, handle xrefs """
line = ""
if words:
line = self.make_html_word( words[0] )
for word in words[1:]:
line = line + " " + self.make_html_word( word )
return "<... | [
"def",
"make_html_para",
"(",
"self",
",",
"words",
")",
":",
"line",
"=",
"\"\"",
"if",
"words",
":",
"line",
"=",
"self",
".",
"make_html_word",
"(",
"words",
"[",
"0",
"]",
")",
"for",
"word",
"in",
"words",
"[",
"1",
":",
"]",
":",
"line",
"=... | https://github.com/adventuregamestudio/ags/blob/efa89736d868e9dfda4200149d33ba8637746399/Common/libsrc/freetype-2.1.3/src/tools/docmaker/tohtml.py#L195-L203 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/html.py | python | HtmlHelpController.ReadCustomization | (*args, **kwargs) | return _html.HtmlHelpController_ReadCustomization(*args, **kwargs) | ReadCustomization(self, ConfigBase cfg, String path=EmptyString) | ReadCustomization(self, ConfigBase cfg, String path=EmptyString) | [
"ReadCustomization",
"(",
"self",
"ConfigBase",
"cfg",
"String",
"path",
"=",
"EmptyString",
")"
] | def ReadCustomization(*args, **kwargs):
"""ReadCustomization(self, ConfigBase cfg, String path=EmptyString)"""
return _html.HtmlHelpController_ReadCustomization(*args, **kwargs) | [
"def",
"ReadCustomization",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_html",
".",
"HtmlHelpController_ReadCustomization",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/html.py#L1994-L1996 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/multiprocessing/connection.py | python | arbitrary_address | (family) | Return an arbitrary free address for the given family | Return an arbitrary free address for the given family | [
"Return",
"an",
"arbitrary",
"free",
"address",
"for",
"the",
"given",
"family"
] | def arbitrary_address(family):
'''
Return an arbitrary free address for the given family
'''
if family == 'AF_INET':
return ('localhost', 0)
elif family == 'AF_UNIX':
# Prefer abstract sockets if possible to avoid problems with the address
# size. When coding portable applic... | [
"def",
"arbitrary_address",
"(",
"family",
")",
":",
"if",
"family",
"==",
"'AF_INET'",
":",
"return",
"(",
"'localhost'",
",",
"0",
")",
"elif",
"family",
"==",
"'AF_UNIX'",
":",
"# Prefer abstract sockets if possible to avoid problems with the address",
"# size. When... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/multiprocessing/connection.py#L69-L86 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/turtle.py | python | _turtle_docrevise | (docstr) | return newdocstr | To reduce docstrings from RawTurtle class for functions | To reduce docstrings from RawTurtle class for functions | [
"To",
"reduce",
"docstrings",
"from",
"RawTurtle",
"class",
"for",
"functions"
] | def _turtle_docrevise(docstr):
"""To reduce docstrings from RawTurtle class for functions
"""
import re
if docstr is None:
return None
turtlename = _CFG["exampleturtle"]
newdocstr = docstr.replace("%s." % turtlename,"")
parexp = re.compile(r' \(.+ %s\):' % turtlename)
newdocstr =... | [
"def",
"_turtle_docrevise",
"(",
"docstr",
")",
":",
"import",
"re",
"if",
"docstr",
"is",
"None",
":",
"return",
"None",
"turtlename",
"=",
"_CFG",
"[",
"\"exampleturtle\"",
"]",
"newdocstr",
"=",
"docstr",
".",
"replace",
"(",
"\"%s.\"",
"%",
"turtlename",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/turtle.py#L3914-L3924 | |
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Draft/draftfunctions/svgtext.py | python | _get_text_techdraw | (text, tcolor, fontsize, anchor,
align, fontname, angle, base,
linespacing) | return svg | Return the SVG representation of text for TechDraw display.
`text` is a list of textual elements; they are iterated, styled,
and added around a `<text>` tag.
::
<text ...> text[0] </text>
<text ...> text[1] </text> | Return the SVG representation of text for TechDraw display. | [
"Return",
"the",
"SVG",
"representation",
"of",
"text",
"for",
"TechDraw",
"display",
"."
] | def _get_text_techdraw(text, tcolor, fontsize, anchor,
align, fontname, angle, base,
linespacing):
"""Return the SVG representation of text for TechDraw display.
`text` is a list of textual elements; they are iterated, styled,
and added around a `<text>` tag.
... | [
"def",
"_get_text_techdraw",
"(",
"text",
",",
"tcolor",
",",
"fontsize",
",",
"anchor",
",",
"align",
",",
"fontname",
",",
"angle",
",",
"base",
",",
"linespacing",
")",
":",
"svg",
"=",
"\"\"",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"text",
"... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Draft/draftfunctions/svgtext.py#L39-L87 | |
apache/singa | 93fd9da72694e68bfe3fb29d0183a65263d238a1 | python/singa/autograd.py | python | Gather.forward | (self, x) | return singa.ConcatOn(xs, self.axis) | forward of Gather
Args:
x (CTensor): input tensor.
Returns:
the output CTensor. | forward of Gather
Args:
x (CTensor): input tensor.
Returns:
the output CTensor. | [
"forward",
"of",
"Gather",
"Args",
":",
"x",
"(",
"CTensor",
")",
":",
"input",
"tensor",
".",
"Returns",
":",
"the",
"output",
"CTensor",
"."
] | def forward(self, x):
"""
forward of Gather
Args:
x (CTensor): input tensor.
Returns:
the output CTensor.
"""
self.x_shape = list(x.shape())
self.axis = self.axis % len(self.x_shape) # handle the negative value
_shape = self.x_shap... | [
"def",
"forward",
"(",
"self",
",",
"x",
")",
":",
"self",
".",
"x_shape",
"=",
"list",
"(",
"x",
".",
"shape",
"(",
")",
")",
"self",
".",
"axis",
"=",
"self",
".",
"axis",
"%",
"len",
"(",
"self",
".",
"x_shape",
")",
"# handle the negative value... | https://github.com/apache/singa/blob/93fd9da72694e68bfe3fb29d0183a65263d238a1/python/singa/autograd.py#L4448-L4478 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/ipaddress.py | python | _BaseV6._string_from_ip_int | (cls, ip_int=None) | return ':'.join(hextets) | Turns a 128-bit integer into hexadecimal notation.
Args:
ip_int: An integer, the IP address.
Returns:
A string, the hexadecimal representation of the address.
Raises:
ValueError: The address is bigger than 128 bits of all ones. | Turns a 128-bit integer into hexadecimal notation. | [
"Turns",
"a",
"128",
"-",
"bit",
"integer",
"into",
"hexadecimal",
"notation",
"."
] | def _string_from_ip_int(cls, ip_int=None):
"""Turns a 128-bit integer into hexadecimal notation.
Args:
ip_int: An integer, the IP address.
Returns:
A string, the hexadecimal representation of the address.
Raises:
ValueError: The address is bigger th... | [
"def",
"_string_from_ip_int",
"(",
"cls",
",",
"ip_int",
"=",
"None",
")",
":",
"if",
"ip_int",
"is",
"None",
":",
"ip_int",
"=",
"int",
"(",
"cls",
".",
"_ip",
")",
"if",
"ip_int",
">",
"cls",
".",
"_ALL_ONES",
":",
"raise",
"ValueError",
"(",
"'IPv... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/ipaddress.py#L1787-L1810 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_controls.py | python | HyperlinkCtrl.GetVisitedColour | (*args, **kwargs) | return _controls_.HyperlinkCtrl_GetVisitedColour(*args, **kwargs) | GetVisitedColour(self) -> Colour | GetVisitedColour(self) -> Colour | [
"GetVisitedColour",
"(",
"self",
")",
"-",
">",
"Colour"
] | def GetVisitedColour(*args, **kwargs):
"""GetVisitedColour(self) -> Colour"""
return _controls_.HyperlinkCtrl_GetVisitedColour(*args, **kwargs) | [
"def",
"GetVisitedColour",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"HyperlinkCtrl_GetVisitedColour",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_controls.py#L6646-L6648 | |
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py | python | Define | (d, flavor) | return QuoteShellArgument(ninja_syntax.escape("-D" + d), flavor) | Takes a preprocessor define and returns a -D parameter that's ninja- and
shell-escaped. | Takes a preprocessor define and returns a -D parameter that's ninja- and
shell-escaped. | [
"Takes",
"a",
"preprocessor",
"define",
"and",
"returns",
"a",
"-",
"D",
"parameter",
"that",
"s",
"ninja",
"-",
"and",
"shell",
"-",
"escaped",
"."
] | def Define(d, flavor):
"""Takes a preprocessor define and returns a -D parameter that's ninja- and
shell-escaped."""
if flavor == "win":
# cl.exe replaces literal # characters with = in preprocessor definitions for
# some reason. Octal-encode to work around that.
d = d.replace("#", "... | [
"def",
"Define",
"(",
"d",
",",
"flavor",
")",
":",
"if",
"flavor",
"==",
"\"win\"",
":",
"# cl.exe replaces literal # characters with = in preprocessor definitions for",
"# some reason. Octal-encode to work around that.",
"d",
"=",
"d",
".",
"replace",
"(",
"\"#\"",
",",... | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py#L85-L92 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_misc.py | python | AboutDialogInfo.GetIcon | (*args, **kwargs) | return _misc_.AboutDialogInfo_GetIcon(*args, **kwargs) | GetIcon(self) -> Icon
Return the current icon value. | GetIcon(self) -> Icon | [
"GetIcon",
"(",
"self",
")",
"-",
">",
"Icon"
] | def GetIcon(*args, **kwargs):
"""
GetIcon(self) -> Icon
Return the current icon value.
"""
return _misc_.AboutDialogInfo_GetIcon(*args, **kwargs) | [
"def",
"GetIcon",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"AboutDialogInfo_GetIcon",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_misc.py#L6754-L6760 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_core.py | python | Position.__eq__ | (*args, **kwargs) | return _core_.Position___eq__(*args, **kwargs) | __eq__(self, PyObject other) -> bool
Test for equality of wx.Position objects. | __eq__(self, PyObject other) -> bool | [
"__eq__",
"(",
"self",
"PyObject",
"other",
")",
"-",
">",
"bool"
] | def __eq__(*args, **kwargs):
"""
__eq__(self, PyObject other) -> bool
Test for equality of wx.Position objects.
"""
return _core_.Position___eq__(*args, **kwargs) | [
"def",
"__eq__",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"Position___eq__",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_core.py#L2110-L2116 | |
dmlc/xgboost | 2775c2a1abd4b5b759ff517617434c8b9aeb4cc0 | python-package/xgboost/core.py | python | _ProxyDMatrix._set_data_from_csr | (self, csr) | Set data from scipy csr | Set data from scipy csr | [
"Set",
"data",
"from",
"scipy",
"csr"
] | def _set_data_from_csr(self, csr):
"""Set data from scipy csr"""
from .data import _array_interface
_LIB.XGProxyDMatrixSetDataCSR(
self.handle,
_array_interface(csr.indptr),
_array_interface(csr.indices),
_array_interface(csr.data),
ct... | [
"def",
"_set_data_from_csr",
"(",
"self",
",",
"csr",
")",
":",
"from",
".",
"data",
"import",
"_array_interface",
"_LIB",
".",
"XGProxyDMatrixSetDataCSR",
"(",
"self",
".",
"handle",
",",
"_array_interface",
"(",
"csr",
".",
"indptr",
")",
",",
"_array_interf... | https://github.com/dmlc/xgboost/blob/2775c2a1abd4b5b759ff517617434c8b9aeb4cc0/python-package/xgboost/core.py#L1132-L1142 | ||
epiqc/ScaffCC | 66a79944ee4cd116b27bc1a69137276885461db8 | llvm/utils/benchmark/tools/strip_asm.py | python | process_identifiers | (l) | return new_line | process_identifiers - process all identifiers and modify them to have
consistent names across all platforms; specifically across ELF and MachO.
For example, MachO inserts an additional understore at the beginning of
names. This function removes that. | process_identifiers - process all identifiers and modify them to have
consistent names across all platforms; specifically across ELF and MachO.
For example, MachO inserts an additional understore at the beginning of
names. This function removes that. | [
"process_identifiers",
"-",
"process",
"all",
"identifiers",
"and",
"modify",
"them",
"to",
"have",
"consistent",
"names",
"across",
"all",
"platforms",
";",
"specifically",
"across",
"ELF",
"and",
"MachO",
".",
"For",
"example",
"MachO",
"inserts",
"an",
"addit... | def process_identifiers(l):
"""
process_identifiers - process all identifiers and modify them to have
consistent names across all platforms; specifically across ELF and MachO.
For example, MachO inserts an additional understore at the beginning of
names. This function removes that.
"""
parts... | [
"def",
"process_identifiers",
"(",
"l",
")",
":",
"parts",
"=",
"re",
".",
"split",
"(",
"r'([a-zA-Z0-9_]+)'",
",",
"l",
")",
"new_line",
"=",
"''",
"for",
"tk",
"in",
"parts",
":",
"if",
"is_identifier",
"(",
"tk",
")",
":",
"if",
"tk",
".",
"starts... | https://github.com/epiqc/ScaffCC/blob/66a79944ee4cd116b27bc1a69137276885461db8/llvm/utils/benchmark/tools/strip_asm.py#L64-L81 | |
netket/netket | 0d534e54ecbf25b677ea72af6b85947979420652 | netket/utils/group/cubic.py | python | Fd3m | () | return (_inv_group().change_origin([1 / 8, 1 / 8, 1 / 8]) @ Td()).replace(
unit_cell=np.asarray([[0, 0.5, 0.5], [0.5, 0, 0.5], [0.5, 0.5, 0]])
) | Nonsymmorphic "point group" of the diamond and pyrochlore lattices with a
cubic unit cell of side length 1. | Nonsymmorphic "point group" of the diamond and pyrochlore lattices with a
cubic unit cell of side length 1. | [
"Nonsymmorphic",
"point",
"group",
"of",
"the",
"diamond",
"and",
"pyrochlore",
"lattices",
"with",
"a",
"cubic",
"unit",
"cell",
"of",
"side",
"length",
"1",
"."
] | def Fd3m() -> PointGroup:
"""Nonsymmorphic "point group" of the diamond and pyrochlore lattices with a
cubic unit cell of side length 1."""
return (_inv_group().change_origin([1 / 8, 1 / 8, 1 / 8]) @ Td()).replace(
unit_cell=np.asarray([[0, 0.5, 0.5], [0.5, 0, 0.5], [0.5, 0.5, 0]])
) | [
"def",
"Fd3m",
"(",
")",
"->",
"PointGroup",
":",
"return",
"(",
"_inv_group",
"(",
")",
".",
"change_origin",
"(",
"[",
"1",
"/",
"8",
",",
"1",
"/",
"8",
",",
"1",
"/",
"8",
"]",
")",
"@",
"Td",
"(",
")",
")",
".",
"replace",
"(",
"unit_cel... | https://github.com/netket/netket/blob/0d534e54ecbf25b677ea72af6b85947979420652/netket/utils/group/cubic.py#L113-L118 | |
olliw42/storm32bgc | 99d62a6130ae2950514022f50eb669c45a8cc1ba | old/betacopter/old/betacopter36dev-v003/modules/uavcan/libuavcan/dsdl_compiler/pyuavcan/uavcan/dsdl/parser.py | python | parse_namespaces | (source_dirs, search_dirs=None) | return output_types | Use only this function to parse DSDL definitions.
This function takes a list of root namespace directories (containing DSDL definition files to parse) and an
optional list of search directories (containing DSDL definition files that can be referenced from the types
that are going to be parsed).
Returns... | Use only this function to parse DSDL definitions.
This function takes a list of root namespace directories (containing DSDL definition files to parse) and an
optional list of search directories (containing DSDL definition files that can be referenced from the types
that are going to be parsed). | [
"Use",
"only",
"this",
"function",
"to",
"parse",
"DSDL",
"definitions",
".",
"This",
"function",
"takes",
"a",
"list",
"of",
"root",
"namespace",
"directories",
"(",
"containing",
"DSDL",
"definition",
"files",
"to",
"parse",
")",
"and",
"an",
"optional",
"... | def parse_namespaces(source_dirs, search_dirs=None):
'''
Use only this function to parse DSDL definitions.
This function takes a list of root namespace directories (containing DSDL definition files to parse) and an
optional list of search directories (containing DSDL definition files that can be referen... | [
"def",
"parse_namespaces",
"(",
"source_dirs",
",",
"search_dirs",
"=",
"None",
")",
":",
"def",
"walk",
"(",
")",
":",
"import",
"fnmatch",
"from",
"functools",
"import",
"partial",
"def",
"on_walk_error",
"(",
"directory",
",",
"ex",
")",
":",
"raise",
"... | https://github.com/olliw42/storm32bgc/blob/99d62a6130ae2950514022f50eb669c45a8cc1ba/old/betacopter/old/betacopter36dev-v003/modules/uavcan/libuavcan/dsdl_compiler/pyuavcan/uavcan/dsdl/parser.py#L702-L756 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_controls.py | python | TreeCtrl.AssignImageList | (*args, **kwargs) | return _controls_.TreeCtrl_AssignImageList(*args, **kwargs) | AssignImageList(self, ImageList imageList) | AssignImageList(self, ImageList imageList) | [
"AssignImageList",
"(",
"self",
"ImageList",
"imageList",
")"
] | def AssignImageList(*args, **kwargs):
"""AssignImageList(self, ImageList imageList)"""
return _controls_.TreeCtrl_AssignImageList(*args, **kwargs) | [
"def",
"AssignImageList",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"TreeCtrl_AssignImageList",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_controls.py#L5252-L5254 | |
luliyucoordinate/Leetcode | 96afcdc54807d1d184e881a075d1dbf3371e31fb | src/0917-Reverse-Only-Letters/0917.py | python | Solution.reverseOnlyLetters | (self, S) | return ''.join([i if not i.isalpha() else p.pop() for i in S]) | :type S: str
:rtype: str | :type S: str
:rtype: str | [
":",
"type",
"S",
":",
"str",
":",
"rtype",
":",
"str"
] | def reverseOnlyLetters(self, S):
"""
:type S: str
:rtype: str
"""
if S == '':
return ''
p = [i for i in S if i.isalpha()]
return ''.join([i if not i.isalpha() else p.pop() for i in S]) | [
"def",
"reverseOnlyLetters",
"(",
"self",
",",
"S",
")",
":",
"if",
"S",
"==",
"''",
":",
"return",
"''",
"p",
"=",
"[",
"i",
"for",
"i",
"in",
"S",
"if",
"i",
".",
"isalpha",
"(",
")",
"]",
"return",
"''",
".",
"join",
"(",
"[",
"i",
"if",
... | https://github.com/luliyucoordinate/Leetcode/blob/96afcdc54807d1d184e881a075d1dbf3371e31fb/src/0917-Reverse-Only-Letters/0917.py#L2-L10 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/tools/api/generator/create_python_api.py | python | _ModuleInitCodeBuilder.format_import | (self, source_module_name, source_name, dest_name) | Formats import statement.
Args:
source_module_name: (string) Source module to import from.
source_name: (string) Source symbol name to import.
dest_name: (string) Destination alias name.
Returns:
An import statement string. | Formats import statement. | [
"Formats",
"import",
"statement",
"."
] | def format_import(self, source_module_name, source_name, dest_name):
"""Formats import statement.
Args:
source_module_name: (string) Source module to import from.
source_name: (string) Source symbol name to import.
dest_name: (string) Destination alias name.
Returns:
An import stat... | [
"def",
"format_import",
"(",
"self",
",",
"source_module_name",
",",
"source_name",
",",
"dest_name",
")",
":",
"if",
"self",
".",
"_lazy_loading",
":",
"return",
"\" '%s': ('%s', '%s'),\"",
"%",
"(",
"dest_name",
",",
"source_module_name",
",",
"source_name",
")... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/tools/api/generator/create_python_api.py#L275-L300 | ||
gv22ga/dlib-face-recognition-android | 42d6305cbd85833f2b85bb79b70ab9ab004153c9 | tools/lint/cpplint.py | python | CheckSectionSpacing | (filename, clean_lines, class_info, linenum, error) | Checks for additional blank line issues related to sections.
Currently the only thing checked here is blank line before protected/private.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
class_info: A _ClassInfo objects.
linenum: The number of... | Checks for additional blank line issues related to sections.
Currently the only thing checked here is blank line before protected/private.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
class_info: A _ClassInfo objects.
linenum: The number of... | [
"Checks",
"for",
"additional",
"blank",
"line",
"issues",
"related",
"to",
"sections",
".",
"Currently",
"the",
"only",
"thing",
"checked",
"here",
"is",
"blank",
"line",
"before",
"protected",
"/",
"private",
".",
"Args",
":",
"filename",
":",
"The",
"name"... | def CheckSectionSpacing(filename, clean_lines, class_info, linenum, error):
"""Checks for additional blank line issues related to sections.
Currently the only thing checked here is blank line before protected/private.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance cont... | [
"def",
"CheckSectionSpacing",
"(",
"filename",
",",
"clean_lines",
",",
"class_info",
",",
"linenum",
",",
"error",
")",
":",
"# Skip checks if the class is small, where small means 25 lines or less.",
"# 25 lines seems like a good cutoff since that's the usual height of",
"# termina... | https://github.com/gv22ga/dlib-face-recognition-android/blob/42d6305cbd85833f2b85bb79b70ab9ab004153c9/tools/lint/cpplint.py#L3436-L3486 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/metrics_impl.py | python | mean_squared_error | (labels,
predictions,
weights=None,
metrics_collections=None,
updates_collections=None,
name=None) | return mean(squared_error, weights, metrics_collections, updates_collections,
name or 'mean_squared_error') | Computes the mean squared error between the labels and predictions.
The `mean_squared_error` function creates two local variables,
`total` and `count` that are used to compute the mean squared error.
This average is weighted by `weights`, and it is ultimately returned as
`mean_squared_error`: an idempotent ope... | Computes the mean squared error between the labels and predictions. | [
"Computes",
"the",
"mean",
"squared",
"error",
"between",
"the",
"labels",
"and",
"predictions",
"."
] | def mean_squared_error(labels,
predictions,
weights=None,
metrics_collections=None,
updates_collections=None,
name=None):
"""Computes the mean squared error between the labels and predictions.
The `me... | [
"def",
"mean_squared_error",
"(",
"labels",
",",
"predictions",
",",
"weights",
"=",
"None",
",",
"metrics_collections",
"=",
"None",
",",
"updates_collections",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"if",
"context",
".",
"executing_eagerly",
"(",
... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/metrics_impl.py#L1266-L1323 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | demo/agw/AUI.py | python | ProgressGauge.GetPath | (self, gc, rc, r) | return path | Returns a rounded GraphicsPath. | Returns a rounded GraphicsPath. | [
"Returns",
"a",
"rounded",
"GraphicsPath",
"."
] | def GetPath(self, gc, rc, r):
""" Returns a rounded GraphicsPath. """
x, y, w, h = rc
path = gc.CreatePath()
path.AddRoundedRectangle(x, y, w, h, r)
path.CloseSubpath()
return path | [
"def",
"GetPath",
"(",
"self",
",",
"gc",
",",
"rc",
",",
"r",
")",
":",
"x",
",",
"y",
",",
"w",
",",
"h",
"=",
"rc",
"path",
"=",
"gc",
".",
"CreatePath",
"(",
")",
"path",
".",
"AddRoundedRectangle",
"(",
"x",
",",
"y",
",",
"w",
",",
"h... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/demo/agw/AUI.py#L859-L866 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/AWS/resource-manager-code/lib/pkg_resources/_vendor/appdirs.py | python | _get_win_folder_from_registry | (csidl_name) | return dir | This is a fallback technique at best. I'm not sure if using the
registry for this guarantees us the correct answer for all CSIDL_*
names. | This is a fallback technique at best. I'm not sure if using the
registry for this guarantees us the correct answer for all CSIDL_*
names. | [
"This",
"is",
"a",
"fallback",
"technique",
"at",
"best",
".",
"I",
"m",
"not",
"sure",
"if",
"using",
"the",
"registry",
"for",
"this",
"guarantees",
"us",
"the",
"correct",
"answer",
"for",
"all",
"CSIDL_",
"*",
"names",
"."
] | def _get_win_folder_from_registry(csidl_name):
"""This is a fallback technique at best. I'm not sure if using the
registry for this guarantees us the correct answer for all CSIDL_*
names.
"""
if PY3:
import winreg as _winreg
else:
import _winreg
shell_folder_name = {
"CS... | [
"def",
"_get_win_folder_from_registry",
"(",
"csidl_name",
")",
":",
"if",
"PY3",
":",
"import",
"winreg",
"as",
"_winreg",
"else",
":",
"import",
"_winreg",
"shell_folder_name",
"=",
"{",
"\"CSIDL_APPDATA\"",
":",
"\"AppData\"",
",",
"\"CSIDL_COMMON_APPDATA\"",
":"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/AWS/resource-manager-code/lib/pkg_resources/_vendor/appdirs.py#L455-L476 | |
PX4/PX4-Autopilot | 0b9f60a0370be53d683352c63fd92db3d6586e18 | Tools/mavlink_px4.py | python | MAVLink.set_gps_global_origin_encode | (self, target_system, latitude, longitude, altitude) | return msg | As local waypoints exist, the global MISSION reference allows to
transform between the local coordinate frame and the
global (GPS) coordinate frame. This can be necessary
when e.g. in- and outdoor settings are connected and
the MAV should move from in- to ... | As local waypoints exist, the global MISSION reference allows to
transform between the local coordinate frame and the
global (GPS) coordinate frame. This can be necessary
when e.g. in- and outdoor settings are connected and
the MAV should move from in- to ... | [
"As",
"local",
"waypoints",
"exist",
"the",
"global",
"MISSION",
"reference",
"allows",
"to",
"transform",
"between",
"the",
"local",
"coordinate",
"frame",
"and",
"the",
"global",
"(",
"GPS",
")",
"coordinate",
"frame",
".",
"This",
"can",
"be",
"necessary",
... | def set_gps_global_origin_encode(self, target_system, latitude, longitude, altitude):
'''
As local waypoints exist, the global MISSION reference allows to
transform between the local coordinate frame and the
global (GPS) coordinate frame. This can be neces... | [
"def",
"set_gps_global_origin_encode",
"(",
"self",
",",
"target_system",
",",
"latitude",
",",
"longitude",
",",
"altitude",
")",
":",
"msg",
"=",
"MAVLink_set_gps_global_origin_message",
"(",
"target_system",
",",
"latitude",
",",
"longitude",
",",
"altitude",
")"... | https://github.com/PX4/PX4-Autopilot/blob/0b9f60a0370be53d683352c63fd92db3d6586e18/Tools/mavlink_px4.py#L3661-L3677 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/sparse_ops.py | python | sparse_slice | (sp_input, start, size, name=None) | Slice a `SparseTensor` based on the `start` and `size`.
For example, if the input is
input_tensor = shape = [2, 7]
[ a d e ]
[b c ]
Graphically the output tensors are:
sparse.slice([0, 0], [2, 4]) = shape = [2, 4]
[ a ]
[b c ]
sparse.slice([0, 4],... | Slice a `SparseTensor` based on the `start` and `size`. | [
"Slice",
"a",
"SparseTensor",
"based",
"on",
"the",
"start",
"and",
"size",
"."
] | def sparse_slice(sp_input, start, size, name=None):
"""Slice a `SparseTensor` based on the `start` and `size`.
For example, if the input is
input_tensor = shape = [2, 7]
[ a d e ]
[b c ]
Graphically the output tensors are:
sparse.slice([0, 0], [2, 4]) = shape = [2, 4]
... | [
"def",
"sparse_slice",
"(",
"sp_input",
",",
"start",
",",
"size",
",",
"name",
"=",
"None",
")",
":",
"sp_input",
"=",
"_convert_to_sparse_tensor",
"(",
"sp_input",
")",
"start",
"=",
"ops",
".",
"convert_to_tensor",
"(",
"start",
",",
"dtypes",
".",
"int... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/sparse_ops.py#L1121-L1166 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/encodings/zlib_codec.py | python | zlib_encode | (input,errors='strict') | return (output, len(input)) | Encodes the object input and returns a tuple (output
object, length consumed).
errors defines the error handling to apply. It defaults to
'strict' handling which is the only currently supported
error handling for this codec. | Encodes the object input and returns a tuple (output
object, length consumed). | [
"Encodes",
"the",
"object",
"input",
"and",
"returns",
"a",
"tuple",
"(",
"output",
"object",
"length",
"consumed",
")",
"."
] | def zlib_encode(input,errors='strict'):
""" Encodes the object input and returns a tuple (output
object, length consumed).
errors defines the error handling to apply. It defaults to
'strict' handling which is the only currently supported
error handling for this codec.
"""
... | [
"def",
"zlib_encode",
"(",
"input",
",",
"errors",
"=",
"'strict'",
")",
":",
"assert",
"errors",
"==",
"'strict'",
"output",
"=",
"zlib",
".",
"compress",
"(",
"input",
")",
"return",
"(",
"output",
",",
"len",
"(",
"input",
")",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/encodings/zlib_codec.py#L14-L26 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_pytorch/nndct_shared/utils/registry.py | python | Registry.list | (self) | return self._registry.keys() | Lists registered items.
Returns:
A list of names of registered objects. | Lists registered items. | [
"Lists",
"registered",
"items",
"."
] | def list(self):
"""Lists registered items.
Returns:
A list of names of registered objects.
"""
return self._registry.keys() | [
"def",
"list",
"(",
"self",
")",
":",
"return",
"self",
".",
"_registry",
".",
"keys",
"(",
")"
] | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_pytorch/nndct_shared/utils/registry.py#L55-L61 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/training/saver.py | python | BaseSaverBuilder.OpListToDict | (op_list) | return names_to_saveables | Create a dictionary of names to operation lists.
Args:
op_list: A list, tuple, or set of Variables or SaveableObjects.
Returns:
A dictionary of names to the operations that must be saved under
that name. Variables with save_slice_info are grouped together under the
same key in no part... | Create a dictionary of names to operation lists. | [
"Create",
"a",
"dictionary",
"of",
"names",
"to",
"operation",
"lists",
"."
] | def OpListToDict(op_list):
"""Create a dictionary of names to operation lists.
Args:
op_list: A list, tuple, or set of Variables or SaveableObjects.
Returns:
A dictionary of names to the operations that must be saved under
that name. Variables with save_slice_info are grouped together u... | [
"def",
"OpListToDict",
"(",
"op_list",
")",
":",
"if",
"not",
"isinstance",
"(",
"op_list",
",",
"(",
"list",
",",
"tuple",
",",
"set",
")",
")",
":",
"raise",
"TypeError",
"(",
"\"Variables to save should be passed in a dict or a \"",
"\"list: %s\"",
"%",
"op_l... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/training/saver.py#L505-L570 | |
stellar-deprecated/stellard | 67eabb2217bdfa9a6ea317f62338fb6bca458c90 | src/protobuf/python/google/protobuf/internal/cpp_message.py | python | InitMessage | (message_descriptor, cls) | Constructs a new message instance (called before instance's __init__). | Constructs a new message instance (called before instance's __init__). | [
"Constructs",
"a",
"new",
"message",
"instance",
"(",
"called",
"before",
"instance",
"s",
"__init__",
")",
"."
] | def InitMessage(message_descriptor, cls):
"""Constructs a new message instance (called before instance's __init__)."""
cls._extensions_by_name = {}
_AddInitMethod(message_descriptor, cls)
_AddMessageMethods(message_descriptor, cls)
_AddPropertiesForExtensions(message_descriptor, cls)
copy_reg.pickle(cls, la... | [
"def",
"InitMessage",
"(",
"message_descriptor",
",",
"cls",
")",
":",
"cls",
".",
"_extensions_by_name",
"=",
"{",
"}",
"_AddInitMethod",
"(",
"message_descriptor",
",",
"cls",
")",
"_AddMessageMethods",
"(",
"message_descriptor",
",",
"cls",
")",
"_AddProperties... | https://github.com/stellar-deprecated/stellard/blob/67eabb2217bdfa9a6ea317f62338fb6bca458c90/src/protobuf/python/google/protobuf/internal/cpp_message.py#L382-L388 | ||
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | third_party/markdown/extensions/admonition.py | python | AdmonitionExtension.extendMarkdown | (self, md, md_globals) | Add Admonition to Markdown instance. | Add Admonition to Markdown instance. | [
"Add",
"Admonition",
"to",
"Markdown",
"instance",
"."
] | def extendMarkdown(self, md, md_globals):
""" Add Admonition to Markdown instance. """
md.registerExtension(self)
md.parser.blockprocessors.add('admonition',
AdmonitionProcessor(md.parser),
'_begin') | [
"def",
"extendMarkdown",
"(",
"self",
",",
"md",
",",
"md_globals",
")",
":",
"md",
".",
"registerExtension",
"(",
"self",
")",
"md",
".",
"parser",
".",
"blockprocessors",
".",
"add",
"(",
"'admonition'",
",",
"AdmonitionProcessor",
"(",
"md",
".",
"parse... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/third_party/markdown/extensions/admonition.py#L86-L92 | ||
neopenx/Dragon | 0e639a7319035ddc81918bd3df059230436ee0a1 | Dragon/python/dragon/vm/caffe/misc.py | python | set_mode_cpu | () | Set to the CPU mode. [**PyCaffe Style**]
Returns
-------
None
References
----------
The implementation of `set_mode_cpu(_caffe.cpp, L51)`_. | Set to the CPU mode. [**PyCaffe Style**] | [
"Set",
"to",
"the",
"CPU",
"mode",
".",
"[",
"**",
"PyCaffe",
"Style",
"**",
"]"
] | def set_mode_cpu():
"""Set to the CPU mode. [**PyCaffe Style**]
Returns
-------
None
References
----------
The implementation of `set_mode_cpu(_caffe.cpp, L51)`_.
"""
config.EnableCPU() | [
"def",
"set_mode_cpu",
"(",
")",
":",
"config",
".",
"EnableCPU",
"(",
")"
] | https://github.com/neopenx/Dragon/blob/0e639a7319035ddc81918bd3df059230436ee0a1/Dragon/python/dragon/vm/caffe/misc.py#L20-L32 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/boto/boto/cloudsearch/optionstatus.py | python | OptionStatus.save | (self) | Write the current state of the local object back to the
CloudSearch service. | Write the current state of the local object back to the
CloudSearch service. | [
"Write",
"the",
"current",
"state",
"of",
"the",
"local",
"object",
"back",
"to",
"the",
"CloudSearch",
"service",
"."
] | def save(self):
"""
Write the current state of the local object back to the
CloudSearch service.
"""
if self.save_fn:
data = self.save_fn(self.domain.name, self.to_json())
self.refresh(data) | [
"def",
"save",
"(",
"self",
")",
":",
"if",
"self",
".",
"save_fn",
":",
"data",
"=",
"self",
".",
"save_fn",
"(",
"self",
".",
"domain",
".",
"name",
",",
"self",
".",
"to_json",
"(",
")",
")",
"self",
".",
"refresh",
"(",
"data",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/boto/boto/cloudsearch/optionstatus.py#L106-L113 | ||
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | build/android/pylib/host_driven/setup.py | python | _GetTestsFromModule | (test_module, **kwargs) | return tests | Gets a list of test objects from |test_module|.
Args:
test_module: Module from which to get the set of test methods.
kwargs: Keyword args to pass into the constructor of test cases.
Returns:
A list of test case objects each initialized for a particular test method
defined in |test_module|. | Gets a list of test objects from |test_module|. | [
"Gets",
"a",
"list",
"of",
"test",
"objects",
"from",
"|test_module|",
"."
] | def _GetTestsFromModule(test_module, **kwargs):
"""Gets a list of test objects from |test_module|.
Args:
test_module: Module from which to get the set of test methods.
kwargs: Keyword args to pass into the constructor of test cases.
Returns:
A list of test case objects each initialized for a particu... | [
"def",
"_GetTestsFromModule",
"(",
"test_module",
",",
"*",
"*",
"kwargs",
")",
":",
"tests",
"=",
"[",
"]",
"for",
"name",
"in",
"dir",
"(",
"test_module",
")",
":",
"attr",
"=",
"getattr",
"(",
"test_module",
",",
"name",
")",
"if",
"_IsTestCaseClass",... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/build/android/pylib/host_driven/setup.py#L108-L125 | |
google/earthenterprise | 0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9 | earth_enterprise/src/server/wsgi/search/common/utils.py | python | SearchUtils.NoSearchResults | (self, folder_name, style, response_type, callback=None) | return search_results | Prepares KML/JSONP output in case of no search results.
Args:
folder_name: Name of the folder which is used in folder->name
in the response.
style: Style information for KML.
response_type: Response type can be KML or JSONP, depending on the client.
callback: Call back function for ... | Prepares KML/JSONP output in case of no search results. | [
"Prepares",
"KML",
"/",
"JSONP",
"output",
"in",
"case",
"of",
"no",
"search",
"results",
"."
] | def NoSearchResults(self, folder_name, style, response_type, callback=None):
"""Prepares KML/JSONP output in case of no search results.
Args:
folder_name: Name of the folder which is used in folder->name
in the response.
style: Style information for KML.
response_type: Response type c... | [
"def",
"NoSearchResults",
"(",
"self",
",",
"folder_name",
",",
"style",
",",
"response_type",
",",
"callback",
"=",
"None",
")",
":",
"search_results",
"=",
"\"\"",
"if",
"response_type",
"==",
"\"KML\"",
":",
"search_results",
"=",
"self",
".",
"kml_template... | https://github.com/google/earthenterprise/blob/0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9/earth_enterprise/src/server/wsgi/search/common/utils.py#L170-L196 | |
Zilliqa/Zilliqa | 9c464cd6910cc4e83e84f49ea44d6bb7a7074ecc | scripts/run-clang-tidy.py | python | get_tidy_invocation | (f, clang_tidy_binary, checks, tmpdir, build_path,
header_filter, extra_arg, extra_arg_before, quiet,
config, warn_as_erro) | return start | Gets a command line for clang-tidy. | Gets a command line for clang-tidy. | [
"Gets",
"a",
"command",
"line",
"for",
"clang",
"-",
"tidy",
"."
] | def get_tidy_invocation(f, clang_tidy_binary, checks, tmpdir, build_path,
header_filter, extra_arg, extra_arg_before, quiet,
config, warn_as_erro):
"""Gets a command line for clang-tidy."""
start = [clang_tidy_binary]
if header_filter is not None:
start.append('... | [
"def",
"get_tidy_invocation",
"(",
"f",
",",
"clang_tidy_binary",
",",
"checks",
",",
"tmpdir",
",",
"build_path",
",",
"header_filter",
",",
"extra_arg",
",",
"extra_arg_before",
",",
"quiet",
",",
"config",
",",
"warn_as_erro",
")",
":",
"start",
"=",
"[",
... | https://github.com/Zilliqa/Zilliqa/blob/9c464cd6910cc4e83e84f49ea44d6bb7a7074ecc/scripts/run-clang-tidy.py#L77-L108 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/ros_comm/roslaunch/src/roslaunch/parent.py | python | ROSLaunchParent.__init__ | (self, run_id, roslaunch_files, is_core=False, port=None, local_only=False, process_listeners=None,
verbose=False, force_screen=False, is_rostest=False, roslaunch_strs=None, num_workers=NUM_WORKERS, timeout=None) | @param run_id: UUID of roslaunch session
@type run_id: str
@param roslaunch_files: list of launch configuration
files to load
@type roslaunch_files: [str]
@param is_core bool: if True, this launch is a roscore
instance. This affects the error behavior if a maste... | [] | def __init__(self, run_id, roslaunch_files, is_core=False, port=None, local_only=False, process_listeners=None,
verbose=False, force_screen=False, is_rostest=False, roslaunch_strs=None, num_workers=NUM_WORKERS, timeout=None):
"""
@param run_id: UUID of roslaunch session
@type run_id... | [
"def",
"__init__",
"(",
"self",
",",
"run_id",
",",
"roslaunch_files",
",",
"is_core",
"=",
"False",
",",
"port",
"=",
"None",
",",
"local_only",
"=",
"False",
",",
"process_listeners",
"=",
"None",
",",
"verbose",
"=",
"False",
",",
"force_screen",
"=",
... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/ros_comm/roslaunch/src/roslaunch/parent.py#L75-L128 | |||
clementine-player/Clementine | 111379dfd027802b59125829fcf87e3e1d0ad73b | dist/cpplint.py | python | CleansedLines.NumLines | (self) | return self.num_lines | Returns the number of lines represented. | Returns the number of lines represented. | [
"Returns",
"the",
"number",
"of",
"lines",
"represented",
"."
] | def NumLines(self):
"""Returns the number of lines represented."""
return self.num_lines | [
"def",
"NumLines",
"(",
"self",
")",
":",
"return",
"self",
".",
"num_lines"
] | https://github.com/clementine-player/Clementine/blob/111379dfd027802b59125829fcf87e3e1d0ad73b/dist/cpplint.py#L1305-L1307 | |
makefile/frcnn | 8d9b9ebf8be8315ba2f374d460121b0adf1df29c | python/caffe/draw.py | python | get_layer_label | (layer, rankdir) | return node_label | Define node label based on layer type.
Parameters
----------
layer : ?
rankdir : {'LR', 'TB', 'BT'}
Direction of graph layout.
Returns
-------
string :
A label for the current layer | Define node label based on layer type. | [
"Define",
"node",
"label",
"based",
"on",
"layer",
"type",
"."
] | def get_layer_label(layer, rankdir):
"""Define node label based on layer type.
Parameters
----------
layer : ?
rankdir : {'LR', 'TB', 'BT'}
Direction of graph layout.
Returns
-------
string :
A label for the current layer
"""
if rankdir in ('TB', 'BT'):
... | [
"def",
"get_layer_label",
"(",
"layer",
",",
"rankdir",
")",
":",
"if",
"rankdir",
"in",
"(",
"'TB'",
",",
"'BT'",
")",
":",
"# If graph orientation is vertical, horizontal space is free and",
"# vertical space is not; separate words with spaces",
"separator",
"=",
"' '",
... | https://github.com/makefile/frcnn/blob/8d9b9ebf8be8315ba2f374d460121b0adf1df29c/python/caffe/draw.py#L62-L114 | |
SFTtech/openage | d6a08c53c48dc1e157807471df92197f6ca9e04d | openage/convert/processor/conversion/ror/ability_subprocessor.py | python | RoRAbilitySubprocessor.game_entity_stance_ability | (line) | return ability_forward_ref | Adds the GameEntityStance ability to a line.
:param line: Unit/Building line that gets the ability.
:type line: ...dataformat.converter_object.ConverterObjectGroup
:returns: The forward reference for the ability.
:rtype: ...dataformat.forward_ref.ForwardRef | Adds the GameEntityStance ability to a line. | [
"Adds",
"the",
"GameEntityStance",
"ability",
"to",
"a",
"line",
"."
] | def game_entity_stance_ability(line):
"""
Adds the GameEntityStance ability to a line.
:param line: Unit/Building line that gets the ability.
:type line: ...dataformat.converter_object.ConverterObjectGroup
:returns: The forward reference for the ability.
:rtype: ...dataf... | [
"def",
"game_entity_stance_ability",
"(",
"line",
")",
":",
"current_unit",
"=",
"line",
".",
"get_head_unit",
"(",
")",
"current_unit_id",
"=",
"line",
".",
"get_head_unit_id",
"(",
")",
"dataset",
"=",
"line",
".",
"data",
"name_lookup_dict",
"=",
"internal_na... | https://github.com/SFTtech/openage/blob/d6a08c53c48dc1e157807471df92197f6ca9e04d/openage/convert/processor/conversion/ror/ability_subprocessor.py#L348-L432 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py3/scipy/fftpack/basic.py | python | rfft | (x, n=None, axis=-1, overwrite_x=False) | return _raw_fft(tmp,n,axis,1,overwrite_x,work_function) | Discrete Fourier transform of a real sequence.
Parameters
----------
x : array_like, real-valued
The data to transform.
n : int, optional
Defines the length of the Fourier transform. If `n` is not specified
(the default) then ``n = x.shape[axis]``. If ``n < x.shape[axis]``,
... | Discrete Fourier transform of a real sequence. | [
"Discrete",
"Fourier",
"transform",
"of",
"a",
"real",
"sequence",
"."
] | def rfft(x, n=None, axis=-1, overwrite_x=False):
"""
Discrete Fourier transform of a real sequence.
Parameters
----------
x : array_like, real-valued
The data to transform.
n : int, optional
Defines the length of the Fourier transform. If `n` is not specified
(the defau... | [
"def",
"rfft",
"(",
"x",
",",
"n",
"=",
"None",
",",
"axis",
"=",
"-",
"1",
",",
"overwrite_x",
"=",
"False",
")",
":",
"tmp",
"=",
"_asfarray",
"(",
"x",
")",
"if",
"not",
"numpy",
".",
"isrealobj",
"(",
"tmp",
")",
":",
"raise",
"TypeError",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py3/scipy/fftpack/basic.py#L374-L444 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/mailbox.py | python | Maildir.add_folder | (self, folder) | return result | Create a folder and return a Maildir instance representing it. | Create a folder and return a Maildir instance representing it. | [
"Create",
"a",
"folder",
"and",
"return",
"a",
"Maildir",
"instance",
"representing",
"it",
"."
] | def add_folder(self, folder):
"""Create a folder and return a Maildir instance representing it."""
path = os.path.join(self._path, '.' + folder)
result = Maildir(path, factory=self._factory)
maildirfolder_path = os.path.join(path, 'maildirfolder')
if not os.path.exists(maildirfol... | [
"def",
"add_folder",
"(",
"self",
",",
"folder",
")",
":",
"path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"_path",
",",
"'.'",
"+",
"folder",
")",
"result",
"=",
"Maildir",
"(",
"path",
",",
"factory",
"=",
"self",
".",
"_factory",
... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/mailbox.py#L428-L436 | |
panda3d/panda3d | 833ad89ebad58395d0af0b7ec08538e5e4308265 | direct/src/fsm/FSM.py | python | FSM.demand | (self, request, *args) | Requests a state transition, by code that does not expect
the request to be denied. If the request is denied, raises a
`RequestDenied` exception.
Unlike `request()`, this method allows a new request to be made
while the FSM is currently in transition. In this case, the
request... | Requests a state transition, by code that does not expect
the request to be denied. If the request is denied, raises a
`RequestDenied` exception. | [
"Requests",
"a",
"state",
"transition",
"by",
"code",
"that",
"does",
"not",
"expect",
"the",
"request",
"to",
"be",
"denied",
".",
"If",
"the",
"request",
"is",
"denied",
"raises",
"a",
"RequestDenied",
"exception",
"."
] | def demand(self, request, *args):
"""Requests a state transition, by code that does not expect
the request to be denied. If the request is denied, raises a
`RequestDenied` exception.
Unlike `request()`, this method allows a new request to be made
while the FSM is currently in t... | [
"def",
"demand",
"(",
"self",
",",
"request",
",",
"*",
"args",
")",
":",
"self",
".",
"fsmLock",
".",
"acquire",
"(",
")",
"try",
":",
"assert",
"isinstance",
"(",
"request",
",",
"str",
")",
"self",
".",
"notify",
".",
"debug",
"(",
"\"%s.demand(%s... | https://github.com/panda3d/panda3d/blob/833ad89ebad58395d0af0b7ec08538e5e4308265/direct/src/fsm/FSM.py#L294-L327 | ||
koth/kcws | 88efbd36a7022de4e6e90f5a1fb880cf87cfae9f | third_party/python/cpplint/cpplint.py | python | _VerboseLevel | () | return _cpplint_state.verbose_level | Returns the module's verbosity setting. | Returns the module's verbosity setting. | [
"Returns",
"the",
"module",
"s",
"verbosity",
"setting",
"."
] | def _VerboseLevel():
"""Returns the module's verbosity setting."""
return _cpplint_state.verbose_level | [
"def",
"_VerboseLevel",
"(",
")",
":",
"return",
"_cpplint_state",
".",
"verbose_level"
] | https://github.com/koth/kcws/blob/88efbd36a7022de4e6e90f5a1fb880cf87cfae9f/third_party/python/cpplint/cpplint.py#L862-L864 | |
cms-sw/cmssw | fd9de012d503d3405420bcbeec0ec879baa57cf2 | Alignment/OfflineValidation/python/TkAlAllInOneTool/overlapValidation.py | python | OverlapValidation.appendToPlots | (self) | return '("{file}", "{title}", {color}, {style}),'.format(file=self.getCompareStrings(plain=True)["DEFAULT"], **self.getRepMap()) | if no argument or "" is passed a string with an instantiation is
returned, else the validation is appended to the list | if no argument or "" is passed a string with an instantiation is
returned, else the validation is appended to the list | [
"if",
"no",
"argument",
"or",
"is",
"passed",
"a",
"string",
"with",
"an",
"instantiation",
"is",
"returned",
"else",
"the",
"validation",
"is",
"appended",
"to",
"the",
"list"
] | def appendToPlots(self):
"""
if no argument or "" is passed a string with an instantiation is
returned, else the validation is appended to the list
"""
return '("{file}", "{title}", {color}, {style}),'.format(file=self.getCompareStrings(plain=True)["DEFAULT"], **self.getRepMap()) | [
"def",
"appendToPlots",
"(",
"self",
")",
":",
"return",
"'(\"{file}\", \"{title}\", {color}, {style}),'",
".",
"format",
"(",
"file",
"=",
"self",
".",
"getCompareStrings",
"(",
"plain",
"=",
"True",
")",
"[",
"\"DEFAULT\"",
"]",
",",
"*",
"*",
"self",
".",
... | https://github.com/cms-sw/cmssw/blob/fd9de012d503d3405420bcbeec0ec879baa57cf2/Alignment/OfflineValidation/python/TkAlAllInOneTool/overlapValidation.py#L41-L46 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_core.py | python | Menu.InsertMenu | (*args, **kwargs) | return _core_.Menu_InsertMenu(*args, **kwargs) | InsertMenu(self, size_t pos, int id, String text, Menu submenu, String help=EmptyString) -> MenuItem | InsertMenu(self, size_t pos, int id, String text, Menu submenu, String help=EmptyString) -> MenuItem | [
"InsertMenu",
"(",
"self",
"size_t",
"pos",
"int",
"id",
"String",
"text",
"Menu",
"submenu",
"String",
"help",
"=",
"EmptyString",
")",
"-",
">",
"MenuItem"
] | def InsertMenu(*args, **kwargs):
"""InsertMenu(self, size_t pos, int id, String text, Menu submenu, String help=EmptyString) -> MenuItem"""
return _core_.Menu_InsertMenu(*args, **kwargs) | [
"def",
"InsertMenu",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"Menu_InsertMenu",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_core.py#L12068-L12070 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/keras/layers/local.py | python | get_locallyconnected_mask | (input_shape, kernel_shape, strides, padding,
data_format) | return mask | Return a mask representing connectivity of a locally-connected operation.
This method returns a masking numpy array of 0s and 1s (of type `np.float32`)
that, when element-wise multiplied with a fully-connected weight tensor, masks
out the weights between disconnected input-output pairs and thus implements
loca... | Return a mask representing connectivity of a locally-connected operation. | [
"Return",
"a",
"mask",
"representing",
"connectivity",
"of",
"a",
"locally",
"-",
"connected",
"operation",
"."
] | def get_locallyconnected_mask(input_shape, kernel_shape, strides, padding,
data_format):
"""Return a mask representing connectivity of a locally-connected operation.
This method returns a masking numpy array of 0s and 1s (of type `np.float32`)
that, when element-wise multiplied with... | [
"def",
"get_locallyconnected_mask",
"(",
"input_shape",
",",
"kernel_shape",
",",
"strides",
",",
"padding",
",",
"data_format",
")",
":",
"mask",
"=",
"conv_utils",
".",
"conv_kernel_mask",
"(",
"input_shape",
"=",
"input_shape",
",",
"kernel_shape",
"=",
"kernel... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/keras/layers/local.py#L643-L702 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/telemetry/telemetry/internal/browser/web_contents.py | python | WebContents.HasReachedQuiescence | (self) | return has_reached_quiescence | Determine whether the page has reached quiescence after loading.
Returns:
True if 2 seconds have passed since last resource received, false
otherwise.
Raises:
exceptions.Error: See EvaluateJavaScript() for a detailed list of
possible exceptions. | Determine whether the page has reached quiescence after loading. | [
"Determine",
"whether",
"the",
"page",
"has",
"reached",
"quiescence",
"after",
"loading",
"."
] | def HasReachedQuiescence(self):
"""Determine whether the page has reached quiescence after loading.
Returns:
True if 2 seconds have passed since last resource received, false
otherwise.
Raises:
exceptions.Error: See EvaluateJavaScript() for a detailed list of
possible exceptions.
... | [
"def",
"HasReachedQuiescence",
"(",
"self",
")",
":",
"# Inclusion of the script that provides",
"# window.__telemetry_testHasReachedNetworkQuiescence()",
"# is idempotent, it's run on every call because WebContents doesn't track",
"# page loads and we need to execute anew for every newly loaded p... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/telemetry/internal/browser/web_contents.py#L138-L156 | |
deepmind/open_spiel | 4ca53bea32bb2875c7385d215424048ae92f78c8 | open_spiel/python/pytorch/losses/rl_losses.py | python | BatchQPGLoss.loss | (self, policy_logits, action_values) | return total_loss | Constructs a PyTorch Crierion that computes the QPG loss for batches.
Args:
policy_logits: `B x A` tensor corresponding to policy logits.
action_values: `B x A` tensor corresponding to Q-values.
Returns:
loss: A 0-D `float` tensor corresponding the loss. | Constructs a PyTorch Crierion that computes the QPG loss for batches. | [
"Constructs",
"a",
"PyTorch",
"Crierion",
"that",
"computes",
"the",
"QPG",
"loss",
"for",
"batches",
"."
] | def loss(self, policy_logits, action_values):
"""Constructs a PyTorch Crierion that computes the QPG loss for batches.
Args:
policy_logits: `B x A` tensor corresponding to policy logits.
action_values: `B x A` tensor corresponding to Q-values.
Returns:
loss: A 0-D `float` tensor correspo... | [
"def",
"loss",
"(",
"self",
",",
"policy_logits",
",",
"action_values",
")",
":",
"_assert_rank_and_shape_compatibility",
"(",
"[",
"policy_logits",
",",
"action_values",
"]",
",",
"2",
")",
"advantages",
"=",
"compute_advantages",
"(",
"policy_logits",
",",
"acti... | https://github.com/deepmind/open_spiel/blob/4ca53bea32bb2875c7385d215424048ae92f78c8/open_spiel/python/pytorch/losses/rl_losses.py#L109-L130 | |
opengauss-mirror/openGauss-server | e383f1b77720a00ddbe4c0655bc85914d9b02a2b | src/gausskernel/dbmind/tools/predictor/python/run.py | python | configure_training | () | API for configuring model, needs to be called before prediction or train
CURL format:
curl -X POST -d '{"max_epoch":"200", "learning_rate":"0.01", "hidden_units":"60", "batch_size": "1000",
"dim_red": "0.7","model_name":"rlstm"}' -H 'Content-Type: application/json' 'https://127.0.0.1:5000/configure'... | API for configuring model, needs to be called before prediction or train
CURL format:
curl -X POST -d '{"max_epoch":"200", "learning_rate":"0.01", "hidden_units":"60", "batch_size": "1000",
"dim_red": "0.7","model_name":"rlstm"}' -H 'Content-Type: application/json' 'https://127.0.0.1:5000/configure'... | [
"API",
"for",
"configuring",
"model",
"needs",
"to",
"be",
"called",
"before",
"prediction",
"or",
"train",
"CURL",
"format",
":",
"curl",
"-",
"X",
"POST",
"-",
"d",
"{",
"max_epoch",
":",
"200",
"learning_rate",
":",
"0",
".",
"01",
"hidden_units",
":"... | def configure_training():
'''
API for configuring model, needs to be called before prediction or train
CURL format:
curl -X POST -d '{"max_epoch":"200", "learning_rate":"0.01", "hidden_units":"60", "batch_size": "1000",
"dim_red": "0.7","model_name":"rlstm"}' -H 'Content-Type: application/js... | [
"def",
"configure_training",
"(",
")",
":",
"global",
"model_config",
"global",
"req_logger",
"global",
"model_logger",
"global",
"tb_url",
"if",
"request",
".",
"method",
"==",
"'POST'",
":",
"req_logger",
".",
"info",
"(",
"request",
".",
"data",
")",
"arg_j... | https://github.com/opengauss-mirror/openGauss-server/blob/e383f1b77720a00ddbe4c0655bc85914d9b02a2b/src/gausskernel/dbmind/tools/predictor/python/run.py#L72-L105 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.