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/scipy/py2/scipy/stats/stats.py | python | _iqr_nanpercentile | (x, q, axis=None, interpolation='linear', keepdims=False,
contains_nan=False) | return result | Private wrapper that works around the following:
1. A bug in `np.nanpercentile` that was around until numpy version
1.11.0.
2. A bug in `np.percentile` NaN handling that was fixed in numpy
version 1.10.0.
3. The non-existence of `np.nanpercentile` before numpy version
1.9.0... | Private wrapper that works around the following: | [
"Private",
"wrapper",
"that",
"works",
"around",
"the",
"following",
":"
] | def _iqr_nanpercentile(x, q, axis=None, interpolation='linear', keepdims=False,
contains_nan=False):
"""
Private wrapper that works around the following:
1. A bug in `np.nanpercentile` that was around until numpy version
1.11.0.
2. A bug in `np.percentile` NaN handli... | [
"def",
"_iqr_nanpercentile",
"(",
"x",
",",
"q",
",",
"axis",
"=",
"None",
",",
"interpolation",
"=",
"'linear'",
",",
"keepdims",
"=",
"False",
",",
"contains_nan",
"=",
"False",
")",
":",
"if",
"hasattr",
"(",
"np",
",",
"'nanpercentile'",
")",
":",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/stats/stats.py#L2557-L2598 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/dispatcher.py | python | _DispatcherBase._compile_for_args | (self, *args, **kws) | For internal use. Compile a specialized version of the function
for the given *args* and *kws*, and return the resulting callable. | For internal use. Compile a specialized version of the function
for the given *args* and *kws*, and return the resulting callable. | [
"For",
"internal",
"use",
".",
"Compile",
"a",
"specialized",
"version",
"of",
"the",
"function",
"for",
"the",
"given",
"*",
"args",
"*",
"and",
"*",
"kws",
"*",
"and",
"return",
"the",
"resulting",
"callable",
"."
] | def _compile_for_args(self, *args, **kws):
"""
For internal use. Compile a specialized version of the function
for the given *args* and *kws*, and return the resulting callable.
"""
assert not kws
def error_rewrite(e, issue_type):
"""
Rewrite and... | [
"def",
"_compile_for_args",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kws",
")",
":",
"assert",
"not",
"kws",
"def",
"error_rewrite",
"(",
"e",
",",
"issue_type",
")",
":",
"\"\"\"\n Rewrite and raise Exception `e` with help supplied based on the\n ... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/dispatcher.py#L326-L420 | ||
arangodb/arangodb | 0d658689c7d1b721b314fa3ca27d38303e1570c8 | 3rdParty/rocksdb/6.29/tools/block_cache_analyzer/block_cache_pysim.py | python | PQTable.pqinsert | (self, entry) | return removed_entry | Add a new key or update the priority of an existing key | Add a new key or update the priority of an existing key | [
"Add",
"a",
"new",
"key",
"or",
"update",
"the",
"priority",
"of",
"an",
"existing",
"key"
] | def pqinsert(self, entry):
"Add a new key or update the priority of an existing key"
# Remove the entry from the table first.
removed_entry = self.table.pop(entry.key, None)
if removed_entry:
# Mark as removed since there is no 'remove' API in heappq.
# Instead, a... | [
"def",
"pqinsert",
"(",
"self",
",",
"entry",
")",
":",
"# Remove the entry from the table first.",
"removed_entry",
"=",
"self",
".",
"table",
".",
"pop",
"(",
"entry",
".",
"key",
",",
"None",
")",
"if",
"removed_entry",
":",
"# Mark as removed since there is no... | https://github.com/arangodb/arangodb/blob/0d658689c7d1b721b314fa3ca27d38303e1570c8/3rdParty/rocksdb/6.29/tools/block_cache_analyzer/block_cache_pysim.py#L1142-L1152 | |
cvxpy/cvxpy | 5165b4fb750dfd237de8659383ef24b4b2e33aaf | cvxpy/atoms/affine/unary_operators.py | python | NegExpression.graph_implementation | (
self, arg_objs, shape: Tuple[int, ...], data=None
) | return (lu.neg_expr(arg_objs[0]), []) | Negate the affine objective.
Parameters
----------
arg_objs : list
LinExpr for each argument.
shape : tuple
The shape of the resulting expression.
data :
Additional data required by the atom.
Returns
-------
tuple
... | Negate the affine objective. | [
"Negate",
"the",
"affine",
"objective",
"."
] | def graph_implementation(
self, arg_objs, shape: Tuple[int, ...], data=None
) -> Tuple[lo.LinOp, List[Constraint]]:
"""Negate the affine objective.
Parameters
----------
arg_objs : list
LinExpr for each argument.
shape : tuple
The shape of the... | [
"def",
"graph_implementation",
"(",
"self",
",",
"arg_objs",
",",
"shape",
":",
"Tuple",
"[",
"int",
",",
"...",
"]",
",",
"data",
"=",
"None",
")",
"->",
"Tuple",
"[",
"lo",
".",
"LinOp",
",",
"List",
"[",
"Constraint",
"]",
"]",
":",
"return",
"(... | https://github.com/cvxpy/cvxpy/blob/5165b4fb750dfd237de8659383ef24b4b2e33aaf/cvxpy/atoms/affine/unary_operators.py#L77-L96 | |
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Path/PathScripts/PathUtils.py | python | findToolController | (obj, proxy, name=None) | return tc | returns a tool controller with a given name.
If no name is specified, returns the first controller.
if no controller is found, returns None | returns a tool controller with a given name.
If no name is specified, returns the first controller.
if no controller is found, returns None | [
"returns",
"a",
"tool",
"controller",
"with",
"a",
"given",
"name",
".",
"If",
"no",
"name",
"is",
"specified",
"returns",
"the",
"first",
"controller",
".",
"if",
"no",
"controller",
"is",
"found",
"returns",
"None"
] | def findToolController(obj, proxy, name=None):
"""returns a tool controller with a given name.
If no name is specified, returns the first controller.
if no controller is found, returns None"""
PathLog.track("name: {}".format(name))
c = None
if UserInput:
c = UserInput.selectedToolContro... | [
"def",
"findToolController",
"(",
"obj",
",",
"proxy",
",",
"name",
"=",
"None",
")",
":",
"PathLog",
".",
"track",
"(",
"\"name: {}\"",
".",
"format",
"(",
"name",
")",
")",
"c",
"=",
"None",
"if",
"UserInput",
":",
"c",
"=",
"UserInput",
".",
"sele... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Path/PathScripts/PathUtils.py#L363-L390 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py2/numpy/lib/nanfunctions.py | python | _nanquantile_1d | (arr1d, q, overwrite_input=False, interpolation='linear') | return function_base._quantile_unchecked(
arr1d, q, overwrite_input=overwrite_input, interpolation=interpolation) | Private function for rank 1 arrays. Compute quantile ignoring NaNs.
See nanpercentile for parameter usage | Private function for rank 1 arrays. Compute quantile ignoring NaNs.
See nanpercentile for parameter usage | [
"Private",
"function",
"for",
"rank",
"1",
"arrays",
".",
"Compute",
"quantile",
"ignoring",
"NaNs",
".",
"See",
"nanpercentile",
"for",
"parameter",
"usage"
] | def _nanquantile_1d(arr1d, q, overwrite_input=False, interpolation='linear'):
"""
Private function for rank 1 arrays. Compute quantile ignoring NaNs.
See nanpercentile for parameter usage
"""
arr1d, overwrite_input = _remove_nan_1d(arr1d,
overwrite_input=overwrite_input)
if arr1d.size ==... | [
"def",
"_nanquantile_1d",
"(",
"arr1d",
",",
"q",
",",
"overwrite_input",
"=",
"False",
",",
"interpolation",
"=",
"'linear'",
")",
":",
"arr1d",
",",
"overwrite_input",
"=",
"_remove_nan_1d",
"(",
"arr1d",
",",
"overwrite_input",
"=",
"overwrite_input",
")",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py2/numpy/lib/nanfunctions.py#L1366-L1377 | |
gimli-org/gimli | 17aa2160de9b15ababd9ef99e89b1bc3277bbb23 | pygimli/utils/cache.py | python | CacheManager.cache | (self, funct, *args, **kwargs) | return cached | Create a unique cache | Create a unique cache | [
"Create",
"a",
"unique",
"cache"
] | def cache(self, funct, *args, **kwargs):
""" Create a unique cache """
hashVal = self.hash(funct, *args, **kwargs)
cached = Cache(hashVal)
cached.info['codeinfo'] = self.functInfo(funct)
cached.info['version'] = pg.versionStr()
cached.info['args'] = str(args)
cac... | [
"def",
"cache",
"(",
"self",
",",
"funct",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"hashVal",
"=",
"self",
".",
"hash",
"(",
"funct",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"cached",
"=",
"Cache",
"(",
"hashVal",
")",
"cac... | https://github.com/gimli-org/gimli/blob/17aa2160de9b15ababd9ef99e89b1bc3277bbb23/pygimli/utils/cache.py#L215-L225 | |
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/python/ops/nn_grad.py | python | _BiasAddGradV1 | (unused_bias_op, received_grad) | return (received_grad, math_ops.reduce_sum(received_grad,
reduction_dim_tensor)) | Return the gradients for the 2 inputs of bias_op.
The first input of unused_bias_op is the tensor t, and its gradient is
just the gradient the unused_bias_op received.
The second input of unused_bias_op is the bias vector which has one fewer
dimension than "received_grad" (the batch dimension.) Its gradient ... | Return the gradients for the 2 inputs of bias_op. | [
"Return",
"the",
"gradients",
"for",
"the",
"2",
"inputs",
"of",
"bias_op",
"."
] | def _BiasAddGradV1(unused_bias_op, received_grad):
"""Return the gradients for the 2 inputs of bias_op.
The first input of unused_bias_op is the tensor t, and its gradient is
just the gradient the unused_bias_op received.
The second input of unused_bias_op is the bias vector which has one fewer
dimension th... | [
"def",
"_BiasAddGradV1",
"(",
"unused_bias_op",
",",
"received_grad",
")",
":",
"reduction_dim_tensor",
"=",
"math_ops",
".",
"range",
"(",
"array_ops",
".",
"rank",
"(",
"received_grad",
")",
"-",
"1",
")",
"return",
"(",
"received_grad",
",",
"math_ops",
"."... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/python/ops/nn_grad.py#L208-L228 | |
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | python/mxnet/ndarray/ndarray.py | python | greater | (lhs, rhs) | return _ufunc_helper(
lhs,
rhs,
op.broadcast_greater,
lambda x, y: 1 if x > y else 0,
_internal._greater_scalar,
_internal._lesser_scalar) | Returns the result of element-wise **greater than** (>) comparison operation
with broadcasting.
For each element in input arrays, return 1(true) if lhs elements are greater than rhs,
otherwise return 0(false).
Equivalent to ``lhs > rhs`` and ``mx.nd.broadcast_greater(lhs, rhs)``.
.. note::
... | Returns the result of element-wise **greater than** (>) comparison operation
with broadcasting. | [
"Returns",
"the",
"result",
"of",
"element",
"-",
"wise",
"**",
"greater",
"than",
"**",
"(",
">",
")",
"comparison",
"operation",
"with",
"broadcasting",
"."
] | def greater(lhs, rhs):
"""Returns the result of element-wise **greater than** (>) comparison operation
with broadcasting.
For each element in input arrays, return 1(true) if lhs elements are greater than rhs,
otherwise return 0(false).
Equivalent to ``lhs > rhs`` and ``mx.nd.broadcast_greater(lhs,... | [
"def",
"greater",
"(",
"lhs",
",",
"rhs",
")",
":",
"# pylint: disable= no-member, protected-access",
"return",
"_ufunc_helper",
"(",
"lhs",
",",
"rhs",
",",
"op",
".",
"broadcast_greater",
",",
"lambda",
"x",
",",
"y",
":",
"1",
"if",
"x",
">",
"y",
"else... | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/python/mxnet/ndarray/ndarray.py#L3340-L3400 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/py/sliceshell.py | python | SlicesShell.OnCallTipAutoCompleteManually | (self, shiftDown) | AutoComplete and Calltips manually. | AutoComplete and Calltips manually. | [
"AutoComplete",
"and",
"Calltips",
"manually",
"."
] | def OnCallTipAutoCompleteManually (self, shiftDown):
"""AutoComplete and Calltips manually."""
if self.AutoCompActive():
self.AutoCompCancel()
currpos = self.GetCurrentPos()
stoppos = self.PositionFromLine(self.GetIOSlice()[0])
cpos = currpos
#go back until '... | [
"def",
"OnCallTipAutoCompleteManually",
"(",
"self",
",",
"shiftDown",
")",
":",
"if",
"self",
".",
"AutoCompActive",
"(",
")",
":",
"self",
".",
"AutoCompCancel",
"(",
")",
"currpos",
"=",
"self",
".",
"GetCurrentPos",
"(",
")",
"stoppos",
"=",
"self",
".... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/py/sliceshell.py#L3095-L3140 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/propgrid.py | python | PGProperty.GetColumnEditor | (*args, **kwargs) | return _propgrid.PGProperty_GetColumnEditor(*args, **kwargs) | GetColumnEditor(self, int column) -> PGEditor | GetColumnEditor(self, int column) -> PGEditor | [
"GetColumnEditor",
"(",
"self",
"int",
"column",
")",
"-",
">",
"PGEditor"
] | def GetColumnEditor(*args, **kwargs):
"""GetColumnEditor(self, int column) -> PGEditor"""
return _propgrid.PGProperty_GetColumnEditor(*args, **kwargs) | [
"def",
"GetColumnEditor",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_propgrid",
".",
"PGProperty_GetColumnEditor",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/propgrid.py#L564-L566 | |
nasa/fprime | 595cf3682d8365943d86c1a6fe7c78f0a116acf0 | Autocoders/Python/src/fprime_ac/generators/ChannelHeader.py | python | ChannelHeader.__call__ | (self, args) | Main execution point.
Calls the accept method on each visitor to generate the code. | Main execution point.
Calls the accept method on each visitor to generate the code. | [
"Main",
"execution",
"point",
".",
"Calls",
"the",
"accept",
"method",
"on",
"each",
"visitor",
"to",
"generate",
"the",
"code",
"."
] | def __call__(self, args):
"""
Main execution point.
Calls the accept method on each visitor to generate the code.
"""
# Note that name handling for params goes
# here so that the visitor in accept can
# process all.
self.__obj = args
for v in self.... | [
"def",
"__call__",
"(",
"self",
",",
"args",
")",
":",
"# Note that name handling for params goes",
"# here so that the visitor in accept can",
"# process all.",
"self",
".",
"__obj",
"=",
"args",
"for",
"v",
"in",
"self",
".",
"__visitor_list",
":",
"self",
".",
"a... | https://github.com/nasa/fprime/blob/595cf3682d8365943d86c1a6fe7c78f0a116acf0/Autocoders/Python/src/fprime_ac/generators/ChannelHeader.py#L57-L67 | ||
kismetwireless/kismet | a7c0dc270c960fb1f58bd9cec4601c201885fd4e | capture_sdr_rtl433/KismetCaptureRtl433/kismetexternal/__init__.py | python | Datasource.send_datasource_data_report | (self, message=None, warning=None, full_gps=None, full_signal=None, full_packet=None,
full_spectrum=None, full_json=None, full_buffer=None, **kwargs) | When operating as a Kismet datasource, send a data frame
:param message: Optional message
:param warning: Optional warning to be included in the datasource details
:param full_gps: Optional full datasource_pb2.SubGps record
:param full_signal: Optional full datasource_pb2.SubSignal reco... | When operating as a Kismet datasource, send a data frame | [
"When",
"operating",
"as",
"a",
"Kismet",
"datasource",
"send",
"a",
"data",
"frame"
] | def send_datasource_data_report(self, message=None, warning=None, full_gps=None, full_signal=None, full_packet=None,
full_spectrum=None, full_json=None, full_buffer=None, **kwargs):
"""
When operating as a Kismet datasource, send a data frame
:param message: ... | [
"def",
"send_datasource_data_report",
"(",
"self",
",",
"message",
"=",
"None",
",",
"warning",
"=",
"None",
",",
"full_gps",
"=",
"None",
",",
"full_signal",
"=",
"None",
",",
"full_packet",
"=",
"None",
",",
"full_spectrum",
"=",
"None",
",",
"full_json",
... | https://github.com/kismetwireless/kismet/blob/a7c0dc270c960fb1f58bd9cec4601c201885fd4e/capture_sdr_rtl433/KismetCaptureRtl433/kismetexternal/__init__.py#L1233-L1277 | ||
deepmodeling/deepmd-kit | 159e45d248b0429844fb6a8cb3b3a201987c8d79 | deepmd/utils/path.py | python | DPH5Path._load_h5py | (cls, path: str) | return h5py.File(path, 'r') | Load hdf5 file.
Parameters
----------
path : str
path to hdf5 file | Load hdf5 file.
Parameters
----------
path : str
path to hdf5 file | [
"Load",
"hdf5",
"file",
".",
"Parameters",
"----------",
"path",
":",
"str",
"path",
"to",
"hdf5",
"file"
] | def _load_h5py(cls, path: str) -> h5py.File:
"""Load hdf5 file.
Parameters
----------
path : str
path to hdf5 file
"""
# this method has cache to avoid duplicated
# loading from different DPH5Path
# However the file will be never close... | [
"def",
"_load_h5py",
"(",
"cls",
",",
"path",
":",
"str",
")",
"->",
"h5py",
".",
"File",
":",
"# this method has cache to avoid duplicated",
"# loading from different DPH5Path",
"# However the file will be never closed?",
"return",
"h5py",
".",
"File",
"(",
"path",
","... | https://github.com/deepmodeling/deepmd-kit/blob/159e45d248b0429844fb6a8cb3b3a201987c8d79/deepmd/utils/path.py#L226-L237 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/py_compile.py | python | wr_long | (f, x) | Internal; write a 32-bit int to a file in little-endian order. | Internal; write a 32-bit int to a file in little-endian order. | [
"Internal",
";",
"write",
"a",
"32",
"-",
"bit",
"int",
"to",
"a",
"file",
"in",
"little",
"-",
"endian",
"order",
"."
] | def wr_long(f, x):
"""Internal; write a 32-bit int to a file in little-endian order."""
f.write(chr( x & 0xff))
f.write(chr((x >> 8) & 0xff))
f.write(chr((x >> 16) & 0xff))
f.write(chr((x >> 24) & 0xff)) | [
"def",
"wr_long",
"(",
"f",
",",
"x",
")",
":",
"f",
".",
"write",
"(",
"chr",
"(",
"x",
"&",
"0xff",
")",
")",
"f",
".",
"write",
"(",
"chr",
"(",
"(",
"x",
">>",
"8",
")",
"&",
"0xff",
")",
")",
"f",
".",
"write",
"(",
"chr",
"(",
"("... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/py_compile.py#L64-L69 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/tools/saved_model_cli.py | python | get_signature_def_map | (saved_model_dir, tag_set) | return meta_graph.signature_def | Gets SignatureDef map from a MetaGraphDef in a SavedModel.
Returns the SignatureDef map for the given tag-set in the SavedModel
directory.
Args:
saved_model_dir: Directory containing the SavedModel to inspect or execute.
tag_set: Group of tag(s) of the MetaGraphDef with the SignatureDef map, in
... | Gets SignatureDef map from a MetaGraphDef in a SavedModel. | [
"Gets",
"SignatureDef",
"map",
"from",
"a",
"MetaGraphDef",
"in",
"a",
"SavedModel",
"."
] | def get_signature_def_map(saved_model_dir, tag_set):
"""Gets SignatureDef map from a MetaGraphDef in a SavedModel.
Returns the SignatureDef map for the given tag-set in the SavedModel
directory.
Args:
saved_model_dir: Directory containing the SavedModel to inspect or execute.
tag_set: Group of tag(s) ... | [
"def",
"get_signature_def_map",
"(",
"saved_model_dir",
",",
"tag_set",
")",
":",
"meta_graph",
"=",
"saved_model_utils",
".",
"get_meta_graph_def",
"(",
"saved_model_dir",
",",
"tag_set",
")",
"return",
"meta_graph",
".",
"signature_def"
] | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/tools/saved_model_cli.py#L210-L226 | |
apache/impala | 8ddac48f3428c86f2cbd037ced89cfb903298b12 | bin/collect_minidumps.py | python | FileArchiver.make_tarball | (self) | Make a tarball with the maximum number of files such that the size of the tarball
is less than or equal to max_output_size. Returns a pair (status (int), message
(str)). status represents the result of the operation and follows the unix convention
where 0 equals success. message provides additional informat... | Make a tarball with the maximum number of files such that the size of the tarball
is less than or equal to max_output_size. Returns a pair (status (int), message
(str)). status represents the result of the operation and follows the unix convention
where 0 equals success. message provides additional informat... | [
"Make",
"a",
"tarball",
"with",
"the",
"maximum",
"number",
"of",
"files",
"such",
"that",
"the",
"size",
"of",
"the",
"tarball",
"is",
"less",
"than",
"or",
"equal",
"to",
"max_output_size",
".",
"Returns",
"a",
"pair",
"(",
"status",
"(",
"int",
")",
... | def make_tarball(self):
'''Make a tarball with the maximum number of files such that the size of the tarball
is less than or equal to max_output_size. Returns a pair (status (int), message
(str)). status represents the result of the operation and follows the unix convention
where 0 equals success. messa... | [
"def",
"make_tarball",
"(",
"self",
")",
":",
"self",
".",
"_compute_file_list",
"(",
")",
"if",
"len",
"(",
"self",
".",
"file_list",
")",
"==",
"0",
":",
"status",
"=",
"0",
"msg",
"=",
"'No files found in \"{0}\".'",
"return",
"status",
",",
"msg",
".... | https://github.com/apache/impala/blob/8ddac48f3428c86f2cbd037ced89cfb903298b12/bin/collect_minidumps.py#L115-L146 | ||
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/config/configobj.py | python | ConfigObj._parse | (self, infile) | Actually parse the config file. | Actually parse the config file. | [
"Actually",
"parse",
"the",
"config",
"file",
"."
] | def _parse(self, infile):
"""Actually parse the config file."""
temp_list_values = self.list_values
if self.unrepr:
self.list_values = False
comment_list = []
done_start = False
this_section = self
maxline = len(infile) - 1
cur_index = -1
... | [
"def",
"_parse",
"(",
"self",
",",
"infile",
")",
":",
"temp_list_values",
"=",
"self",
".",
"list_values",
"if",
"self",
".",
"unrepr",
":",
"self",
".",
"list_values",
"=",
"False",
"comment_list",
"=",
"[",
"]",
"done_start",
"=",
"False",
"this_section... | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/config/configobj.py#L1410-L1578 | ||
RamadhanAmizudin/malware | 2c6c53c8b0d556f5d8078d6ca0fc4448f4697cf1 | Fuzzbunch/fuzzbunch/pyreadline/modes/notemacs.py | python | NotEmacsMode.copy_forward_word | (self, e) | Copy the word following point to the kill buffer. The word
boundaries are the same as forward-word. By default, this command is
unbound. | Copy the word following point to the kill buffer. The word
boundaries are the same as forward-word. By default, this command is
unbound. | [
"Copy",
"the",
"word",
"following",
"point",
"to",
"the",
"kill",
"buffer",
".",
"The",
"word",
"boundaries",
"are",
"the",
"same",
"as",
"forward",
"-",
"word",
".",
"By",
"default",
"this",
"command",
"is",
"unbound",
"."
] | def copy_forward_word(self, e): # ()
'''Copy the word following point to the kill buffer. The word
boundaries are the same as forward-word. By default, this command is
unbound.'''
pass | [
"def",
"copy_forward_word",
"(",
"self",
",",
"e",
")",
":",
"# ()",
"pass"
] | https://github.com/RamadhanAmizudin/malware/blob/2c6c53c8b0d556f5d8078d6ca0fc4448f4697cf1/Fuzzbunch/fuzzbunch/pyreadline/modes/notemacs.py#L387-L391 | ||
kushview/Element | 1cc16380caa2ab79461246ba758b9de1f46db2a5 | waflib/TaskGen.py | python | task_gen.clone | (self, env) | return newobj | Makes a copy of a task generator. Once the copy is made, it is necessary to ensure that the
it does not create the same output files as the original, or the same files may
be compiled several times.
:param env: A configuration set
:type env: :py:class:`waflib.ConfigSet.ConfigSet`
:return: A copy
:rtype: :p... | Makes a copy of a task generator. Once the copy is made, it is necessary to ensure that the
it does not create the same output files as the original, or the same files may
be compiled several times. | [
"Makes",
"a",
"copy",
"of",
"a",
"task",
"generator",
".",
"Once",
"the",
"copy",
"is",
"made",
"it",
"is",
"necessary",
"to",
"ensure",
"that",
"the",
"it",
"does",
"not",
"create",
"the",
"same",
"output",
"files",
"as",
"the",
"original",
"or",
"the... | def clone(self, env):
"""
Makes a copy of a task generator. Once the copy is made, it is necessary to ensure that the
it does not create the same output files as the original, or the same files may
be compiled several times.
:param env: A configuration set
:type env: :py:class:`waflib.ConfigSet.ConfigSet`
... | [
"def",
"clone",
"(",
"self",
",",
"env",
")",
":",
"newobj",
"=",
"self",
".",
"bld",
"(",
")",
"for",
"x",
"in",
"self",
".",
"__dict__",
":",
"if",
"x",
"in",
"(",
"'env'",
",",
"'bld'",
")",
":",
"continue",
"elif",
"x",
"in",
"(",
"'path'",... | https://github.com/kushview/Element/blob/1cc16380caa2ab79461246ba758b9de1f46db2a5/waflib/TaskGen.py#L287-L313 | |
chuckcho/video-caffe | fc232b3e3a90ea22dd041b9fc5c542f170581f20 | tools/extra/summarize.py | python | print_table | (table, max_width) | Print a simple nicely-aligned table.
table must be a list of (equal-length) lists. Columns are space-separated,
and as narrow as possible, but no wider than max_width. Text may overflow
columns; note that unlike string.format, this will not affect subsequent
columns, if possible. | Print a simple nicely-aligned table. | [
"Print",
"a",
"simple",
"nicely",
"-",
"aligned",
"table",
"."
] | def print_table(table, max_width):
"""Print a simple nicely-aligned table.
table must be a list of (equal-length) lists. Columns are space-separated,
and as narrow as possible, but no wider than max_width. Text may overflow
columns; note that unlike string.format, this will not affect subsequent
co... | [
"def",
"print_table",
"(",
"table",
",",
"max_width",
")",
":",
"max_widths",
"=",
"[",
"max_width",
"]",
"*",
"len",
"(",
"table",
"[",
"0",
"]",
")",
"column_widths",
"=",
"[",
"max",
"(",
"printed_len",
"(",
"row",
"[",
"j",
"]",
")",
"+",
"1",
... | https://github.com/chuckcho/video-caffe/blob/fc232b3e3a90ea22dd041b9fc5c542f170581f20/tools/extra/summarize.py#L41-L61 | ||
PixarAnimationStudios/USD | faed18ce62c8736b02413635b584a2f637156bad | pxr/usdImaging/usdviewq/appController.py | python | AppController._currentPathChanged | (self) | Called when the currentPathWidget text is changed | Called when the currentPathWidget text is changed | [
"Called",
"when",
"the",
"currentPathWidget",
"text",
"is",
"changed"
] | def _currentPathChanged(self):
"""Called when the currentPathWidget text is changed"""
newPaths = self._ui.currentPathWidget.text()
pathList = re.split(", ?", newPaths)
pathList = [path for path in pathList if len(path) != 0]
try:
prims = self._getPrimsFromPaths(path... | [
"def",
"_currentPathChanged",
"(",
"self",
")",
":",
"newPaths",
"=",
"self",
".",
"_ui",
".",
"currentPathWidget",
".",
"text",
"(",
")",
"pathList",
"=",
"re",
".",
"split",
"(",
"\", ?\"",
",",
"newPaths",
")",
"pathList",
"=",
"[",
"path",
"for",
"... | https://github.com/PixarAnimationStudios/USD/blob/faed18ce62c8736b02413635b584a2f637156bad/pxr/usdImaging/usdviewq/appController.py#L3280-L3312 | ||
netket/netket | 0d534e54ecbf25b677ea72af6b85947979420652 | netket/experimental/driver/tdvp.py | python | qgt_norm | (driver: TDVP, x: PyTree) | return jnp.sqrt(jnp.real(xc_dot_y)) | Computes the norm induced by the QGT :math:`S`, i.e, :math:`x^\\dagger S x`. | Computes the norm induced by the QGT :math:`S`, i.e, :math:`x^\\dagger S x`. | [
"Computes",
"the",
"norm",
"induced",
"by",
"the",
"QGT",
":",
"math",
":",
"S",
"i",
".",
"e",
":",
"math",
":",
"x^",
"\\\\",
"dagger",
"S",
"x",
"."
] | def qgt_norm(driver: TDVP, x: PyTree):
"""
Computes the norm induced by the QGT :math:`S`, i.e, :math:`x^\\dagger S x`.
"""
y = driver._last_qgt @ x # pylint: disable=protected-access
xc_dot_y = nk.jax.tree_dot(nk.jax.tree_conj(x), y)
return jnp.sqrt(jnp.real(xc_dot_y)) | [
"def",
"qgt_norm",
"(",
"driver",
":",
"TDVP",
",",
"x",
":",
"PyTree",
")",
":",
"y",
"=",
"driver",
".",
"_last_qgt",
"@",
"x",
"# pylint: disable=protected-access",
"xc_dot_y",
"=",
"nk",
".",
"jax",
".",
"tree_dot",
"(",
"nk",
".",
"jax",
".",
"tre... | https://github.com/netket/netket/blob/0d534e54ecbf25b677ea72af6b85947979420652/netket/experimental/driver/tdvp.py#L447-L453 | |
gklz1982/caffe-yolov2 | ebb27029db4ddc0d40e520634633b0fa9cdcc10d | scripts/cpp_lint.py | python | ReverseCloseExpression | (clean_lines, linenum, pos) | return (line, 0, -1) | If input points to ) or } or ] or >, finds the position that opens it.
If lines[linenum][pos] points to a ')' or '}' or ']' or '>', finds the
linenum/pos that correspond to the opening of the expression.
Args:
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to ... | If input points to ) or } or ] or >, finds the position that opens it. | [
"If",
"input",
"points",
"to",
")",
"or",
"}",
"or",
"]",
"or",
">",
"finds",
"the",
"position",
"that",
"opens",
"it",
"."
] | def ReverseCloseExpression(clean_lines, linenum, pos):
"""If input points to ) or } or ] or >, finds the position that opens it.
If lines[linenum][pos] points to a ')' or '}' or ']' or '>', finds the
linenum/pos that correspond to the opening of the expression.
Args:
clean_lines: A CleansedLines instance ... | [
"def",
"ReverseCloseExpression",
"(",
"clean_lines",
",",
"linenum",
",",
"pos",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"endchar",
"=",
"line",
"[",
"pos",
"]",
"if",
"endchar",
"not",
"in",
"')}]>'",
":",
"return",
"("... | https://github.com/gklz1982/caffe-yolov2/blob/ebb27029db4ddc0d40e520634633b0fa9cdcc10d/scripts/cpp_lint.py#L1327-L1369 | |
echronos/echronos | c996f1d2c8af6c6536205eb319c1bf1d4d84569c | external_tools/ply_info/example/ansic/cparse.py | python | p_translation_unit_2 | (t) | translation_unit : translation_unit external_declaration | translation_unit : translation_unit external_declaration | [
"translation_unit",
":",
"translation_unit",
"external_declaration"
] | def p_translation_unit_2(t):
'translation_unit : translation_unit external_declaration'
pass | [
"def",
"p_translation_unit_2",
"(",
"t",
")",
":",
"pass"
] | https://github.com/echronos/echronos/blob/c996f1d2c8af6c6536205eb319c1bf1d4d84569c/external_tools/ply_info/example/ansic/cparse.py#L20-L22 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_vendor/distlib/locators.py | python | Locator._get_project | (self, name) | For a given project, get a dictionary mapping available versions to Distribution
instances.
This should be implemented in subclasses.
If called from a locate() request, self.matcher will be set to a
matcher for the requirement to satisfy, otherwise it will be None. | [] | def _get_project(self, name):
"""
For a given project, get a dictionary mapping available versions to Distribution
instances.
This should be implemented in subclasses.
If called from a locate() request, self.matcher will be set to a
matcher for the requirement t... | [
"def",
"_get_project",
"(",
"self",
",",
"name",
")",
":",
"raise",
"NotImplementedError",
"(",
"'Please implement in the subclass'",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_vendor/distlib/locators.py#L305-L325 | |||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/customtreectrl.py | python | GenericTreeItem.GetCheckedImage | (self, which=TreeItemIcon_Checked) | return self._checkedimages[which] | Returns the item check image.
:param integer `which`: can be one of the following bits:
================================= ========================
Item State Description
================================= ========================
``TreeItemIcon_Checked... | Returns the item check image. | [
"Returns",
"the",
"item",
"check",
"image",
"."
] | def GetCheckedImage(self, which=TreeItemIcon_Checked):
"""
Returns the item check image.
:param integer `which`: can be one of the following bits:
================================= ========================
Item State Description
===============... | [
"def",
"GetCheckedImage",
"(",
"self",
",",
"which",
"=",
"TreeItemIcon_Checked",
")",
":",
"return",
"self",
".",
"_checkedimages",
"[",
"which",
"]"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/customtreectrl.py#L1732-L1754 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/logging/__init__.py | python | Filterer.__init__ | (self) | Initialize the list of filters to be an empty list. | Initialize the list of filters to be an empty list. | [
"Initialize",
"the",
"list",
"of",
"filters",
"to",
"be",
"an",
"empty",
"list",
"."
] | def __init__(self):
"""
Initialize the list of filters to be an empty list.
"""
self.filters = [] | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"filters",
"=",
"[",
"]"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/logging/__init__.py#L578-L582 | ||
apple/swift-lldb | d74be846ef3e62de946df343e8c234bde93a8912 | scripts/Python/static-binding/lldb.py | python | SBDebugger.SetScriptLanguage | (self, script_lang) | return _lldb.SBDebugger_SetScriptLanguage(self, script_lang) | SetScriptLanguage(SBDebugger self, lldb::ScriptLanguage script_lang) | SetScriptLanguage(SBDebugger self, lldb::ScriptLanguage script_lang) | [
"SetScriptLanguage",
"(",
"SBDebugger",
"self",
"lldb",
"::",
"ScriptLanguage",
"script_lang",
")"
] | def SetScriptLanguage(self, script_lang):
"""SetScriptLanguage(SBDebugger self, lldb::ScriptLanguage script_lang)"""
return _lldb.SBDebugger_SetScriptLanguage(self, script_lang) | [
"def",
"SetScriptLanguage",
"(",
"self",
",",
"script_lang",
")",
":",
"return",
"_lldb",
".",
"SBDebugger_SetScriptLanguage",
"(",
"self",
",",
"script_lang",
")"
] | https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/scripts/Python/static-binding/lldb.py#L4219-L4221 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/auto_bisect/bisect_perf_regression.py | python | RemoveDirectoryTree | (path_to_dir) | Removes a directory tree. Returns True if successful or False otherwise. | Removes a directory tree. Returns True if successful or False otherwise. | [
"Removes",
"a",
"directory",
"tree",
".",
"Returns",
"True",
"if",
"successful",
"or",
"False",
"otherwise",
"."
] | def RemoveDirectoryTree(path_to_dir):
"""Removes a directory tree. Returns True if successful or False otherwise."""
if os.path.isfile(path_to_dir):
logging.info('REMOVING FILE %s' % path_to_dir)
os.remove(path_to_dir)
try:
if os.path.exists(path_to_dir):
shutil.rmtree(path_to_dir)
except OSEr... | [
"def",
"RemoveDirectoryTree",
"(",
"path_to_dir",
")",
":",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"path_to_dir",
")",
":",
"logging",
".",
"info",
"(",
"'REMOVING FILE %s'",
"%",
"path_to_dir",
")",
"os",
".",
"remove",
"(",
"path_to_dir",
")",
"try... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/auto_bisect/bisect_perf_regression.py#L2552-L2562 | ||
Polidea/SiriusObfuscator | b0e590d8130e97856afe578869b83a209e2b19be | SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py | python | SBValue.GetPreferSyntheticValue | (self) | return _lldb.SBValue_GetPreferSyntheticValue(self) | GetPreferSyntheticValue(self) -> bool | GetPreferSyntheticValue(self) -> bool | [
"GetPreferSyntheticValue",
"(",
"self",
")",
"-",
">",
"bool"
] | def GetPreferSyntheticValue(self):
"""GetPreferSyntheticValue(self) -> bool"""
return _lldb.SBValue_GetPreferSyntheticValue(self) | [
"def",
"GetPreferSyntheticValue",
"(",
"self",
")",
":",
"return",
"_lldb",
".",
"SBValue_GetPreferSyntheticValue",
"(",
"self",
")"
] | https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py#L11900-L11902 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/shutil.py | python | chown | (path, user=None, group=None) | Change owner user and group of the given path.
user and group can be the uid/gid or the user/group names, and in that case,
they are converted to their respective uid/gid. | Change owner user and group of the given path. | [
"Change",
"owner",
"user",
"and",
"group",
"of",
"the",
"given",
"path",
"."
] | def chown(path, user=None, group=None):
"""Change owner user and group of the given path.
user and group can be the uid/gid or the user/group names, and in that case,
they are converted to their respective uid/gid.
"""
if user is None and group is None:
raise ValueError("user and/or group ... | [
"def",
"chown",
"(",
"path",
",",
"user",
"=",
"None",
",",
"group",
"=",
"None",
")",
":",
"if",
"user",
"is",
"None",
"and",
"group",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"user and/or group must be set\"",
")",
"_user",
"=",
"user",
"_group... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/shutil.py#L1042-L1071 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_gdi.py | python | GraphicsPath.AddArcToPoint | (*args, **kwargs) | return _gdi_.GraphicsPath_AddArcToPoint(*args, **kwargs) | AddArcToPoint(self, Double x1, Double y1, Double x2, Double y2, Double r)
Appends an arc to two tangents connecting (current) to (x1,y1) and
(x1,y1) to (x2,y2), also a straight line from (current) to (x1,y1) | AddArcToPoint(self, Double x1, Double y1, Double x2, Double y2, Double r) | [
"AddArcToPoint",
"(",
"self",
"Double",
"x1",
"Double",
"y1",
"Double",
"x2",
"Double",
"y2",
"Double",
"r",
")"
] | def AddArcToPoint(*args, **kwargs):
"""
AddArcToPoint(self, Double x1, Double y1, Double x2, Double y2, Double r)
Appends an arc to two tangents connecting (current) to (x1,y1) and
(x1,y1) to (x2,y2), also a straight line from (current) to (x1,y1)
"""
return _gdi_.Graphi... | [
"def",
"AddArcToPoint",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"GraphicsPath_AddArcToPoint",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_gdi.py#L5965-L5972 | |
seqan/seqan | f5f658343c366c9c3d44ba358ffc9317e78a09ed | util/py_lib/seqan/dox/inc_mgr.py | python | IncludeManager._loadSnippets | (self, path) | Load snippet
@raises IncludeException When there is an error loading the file or snippet. | Load snippet | [
"Load",
"snippet"
] | def _loadSnippets(self, path):
"""Load snippet
@raises IncludeException When there is an error loading the file or snippet.
"""
if not self.file_cache.get(path):
self._loadFile(path)
current_key = None
current_lines = []
fcontents = self.file_cache[pa... | [
"def",
"_loadSnippets",
"(",
"self",
",",
"path",
")",
":",
"if",
"not",
"self",
".",
"file_cache",
".",
"get",
"(",
"path",
")",
":",
"self",
".",
"_loadFile",
"(",
"path",
")",
"current_key",
"=",
"None",
"current_lines",
"=",
"[",
"]",
"fcontents",
... | https://github.com/seqan/seqan/blob/f5f658343c366c9c3d44ba358ffc9317e78a09ed/util/py_lib/seqan/dox/inc_mgr.py#L69-L92 | ||
aimerykong/Low-Rank-Bilinear-Pooling | 487eb2c857fd9c95357a5166b0c15ad0fe135b28 | caffe-20160312/python/caffe/io.py | python | Transformer.set_channel_swap | (self, in_, order) | Set the input channel order for e.g. RGB to BGR conversion
as needed for the reference ImageNet model.
N.B. this assumes the channels are the first dimension AFTER transpose.
Parameters
----------
in_ : which input to assign this channel order
order : the order to take t... | Set the input channel order for e.g. RGB to BGR conversion
as needed for the reference ImageNet model.
N.B. this assumes the channels are the first dimension AFTER transpose. | [
"Set",
"the",
"input",
"channel",
"order",
"for",
"e",
".",
"g",
".",
"RGB",
"to",
"BGR",
"conversion",
"as",
"needed",
"for",
"the",
"reference",
"ImageNet",
"model",
".",
"N",
".",
"B",
".",
"this",
"assumes",
"the",
"channels",
"are",
"the",
"first"... | def set_channel_swap(self, in_, order):
"""
Set the input channel order for e.g. RGB to BGR conversion
as needed for the reference ImageNet model.
N.B. this assumes the channels are the first dimension AFTER transpose.
Parameters
----------
in_ : which input to a... | [
"def",
"set_channel_swap",
"(",
"self",
",",
"in_",
",",
"order",
")",
":",
"self",
".",
"__check_input",
"(",
"in_",
")",
"if",
"len",
"(",
"order",
")",
"!=",
"self",
".",
"inputs",
"[",
"in_",
"]",
"[",
"1",
"]",
":",
"raise",
"Exception",
"(",
... | https://github.com/aimerykong/Low-Rank-Bilinear-Pooling/blob/487eb2c857fd9c95357a5166b0c15ad0fe135b28/caffe-20160312/python/caffe/io.py#L202-L218 | ||
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/models/embedding/word2vec.py | python | Word2Vec.forward | (self, examples, labels) | return true_logits, sampled_logits | Build the graph for the forward pass. | Build the graph for the forward pass. | [
"Build",
"the",
"graph",
"for",
"the",
"forward",
"pass",
"."
] | def forward(self, examples, labels):
"""Build the graph for the forward pass."""
opts = self._options
# Declare all variables we need.
# Embedding: [vocab_size, emb_dim]
init_width = 0.5 / opts.emb_dim
emb = tf.Variable(
tf.random_uniform(
[opts.vocab_size, opts.emb_dim], -i... | [
"def",
"forward",
"(",
"self",
",",
"examples",
",",
"labels",
")",
":",
"opts",
"=",
"self",
".",
"_options",
"# Declare all variables we need.",
"# Embedding: [vocab_size, emb_dim]",
"init_width",
"=",
"0.5",
"/",
"opts",
".",
"emb_dim",
"emb",
"=",
"tf",
".",... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/models/embedding/word2vec.py#L194-L257 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | tools/mac/symbolicate_crash.py | python | CrashReport.Symbolicate | (self, symbol_path) | Symbolicates a crash report stack trace. | Symbolicates a crash report stack trace. | [
"Symbolicates",
"a",
"crash",
"report",
"stack",
"trace",
"."
] | def Symbolicate(self, symbol_path):
"""Symbolicates a crash report stack trace."""
# In order to be efficient, collect all the offsets that will be passed to
# atos by the image name.
offsets_by_image = self._CollectAddressesForImages(SYMBOL_IMAGE_MAP.keys())
# For each image, run atos with the lis... | [
"def",
"Symbolicate",
"(",
"self",
",",
"symbol_path",
")",
":",
"# In order to be efficient, collect all the offsets that will be passed to",
"# atos by the image name.",
"offsets_by_image",
"=",
"self",
".",
"_CollectAddressesForImages",
"(",
"SYMBOL_IMAGE_MAP",
".",
"keys",
... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/tools/mac/symbolicate_crash.py#L65-L96 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/ops/control_flow_ops.py | python | ControlFlowContext.GetControlPivot | (self) | return None | Returns the pivot node for this context, or None. | Returns the pivot node for this context, or None. | [
"Returns",
"the",
"pivot",
"node",
"for",
"this",
"context",
"or",
"None",
"."
] | def GetControlPivot(self):
"""Returns the pivot node for this context, or None."""
return None | [
"def",
"GetControlPivot",
"(",
"self",
")",
":",
"return",
"None"
] | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/ops/control_flow_ops.py#L1479-L1481 | |
google/syzygy | 8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5 | third_party/numpy/files/numpy/core/defchararray.py | python | startswith | (a, prefix, start=0, end=None) | return _vec_string(
a, bool_, 'startswith', [prefix, start] + _clean_args(end)) | Returns a boolean array which is `True` where the string element
in `a` starts with `prefix`, otherwise `False`.
Calls `str.startswith` element-wise.
Parameters
----------
a : array_like of str or unicode
suffix : str
start, end : int, optional
With optional `start`, test beginni... | Returns a boolean array which is `True` where the string element
in `a` starts with `prefix`, otherwise `False`. | [
"Returns",
"a",
"boolean",
"array",
"which",
"is",
"True",
"where",
"the",
"string",
"element",
"in",
"a",
"starts",
"with",
"prefix",
"otherwise",
"False",
"."
] | def startswith(a, prefix, start=0, end=None):
"""
Returns a boolean array which is `True` where the string element
in `a` starts with `prefix`, otherwise `False`.
Calls `str.startswith` element-wise.
Parameters
----------
a : array_like of str or unicode
suffix : str
start, end :... | [
"def",
"startswith",
"(",
"a",
",",
"prefix",
",",
"start",
"=",
"0",
",",
"end",
"=",
"None",
")",
":",
"return",
"_vec_string",
"(",
"a",
",",
"bool_",
",",
"'startswith'",
",",
"[",
"prefix",
",",
"start",
"]",
"+",
"_clean_args",
"(",
"end",
")... | https://github.com/google/syzygy/blob/8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5/third_party/numpy/files/numpy/core/defchararray.py#L1397-L1425 | |
AcademySoftwareFoundation/OpenColorIO | 73508eb5230374df8d96147a0627c015d359a641 | src/apps/pyociodisplay/pyociodisplay.py | python | ImagePlane.paintGL | (self) | Called whenever a repaint is needed. Calling ``update()`` will
schedule a repaint. | Called whenever a repaint is needed. Calling ``update()`` will
schedule a repaint. | [
"Called",
"whenever",
"a",
"repaint",
"is",
"needed",
".",
"Calling",
"update",
"()",
"will",
"schedule",
"a",
"repaint",
"."
] | def paintGL(self):
"""
Called whenever a repaint is needed. Calling ``update()`` will
schedule a repaint.
"""
GL.glClearColor(0.0, 0.0, 0.0, 1.0)
GL.glClear(GL.GL_COLOR_BUFFER_BIT)
if self._shader_program is not None:
GL.glUseProgram(self._shader_prog... | [
"def",
"paintGL",
"(",
"self",
")",
":",
"GL",
".",
"glClearColor",
"(",
"0.0",
",",
"0.0",
",",
"0.0",
",",
"1.0",
")",
"GL",
".",
"glClear",
"(",
"GL",
".",
"GL_COLOR_BUFFER_BIT",
")",
"if",
"self",
".",
"_shader_program",
"is",
"not",
"None",
":",... | https://github.com/AcademySoftwareFoundation/OpenColorIO/blob/73508eb5230374df8d96147a0627c015d359a641/src/apps/pyociodisplay/pyociodisplay.py#L282-L328 | ||
microsoft/CNTK | e9396480025b9ca457d26b6f33dd07c474c6aa04 | Examples/Image/Detection/utils/od_utils.py | python | filter_results | (regressed_rois, cls_probs, cfg) | return filtered_bboxes, filtered_labels, filtered_scores | Filters the provided results by performing NMS (non maximum suppression)
:param regressed_rois: the predicted bounding boxes
:param cls_probs: class probabilities per bounding box
:param cfg: the configuration
:return:
bboxes - the filtered list of bounding boxes
labels - the single clas... | Filters the provided results by performing NMS (non maximum suppression)
:param regressed_rois: the predicted bounding boxes
:param cls_probs: class probabilities per bounding box
:param cfg: the configuration
:return:
bboxes - the filtered list of bounding boxes
labels - the single clas... | [
"Filters",
"the",
"provided",
"results",
"by",
"performing",
"NMS",
"(",
"non",
"maximum",
"suppression",
")",
":",
"param",
"regressed_rois",
":",
"the",
"predicted",
"bounding",
"boxes",
":",
"param",
"cls_probs",
":",
"class",
"probabilities",
"per",
"boundin... | def filter_results(regressed_rois, cls_probs, cfg):
"""
Filters the provided results by performing NMS (non maximum suppression)
:param regressed_rois: the predicted bounding boxes
:param cls_probs: class probabilities per bounding box
:param cfg: the configuration
:return:
bboxes - the ... | [
"def",
"filter_results",
"(",
"regressed_rois",
",",
"cls_probs",
",",
"cfg",
")",
":",
"labels",
"=",
"cls_probs",
".",
"argmax",
"(",
"axis",
"=",
"1",
")",
"scores",
"=",
"cls_probs",
".",
"max",
"(",
"axis",
"=",
"1",
")",
"nmsKeepIndices",
"=",
"a... | https://github.com/microsoft/CNTK/blob/e9396480025b9ca457d26b6f33dd07c474c6aa04/Examples/Image/Detection/utils/od_utils.py#L77-L102 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/prompt-toolkit/py3/prompt_toolkit/key_binding/bindings/named_commands.py | python | emacs_editing_mode | (event: E) | Switch to Emacs editing mode. | Switch to Emacs editing mode. | [
"Switch",
"to",
"Emacs",
"editing",
"mode",
"."
] | def emacs_editing_mode(event: E) -> None:
"""
Switch to Emacs editing mode.
"""
event.app.editing_mode = EditingMode.EMACS | [
"def",
"emacs_editing_mode",
"(",
"event",
":",
"E",
")",
"->",
"None",
":",
"event",
".",
"app",
".",
"editing_mode",
"=",
"EditingMode",
".",
"EMACS"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/prompt-toolkit/py3/prompt_toolkit/key_binding/bindings/named_commands.py#L639-L643 | ||
facebook/openr | ed38bdfd6bf290084bfab4821b59f83e7b59315d | openr/py/openr/cli/utils/utils.py | python | adj_dbs_to_dict | (resp, nodes, bidir, iter_func) | return adjs_map | get parsed adjacency db
:param resp kv_store_types.Publication, or decision_types.adjDbs
:param nodes set: the set of the nodes to print prefixes for
:param bidir bool: only dump bidirectional adjacencies
:return map(node, map(adjacency_keys, (adjacency_values)): the parsed
adjacency DB in a m... | get parsed adjacency db | [
"get",
"parsed",
"adjacency",
"db"
] | def adj_dbs_to_dict(resp, nodes, bidir, iter_func):
"""get parsed adjacency db
:param resp kv_store_types.Publication, or decision_types.adjDbs
:param nodes set: the set of the nodes to print prefixes for
:param bidir bool: only dump bidirectional adjacencies
:return map(node, map(adjacency_keys, ... | [
"def",
"adj_dbs_to_dict",
"(",
"resp",
",",
"nodes",
",",
"bidir",
",",
"iter_func",
")",
":",
"adj_dbs",
"=",
"resp",
"if",
"isinstance",
"(",
"adj_dbs",
",",
"kv_store_types",
".",
"Publication",
")",
":",
"adj_dbs",
"=",
"build_global_adj_db",
"(",
"resp"... | https://github.com/facebook/openr/blob/ed38bdfd6bf290084bfab4821b59f83e7b59315d/openr/py/openr/cli/utils/utils.py#L530-L555 | |
SoarGroup/Soar | a1c5e249499137a27da60533c72969eef3b8ab6b | scons/scons-local-4.1.0/SCons/Node/FS.py | python | RootDir._lookup_abs | (self, p, klass, create=1) | return result | Fast (?) lookup of a *normalized* absolute path.
This method is intended for use by internal lookups with
already-normalized path data. For general-purpose lookups,
use the FS.Entry(), FS.Dir() or FS.File() methods.
The caller is responsible for making sure we're passed a
norm... | Fast (?) lookup of a *normalized* absolute path. | [
"Fast",
"(",
"?",
")",
"lookup",
"of",
"a",
"*",
"normalized",
"*",
"absolute",
"path",
"."
] | def _lookup_abs(self, p, klass, create=1):
"""
Fast (?) lookup of a *normalized* absolute path.
This method is intended for use by internal lookups with
already-normalized path data. For general-purpose lookups,
use the FS.Entry(), FS.Dir() or FS.File() methods.
The ca... | [
"def",
"_lookup_abs",
"(",
"self",
",",
"p",
",",
"klass",
",",
"create",
"=",
"1",
")",
":",
"k",
"=",
"_my_normcase",
"(",
"p",
")",
"try",
":",
"result",
"=",
"self",
".",
"_lookupDict",
"[",
"k",
"]",
"except",
"KeyError",
":",
"if",
"not",
"... | https://github.com/SoarGroup/Soar/blob/a1c5e249499137a27da60533c72969eef3b8ab6b/scons/scons-local-4.1.0/SCons/Node/FS.py#L2372-L2412 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/boto/boto/ec2/autoscale/group.py | python | AutoScalingGroup.put_notification_configuration | (self, topic, notification_types) | return self.connection.put_notification_configuration(self,
topic,
notification_types) | Configures an Auto Scaling group to send notifications when
specified events take place. Valid notification types are:
'autoscaling:EC2_INSTANCE_LAUNCH',
'autoscaling:EC2_INSTANCE_LAUNCH_ERROR',
'autoscaling:EC2_INSTANCE_TERMINATE',
'autoscaling:EC2_INSTANCE_TERMINATE_ERROR',
... | Configures an Auto Scaling group to send notifications when
specified events take place. Valid notification types are:
'autoscaling:EC2_INSTANCE_LAUNCH',
'autoscaling:EC2_INSTANCE_LAUNCH_ERROR',
'autoscaling:EC2_INSTANCE_TERMINATE',
'autoscaling:EC2_INSTANCE_TERMINATE_ERROR',
... | [
"Configures",
"an",
"Auto",
"Scaling",
"group",
"to",
"send",
"notifications",
"when",
"specified",
"events",
"take",
"place",
".",
"Valid",
"notification",
"types",
"are",
":",
"autoscaling",
":",
"EC2_INSTANCE_LAUNCH",
"autoscaling",
":",
"EC2_INSTANCE_LAUNCH_ERROR"... | def put_notification_configuration(self, topic, notification_types):
"""
Configures an Auto Scaling group to send notifications when
specified events take place. Valid notification types are:
'autoscaling:EC2_INSTANCE_LAUNCH',
'autoscaling:EC2_INSTANCE_LAUNCH_ERROR',
'aut... | [
"def",
"put_notification_configuration",
"(",
"self",
",",
"topic",
",",
"notification_types",
")",
":",
"return",
"self",
".",
"connection",
".",
"put_notification_configuration",
"(",
"self",
",",
"topic",
",",
"notification_types",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/boto/boto/ec2/autoscale/group.py#L309-L321 | |
llvm-mirror/libcxx | 78d6a7767ed57b50122a161b91f59f19c9bd0d19 | utils/gdb/libcxx/printers.py | python | _typename_with_n_generic_arguments | (gdb_type, n) | return result | Return a string for the type with the first n (1, ...) generic args. | Return a string for the type with the first n (1, ...) generic args. | [
"Return",
"a",
"string",
"for",
"the",
"type",
"with",
"the",
"first",
"n",
"(",
"1",
"...",
")",
"generic",
"args",
"."
] | def _typename_with_n_generic_arguments(gdb_type, n):
"""Return a string for the type with the first n (1, ...) generic args."""
base_type = _remove_generics(_prettify_typename(gdb_type))
arg_list = [base_type]
template = "%s<"
for i in range(n):
arg_list.append(_typename_for_nth_generic_arg... | [
"def",
"_typename_with_n_generic_arguments",
"(",
"gdb_type",
",",
"n",
")",
":",
"base_type",
"=",
"_remove_generics",
"(",
"_prettify_typename",
"(",
"gdb_type",
")",
")",
"arg_list",
"=",
"[",
"base_type",
"]",
"template",
"=",
"\"%s<\"",
"for",
"i",
"in",
... | https://github.com/llvm-mirror/libcxx/blob/78d6a7767ed57b50122a161b91f59f19c9bd0d19/utils/gdb/libcxx/printers.py#L109-L119 | |
rapidsai/cudf | d5b2448fc69f17509304d594f029d0df56984962 | python/cudf/cudf/core/indexed_frame.py | python | IndexedFrame.sort_index | (
self,
axis=0,
level=None,
ascending=True,
inplace=False,
kind=None,
na_position="last",
sort_remaining=True,
ignore_index=False,
key=None,
) | return self._mimic_inplace(out, inplace=inplace) | Sort object by labels (along an axis).
Parameters
----------
axis : {0 or ‘index’, 1 or ‘columns’}, default 0
The axis along which to sort. The value 0 identifies the rows,
and 1 identifies the columns.
level : int or level name or list of ints or list of level n... | Sort object by labels (along an axis). | [
"Sort",
"object",
"by",
"labels",
"(",
"along",
"an",
"axis",
")",
"."
] | def sort_index(
self,
axis=0,
level=None,
ascending=True,
inplace=False,
kind=None,
na_position="last",
sort_remaining=True,
ignore_index=False,
key=None,
):
"""Sort object by labels (along an axis).
Parameters
... | [
"def",
"sort_index",
"(",
"self",
",",
"axis",
"=",
"0",
",",
"level",
"=",
"None",
",",
"ascending",
"=",
"True",
",",
"inplace",
"=",
"False",
",",
"kind",
"=",
"None",
",",
"na_position",
"=",
"\"last\"",
",",
"sort_remaining",
"=",
"True",
",",
"... | https://github.com/rapidsai/cudf/blob/d5b2448fc69f17509304d594f029d0df56984962/python/cudf/cudf/core/indexed_frame.py#L321-L474 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/extern/aui/framemanager.py | python | AuiManager.GetAllPanes | (self) | return self._panes | Returns a reference to all the pane info structures. | Returns a reference to all the pane info structures. | [
"Returns",
"a",
"reference",
"to",
"all",
"the",
"pane",
"info",
"structures",
"."
] | def GetAllPanes(self):
""" Returns a reference to all the pane info structures. """
return self._panes | [
"def",
"GetAllPanes",
"(",
"self",
")",
":",
"return",
"self",
".",
"_panes"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/extern/aui/framemanager.py#L4306-L4309 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/frame.py | python | DataFrame._set_value | (self, index, col, value, takeable: bool = False) | Put single value at passed column and index.
Parameters
----------
index : row label
col : column label
value : scalar
takeable : interpret the index/col as indexers, default False
Returns
-------
DataFrame
If label pair is contained,... | Put single value at passed column and index. | [
"Put",
"single",
"value",
"at",
"passed",
"column",
"and",
"index",
"."
] | def _set_value(self, index, col, value, takeable: bool = False):
"""
Put single value at passed column and index.
Parameters
----------
index : row label
col : column label
value : scalar
takeable : interpret the index/col as indexers, default False
... | [
"def",
"_set_value",
"(",
"self",
",",
"index",
",",
"col",
",",
"value",
",",
"takeable",
":",
"bool",
"=",
"False",
")",
":",
"try",
":",
"if",
"takeable",
"is",
"True",
":",
"series",
"=",
"self",
".",
"_iget_item_cache",
"(",
"col",
")",
"return"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/frame.py#L3009-L3044 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow2.x/tensorflow_model_optimization/python/core/sparsity/keras/pruning_impl.py | python | Pruning._maybe_update_block_mask | (self, weights) | return new_threshold, tf.reshape(sliced_mask, tf.shape(weights)) | Performs block-granular masking of the weights.
Block pruning occurs only if the block_height or block_width is > 1 and
if the weight tensor, when squeezed, has ndims = 2. Otherwise, elementwise
pruning occurs.
Args:
weights: The weight tensor that needs to be masked.
Returns:
new_thre... | Performs block-granular masking of the weights. | [
"Performs",
"block",
"-",
"granular",
"masking",
"of",
"the",
"weights",
"."
] | def _maybe_update_block_mask(self, weights):
"""Performs block-granular masking of the weights.
Block pruning occurs only if the block_height or block_width is > 1 and
if the weight tensor, when squeezed, has ndims = 2. Otherwise, elementwise
pruning occurs.
Args:
weights: The weight tensor t... | [
"def",
"_maybe_update_block_mask",
"(",
"self",
",",
"weights",
")",
":",
"if",
"self",
".",
"_block_size",
"==",
"[",
"1",
",",
"1",
"]",
":",
"return",
"self",
".",
"_update_mask",
"(",
"weights",
")",
"# TODO(pulkitb): Check if squeeze operations should now be ... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow2.x/tensorflow_model_optimization/python/core/sparsity/keras/pruning_impl.py#L101-L145 | |
ZintrulCre/LeetCode_Archiver | de23e16ead29336b5ee7aa1898a392a5d6463d27 | LeetCode/python/1020.py | python | Solution.canThreePartsEqualSum | (self, A) | return False | :type A: List[int]
:rtype: bool | :type A: List[int]
:rtype: bool | [
":",
"type",
"A",
":",
"List",
"[",
"int",
"]",
":",
"rtype",
":",
"bool"
] | def canThreePartsEqualSum(self, A):
"""
:type A: List[int]
:rtype: bool
"""
s = sum(A)
if s % 3 != 0:
return False
s //= 3
cum = 0
total = 0
for a in A:
cum += a
if cum == s:
total += 1
... | [
"def",
"canThreePartsEqualSum",
"(",
"self",
",",
"A",
")",
":",
"s",
"=",
"sum",
"(",
"A",
")",
"if",
"s",
"%",
"3",
"!=",
"0",
":",
"return",
"False",
"s",
"//=",
"3",
"cum",
"=",
"0",
"total",
"=",
"0",
"for",
"a",
"in",
"A",
":",
"cum",
... | https://github.com/ZintrulCre/LeetCode_Archiver/blob/de23e16ead29336b5ee7aa1898a392a5d6463d27/LeetCode/python/1020.py#L2-L20 | |
blitzpp/blitz | 39f885951a9b8b11f931f917935a16066a945056 | blitz/generate/makeloops.py | python | genf77 | (loop) | Generate the fortran code from loop data. | Generate the fortran code from loop data. | [
"Generate",
"the",
"fortran",
"code",
"from",
"loop",
"data",
"."
] | def genf77(loop):
"""Generate the fortran code from loop data."""
f77expr = indexexpr(loop,"i")
# see if we must continue line
maxlen=60
if len(f77expr)>maxlen:
f77expr=f77expr[:maxlen]+"\n !"+f77expr[maxlen:]
subs=[
("loopname",loopname(loop)),
("f77args", cc([... | [
"def",
"genf77",
"(",
"loop",
")",
":",
"f77expr",
"=",
"indexexpr",
"(",
"loop",
",",
"\"i\"",
")",
"# see if we must continue line",
"maxlen",
"=",
"60",
"if",
"len",
"(",
"f77expr",
")",
">",
"maxlen",
":",
"f77expr",
"=",
"f77expr",
"[",
":",
"maxlen... | https://github.com/blitzpp/blitz/blob/39f885951a9b8b11f931f917935a16066a945056/blitz/generate/makeloops.py#L216-L238 | ||
kushview/Element | 1cc16380caa2ab79461246ba758b9de1f46db2a5 | waflib/Scripting.py | python | Dist.get_arch_name | (self) | return self.arch_name | Returns the archive file name.
Set the attribute *arch_name* to change the default value::
def dist(ctx):
ctx.arch_name = 'ctx.tar.bz2'
:rtype: string | Returns the archive file name.
Set the attribute *arch_name* to change the default value:: | [
"Returns",
"the",
"archive",
"file",
"name",
".",
"Set",
"the",
"attribute",
"*",
"arch_name",
"*",
"to",
"change",
"the",
"default",
"value",
"::"
] | def get_arch_name(self):
"""
Returns the archive file name.
Set the attribute *arch_name* to change the default value::
def dist(ctx):
ctx.arch_name = 'ctx.tar.bz2'
:rtype: string
"""
try:
self.arch_name
except AttributeError:
self.arch_name = self.get_base_name() + '.' + self.ext_algo.get(... | [
"def",
"get_arch_name",
"(",
"self",
")",
":",
"try",
":",
"self",
".",
"arch_name",
"except",
"AttributeError",
":",
"self",
".",
"arch_name",
"=",
"self",
".",
"get_base_name",
"(",
")",
"+",
"'.'",
"+",
"self",
".",
"ext_algo",
".",
"get",
"(",
"sel... | https://github.com/kushview/Element/blob/1cc16380caa2ab79461246ba758b9de1f46db2a5/waflib/Scripting.py#L446-L460 | |
happynear/caffe-windows | 967eedf25009e334b7f6f933bb5e17aaaff5bef6 | examples/pycaffe/tools.py | python | SimpleTransformer.deprocess | (self, im) | return np.uint8(im) | inverse of preprocess() | inverse of preprocess() | [
"inverse",
"of",
"preprocess",
"()"
] | def deprocess(self, im):
"""
inverse of preprocess()
"""
im = im.transpose(1, 2, 0)
im /= self.scale
im += self.mean
im = im[:, :, ::-1] # change to RGB
return np.uint8(im) | [
"def",
"deprocess",
"(",
"self",
",",
"im",
")",
":",
"im",
"=",
"im",
".",
"transpose",
"(",
"1",
",",
"2",
",",
"0",
")",
"im",
"/=",
"self",
".",
"scale",
"im",
"+=",
"self",
".",
"mean",
"im",
"=",
"im",
"[",
":",
",",
":",
",",
":",
... | https://github.com/happynear/caffe-windows/blob/967eedf25009e334b7f6f933bb5e17aaaff5bef6/examples/pycaffe/tools.py#L41-L50 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_core.py | python | Image.Resize | (*args, **kwargs) | return _core_.Image_Resize(*args, **kwargs) | Resize(self, Size size, Point pos, int r=-1, int g=-1, int b=-1) -> Image
Changes the size of the image in-place without scaling it, by adding
either a border with the given colour or cropping as necessary. The
image is pasted into a new image with the given size and background
colour a... | Resize(self, Size size, Point pos, int r=-1, int g=-1, int b=-1) -> Image | [
"Resize",
"(",
"self",
"Size",
"size",
"Point",
"pos",
"int",
"r",
"=",
"-",
"1",
"int",
"g",
"=",
"-",
"1",
"int",
"b",
"=",
"-",
"1",
")",
"-",
">",
"Image"
] | def Resize(*args, **kwargs):
"""
Resize(self, Size size, Point pos, int r=-1, int g=-1, int b=-1) -> Image
Changes the size of the image in-place without scaling it, by adding
either a border with the given colour or cropping as necessary. The
image is pasted into a new image wi... | [
"def",
"Resize",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"Image_Resize",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_core.py#L2982-L2996 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/mindrecord/mindpage.py | python | MindPage.read_at_page_by_name | (self, category_name, page, num_row) | return self._segment.read_at_page_by_name(category_name, page, num_row) | Query by category name in pagination.
Args:
category_name (str): String of category field's value,
referred to the return of `read_category_info`.
page (int): Index of page.
num_row (int): Number of row in a page.
Returns:
list[dict], dat... | Query by category name in pagination. | [
"Query",
"by",
"category",
"name",
"in",
"pagination",
"."
] | def read_at_page_by_name(self, category_name, page, num_row):
"""
Query by category name in pagination.
Args:
category_name (str): String of category field's value,
referred to the return of `read_category_info`.
page (int): Index of page.
num... | [
"def",
"read_at_page_by_name",
"(",
"self",
",",
"category_name",
",",
"page",
",",
"num_row",
")",
":",
"if",
"not",
"isinstance",
"(",
"category_name",
",",
"str",
")",
":",
"raise",
"ParamValueError",
"(",
"\"Category name should be str.\"",
")",
"if",
"not",... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/mindrecord/mindpage.py#L151-L170 | |
luliyucoordinate/Leetcode | 96afcdc54807d1d184e881a075d1dbf3371e31fb | src/0392-Is-Subsequence/0392.py | python | Solution.isSubsequence | (self, s, t) | return True | :type s: str
:type t: str
:rtype: bool | :type s: str
:type t: str
:rtype: bool | [
":",
"type",
"s",
":",
"str",
":",
"type",
"t",
":",
"str",
":",
"rtype",
":",
"bool"
] | def isSubsequence(self, s, t):
"""
:type s: str
:type t: str
:rtype: bool
"""
for per_s in s:
s_index_t = t.find(per_s)
if s_index_t == -1:
return False
if s_index_t == len(t) - 1:
t = str()
... | [
"def",
"isSubsequence",
"(",
"self",
",",
"s",
",",
"t",
")",
":",
"for",
"per_s",
"in",
"s",
":",
"s_index_t",
"=",
"t",
".",
"find",
"(",
"per_s",
")",
"if",
"s_index_t",
"==",
"-",
"1",
":",
"return",
"False",
"if",
"s_index_t",
"==",
"len",
"... | https://github.com/luliyucoordinate/Leetcode/blob/96afcdc54807d1d184e881a075d1dbf3371e31fb/src/0392-Is-Subsequence/0392.py#L2-L18 | |
TGAC/KAT | e8870331de2b4bb0a1b3b91c6afb8fb9d59e9216 | deps/boost/tools/build/src/build/property.py | python | take | (attributes, properties) | return result | Returns a property set which include all
properties in 'properties' that have any of 'attributes'. | Returns a property set which include all
properties in 'properties' that have any of 'attributes'. | [
"Returns",
"a",
"property",
"set",
"which",
"include",
"all",
"properties",
"in",
"properties",
"that",
"have",
"any",
"of",
"attributes",
"."
] | def take(attributes, properties):
"""Returns a property set which include all
properties in 'properties' that have any of 'attributes'."""
assert is_iterable_typed(attributes, basestring)
assert is_iterable_typed(properties, basestring)
result = []
for e in properties:
if b2.util.set.int... | [
"def",
"take",
"(",
"attributes",
",",
"properties",
")",
":",
"assert",
"is_iterable_typed",
"(",
"attributes",
",",
"basestring",
")",
"assert",
"is_iterable_typed",
"(",
"properties",
",",
"basestring",
")",
"result",
"=",
"[",
"]",
"for",
"e",
"in",
"pro... | https://github.com/TGAC/KAT/blob/e8870331de2b4bb0a1b3b91c6afb8fb9d59e9216/deps/boost/tools/build/src/build/property.py#L542-L551 | |
taichi-dev/taichi | 973c04d6ba40f34e9e3bd5a28ae0ee0802f136a6 | python/taichi/lang/_ndarray.py | python | Ndarray.fill | (self, val) | Fills ndarray with a specific scalar value.
Args:
val (Union[int, float]): Value to fill. | Fills ndarray with a specific scalar value. | [
"Fills",
"ndarray",
"with",
"a",
"specific",
"scalar",
"value",
"."
] | def fill(self, val):
"""Fills ndarray with a specific scalar value.
Args:
val (Union[int, float]): Value to fill.
"""
if self.ndarray_use_torch:
self.arr.fill_(val)
elif impl.current_cfg(
).arch != _ti_core.Arch.cuda and impl.current_cfg(
... | [
"def",
"fill",
"(",
"self",
",",
"val",
")",
":",
"if",
"self",
".",
"ndarray_use_torch",
":",
"self",
".",
"arr",
".",
"fill_",
"(",
"val",
")",
"elif",
"impl",
".",
"current_cfg",
"(",
")",
".",
"arch",
"!=",
"_ti_core",
".",
"Arch",
".",
"cuda",... | https://github.com/taichi-dev/taichi/blob/973c04d6ba40f34e9e3bd5a28ae0ee0802f136a6/python/taichi/lang/_ndarray.py#L78-L97 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/textwrap.py | python | fill | (text, width=70, **kwargs) | return w.fill(text) | Fill a single paragraph of text, returning a new string.
Reformat the single paragraph in 'text' to fit in lines of no more
than 'width' columns, and return a new string containing the entire
wrapped paragraph. As with wrap(), tabs are expanded and other
whitespace characters converted to space. See ... | Fill a single paragraph of text, returning a new string. | [
"Fill",
"a",
"single",
"paragraph",
"of",
"text",
"returning",
"a",
"new",
"string",
"."
] | def fill(text, width=70, **kwargs):
"""Fill a single paragraph of text, returning a new string.
Reformat the single paragraph in 'text' to fit in lines of no more
than 'width' columns, and return a new string containing the entire
wrapped paragraph. As with wrap(), tabs are expanded and other
whit... | [
"def",
"fill",
"(",
"text",
",",
"width",
"=",
"70",
",",
"*",
"*",
"kwargs",
")",
":",
"w",
"=",
"TextWrapper",
"(",
"width",
"=",
"width",
",",
"*",
"*",
"kwargs",
")",
"return",
"w",
".",
"fill",
"(",
"text",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/textwrap.py#L356-L366 | |
SFTtech/openage | d6a08c53c48dc1e157807471df92197f6ca9e04d | openage/convert/processor/conversion/ror/nyan_subprocessor.py | python | RoRNyanSubprocessor.unit_line_to_game_entity | (unit_line) | Creates raw API objects for a unit line.
:param unit_line: Unit line that gets converted to a game entity.
:type unit_line: ..dataformat.converter_object.ConverterObjectGroup | Creates raw API objects for a unit line. | [
"Creates",
"raw",
"API",
"objects",
"for",
"a",
"unit",
"line",
"."
] | def unit_line_to_game_entity(unit_line):
"""
Creates raw API objects for a unit line.
:param unit_line: Unit line that gets converted to a game entity.
:type unit_line: ..dataformat.converter_object.ConverterObjectGroup
"""
current_unit = unit_line.get_head_unit()
... | [
"def",
"unit_line_to_game_entity",
"(",
"unit_line",
")",
":",
"current_unit",
"=",
"unit_line",
".",
"get_head_unit",
"(",
")",
"current_unit_id",
"=",
"unit_line",
".",
"get_head_unit_id",
"(",
")",
"dataset",
"=",
"unit_line",
".",
"data",
"name_lookup_dict",
"... | https://github.com/SFTtech/openage/blob/d6a08c53c48dc1e157807471df92197f6ca9e04d/openage/convert/processor/conversion/ror/nyan_subprocessor.py#L158-L339 | ||
ricardoquesada/Spidermonkey | 4a75ea2543408bd1b2c515aa95901523eeef7858 | python/configobj/configobj.py | python | Section.dict | (self) | return newdict | Return a deepcopy of self as a dictionary.
All members that are ``Section`` instances are recursively turned to
ordinary dictionaries - by calling their ``dict`` method.
>>> n = a.dict()
>>> n == a
1
>>> n is a
0 | Return a deepcopy of self as a dictionary.
All members that are ``Section`` instances are recursively turned to
ordinary dictionaries - by calling their ``dict`` method.
>>> n = a.dict()
>>> n == a
1
>>> n is a
0 | [
"Return",
"a",
"deepcopy",
"of",
"self",
"as",
"a",
"dictionary",
".",
"All",
"members",
"that",
"are",
"Section",
"instances",
"are",
"recursively",
"turned",
"to",
"ordinary",
"dictionaries",
"-",
"by",
"calling",
"their",
"dict",
"method",
".",
">>>",
"n"... | def dict(self):
"""
Return a deepcopy of self as a dictionary.
All members that are ``Section`` instances are recursively turned to
ordinary dictionaries - by calling their ``dict`` method.
>>> n = a.dict()
>>> n == a
1
>>> n is a
... | [
"def",
"dict",
"(",
"self",
")",
":",
"newdict",
"=",
"{",
"}",
"for",
"entry",
"in",
"self",
":",
"this_entry",
"=",
"self",
"[",
"entry",
"]",
"if",
"isinstance",
"(",
"this_entry",
",",
"Section",
")",
":",
"this_entry",
"=",
"this_entry",
".",
"d... | https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/python/configobj/configobj.py#L770-L795 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_controls.py | python | AnyButton.SetBitmapMargins | (*args) | return _controls_.AnyButton_SetBitmapMargins(*args) | SetBitmapMargins(self, int x, int y)
SetBitmapMargins(self, Size sz) | SetBitmapMargins(self, int x, int y)
SetBitmapMargins(self, Size sz) | [
"SetBitmapMargins",
"(",
"self",
"int",
"x",
"int",
"y",
")",
"SetBitmapMargins",
"(",
"self",
"Size",
"sz",
")"
] | def SetBitmapMargins(*args):
"""
SetBitmapMargins(self, int x, int y)
SetBitmapMargins(self, Size sz)
"""
return _controls_.AnyButton_SetBitmapMargins(*args) | [
"def",
"SetBitmapMargins",
"(",
"*",
"args",
")",
":",
"return",
"_controls_",
".",
"AnyButton_SetBitmapMargins",
"(",
"*",
"args",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_controls.py#L143-L148 | |
facebook/ThreatExchange | 31914a51820c73c8a0daffe62ccca29a6e3d359e | python-threatexchange/threatexchange/signal_type/pdq_index.py | python | PDQIndex.query | (self, hash: str) | return matches | Look up entries against the index, up to the max supported distance. | Look up entries against the index, up to the max supported distance. | [
"Look",
"up",
"entries",
"against",
"the",
"index",
"up",
"to",
"the",
"max",
"supported",
"distance",
"."
] | def query(self, hash: str) -> t.List[IndexMatch[IndexT]]:
"""
Look up entries against the index, up to the max supported distance.
"""
# query takes a signal hash but index supports batch queries hence [hash]
results = self.index.search_with_distance_in_result(
[hash... | [
"def",
"query",
"(",
"self",
",",
"hash",
":",
"str",
")",
"->",
"t",
".",
"List",
"[",
"IndexMatch",
"[",
"IndexT",
"]",
"]",
":",
"# query takes a signal hash but index supports batch queries hence [hash]",
"results",
"=",
"self",
".",
"index",
".",
"search_wi... | https://github.com/facebook/ThreatExchange/blob/31914a51820c73c8a0daffe62ccca29a6e3d359e/python-threatexchange/threatexchange/signal_type/pdq_index.py#L43-L56 | |
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py | python | FieldMask.ToJsonString | (self) | return ','.join(camelcase_paths) | Converts FieldMask to string according to proto3 JSON spec. | Converts FieldMask to string according to proto3 JSON spec. | [
"Converts",
"FieldMask",
"to",
"string",
"according",
"to",
"proto3",
"JSON",
"spec",
"."
] | def ToJsonString(self):
"""Converts FieldMask to string according to proto3 JSON spec."""
camelcase_paths = []
for path in self.paths:
camelcase_paths.append(_SnakeCaseToCamelCase(path))
return ','.join(camelcase_paths) | [
"def",
"ToJsonString",
"(",
"self",
")",
":",
"camelcase_paths",
"=",
"[",
"]",
"for",
"path",
"in",
"self",
".",
"paths",
":",
"camelcase_paths",
".",
"append",
"(",
"_SnakeCaseToCamelCase",
"(",
"path",
")",
")",
"return",
"','",
".",
"join",
"(",
"cam... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L396-L401 | |
zeakey/DeepSkeleton | dc70170f8fd2ec8ca1157484ce66129981104486 | scripts/cpp_lint.py | python | GetLineWidth | (line) | Determines the width of the line in column positions.
Args:
line: A string, which may be a Unicode string.
Returns:
The width of the line in column positions, accounting for Unicode
combining characters and wide characters. | Determines the width of the line in column positions. | [
"Determines",
"the",
"width",
"of",
"the",
"line",
"in",
"column",
"positions",
"."
] | def GetLineWidth(line):
"""Determines the width of the line in column positions.
Args:
line: A string, which may be a Unicode string.
Returns:
The width of the line in column positions, accounting for Unicode
combining characters and wide characters.
"""
if isinstance(line, unicode):
width =... | [
"def",
"GetLineWidth",
"(",
"line",
")",
":",
"if",
"isinstance",
"(",
"line",
",",
"unicode",
")",
":",
"width",
"=",
"0",
"for",
"uc",
"in",
"unicodedata",
".",
"normalize",
"(",
"'NFC'",
",",
"line",
")",
":",
"if",
"unicodedata",
".",
"east_asian_w... | https://github.com/zeakey/DeepSkeleton/blob/dc70170f8fd2ec8ca1157484ce66129981104486/scripts/cpp_lint.py#L3437-L3456 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/tpu/feature_column.py | python | _is_running_on_cpu | () | return tpu_function.get_tpu_context().number_of_shards is None | Returns True if the current context is CPU model. | Returns True if the current context is CPU model. | [
"Returns",
"True",
"if",
"the",
"current",
"context",
"is",
"CPU",
"model",
"."
] | def _is_running_on_cpu():
"""Returns True if the current context is CPU model."""
return tpu_function.get_tpu_context().number_of_shards is None | [
"def",
"_is_running_on_cpu",
"(",
")",
":",
"return",
"tpu_function",
".",
"get_tpu_context",
"(",
")",
".",
"number_of_shards",
"is",
"None"
] | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/tpu/feature_column.py#L618-L620 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py2/sklearn/externals/joblib/memory.py | python | Memory.eval | (self, func, *args, **kwargs) | return self.cache(func)(*args, **kwargs) | Eval function func with arguments `*args` and `**kwargs`,
in the context of the memory.
This method works similarly to the builtin `apply`, except
that the function is called only if the cache is not
up to date. | Eval function func with arguments `*args` and `**kwargs`,
in the context of the memory. | [
"Eval",
"function",
"func",
"with",
"arguments",
"*",
"args",
"and",
"**",
"kwargs",
"in",
"the",
"context",
"of",
"the",
"memory",
"."
] | def eval(self, func, *args, **kwargs):
""" Eval function func with arguments `*args` and `**kwargs`,
in the context of the memory.
This method works similarly to the builtin `apply`, except
that the function is called only if the cache is not
up to date.
... | [
"def",
"eval",
"(",
"self",
",",
"func",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"cachedir",
"is",
"None",
":",
"return",
"func",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"self",
".",
"cache",
"(... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py2/sklearn/externals/joblib/memory.py#L887-L898 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/optimize/_shgo.py | python | SHGO.surface_topo_ref | (self) | Find the BD and FD finite differences along each component vector. | Find the BD and FD finite differences along each component vector. | [
"Find",
"the",
"BD",
"and",
"FD",
"finite",
"differences",
"along",
"each",
"component",
"vector",
"."
] | def surface_topo_ref(self): # Validated
"""
Find the BD and FD finite differences along each component vector.
"""
# Replace numpy inf, -inf and nan objects with floating point numbers
# nan --> float
self.F[np.isnan(self.F)] = np.inf
# inf, -inf --> floats
... | [
"def",
"surface_topo_ref",
"(",
"self",
")",
":",
"# Validated",
"# Replace numpy inf, -inf and nan objects with floating point numbers",
"# nan --> float",
"self",
".",
"F",
"[",
"np",
".",
"isnan",
"(",
"self",
".",
"F",
")",
"]",
"=",
"np",
".",
"inf",
"# inf, ... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/optimize/_shgo.py#L1444-L1456 | ||
apache/qpid-proton | 6bcdfebb55ea3554bc29b1901422532db331a591 | python/proton/_endpoints.py | python | Terminus.capabilities | (self) | return Data(pn_terminus_capabilities(self._impl)) | Capabilities of the source or target.
:type: :class:`Data` containing an array of :class:`symbol`. | Capabilities of the source or target. | [
"Capabilities",
"of",
"the",
"source",
"or",
"target",
"."
] | def capabilities(self):
"""
Capabilities of the source or target.
:type: :class:`Data` containing an array of :class:`symbol`.
"""
return Data(pn_terminus_capabilities(self._impl)) | [
"def",
"capabilities",
"(",
"self",
")",
":",
"return",
"Data",
"(",
"pn_terminus_capabilities",
"(",
"self",
".",
"_impl",
")",
")"
] | https://github.com/apache/qpid-proton/blob/6bcdfebb55ea3554bc29b1901422532db331a591/python/proton/_endpoints.py#L1405-L1411 | |
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Draft/draftviewproviders/view_dimension.py | python | ViewProviderLinearDimension.is_linked_to_circle | (self) | return False | Return true if the dimension measures a circular edge. | Return true if the dimension measures a circular edge. | [
"Return",
"true",
"if",
"the",
"dimension",
"measures",
"a",
"circular",
"edge",
"."
] | def is_linked_to_circle(self):
"""Return true if the dimension measures a circular edge."""
obj = self.Object
if obj.LinkedGeometry and len(obj.LinkedGeometry) == 1:
linked_obj = obj.LinkedGeometry[0][0]
subelements = obj.LinkedGeometry[0][1]
if len(subelement... | [
"def",
"is_linked_to_circle",
"(",
"self",
")",
":",
"obj",
"=",
"self",
".",
"Object",
"if",
"obj",
".",
"LinkedGeometry",
"and",
"len",
"(",
"obj",
".",
"LinkedGeometry",
")",
"==",
"1",
":",
"linked_obj",
"=",
"obj",
".",
"LinkedGeometry",
"[",
"0",
... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Draft/draftviewproviders/view_dimension.py#L884-L896 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/build/waf-1.7.13/lmbrwaflib/build_configurations.py | python | PlatformDetail.__init__ | (self, platform, enabled, has_server, has_tests, is_monolithic_value, output_folder, aliases, attributes, needs_java, platform_env_dict) | Initialize
:param platform: The base name of this platform. (The concrete platform name may be extended with a server suffix if the right options are set)
:param enabled: Flag: Is this platform enabled or not
:param has_server: Flag: Are server platforms/configur... | Initialize | [
"Initialize"
] | def __init__(self, platform, enabled, has_server, has_tests, is_monolithic_value, output_folder, aliases, attributes, needs_java, platform_env_dict):
"""
Initialize
:param platform: The base name of this platform. (The concrete platform name may be extended with a server suffix if th... | [
"def",
"__init__",
"(",
"self",
",",
"platform",
",",
"enabled",
",",
"has_server",
",",
"has_tests",
",",
"is_monolithic_value",
",",
"output_folder",
",",
"aliases",
",",
"attributes",
",",
"needs_java",
",",
"platform_env_dict",
")",
":",
"self",
".",
"plat... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/build/waf-1.7.13/lmbrwaflib/build_configurations.py#L131-L243 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/tkinter/__init__.py | python | Canvas.create_text | (self, *args, **kw) | return self._create('text', args, kw) | Create text with coordinates x1,y1. | Create text with coordinates x1,y1. | [
"Create",
"text",
"with",
"coordinates",
"x1",
"y1",
"."
] | def create_text(self, *args, **kw):
"""Create text with coordinates x1,y1."""
return self._create('text', args, kw) | [
"def",
"create_text",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kw",
")",
":",
"return",
"self",
".",
"_create",
"(",
"'text'",
",",
"args",
",",
"kw",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/tkinter/__init__.py#L2502-L2504 | |
google/or-tools | 2cb85b4eead4c38e1c54b48044f92087cf165bce | ortools/sat/python/cp_model.py | python | CpModel.AddNoOverlap | (self, interval_vars) | return ct | Adds NoOverlap(interval_vars).
A NoOverlap constraint ensures that all present intervals do not overlap
in time.
Args:
interval_vars: The list of interval variables to constrain.
Returns:
An instance of the `Constraint` class. | Adds NoOverlap(interval_vars). | [
"Adds",
"NoOverlap",
"(",
"interval_vars",
")",
"."
] | def AddNoOverlap(self, interval_vars):
"""Adds NoOverlap(interval_vars).
A NoOverlap constraint ensures that all present intervals do not overlap
in time.
Args:
interval_vars: The list of interval variables to constrain.
Returns:
An instance of the `Constraint` class.
"""
... | [
"def",
"AddNoOverlap",
"(",
"self",
",",
"interval_vars",
")",
":",
"ct",
"=",
"Constraint",
"(",
"self",
".",
"__model",
".",
"constraints",
")",
"model_ct",
"=",
"self",
".",
"__model",
".",
"constraints",
"[",
"ct",
".",
"Index",
"(",
")",
"]",
"mod... | https://github.com/google/or-tools/blob/2cb85b4eead4c38e1c54b48044f92087cf165bce/ortools/sat/python/cp_model.py#L1686-L1702 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | scripts/reduction_workflow/command_interface.py | python | ClearDataFiles | () | Empty the list of data files to be processed while keeping
all other reduction options. | Empty the list of data files to be processed while keeping
all other reduction options. | [
"Empty",
"the",
"list",
"of",
"data",
"files",
"to",
"be",
"processed",
"while",
"keeping",
"all",
"other",
"reduction",
"options",
"."
] | def ClearDataFiles():
"""
Empty the list of data files to be processed while keeping
all other reduction options.
"""
ReductionSingleton().clear_data_files() | [
"def",
"ClearDataFiles",
"(",
")",
":",
"ReductionSingleton",
"(",
")",
".",
"clear_data_files",
"(",
")"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/reduction_workflow/command_interface.py#L113-L118 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/xml/etree/ElementTree.py | python | ElementTree._setroot | (self, element) | Replace root element of this tree.
This will discard the current contents of the tree and replace it
with the given element. Use with care! | Replace root element of this tree. | [
"Replace",
"root",
"element",
"of",
"this",
"tree",
"."
] | def _setroot(self, element):
"""Replace root element of this tree.
This will discard the current contents of the tree and replace it
with the given element. Use with care!
"""
# assert iselement(element)
self._root = element | [
"def",
"_setroot",
"(",
"self",
",",
"element",
")",
":",
"# assert iselement(element)",
"self",
".",
"_root",
"=",
"element"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/xml/etree/ElementTree.py#L546-L554 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/signal/filter_design.py | python | buttap | (N) | return z, p, k | Return (z,p,k) for analog prototype of Nth-order Butterworth filter.
The filter will have an angular (e.g. rad/s) cutoff frequency of 1.
See Also
--------
butter : Filter design function using this prototype | Return (z,p,k) for analog prototype of Nth-order Butterworth filter. | [
"Return",
"(",
"z",
"p",
"k",
")",
"for",
"analog",
"prototype",
"of",
"Nth",
"-",
"order",
"Butterworth",
"filter",
"."
] | def buttap(N):
"""Return (z,p,k) for analog prototype of Nth-order Butterworth filter.
The filter will have an angular (e.g. rad/s) cutoff frequency of 1.
See Also
--------
butter : Filter design function using this prototype
"""
if abs(int(N)) != N:
raise ValueError("Filter order... | [
"def",
"buttap",
"(",
"N",
")",
":",
"if",
"abs",
"(",
"int",
"(",
"N",
")",
")",
"!=",
"N",
":",
"raise",
"ValueError",
"(",
"\"Filter order must be a nonnegative integer\"",
")",
"z",
"=",
"numpy",
".",
"array",
"(",
"[",
"]",
")",
"m",
"=",
"numpy... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/signal/filter_design.py#L3778-L3795 | |
regomne/chinesize | 2ae555445046cd28d60a514e30ac1d6eca1c442a | N2System/nsbparser/nsbParser.py | python | NsbParser.pa5 | (self) | 加法 | 加法 | [
"加法"
] | def pa5(self):
'加法'
var1=self.stack.pop()
self.stack.append('('+self.stack.pop()+' + '+var1+')') | [
"def",
"pa5",
"(",
"self",
")",
":",
"var1",
"=",
"self",
".",
"stack",
".",
"pop",
"(",
")",
"self",
".",
"stack",
".",
"append",
"(",
"'('",
"+",
"self",
".",
"stack",
".",
"pop",
"(",
")",
"+",
"' + '",
"+",
"var1",
"+",
"')'",
")"
] | https://github.com/regomne/chinesize/blob/2ae555445046cd28d60a514e30ac1d6eca1c442a/N2System/nsbparser/nsbParser.py#L118-L121 | ||
apache/incubator-weex | 5c25f0b59f7ac90703c363e7261f60bd06356dbe | weex_core/tools/cpplint.py | python | _AddFilters | (filters) | Adds more filter overrides.
Unlike _SetFilters, this function does not reset the current list of filters
available.
Args:
filters: A string of comma-separated filters (eg "whitespace/indent").
Each filter should start with + or -; else we die. | Adds more filter overrides. | [
"Adds",
"more",
"filter",
"overrides",
"."
] | def _AddFilters(filters):
"""Adds more filter overrides.
Unlike _SetFilters, this function does not reset the current list of filters
available.
Args:
filters: A string of comma-separated filters (eg "whitespace/indent").
Each filter should start with + or -; else we die.
"""
_cpplint_sta... | [
"def",
"_AddFilters",
"(",
"filters",
")",
":",
"_cpplint_state",
".",
"AddFilters",
"(",
"filters",
")"
] | https://github.com/apache/incubator-weex/blob/5c25f0b59f7ac90703c363e7261f60bd06356dbe/weex_core/tools/cpplint.py#L1013-L1023 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/distutils/config.py | python | PyPIRCCommand._store_pypirc | (self, username, password) | Creates a default .pypirc file. | Creates a default .pypirc file. | [
"Creates",
"a",
"default",
".",
"pypirc",
"file",
"."
] | def _store_pypirc(self, username, password):
"""Creates a default .pypirc file."""
rc = self._get_rc_file()
with os.fdopen(os.open(rc, os.O_CREAT | os.O_WRONLY, 0o600), 'w') as f:
f.write(DEFAULT_PYPIRC % (username, password)) | [
"def",
"_store_pypirc",
"(",
"self",
",",
"username",
",",
"password",
")",
":",
"rc",
"=",
"self",
".",
"_get_rc_file",
"(",
")",
"with",
"os",
".",
"fdopen",
"(",
"os",
".",
"open",
"(",
"rc",
",",
"os",
".",
"O_CREAT",
"|",
"os",
".",
"O_WRONLY"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/distutils/config.py#L42-L46 | ||
klzgrad/naiveproxy | ed2c513637c77b18721fe428d7ed395b4d284c83 | src/build/toolchain/win/setup_toolchain.py | python | _DetectVisualStudioPath | () | return vs_toolchain.DetectVisualStudioPath() | Return path to the installed Visual Studio. | Return path to the installed Visual Studio. | [
"Return",
"path",
"to",
"the",
"installed",
"Visual",
"Studio",
"."
] | def _DetectVisualStudioPath():
"""Return path to the installed Visual Studio.
"""
# Use the code in build/vs_toolchain.py to avoid duplicating code.
chromium_dir = os.path.abspath(os.path.join(SCRIPT_DIR, '..', '..', '..'))
sys.path.append(os.path.join(chromium_dir, 'build'))
import vs_toolchain
return v... | [
"def",
"_DetectVisualStudioPath",
"(",
")",
":",
"# Use the code in build/vs_toolchain.py to avoid duplicating code.",
"chromium_dir",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"path",
".",
"join",
"(",
"SCRIPT_DIR",
",",
"'..'",
",",
"'..'",
",",
"'... | https://github.com/klzgrad/naiveproxy/blob/ed2c513637c77b18721fe428d7ed395b4d284c83/src/build/toolchain/win/setup_toolchain.py#L71-L79 | |
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | python/mxnet/contrib/onnx/mx2onnx/_op_translations.py | python | convert_expand_dims | (node, **kwargs) | return [node] | Map MXNet's expand_dims operator attributes to onnx's Unsqueeze operator
and return the created node. | Map MXNet's expand_dims operator attributes to onnx's Unsqueeze operator
and return the created node. | [
"Map",
"MXNet",
"s",
"expand_dims",
"operator",
"attributes",
"to",
"onnx",
"s",
"Unsqueeze",
"operator",
"and",
"return",
"the",
"created",
"node",
"."
] | def convert_expand_dims(node, **kwargs):
"""Map MXNet's expand_dims operator attributes to onnx's Unsqueeze operator
and return the created node.
"""
name, input_nodes, attrs = get_inputs(node, kwargs)
axis = int(attrs.get("axis"))
node = onnx.helper.make_node(
"Unsqueeze",
inp... | [
"def",
"convert_expand_dims",
"(",
"node",
",",
"*",
"*",
"kwargs",
")",
":",
"name",
",",
"input_nodes",
",",
"attrs",
"=",
"get_inputs",
"(",
"node",
",",
"kwargs",
")",
"axis",
"=",
"int",
"(",
"attrs",
".",
"get",
"(",
"\"axis\"",
")",
")",
"node... | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/python/mxnet/contrib/onnx/mx2onnx/_op_translations.py#L1557-L1572 | |
google/syzygy | 8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5 | third_party/numpy/files/numpy/distutils/fcompiler/__init__.py | python | FCompiler.update_executables | (elf) | Called at the beginning of customisation. Subclasses should
override this if they need to set up the executables dictionary.
Note that self.find_executables() is run afterwards, so the
self.executables dictionary values can contain <F77> or <F90> as
the command, which will be replaced b... | Called at the beginning of customisation. Subclasses should
override this if they need to set up the executables dictionary. | [
"Called",
"at",
"the",
"beginning",
"of",
"customisation",
".",
"Subclasses",
"should",
"override",
"this",
"if",
"they",
"need",
"to",
"set",
"up",
"the",
"executables",
"dictionary",
"."
] | def update_executables(elf):
"""Called at the beginning of customisation. Subclasses should
override this if they need to set up the executables dictionary.
Note that self.find_executables() is run afterwards, so the
self.executables dictionary values can contain <F77> or <F90> as
... | [
"def",
"update_executables",
"(",
"elf",
")",
":",
"pass"
] | https://github.com/google/syzygy/blob/8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5/third_party/numpy/files/numpy/distutils/fcompiler/__init__.py#L362-L371 | ||
freesurfer/freesurfer | 6dbe527d43ffa611acb2cd112e9469f9bfec8e36 | cnn_sphere_register/ext/neuron/neuron/plot.py | python | slices | (slices_in, # the 2D slices
titles=None, # list of titles
cmaps=None, # list of colormaps
norms=None, # list of normalizations
do_colorbars=False, # option to show colorbars on each slice
grid=False, # option to plot... | return (fig, axs) | plot a grid of slices (2d images) | plot a grid of slices (2d images) | [
"plot",
"a",
"grid",
"of",
"slices",
"(",
"2d",
"images",
")"
] | def slices(slices_in, # the 2D slices
titles=None, # list of titles
cmaps=None, # list of colormaps
norms=None, # list of normalizations
do_colorbars=False, # option to show colorbars on each slice
grid=False, # opti... | [
"def",
"slices",
"(",
"slices_in",
",",
"# the 2D slices",
"titles",
"=",
"None",
",",
"# list of titles",
"cmaps",
"=",
"None",
",",
"# list of colormaps",
"norms",
"=",
"None",
",",
"# list of normalizations",
"do_colorbars",
"=",
"False",
",",
"# option to show c... | https://github.com/freesurfer/freesurfer/blob/6dbe527d43ffa611acb2cd112e9469f9bfec8e36/cnn_sphere_register/ext/neuron/neuron/plot.py#L7-L88 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/email/charset.py | python | add_alias | (alias, canonical) | Add a character set alias.
alias is the alias name, e.g. latin-1
canonical is the character set's canonical name, e.g. iso-8859-1 | Add a character set alias. | [
"Add",
"a",
"character",
"set",
"alias",
"."
] | def add_alias(alias, canonical):
"""Add a character set alias.
alias is the alias name, e.g. latin-1
canonical is the character set's canonical name, e.g. iso-8859-1
"""
ALIASES[alias] = canonical | [
"def",
"add_alias",
"(",
"alias",
",",
"canonical",
")",
":",
"ALIASES",
"[",
"alias",
"]",
"=",
"canonical"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/email/charset.py#L136-L142 | ||
ceph/ceph | 959663007321a369c83218414a29bd9dbc8bda3a | qa/tasks/cephfs/filesystem.py | python | Filesystem.list_dirfrag | (self, dir_ino) | return key_list_str.strip().split("\n") if key_list_str else [] | Read the named object and return the list of omap keys
:return a list of 0 or more strings | Read the named object and return the list of omap keys | [
"Read",
"the",
"named",
"object",
"and",
"return",
"the",
"list",
"of",
"omap",
"keys"
] | def list_dirfrag(self, dir_ino):
"""
Read the named object and return the list of omap keys
:return a list of 0 or more strings
"""
dirfrag_obj_name = "{0:x}.00000000".format(dir_ino)
try:
key_list_str = self.radosmo(["listomapkeys", dirfrag_obj_name], stdo... | [
"def",
"list_dirfrag",
"(",
"self",
",",
"dir_ino",
")",
":",
"dirfrag_obj_name",
"=",
"\"{0:x}.00000000\"",
".",
"format",
"(",
"dir_ino",
")",
"try",
":",
"key_list_str",
"=",
"self",
".",
"radosmo",
"(",
"[",
"\"listomapkeys\"",
",",
"dirfrag_obj_name",
"]"... | https://github.com/ceph/ceph/blob/959663007321a369c83218414a29bd9dbc8bda3a/qa/tasks/cephfs/filesystem.py#L1394-L1409 | |
zeakey/DeepSkeleton | dc70170f8fd2ec8ca1157484ce66129981104486 | python/caffe/net_spec.py | python | assign_proto | (proto, name, val) | Assign a Python object to a protobuf message, based on the Python
type (in recursive fashion). Lists become repeated fields/messages, dicts
become messages, and other types are assigned directly. | Assign a Python object to a protobuf message, based on the Python
type (in recursive fashion). Lists become repeated fields/messages, dicts
become messages, and other types are assigned directly. | [
"Assign",
"a",
"Python",
"object",
"to",
"a",
"protobuf",
"message",
"based",
"on",
"the",
"Python",
"type",
"(",
"in",
"recursive",
"fashion",
")",
".",
"Lists",
"become",
"repeated",
"fields",
"/",
"messages",
"dicts",
"become",
"messages",
"and",
"other",... | def assign_proto(proto, name, val):
"""Assign a Python object to a protobuf message, based on the Python
type (in recursive fashion). Lists become repeated fields/messages, dicts
become messages, and other types are assigned directly."""
if isinstance(val, list):
if isinstance(val[0], dict):
... | [
"def",
"assign_proto",
"(",
"proto",
",",
"name",
",",
"val",
")",
":",
"if",
"isinstance",
"(",
"val",
",",
"list",
")",
":",
"if",
"isinstance",
"(",
"val",
"[",
"0",
"]",
",",
"dict",
")",
":",
"for",
"item",
"in",
"val",
":",
"proto_item",
"=... | https://github.com/zeakey/DeepSkeleton/blob/dc70170f8fd2ec8ca1157484ce66129981104486/python/caffe/net_spec.py#L56-L73 | ||
domino-team/openwrt-cc | 8b181297c34d14d3ca521cc9f31430d561dbc688 | package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/tools/gyp/pylib/gyp/xcodeproj_file.py | python | XCObject._EncodeString | (self, value) | return '"' + _escaped.sub(self._EncodeTransform, value) + '"' | Encodes a string to be placed in the project file output, mimicing
Xcode behavior. | Encodes a string to be placed in the project file output, mimicing
Xcode behavior. | [
"Encodes",
"a",
"string",
"to",
"be",
"placed",
"in",
"the",
"project",
"file",
"output",
"mimicing",
"Xcode",
"behavior",
"."
] | def _EncodeString(self, value):
"""Encodes a string to be placed in the project file output, mimicing
Xcode behavior.
"""
# Use quotation marks when any character outside of the range A-Z, a-z, 0-9,
# $ (dollar sign), . (period), and _ (underscore) is present. Also use
# quotation marks to rep... | [
"def",
"_EncodeString",
"(",
"self",
",",
"value",
")",
":",
"# Use quotation marks when any character outside of the range A-Z, a-z, 0-9,",
"# $ (dollar sign), . (period), and _ (underscore) is present. Also use",
"# quotation marks to represent empty strings.",
"#",
"# Escape \" (double-q... | https://github.com/domino-team/openwrt-cc/blob/8b181297c34d14d3ca521cc9f31430d561dbc688/package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/tools/gyp/pylib/gyp/xcodeproj_file.py#L532-L569 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/curses/textpad.py | python | rectangle | (win, uly, ulx, lry, lrx) | Draw a rectangle with corners at the provided upper-left
and lower-right coordinates. | Draw a rectangle with corners at the provided upper-left
and lower-right coordinates. | [
"Draw",
"a",
"rectangle",
"with",
"corners",
"at",
"the",
"provided",
"upper",
"-",
"left",
"and",
"lower",
"-",
"right",
"coordinates",
"."
] | def rectangle(win, uly, ulx, lry, lrx):
"""Draw a rectangle with corners at the provided upper-left
and lower-right coordinates.
"""
win.vline(uly+1, ulx, curses.ACS_VLINE, lry - uly - 1)
win.hline(uly, ulx+1, curses.ACS_HLINE, lrx - ulx - 1)
win.hline(lry, ulx+1, curses.ACS_HLINE, lrx - ulx - 1... | [
"def",
"rectangle",
"(",
"win",
",",
"uly",
",",
"ulx",
",",
"lry",
",",
"lrx",
")",
":",
"win",
".",
"vline",
"(",
"uly",
"+",
"1",
",",
"ulx",
",",
"curses",
".",
"ACS_VLINE",
",",
"lry",
"-",
"uly",
"-",
"1",
")",
"win",
".",
"hline",
"(",... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/curses/textpad.py#L6-L17 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_gdi.py | python | DC.SetUserScale | (*args, **kwargs) | return _gdi_.DC_SetUserScale(*args, **kwargs) | SetUserScale(self, double x, double y)
Sets the user scaling factor, useful for applications which require
'zooming'. | SetUserScale(self, double x, double y) | [
"SetUserScale",
"(",
"self",
"double",
"x",
"double",
"y",
")"
] | def SetUserScale(*args, **kwargs):
"""
SetUserScale(self, double x, double y)
Sets the user scaling factor, useful for applications which require
'zooming'.
"""
return _gdi_.DC_SetUserScale(*args, **kwargs) | [
"def",
"SetUserScale",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"DC_SetUserScale",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_gdi.py#L4429-L4436 | |
llvm/llvm-project | ffa6262cb4e2a335d26416fad39a581b4f98c5f4 | lldb/utils/lui/lldbutil.py | python | value_type_to_str | (enum) | Returns the valueType string given an enum. | Returns the valueType string given an enum. | [
"Returns",
"the",
"valueType",
"string",
"given",
"an",
"enum",
"."
] | def value_type_to_str(enum):
"""Returns the valueType string given an enum."""
if enum == lldb.eValueTypeInvalid:
return "invalid"
elif enum == lldb.eValueTypeVariableGlobal:
return "global_variable"
elif enum == lldb.eValueTypeVariableStatic:
return "static_variable"
elif en... | [
"def",
"value_type_to_str",
"(",
"enum",
")",
":",
"if",
"enum",
"==",
"lldb",
".",
"eValueTypeInvalid",
":",
"return",
"\"invalid\"",
"elif",
"enum",
"==",
"lldb",
".",
"eValueTypeVariableGlobal",
":",
"return",
"\"global_variable\"",
"elif",
"enum",
"==",
"lld... | https://github.com/llvm/llvm-project/blob/ffa6262cb4e2a335d26416fad39a581b4f98c5f4/lldb/utils/lui/lldbutil.py#L259-L278 | ||
deepmind/open_spiel | 4ca53bea32bb2875c7385d215424048ae92f78c8 | open_spiel/python/pytorch/rcfr.py | python | ReservoirBuffer.insert | (self, candidate) | Consider this `candidate` for inclusion in this sampling buffer. | Consider this `candidate` for inclusion in this sampling buffer. | [
"Consider",
"this",
"candidate",
"for",
"inclusion",
"in",
"this",
"sampling",
"buffer",
"."
] | def insert(self, candidate):
"""Consider this `candidate` for inclusion in this sampling buffer."""
self._num_candidates += 1
if self.num_elements < self.size:
self._buffer[self.num_elements] = candidate
self.num_elements += 1
return
idx = np.random.choice(self._num_candidates)
if ... | [
"def",
"insert",
"(",
"self",
",",
"candidate",
")",
":",
"self",
".",
"_num_candidates",
"+=",
"1",
"if",
"self",
".",
"num_elements",
"<",
"self",
".",
"size",
":",
"self",
".",
"_buffer",
"[",
"self",
".",
"num_elements",
"]",
"=",
"candidate",
"sel... | https://github.com/deepmind/open_spiel/blob/4ca53bea32bb2875c7385d215424048ae92f78c8/open_spiel/python/pytorch/rcfr.py#L799-L808 | ||
Samsung/veles | 95ed733c2e49bc011ad98ccf2416ecec23fbf352 | libVeles/cpplint.py | python | CheckForFunctionLengths | (filename, clean_lines, linenum,
function_state, error) | Reports for long function bodies.
For an overview why this is done, see:
http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Write_Short_Functions
Uses a simplistic algorithm assuming other style guidelines
(especially spacing) are followed.
Only checks unindented functions, so class members are ... | Reports for long function bodies. | [
"Reports",
"for",
"long",
"function",
"bodies",
"."
] | def CheckForFunctionLengths(filename, clean_lines, linenum,
function_state, error):
"""Reports for long function bodies.
For an overview why this is done, see:
http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Write_Short_Functions
Uses a simplistic algorithm assuming ... | [
"def",
"CheckForFunctionLengths",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"function_state",
",",
"error",
")",
":",
"lines",
"=",
"clean_lines",
".",
"lines",
"line",
"=",
"lines",
"[",
"linenum",
"]",
"raw",
"=",
"clean_lines",
".",
"raw_l... | https://github.com/Samsung/veles/blob/95ed733c2e49bc011ad98ccf2416ecec23fbf352/libVeles/cpplint.py#L1941-L2008 | ||
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/contrib/bayesflow/python/ops/stochastic_graph.py | python | DistributionTensor._create_value | (self) | Create the value Tensor based on the value type, store as self._value. | Create the value Tensor based on the value type, store as self._value. | [
"Create",
"the",
"value",
"Tensor",
"based",
"on",
"the",
"value",
"type",
"store",
"as",
"self",
".",
"_value",
"."
] | def _create_value(self):
"""Create the value Tensor based on the value type, store as self._value."""
if isinstance(self._value_type, MeanValue):
value_tensor = self._dist.mean()
elif isinstance(self._value_type, SampleValue):
value_tensor = self._dist.sample_n(self._value_type.n)
elif isin... | [
"def",
"_create_value",
"(",
"self",
")",
":",
"if",
"isinstance",
"(",
"self",
".",
"_value_type",
",",
"MeanValue",
")",
":",
"value_tensor",
"=",
"self",
".",
"_dist",
".",
"mean",
"(",
")",
"elif",
"isinstance",
"(",
"self",
".",
"_value_type",
",",
... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/contrib/bayesflow/python/ops/stochastic_graph.py#L406-L448 | ||
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Draft/draftutils/utils.py | python | epsilon | () | return 1.0/(10.0**tolerance()) | Return a small number based on the tolerance for use in comparisons.
The epsilon value is used in floating point comparisons. Use with caution.
::
denom = 10**tolerance
num = 1
epsilon = num/denom
Returns
-------
float
1/(10**tolerance) | Return a small number based on the tolerance for use in comparisons. | [
"Return",
"a",
"small",
"number",
"based",
"on",
"the",
"tolerance",
"for",
"use",
"in",
"comparisons",
"."
] | def epsilon():
"""Return a small number based on the tolerance for use in comparisons.
The epsilon value is used in floating point comparisons. Use with caution.
::
denom = 10**tolerance
num = 1
epsilon = num/denom
Returns
-------
float
1/(10**tolerance)
"""... | [
"def",
"epsilon",
"(",
")",
":",
"return",
"1.0",
"/",
"(",
"10.0",
"**",
"tolerance",
"(",
")",
")"
] | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Draft/draftutils/utils.py#L362-L376 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_controls.py | python | FileCtrl.Create | (*args, **kwargs) | return _controls_.FileCtrl_Create(*args, **kwargs) | Create(self, Window parent, int id=-1, String defaultDirectory=wxEmptyString,
String defaultFilename=wxEmptyString,
String wildCard=wxFileSelectorDefaultWildcardStr,
long style=FC_DEFAULT_STYLE, Point pos=DefaultPosition,
Size size=DefaultSize,
String nam... | Create(self, Window parent, int id=-1, String defaultDirectory=wxEmptyString,
String defaultFilename=wxEmptyString,
String wildCard=wxFileSelectorDefaultWildcardStr,
long style=FC_DEFAULT_STYLE, Point pos=DefaultPosition,
Size size=DefaultSize,
String nam... | [
"Create",
"(",
"self",
"Window",
"parent",
"int",
"id",
"=",
"-",
"1",
"String",
"defaultDirectory",
"=",
"wxEmptyString",
"String",
"defaultFilename",
"=",
"wxEmptyString",
"String",
"wildCard",
"=",
"wxFileSelectorDefaultWildcardStr",
"long",
"style",
"=",
"FC_DEF... | def Create(*args, **kwargs):
"""
Create(self, Window parent, int id=-1, String defaultDirectory=wxEmptyString,
String defaultFilename=wxEmptyString,
String wildCard=wxFileSelectorDefaultWildcardStr,
long style=FC_DEFAULT_STYLE, Point pos=DefaultPosition,
... | [
"def",
"Create",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"FileCtrl_Create",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_controls.py#L7597-L7606 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSILLReduction.py | python | SANSILLReduction._split_kinetic_frames | (self, ws) | return frames | Explodes the frames of a kinetic workspace into separate workspaces | Explodes the frames of a kinetic workspace into separate workspaces | [
"Explodes",
"the",
"frames",
"of",
"a",
"kinetic",
"workspace",
"into",
"separate",
"workspaces"
] | def _split_kinetic_frames(self, ws):
'''Explodes the frames of a kinetic workspace into separate workspaces'''
n_frames = mtd[ws].blocksize()
n_hist = mtd[ws].getNumberHistograms()
wavelength = round(mtd[ws].getRun().getLogData('wavelength').value * 100) / 100
wave_bins = [wavele... | [
"def",
"_split_kinetic_frames",
"(",
"self",
",",
"ws",
")",
":",
"n_frames",
"=",
"mtd",
"[",
"ws",
"]",
".",
"blocksize",
"(",
")",
"n_hist",
"=",
"mtd",
"[",
"ws",
"]",
".",
"getNumberHistograms",
"(",
")",
"wavelength",
"=",
"round",
"(",
"mtd",
... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSILLReduction.py#L852-L868 | |
trailofbits/llvm-sanitizer-tutorial | d29dfeec7f51fbf234fd0080f28f2b30cd0b6e99 | llvm/tools/clang/bindings/python/clang/cindex.py | python | Cursor.access_specifier | (self) | return AccessSpecifier.from_id(self._access_specifier) | Retrieves the access specifier (if any) of the entity pointed at by the
cursor. | Retrieves the access specifier (if any) of the entity pointed at by the
cursor. | [
"Retrieves",
"the",
"access",
"specifier",
"(",
"if",
"any",
")",
"of",
"the",
"entity",
"pointed",
"at",
"by",
"the",
"cursor",
"."
] | def access_specifier(self):
"""
Retrieves the access specifier (if any) of the entity pointed at by the
cursor.
"""
if not hasattr(self, '_access_specifier'):
self._access_specifier = conf.lib.clang_getCXXAccessSpecifier(self)
return AccessSpecifier.from_id(s... | [
"def",
"access_specifier",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'_access_specifier'",
")",
":",
"self",
".",
"_access_specifier",
"=",
"conf",
".",
"lib",
".",
"clang_getCXXAccessSpecifier",
"(",
"self",
")",
"return",
"AccessSpeci... | https://github.com/trailofbits/llvm-sanitizer-tutorial/blob/d29dfeec7f51fbf234fd0080f28f2b30cd0b6e99/llvm/tools/clang/bindings/python/clang/cindex.py#L1630-L1638 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/combo.py | python | ComboCtrl.Popup | (*args, **kwargs) | return _combo.ComboCtrl_Popup(*args, **kwargs) | Popup(self) | Popup(self) | [
"Popup",
"(",
"self",
")"
] | def Popup(*args, **kwargs):
"""Popup(self)"""
return _combo.ComboCtrl_Popup(*args, **kwargs) | [
"def",
"Popup",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_combo",
".",
"ComboCtrl_Popup",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/combo.py#L124-L126 | |
stulp/dmpbbo | ca900e3b851d25faaf59ea296650370c70ed7d0f | python/bbo/updaters.py | python | UpdaterCovarDecay.__init__ | (self,eliteness = 10, weighting_method = 'PI-BB', covar_decay_factor = 0.8) | Initialize an UpdaterCovarDecay object.
\param[in] eliteness The eliteness parameter (see costsToWeights(...))
\param[in] weighting_method The weighting method ('PI-BB','CMA-ES','CEM', see costsToWeights(...))
\param[in] covar_decay_factor Factor with which to decay the covariance matrix (i.e. c... | Initialize an UpdaterCovarDecay object.
\param[in] eliteness The eliteness parameter (see costsToWeights(...))
\param[in] weighting_method The weighting method ('PI-BB','CMA-ES','CEM', see costsToWeights(...))
\param[in] covar_decay_factor Factor with which to decay the covariance matrix (i.e. c... | [
"Initialize",
"an",
"UpdaterCovarDecay",
"object",
".",
"\\",
"param",
"[",
"in",
"]",
"eliteness",
"The",
"eliteness",
"parameter",
"(",
"see",
"costsToWeights",
"(",
"...",
"))",
"\\",
"param",
"[",
"in",
"]",
"weighting_method",
"The",
"weighting",
"method"... | def __init__(self,eliteness = 10, weighting_method = 'PI-BB', covar_decay_factor = 0.8):
""" Initialize an UpdaterCovarDecay object.
\param[in] eliteness The eliteness parameter (see costsToWeights(...))
\param[in] weighting_method The weighting method ('PI-BB','CMA-ES','CEM', see costsToWeights... | [
"def",
"__init__",
"(",
"self",
",",
"eliteness",
"=",
"10",
",",
"weighting_method",
"=",
"'PI-BB'",
",",
"covar_decay_factor",
"=",
"0.8",
")",
":",
"self",
".",
"eliteness",
"=",
"eliteness",
"self",
".",
"weighting_method",
"=",
"weighting_method",
"self",... | https://github.com/stulp/dmpbbo/blob/ca900e3b851d25faaf59ea296650370c70ed7d0f/python/bbo/updaters.py#L77-L85 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.