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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/setuptools/py2/pkg_resources/_vendor/pyparsing.py | python | ParserElement.__and__ | (self, other ) | return Each( [ self, other ] ) | Implementation of & operator - returns C{L{Each}} | Implementation of & operator - returns C{L{Each}} | [
"Implementation",
"of",
"&",
"operator",
"-",
"returns",
"C",
"{",
"L",
"{",
"Each",
"}}"
] | def __and__(self, other ):
"""
Implementation of & operator - returns C{L{Each}}
"""
if isinstance( other, basestring ):
other = ParserElement._literalStringClass( other )
if not isinstance( other, ParserElement ):
warnings.warn("Cannot combine element of ... | [
"def",
"__and__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"basestring",
")",
":",
"other",
"=",
"ParserElement",
".",
"_literalStringClass",
"(",
"other",
")",
"if",
"not",
"isinstance",
"(",
"other",
",",
"ParserElement... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/setuptools/py2/pkg_resources/_vendor/pyparsing.py#L1996-L2006 | |
ricardoquesada/Spidermonkey | 4a75ea2543408bd1b2c515aa95901523eeef7858 | media/webrtc/trunk/build/android/pylib/valgrind_tools.py | python | BaseTool.SetupEnvironment | (self) | Sets up the system environment for a test.
This is a good place to set system properties. | Sets up the system environment for a test. | [
"Sets",
"up",
"the",
"system",
"environment",
"for",
"a",
"test",
"."
] | def SetupEnvironment(self):
"""Sets up the system environment for a test.
This is a good place to set system properties.
"""
pass | [
"def",
"SetupEnvironment",
"(",
"self",
")",
":",
"pass"
] | https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/media/webrtc/trunk/build/android/pylib/valgrind_tools.py#L60-L65 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqt/mantidqt/plotting/functions.py | python | plot_md_ws_from_names | (names, errors, overplot, fig=None) | Given a list of names of 1-dimensional IMDHistoWorkspaces and plot
:param names: A list of workspaces names
:param errors: If true then error bars will be plotted on the points
:param overplot: If true then the add to the current figure if one
exists and it is a compatible figure
:... | Given a list of names of 1-dimensional IMDHistoWorkspaces and plot | [
"Given",
"a",
"list",
"of",
"names",
"of",
"1",
"-",
"dimensional",
"IMDHistoWorkspaces",
"and",
"plot"
] | def plot_md_ws_from_names(names, errors, overplot, fig=None):
"""
Given a list of names of 1-dimensional IMDHistoWorkspaces and plot
:param names: A list of workspaces names
:param errors: If true then error bars will be plotted on the points
:param overplot: If true then the add to the current fig... | [
"def",
"plot_md_ws_from_names",
"(",
"names",
",",
"errors",
",",
"overplot",
",",
"fig",
"=",
"None",
")",
":",
"# Get workspaces",
"workspaces",
"=",
"AnalysisDataService",
".",
"Instance",
"(",
")",
".",
"retrieveWorkspaces",
"(",
"names",
",",
"unrollGroups"... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqt/mantidqt/plotting/functions.py#L80-L102 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/logging/handlers.py | python | RotatingFileHandler.shouldRollover | (self, record) | return 0 | Determine if rollover should occur.
Basically, see if the supplied record would cause the file to exceed
the size limit we have. | Determine if rollover should occur. | [
"Determine",
"if",
"rollover",
"should",
"occur",
"."
] | def shouldRollover(self, record):
"""
Determine if rollover should occur.
Basically, see if the supplied record would cause the file to exceed
the size limit we have.
"""
if self.stream is None: # delay was set...
self.stream = self._open()
... | [
"def",
"shouldRollover",
"(",
"self",
",",
"record",
")",
":",
"if",
"self",
".",
"stream",
"is",
"None",
":",
"# delay was set...",
"self",
".",
"stream",
"=",
"self",
".",
"_open",
"(",
")",
"if",
"self",
".",
"maxBytes",
">",
"0",
":",
"# are we rol... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/logging/handlers.py#L175-L189 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/lib-tk/turtle.py | python | TurtleScreen.update | (self) | Perform a TurtleScreen update. | Perform a TurtleScreen update. | [
"Perform",
"a",
"TurtleScreen",
"update",
"."
] | def update(self):
"""Perform a TurtleScreen update.
"""
tracing = self._tracing
self._tracing = True
for t in self.turtles():
t._update_data()
t._drawturtle()
self._tracing = tracing
self._update() | [
"def",
"update",
"(",
"self",
")",
":",
"tracing",
"=",
"self",
".",
"_tracing",
"self",
".",
"_tracing",
"=",
"True",
"for",
"t",
"in",
"self",
".",
"turtles",
"(",
")",
":",
"t",
".",
"_update_data",
"(",
")",
"t",
".",
"_drawturtle",
"(",
")",
... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/lib-tk/turtle.py#L1244-L1253 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/ops/gradients_impl.py | python | _StopOps | (from_ops, pending_count) | return stop_ops | The set of ops that terminate the gradient computation.
This computes the frontier of the forward graph *before* which backprop
should stop. Operations in the returned set will not be differentiated.
This set is defined as the subset of `from_ops` containing ops that have
no predecessor in `from_ops`. `pending... | The set of ops that terminate the gradient computation. | [
"The",
"set",
"of",
"ops",
"that",
"terminate",
"the",
"gradient",
"computation",
"."
] | def _StopOps(from_ops, pending_count):
"""The set of ops that terminate the gradient computation.
This computes the frontier of the forward graph *before* which backprop
should stop. Operations in the returned set will not be differentiated.
This set is defined as the subset of `from_ops` containing ops that h... | [
"def",
"_StopOps",
"(",
"from_ops",
",",
"pending_count",
")",
":",
"stop_ops",
"=",
"set",
"(",
")",
"for",
"op",
"in",
"from_ops",
":",
"is_stop_op",
"=",
"True",
"for",
"inp",
"in",
"op",
".",
"inputs",
":",
"if",
"pending_count",
"[",
"inp",
".",
... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/ops/gradients_impl.py#L280-L306 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/zipfile.py | python | _EndRecData64 | (fpin, offset, endrec) | return endrec | Read the ZIP64 end-of-archive records and use that to update endrec | Read the ZIP64 end-of-archive records and use that to update endrec | [
"Read",
"the",
"ZIP64",
"end",
"-",
"of",
"-",
"archive",
"records",
"and",
"use",
"that",
"to",
"update",
"endrec"
] | def _EndRecData64(fpin, offset, endrec):
"""
Read the ZIP64 end-of-archive records and use that to update endrec
"""
try:
fpin.seek(offset - sizeEndCentDir64Locator, 2)
except IOError:
# If the seek fails, the file is not large enough to contain a ZIP64
# end-of-archive recor... | [
"def",
"_EndRecData64",
"(",
"fpin",
",",
"offset",
",",
"endrec",
")",
":",
"try",
":",
"fpin",
".",
"seek",
"(",
"offset",
"-",
"sizeEndCentDir64Locator",
",",
"2",
")",
"except",
"IOError",
":",
"# If the seek fails, the file is not large enough to contain a ZIP6... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/zipfile.py#L158-L198 | |
QMCPACK/qmcpack | d0948ab455e38364458740cc8e2239600a14c5cd | utils/afqmctools/afqmctools/wavefunction/mol.py | python | gen_multi_det_wavefunction | (mc, weight_cutoff=0.95, verbose=False,
max_ndets=1e5, norb=None,
filename=None) | return coeffs, [occups,occdns] | Generate multi determinant particle-hole trial wavefunction.
Format adopted to be compatable with QMCPACK PHMSD type wavefunction.
Parameters
----------
mc : pyscf CI solver type object
Input object containing multi determinant coefficients.
weight_cutoff : float, optional
Print de... | Generate multi determinant particle-hole trial wavefunction. | [
"Generate",
"multi",
"determinant",
"particle",
"-",
"hole",
"trial",
"wavefunction",
"."
] | def gen_multi_det_wavefunction(mc, weight_cutoff=0.95, verbose=False,
max_ndets=1e5, norb=None,
filename=None):
"""Generate multi determinant particle-hole trial wavefunction.
Format adopted to be compatable with QMCPACK PHMSD type wavefunction.
... | [
"def",
"gen_multi_det_wavefunction",
"(",
"mc",
",",
"weight_cutoff",
"=",
"0.95",
",",
"verbose",
"=",
"False",
",",
"max_ndets",
"=",
"1e5",
",",
"norb",
"=",
"None",
",",
"filename",
"=",
"None",
")",
":",
"occlists",
"=",
"fci",
".",
"cistring",
".",... | https://github.com/QMCPACK/qmcpack/blob/d0948ab455e38364458740cc8e2239600a14c5cd/utils/afqmctools/afqmctools/wavefunction/mol.py#L247-L311 | |
baidu/bigflow | 449245016c0df7d1252e85581e588bfc60cefad3 | bigflow_python/python/bigflow/ptype.py | python | PType.cache | (self) | Persist this PType on storage. | Persist this PType on storage. | [
"Persist",
"this",
"PType",
"on",
"storage",
"."
] | def cache(self):
"""
Persist this PType on storage.
"""
self._node.cache()
self._pipeline.add_cache_id(self._node.id()) | [
"def",
"cache",
"(",
"self",
")",
":",
"self",
".",
"_node",
".",
"cache",
"(",
")",
"self",
".",
"_pipeline",
".",
"add_cache_id",
"(",
"self",
".",
"_node",
".",
"id",
"(",
")",
")"
] | https://github.com/baidu/bigflow/blob/449245016c0df7d1252e85581e588bfc60cefad3/bigflow_python/python/bigflow/ptype.py#L73-L78 | ||
tpfister/caffe-heatmap | 4db69ef53e6b8a0b3b4ebb29328b0ab3dbf67c4e | scripts/cpp_lint.py | python | FindStartOfExpressionInLine | (line, endpos, depth, startchar, endchar) | return (-1, depth) | Find position at the matching startchar.
This is almost the reverse of FindEndOfExpressionInLine, but note
that the input position and returned position differs by 1.
Args:
line: a CleansedLines line.
endpos: start searching at this position.
depth: nesting level at endpos.
startchar: expression... | Find position at the matching startchar. | [
"Find",
"position",
"at",
"the",
"matching",
"startchar",
"."
] | def FindStartOfExpressionInLine(line, endpos, depth, startchar, endchar):
"""Find position at the matching startchar.
This is almost the reverse of FindEndOfExpressionInLine, but note
that the input position and returned position differs by 1.
Args:
line: a CleansedLines line.
endpos: start searching ... | [
"def",
"FindStartOfExpressionInLine",
"(",
"line",
",",
"endpos",
",",
"depth",
",",
"startchar",
",",
"endchar",
")",
":",
"for",
"i",
"in",
"xrange",
"(",
"endpos",
",",
"-",
"1",
",",
"-",
"1",
")",
":",
"if",
"line",
"[",
"i",
"]",
"==",
"endch... | https://github.com/tpfister/caffe-heatmap/blob/4db69ef53e6b8a0b3b4ebb29328b0ab3dbf67c4e/scripts/cpp_lint.py#L1300-L1324 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | scripts/reducer_singleton.py | python | Reducer.post_process | (self) | Reduction steps to be executed after all data files have been
processed. | Reduction steps to be executed after all data files have been
processed. | [
"Reduction",
"steps",
"to",
"be",
"executed",
"after",
"all",
"data",
"files",
"have",
"been",
"processed",
"."
] | def post_process(self):
"""
Reduction steps to be executed after all data files have been
processed.
"""
pass | [
"def",
"post_process",
"(",
"self",
")",
":",
"pass"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/reducer_singleton.py#L118-L123 | ||
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/urlparse.py | python | clear_cache | () | Clear the parse cache. | Clear the parse cache. | [
"Clear",
"the",
"parse",
"cache",
"."
] | def clear_cache():
"""Clear the parse cache."""
_parse_cache.clear() | [
"def",
"clear_cache",
"(",
")",
":",
"_parse_cache",
".",
"clear",
"(",
")"
] | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/urlparse.py#L38-L40 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/html.py | python | HtmlLinkInfo.GetHtmlCell | (*args, **kwargs) | return _html.HtmlLinkInfo_GetHtmlCell(*args, **kwargs) | GetHtmlCell(self) -> HtmlCell | GetHtmlCell(self) -> HtmlCell | [
"GetHtmlCell",
"(",
"self",
")",
"-",
">",
"HtmlCell"
] | def GetHtmlCell(*args, **kwargs):
"""GetHtmlCell(self) -> HtmlCell"""
return _html.HtmlLinkInfo_GetHtmlCell(*args, **kwargs) | [
"def",
"GetHtmlCell",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_html",
".",
"HtmlLinkInfo_GetHtmlCell",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/html.py#L114-L116 | |
y123456yz/reading-and-annotate-mongodb-3.6 | 93280293672ca7586dc24af18132aa61e4ed7fcf | mongo/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Builder.py | python | BuilderBase.get_name | (self, env) | Attempts to get the name of the Builder.
Look at the BUILDERS variable of env, expecting it to be a
dictionary containing this Builder, and return the key of the
dictionary. If there's no key, then return a directly-configured
name (if there is one) or the name of the class (by default... | Attempts to get the name of the Builder. | [
"Attempts",
"to",
"get",
"the",
"name",
"of",
"the",
"Builder",
"."
] | def get_name(self, env):
"""Attempts to get the name of the Builder.
Look at the BUILDERS variable of env, expecting it to be a
dictionary containing this Builder, and return the key of the
dictionary. If there's no key, then return a directly-configured
name (if there is one) ... | [
"def",
"get_name",
"(",
"self",
",",
"env",
")",
":",
"try",
":",
"index",
"=",
"list",
"(",
"env",
"[",
"'BUILDERS'",
"]",
".",
"values",
"(",
")",
")",
".",
"index",
"(",
"self",
")",
"return",
"list",
"(",
"env",
"[",
"'BUILDERS'",
"]",
".",
... | 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/Builder.py#L426-L441 | ||
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/robotsim.py | python | TriangleMesh.getIndices | (self) | return _robotsim.TriangleMesh_getIndices(self) | r"""
Retrieves a view of the vertices as an mx3 Numpy array. | r"""
Retrieves a view of the vertices as an mx3 Numpy array. | [
"r",
"Retrieves",
"a",
"view",
"of",
"the",
"vertices",
"as",
"an",
"mx3",
"Numpy",
"array",
"."
] | def getIndices(self) ->None:
r"""
Retrieves a view of the vertices as an mx3 Numpy array.
"""
return _robotsim.TriangleMesh_getIndices(self) | [
"def",
"getIndices",
"(",
"self",
")",
"->",
"None",
":",
"return",
"_robotsim",
".",
"TriangleMesh_getIndices",
"(",
"self",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/robotsim.py#L920-L925 | |
projectchrono/chrono | 92015a8a6f84ef63ac8206a74e54a676251dcc89 | src/demos/python/chrono-tensorflow/PPO/train_parallel.py | python | build_train_set | (trajectories) | return observes, actions, advantages, disc_sum_rew | Args:
trajectories: trajectories after processing by add_disc_sum_rew(),
add_value(), and add_gae()
Returns: 4-tuple of NumPy arrays
observes: shape = (N, obs_dim)
actions: shape = (N, act_dim)
advantages: shape = (N,)
disc_sum_rew: shape = (N,) | [] | def build_train_set(trajectories):
"""
Args:
trajectories: trajectories after processing by add_disc_sum_rew(),
add_value(), and add_gae()
Returns: 4-tuple of NumPy arrays
observes: shape = (N, obs_dim)
actions: shape = (N, act_dim)
advantages: shape = (N,)
... | [
"def",
"build_train_set",
"(",
"trajectories",
")",
":",
"observes",
"=",
"np",
".",
"concatenate",
"(",
"[",
"t",
"[",
"'observes'",
"]",
"for",
"t",
"in",
"trajectories",
"]",
")",
"actions",
"=",
"np",
".",
"concatenate",
"(",
"[",
"t",
"[",
"'actio... | https://github.com/projectchrono/chrono/blob/92015a8a6f84ef63ac8206a74e54a676251dcc89/src/demos/python/chrono-tensorflow/PPO/train_parallel.py#L161-L181 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/contrib/cudnn_rnn/python/ops/cudnn_rnn_ops.py | python | _CudnnRNN.params_to_canonical | (self, params) | return cudnn_rnn_opaque_params_to_canonical(
rnn_mode=self._rnn_mode,
num_layers=self._num_layers,
num_units=self._num_units,
input_size=self._input_size,
params=params,
input_mode=self._input_mode,
direction=self._direction,
dropout=self._dropout,
... | Converts params from a specific format of cuDNN to the canonical format.
Args:
params: a Variable for weight and bias parameters.
Returns:
A function for the specific-to-canonical conversion. | Converts params from a specific format of cuDNN to the canonical format. | [
"Converts",
"params",
"from",
"a",
"specific",
"format",
"of",
"cuDNN",
"to",
"the",
"canonical",
"format",
"."
] | def params_to_canonical(self, params):
"""Converts params from a specific format of cuDNN to the canonical format.
Args:
params: a Variable for weight and bias parameters.
Returns:
A function for the specific-to-canonical conversion.
"""
return cudnn_rnn_opaque_params_to_canonical(
... | [
"def",
"params_to_canonical",
"(",
"self",
",",
"params",
")",
":",
"return",
"cudnn_rnn_opaque_params_to_canonical",
"(",
"rnn_mode",
"=",
"self",
".",
"_rnn_mode",
",",
"num_layers",
"=",
"self",
".",
"_num_layers",
",",
"num_units",
"=",
"self",
".",
"_num_un... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/cudnn_rnn/python/ops/cudnn_rnn_ops.py#L1336-L1354 | |
cms-sw/cmssw | fd9de012d503d3405420bcbeec0ec879baa57cf2 | PhysicsTools/Heppy/python/physicsobjects/Tau.py | python | Tau.zImpact | (self, vertex=None) | return vertex.z() + 130./math.tan(self.theta()) | z impact at ECAL surface | z impact at ECAL surface | [
"z",
"impact",
"at",
"ECAL",
"surface"
] | def zImpact(self, vertex=None):
'''z impact at ECAL surface'''
if vertex is None:
vertex = self.associatedVertex
return vertex.z() + 130./math.tan(self.theta()) | [
"def",
"zImpact",
"(",
"self",
",",
"vertex",
"=",
"None",
")",
":",
"if",
"vertex",
"is",
"None",
":",
"vertex",
"=",
"self",
".",
"associatedVertex",
"return",
"vertex",
".",
"z",
"(",
")",
"+",
"130.",
"/",
"math",
".",
"tan",
"(",
"self",
".",
... | https://github.com/cms-sw/cmssw/blob/fd9de012d503d3405420bcbeec0ec879baa57cf2/PhysicsTools/Heppy/python/physicsobjects/Tau.py#L59-L63 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow2.x/tensorflow_model_optimization/python/core/quantization/keras/vitis/common/vitis_quantize_registry.py | python | VitisQuantizeRegistry.supports | (self, layer) | return False | Returns whether the registry supports this layer type.
Args:
layer: The layer to check for support.
Returns:
True/False whether the layer type is supported. | Returns whether the registry supports this layer type. | [
"Returns",
"whether",
"the",
"registry",
"supports",
"this",
"layer",
"type",
"."
] | def supports(self, layer):
"""Returns whether the registry supports this layer type.
Args:
layer: The layer to check for support.
Returns:
True/False whether the layer type is supported.
"""
if self._is_supported_layer(layer.__class__):
return True
return False | [
"def",
"supports",
"(",
"self",
",",
"layer",
")",
":",
"if",
"self",
".",
"_is_supported_layer",
"(",
"layer",
".",
"__class__",
")",
":",
"return",
"True",
"return",
"False"
] | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow2.x/tensorflow_model_optimization/python/core/quantization/keras/vitis/common/vitis_quantize_registry.py#L173-L186 | |
yuxng/DA-RNN | 77fbb50b4272514588a10a9f90b7d5f8d46974fb | lib/gt_single_data_layer/minibatch.py | python | get_minibatch | (roidb, voxelizer) | return blobs | Given a roidb, construct a minibatch sampled from it. | Given a roidb, construct a minibatch sampled from it. | [
"Given",
"a",
"roidb",
"construct",
"a",
"minibatch",
"sampled",
"from",
"it",
"."
] | def get_minibatch(roidb, voxelizer):
"""Given a roidb, construct a minibatch sampled from it."""
num_images = len(roidb)
# Get the input image blob, formatted for tensorflow
random_scale_ind = npr.randint(0, high=len(cfg.TRAIN.SCALES_BASE))
im_blob, im_depth_blob, im_normal_blob, im_scales = _get_i... | [
"def",
"get_minibatch",
"(",
"roidb",
",",
"voxelizer",
")",
":",
"num_images",
"=",
"len",
"(",
"roidb",
")",
"# Get the input image blob, formatted for tensorflow",
"random_scale_ind",
"=",
"npr",
".",
"randint",
"(",
"0",
",",
"high",
"=",
"len",
"(",
"cfg",
... | https://github.com/yuxng/DA-RNN/blob/77fbb50b4272514588a10a9f90b7d5f8d46974fb/lib/gt_single_data_layer/minibatch.py#L20-L46 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/smtpd.py | python | SMTPServer.process_message | (self, peer, mailfrom, rcpttos, data, **kwargs) | Override this abstract method to handle messages from the client.
peer is a tuple containing (ipaddr, port) of the client that made the
socket connection to our smtp port.
mailfrom is the raw address the client claims the message is coming
from.
rcpttos is a list of raw addres... | Override this abstract method to handle messages from the client. | [
"Override",
"this",
"abstract",
"method",
"to",
"handle",
"messages",
"from",
"the",
"client",
"."
] | def process_message(self, peer, mailfrom, rcpttos, data, **kwargs):
"""Override this abstract method to handle messages from the client.
peer is a tuple containing (ipaddr, port) of the client that made the
socket connection to our smtp port.
mailfrom is the raw address the client clai... | [
"def",
"process_message",
"(",
"self",
",",
"peer",
",",
"mailfrom",
",",
"rcpttos",
",",
"data",
",",
"*",
"*",
"kwargs",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/smtpd.py#L671-L702 | ||
facebookincubator/BOLT | 88c70afe9d388ad430cc150cc158641701397f70 | lldb/third_party/Python/module/pexpect-4.6/pexpect/ANSI.py | python | ANSI.do_modecrap | (self, fsm) | Handler for \x1b[?<number>h and \x1b[?<number>l. If anyone
wanted to actually use these, they'd need to add more states to the
FSM rather than just improve or override this method. | Handler for \x1b[?<number>h and \x1b[?<number>l. If anyone
wanted to actually use these, they'd need to add more states to the
FSM rather than just improve or override this method. | [
"Handler",
"for",
"\\",
"x1b",
"[",
"?<number",
">",
"h",
"and",
"\\",
"x1b",
"[",
"?<number",
">",
"l",
".",
"If",
"anyone",
"wanted",
"to",
"actually",
"use",
"these",
"they",
"d",
"need",
"to",
"add",
"more",
"states",
"to",
"the",
"FSM",
"rather"... | def do_modecrap (self, fsm):
'''Handler for \x1b[?<number>h and \x1b[?<number>l. If anyone
wanted to actually use these, they'd need to add more states to the
FSM rather than just improve or override this method. '''
screen = fsm.memory[0]
fsm.memory = [screen] | [
"def",
"do_modecrap",
"(",
"self",
",",
"fsm",
")",
":",
"screen",
"=",
"fsm",
".",
"memory",
"[",
"0",
"]",
"fsm",
".",
"memory",
"=",
"[",
"screen",
"]"
] | https://github.com/facebookincubator/BOLT/blob/88c70afe9d388ad430cc150cc158641701397f70/lldb/third_party/Python/module/pexpect-4.6/pexpect/ANSI.py#L346-L351 | ||
fatih/subvim | 241b6d170597857105da219c9b7d36059e9f11fb | vim/base/YouCompleteMe/third_party/jedi/jedi/parser/representation.py | python | SubModule.__init__ | (self, path, start_pos=(1, 0), top_module=None) | Initialize :class:`SubModule`.
:type path: str
:arg path: File path to this module.
.. todo:: Document `top_module`. | Initialize :class:`SubModule`. | [
"Initialize",
":",
"class",
":",
"SubModule",
"."
] | def __init__(self, path, start_pos=(1, 0), top_module=None):
"""
Initialize :class:`SubModule`.
:type path: str
:arg path: File path to this module.
.. todo:: Document `top_module`.
"""
super(SubModule, self).__init__(self, start_pos)
self.path = path
... | [
"def",
"__init__",
"(",
"self",
",",
"path",
",",
"start_pos",
"=",
"(",
"1",
",",
"0",
")",
",",
"top_module",
"=",
"None",
")",
":",
"super",
"(",
"SubModule",
",",
"self",
")",
".",
"__init__",
"(",
"self",
",",
"start_pos",
")",
"self",
".",
... | https://github.com/fatih/subvim/blob/241b6d170597857105da219c9b7d36059e9f11fb/vim/base/YouCompleteMe/third_party/jedi/jedi/parser/representation.py#L322-L340 | ||
KratosMultiphysics/Kratos | 0000833054ed0503424eb28205d6508d9ca6cbbc | applications/HDF5Application/python_scripts/core/xdmf.py | python | Grid.add_attribute | (self, attr) | Add an XDMF Attribute to the grid.
This allows results data to be appended to the current mesh. | Add an XDMF Attribute to the grid. | [
"Add",
"an",
"XDMF",
"Attribute",
"to",
"the",
"grid",
"."
] | def add_attribute(self, attr):
"""Add an XDMF Attribute to the grid.
This allows results data to be appended to the current mesh.
"""
pass | [
"def",
"add_attribute",
"(",
"self",
",",
"attr",
")",
":",
"pass"
] | https://github.com/KratosMultiphysics/Kratos/blob/0000833054ed0503424eb28205d6508d9ca6cbbc/applications/HDF5Application/python_scripts/core/xdmf.py#L156-L161 | ||
SFTtech/openage | d6a08c53c48dc1e157807471df92197f6ca9e04d | openage/convert/processor/conversion/swgbcc/nyan_subprocessor.py | python | SWGBCCNyanSubprocessor.tech_group_to_tech | (tech_group) | Creates raw API objects for a tech group.
:param tech_group: Tech group that gets converted to a tech.
:type tech_group: ..dataformat.converter_object.ConverterObjectGroup | Creates raw API objects for a tech group. | [
"Creates",
"raw",
"API",
"objects",
"for",
"a",
"tech",
"group",
"."
] | def tech_group_to_tech(tech_group):
"""
Creates raw API objects for a tech group.
:param tech_group: Tech group that gets converted to a tech.
:type tech_group: ..dataformat.converter_object.ConverterObjectGroup
"""
tech_id = tech_group.get_id()
# Skip Tech Leve... | [
"def",
"tech_group_to_tech",
"(",
"tech_group",
")",
":",
"tech_id",
"=",
"tech_group",
".",
"get_id",
"(",
")",
"# Skip Tech Level 0 tech",
"if",
"tech_id",
"==",
"0",
":",
"return",
"dataset",
"=",
"tech_group",
".",
"data",
"name_lookup_dict",
"=",
"internal_... | https://github.com/SFTtech/openage/blob/d6a08c53c48dc1e157807471df92197f6ca9e04d/openage/convert/processor/conversion/swgbcc/nyan_subprocessor.py#L608-L721 | ||
NVIDIA/DALI | bf16cc86ba8f091b145f91962f21fe1b6aff243d | dali/python/nvidia/dali/types.py | python | CUDAStream.ptr | (self) | return self._ptr | Raw CUDA stream pointer, stored as uint64. | Raw CUDA stream pointer, stored as uint64. | [
"Raw",
"CUDA",
"stream",
"pointer",
"stored",
"as",
"uint64",
"."
] | def ptr(self):
"""Raw CUDA stream pointer, stored as uint64."""
return self._ptr | [
"def",
"ptr",
"(",
"self",
")",
":",
"return",
"self",
".",
"_ptr"
] | https://github.com/NVIDIA/DALI/blob/bf16cc86ba8f091b145f91962f21fe1b6aff243d/dali/python/nvidia/dali/types.py#L153-L155 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/platebtn.py | python | PlateButton.SetWindowVariant | (self, variant) | Set the variant/font size of this control | Set the variant/font size of this control | [
"Set",
"the",
"variant",
"/",
"font",
"size",
"of",
"this",
"control"
] | def SetWindowVariant(self, variant):
"""Set the variant/font size of this control"""
super(PlateButton, self).SetWindowVariant(variant)
self.InvalidateBestSize() | [
"def",
"SetWindowVariant",
"(",
"self",
",",
"variant",
")",
":",
"super",
"(",
"PlateButton",
",",
"self",
")",
".",
"SetWindowVariant",
"(",
"variant",
")",
"self",
".",
"InvalidateBestSize",
"(",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/platebtn.py#L736-L739 | ||
SpenceKonde/megaTinyCore | 1c4a70b18a149fe6bcb551dfa6db11ca50b8997b | megaavr/tools/libs/serial/rfc2217.py | python | Serial.rfc2217_send_subnegotiation | (self, option, value=b'') | Subnegotiation of RFC2217 parameters. | Subnegotiation of RFC2217 parameters. | [
"Subnegotiation",
"of",
"RFC2217",
"parameters",
"."
] | def rfc2217_send_subnegotiation(self, option, value=b''):
"""Subnegotiation of RFC2217 parameters."""
value = value.replace(IAC, IAC_DOUBLED)
self._internal_raw_write(IAC + SB + COM_PORT_OPTION + option + value + IAC + SE) | [
"def",
"rfc2217_send_subnegotiation",
"(",
"self",
",",
"option",
",",
"value",
"=",
"b''",
")",
":",
"value",
"=",
"value",
".",
"replace",
"(",
"IAC",
",",
"IAC_DOUBLED",
")",
"self",
".",
"_internal_raw_write",
"(",
"IAC",
"+",
"SB",
"+",
"COM_PORT_OPTI... | https://github.com/SpenceKonde/megaTinyCore/blob/1c4a70b18a149fe6bcb551dfa6db11ca50b8997b/megaavr/tools/libs/serial/rfc2217.py#L859-L862 | ||
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/decimal.py | python | Context._shallow_copy | (self) | return nc | Returns a shallow copy from self. | Returns a shallow copy from self. | [
"Returns",
"a",
"shallow",
"copy",
"from",
"self",
"."
] | def _shallow_copy(self):
"""Returns a shallow copy from self."""
nc = Context(self.prec, self.rounding, self.traps,
self.flags, self.Emin, self.Emax,
self.capitals, self._clamp, self._ignored_flags)
return nc | [
"def",
"_shallow_copy",
"(",
"self",
")",
":",
"nc",
"=",
"Context",
"(",
"self",
".",
"prec",
",",
"self",
".",
"rounding",
",",
"self",
".",
"traps",
",",
"self",
".",
"flags",
",",
"self",
".",
"Emin",
",",
"self",
".",
"Emax",
",",
"self",
".... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/decimal.py#L3837-L3842 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/telemetry/telemetry/internal/browser/tab.py | python | Tab.Highlight | (self, color) | Synchronously highlights entire tab contents with the given RgbaColor.
TODO(tonyg): It is possible that the z-index hack here might not work for
all pages. If this happens, DevTools also provides a method for this.
Raises:
exceptions.EvaluateException
exceptions.WebSocketDisconnected
exc... | Synchronously highlights entire tab contents with the given RgbaColor. | [
"Synchronously",
"highlights",
"entire",
"tab",
"contents",
"with",
"the",
"given",
"RgbaColor",
"."
] | def Highlight(self, color):
"""Synchronously highlights entire tab contents with the given RgbaColor.
TODO(tonyg): It is possible that the z-index hack here might not work for
all pages. If this happens, DevTools also provides a method for this.
Raises:
exceptions.EvaluateException
excepti... | [
"def",
"Highlight",
"(",
"self",
",",
"color",
")",
":",
"self",
".",
"ExecuteJavaScript",
"(",
"\"\"\"\n (function() {\n var screen = document.createElement('div');\n screen.style.background = 'rgba(%d, %d, %d, %d)';\n screen.style.position = 'fixed';\n scre... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/telemetry/internal/browser/tab.py#L124-L155 | ||
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/tools/gyp/pylib/gyp/MSVSUtil.py | python | _GetLargePdbShimCcPath | () | return large_pdb_shim_cc | Returns the path of the large_pdb_shim.cc file. | Returns the path of the large_pdb_shim.cc file. | [
"Returns",
"the",
"path",
"of",
"the",
"large_pdb_shim",
".",
"cc",
"file",
"."
] | def _GetLargePdbShimCcPath():
"""Returns the path of the large_pdb_shim.cc file."""
this_dir = os.path.abspath(os.path.dirname(__file__))
src_dir = os.path.abspath(os.path.join(this_dir, "..", ".."))
win_data_dir = os.path.join(src_dir, "data", "win")
large_pdb_shim_cc = os.path.join(win_data_dir, "... | [
"def",
"_GetLargePdbShimCcPath",
"(",
")",
":",
"this_dir",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"__file__",
")",
")",
"src_dir",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"path",
".",
"... | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/tools/gyp/pylib/gyp/MSVSUtil.py#L21-L27 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/idlelib/autoexpand.py | python | AutoExpand.expand_word_event | (self, event) | return "break" | Replace the current word with the next expansion. | Replace the current word with the next expansion. | [
"Replace",
"the",
"current",
"word",
"with",
"the",
"next",
"expansion",
"."
] | def expand_word_event(self, event):
"Replace the current word with the next expansion."
curinsert = self.text.index("insert")
curline = self.text.get("insert linestart", "insert lineend")
if not self.state:
words = self.getwords()
index = 0
else:
... | [
"def",
"expand_word_event",
"(",
"self",
",",
"event",
")",
":",
"curinsert",
"=",
"self",
".",
"text",
".",
"index",
"(",
"\"insert\"",
")",
"curline",
"=",
"self",
".",
"text",
".",
"get",
"(",
"\"insert linestart\"",
",",
"\"insert lineend\"",
")",
"if"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/idlelib/autoexpand.py#L27-L52 | |
yyzybb537/libgo | 4af17b7c67643c4d54aa354dcc77963ea07847d0 | third_party/boost.context/tools/build/src/build/virtual_target.py | python | VirtualTargetRegistry.recent_targets | (self) | return self.recent_targets_ | Each target returned by 'register' is added to a list of
'recent-target', returned by this function. So, this allows
us to find all targets created when building a given main
target, even if the target. | Each target returned by 'register' is added to a list of
'recent-target', returned by this function. So, this allows
us to find all targets created when building a given main
target, even if the target. | [
"Each",
"target",
"returned",
"by",
"register",
"is",
"added",
"to",
"a",
"list",
"of",
"recent",
"-",
"target",
"returned",
"by",
"this",
"function",
".",
"So",
"this",
"allows",
"us",
"to",
"find",
"all",
"targets",
"created",
"when",
"building",
"a",
... | def recent_targets(self):
"""Each target returned by 'register' is added to a list of
'recent-target', returned by this function. So, this allows
us to find all targets created when building a given main
target, even if the target."""
return self.recent_targets_ | [
"def",
"recent_targets",
"(",
"self",
")",
":",
"return",
"self",
".",
"recent_targets_"
] | https://github.com/yyzybb537/libgo/blob/4af17b7c67643c4d54aa354dcc77963ea07847d0/third_party/boost.context/tools/build/src/build/virtual_target.py#L180-L186 | |
CMU-Perceptual-Computing-Lab/caffe_rtpose | a4778bb1c3eb74d7250402016047216f77b4dba6 | python/caffe/io.py | python | Transformer.deprocess | (self, in_, data) | return decaf_in | Invert Caffe formatting; see preprocess(). | Invert Caffe formatting; see preprocess(). | [
"Invert",
"Caffe",
"formatting",
";",
"see",
"preprocess",
"()",
"."
] | def deprocess(self, in_, data):
"""
Invert Caffe formatting; see preprocess().
"""
self.__check_input(in_)
decaf_in = data.copy().squeeze()
transpose = self.transpose.get(in_)
channel_swap = self.channel_swap.get(in_)
raw_scale = self.raw_scale.get(in_)
... | [
"def",
"deprocess",
"(",
"self",
",",
"in_",
",",
"data",
")",
":",
"self",
".",
"__check_input",
"(",
"in_",
")",
"decaf_in",
"=",
"data",
".",
"copy",
"(",
")",
".",
"squeeze",
"(",
")",
"transpose",
"=",
"self",
".",
"transpose",
".",
"get",
"("... | https://github.com/CMU-Perceptual-Computing-Lab/caffe_rtpose/blob/a4778bb1c3eb74d7250402016047216f77b4dba6/python/caffe/io.py#L164-L185 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/applications/workbench/workbench/plotting/mantidfigurecanvas.py | python | MantidFigureCanvas.update_pen_color | (self) | Update the pen color used to draw tool in the matplotlib toolbar, e.g
the zoombox. The color is automatically determined
by considering how dark, or light the image is and setting a pen appropriately.
Only works if the figure contains a MantidImage. | Update the pen color used to draw tool in the matplotlib toolbar, e.g
the zoombox. The color is automatically determined
by considering how dark, or light the image is and setting a pen appropriately.
Only works if the figure contains a MantidImage. | [
"Update",
"the",
"pen",
"color",
"used",
"to",
"draw",
"tool",
"in",
"the",
"matplotlib",
"toolbar",
"e",
".",
"g",
"the",
"zoombox",
".",
"The",
"color",
"is",
"automatically",
"determined",
"by",
"considering",
"how",
"dark",
"or",
"light",
"the",
"image... | def update_pen_color(self):
"""Update the pen color used to draw tool in the matplotlib toolbar, e.g
the zoombox. The color is automatically determined
by considering how dark, or light the image is and setting a pen appropriately.
Only works if the figure contains a MantidImage.
... | [
"def",
"update_pen_color",
"(",
"self",
")",
":",
"for",
"ax",
"in",
"self",
".",
"figure",
".",
"get_axes",
"(",
")",
":",
"for",
"img",
"in",
"ax",
".",
"get_images",
"(",
")",
":",
"if",
"(",
"not",
"isinstance",
"(",
"img",
",",
"MantidImage",
... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/applications/workbench/workbench/plotting/mantidfigurecanvas.py#L62-L79 | ||
facebook/wangle | 2e7e3fbb3a15c4986d6fe0e36c31daeeba614ce3 | build/fbcode_builder/getdeps/fetcher.py | python | Fetcher.clean | (self) | Reverts any changes that might have been made to
the src dir | Reverts any changes that might have been made to
the src dir | [
"Reverts",
"any",
"changes",
"that",
"might",
"have",
"been",
"made",
"to",
"the",
"src",
"dir"
] | def clean(self):
"""Reverts any changes that might have been made to
the src dir"""
pass | [
"def",
"clean",
"(",
"self",
")",
":",
"pass"
] | https://github.com/facebook/wangle/blob/2e7e3fbb3a15c4986d6fe0e36c31daeeba614ce3/build/fbcode_builder/getdeps/fetcher.py#L113-L116 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/training/python/training/sequence_queueing_state_saver.py | python | _check_shape | (value, expected_shape) | Check the shape of Tensor `value`, via shape inference and assertions.
Args:
value: A Tensor, possibly with shape associated shape information.
expected_shape: a `TensorShape`, list of `int32`, or a vector `Tensor`.
Returns:
new_value: A Tensor matching `value`. Accessing this tensor tests
asse... | Check the shape of Tensor `value`, via shape inference and assertions. | [
"Check",
"the",
"shape",
"of",
"Tensor",
"value",
"via",
"shape",
"inference",
"and",
"assertions",
"."
] | def _check_shape(value, expected_shape):
"""Check the shape of Tensor `value`, via shape inference and assertions.
Args:
value: A Tensor, possibly with shape associated shape information.
expected_shape: a `TensorShape`, list of `int32`, or a vector `Tensor`.
Returns:
new_value: A Tensor matching `v... | [
"def",
"_check_shape",
"(",
"value",
",",
"expected_shape",
")",
":",
"assert",
"isinstance",
"(",
"value",
",",
"ops",
".",
"Tensor",
")",
"if",
"isinstance",
"(",
"expected_shape",
",",
"tensor_shape",
".",
"TensorShape",
")",
":",
"expected_shape",
"=",
"... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/training/python/training/sequence_queueing_state_saver.py#L178-L223 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_windows.py | python | VarHScrollHelper.RefreshColumn | (*args, **kwargs) | return _windows_.VarHScrollHelper_RefreshColumn(*args, **kwargs) | RefreshColumn(self, size_t column) | RefreshColumn(self, size_t column) | [
"RefreshColumn",
"(",
"self",
"size_t",
"column",
")"
] | def RefreshColumn(*args, **kwargs):
"""RefreshColumn(self, size_t column)"""
return _windows_.VarHScrollHelper_RefreshColumn(*args, **kwargs) | [
"def",
"RefreshColumn",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"VarHScrollHelper_RefreshColumn",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_windows.py#L2336-L2338 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/webapp2/webapp2.py | python | WSGIApplication.set_globals | (self, app=None, request=None) | Registers the global variables for app and request.
If :mod:`webapp2_extras.local` is available the app and request
class attributes are assigned to a proxy object that returns them
using thread-local, making the application thread-safe. This can also
be used in environments that don't ... | Registers the global variables for app and request. | [
"Registers",
"the",
"global",
"variables",
"for",
"app",
"and",
"request",
"."
] | def set_globals(self, app=None, request=None):
"""Registers the global variables for app and request.
If :mod:`webapp2_extras.local` is available the app and request
class attributes are assigned to a proxy object that returns them
using thread-local, making the application thread-safe.... | [
"def",
"set_globals",
"(",
"self",
",",
"app",
"=",
"None",
",",
"request",
"=",
"None",
")",
":",
"if",
"_local",
"is",
"not",
"None",
":",
"# pragma: no cover",
"_local",
".",
"app",
"=",
"app",
"_local",
".",
"request",
"=",
"request",
"else",
":",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/webapp2/webapp2.py#L1481-L1503 | ||
envoyproxy/envoy-wasm | ab5d9381fdf92a1efa0b87cff80036b5b3e81198 | tools/protodoc/protodoc.py | python | IndentLines | (spaces, lines) | return map(functools.partial(Indent, spaces), lines) | Indent a list of strings. | Indent a list of strings. | [
"Indent",
"a",
"list",
"of",
"strings",
"."
] | def IndentLines(spaces, lines):
"""Indent a list of strings."""
return map(functools.partial(Indent, spaces), lines) | [
"def",
"IndentLines",
"(",
"spaces",
",",
"lines",
")",
":",
"return",
"map",
"(",
"functools",
".",
"partial",
"(",
"Indent",
",",
"spaces",
")",
",",
"lines",
")"
] | https://github.com/envoyproxy/envoy-wasm/blob/ab5d9381fdf92a1efa0b87cff80036b5b3e81198/tools/protodoc/protodoc.py#L156-L158 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_aarch64/python2.7/dist-packages/rosdep2/platforms/osx.py | python | brew_strip_pkg_name | (package) | return package.split('/')[-1] | Strip the tap information of a fully qualified package name.
:returns: Unqualified package name. E.g. 'foo-pkg' for input
'ros/hydro/foo-pkg' | Strip the tap information of a fully qualified package name. | [
"Strip",
"the",
"tap",
"information",
"of",
"a",
"fully",
"qualified",
"package",
"name",
"."
] | def brew_strip_pkg_name(package):
"""Strip the tap information of a fully qualified package name.
:returns: Unqualified package name. E.g. 'foo-pkg' for input
'ros/hydro/foo-pkg'
"""
return package.split('/')[-1] | [
"def",
"brew_strip_pkg_name",
"(",
"package",
")",
":",
"return",
"package",
".",
"split",
"(",
"'/'",
")",
"[",
"-",
"1",
"]"
] | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_aarch64/python2.7/dist-packages/rosdep2/platforms/osx.py#L151-L157 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/robotsim.py | python | RobotModelLink.drawLocalGL | (self, keepAppearance: bool=True) | return _robotsim.RobotModelLink_drawLocalGL(self, keepAppearance) | r"""
Draws the link's geometry in its local frame. If keepAppearance=true, the
current Appearance is honored. Otherwise, just the geometry is drawn.
Args:
keepAppearance (bool, optional): default value True | r"""
Draws the link's geometry in its local frame. If keepAppearance=true, the
current Appearance is honored. Otherwise, just the geometry is drawn. | [
"r",
"Draws",
"the",
"link",
"s",
"geometry",
"in",
"its",
"local",
"frame",
".",
"If",
"keepAppearance",
"=",
"true",
"the",
"current",
"Appearance",
"is",
"honored",
".",
"Otherwise",
"just",
"the",
"geometry",
"is",
"drawn",
"."
] | def drawLocalGL(self, keepAppearance: bool=True) ->None:
r"""
Draws the link's geometry in its local frame. If keepAppearance=true, the
current Appearance is honored. Otherwise, just the geometry is drawn.
Args:
keepAppearance (bool, optional): default value True
"... | [
"def",
"drawLocalGL",
"(",
"self",
",",
"keepAppearance",
":",
"bool",
"=",
"True",
")",
"->",
"None",
":",
"return",
"_robotsim",
".",
"RobotModelLink_drawLocalGL",
"(",
"self",
",",
"keepAppearance",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/robotsim.py#L4346-L4354 | |
perilouswithadollarsign/cstrike15_src | f82112a2388b841d72cb62ca48ab1846dfcc11c8 | thirdparty/protobuf-2.5.0/python/google/protobuf/internal/python_message.py | python | _AddClearExtensionMethod | (cls) | Helper for _AddMessageMethods(). | Helper for _AddMessageMethods(). | [
"Helper",
"for",
"_AddMessageMethods",
"()",
"."
] | def _AddClearExtensionMethod(cls):
"""Helper for _AddMessageMethods()."""
def ClearExtension(self, extension_handle):
_VerifyExtensionHandle(self, extension_handle)
# Similar to ClearField(), above.
if extension_handle in self._fields:
del self._fields[extension_handle]
self._Modified()
cls... | [
"def",
"_AddClearExtensionMethod",
"(",
"cls",
")",
":",
"def",
"ClearExtension",
"(",
"self",
",",
"extension_handle",
")",
":",
"_VerifyExtensionHandle",
"(",
"self",
",",
"extension_handle",
")",
"# Similar to ClearField(), above.",
"if",
"extension_handle",
"in",
... | https://github.com/perilouswithadollarsign/cstrike15_src/blob/f82112a2388b841d72cb62ca48ab1846dfcc11c8/thirdparty/protobuf-2.5.0/python/google/protobuf/internal/python_message.py#L630-L639 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/setuptools/msvc.py | python | EnvironmentInfo.FxTools | (self) | return tools | Microsoft .NET Framework Tools | Microsoft .NET Framework Tools | [
"Microsoft",
".",
"NET",
"Framework",
"Tools"
] | def FxTools(self):
"""
Microsoft .NET Framework Tools
"""
pi = self.pi
si = self.si
if self.vc_ver <= 10.0:
include32 = True
include64 = not pi.target_is_x86() and not pi.current_is_x86()
else:
include32 = pi.target_is_x86() or... | [
"def",
"FxTools",
"(",
"self",
")",
":",
"pi",
"=",
"self",
".",
"pi",
"si",
"=",
"self",
".",
"si",
"if",
"self",
".",
"vc_ver",
"<=",
"10.0",
":",
"include32",
"=",
"True",
"include64",
"=",
"not",
"pi",
".",
"target_is_x86",
"(",
")",
"and",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/setuptools/msvc.py#L1072-L1093 | |
rsummers11/CADLab | 976ed959a0b5208bb4173127a7ef732ac73a9b6f | lesion_detector_3DCE/rcnn/pycocotools/coco.py | python | COCO.getImgIds | (self, imgIds=[], catIds=[]) | return list(ids) | Get img ids that satisfy given filter conditions.
:param imgIds (int array) : get imgs for given ids
:param catIds (int array) : get imgs with all given cats
:return: ids (int array) : integer array of img ids | Get img ids that satisfy given filter conditions.
:param imgIds (int array) : get imgs for given ids
:param catIds (int array) : get imgs with all given cats
:return: ids (int array) : integer array of img ids | [
"Get",
"img",
"ids",
"that",
"satisfy",
"given",
"filter",
"conditions",
".",
":",
"param",
"imgIds",
"(",
"int",
"array",
")",
":",
"get",
"imgs",
"for",
"given",
"ids",
":",
"param",
"catIds",
"(",
"int",
"array",
")",
":",
"get",
"imgs",
"with",
"... | def getImgIds(self, imgIds=[], catIds=[]):
'''
Get img ids that satisfy given filter conditions.
:param imgIds (int array) : get imgs for given ids
:param catIds (int array) : get imgs with all given cats
:return: ids (int array) : integer array of img ids
'''
im... | [
"def",
"getImgIds",
"(",
"self",
",",
"imgIds",
"=",
"[",
"]",
",",
"catIds",
"=",
"[",
"]",
")",
":",
"imgIds",
"=",
"imgIds",
"if",
"type",
"(",
"imgIds",
")",
"==",
"list",
"else",
"[",
"imgIds",
"]",
"catIds",
"=",
"catIds",
"if",
"type",
"("... | https://github.com/rsummers11/CADLab/blob/976ed959a0b5208bb4173127a7ef732ac73a9b6f/lesion_detector_3DCE/rcnn/pycocotools/coco.py#L174-L193 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/ConfigParser.py | python | RawConfigParser.has_section | (self, section) | return section in self._sections | Indicate whether the named section is present in the configuration.
The DEFAULT section is not acknowledged. | Indicate whether the named section is present in the configuration. | [
"Indicate",
"whether",
"the",
"named",
"section",
"is",
"present",
"in",
"the",
"configuration",
"."
] | def has_section(self, section):
"""Indicate whether the named section is present in the configuration.
The DEFAULT section is not acknowledged.
"""
return section in self._sections | [
"def",
"has_section",
"(",
"self",
",",
"section",
")",
":",
"return",
"section",
"in",
"self",
".",
"_sections"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/ConfigParser.py#L267-L272 | |
forkineye/ESPixelStick | 22926f1c0d1131f1369fc7cad405689a095ae3cb | dist/bin/esptool/serial/tools/hexlify_codec.py | python | Codec.decode | (self, data, errors='strict') | return unicode(''.join('{:02X} '.format(ord(b)) for b in serial.iterbytes(data))) | b'@ab' -> '40 41 42 | b' | [
"b"
] | def decode(self, data, errors='strict'):
"""b'@ab' -> '40 41 42'"""
return unicode(''.join('{:02X} '.format(ord(b)) for b in serial.iterbytes(data))) | [
"def",
"decode",
"(",
"self",
",",
"data",
",",
"errors",
"=",
"'strict'",
")",
":",
"return",
"unicode",
"(",
"''",
".",
"join",
"(",
"'{:02X} '",
".",
"format",
"(",
"ord",
"(",
"b",
")",
")",
"for",
"b",
"in",
"serial",
".",
"iterbytes",
"(",
... | https://github.com/forkineye/ESPixelStick/blob/22926f1c0d1131f1369fc7cad405689a095ae3cb/dist/bin/esptool/serial/tools/hexlify_codec.py#L51-L53 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | third_party/markdown/odict.py | python | OrderedDict.value_for_index | (self, index) | return self[self.keyOrder[index]] | Returns the value of the item at the given zero-based index. | Returns the value of the item at the given zero-based index. | [
"Returns",
"the",
"value",
"of",
"the",
"item",
"at",
"the",
"given",
"zero",
"-",
"based",
"index",
"."
] | def value_for_index(self, index):
"""Returns the value of the item at the given zero-based index."""
return self[self.keyOrder[index]] | [
"def",
"value_for_index",
"(",
"self",
",",
"index",
")",
":",
"return",
"self",
"[",
"self",
".",
"keyOrder",
"[",
"index",
"]",
"]"
] | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/third_party/markdown/odict.py#L149-L151 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/mailbox.py | python | Mailbox.update | (self, arg=None) | Change the messages that correspond to certain keys. | Change the messages that correspond to certain keys. | [
"Change",
"the",
"messages",
"that",
"correspond",
"to",
"certain",
"keys",
"."
] | def update(self, arg=None):
"""Change the messages that correspond to certain keys."""
if hasattr(arg, 'iteritems'):
source = arg.iteritems()
elif hasattr(arg, 'items'):
source = arg.items()
else:
source = arg
bad_key = False
for key, m... | [
"def",
"update",
"(",
"self",
",",
"arg",
"=",
"None",
")",
":",
"if",
"hasattr",
"(",
"arg",
",",
"'iteritems'",
")",
":",
"source",
"=",
"arg",
".",
"iteritems",
"(",
")",
"elif",
"hasattr",
"(",
"arg",
",",
"'items'",
")",
":",
"source",
"=",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/mailbox.py#L164-L179 | ||
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | deps/src/libxml2-2.9.1/python/libxml2class.py | python | parserCtxt.parseReference | (self) | parse and handle entity references in content, depending on
the SAX interface, this may end-up in a call to character()
if this is a CharRef, a predefined entity, if there is no
reference() callback. or if the parser was asked to switch
to that mode. [67] Reference ::= EntityRe... | parse and handle entity references in content, depending on
the SAX interface, this may end-up in a call to character()
if this is a CharRef, a predefined entity, if there is no
reference() callback. or if the parser was asked to switch
to that mode. [67] Reference ::= EntityRe... | [
"parse",
"and",
"handle",
"entity",
"references",
"in",
"content",
"depending",
"on",
"the",
"SAX",
"interface",
"this",
"may",
"end",
"-",
"up",
"in",
"a",
"call",
"to",
"character",
"()",
"if",
"this",
"is",
"a",
"CharRef",
"a",
"predefined",
"entity",
... | def parseReference(self):
"""parse and handle entity references in content, depending on
the SAX interface, this may end-up in a call to character()
if this is a CharRef, a predefined entity, if there is no
reference() callback. or if the parser was asked to switch
to th... | [
"def",
"parseReference",
"(",
"self",
")",
":",
"libxml2mod",
".",
"xmlParseReference",
"(",
"self",
".",
"_o",
")"
] | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/deps/src/libxml2-2.9.1/python/libxml2class.py#L4630-L4636 | ||
NVIDIA/DALI | bf16cc86ba8f091b145f91962f21fe1b6aff243d | dali/python/nvidia/dali/_multiproc/pool.py | python | create_worker_contexts | (mp, callback_contexts : List[CallbackContext], num_workers, callback_pickler) | return worker_contexts | Prepares list of `WorkerContext` instances.
Each instance describes parameters specific to a given worker process (as opposed to parameters common
for all processes in the pool). WorkerContext contains sources that the worker will receive and shared memory
chunks corresponding to the sources. It also contai... | Prepares list of `WorkerContext` instances.
Each instance describes parameters specific to a given worker process (as opposed to parameters common
for all processes in the pool). WorkerContext contains sources that the worker will receive and shared memory
chunks corresponding to the sources. It also contai... | [
"Prepares",
"list",
"of",
"WorkerContext",
"instances",
".",
"Each",
"instance",
"describes",
"parameters",
"specific",
"to",
"a",
"given",
"worker",
"process",
"(",
"as",
"opposed",
"to",
"parameters",
"common",
"for",
"all",
"processes",
"in",
"the",
"pool",
... | def create_worker_contexts(mp, callback_contexts : List[CallbackContext], num_workers, callback_pickler) -> List[WorkerContext]:
"""
Prepares list of `WorkerContext` instances.
Each instance describes parameters specific to a given worker process (as opposed to parameters common
for all processes in the... | [
"def",
"create_worker_contexts",
"(",
"mp",
",",
"callback_contexts",
":",
"List",
"[",
"CallbackContext",
"]",
",",
"num_workers",
",",
"callback_pickler",
")",
"->",
"List",
"[",
"WorkerContext",
"]",
":",
"if",
"callback_pickler",
"is",
"None",
":",
"source_d... | https://github.com/NVIDIA/DALI/blob/bf16cc86ba8f091b145f91962f21fe1b6aff243d/dali/python/nvidia/dali/_multiproc/pool.py#L250-L288 | |
panda3d/panda3d | 833ad89ebad58395d0af0b7ec08538e5e4308265 | direct/src/showbase/ShowBase.py | python | ShowBase.createStats | (self, hostname=None, port=None) | return PStatClient.isConnected() | If want-pstats is set in Config.prc, or the `wantStats` member is
otherwise set to True, connects to the PStats server.
This is normally called automatically from the ShowBase constructor. | If want-pstats is set in Config.prc, or the `wantStats` member is
otherwise set to True, connects to the PStats server.
This is normally called automatically from the ShowBase constructor. | [
"If",
"want",
"-",
"pstats",
"is",
"set",
"in",
"Config",
".",
"prc",
"or",
"the",
"wantStats",
"member",
"is",
"otherwise",
"set",
"to",
"True",
"connects",
"to",
"the",
"PStats",
"server",
".",
"This",
"is",
"normally",
"called",
"automatically",
"from",... | def createStats(self, hostname=None, port=None):
"""
If want-pstats is set in Config.prc, or the `wantStats` member is
otherwise set to True, connects to the PStats server.
This is normally called automatically from the ShowBase constructor.
"""
# You can specify pstats-h... | [
"def",
"createStats",
"(",
"self",
",",
"hostname",
"=",
"None",
",",
"port",
"=",
"None",
")",
":",
"# You can specify pstats-host in your Config.prc or use ~pstats/~aipstats",
"# The default is localhost",
"if",
"not",
"self",
".",
"wantStats",
":",
"return",
"False",... | https://github.com/panda3d/panda3d/blob/833ad89ebad58395d0af0b7ec08538e5e4308265/direct/src/showbase/ShowBase.py#L1914-L1933 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_vendor/chardet/universaldetector.py | python | UniversalDetector.close | (self) | return self.result | Stop analyzing the current document and come up with a final
prediction.
:returns: The ``result`` attribute, a ``dict`` with the keys
`encoding`, `confidence`, and `language`. | [] | def close(self):
"""
Stop analyzing the current document and come up with a final
prediction.
:returns: The ``result`` attribute, a ``dict`` with the keys
`encoding`, `confidence`, and `language`.
"""
# Don't bother with checks if we're alread... | [
"def",
"close",
"(",
"self",
")",
":",
"# Don't bother with checks if we're already done",
"if",
"self",
".",
"done",
":",
"return",
"self",
".",
"result",
"self",
".",
"done",
"=",
"True",
"if",
"not",
"self",
".",
"_got_data",
":",
"self",
".",
"logger",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_vendor/chardet/universaldetector.py#L439-L571 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/tarfile.py | python | TarInfo.create_gnu_header | (self, info, encoding, errors) | return buf + self._create_header(info, GNU_FORMAT, encoding, errors) | Return the object as a GNU header block sequence. | Return the object as a GNU header block sequence. | [
"Return",
"the",
"object",
"as",
"a",
"GNU",
"header",
"block",
"sequence",
"."
] | def create_gnu_header(self, info, encoding, errors):
"""Return the object as a GNU header block sequence.
"""
info["magic"] = GNU_MAGIC
buf = b""
if len(info["linkname"].encode(encoding, errors)) > LENGTH_LINK:
buf += self._create_gnu_long_header(info["linkname"], GN... | [
"def",
"create_gnu_header",
"(",
"self",
",",
"info",
",",
"encoding",
",",
"errors",
")",
":",
"info",
"[",
"\"magic\"",
"]",
"=",
"GNU_MAGIC",
"buf",
"=",
"b\"\"",
"if",
"len",
"(",
"info",
"[",
"\"linkname\"",
"]",
".",
"encode",
"(",
"encoding",
",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/tarfile.py#L835-L847 | |
ideawu/ssdb | f229ba277c7f7d0ca5a441c0c6fb3d1209af68e4 | deps/cpy/antlr3/tree.py | python | BaseTreeAdaptor.errorNode | (self, input, start, stop, exc) | return CommonErrorNode(input, start, stop, exc) | create tree node that holds the start and stop tokens associated
with an error.
If you specify your own kind of tree nodes, you will likely have to
override this method. CommonTree returns Token.INVALID_TOKEN_TYPE
if no token payload but you might have to set token type for diff
... | create tree node that holds the start and stop tokens associated
with an error. | [
"create",
"tree",
"node",
"that",
"holds",
"the",
"start",
"and",
"stop",
"tokens",
"associated",
"with",
"an",
"error",
"."
] | def errorNode(self, input, start, stop, exc):
"""
create tree node that holds the start and stop tokens associated
with an error.
If you specify your own kind of tree nodes, you will likely have to
override this method. CommonTree returns Token.INVALID_TOKEN_TYPE
if no t... | [
"def",
"errorNode",
"(",
"self",
",",
"input",
",",
"start",
",",
"stop",
",",
"exc",
")",
":",
"return",
"CommonErrorNode",
"(",
"input",
",",
"start",
",",
"stop",
",",
"exc",
")"
] | https://github.com/ideawu/ssdb/blob/f229ba277c7f7d0ca5a441c0c6fb3d1209af68e4/deps/cpy/antlr3/tree.py#L918-L929 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/keras/saving/saved_model/save.py | python | LayerCallCollection.add_function | (self, call_fn, name) | return fn | Adds a layer call function to the collection. | Adds a layer call function to the collection. | [
"Adds",
"a",
"layer",
"call",
"function",
"to",
"the",
"collection",
"."
] | def add_function(self, call_fn, name):
"""Adds a layer call function to the collection."""
self._functions[name] = fn = LayerCall(
self, self._maybe_wrap_with_training_arg(call_fn), name,
input_signature=self.fn_input_signature)
if (None not in nest.flatten(self._input_signature) and
... | [
"def",
"add_function",
"(",
"self",
",",
"call_fn",
",",
"name",
")",
":",
"self",
".",
"_functions",
"[",
"name",
"]",
"=",
"fn",
"=",
"LayerCall",
"(",
"self",
",",
"self",
".",
"_maybe_wrap_with_training_arg",
"(",
"call_fn",
")",
",",
"name",
",",
... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/keras/saving/saved_model/save.py#L562-L573 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_core.py | python | MenuItem.GetId | (*args, **kwargs) | return _core_.MenuItem_GetId(*args, **kwargs) | GetId(self) -> int | GetId(self) -> int | [
"GetId",
"(",
"self",
")",
"-",
">",
"int"
] | def GetId(*args, **kwargs):
"""GetId(self) -> int"""
return _core_.MenuItem_GetId(*args, **kwargs) | [
"def",
"GetId",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"MenuItem_GetId",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_core.py#L12455-L12457 | |
turi-code/SFrame | 796b9bdfb2fa1b881d82080754643c7e68629cd2 | oss_src/unity/python/sframe/data_structures/sarray_builder.py | python | SArrayBuilder.close | (self) | return SArray(_proxy=self._builder.close()) | Creates an SArray from all values that were appended to the
SArrayBuilder. No function that appends data may be called after this
is called.
Returns
-------
out : SArray | Creates an SArray from all values that were appended to the
SArrayBuilder. No function that appends data may be called after this
is called. | [
"Creates",
"an",
"SArray",
"from",
"all",
"values",
"that",
"were",
"appended",
"to",
"the",
"SArrayBuilder",
".",
"No",
"function",
"that",
"appends",
"data",
"may",
"be",
"called",
"after",
"this",
"is",
"called",
"."
] | def close(self):
"""
Creates an SArray from all values that were appended to the
SArrayBuilder. No function that appends data may be called after this
is called.
Returns
-------
out : SArray
"""
return SArray(_proxy=self._builder.close()) | [
"def",
"close",
"(",
"self",
")",
":",
"return",
"SArray",
"(",
"_proxy",
"=",
"self",
".",
"_builder",
".",
"close",
"(",
")",
")"
] | https://github.com/turi-code/SFrame/blob/796b9bdfb2fa1b881d82080754643c7e68629cd2/oss_src/unity/python/sframe/data_structures/sarray_builder.py#L136-L147 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/setuptools/msvc.py | python | SystemInfo._guess_vc_legacy | (self) | return os.path.join(self.ProgramFilesx86, default) | Locate Visual C for versions prior to 2017 | Locate Visual C for versions prior to 2017 | [
"Locate",
"Visual",
"C",
"for",
"versions",
"prior",
"to",
"2017"
] | def _guess_vc_legacy(self):
"""
Locate Visual C for versions prior to 2017
"""
default = r'Microsoft Visual Studio %0.1f\VC' % self.vc_ver
return os.path.join(self.ProgramFilesx86, default) | [
"def",
"_guess_vc_legacy",
"(",
"self",
")",
":",
"default",
"=",
"r'Microsoft Visual Studio %0.1f\\VC'",
"%",
"self",
".",
"vc_ver",
"return",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"ProgramFilesx86",
",",
"default",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/setuptools/msvc.py#L576-L581 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/operations/build/wheel_legacy.py | python | get_legacy_build_wheel_path | (
names, # type: List[str]
temp_dir, # type: str
name, # type: str
command_args, # type: List[str]
command_output, # type: str
) | return os.path.join(temp_dir, names[0]) | Return the path to the wheel in the temporary build directory. | Return the path to the wheel in the temporary build directory. | [
"Return",
"the",
"path",
"to",
"the",
"wheel",
"in",
"the",
"temporary",
"build",
"directory",
"."
] | def get_legacy_build_wheel_path(
names, # type: List[str]
temp_dir, # type: str
name, # type: str
command_args, # type: List[str]
command_output, # type: str
):
# type: (...) -> Optional[str]
"""Return the path to the wheel in the temporary build directory."""
# Sort for determinism... | [
"def",
"get_legacy_build_wheel_path",
"(",
"names",
",",
"# type: List[str]",
"temp_dir",
",",
"# type: str",
"name",
",",
"# type: str",
"command_args",
",",
"# type: List[str]",
"command_output",
",",
"# type: str",
")",
":",
"# type: (...) -> Optional[str]",
"# Sort for ... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/operations/build/wheel_legacy.py#L40-L67 | |
h0x91b/redis-v8 | ac8b9d49701d75bcee3719892a2a6a50b437e47a | redis/deps/v8/tools/stats-viewer.py | python | CounterCollection.CounterSize | (self) | return 4 + self.max_name_size | Return the size of a single counter. | Return the size of a single counter. | [
"Return",
"the",
"size",
"of",
"a",
"single",
"counter",
"."
] | def CounterSize(self):
"""Return the size of a single counter."""
return 4 + self.max_name_size | [
"def",
"CounterSize",
"(",
"self",
")",
":",
"return",
"4",
"+",
"self",
".",
"max_name_size"
] | https://github.com/h0x91b/redis-v8/blob/ac8b9d49701d75bcee3719892a2a6a50b437e47a/redis/deps/v8/tools/stats-viewer.py#L378-L380 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/_pyio.py | python | BufferedIOBase.detach | (self) | Separate the underlying raw stream from the buffer and return it.
After the raw stream has been detached, the buffer is in an unusable
state. | Separate the underlying raw stream from the buffer and return it. | [
"Separate",
"the",
"underlying",
"raw",
"stream",
"from",
"the",
"buffer",
"and",
"return",
"it",
"."
] | def detach(self):
"""
Separate the underlying raw stream from the buffer and return it.
After the raw stream has been detached, the buffer is in an unusable
state.
"""
self._unsupported("detach") | [
"def",
"detach",
"(",
"self",
")",
":",
"self",
".",
"_unsupported",
"(",
"\"detach\"",
")"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/_pyio.py#L667-L674 | ||
esa/pagmo | 80281d549c8f1b470e1489a5d37c8f06b2e429c0 | PyGMO/util/_analysis.py | python | analysis.plot_local_cluster_pcp | (self, together=True, clusters_to_plot=10) | Generates a Parallel Coordinate Plot of the clusters obtained on the local search results.
The parallel axes represent the chromosome of the initial points of each local search and
the colors are the clusters to which its local search resulting points belong.
**USAGE:**
analysis.plot_l... | Generates a Parallel Coordinate Plot of the clusters obtained on the local search results.
The parallel axes represent the chromosome of the initial points of each local search and
the colors are the clusters to which its local search resulting points belong. | [
"Generates",
"a",
"Parallel",
"Coordinate",
"Plot",
"of",
"the",
"clusters",
"obtained",
"on",
"the",
"local",
"search",
"results",
".",
"The",
"parallel",
"axes",
"represent",
"the",
"chromosome",
"of",
"the",
"initial",
"points",
"of",
"each",
"local",
"sear... | def plot_local_cluster_pcp(self, together=True, clusters_to_plot=10):
"""
Generates a Parallel Coordinate Plot of the clusters obtained on the local search results.
The parallel axes represent the chromosome of the initial points of each local search and
the colors are the clusters to wh... | [
"def",
"plot_local_cluster_pcp",
"(",
"self",
",",
"together",
"=",
"True",
",",
"clusters_to_plot",
"=",
"10",
")",
":",
"if",
"self",
".",
"local_nclusters",
"==",
"0",
":",
"raise",
"ValueError",
"(",
"\"analysis.plot_local_cluster_pcp: sampling, getting local extr... | https://github.com/esa/pagmo/blob/80281d549c8f1b470e1489a5d37c8f06b2e429c0/PyGMO/util/_analysis.py#L3397-L3477 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | Framework/PythonInterface/mantid/plots/axesfunctions.py | python | scatter | (axes, workspace, *args, **kwargs) | return axes.scatter(x, y, *args, **kwargs) | Unpack mantid workspace and render it with matplotlib. ``args`` and
``kwargs`` are passed to :py:meth:`matplotlib.axes.Axes.scatter` after special
keyword arguments are removed. This will automatically label the
line according to the spectrum number unless specified otherwise.
:param axes: :class:... | Unpack mantid workspace and render it with matplotlib. ``args`` and
``kwargs`` are passed to :py:meth:`matplotlib.axes.Axes.scatter` after special
keyword arguments are removed. This will automatically label the
line according to the spectrum number unless specified otherwise. | [
"Unpack",
"mantid",
"workspace",
"and",
"render",
"it",
"with",
"matplotlib",
".",
"args",
"and",
"kwargs",
"are",
"passed",
"to",
":",
"py",
":",
"meth",
":",
"matplotlib",
".",
"axes",
".",
"Axes",
".",
"scatter",
"after",
"special",
"keyword",
"argument... | def scatter(axes, workspace, *args, **kwargs):
'''
Unpack mantid workspace and render it with matplotlib. ``args`` and
``kwargs`` are passed to :py:meth:`matplotlib.axes.Axes.scatter` after special
keyword arguments are removed. This will automatically label the
line according to the spectrum number... | [
"def",
"scatter",
"(",
"axes",
",",
"workspace",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"isinstance",
"(",
"workspace",
",",
"mantid",
".",
"dataobjects",
".",
"MDHistoWorkspace",
")",
":",
"(",
"normalization",
",",
"kwargs",
")",
... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/Framework/PythonInterface/mantid/plots/axesfunctions.py#L287-L329 | |
microsoft/checkedc-clang | a173fefde5d7877b7750e7ce96dd08cf18baebf2 | llvm/bindings/python/llvm/core.py | python | LLVMEnumeration.register | (cls, name, value) | Registers a new enumeration.
This is called by this module for each enumeration defined in
enumerations. You should not need to call this outside this module. | Registers a new enumeration. | [
"Registers",
"a",
"new",
"enumeration",
"."
] | def register(cls, name, value):
"""Registers a new enumeration.
This is called by this module for each enumeration defined in
enumerations. You should not need to call this outside this module.
"""
if value in cls._value_map:
raise ValueError('%s value already regist... | [
"def",
"register",
"(",
"cls",
",",
"name",
",",
"value",
")",
":",
"if",
"value",
"in",
"cls",
".",
"_value_map",
":",
"raise",
"ValueError",
"(",
"'%s value already registered: %d'",
"%",
"(",
"cls",
".",
"__name__",
",",
"value",
")",
")",
"enum",
"="... | https://github.com/microsoft/checkedc-clang/blob/a173fefde5d7877b7750e7ce96dd08cf18baebf2/llvm/bindings/python/llvm/core.py#L63-L74 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/tornado/tornado-6/tornado/web.py | python | StaticFileHandler.get_absolute_path | (cls, root: str, path: str) | return abspath | Returns the absolute location of ``path`` relative to ``root``.
``root`` is the path configured for this `StaticFileHandler`
(in most cases the ``static_path`` `Application` setting).
This class method may be overridden in subclasses. By default
it returns a filesystem path, but other... | Returns the absolute location of ``path`` relative to ``root``. | [
"Returns",
"the",
"absolute",
"location",
"of",
"path",
"relative",
"to",
"root",
"."
] | def get_absolute_path(cls, root: str, path: str) -> str:
"""Returns the absolute location of ``path`` relative to ``root``.
``root`` is the path configured for this `StaticFileHandler`
(in most cases the ``static_path`` `Application` setting).
This class method may be overridden in sub... | [
"def",
"get_absolute_path",
"(",
"cls",
",",
"root",
":",
"str",
",",
"path",
":",
"str",
")",
"->",
"str",
":",
"abspath",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"path",
".",
"join",
"(",
"root",
",",
"path",
")",
")",
"return",... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/tornado/tornado-6/tornado/web.py#L2717-L2731 | |
PX4/PX4-Autopilot | 0b9f60a0370be53d683352c63fd92db3d6586e18 | Tools/px4.py | python | get_version | () | return version | Get PX4 Firmware latest Git tag. | Get PX4 Firmware latest Git tag. | [
"Get",
"PX4",
"Firmware",
"latest",
"Git",
"tag",
"."
] | def get_version():
"""
Get PX4 Firmware latest Git tag.
"""
px4_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
if os.path.isdir(os.path.join(px4_dir, '.git')):
# If inside a clone PX4 Firmware repository, get version from "git describe"
cmd = 'git describe --e... | [
"def",
"get_version",
"(",
")",
":",
"px4_dir",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"os",
".",
"path",
".",
"abspath",
"(",
"__file__",
")",
")",
")",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
... | https://github.com/PX4/PX4-Autopilot/blob/0b9f60a0370be53d683352c63fd92db3d6586e18/Tools/px4.py#L60-L86 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/optimize/_lsq/common.py | python | in_bounds | (x, lb, ub) | return np.all((x >= lb) & (x <= ub)) | Check if a point lies within bounds. | Check if a point lies within bounds. | [
"Check",
"if",
"a",
"point",
"lies",
"within",
"bounds",
"."
] | def in_bounds(x, lb, ub):
"""Check if a point lies within bounds."""
return np.all((x >= lb) & (x <= ub)) | [
"def",
"in_bounds",
"(",
"x",
",",
"lb",
",",
"ub",
")",
":",
"return",
"np",
".",
"all",
"(",
"(",
"x",
">=",
"lb",
")",
"&",
"(",
"x",
"<=",
"ub",
")",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/optimize/_lsq/common.py#L368-L370 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/scipy/ndimage/filters.py | python | gaussian_laplace | (input, sigma, output=None, mode="reflect",
cval=0.0, **kwargs) | return generic_laplace(input, derivative2, output, mode, cval,
extra_arguments=(sigma,),
extra_keywords=kwargs) | Multidimensional Laplace filter using gaussian second derivatives.
Parameters
----------
%(input)s
sigma : scalar or sequence of scalars
The standard deviations of the Gaussian filter are given for
each axis as a sequence, or as a single number, in which case
it is equal for all... | Multidimensional Laplace filter using gaussian second derivatives. | [
"Multidimensional",
"Laplace",
"filter",
"using",
"gaussian",
"second",
"derivatives",
"."
] | def gaussian_laplace(input, sigma, output=None, mode="reflect",
cval=0.0, **kwargs):
"""Multidimensional Laplace filter using gaussian second derivatives.
Parameters
----------
%(input)s
sigma : scalar or sequence of scalars
The standard deviations of the Gaussian filte... | [
"def",
"gaussian_laplace",
"(",
"input",
",",
"sigma",
",",
"output",
"=",
"None",
",",
"mode",
"=",
"\"reflect\"",
",",
"cval",
"=",
"0.0",
",",
"*",
"*",
"kwargs",
")",
":",
"input",
"=",
"numpy",
".",
"asarray",
"(",
"input",
")",
"def",
"derivati... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/scipy/ndimage/filters.py#L457-L501 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_controls.py | python | TextAttr.SetParagraphStyleName | (*args, **kwargs) | return _controls_.TextAttr_SetParagraphStyleName(*args, **kwargs) | SetParagraphStyleName(self, String name) | SetParagraphStyleName(self, String name) | [
"SetParagraphStyleName",
"(",
"self",
"String",
"name",
")"
] | def SetParagraphStyleName(*args, **kwargs):
"""SetParagraphStyleName(self, String name)"""
return _controls_.TextAttr_SetParagraphStyleName(*args, **kwargs) | [
"def",
"SetParagraphStyleName",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"TextAttr_SetParagraphStyleName",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_controls.py#L1579-L1581 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/robotsim.py | python | SimJoint.setLimits | (self, min: float, max: float) | return _robotsim.SimJoint_setLimits(self, min, max) | r"""
Sets the joint limits, relative to the initial configuration of the bodies.
Units are in radians for hinges and meters for sliders.
Args:
min (float)
max (float) | r"""
Sets the joint limits, relative to the initial configuration of the bodies.
Units are in radians for hinges and meters for sliders. | [
"r",
"Sets",
"the",
"joint",
"limits",
"relative",
"to",
"the",
"initial",
"configuration",
"of",
"the",
"bodies",
".",
"Units",
"are",
"in",
"radians",
"for",
"hinges",
"and",
"meters",
"for",
"sliders",
"."
] | def setLimits(self, min: float, max: float) ->None:
r"""
Sets the joint limits, relative to the initial configuration of the bodies.
Units are in radians for hinges and meters for sliders.
Args:
min (float)
max (float)
"""
return _robotsim.SimJo... | [
"def",
"setLimits",
"(",
"self",
",",
"min",
":",
"float",
",",
"max",
":",
"float",
")",
"->",
"None",
":",
"return",
"_robotsim",
".",
"SimJoint_setLimits",
"(",
"self",
",",
"min",
",",
"max",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/robotsim.py#L7699-L7708 | |
GoSSIP-SJTU/TripleDoggy | 03648d6b19c812504b14e8b98c8c7b3f443f4e54 | examples/Kaleidoscope/MCJIT/lazy/genk-timing.py | python | generateKScript | (filename, numFuncs, elementsPerFunc, funcsBetweenExec, callWeighting, timingScript) | Generate a random Kaleidoscope script based on the given parameters | Generate a random Kaleidoscope script based on the given parameters | [
"Generate",
"a",
"random",
"Kaleidoscope",
"script",
"based",
"on",
"the",
"given",
"parameters"
] | def generateKScript(filename, numFuncs, elementsPerFunc, funcsBetweenExec, callWeighting, timingScript):
""" Generate a random Kaleidoscope script based on the given parameters """
print "Generating " + filename
print(" %d functions, %d elements per function, %d functions between execution" %
(nu... | [
"def",
"generateKScript",
"(",
"filename",
",",
"numFuncs",
",",
"elementsPerFunc",
",",
"funcsBetweenExec",
",",
"callWeighting",
",",
"timingScript",
")",
":",
"print",
"\"Generating \"",
"+",
"filename",
"print",
"(",
"\" %d functions, %d elements per function, %d fun... | https://github.com/GoSSIP-SJTU/TripleDoggy/blob/03648d6b19c812504b14e8b98c8c7b3f443f4e54/examples/Kaleidoscope/MCJIT/lazy/genk-timing.py#L174-L204 | ||
gnuradio/gnuradio | 09c3c4fa4bfb1a02caac74cb5334dfe065391e3b | gr-network/python/network/tcp_source.py | python | _get_sock_fd | (addr, port, server) | Get the file descriptor for the socket.
As a client, block on connect, dup the socket descriptor.
As a server, block on accept, dup the client descriptor.
Args:
addr: the ip address string
port: the tcp port number
server: true for server mode, false for client mode
Returns:
... | Get the file descriptor for the socket.
As a client, block on connect, dup the socket descriptor.
As a server, block on accept, dup the client descriptor. | [
"Get",
"the",
"file",
"descriptor",
"for",
"the",
"socket",
".",
"As",
"a",
"client",
"block",
"on",
"connect",
"dup",
"the",
"socket",
"descriptor",
".",
"As",
"a",
"server",
"block",
"on",
"accept",
"dup",
"the",
"client",
"descriptor",
"."
] | def _get_sock_fd(addr, port, server):
"""
Get the file descriptor for the socket.
As a client, block on connect, dup the socket descriptor.
As a server, block on accept, dup the client descriptor.
Args:
addr: the ip address string
port: the tcp port number
server: true for s... | [
"def",
"_get_sock_fd",
"(",
"addr",
",",
"port",
",",
"server",
")",
":",
"is_ipv6",
"=",
"False",
"if",
"\":\"",
"in",
"addr",
":",
"sock",
"=",
"socket",
".",
"socket",
"(",
"socket",
".",
"AF_INET6",
",",
"socket",
".",
"SOCK_STREAM",
",",
"0",
")... | https://github.com/gnuradio/gnuradio/blob/09c3c4fa4bfb1a02caac74cb5334dfe065391e3b/gr-network/python/network/tcp_source.py#L27-L76 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/poplib.py | python | POP3.retr | (self, which) | return self._longcmd('RETR %s' % which) | Retrieve whole message number 'which'.
Result is in form ['response', ['line', ...], octets]. | Retrieve whole message number 'which'. | [
"Retrieve",
"whole",
"message",
"number",
"which",
"."
] | def retr(self, which):
"""Retrieve whole message number 'which'.
Result is in form ['response', ['line', ...], octets].
"""
return self._longcmd('RETR %s' % which) | [
"def",
"retr",
"(",
"self",
",",
"which",
")",
":",
"return",
"self",
".",
"_longcmd",
"(",
"'RETR %s'",
"%",
"which",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/poplib.py#L248-L253 | |
yue/yue | 619d62c191b13c51c01be451dc48917c34a5aefc | building/tools/cpplint.py | python | FindStartOfExpressionInLine | (line, endpos, stack) | return (-1, stack) | Find position at the matching start of current expression.
This is almost the reverse of FindEndOfExpressionInLine, but note
that the input position and returned position differs by 1.
Args:
line: a CleansedLines line.
endpos: start searching at this position.
stack: nesting stack at endpos.
Retu... | Find position at the matching start of current expression. | [
"Find",
"position",
"at",
"the",
"matching",
"start",
"of",
"current",
"expression",
"."
] | def FindStartOfExpressionInLine(line, endpos, stack):
"""Find position at the matching start of current expression.
This is almost the reverse of FindEndOfExpressionInLine, but note
that the input position and returned position differs by 1.
Args:
line: a CleansedLines line.
endpos: start searching at... | [
"def",
"FindStartOfExpressionInLine",
"(",
"line",
",",
"endpos",
",",
"stack",
")",
":",
"i",
"=",
"endpos",
"while",
"i",
">=",
"0",
":",
"char",
"=",
"line",
"[",
"i",
"]",
"if",
"char",
"in",
"')]}'",
":",
"# Found end of expression, push to expression s... | https://github.com/yue/yue/blob/619d62c191b13c51c01be451dc48917c34a5aefc/building/tools/cpplint.py#L1635-L1709 | |
protocolbuffers/protobuf | b5ab0b7a18b7336c60130f4ddb2d97c51792f896 | python/google/protobuf/message.py | python | Message.ByteSize | (self) | Returns the serialized size of this message.
Recursively calls ByteSize() on all contained messages.
Returns:
int: The number of bytes required to serialize this message. | Returns the serialized size of this message. | [
"Returns",
"the",
"serialized",
"size",
"of",
"this",
"message",
"."
] | def ByteSize(self):
"""Returns the serialized size of this message.
Recursively calls ByteSize() on all contained messages.
Returns:
int: The number of bytes required to serialize this message.
"""
raise NotImplementedError | [
"def",
"ByteSize",
"(",
"self",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/protocolbuffers/protobuf/blob/b5ab0b7a18b7336c60130f4ddb2d97c51792f896/python/google/protobuf/message.py#L352-L360 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/framework/ops.py | python | prepend_name_scope | (name, import_scope) | Prepends name scope to a name.
Args:
name: A `string` name.
import_scope: Optional `string`. Name scope to add.
Returns:
Name with name scope added, or the original name if import_scope
is None. | Prepends name scope to a name. | [
"Prepends",
"name",
"scope",
"to",
"a",
"name",
"."
] | def prepend_name_scope(name, import_scope):
"""Prepends name scope to a name.
Args:
name: A `string` name.
import_scope: Optional `string`. Name scope to add.
Returns:
Name with name scope added, or the original name if import_scope
is None.
"""
if import_scope:
if import_scope[-1] == "/... | [
"def",
"prepend_name_scope",
"(",
"name",
",",
"import_scope",
")",
":",
"if",
"import_scope",
":",
"if",
"import_scope",
"[",
"-",
"1",
"]",
"==",
"\"/\"",
":",
"import_scope",
"=",
"import_scope",
"[",
":",
"-",
"1",
"]",
"try",
":",
"str_to_replace",
... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/framework/ops.py#L7022-L7046 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/distutils/command/autodist.py | python | check_gcc_function_attribute_with_intrinsics | (cmd, attribute, name, code,
include) | return cmd.try_compile(body, None, None) != 0 | Return True if the given function attribute is supported with
intrinsics. | Return True if the given function attribute is supported with
intrinsics. | [
"Return",
"True",
"if",
"the",
"given",
"function",
"attribute",
"is",
"supported",
"with",
"intrinsics",
"."
] | def check_gcc_function_attribute_with_intrinsics(cmd, attribute, name, code,
include):
"""Return True if the given function attribute is supported with
intrinsics."""
cmd._check_compiler()
body = textwrap.dedent("""
#include<%s>
int %s %s(v... | [
"def",
"check_gcc_function_attribute_with_intrinsics",
"(",
"cmd",
",",
"attribute",
",",
"name",
",",
"code",
",",
"include",
")",
":",
"cmd",
".",
"_check_compiler",
"(",
")",
"body",
"=",
"textwrap",
".",
"dedent",
"(",
"\"\"\"\n #include<%s>\n int ... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/distutils/command/autodist.py#L85-L104 | |
yuxng/PoseCNN | 9f3dd7b7bce21dcafc05e8f18ccc90da3caabd04 | lib/datasets/sym.py | python | sym.label_path_from_index | (self, index) | return label_path | Construct an metadata path from the image's "index" identifier. | Construct an metadata path from the image's "index" identifier. | [
"Construct",
"an",
"metadata",
"path",
"from",
"the",
"image",
"s",
"index",
"identifier",
"."
] | def label_path_from_index(self, index):
"""
Construct an metadata path from the image's "index" identifier.
"""
label_path = os.path.join(self._data_path, index + '-label' + self._image_ext)
assert os.path.exists(label_path), \
'Path does not exist: {}'.format(lab... | [
"def",
"label_path_from_index",
"(",
"self",
",",
"index",
")",
":",
"label_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"_data_path",
",",
"index",
"+",
"'-label'",
"+",
"self",
".",
"_image_ext",
")",
"assert",
"os",
".",
"path",
"."... | https://github.com/yuxng/PoseCNN/blob/9f3dd7b7bce21dcafc05e8f18ccc90da3caabd04/lib/datasets/sym.py#L86-L93 | |
ValveSoftware/source-sdk-2013 | 0d8dceea4310fde5706b3ce1c70609d72a38efdf | mp/src/thirdparty/protobuf-2.3.0/python/google/protobuf/internal/containers.py | python | RepeatedScalarFieldContainer.insert | (self, key, value) | Inserts the item at the specified position. Similar to list.insert(). | Inserts the item at the specified position. Similar to list.insert(). | [
"Inserts",
"the",
"item",
"at",
"the",
"specified",
"position",
".",
"Similar",
"to",
"list",
".",
"insert",
"()",
"."
] | def insert(self, key, value):
"""Inserts the item at the specified position. Similar to list.insert()."""
self._type_checker.CheckValue(value)
self._values.insert(key, value)
if not self._message_listener.dirty:
self._message_listener.Modified() | [
"def",
"insert",
"(",
"self",
",",
"key",
",",
"value",
")",
":",
"self",
".",
"_type_checker",
".",
"CheckValue",
"(",
"value",
")",
"self",
".",
"_values",
".",
"insert",
"(",
"key",
",",
"value",
")",
"if",
"not",
"self",
".",
"_message_listener",
... | https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/mp/src/thirdparty/protobuf-2.3.0/python/google/protobuf/internal/containers.py#L105-L110 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/_pydecimal.py | python | Decimal.number_class | (self, context=None) | Returns an indication of the class of self.
The class is one of the following strings:
sNaN
NaN
-Infinity
-Normal
-Subnormal
-Zero
+Zero
+Subnormal
+Normal
+Infinity | Returns an indication of the class of self. | [
"Returns",
"an",
"indication",
"of",
"the",
"class",
"of",
"self",
"."
] | def number_class(self, context=None):
"""Returns an indication of the class of self.
The class is one of the following strings:
sNaN
NaN
-Infinity
-Normal
-Subnormal
-Zero
+Zero
+Subnormal
+Normal
+Infin... | [
"def",
"number_class",
"(",
"self",
",",
"context",
"=",
"None",
")",
":",
"if",
"self",
".",
"is_snan",
"(",
")",
":",
"return",
"\"sNaN\"",
"if",
"self",
".",
"is_qnan",
"(",
")",
":",
"return",
"\"NaN\"",
"inf",
"=",
"self",
".",
"_isinfinity",
"(... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/_pydecimal.py#L3590-L3630 | ||
deepmind/open_spiel | 4ca53bea32bb2875c7385d215424048ae92f78c8 | open_spiel/python/algorithms/fictitious_play.py | python | _full_best_response_policy | (br_infoset_dict) | return wrap | Turns a dictionary of best response action selections into a full policy.
Args:
br_infoset_dict: A dictionary mapping information state to a best response
action.
Returns:
A function `state` -> list of (action, prob) | Turns a dictionary of best response action selections into a full policy. | [
"Turns",
"a",
"dictionary",
"of",
"best",
"response",
"action",
"selections",
"into",
"a",
"full",
"policy",
"."
] | def _full_best_response_policy(br_infoset_dict):
"""Turns a dictionary of best response action selections into a full policy.
Args:
br_infoset_dict: A dictionary mapping information state to a best response
action.
Returns:
A function `state` -> list of (action, prob)
"""
def wrap(state):
... | [
"def",
"_full_best_response_policy",
"(",
"br_infoset_dict",
")",
":",
"def",
"wrap",
"(",
"state",
")",
":",
"infostate_key",
"=",
"state",
".",
"information_state_string",
"(",
"state",
".",
"current_player",
"(",
")",
")",
"br_action",
"=",
"br_infoset_dict",
... | https://github.com/deepmind/open_spiel/blob/4ca53bea32bb2875c7385d215424048ae92f78c8/open_spiel/python/algorithms/fictitious_play.py#L79-L98 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | third_party/closure_linter/closure_linter/statetracker.py | python | DocComment.__init__ | (self, start_token) | Create the doc comment object.
Args:
start_token: The first token in the doc comment. | Create the doc comment object. | [
"Create",
"the",
"doc",
"comment",
"object",
"."
] | def __init__(self, start_token):
"""Create the doc comment object.
Args:
start_token: The first token in the doc comment.
"""
self.__params = {}
self.ordered_params = []
self.__flags = {}
self.start_token = start_token
self.end_token = None
self.suppressions = {}
self.inva... | [
"def",
"__init__",
"(",
"self",
",",
"start_token",
")",
":",
"self",
".",
"__params",
"=",
"{",
"}",
"self",
".",
"ordered_params",
"=",
"[",
"]",
"self",
".",
"__flags",
"=",
"{",
"}",
"self",
".",
"start_token",
"=",
"start_token",
"self",
".",
"e... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/third_party/closure_linter/closure_linter/statetracker.py#L225-L237 | ||
LiquidPlayer/LiquidCore | 9405979363f2353ac9a71ad8ab59685dd7f919c9 | deps/node-10.15.3/deps/v8/third_party/jinja2/filters.py | python | do_min | (environment, value, case_sensitive=False, attribute=None) | return _min_or_max(environment, value, min, case_sensitive, attribute) | Return the smallest item from the sequence.
.. sourcecode:: jinja
{{ [1, 2, 3]|min }}
-> 1
:param case_sensitive: Treat upper and lower case strings as distinct.
:param attribute: Get the object with the max value of this attribute. | Return the smallest item from the sequence. | [
"Return",
"the",
"smallest",
"item",
"from",
"the",
"sequence",
"."
] | def do_min(environment, value, case_sensitive=False, attribute=None):
"""Return the smallest item from the sequence.
.. sourcecode:: jinja
{{ [1, 2, 3]|min }}
-> 1
:param case_sensitive: Treat upper and lower case strings as distinct.
:param attribute: Get the object with the max ... | [
"def",
"do_min",
"(",
"environment",
",",
"value",
",",
"case_sensitive",
"=",
"False",
",",
"attribute",
"=",
"None",
")",
":",
"return",
"_min_or_max",
"(",
"environment",
",",
"value",
",",
"min",
",",
"case_sensitive",
",",
"attribute",
")"
] | https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/node-10.15.3/deps/v8/third_party/jinja2/filters.py#L326-L337 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/combotreebox.py | python | BaseComboTreeBox.Clear | (self) | return self._tree.DeleteAllItems() | Removes all items from the control. | Removes all items from the control. | [
"Removes",
"all",
"items",
"from",
"the",
"control",
"."
] | def Clear(self):
"""Removes all items from the control."""
return self._tree.DeleteAllItems() | [
"def",
"Clear",
"(",
"self",
")",
":",
"return",
"self",
".",
"_tree",
".",
"DeleteAllItems",
"(",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/combotreebox.py#L537-L539 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_misc.py | python | SingleInstanceChecker.__init__ | (self, *args, **kwargs) | __init__(self, String name, String path=EmptyString) -> SingleInstanceChecker | __init__(self, String name, String path=EmptyString) -> SingleInstanceChecker | [
"__init__",
"(",
"self",
"String",
"name",
"String",
"path",
"=",
"EmptyString",
")",
"-",
">",
"SingleInstanceChecker"
] | def __init__(self, *args, **kwargs):
"""__init__(self, String name, String path=EmptyString) -> SingleInstanceChecker"""
_misc_.SingleInstanceChecker_swiginit(self,_misc_.new_SingleInstanceChecker(*args, **kwargs)) | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_misc_",
".",
"SingleInstanceChecker_swiginit",
"(",
"self",
",",
"_misc_",
".",
"new_SingleInstanceChecker",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_misc.py#L969-L971 | ||
p4lang/p4c | 3272e79369f20813cc1a555a5eb26f44432f84a4 | tools/cpplint.py | python | _CppLintState.SetQuiet | (self, quiet) | return last_quiet | Sets the module's quiet settings, and returns the previous setting. | Sets the module's quiet settings, and returns the previous setting. | [
"Sets",
"the",
"module",
"s",
"quiet",
"settings",
"and",
"returns",
"the",
"previous",
"setting",
"."
] | def SetQuiet(self, quiet):
"""Sets the module's quiet settings, and returns the previous setting."""
last_quiet = self.quiet
self.quiet = quiet
return last_quiet | [
"def",
"SetQuiet",
"(",
"self",
",",
"quiet",
")",
":",
"last_quiet",
"=",
"self",
".",
"quiet",
"self",
".",
"quiet",
"=",
"quiet",
"return",
"last_quiet"
] | https://github.com/p4lang/p4c/blob/3272e79369f20813cc1a555a5eb26f44432f84a4/tools/cpplint.py#L1280-L1284 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | build/landmine_utils.py | python | builder | () | Returns a string representing the build engine (not compiler) to use.
Possible values: 'make', 'ninja', 'xcode', 'msvs', 'scons' | Returns a string representing the build engine (not compiler) to use.
Possible values: 'make', 'ninja', 'xcode', 'msvs', 'scons' | [
"Returns",
"a",
"string",
"representing",
"the",
"build",
"engine",
"(",
"not",
"compiler",
")",
"to",
"use",
".",
"Possible",
"values",
":",
"make",
"ninja",
"xcode",
"msvs",
"scons"
] | def builder():
"""
Returns a string representing the build engine (not compiler) to use.
Possible values: 'make', 'ninja', 'xcode', 'msvs', 'scons'
"""
if 'GYP_GENERATORS' in os.environ:
# for simplicity, only support the first explicit generator
generator = os.environ['GYP_GENERATORS'].split(',')[0]
... | [
"def",
"builder",
"(",
")",
":",
"if",
"'GYP_GENERATORS'",
"in",
"os",
".",
"environ",
":",
"# for simplicity, only support the first explicit generator",
"generator",
"=",
"os",
".",
"environ",
"[",
"'GYP_GENERATORS'",
"]",
".",
"split",
"(",
"','",
")",
"[",
"... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/build/landmine_utils.py#L87-L114 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_core.py | python | SizerItem.IsWindow | (*args, **kwargs) | return _core_.SizerItem_IsWindow(*args, **kwargs) | IsWindow(self) -> bool
Is this sizer item a window? | IsWindow(self) -> bool | [
"IsWindow",
"(",
"self",
")",
"-",
">",
"bool"
] | def IsWindow(*args, **kwargs):
"""
IsWindow(self) -> bool
Is this sizer item a window?
"""
return _core_.SizerItem_IsWindow(*args, **kwargs) | [
"def",
"IsWindow",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"SizerItem_IsWindow",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_core.py#L14165-L14171 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/learn/python/learn/learn_runner.py | python | _get_default_schedule | (config) | Returns the default schedule for the provided RunConfig. | Returns the default schedule for the provided RunConfig. | [
"Returns",
"the",
"default",
"schedule",
"for",
"the",
"provided",
"RunConfig",
"."
] | def _get_default_schedule(config):
"""Returns the default schedule for the provided RunConfig."""
if not config or not _is_distributed(config):
return 'train_and_evaluate'
if not config.task_type:
raise ValueError('Must specify a schedule')
if config.task_type == run_config_lib.TaskType.MASTER:
# ... | [
"def",
"_get_default_schedule",
"(",
"config",
")",
":",
"if",
"not",
"config",
"or",
"not",
"_is_distributed",
"(",
"config",
")",
":",
"return",
"'train_and_evaluate'",
"if",
"not",
"config",
".",
"task_type",
":",
"raise",
"ValueError",
"(",
"'Must specify a ... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/learn/python/learn/learn_runner.py#L280-L297 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/importlib/_bootstrap_external.py | python | _find_module_shim | (self, fullname) | return loader | Try to find a loader for the specified module by delegating to
self.find_loader().
This method is deprecated in favor of finder.find_spec(). | Try to find a loader for the specified module by delegating to
self.find_loader(). | [
"Try",
"to",
"find",
"a",
"loader",
"for",
"the",
"specified",
"module",
"by",
"delegating",
"to",
"self",
".",
"find_loader",
"()",
"."
] | def _find_module_shim(self, fullname):
"""Try to find a loader for the specified module by delegating to
self.find_loader().
This method is deprecated in favor of finder.find_spec().
"""
# Call find_loader(). If it returns a string (indicating this
# is a namespace package portion), generate a... | [
"def",
"_find_module_shim",
"(",
"self",
",",
"fullname",
")",
":",
"# Call find_loader(). If it returns a string (indicating this",
"# is a namespace package portion), generate a warning and",
"# return None.",
"loader",
",",
"portions",
"=",
"self",
".",
"find_loader",
"(",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/importlib/_bootstrap_external.py#L421-L435 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/setuptools/command/easy_install.py | python | expand_paths | (inputs) | Yield sys.path directories that might contain "old-style" packages | Yield sys.path directories that might contain "old-style" packages | [
"Yield",
"sys",
".",
"path",
"directories",
"that",
"might",
"contain",
"old",
"-",
"style",
"packages"
] | def expand_paths(inputs):
"""Yield sys.path directories that might contain "old-style" packages"""
seen = {}
for dirname in inputs:
dirname = normalize_path(dirname)
if dirname in seen:
continue
seen[dirname] = 1
if not os.path.isdir(dirname):
conti... | [
"def",
"expand_paths",
"(",
"inputs",
")",
":",
"seen",
"=",
"{",
"}",
"for",
"dirname",
"in",
"inputs",
":",
"dirname",
"=",
"normalize_path",
"(",
"dirname",
")",
"if",
"dirname",
"in",
"seen",
":",
"continue",
"seen",
"[",
"dirname",
"]",
"=",
"1",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/setuptools/command/easy_install.py#L1452-L1490 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/ogl/_basic.py | python | Shape.SetShadowMode | (self, mode, redraw = False) | Set the shadow mode (whether a shadow is drawn or not).
mode can be one of the following:
SHADOW_NONE
No shadow (the default).
SHADOW_LEFT
Shadow on the left side.
SHADOW_RIGHT
Shadow on the right side. | Set the shadow mode (whether a shadow is drawn or not).
mode can be one of the following: | [
"Set",
"the",
"shadow",
"mode",
"(",
"whether",
"a",
"shadow",
"is",
"drawn",
"or",
"not",
")",
".",
"mode",
"can",
"be",
"one",
"of",
"the",
"following",
":"
] | def SetShadowMode(self, mode, redraw = False):
"""Set the shadow mode (whether a shadow is drawn or not).
mode can be one of the following:
SHADOW_NONE
No shadow (the default).
SHADOW_LEFT
Shadow on the left side.
SHADOW_RIGHT
Shadow on the right ... | [
"def",
"SetShadowMode",
"(",
"self",
",",
"mode",
",",
"redraw",
"=",
"False",
")",
":",
"if",
"redraw",
"and",
"self",
".",
"GetCanvas",
"(",
")",
":",
"dc",
"=",
"wx",
".",
"ClientDC",
"(",
"self",
".",
"GetCanvas",
"(",
")",
")",
"self",
".",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/ogl/_basic.py#L379-L397 | ||
limbo018/DREAMPlace | 146c3b9fd003d1acd52c96d9fd02e3f0a05154e4 | dreamplace/ops/macro_legalize/macro_legalize.py | python | MacroLegalize.__call__ | (self, init_pos, pos) | return MacroLegalizeFunction.forward(
init_pos,
pos,
node_size_x=self.node_size_x,
node_size_y=self.node_size_y,
node_weights=self.node_weights,
flat_region_boxes=self.flat_region_boxes,
flat_region_boxes_start=self.flat_region_boxes_st... | @param init_pos the reference position for displacement minization
@param pos current roughly legal position | [] | def __call__(self, init_pos, pos):
"""
@param init_pos the reference position for displacement minization
@param pos current roughly legal position
"""
return MacroLegalizeFunction.forward(
init_pos,
pos,
node_size_x=self.node_size_x,
... | [
"def",
"__call__",
"(",
"self",
",",
"init_pos",
",",
"pos",
")",
":",
"return",
"MacroLegalizeFunction",
".",
"forward",
"(",
"init_pos",
",",
"pos",
",",
"node_size_x",
"=",
"self",
".",
"node_size_x",
",",
"node_size_y",
"=",
"self",
".",
"node_size_y",
... | https://github.com/limbo018/DREAMPlace/blob/146c3b9fd003d1acd52c96d9fd02e3f0a05154e4/dreamplace/ops/macro_legalize/macro_legalize.py#L68-L93 | ||
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/python/ops/control_flow_grad.py | python | _MergeGrad | (op, grad, _) | Gradients for a Merge op are calculated using a Switch op. | Gradients for a Merge op are calculated using a Switch op. | [
"Gradients",
"for",
"a",
"Merge",
"op",
"are",
"calculated",
"using",
"a",
"Switch",
"op",
"."
] | def _MergeGrad(op, grad, _):
"""Gradients for a Merge op are calculated using a Switch op."""
input_op = op.inputs[0].op
graph = ops.get_default_graph()
# pylint: disable=protected-access
op_ctxt = input_op._get_control_flow_context()
grad_ctxt = graph._get_control_flow_context()
# pylint: enable=protecte... | [
"def",
"_MergeGrad",
"(",
"op",
",",
"grad",
",",
"_",
")",
":",
"input_op",
"=",
"op",
".",
"inputs",
"[",
"0",
"]",
".",
"op",
"graph",
"=",
"ops",
".",
"get_default_graph",
"(",
")",
"# pylint: disable=protected-access",
"op_ctxt",
"=",
"input_op",
".... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/python/ops/control_flow_grad.py#L81-L122 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/compiler/xla/jit.py | python | experimental_jit_scope | (compile_ops=True, separate_compiled_gradients=False) | Enable or disable JIT compilation of operators within the scope.
NOTE: This is an experimental feature.
The compilation is a hint and only supported on a best-effort basis.
Example usage:
```python
with tf.xla.experimental.jit_scope():
c = tf.matmul(a, b) # compiled
with tf.xla.experimental... | Enable or disable JIT compilation of operators within the scope. | [
"Enable",
"or",
"disable",
"JIT",
"compilation",
"of",
"operators",
"within",
"the",
"scope",
"."
] | def experimental_jit_scope(compile_ops=True, separate_compiled_gradients=False):
"""Enable or disable JIT compilation of operators within the scope.
NOTE: This is an experimental feature.
The compilation is a hint and only supported on a best-effort basis.
Example usage:
```python
with tf.xla.experi... | [
"def",
"experimental_jit_scope",
"(",
"compile_ops",
"=",
"True",
",",
"separate_compiled_gradients",
"=",
"False",
")",
":",
"if",
"context",
".",
"executing_eagerly",
"(",
")",
":",
"raise",
"RuntimeError",
"(",
"\"xla.experimental.jit_scope is not supported when eager ... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/compiler/xla/jit.py#L38-L156 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | buildtools/checkdeps/checkdeps.py | python | DepsChecker.Report | (self) | return 0 | Prints a report of results, and returns an exit code for the process. | Prints a report of results, and returns an exit code for the process. | [
"Prints",
"a",
"report",
"of",
"results",
"and",
"returns",
"an",
"exit",
"code",
"for",
"the",
"process",
"."
] | def Report(self):
"""Prints a report of results, and returns an exit code for the process."""
if self.results_formatter.GetResults():
self.results_formatter.PrintResults()
return 1
print '\nSUCCESS\n'
return 0 | [
"def",
"Report",
"(",
"self",
")",
":",
"if",
"self",
".",
"results_formatter",
".",
"GetResults",
"(",
")",
":",
"self",
".",
"results_formatter",
".",
"PrintResults",
"(",
")",
"return",
"1",
"print",
"'\\nSUCCESS\\n'",
"return",
"0"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/buildtools/checkdeps/checkdeps.py#L63-L69 | |
shogun-toolbox/shogun | 9b8d856971af5a295dd6ad70623ae45647a6334c | applications/easysvm/splicesites/utils.py | python | take_subset | (strings, lab, max_pos=200, max_neg=2000) | return (strings,lab) | Take a subset of the classes to the maximum numbers determined by
max_pos and max_neg | Take a subset of the classes to the maximum numbers determined by
max_pos and max_neg | [
"Take",
"a",
"subset",
"of",
"the",
"classes",
"to",
"the",
"maximum",
"numbers",
"determined",
"by",
"max_pos",
"and",
"max_neg"
] | def take_subset(strings, lab, max_pos=200, max_neg=2000):
"""Take a subset of the classes to the maximum numbers determined by
max_pos and max_neg
"""
random.seed(123456789)
pos_idx = where(lab>0)[0]
neg_idx = where(lab<0)[0]
num_pos = len(pos_idx)
num_neg = len(neg_idx)
assert(num... | [
"def",
"take_subset",
"(",
"strings",
",",
"lab",
",",
"max_pos",
"=",
"200",
",",
"max_neg",
"=",
"2000",
")",
":",
"random",
".",
"seed",
"(",
"123456789",
")",
"pos_idx",
"=",
"where",
"(",
"lab",
">",
"0",
")",
"[",
"0",
"]",
"neg_idx",
"=",
... | https://github.com/shogun-toolbox/shogun/blob/9b8d856971af5a295dd6ad70623ae45647a6334c/applications/easysvm/splicesites/utils.py#L142-L167 | |
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/python/blessings/blessings/__init__.py | python | split_into_formatters | (compound) | return merged_segs | Split a possibly compound format string into segments.
>>> split_into_formatters('bold_underline_bright_blue_on_red')
['bold', 'underline', 'bright_blue', 'on_red'] | Split a possibly compound format string into segments. | [
"Split",
"a",
"possibly",
"compound",
"format",
"string",
"into",
"segments",
"."
] | def split_into_formatters(compound):
"""Split a possibly compound format string into segments.
>>> split_into_formatters('bold_underline_bright_blue_on_red')
['bold', 'underline', 'bright_blue', 'on_red']
"""
merged_segs = []
# These occur only as prefixes, so they can always be merged:
me... | [
"def",
"split_into_formatters",
"(",
"compound",
")",
":",
"merged_segs",
"=",
"[",
"]",
"# These occur only as prefixes, so they can always be merged:",
"mergeable_prefixes",
"=",
"[",
"'on'",
",",
"'bright'",
",",
"'on_bright'",
"]",
"for",
"s",
"in",
"compound",
".... | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/python/blessings/blessings/__init__.py#L414-L429 | |
acado/acado | b4e28f3131f79cadfd1a001e9fff061f361d3a0f | misc/cpplint.py | python | GetPreviousNonBlankLine | (clean_lines, linenum) | return ('', -1) | Return the most recent non-blank line and its line number.
Args:
clean_lines: A CleansedLines instance containing the file contents.
linenum: The number of the line to check.
Returns:
A tuple with two elements. The first element is the contents of the last
non-blank line before the current line, ... | Return the most recent non-blank line and its line number. | [
"Return",
"the",
"most",
"recent",
"non",
"-",
"blank",
"line",
"and",
"its",
"line",
"number",
"."
] | def GetPreviousNonBlankLine(clean_lines, linenum):
"""Return the most recent non-blank line and its line number.
Args:
clean_lines: A CleansedLines instance containing the file contents.
linenum: The number of the line to check.
Returns:
A tuple with two elements. The first element is the contents ... | [
"def",
"GetPreviousNonBlankLine",
"(",
"clean_lines",
",",
"linenum",
")",
":",
"prevlinenum",
"=",
"linenum",
"-",
"1",
"while",
"prevlinenum",
">=",
"0",
":",
"prevline",
"=",
"clean_lines",
".",
"elided",
"[",
"prevlinenum",
"]",
"if",
"not",
"IsBlankLine",... | https://github.com/acado/acado/blob/b4e28f3131f79cadfd1a001e9fff061f361d3a0f/misc/cpplint.py#L2938-L2958 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.