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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
weolar/miniblink49 | 1c4678db0594a4abde23d3ebbcc7cd13c3170777 | third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/pep8.py | python | BaseReport.start | (self) | Start the timer. | Start the timer. | [
"Start",
"the",
"timer",
"."
] | def start(self):
"""Start the timer."""
self._start_time = time.time() | [
"def",
"start",
"(",
"self",
")",
":",
"self",
".",
"_start_time",
"=",
"time",
".",
"time",
"(",
")"
] | https://github.com/weolar/miniblink49/blob/1c4678db0594a4abde23d3ebbcc7cd13c3170777/third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/pep8.py#L1474-L1476 | ||
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/contrib/learn/python/learn/estimators/random_forest.py | python | TensorForestEstimator.predict_proba | (
self, x=None, input_fn=None, batch_size=None, as_iterable=False) | return super(TensorForestEstimator, self).predict(
x=x, input_fn=input_fn, batch_size=batch_size, as_iterable=as_iterable) | Returns prediction probabilities for given features (classification).
Args:
x: features.
input_fn: Input function. If set, x and y must be None.
batch_size: Override default batch size.
as_iterable: If True, return an iterable which keeps yielding predictions
for each example until ... | Returns prediction probabilities for given features (classification). | [
"Returns",
"prediction",
"probabilities",
"for",
"given",
"features",
"(",
"classification",
")",
"."
] | def predict_proba(
self, x=None, input_fn=None, batch_size=None, as_iterable=False):
"""Returns prediction probabilities for given features (classification).
Args:
x: features.
input_fn: Input function. If set, x and y must be None.
batch_size: Override default batch size.
as_iter... | [
"def",
"predict_proba",
"(",
"self",
",",
"x",
"=",
"None",
",",
"input_fn",
"=",
"None",
",",
"batch_size",
"=",
"None",
",",
"as_iterable",
"=",
"False",
")",
":",
"return",
"super",
"(",
"TensorForestEstimator",
",",
"self",
")",
".",
"predict",
"(",
... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/contrib/learn/python/learn/estimators/random_forest.py#L102-L123 | |
rsummers11/CADLab | 976ed959a0b5208bb4173127a7ef732ac73a9b6f | lesion_detector_3DCE/rcnn/fio/load_ct_img.py | python | load_prep_img | (imname, slice_idx, spacing, slice_intv, do_clip=False, num_slice=3) | return im, im_scale, c | load volume, windowing, interpolate multiple slices, clip black border, resize according to spacing | load volume, windowing, interpolate multiple slices, clip black border, resize according to spacing | [
"load",
"volume",
"windowing",
"interpolate",
"multiple",
"slices",
"clip",
"black",
"border",
"resize",
"according",
"to",
"spacing"
] | def load_prep_img(imname, slice_idx, spacing, slice_intv, do_clip=False, num_slice=3):
"""load volume, windowing, interpolate multiple slices, clip black border, resize according to spacing"""
if imname.endswith('.nii.gz') or imname.endswith('.nii'):
im, mask = load_multislice_img_nifti(imname, slice_id... | [
"def",
"load_prep_img",
"(",
"imname",
",",
"slice_idx",
",",
"spacing",
",",
"slice_intv",
",",
"do_clip",
"=",
"False",
",",
"num_slice",
"=",
"3",
")",
":",
"if",
"imname",
".",
"endswith",
"(",
"'.nii.gz'",
")",
"or",
"imname",
".",
"endswith",
"(",
... | https://github.com/rsummers11/CADLab/blob/976ed959a0b5208bb4173127a7ef732ac73a9b6f/lesion_detector_3DCE/rcnn/fio/load_ct_img.py#L16-L48 | |
OAID/Tengine | 66b2c22ad129d25e2fc6de3b22a608bb54dd90db | pytengine/tengine/node.py | python | Node.getOutputTensorByIdx | (self, idx) | return Tensor(tensor=tensor) | Get the output tensor handle of a node.
:param idx: <int> The index of the output tensor.
:return: The tensor handle or None on error. | Get the output tensor handle of a node.
:param idx: <int> The index of the output tensor.
:return: The tensor handle or None on error. | [
"Get",
"the",
"output",
"tensor",
"handle",
"of",
"a",
"node",
".",
":",
"param",
"idx",
":",
"<int",
">",
"The",
"index",
"of",
"the",
"output",
"tensor",
".",
":",
"return",
":",
"The",
"tensor",
"handle",
"or",
"None",
"on",
"error",
"."
] | def getOutputTensorByIdx(self, idx):
"""
Get the output tensor handle of a node.
:param idx: <int> The index of the output tensor.
:return: The tensor handle or None on error.
"""
_LIB.get_node_output_tensor.restype = tensor_t
tensor = _LIB.get_node_output_tensor(... | [
"def",
"getOutputTensorByIdx",
"(",
"self",
",",
"idx",
")",
":",
"_LIB",
".",
"get_node_output_tensor",
".",
"restype",
"=",
"tensor_t",
"tensor",
"=",
"_LIB",
".",
"get_node_output_tensor",
"(",
"ctypes",
".",
"c_void_p",
"(",
"self",
".",
"node",
")",
","... | https://github.com/OAID/Tengine/blob/66b2c22ad129d25e2fc6de3b22a608bb54dd90db/pytengine/tengine/node.py#L65-L73 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/tornado/tornado-6/tornado/gen.py | python | is_coroutine_function | (func: Any) | return getattr(func, "__tornado_coroutine__", False) | Return whether *func* is a coroutine function, i.e. a function
wrapped with `~.gen.coroutine`.
.. versionadded:: 4.5 | Return whether *func* is a coroutine function, i.e. a function
wrapped with `~.gen.coroutine`. | [
"Return",
"whether",
"*",
"func",
"*",
"is",
"a",
"coroutine",
"function",
"i",
".",
"e",
".",
"a",
"function",
"wrapped",
"with",
"~",
".",
"gen",
".",
"coroutine",
"."
] | def is_coroutine_function(func: Any) -> bool:
"""Return whether *func* is a coroutine function, i.e. a function
wrapped with `~.gen.coroutine`.
.. versionadded:: 4.5
"""
return getattr(func, "__tornado_coroutine__", False) | [
"def",
"is_coroutine_function",
"(",
"func",
":",
"Any",
")",
"->",
"bool",
":",
"return",
"getattr",
"(",
"func",
",",
"\"__tornado_coroutine__\"",
",",
"False",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/tornado/tornado-6/tornado/gen.py#L273-L279 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/keras/backend.py | python | backend | () | return 'tensorflow' | Publicly accessible method for determining the current backend.
Only exists for API compatibility with multi-backend Keras.
Returns:
The string "tensorflow". | Publicly accessible method for determining the current backend. | [
"Publicly",
"accessible",
"method",
"for",
"determining",
"the",
"current",
"backend",
"."
] | def backend():
"""Publicly accessible method for determining the current backend.
Only exists for API compatibility with multi-backend Keras.
Returns:
The string "tensorflow".
"""
return 'tensorflow' | [
"def",
"backend",
"(",
")",
":",
"return",
"'tensorflow'"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/keras/backend.py#L175-L183 | |
google/mysql-protobuf | 467cda676afaa49e762c5c9164a43f6ad31a1fbf | libevent/event_rpcgen.py | python | Struct.PrintIdented | (self, file, ident, code) | Takes an array, add indentation to each entry and prints it. | Takes an array, add indentation to each entry and prints it. | [
"Takes",
"an",
"array",
"add",
"indentation",
"to",
"each",
"entry",
"and",
"prints",
"it",
"."
] | def PrintIdented(self, file, ident, code):
"""Takes an array, add indentation to each entry and prints it."""
for entry in code:
print >>file, '%s%s' % (ident, entry) | [
"def",
"PrintIdented",
"(",
"self",
",",
"file",
",",
"ident",
",",
"code",
")",
":",
"for",
"entry",
"in",
"code",
":",
"print",
">>",
"file",
",",
"'%s%s'",
"%",
"(",
"ident",
",",
"entry",
")"
] | https://github.com/google/mysql-protobuf/blob/467cda676afaa49e762c5c9164a43f6ad31a1fbf/libevent/event_rpcgen.py#L52-L55 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | contrib/gizmos/osx_cocoa/gizmos.py | python | TreeListCtrl.EditLabel | (*args, **kwargs) | return _gizmos.TreeListCtrl_EditLabel(*args, **kwargs) | EditLabel(self, TreeItemId item, int column=-1) | EditLabel(self, TreeItemId item, int column=-1) | [
"EditLabel",
"(",
"self",
"TreeItemId",
"item",
"int",
"column",
"=",
"-",
"1",
")"
] | def EditLabel(*args, **kwargs):
"""EditLabel(self, TreeItemId item, int column=-1)"""
return _gizmos.TreeListCtrl_EditLabel(*args, **kwargs) | [
"def",
"EditLabel",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gizmos",
".",
"TreeListCtrl_EditLabel",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/contrib/gizmos/osx_cocoa/gizmos.py#L923-L925 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/extern/aui/auibar.py | python | AuiToolBar.OnLeftUp | (self, event) | Handles the ``wx.EVT_LEFT_UP`` event for :class:`AuiToolBar`.
:param `event`: a :class:`MouseEvent` event to be processed. | Handles the ``wx.EVT_LEFT_UP`` event for :class:`AuiToolBar`. | [
"Handles",
"the",
"wx",
".",
"EVT_LEFT_UP",
"event",
"for",
":",
"class",
":",
"AuiToolBar",
"."
] | def OnLeftUp(self, event):
"""
Handles the ``wx.EVT_LEFT_UP`` event for :class:`AuiToolBar`.
:param `event`: a :class:`MouseEvent` event to be processed.
"""
self.SetPressedItem(None)
hit_item = self.FindToolForPosition(*event.GetPosition())
... | [
"def",
"OnLeftUp",
"(",
"self",
",",
"event",
")",
":",
"self",
".",
"SetPressedItem",
"(",
"None",
")",
"hit_item",
"=",
"self",
".",
"FindToolForPosition",
"(",
"*",
"event",
".",
"GetPosition",
"(",
")",
")",
"if",
"hit_item",
"and",
"not",
"hit_item"... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/extern/aui/auibar.py#L3636-L3710 | ||
root-project/root | fcd3583bb14852bf2e8cd2415717cbaac0e75896 | interpreter/llvm/src/tools/clang/tools/scan-build-py/libscanbuild/clang.py | python | get_checkers | (clang, plugins) | return checkers | Get all the available checkers from default and from the plugins.
:param clang: the compiler we are using
:param plugins: list of plugins which was requested by the user
:return: a dictionary of all available checkers and its status
{<checker name>: (<checker description>, <is active by defau... | Get all the available checkers from default and from the plugins. | [
"Get",
"all",
"the",
"available",
"checkers",
"from",
"default",
"and",
"from",
"the",
"plugins",
"."
] | def get_checkers(clang, plugins):
""" Get all the available checkers from default and from the plugins.
:param clang: the compiler we are using
:param plugins: list of plugins which was requested by the user
:return: a dictionary of all available checkers and its status
{<checker name>: (... | [
"def",
"get_checkers",
"(",
"clang",
",",
"plugins",
")",
":",
"load",
"=",
"[",
"elem",
"for",
"plugin",
"in",
"plugins",
"for",
"elem",
"in",
"[",
"'-load'",
",",
"plugin",
"]",
"]",
"cmd",
"=",
"[",
"clang",
",",
"'-cc1'",
"]",
"+",
"load",
"+",... | https://github.com/root-project/root/blob/fcd3583bb14852bf2e8cd2415717cbaac0e75896/interpreter/llvm/src/tools/clang/tools/scan-build-py/libscanbuild/clang.py#L132-L155 | |
bareos/bareos | 56a10bb368b0a81e977bb51304033fe49d59efb0 | restapi/bareos_restapi/__init__.py | python | read_all_filesets | (
*,
response: Response,
current_user: User = Depends(get_current_user),
verbose: Optional[bareosBool] = Query("yes", title="Verbose output"),
) | return show_configuration_items(
response=response,
current_user=current_user,
itemType="filesets",
verbose=verbose,
) | Read all jobdef resources. Built on console command _show filesets_.
Needs at least Bareos Version >= 20.0.0 | Read all jobdef resources. Built on console command _show filesets_. | [
"Read",
"all",
"jobdef",
"resources",
".",
"Built",
"on",
"console",
"command",
"_show",
"filesets_",
"."
] | def read_all_filesets(
*,
response: Response,
current_user: User = Depends(get_current_user),
verbose: Optional[bareosBool] = Query("yes", title="Verbose output"),
):
"""
Read all jobdef resources. Built on console command _show filesets_.
Needs at least Bareos Version >= 20.0.0
"""
... | [
"def",
"read_all_filesets",
"(",
"*",
",",
"response",
":",
"Response",
",",
"current_user",
":",
"User",
"=",
"Depends",
"(",
"get_current_user",
")",
",",
"verbose",
":",
"Optional",
"[",
"bareosBool",
"]",
"=",
"Query",
"(",
"\"yes\"",
",",
"title",
"="... | https://github.com/bareos/bareos/blob/56a10bb368b0a81e977bb51304033fe49d59efb0/restapi/bareos_restapi/__init__.py#L593-L609 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/roc/compiler.py | python | _unpack_argument | (ty, val, kernelargs, retr) | Convert arguments to ctypes and append to kernelargs | Convert arguments to ctypes and append to kernelargs | [
"Convert",
"arguments",
"to",
"ctypes",
"and",
"append",
"to",
"kernelargs"
] | def _unpack_argument(ty, val, kernelargs, retr):
"""
Convert arguments to ctypes and append to kernelargs
"""
if isinstance(ty, types.Array):
c_intp = ctypes.c_ssize_t
# if a dgpu is present, move the data to the device.
if dgpu_present:
devary, conv = devicearray.aut... | [
"def",
"_unpack_argument",
"(",
"ty",
",",
"val",
",",
"kernelargs",
",",
"retr",
")",
":",
"if",
"isinstance",
"(",
"ty",
",",
"types",
".",
"Array",
")",
":",
"c_intp",
"=",
"ctypes",
".",
"c_ssize_t",
"# if a dgpu is present, move the data to the device.",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/roc/compiler.py#L374-L428 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_core.py | python | BookCtrlEvent.SetSelection | (*args, **kwargs) | return _core_.BookCtrlEvent_SetSelection(*args, **kwargs) | SetSelection(self, int nSel) | SetSelection(self, int nSel) | [
"SetSelection",
"(",
"self",
"int",
"nSel",
")"
] | def SetSelection(*args, **kwargs):
"""SetSelection(self, int nSel)"""
return _core_.BookCtrlEvent_SetSelection(*args, **kwargs) | [
"def",
"SetSelection",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"BookCtrlEvent_SetSelection",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_core.py#L13719-L13721 | |
cvxpy/cvxpy | 5165b4fb750dfd237de8659383ef24b4b2e33aaf | cvxpy/atoms/affine/trace.py | python | trace.shape_from_args | (self) | return tuple() | Always scalar. | Always scalar. | [
"Always",
"scalar",
"."
] | def shape_from_args(self) -> Tuple[int, ...]:
"""Always scalar.
"""
return tuple() | [
"def",
"shape_from_args",
"(",
"self",
")",
"->",
"Tuple",
"[",
"int",
",",
"...",
"]",
":",
"return",
"tuple",
"(",
")"
] | https://github.com/cvxpy/cvxpy/blob/5165b4fb750dfd237de8659383ef24b4b2e33aaf/cvxpy/atoms/affine/trace.py#L51-L54 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/robotsim.py | python | Appearance.setTexgen | (self, np_array2: Vector, worldcoordinates: bool=False) | return _robotsim.Appearance_setTexgen(self, np_array2, worldcoordinates) | r"""
Sets the texture generation. The array must be size m x 4, with m in the range
0,...,4. If worldcoordinates=true, the texture generation is performed in world
coordinates rather than object coordinates.
Args:
np_array2 (:obj:`2D Numpy array of floats`)
wor... | r"""
Sets the texture generation. The array must be size m x 4, with m in the range
0,...,4. If worldcoordinates=true, the texture generation is performed in world
coordinates rather than object coordinates. | [
"r",
"Sets",
"the",
"texture",
"generation",
".",
"The",
"array",
"must",
"be",
"size",
"m",
"x",
"4",
"with",
"m",
"in",
"the",
"range",
"0",
"...",
"4",
".",
"If",
"worldcoordinates",
"=",
"true",
"the",
"texture",
"generation",
"is",
"performed",
"i... | def setTexgen(self, np_array2: Vector, worldcoordinates: bool=False) ->None:
r"""
Sets the texture generation. The array must be size m x 4, with m in the range
0,...,4. If worldcoordinates=true, the texture generation is performed in world
coordinates rather than object coordinates.
... | [
"def",
"setTexgen",
"(",
"self",
",",
"np_array2",
":",
"Vector",
",",
"worldcoordinates",
":",
"bool",
"=",
"False",
")",
"->",
"None",
":",
"return",
"_robotsim",
".",
"Appearance_setTexgen",
"(",
"self",
",",
"np_array2",
",",
"worldcoordinates",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/robotsim.py#L3048-L3058 | |
macchina-io/macchina.io | ef24ba0e18379c3dd48fb84e6dbf991101cb8db0 | platform/JS/V8/tools/gyp/pylib/gyp/generator/dump_dependency_json.py | python | CalculateGeneratorInputInfo | (params) | Calculate the generator specific info that gets fed to input (called by
gyp). | Calculate the generator specific info that gets fed to input (called by
gyp). | [
"Calculate",
"the",
"generator",
"specific",
"info",
"that",
"gets",
"fed",
"to",
"input",
"(",
"called",
"by",
"gyp",
")",
"."
] | def CalculateGeneratorInputInfo(params):
"""Calculate the generator specific info that gets fed to input (called by
gyp)."""
generator_flags = params.get('generator_flags', {})
if generator_flags.get('adjust_static_libraries', False):
global generator_wants_static_library_dependencies_adjusted
generator... | [
"def",
"CalculateGeneratorInputInfo",
"(",
"params",
")",
":",
"generator_flags",
"=",
"params",
".",
"get",
"(",
"'generator_flags'",
",",
"{",
"}",
")",
"if",
"generator_flags",
".",
"get",
"(",
"'adjust_static_libraries'",
",",
"False",
")",
":",
"global",
... | https://github.com/macchina-io/macchina.io/blob/ef24ba0e18379c3dd48fb84e6dbf991101cb8db0/platform/JS/V8/tools/gyp/pylib/gyp/generator/dump_dependency_json.py#L54-L72 | ||
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/fft/fftpack.py | python | irfft2 | (a, s=None, axes=(-2, -1)) | return irfftn(a, s, axes) | Compute the 2-dimensional inverse FFT of a real array.
Parameters
----------
a : array_like
The input array
s : sequence of ints, optional
Shape of the inverse FFT.
axes : sequence of ints, optional
The axes over which to compute the inverse fft.
Default is the last ... | Compute the 2-dimensional inverse FFT of a real array. | [
"Compute",
"the",
"2",
"-",
"dimensional",
"inverse",
"FFT",
"of",
"a",
"real",
"array",
"."
] | def irfft2(a, s=None, axes=(-2, -1)):
"""
Compute the 2-dimensional inverse FFT of a real array.
Parameters
----------
a : array_like
The input array
s : sequence of ints, optional
Shape of the inverse FFT.
axes : sequence of ints, optional
The axes over which to com... | [
"def",
"irfft2",
"(",
"a",
",",
"s",
"=",
"None",
",",
"axes",
"=",
"(",
"-",
"2",
",",
"-",
"1",
")",
")",
":",
"return",
"irfftn",
"(",
"a",
",",
"s",
",",
"axes",
")"
] | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/fft/fftpack.py#L1097-L1127 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/ntpath.py | python | relpath | (path, start=None) | Return a relative version of a path | Return a relative version of a path | [
"Return",
"a",
"relative",
"version",
"of",
"a",
"path"
] | def relpath(path, start=None):
"""Return a relative version of a path"""
path = os.fspath(path)
if isinstance(path, bytes):
sep = b'\\'
curdir = b'.'
pardir = b'..'
else:
sep = '\\'
curdir = '.'
pardir = '..'
if start is None:
start = curdir
... | [
"def",
"relpath",
"(",
"path",
",",
"start",
"=",
"None",
")",
":",
"path",
"=",
"os",
".",
"fspath",
"(",
"path",
")",
"if",
"isinstance",
"(",
"path",
",",
"bytes",
")",
":",
"sep",
"=",
"b'\\\\'",
"curdir",
"=",
"b'.'",
"pardir",
"=",
"b'..'",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/ntpath.py#L536-L579 | ||
DGA-MI-SSI/YaCo | 9b85e6ca1809114c4df1382c11255f7e38408912 | deps/flatbuffers-1.8.0/python/flatbuffers/builder.py | python | Builder.PlaceSOffsetT | (self, x) | PlaceSOffsetT prepends a SOffsetT to the Builder, without checking
for space. | PlaceSOffsetT prepends a SOffsetT to the Builder, without checking
for space. | [
"PlaceSOffsetT",
"prepends",
"a",
"SOffsetT",
"to",
"the",
"Builder",
"without",
"checking",
"for",
"space",
"."
] | def PlaceSOffsetT(self, x):
"""PlaceSOffsetT prepends a SOffsetT to the Builder, without checking
for space.
"""
N.enforce_number(x, N.SOffsetTFlags)
self.head = self.head - N.SOffsetTFlags.bytewidth
encode.Write(packer.soffset, self.Bytes, self.Head(), x) | [
"def",
"PlaceSOffsetT",
"(",
"self",
",",
"x",
")",
":",
"N",
".",
"enforce_number",
"(",
"x",
",",
"N",
".",
"SOffsetTFlags",
")",
"self",
".",
"head",
"=",
"self",
".",
"head",
"-",
"N",
".",
"SOffsetTFlags",
".",
"bytewidth",
"encode",
".",
"Write... | https://github.com/DGA-MI-SSI/YaCo/blob/9b85e6ca1809114c4df1382c11255f7e38408912/deps/flatbuffers-1.8.0/python/flatbuffers/builder.py#L664-L670 | ||
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/fluid/dygraph/dygraph_to_static/partial_program.py | python | PartialProgramLayer._infer_program | (self) | return self._clone_for_test(self._origin_main_program) | Lazy initialized property of infer_program. | Lazy initialized property of infer_program. | [
"Lazy",
"initialized",
"property",
"of",
"infer_program",
"."
] | def _infer_program(self):
"""
Lazy initialized property of infer_program.
"""
return self._clone_for_test(self._origin_main_program) | [
"def",
"_infer_program",
"(",
"self",
")",
":",
"return",
"self",
".",
"_clone_for_test",
"(",
"self",
".",
"_origin_main_program",
")"
] | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/fluid/dygraph/dygraph_to_static/partial_program.py#L165-L169 | |
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | python/mxnet/contrib/onnx/mx2onnx/_op_translations.py | python | convert_flatten | (node, **kwargs) | return create_basic_op_node('Flatten', node, kwargs) | Map MXNet's Flatten operator attributes to onnx's Flatten operator
and return the created node. | Map MXNet's Flatten operator attributes to onnx's Flatten operator
and return the created node. | [
"Map",
"MXNet",
"s",
"Flatten",
"operator",
"attributes",
"to",
"onnx",
"s",
"Flatten",
"operator",
"and",
"return",
"the",
"created",
"node",
"."
] | def convert_flatten(node, **kwargs):
"""Map MXNet's Flatten operator attributes to onnx's Flatten operator
and return the created node.
"""
return create_basic_op_node('Flatten', node, kwargs) | [
"def",
"convert_flatten",
"(",
"node",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"create_basic_op_node",
"(",
"'Flatten'",
",",
"node",
",",
"kwargs",
")"
] | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/python/mxnet/contrib/onnx/mx2onnx/_op_translations.py#L965-L969 | |
LiquidPlayer/LiquidCore | 9405979363f2353ac9a71ad8ab59685dd7f919c9 | deps/boost_1_66_0/libs/metaparse/tools/benchmark/generate.py | python | random_chars | (number) | return (
format_character(nth_char(char_map, random.randint(0, char_num - 1)))
for _ in xrange(0, number)
) | Generate random characters | Generate random characters | [
"Generate",
"random",
"characters"
] | def random_chars(number):
"""Generate random characters"""
char_map = {
k: v for k, v in chars.CHARS.iteritems()
if not format_character(k).startswith('\\x')
}
char_num = sum(char_map.values())
return (
format_character(nth_char(char_map, random.randint(0, char_num - 1)))
... | [
"def",
"random_chars",
"(",
"number",
")",
":",
"char_map",
"=",
"{",
"k",
":",
"v",
"for",
"k",
",",
"v",
"in",
"chars",
".",
"CHARS",
".",
"iteritems",
"(",
")",
"if",
"not",
"format_character",
"(",
"k",
")",
".",
"startswith",
"(",
"'\\\\x'",
"... | https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/boost_1_66_0/libs/metaparse/tools/benchmark/generate.py#L50-L61 | |
ArduPilot/ardupilot | 6e684b3496122b8158ac412b609d00004b7ac306 | Tools/scripts/build_binaries.py | python | build_binaries.build_antennatracker | (self, tag) | build Tracker binaries | build Tracker binaries | [
"build",
"Tracker",
"binaries"
] | def build_antennatracker(self, tag):
'''build Tracker binaries'''
boards = self.common_boards()[:]
self.build_vehicle(tag,
"AntennaTracker",
boards,
"AntennaTracker",
"antennatracker") | [
"def",
"build_antennatracker",
"(",
"self",
",",
"tag",
")",
":",
"boards",
"=",
"self",
".",
"common_boards",
"(",
")",
"[",
":",
"]",
"self",
".",
"build_vehicle",
"(",
"tag",
",",
"\"AntennaTracker\"",
",",
"boards",
",",
"\"AntennaTracker\"",
",",
"\"a... | https://github.com/ArduPilot/ardupilot/blob/6e684b3496122b8158ac412b609d00004b7ac306/Tools/scripts/build_binaries.py#L550-L557 | ||
tum-vision/fusenet | a1451be2971b348a01b0f525c2a3a7a0e215a591 | scripts/cpp_lint.py | python | _NestingState.CheckCompletedBlocks | (self, filename, error) | Checks that all classes and namespaces have been completely parsed.
Call this when all lines in a file have been processed.
Args:
filename: The name of the current file.
error: The function to call with any errors found. | Checks that all classes and namespaces have been completely parsed. | [
"Checks",
"that",
"all",
"classes",
"and",
"namespaces",
"have",
"been",
"completely",
"parsed",
"."
] | def CheckCompletedBlocks(self, filename, error):
"""Checks that all classes and namespaces have been completely parsed.
Call this when all lines in a file have been processed.
Args:
filename: The name of the current file.
error: The function to call with any errors found.
"""
# Note: Th... | [
"def",
"CheckCompletedBlocks",
"(",
"self",
",",
"filename",
",",
"error",
")",
":",
"# Note: This test can result in false positives if #ifdef constructs",
"# get in the way of brace matching. See the testBuildClass test in",
"# cpplint_unittest.py for an example of this.",
"for",
"obj"... | https://github.com/tum-vision/fusenet/blob/a1451be2971b348a01b0f525c2a3a7a0e215a591/scripts/cpp_lint.py#L2172-L2191 | ||
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | lts/tools/inspector_protocol/jinja2/parser.py | python | Parser.free_identifier | (self, lineno=None) | return rv | Return a new free identifier as :class:`~jinja2.nodes.InternalName`. | Return a new free identifier as :class:`~jinja2.nodes.InternalName`. | [
"Return",
"a",
"new",
"free",
"identifier",
"as",
":",
"class",
":",
"~jinja2",
".",
"nodes",
".",
"InternalName",
"."
] | def free_identifier(self, lineno=None):
"""Return a new free identifier as :class:`~jinja2.nodes.InternalName`."""
self._last_identifier += 1
rv = object.__new__(nodes.InternalName)
nodes.Node.__init__(rv, 'fi%d' % self._last_identifier, lineno=lineno)
return rv | [
"def",
"free_identifier",
"(",
"self",
",",
"lineno",
"=",
"None",
")",
":",
"self",
".",
"_last_identifier",
"+=",
"1",
"rv",
"=",
"object",
".",
"__new__",
"(",
"nodes",
".",
"InternalName",
")",
"nodes",
".",
"Node",
".",
"__init__",
"(",
"rv",
",",... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/tools/inspector_protocol/jinja2/parser.py#L114-L119 | |
PX4/PX4-Autopilot | 0b9f60a0370be53d683352c63fd92db3d6586e18 | Tools/mavlink_px4.py | python | MAVLink.change_operator_control_ack_send | (self, gcs_system_id, control_request, ack) | return self.send(self.change_operator_control_ack_encode(gcs_system_id, control_request, ack)) | Accept / deny control of this MAV
gcs_system_id : ID of the GCS this message (uint8_t)
control_request : 0: request control of this MAV, 1: Release control of this MAV (uint8_t)
ack : 0: ACK, 1: NACK: Wrong passkey, 2: NACK: Un... | Accept / deny control of this MAV | [
"Accept",
"/",
"deny",
"control",
"of",
"this",
"MAV"
] | def change_operator_control_ack_send(self, gcs_system_id, control_request, ack):
'''
Accept / deny control of this MAV
gcs_system_id : ID of the GCS this message (uint8_t)
control_request : 0: request control of this MAV, 1: Release ... | [
"def",
"change_operator_control_ack_send",
"(",
"self",
",",
"gcs_system_id",
",",
"control_request",
",",
"ack",
")",
":",
"return",
"self",
".",
"send",
"(",
"self",
".",
"change_operator_control_ack_encode",
"(",
"gcs_system_id",
",",
"control_request",
",",
"ack... | https://github.com/PX4/PX4-Autopilot/blob/0b9f60a0370be53d683352c63fd92db3d6586e18/Tools/mavlink_px4.py#L2600-L2609 | |
hfinkel/llvm-project-cxxjit | 91084ef018240bbb8e24235ff5cd8c355a9c1a1e | llvm/utils/lit/lit/util.py | python | to_string | (b) | Return the parameter as type 'str', possibly encoding it.
In Python2, the 'str' type is the same as 'bytes'. In Python3, the
'str' type is (essentially) Python2's 'unicode' type, and 'bytes' is
distinct. | Return the parameter as type 'str', possibly encoding it. | [
"Return",
"the",
"parameter",
"as",
"type",
"str",
"possibly",
"encoding",
"it",
"."
] | def to_string(b):
"""Return the parameter as type 'str', possibly encoding it.
In Python2, the 'str' type is the same as 'bytes'. In Python3, the
'str' type is (essentially) Python2's 'unicode' type, and 'bytes' is
distinct.
"""
if isinstance(b, str):
# In Python2, this branch is taken... | [
"def",
"to_string",
"(",
"b",
")",
":",
"if",
"isinstance",
"(",
"b",
",",
"str",
")",
":",
"# In Python2, this branch is taken for types 'str' and 'bytes'.",
"# In Python3, this branch is taken only for 'str'.",
"return",
"b",
"if",
"isinstance",
"(",
"b",
",",
"bytes"... | https://github.com/hfinkel/llvm-project-cxxjit/blob/91084ef018240bbb8e24235ff5cd8c355a9c1a1e/llvm/utils/lit/lit/util.py#L66-L102 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/ed_vim.py | python | Join | (editor, repeat, cmd) | Join lines command.
@see: vim_parser | Join lines command.
@see: vim_parser | [
"Join",
"lines",
"command",
".",
"@see",
":",
"vim_parser"
] | def Join(editor, repeat, cmd):
"""Join lines command.
@see: vim_parser
"""
editor.PushCaret()
editor.JoinLines(repeat)
editor.PopCaret() | [
"def",
"Join",
"(",
"editor",
",",
"repeat",
",",
"cmd",
")",
":",
"editor",
".",
"PushCaret",
"(",
")",
"editor",
".",
"JoinLines",
"(",
"repeat",
")",
"editor",
".",
"PopCaret",
"(",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/ed_vim.py#L1116-L1123 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/tkinter/ttk.py | python | Spinbox.set | (self, value) | Sets the value of the Spinbox to value. | Sets the value of the Spinbox to value. | [
"Sets",
"the",
"value",
"of",
"the",
"Spinbox",
"to",
"value",
"."
] | def set(self, value):
"""Sets the value of the Spinbox to value."""
self.tk.call(self._w, "set", value) | [
"def",
"set",
"(",
"self",
",",
"value",
")",
":",
"self",
".",
"tk",
".",
"call",
"(",
"self",
".",
"_w",
",",
"\"set\"",
",",
"value",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/tkinter/ttk.py#L1177-L1179 | ||
ceph/ceph | 959663007321a369c83218414a29bd9dbc8bda3a | src/pybind/mgr/cephadm/inventory.py | python | SpecStore.all_specs | (self) | return self._specs | returns active and deleted specs. Returns read-only dict. | returns active and deleted specs. Returns read-only dict. | [
"returns",
"active",
"and",
"deleted",
"specs",
".",
"Returns",
"read",
"-",
"only",
"dict",
"."
] | def all_specs(self) -> Mapping[str, ServiceSpec]:
"""
returns active and deleted specs. Returns read-only dict.
"""
return self._specs | [
"def",
"all_specs",
"(",
"self",
")",
"->",
"Mapping",
"[",
"str",
",",
"ServiceSpec",
"]",
":",
"return",
"self",
".",
"_specs"
] | https://github.com/ceph/ceph/blob/959663007321a369c83218414a29bd9dbc8bda3a/src/pybind/mgr/cephadm/inventory.py#L186-L190 | |
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/external/boost/boost_1_68_0/tools/build/src/build/engine.py | python | Engine.get_target_variable | (self, targets, variable) | return bjam_interface.call('get-target-variable', targets, variable) | Gets the value of `variable` on set on the first target in `targets`.
Args:
targets (str or list): one or more targets to get the variable from.
variable (str): the name of the variable
Returns:
the value of `variable` set on `targets` (list)
Example:
... | Gets the value of `variable` on set on the first target in `targets`. | [
"Gets",
"the",
"value",
"of",
"variable",
"on",
"set",
"on",
"the",
"first",
"target",
"in",
"targets",
"."
] | def get_target_variable(self, targets, variable):
"""Gets the value of `variable` on set on the first target in `targets`.
Args:
targets (str or list): one or more targets to get the variable from.
variable (str): the name of the variable
Returns:
the value... | [
"def",
"get_target_variable",
"(",
"self",
",",
"targets",
",",
"variable",
")",
":",
"if",
"isinstance",
"(",
"targets",
",",
"str",
")",
":",
"targets",
"=",
"[",
"targets",
"]",
"assert",
"is_iterable",
"(",
"targets",
")",
"assert",
"isinstance",
"(",
... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/external/boost/boost_1_68_0/tools/build/src/build/engine.py#L93-L121 | |
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Draft/draftguitools/gui_annotationstyleeditor.py | python | AnnotationStyleEditor.on_delete | (self) | Execute as a callback when the delete button is pressed. | Execute as a callback when the delete button is pressed. | [
"Execute",
"as",
"a",
"callback",
"when",
"the",
"delete",
"button",
"is",
"pressed",
"."
] | def on_delete(self):
"""Execute as a callback when the delete button is pressed."""
index = self.form.comboBoxStyles.currentIndex()
style = self.form.comboBoxStyles.itemText(index)
if self.get_style_users(style):
reply = QtGui.QMessageBox.question(None,
... | [
"def",
"on_delete",
"(",
"self",
")",
":",
"index",
"=",
"self",
".",
"form",
".",
"comboBoxStyles",
".",
"currentIndex",
"(",
")",
"style",
"=",
"self",
".",
"form",
".",
"comboBoxStyles",
".",
"itemText",
"(",
"index",
")",
"if",
"self",
".",
"get_st... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Draft/draftguitools/gui_annotationstyleeditor.py#L245-L259 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/distribute/v1/all_reduce.py | python | _build_nccl_hybrid | (input_tensors, red_op, upper_level_f) | return output_tensors | Construct a subgraph for NCCL hybrid all-reduce.
Args:
input_tensors: list of `tf.Tensor` of same-shape and type values to
be reduced.
red_op: binary elementwise reduction operator.
upper_level_f: function for reducing one value per worker, across
workers.
Returns:
list of `tf.Tensor` ... | Construct a subgraph for NCCL hybrid all-reduce. | [
"Construct",
"a",
"subgraph",
"for",
"NCCL",
"hybrid",
"all",
"-",
"reduce",
"."
] | def _build_nccl_hybrid(input_tensors, red_op, upper_level_f):
"""Construct a subgraph for NCCL hybrid all-reduce.
Args:
input_tensors: list of `tf.Tensor` of same-shape and type values to
be reduced.
red_op: binary elementwise reduction operator.
upper_level_f: function for reducing one value per... | [
"def",
"_build_nccl_hybrid",
"(",
"input_tensors",
",",
"red_op",
",",
"upper_level_f",
")",
":",
"input_tensors",
",",
"shape",
"=",
"_flatten_tensors",
"(",
"input_tensors",
")",
"devices",
"=",
"[",
"t",
".",
"device",
"for",
"t",
"in",
"input_tensors",
"]"... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/distribute/v1/all_reduce.py#L710-L758 | |
SoarGroup/Soar | a1c5e249499137a27da60533c72969eef3b8ab6b | scons/scons-local-4.1.0/SCons/CacheDir.py | python | CacheDir.__init__ | (self, path) | Initialize a CacheDir object.
The cache configuration is stored in the object. It
is read from the config file in the supplied path if
one exists, if not the config file is created and
the default config is written, as well as saved in the object. | Initialize a CacheDir object. | [
"Initialize",
"a",
"CacheDir",
"object",
"."
] | def __init__(self, path):
"""
Initialize a CacheDir object.
The cache configuration is stored in the object. It
is read from the config file in the supplied path if
one exists, if not the config file is created and
the default config is written, as well as saved in the ... | [
"def",
"__init__",
"(",
"self",
",",
"path",
")",
":",
"self",
".",
"requests",
"=",
"0",
"self",
".",
"hits",
"=",
"0",
"self",
".",
"path",
"=",
"path",
"self",
".",
"current_cache_debug",
"=",
"None",
"self",
".",
"debugFP",
"=",
"None",
"self",
... | https://github.com/SoarGroup/Soar/blob/a1c5e249499137a27da60533c72969eef3b8ab6b/scons/scons-local-4.1.0/SCons/CacheDir.py#L138-L156 | ||
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Source/ThirdParty/CEF3/pristine/cef_source/tools/cef_parser.py | python | obj_analysis.get_ptr_type | (self) | return self.ptr_type | Return the C++ class type referenced by a CefRefPtr. | Return the C++ class type referenced by a CefRefPtr. | [
"Return",
"the",
"C",
"++",
"class",
"type",
"referenced",
"by",
"a",
"CefRefPtr",
"."
] | def get_ptr_type(self):
""" Return the C++ class type referenced by a CefRefPtr. """
if self.is_result_vector() and self.is_result_vector_ptr():
# return the vector RefPtr type
return self.result_value[0]['ptr_type']
# return the basic RefPtr type
return self.ptr_... | [
"def",
"get_ptr_type",
"(",
"self",
")",
":",
"if",
"self",
".",
"is_result_vector",
"(",
")",
"and",
"self",
".",
"is_result_vector_ptr",
"(",
")",
":",
"# return the vector RefPtr type",
"return",
"self",
".",
"result_value",
"[",
"0",
"]",
"[",
"'ptr_type'"... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Source/ThirdParty/CEF3/pristine/cef_source/tools/cef_parser.py#L1745-L1751 | |
eric612/MobileNet-YOLO | 69b4441cb3ec8d553fbdef788ad033e246f901bd | python/caffe/coord_map.py | python | compose | (base_map, next_map) | return ax, a1 * a2, a1 * b2 + b1 | Compose a base coord map with scale a1, shift b1 with a further coord map
with scale a2, shift b2. The scales multiply and the further shift, b2,
is scaled by base coord scale a1. | Compose a base coord map with scale a1, shift b1 with a further coord map
with scale a2, shift b2. The scales multiply and the further shift, b2,
is scaled by base coord scale a1. | [
"Compose",
"a",
"base",
"coord",
"map",
"with",
"scale",
"a1",
"shift",
"b1",
"with",
"a",
"further",
"coord",
"map",
"with",
"scale",
"a2",
"shift",
"b2",
".",
"The",
"scales",
"multiply",
"and",
"the",
"further",
"shift",
"b2",
"is",
"scaled",
"by",
... | def compose(base_map, next_map):
"""
Compose a base coord map with scale a1, shift b1 with a further coord map
with scale a2, shift b2. The scales multiply and the further shift, b2,
is scaled by base coord scale a1.
"""
ax1, a1, b1 = base_map
ax2, a2, b2 = next_map
if ax1 is None:
... | [
"def",
"compose",
"(",
"base_map",
",",
"next_map",
")",
":",
"ax1",
",",
"a1",
",",
"b1",
"=",
"base_map",
"ax2",
",",
"a2",
",",
"b2",
"=",
"next_map",
"if",
"ax1",
"is",
"None",
":",
"ax",
"=",
"ax2",
"elif",
"ax2",
"is",
"None",
"or",
"ax1",
... | https://github.com/eric612/MobileNet-YOLO/blob/69b4441cb3ec8d553fbdef788ad033e246f901bd/python/caffe/coord_map.py#L89-L103 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/setuptools/command/build_py.py | python | build_py.check_package | (self, package, package_dir) | return init_py | Check namespace packages' __init__ for declare_namespace | Check namespace packages' __init__ for declare_namespace | [
"Check",
"namespace",
"packages",
"__init__",
"for",
"declare_namespace"
] | def check_package(self, package, package_dir):
"""Check namespace packages' __init__ for declare_namespace"""
try:
return self.packages_checked[package]
except KeyError:
pass
init_py = orig.build_py.check_package(self, package, package_dir)
self.packages_... | [
"def",
"check_package",
"(",
"self",
",",
"package",
",",
"package_dir",
")",
":",
"try",
":",
"return",
"self",
".",
"packages_checked",
"[",
"package",
"]",
"except",
"KeyError",
":",
"pass",
"init_py",
"=",
"orig",
".",
"build_py",
".",
"check_package",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/setuptools/command/build_py.py#L162-L190 | |
gem5/gem5 | 141cc37c2d4b93959d4c249b8f7e6a8b2ef75338 | ext/ply/example/ansic/cparse.py | python | p_constant | (t) | constant : ICONST
| FCONST
| CCONST | constant : ICONST
| FCONST
| CCONST | [
"constant",
":",
"ICONST",
"|",
"FCONST",
"|",
"CCONST"
] | def p_constant(t):
'''constant : ICONST
| FCONST
| CCONST'''
pass | [
"def",
"p_constant",
"(",
"t",
")",
":",
"pass"
] | https://github.com/gem5/gem5/blob/141cc37c2d4b93959d4c249b8f7e6a8b2ef75338/ext/ply/example/ansic/cparse.py#L840-L844 | ||
syoyo/tinygltf | e7f1ff5c59d3ca2489923beb239bdf93d863498f | deps/cpplint.py | python | _FunctionState.Count | (self) | Count line in current function body. | Count line in current function body. | [
"Count",
"line",
"in",
"current",
"function",
"body",
"."
] | def Count(self):
"""Count line in current function body."""
if self.in_a_function:
self.lines_in_function += 1 | [
"def",
"Count",
"(",
"self",
")",
":",
"if",
"self",
".",
"in_a_function",
":",
"self",
".",
"lines_in_function",
"+=",
"1"
] | https://github.com/syoyo/tinygltf/blob/e7f1ff5c59d3ca2489923beb239bdf93d863498f/deps/cpplint.py#L934-L937 | ||
llvm/llvm-project | ffa6262cb4e2a335d26416fad39a581b4f98c5f4 | clang/utils/check_cfc/obj_diff.py | python | compare_debug_info | (objfilea, objfileb) | return first_diff(dbga, dbgb, objfilea, objfileb) | Compare debug info of two different files.
Allowing unavoidable differences, such as filenames.
Return the first difference if the debug info differs, or None.
If there are differences in the code, there will almost certainly be differences in the debug info too. | Compare debug info of two different files.
Allowing unavoidable differences, such as filenames.
Return the first difference if the debug info differs, or None.
If there are differences in the code, there will almost certainly be differences in the debug info too. | [
"Compare",
"debug",
"info",
"of",
"two",
"different",
"files",
".",
"Allowing",
"unavoidable",
"differences",
"such",
"as",
"filenames",
".",
"Return",
"the",
"first",
"difference",
"if",
"the",
"debug",
"info",
"differs",
"or",
"None",
".",
"If",
"there",
"... | def compare_debug_info(objfilea, objfileb):
"""Compare debug info of two different files.
Allowing unavoidable differences, such as filenames.
Return the first difference if the debug info differs, or None.
If there are differences in the code, there will almost certainly be differences in the ... | [
"def",
"compare_debug_info",
"(",
"objfilea",
",",
"objfileb",
")",
":",
"dbga",
"=",
"dump_debug",
"(",
"objfilea",
")",
"dbgb",
"=",
"dump_debug",
"(",
"objfileb",
")",
"return",
"first_diff",
"(",
"dbga",
",",
"dbgb",
",",
"objfilea",
",",
"objfileb",
"... | https://github.com/llvm/llvm-project/blob/ffa6262cb4e2a335d26416fad39a581b4f98c5f4/clang/utils/check_cfc/obj_diff.py#L76-L84 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_windows.py | python | FontData.GetChosenFont | (*args, **kwargs) | return _windows_.FontData_GetChosenFont(*args, **kwargs) | GetChosenFont(self) -> Font
Gets the font chosen by the user. | GetChosenFont(self) -> Font | [
"GetChosenFont",
"(",
"self",
")",
"-",
">",
"Font"
] | def GetChosenFont(*args, **kwargs):
"""
GetChosenFont(self) -> Font
Gets the font chosen by the user.
"""
return _windows_.FontData_GetChosenFont(*args, **kwargs) | [
"def",
"GetChosenFont",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"FontData_GetChosenFont",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_windows.py#L3485-L3491 | |
lballabio/quantlib-old | 136336947ed4fea9ecc1da6edad188700e821739 | gensrc/gensrc/addins/enumerations.py | python | Enumerations.generateEnumeratedClasses | (self) | Generate source file for enumerated types. | Generate source file for enumerated types. | [
"Generate",
"source",
"file",
"for",
"enumerated",
"types",
"."
] | def generateEnumeratedClasses(self):
"""Generate source file for enumerated types."""
if not self.enumerationList_.hasEnumeratedClasses:
return
buffer = '' # code to register the enumeration
for enumeratedClassGroup in self.enumerationList_.enumeratedClassGroups():
... | [
"def",
"generateEnumeratedClasses",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"enumerationList_",
".",
"hasEnumeratedClasses",
":",
"return",
"buffer",
"=",
"''",
"# code to register the enumeration",
"for",
"enumeratedClassGroup",
"in",
"self",
".",
"enumerati... | https://github.com/lballabio/quantlib-old/blob/136336947ed4fea9ecc1da6edad188700e821739/gensrc/gensrc/addins/enumerations.py#L98-L109 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py2/sklearn/svm/base.py | python | BaseLibSVM._decision_function | (self, X) | return dec_func | Distance of the samples X to the separating hyperplane.
Parameters
----------
X : array-like, shape (n_samples, n_features)
Returns
-------
X : array-like, shape (n_samples, n_class * (n_class-1) / 2)
Returns the decision function of the sample for each clas... | Distance of the samples X to the separating hyperplane. | [
"Distance",
"of",
"the",
"samples",
"X",
"to",
"the",
"separating",
"hyperplane",
"."
] | def _decision_function(self, X):
"""Distance of the samples X to the separating hyperplane.
Parameters
----------
X : array-like, shape (n_samples, n_features)
Returns
-------
X : array-like, shape (n_samples, n_class * (n_class-1) / 2)
Returns the d... | [
"def",
"_decision_function",
"(",
"self",
",",
"X",
")",
":",
"# NOTE: _validate_for_predict contains check for is_fitted",
"# hence must be placed before any other attributes are used.",
"X",
"=",
"self",
".",
"_validate_for_predict",
"(",
"X",
")",
"X",
"=",
"self",
".",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py2/sklearn/svm/base.py#L389-L417 | |
echronos/echronos | c996f1d2c8af6c6536205eb319c1bf1d4d84569c | external_tools/pystache/renderer.py | python | Renderer._interpolate | (self, val, formatter_key, location) | return formatter(val) | Convert a value to string. | Convert a value to string. | [
"Convert",
"a",
"value",
"to",
"string",
"."
] | def _interpolate(self, val, formatter_key, location):
"""Convert a value to string.
"""
try:
formatter = self.formatters[formatter_key]
except:
raise FormatterNotFoundError(formatter_key, location)
if isinstance(val, bytes):
val = self._bytes_... | [
"def",
"_interpolate",
"(",
"self",
",",
"val",
",",
"formatter_key",
",",
"location",
")",
":",
"try",
":",
"formatter",
"=",
"self",
".",
"formatters",
"[",
"formatter_key",
"]",
"except",
":",
"raise",
"FormatterNotFoundError",
"(",
"formatter_key",
",",
... | https://github.com/echronos/echronos/blob/c996f1d2c8af6c6536205eb319c1bf1d4d84569c/external_tools/pystache/renderer.py#L168-L180 | |
mingchen/protobuf-ios | 0958df34558cd54cb7b6e6ca5c8855bf3d475046 | compiler/python/google/protobuf/internal/encoder.py | python | Encoder.AppendSInt64NoTag | (self, value) | Appends a 64-bit integer to our buffer, zigzag-encoded and then
varint-encoded. | Appends a 64-bit integer to our buffer, zigzag-encoded and then
varint-encoded. | [
"Appends",
"a",
"64",
"-",
"bit",
"integer",
"to",
"our",
"buffer",
"zigzag",
"-",
"encoded",
"and",
"then",
"varint",
"-",
"encoded",
"."
] | def AppendSInt64NoTag(self, value):
"""Appends a 64-bit integer to our buffer, zigzag-encoded and then
varint-encoded.
"""
zigzag_value = wire_format.ZigZagEncode(value)
self._stream.AppendVarUInt64(zigzag_value) | [
"def",
"AppendSInt64NoTag",
"(",
"self",
",",
"value",
")",
":",
"zigzag_value",
"=",
"wire_format",
".",
"ZigZagEncode",
"(",
"value",
")",
"self",
".",
"_stream",
".",
"AppendVarUInt64",
"(",
"zigzag_value",
")"
] | https://github.com/mingchen/protobuf-ios/blob/0958df34558cd54cb7b6e6ca5c8855bf3d475046/compiler/python/google/protobuf/internal/encoder.py#L87-L92 | ||
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/python/ops/math_grad.py | python | _TanhGrad | (op, grad) | Returns grad * (1 - tanh(x) * tanh(x)). | Returns grad * (1 - tanh(x) * tanh(x)). | [
"Returns",
"grad",
"*",
"(",
"1",
"-",
"tanh",
"(",
"x",
")",
"*",
"tanh",
"(",
"x",
"))",
"."
] | def _TanhGrad(op, grad):
"""Returns grad * (1 - tanh(x) * tanh(x))."""
y = op.outputs[0] # y = tanh(x)
with ops.control_dependencies([grad.op]):
y = math_ops.conj(y)
# pylint: disable=protected-access
return gen_math_ops._tanh_grad(y, grad) | [
"def",
"_TanhGrad",
"(",
"op",
",",
"grad",
")",
":",
"y",
"=",
"op",
".",
"outputs",
"[",
"0",
"]",
"# y = tanh(x)",
"with",
"ops",
".",
"control_dependencies",
"(",
"[",
"grad",
".",
"op",
"]",
")",
":",
"y",
"=",
"math_ops",
".",
"conj",
"(",
... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/ops/math_grad.py#L330-L336 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/idlelib/PyShell.py | python | PyShellEditorWindow.store_file_breaks | (self) | Save breakpoints when file is saved | Save breakpoints when file is saved | [
"Save",
"breakpoints",
"when",
"file",
"is",
"saved"
] | def store_file_breaks(self):
"Save breakpoints when file is saved"
# XXX 13 Dec 2002 KBK Currently the file must be saved before it can
# be run. The breaks are saved at that time. If we introduce
# a temporary file save feature the save breaks functionality
# needs... | [
"def",
"store_file_breaks",
"(",
"self",
")",
":",
"# XXX 13 Dec 2002 KBK Currently the file must be saved before it can",
"# be run. The breaks are saved at that time. If we introduce",
"# a temporary file save feature the save breaks functionality",
"# needs to be re-verified, sinc... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/idlelib/PyShell.py#L192-L237 | ||
naver/sling | 5671cd445a2caae0b4dd0332299e4cfede05062c | webkit/Tools/Scripts/webkitpy/thirdparty/irc/irclib.py | python | ServerConnection.time | (self, server="") | Send a TIME command. | Send a TIME command. | [
"Send",
"a",
"TIME",
"command",
"."
] | def time(self, server=""):
"""Send a TIME command."""
self.send_raw("TIME" + (server and (" " + server))) | [
"def",
"time",
"(",
"self",
",",
"server",
"=",
"\"\"",
")",
":",
"self",
".",
"send_raw",
"(",
"\"TIME\"",
"+",
"(",
"server",
"and",
"(",
"\" \"",
"+",
"server",
")",
")",
")"
] | https://github.com/naver/sling/blob/5671cd445a2caae0b4dd0332299e4cfede05062c/webkit/Tools/Scripts/webkitpy/thirdparty/irc/irclib.py#L805-L807 | ||
trilinos/Trilinos | 6168be6dd51e35e1cd681e9c4b24433e709df140 | packages/seacas/scripts/exodus2.in.py | python | exodus.put_elem_blk_names | (self, names) | exo.put_elem_blk_names(elem_blk_names)
-> store a list of all element block names ordered by block *INDEX*;
(see description of get_elem_blk_ids() for explanation of the
difference between block *ID* and block *INDEX*)
input value(s):
<list<string>> elem_blk_na... | exo.put_elem_blk_names(elem_blk_names) | [
"exo",
".",
"put_elem_blk_names",
"(",
"elem_blk_names",
")"
] | def put_elem_blk_names(self, names):
"""
exo.put_elem_blk_names(elem_blk_names)
-> store a list of all element block names ordered by block *INDEX*;
(see description of get_elem_blk_ids() for explanation of the
difference between block *ID* and block *INDEX*)
... | [
"def",
"put_elem_blk_names",
"(",
"self",
",",
"names",
")",
":",
"objType",
"=",
"ex_entity_type",
"(",
"\"EX_ELEM_BLOCK\"",
")",
"inqType",
"=",
"ex_inquiry",
"(",
"\"EX_INQ_ELEM_BLK\"",
")",
"self",
".",
"__ex_put_names",
"(",
"objType",
",",
"inqType",
",",
... | https://github.com/trilinos/Trilinos/blob/6168be6dd51e35e1cd681e9c4b24433e709df140/packages/seacas/scripts/exodus2.in.py#L1278-L1291 | ||
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/genmsg/src/genmsg/msg_loader.py | python | MsgContext.get_registered | (self, full_msg_type) | :raises: :exc:`KeyError` If not registered | :raises: :exc:`KeyError` If not registered | [
":",
"raises",
":",
":",
"exc",
":",
"KeyError",
"If",
"not",
"registered"
] | def get_registered(self, full_msg_type):
"""
:raises: :exc:`KeyError` If not registered
"""
full_msg_type = bare_msg_type(full_msg_type)
if self.is_registered(full_msg_type):
package, base_type = package_resource_name(full_msg_type)
return self._registered... | [
"def",
"get_registered",
"(",
"self",
",",
"full_msg_type",
")",
":",
"full_msg_type",
"=",
"bare_msg_type",
"(",
"full_msg_type",
")",
"if",
"self",
".",
"is_registered",
"(",
"full_msg_type",
")",
":",
"package",
",",
"base_type",
"=",
"package_resource_name",
... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/genmsg/src/genmsg/msg_loader.py#L429-L438 | ||
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/idlelib/PyShell.py | python | ModifiedInterpreter.runcommand | (self, code) | return 1 | Run the code without invoking the debugger | Run the code without invoking the debugger | [
"Run",
"the",
"code",
"without",
"invoking",
"the",
"debugger"
] | def runcommand(self, code):
"Run the code without invoking the debugger"
# The code better not raise an exception!
if self.tkconsole.executing:
self.display_executing_dialog()
return 0
if self.rpcclt:
self.rpcclt.remotequeue("exec", "runcode", (code,),... | [
"def",
"runcommand",
"(",
"self",
",",
"code",
")",
":",
"# The code better not raise an exception!",
"if",
"self",
".",
"tkconsole",
".",
"executing",
":",
"self",
".",
"display_executing_dialog",
"(",
")",
"return",
"0",
"if",
"self",
".",
"rpcclt",
":",
"se... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/idlelib/PyShell.py#L736-L746 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/piexif/_insert.py | python | insert | (exif, image, new_file=None) | py:function:: piexif.insert(exif_bytes, filename)
Insert exif into JPEG.
:param bytes exif_bytes: Exif as bytes
:param str filename: JPEG | py:function:: piexif.insert(exif_bytes, filename) | [
"py",
":",
"function",
"::",
"piexif",
".",
"insert",
"(",
"exif_bytes",
"filename",
")"
] | def insert(exif, image, new_file=None):
"""
py:function:: piexif.insert(exif_bytes, filename)
Insert exif into JPEG.
:param bytes exif_bytes: Exif as bytes
:param str filename: JPEG
"""
if exif[0:6] != b"\x45\x78\x69\x66\x00\x00":
raise ValueError("Given data is not exif data")
... | [
"def",
"insert",
"(",
"exif",
",",
"image",
",",
"new_file",
"=",
"None",
")",
":",
"if",
"exif",
"[",
"0",
":",
"6",
"]",
"!=",
"b\"\\x45\\x78\\x69\\x66\\x00\\x00\"",
":",
"raise",
"ValueError",
"(",
"\"Given data is not exif data\"",
")",
"output_file",
"=",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/piexif/_insert.py#L9-L60 | ||
OSGeo/gdal | 3748fc4ba4fba727492774b2b908a2130c864a83 | swig/python/osgeo/ogr.py | python | Geometry.GetSpatialReference | (self, *args) | return _ogr.Geometry_GetSpatialReference(self, *args) | r"""
GetSpatialReference(Geometry self) -> SpatialReference
OGRSpatialReferenceH
OGR_G_GetSpatialReference(OGRGeometryH hGeom)
Returns spatial reference system for geometry.
This function relates to the SFCOM IGeometry::get_SpatialReference()
method.
This funct... | r"""
GetSpatialReference(Geometry self) -> SpatialReference
OGRSpatialReferenceH
OGR_G_GetSpatialReference(OGRGeometryH hGeom) | [
"r",
"GetSpatialReference",
"(",
"Geometry",
"self",
")",
"-",
">",
"SpatialReference",
"OGRSpatialReferenceH",
"OGR_G_GetSpatialReference",
"(",
"OGRGeometryH",
"hGeom",
")"
] | def GetSpatialReference(self, *args):
r"""
GetSpatialReference(Geometry self) -> SpatialReference
OGRSpatialReferenceH
OGR_G_GetSpatialReference(OGRGeometryH hGeom)
Returns spatial reference system for geometry.
This function relates to the SFCOM IGeometry::get_SpatialR... | [
"def",
"GetSpatialReference",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_ogr",
".",
"Geometry_GetSpatialReference",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/OSGeo/gdal/blob/3748fc4ba4fba727492774b2b908a2130c864a83/swig/python/osgeo/ogr.py#L6987-L7008 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/autograph/pyct/static_analysis/activity.py | python | Scope.merge_from | (self, other) | Adds all activity from another scope to this scope. | Adds all activity from another scope to this scope. | [
"Adds",
"all",
"activity",
"from",
"another",
"scope",
"to",
"this",
"scope",
"."
] | def merge_from(self, other):
"""Adds all activity from another scope to this scope."""
assert not self.is_final
if self.parent is not None:
assert other.parent is not None
self.parent.merge_from(other.parent)
self.isolated_names.update(other.isolated_names)
self.read.update(other.read)
... | [
"def",
"merge_from",
"(",
"self",
",",
"other",
")",
":",
"assert",
"not",
"self",
".",
"is_final",
"if",
"self",
".",
"parent",
"is",
"not",
"None",
":",
"assert",
"other",
".",
"parent",
"is",
"not",
"None",
"self",
".",
"parent",
".",
"merge_from",
... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/autograph/pyct/static_analysis/activity.py#L167-L179 | ||
idaholab/moose | 9eeebc65e098b4c30f8205fb41591fd5b61eb6ff | python/MooseDocs/common/load_config.py | python | _yaml_load_content | (config, in_ext) | return MooseDocs.common.get_content(items, in_ext) | Load the 'Content' section. | Load the 'Content' section. | [
"Load",
"the",
"Content",
"section",
"."
] | def _yaml_load_content(config, in_ext):
"""Load the 'Content' section."""
options = config.get('Content', None)
if options is None:
msg = "The 'Content' section is required."
raise exceptions.MooseDocsException(msg)
items = MooseDocs.common.get_items(options)
return MooseDocs.common... | [
"def",
"_yaml_load_content",
"(",
"config",
",",
"in_ext",
")",
":",
"options",
"=",
"config",
".",
"get",
"(",
"'Content'",
",",
"None",
")",
"if",
"options",
"is",
"None",
":",
"msg",
"=",
"\"The 'Content' section is required.\"",
"raise",
"exceptions",
".",... | https://github.com/idaholab/moose/blob/9eeebc65e098b4c30f8205fb41591fd5b61eb6ff/python/MooseDocs/common/load_config.py#L240-L248 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/nn/cell.py | python | Cell.set_broadcast_flag | (self, mode=True) | return self | Set parameter broadcast mode for this cell.
Args:
mode (bool): Specifies whether the mode is parameter broadcast. Default: True. | Set parameter broadcast mode for this cell. | [
"Set",
"parameter",
"broadcast",
"mode",
"for",
"this",
"cell",
"."
] | def set_broadcast_flag(self, mode=True):
"""
Set parameter broadcast mode for this cell.
Args:
mode (bool): Specifies whether the mode is parameter broadcast. Default: True.
"""
self.add_flags_recursive(broadcast_flag=mode)
return self | [
"def",
"set_broadcast_flag",
"(",
"self",
",",
"mode",
"=",
"True",
")",
":",
"self",
".",
"add_flags_recursive",
"(",
"broadcast_flag",
"=",
"mode",
")",
"return",
"self"
] | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/nn/cell.py#L1425-L1433 | |
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/contrib/framework/python/framework/deprecation.py | python | deprecated_args | (date, instructions, *deprecated_arg_names) | return deprecated_wrapper | Decorator for marking specific function arguments as deprecated.
This decorator logs a deprecation warning whenever the decorated function is
called with the deprecated argument. It has the following format:
Calling <function> (from <module>) with <arg> is deprecated and will be
removed after <date>. Inst... | Decorator for marking specific function arguments as deprecated. | [
"Decorator",
"for",
"marking",
"specific",
"function",
"arguments",
"as",
"deprecated",
"."
] | def deprecated_args(date, instructions, *deprecated_arg_names):
"""Decorator for marking specific function arguments as deprecated.
This decorator logs a deprecation warning whenever the decorated function is
called with the deprecated argument. It has the following format:
Calling <function> (from <module>... | [
"def",
"deprecated_args",
"(",
"date",
",",
"instructions",
",",
"*",
"deprecated_arg_names",
")",
":",
"_validate_deprecation_args",
"(",
"date",
",",
"instructions",
")",
"if",
"not",
"deprecated_arg_names",
":",
"raise",
"ValueError",
"(",
"'Specify which argument ... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/contrib/framework/python/framework/deprecation.py#L145-L222 | |
adobe/brackets-app | 26dc31087a30bef7754b94e09fe7e74f6da9d699 | src/mac/tools/change_mach_o_flags.py | python | WriteUInt32 | (file, uint32, endian) | Writes |uint32| as an unsinged 32-bit integer to the file-like |file|
object, treating it as having endianness specified by |endian| (per the
|struct| module). | Writes |uint32| as an unsinged 32-bit integer to the file-like |file|
object, treating it as having endianness specified by |endian| (per the
|struct| module). | [
"Writes",
"|uint32|",
"as",
"an",
"unsinged",
"32",
"-",
"bit",
"integer",
"to",
"the",
"file",
"-",
"like",
"|file|",
"object",
"treating",
"it",
"as",
"having",
"endianness",
"specified",
"by",
"|endian|",
"(",
"per",
"the",
"|struct|",
"module",
")",
".... | def WriteUInt32(file, uint32, endian):
"""Writes |uint32| as an unsinged 32-bit integer to the file-like |file|
object, treating it as having endianness specified by |endian| (per the
|struct| module)."""
bytes = struct.pack(endian + 'I', uint32)
assert len(bytes) == 4
file.write(bytes) | [
"def",
"WriteUInt32",
"(",
"file",
",",
"uint32",
",",
"endian",
")",
":",
"bytes",
"=",
"struct",
".",
"pack",
"(",
"endian",
"+",
"'I'",
",",
"uint32",
")",
"assert",
"len",
"(",
"bytes",
")",
"==",
"4",
"file",
".",
"write",
"(",
"bytes",
")"
] | https://github.com/adobe/brackets-app/blob/26dc31087a30bef7754b94e09fe7e74f6da9d699/src/mac/tools/change_mach_o_flags.py#L164-L172 | ||
ablab/spades | 3a754192b88540524ce6fb69eef5ea9273a38465 | assembler/ext/src/python_libs/joblib3/pool.py | python | _strided_from_memmap | (filename, dtype, mode, offset, order, shape, strides,
total_buffer_len) | Reconstruct an array view on a memmory mapped file | Reconstruct an array view on a memmory mapped file | [
"Reconstruct",
"an",
"array",
"view",
"on",
"a",
"memmory",
"mapped",
"file"
] | def _strided_from_memmap(filename, dtype, mode, offset, order, shape, strides,
total_buffer_len):
"""Reconstruct an array view on a memmory mapped file"""
if mode == 'w+':
# Do not zero the original data when unpickling
mode = 'r+'
if strides is None:
# Simp... | [
"def",
"_strided_from_memmap",
"(",
"filename",
",",
"dtype",
",",
"mode",
",",
"offset",
",",
"order",
",",
"shape",
",",
"strides",
",",
"total_buffer_len",
")",
":",
"if",
"mode",
"==",
"'w+'",
":",
"# Do not zero the original data when unpickling",
"mode",
"... | https://github.com/ablab/spades/blob/3a754192b88540524ce6fb69eef5ea9273a38465/assembler/ext/src/python_libs/joblib3/pool.py#L93-L109 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | scripts/abins/input/euphonicloader.py | python | EuphonicLoader.__init__ | (self, input_ab_initio_filename) | :param input_ab_initio_filename: name of file with phonon data (foo.phonon) | [] | def __init__(self, input_ab_initio_filename):
"""
:param input_ab_initio_filename: name of file with phonon data (foo.phonon)
"""
if not isinstance(input_ab_initio_filename, str):
raise TypeError('Filename must be a string')
elif not Path(input_ab_initio_filename).is... | [
"def",
"__init__",
"(",
"self",
",",
"input_ab_initio_filename",
")",
":",
"if",
"not",
"isinstance",
"(",
"input_ab_initio_filename",
",",
"str",
")",
":",
"raise",
"TypeError",
"(",
"'Filename must be a string'",
")",
"elif",
"not",
"Path",
"(",
"input_ab_initio... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/abins/input/euphonicloader.py#L19-L30 | |||
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/numpy/multiarray.py | python | may_share_memory | (a, b, max_work=None) | return _mx_nd_np.may_share_memory(a, b, max_work) | Determine if two arrays might share memory
A return of True does not necessarily mean that the two arrays
share any element. It just means that they *might*.
Only the memory bounds of a and b are checked by default.
Parameters
----------
a, b : ndarray
Input arrays
Returns
-... | Determine if two arrays might share memory | [
"Determine",
"if",
"two",
"arrays",
"might",
"share",
"memory"
] | def may_share_memory(a, b, max_work=None):
"""
Determine if two arrays might share memory
A return of True does not necessarily mean that the two arrays
share any element. It just means that they *might*.
Only the memory bounds of a and b are checked by default.
Parameters
----------
... | [
"def",
"may_share_memory",
"(",
"a",
",",
"b",
",",
"max_work",
"=",
"None",
")",
":",
"return",
"_mx_nd_np",
".",
"may_share_memory",
"(",
"a",
",",
"b",
",",
"max_work",
")"
] | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/numpy/multiarray.py#L11315-L11353 | |
wyrover/book-code | 7f4883d9030d553bc6bcfa3da685e34789839900 | 3rdparty/protobuf/python/google/protobuf/internal/containers.py | python | RepeatedCompositeFieldContainer.MergeFrom | (self, other) | Appends the contents of another repeated field of the same type to this
one, copying each individual message. | Appends the contents of another repeated field of the same type to this
one, copying each individual message. | [
"Appends",
"the",
"contents",
"of",
"another",
"repeated",
"field",
"of",
"the",
"same",
"type",
"to",
"this",
"one",
"copying",
"each",
"individual",
"message",
"."
] | def MergeFrom(self, other):
"""Appends the contents of another repeated field of the same type to this
one, copying each individual message.
"""
self.extend(other._values) | [
"def",
"MergeFrom",
"(",
"self",
",",
"other",
")",
":",
"self",
".",
"extend",
"(",
"other",
".",
"_values",
")"
] | https://github.com/wyrover/book-code/blob/7f4883d9030d553bc6bcfa3da685e34789839900/3rdparty/protobuf/python/google/protobuf/internal/containers.py#L393-L397 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/keras/saving/save.py | python | save_model | (model,
filepath,
overwrite=True,
include_optimizer=True,
save_format=None,
signatures=None) | Saves a model as a TensorFlow SavedModel or HDF5 file.
The saved model contains:
- the model's configuration (topology)
- the model's weights
- the model's optimizer's state (if any)
Thus the saved model can be reinstantiated in
the exact same state, without any of the code
used for model de... | Saves a model as a TensorFlow SavedModel or HDF5 file. | [
"Saves",
"a",
"model",
"as",
"a",
"TensorFlow",
"SavedModel",
"or",
"HDF5",
"file",
"."
] | def save_model(model,
filepath,
overwrite=True,
include_optimizer=True,
save_format=None,
signatures=None):
"""Saves a model as a TensorFlow SavedModel or HDF5 file.
The saved model contains:
- the model's configuration (topology)
... | [
"def",
"save_model",
"(",
"model",
",",
"filepath",
",",
"overwrite",
"=",
"True",
",",
"include_optimizer",
"=",
"True",
",",
"save_format",
"=",
"None",
",",
"signatures",
"=",
"None",
")",
":",
"from",
"tensorflow",
".",
"python",
".",
"keras",
".",
"... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/keras/saving/save.py#L47-L112 | ||
ceph/ceph | 959663007321a369c83218414a29bd9dbc8bda3a | src/pybind/mgr/mirroring/fs/dir_map/policy.py | python | Policy.can_shuffle_dir | (self, dir_path) | return StateTransition.is_idle(dir_state.state) and \
(time.time() - dir_state['mapped_time']) > Policy.DIR_SHUFFLE_THROTTLE_INTERVAL | Right now, shuffle directories only based on idleness. Later, we
probably want to avoid shuffling images that were recently shuffled. | Right now, shuffle directories only based on idleness. Later, we
probably want to avoid shuffling images that were recently shuffled. | [
"Right",
"now",
"shuffle",
"directories",
"only",
"based",
"on",
"idleness",
".",
"Later",
"we",
"probably",
"want",
"to",
"avoid",
"shuffling",
"images",
"that",
"were",
"recently",
"shuffled",
"."
] | def can_shuffle_dir(self, dir_path):
"""Right now, shuffle directories only based on idleness. Later, we
probably want to avoid shuffling images that were recently shuffled.
"""
log.debug(f'can_shuffle_dir: {dir_path}')
dir_state = self.dir_states[dir_path]
return StateTr... | [
"def",
"can_shuffle_dir",
"(",
"self",
",",
"dir_path",
")",
":",
"log",
".",
"debug",
"(",
"f'can_shuffle_dir: {dir_path}'",
")",
"dir_state",
"=",
"self",
".",
"dir_states",
"[",
"dir_path",
"]",
"return",
"StateTransition",
".",
"is_idle",
"(",
"dir_state",
... | https://github.com/ceph/ceph/blob/959663007321a369c83218414a29bd9dbc8bda3a/src/pybind/mgr/mirroring/fs/dir_map/policy.py#L55-L62 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/ops/rnn_cell_impl.py | python | _linear | (args,
output_size,
bias,
bias_initializer=None,
kernel_initializer=None) | Linear map: sum_i(args[i] * W[i]), where W[i] is a variable.
Args:
args: a 2D Tensor or a list of 2D, batch, n, Tensors.
output_size: int, second dimension of W[i].
bias: boolean, whether to add a bias term or not.
bias_initializer: starting value to initialize the bias
(default is all zeros).
... | Linear map: sum_i(args[i] * W[i]), where W[i] is a variable. | [
"Linear",
"map",
":",
"sum_i",
"(",
"args",
"[",
"i",
"]",
"*",
"W",
"[",
"i",
"]",
")",
"where",
"W",
"[",
"i",
"]",
"is",
"a",
"variable",
"."
] | def _linear(args,
output_size,
bias,
bias_initializer=None,
kernel_initializer=None):
"""Linear map: sum_i(args[i] * W[i]), where W[i] is a variable.
Args:
args: a 2D Tensor or a list of 2D, batch, n, Tensors.
output_size: int, second dimension of W[i].
b... | [
"def",
"_linear",
"(",
"args",
",",
"output_size",
",",
"bias",
",",
"bias_initializer",
"=",
"None",
",",
"kernel_initializer",
"=",
"None",
")",
":",
"if",
"args",
"is",
"None",
"or",
"(",
"nest",
".",
"is_sequence",
"(",
"args",
")",
"and",
"not",
"... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/ops/rnn_cell_impl.py#L1284-L1346 | ||
facebook/ThreatExchange | 31914a51820c73c8a0daffe62ccca29a6e3d359e | api-reference-examples/python/pytx/pytx/malware.py | python | Malware.rfh | (self) | return rfh | Return a file handle of the base64-decoded and unzipped sample. | Return a file handle of the base64-decoded and unzipped sample. | [
"Return",
"a",
"file",
"handle",
"of",
"the",
"base64",
"-",
"decoded",
"and",
"unzipped",
"sample",
"."
] | def rfh(self):
"""
Return a file handle of the base64-decoded and unzipped sample.
"""
zfh = self.zfh
rfh = io.BytesIO()
with zipfile.ZipFile(zfh, 'r') as zf:
for entry in zf.infolist():
rfh.write(zf.read(entry.filename,
... | [
"def",
"rfh",
"(",
"self",
")",
":",
"zfh",
"=",
"self",
".",
"zfh",
"rfh",
"=",
"io",
".",
"BytesIO",
"(",
")",
"with",
"zipfile",
".",
"ZipFile",
"(",
"zfh",
",",
"'r'",
")",
"as",
"zf",
":",
"for",
"entry",
"in",
"zf",
".",
"infolist",
"(",
... | https://github.com/facebook/ThreatExchange/blob/31914a51820c73c8a0daffe62ccca29a6e3d359e/api-reference-examples/python/pytx/pytx/malware.py#L105-L117 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/indexes/numeric.py | python | UInt64Index.inferred_type | (self) | return "integer" | Always 'integer' for ``UInt64Index`` | Always 'integer' for ``UInt64Index`` | [
"Always",
"integer",
"for",
"UInt64Index"
] | def inferred_type(self) -> str:
"""
Always 'integer' for ``UInt64Index``
"""
return "integer" | [
"def",
"inferred_type",
"(",
"self",
")",
"->",
"str",
":",
"return",
"\"integer\""
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/indexes/numeric.py#L307-L311 | |
intel/llvm | e6d0547e9d99b5a56430c4749f6c7e328bf221ab | clang/bindings/python/clang/cindex.py | python | Cursor.is_const_method | (self) | return conf.lib.clang_CXXMethod_isConst(self) | Returns True if the cursor refers to a C++ member function or member
function template that is declared 'const'. | Returns True if the cursor refers to a C++ member function or member
function template that is declared 'const'. | [
"Returns",
"True",
"if",
"the",
"cursor",
"refers",
"to",
"a",
"C",
"++",
"member",
"function",
"or",
"member",
"function",
"template",
"that",
"is",
"declared",
"const",
"."
] | def is_const_method(self):
"""Returns True if the cursor refers to a C++ member function or member
function template that is declared 'const'.
"""
return conf.lib.clang_CXXMethod_isConst(self) | [
"def",
"is_const_method",
"(",
"self",
")",
":",
"return",
"conf",
".",
"lib",
".",
"clang_CXXMethod_isConst",
"(",
"self",
")"
] | https://github.com/intel/llvm/blob/e6d0547e9d99b5a56430c4749f6c7e328bf221ab/clang/bindings/python/clang/cindex.py#L1444-L1448 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_vendor/requests/cookies.py | python | morsel_to_cookie | (morsel) | return create_cookie(
comment=morsel['comment'],
comment_url=bool(morsel['comment']),
discard=False,
domain=morsel['domain'],
expires=expires,
name=morsel.key,
path=morsel['path'],
port=None,
rest={'HttpOnly': morsel['httponly']},
... | Convert a Morsel object into a Cookie containing the one k/v pair. | Convert a Morsel object into a Cookie containing the one k/v pair. | [
"Convert",
"a",
"Morsel",
"object",
"into",
"a",
"Cookie",
"containing",
"the",
"one",
"k",
"/",
"v",
"pair",
"."
] | def morsel_to_cookie(morsel):
"""Convert a Morsel object into a Cookie containing the one k/v pair."""
expires = None
if morsel['max-age']:
try:
expires = int(time.time() + int(morsel['max-age']))
except ValueError:
raise TypeError('max-age: %s must be intege... | [
"def",
"morsel_to_cookie",
"(",
"morsel",
")",
":",
"expires",
"=",
"None",
"if",
"morsel",
"[",
"'max-age'",
"]",
":",
"try",
":",
"expires",
"=",
"int",
"(",
"time",
".",
"time",
"(",
")",
"+",
"int",
"(",
"morsel",
"[",
"'max-age'",
"]",
")",
")... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_vendor/requests/cookies.py#L953-L1009 | |
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | deps/src/libxml2-2.9.1/python/libxml2class.py | python | uCSIsCatPi | (code) | return ret | Check whether the character is part of Pi UCS Category | Check whether the character is part of Pi UCS Category | [
"Check",
"whether",
"the",
"character",
"is",
"part",
"of",
"Pi",
"UCS",
"Category"
] | def uCSIsCatPi(code):
"""Check whether the character is part of Pi UCS Category """
ret = libxml2mod.xmlUCSIsCatPi(code)
return ret | [
"def",
"uCSIsCatPi",
"(",
"code",
")",
":",
"ret",
"=",
"libxml2mod",
".",
"xmlUCSIsCatPi",
"(",
"code",
")",
"return",
"ret"
] | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/deps/src/libxml2-2.9.1/python/libxml2class.py#L1578-L1581 | |
ValveSoftware/source-sdk-2013 | 0d8dceea4310fde5706b3ce1c70609d72a38efdf | sp/src/thirdparty/protobuf-2.3.0/python/mox.py | python | Func.__init__ | (self, func) | Initialize.
Args:
func: callable that takes one parameter and returns a bool | Initialize. | [
"Initialize",
"."
] | def __init__(self, func):
"""Initialize.
Args:
func: callable that takes one parameter and returns a bool
"""
self._func = func | [
"def",
"__init__",
"(",
"self",
",",
"func",
")",
":",
"self",
".",
"_func",
"=",
"func"
] | https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/sp/src/thirdparty/protobuf-2.3.0/python/mox.py#L1129-L1136 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_core.py | python | FileSystemHandler.GetRightLocation | (*args, **kwargs) | return _core_.FileSystemHandler_GetRightLocation(*args, **kwargs) | GetRightLocation(String location) -> String | GetRightLocation(String location) -> String | [
"GetRightLocation",
"(",
"String",
"location",
")",
"-",
">",
"String"
] | def GetRightLocation(*args, **kwargs):
"""GetRightLocation(String location) -> String"""
return _core_.FileSystemHandler_GetRightLocation(*args, **kwargs) | [
"def",
"GetRightLocation",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"FileSystemHandler_GetRightLocation",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_core.py#L2375-L2377 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/urllib/robotparser.py | python | RobotFileParser.modified | (self) | Sets the time the robots.txt file was last fetched to the
current time. | Sets the time the robots.txt file was last fetched to the
current time. | [
"Sets",
"the",
"time",
"the",
"robots",
".",
"txt",
"file",
"was",
"last",
"fetched",
"to",
"the",
"current",
"time",
"."
] | def modified(self):
"""Sets the time the robots.txt file was last fetched to the
current time.
"""
import time
self.last_checked = time.time() | [
"def",
"modified",
"(",
"self",
")",
":",
"import",
"time",
"self",
".",
"last_checked",
"=",
"time",
".",
"time",
"(",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/urllib/robotparser.py#L46-L52 | ||
JumpingYang001/webrtc | c03d6e965e1f54aeadd670e491eabe5fdb8db968 | tools_webrtc/vim/webrtc.ycm_extra_conf.py | python | GetNinjaBuildOutputsForSourceFile | (out_dir, filename) | return [
target for target in output_lines
if target and (target.endswith('.o') or target.endswith('.obj'))
] | Returns a list of build outputs for filename.
The list is generated by invoking 'ninja -t query' tool to retrieve a list of
inputs and outputs of |filename|. This list is then filtered to only include
.o and .obj outputs.
Args:
out_dir: (String) Absolute path to ninja build output directory.
filename:... | Returns a list of build outputs for filename. | [
"Returns",
"a",
"list",
"of",
"build",
"outputs",
"for",
"filename",
"."
] | def GetNinjaBuildOutputsForSourceFile(out_dir, filename):
"""Returns a list of build outputs for filename.
The list is generated by invoking 'ninja -t query' tool to retrieve a list of
inputs and outputs of |filename|. This list is then filtered to only include
.o and .obj outputs.
Args:
out_dir: (Str... | [
"def",
"GetNinjaBuildOutputsForSourceFile",
"(",
"out_dir",
",",
"filename",
")",
":",
"# Ninja needs the path to the source file relative to the output build",
"# directory.",
"rel_filename",
"=",
"os",
".",
"path",
".",
"relpath",
"(",
"filename",
",",
"out_dir",
")",
"... | https://github.com/JumpingYang001/webrtc/blob/c03d6e965e1f54aeadd670e491eabe5fdb8db968/tools_webrtc/vim/webrtc.ycm_extra_conf.py#L123-L162 | |
perilouswithadollarsign/cstrike15_src | f82112a2388b841d72cb62ca48ab1846dfcc11c8 | thirdparty/protobuf-2.5.0/python/google/protobuf/service_reflection.py | python | GeneratedServiceType.__init__ | (cls, name, bases, dictionary) | Creates a message service class.
Args:
name: Name of the class (ignored, but required by the metaclass
protocol).
bases: Base classes of the class being constructed.
dictionary: The class dictionary of the class being constructed.
dictionary[_DESCRIPTOR_KEY] must contain a Service... | Creates a message service class. | [
"Creates",
"a",
"message",
"service",
"class",
"."
] | def __init__(cls, name, bases, dictionary):
"""Creates a message service class.
Args:
name: Name of the class (ignored, but required by the metaclass
protocol).
bases: Base classes of the class being constructed.
dictionary: The class dictionary of the class being constructed.
... | [
"def",
"__init__",
"(",
"cls",
",",
"name",
",",
"bases",
",",
"dictionary",
")",
":",
"# Don't do anything if this class doesn't have a descriptor. This happens",
"# when a service class is subclassed.",
"if",
"GeneratedServiceType",
".",
"_DESCRIPTOR_KEY",
"not",
"in",
"dic... | https://github.com/perilouswithadollarsign/cstrike15_src/blob/f82112a2388b841d72cb62ca48ab1846dfcc11c8/thirdparty/protobuf-2.5.0/python/google/protobuf/service_reflection.py#L64-L81 | ||
MVIG-SJTU/RMPE | 5188c230ec800c12be7369c3619615bc9b020aa4 | scripts/cpp_lint.py | python | CheckBraces | (filename, clean_lines, linenum, error) | Looks for misplaced braces (e.g. at the end of line).
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call with any errors found. | Looks for misplaced braces (e.g. at the end of line). | [
"Looks",
"for",
"misplaced",
"braces",
"(",
"e",
".",
"g",
".",
"at",
"the",
"end",
"of",
"line",
")",
"."
] | def CheckBraces(filename, clean_lines, linenum, error):
"""Looks for misplaced braces (e.g. at the end of line).
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call with any er... | [
"def",
"CheckBraces",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"# get rid of comments and strings",
"if",
"Match",
"(",
"r'\\s*{\\s*$'",
",",
"line",
")",
":",
... | https://github.com/MVIG-SJTU/RMPE/blob/5188c230ec800c12be7369c3619615bc9b020aa4/scripts/cpp_lint.py#L3073-L3244 | ||
rdkit/rdkit | ede860ae316d12d8568daf5ee800921c3389c84e | rdkit/ML/Cluster/Clusters.py | python | Cluster.AddChildren | (self, children) | Adds a bunch of children to our list
**Arguments**
- children: a list of Clusters | Adds a bunch of children to our list | [
"Adds",
"a",
"bunch",
"of",
"children",
"to",
"our",
"list"
] | def AddChildren(self, children):
"""Adds a bunch of children to our list
**Arguments**
- children: a list of Clusters
"""
self.children += children
self._GenPoints()
self._UpdateLength() | [
"def",
"AddChildren",
"(",
"self",
",",
"children",
")",
":",
"self",
".",
"children",
"+=",
"children",
"self",
".",
"_GenPoints",
"(",
")",
"self",
".",
"_UpdateLength",
"(",
")"
] | https://github.com/rdkit/rdkit/blob/ede860ae316d12d8568daf5ee800921c3389c84e/rdkit/ML/Cluster/Clusters.py#L162-L172 | ||
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/python/framework/common_shapes.py | python | depthwise_conv2d_native_shape | (op) | return [tensor_shape.TensorShape([batch_size, out_rows, out_cols, depth_out])] | Shape function for a DepthwiseConv2D op.
This op has two inputs:
* input, a 4D tensor with shape = [batch_size, rows, cols, depth_in]
* filter, a 4D tensor with shape = [filter_rows, filter_cols,
depth_in, depthwise_multiplier]
The output is a 4D tensor with shape = [batch_size, out_rows,
out_cols, de... | Shape function for a DepthwiseConv2D op. | [
"Shape",
"function",
"for",
"a",
"DepthwiseConv2D",
"op",
"."
] | def depthwise_conv2d_native_shape(op):
"""Shape function for a DepthwiseConv2D op.
This op has two inputs:
* input, a 4D tensor with shape = [batch_size, rows, cols, depth_in]
* filter, a 4D tensor with shape = [filter_rows, filter_cols,
depth_in, depthwise_multiplier]
The output is a 4D tensor with s... | [
"def",
"depthwise_conv2d_native_shape",
"(",
"op",
")",
":",
"input_shape",
"=",
"op",
".",
"inputs",
"[",
"0",
"]",
".",
"get_shape",
"(",
")",
".",
"with_rank",
"(",
"4",
")",
"filter_shape",
"=",
"op",
".",
"inputs",
"[",
"1",
"]",
".",
"get_shape",... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/python/framework/common_shapes.py#L256-L309 | |
ArduPilot/ardupilot | 6e684b3496122b8158ac412b609d00004b7ac306 | Tools/scripts/build_binaries.py | python | build_binaries.touch_filepath | (self, filepath) | creates a file at filepath, or updates the timestamp on filepath | creates a file at filepath, or updates the timestamp on filepath | [
"creates",
"a",
"file",
"at",
"filepath",
"or",
"updates",
"the",
"timestamp",
"on",
"filepath"
] | def touch_filepath(self, filepath):
'''creates a file at filepath, or updates the timestamp on filepath'''
if os.path.exists(filepath):
os.utime(filepath, None)
else:
with open(filepath, "a"):
pass | [
"def",
"touch_filepath",
"(",
"self",
",",
"filepath",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"filepath",
")",
":",
"os",
".",
"utime",
"(",
"filepath",
",",
"None",
")",
"else",
":",
"with",
"open",
"(",
"filepath",
",",
"\"a\"",
"... | https://github.com/ArduPilot/ardupilot/blob/6e684b3496122b8158ac412b609d00004b7ac306/Tools/scripts/build_binaries.py#L384-L390 | ||
gnuradio/gnuradio | 09c3c4fa4bfb1a02caac74cb5334dfe065391e3b | gr-digital/python/digital/qa_header_payload_demux.py | python | qa_header_payload_demux.test_001_headerpadding_payload_offset | (self) | Like test 1, but with header padding + payload offset. | Like test 1, but with header padding + payload offset. | [
"Like",
"test",
"1",
"but",
"with",
"header",
"padding",
"+",
"payload",
"offset",
"."
] | def test_001_headerpadding_payload_offset(self):
""" Like test 1, but with header padding + payload offset. """
n_zeros = 3
header = [1, 2, 3]
header_padding = 1
payload_offset = -1
payload = list(range(5, 20))
data_signal = [0, ] * n_zeros + header + payload + [0... | [
"def",
"test_001_headerpadding_payload_offset",
"(",
"self",
")",
":",
"n_zeros",
"=",
"3",
"header",
"=",
"[",
"1",
",",
"2",
",",
"3",
"]",
"header_padding",
"=",
"1",
"payload_offset",
"=",
"-",
"1",
"payload",
"=",
"list",
"(",
"range",
"(",
"5",
"... | https://github.com/gnuradio/gnuradio/blob/09c3c4fa4bfb1a02caac74cb5334dfe065391e3b/gr-digital/python/digital/qa_header_payload_demux.py#L316-L377 | ||
google/llvm-propeller | 45c226984fe8377ebfb2ad7713c680d652ba678d | compiler-rt/lib/sanitizer_common/scripts/cpplint.py | python | ReplaceAll | (pattern, rep, s) | return _regexp_compile_cache[pattern].sub(rep, s) | Replaces instances of pattern in a string with a replacement.
The compiled regex is kept in a cache shared by Match and Search.
Args:
pattern: regex pattern
rep: replacement text
s: search string
Returns:
string with replacements made (or original string if no replacements) | Replaces instances of pattern in a string with a replacement. | [
"Replaces",
"instances",
"of",
"pattern",
"in",
"a",
"string",
"with",
"a",
"replacement",
"."
] | def ReplaceAll(pattern, rep, s):
"""Replaces instances of pattern in a string with a replacement.
The compiled regex is kept in a cache shared by Match and Search.
Args:
pattern: regex pattern
rep: replacement text
s: search string
Returns:
string with replacements made (or original string if... | [
"def",
"ReplaceAll",
"(",
"pattern",
",",
"rep",
",",
"s",
")",
":",
"if",
"pattern",
"not",
"in",
"_regexp_compile_cache",
":",
"_regexp_compile_cache",
"[",
"pattern",
"]",
"=",
"sre_compile",
".",
"compile",
"(",
"pattern",
")",
"return",
"_regexp_compile_c... | https://github.com/google/llvm-propeller/blob/45c226984fe8377ebfb2ad7713c680d652ba678d/compiler-rt/lib/sanitizer_common/scripts/cpplint.py#L667-L682 | |
xiaohaoChen/rrc_detection | 4f2b110cd122da7f55e8533275a9b4809a88785a | scripts/cpp_lint.py | python | _Filters | () | return _cpplint_state.filters | Returns the module's list of output filters, as a list. | Returns the module's list of output filters, as a list. | [
"Returns",
"the",
"module",
"s",
"list",
"of",
"output",
"filters",
"as",
"a",
"list",
"."
] | def _Filters():
"""Returns the module's list of output filters, as a list."""
return _cpplint_state.filters | [
"def",
"_Filters",
"(",
")",
":",
"return",
"_cpplint_state",
".",
"filters"
] | https://github.com/xiaohaoChen/rrc_detection/blob/4f2b110cd122da7f55e8533275a9b4809a88785a/scripts/cpp_lint.py#L792-L794 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/_osx_support.py | python | customize_config_vars | (_config_vars) | return _config_vars | Customize Python build configuration variables.
Called internally from sysconfig with a mutable mapping
containing name/value pairs parsed from the configured
makefile used to build this interpreter. Returns
the mapping updated as needed to reflect the environment
in which the interpreter is runni... | Customize Python build configuration variables. | [
"Customize",
"Python",
"build",
"configuration",
"variables",
"."
] | def customize_config_vars(_config_vars):
"""Customize Python build configuration variables.
Called internally from sysconfig with a mutable mapping
containing name/value pairs parsed from the configured
makefile used to build this interpreter. Returns
the mapping updated as needed to reflect the e... | [
"def",
"customize_config_vars",
"(",
"_config_vars",
")",
":",
"if",
"not",
"_supports_universal_builds",
"(",
")",
":",
"# On Mac OS X before 10.4, check if -arch and -isysroot",
"# are in CFLAGS or LDFLAGS and remove them if they are.",
"# This is needed when building extensions on a 1... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/_osx_support.py#L362-L400 | |
psi4/psi4 | be533f7f426b6ccc263904e55122899b16663395 | psi4/driver/p4util/procutil.py | python | prepare_options_for_modules | (changedOnly=False, commandsInsteadDict=False) | Function to return a string of commands to replicate the
current state of user-modified options. Used to capture C++
options information for distributed (sow/reap) input files.
.. caution:: Some features are not yet implemented. Buy a developer a coffee.
- Need some option to get either all or chan... | Function to return a string of commands to replicate the
current state of user-modified options. Used to capture C++
options information for distributed (sow/reap) input files. | [
"Function",
"to",
"return",
"a",
"string",
"of",
"commands",
"to",
"replicate",
"the",
"current",
"state",
"of",
"user",
"-",
"modified",
"options",
".",
"Used",
"to",
"capture",
"C",
"++",
"options",
"information",
"for",
"distributed",
"(",
"sow",
"/",
"... | def prepare_options_for_modules(changedOnly=False, commandsInsteadDict=False):
"""Function to return a string of commands to replicate the
current state of user-modified options. Used to capture C++
options information for distributed (sow/reap) input files.
.. caution:: Some features are not yet imple... | [
"def",
"prepare_options_for_modules",
"(",
"changedOnly",
"=",
"False",
",",
"commandsInsteadDict",
"=",
"False",
")",
":",
"options",
"=",
"collections",
".",
"defaultdict",
"(",
"dict",
")",
"commands",
"=",
"''",
"for",
"opt",
"in",
"core",
".",
"get_global... | https://github.com/psi4/psi4/blob/be533f7f426b6ccc263904e55122899b16663395/psi4/driver/p4util/procutil.py#L383-L429 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/build/waf-1.7.13/waflib/extras/misc.py | python | copy_func | (tsk) | Make a file copy. This might be used to make other kinds of file processing (even calling a compiler is possible) | Make a file copy. This might be used to make other kinds of file processing (even calling a compiler is possible) | [
"Make",
"a",
"file",
"copy",
".",
"This",
"might",
"be",
"used",
"to",
"make",
"other",
"kinds",
"of",
"file",
"processing",
"(",
"even",
"calling",
"a",
"compiler",
"is",
"possible",
")"
] | def copy_func(tsk):
"Make a file copy. This might be used to make other kinds of file processing (even calling a compiler is possible)"
env = tsk.env
infile = tsk.inputs[0].abspath()
outfile = tsk.outputs[0].abspath()
try:
shutil.copy2(infile, outfile)
except (OSError, IOError):
return 1
else:
if tsk.chmod... | [
"def",
"copy_func",
"(",
"tsk",
")",
":",
"env",
"=",
"tsk",
".",
"env",
"infile",
"=",
"tsk",
".",
"inputs",
"[",
"0",
"]",
".",
"abspath",
"(",
")",
"outfile",
"=",
"tsk",
".",
"outputs",
"[",
"0",
"]",
".",
"abspath",
"(",
")",
"try",
":",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/build/waf-1.7.13/waflib/extras/misc.py#L28-L39 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_controls.py | python | CollapsiblePaneEvent.__init__ | (self, *args, **kwargs) | __init__(self, Object generator, int id, bool collapsed) -> CollapsiblePaneEvent | __init__(self, Object generator, int id, bool collapsed) -> CollapsiblePaneEvent | [
"__init__",
"(",
"self",
"Object",
"generator",
"int",
"id",
"bool",
"collapsed",
")",
"-",
">",
"CollapsiblePaneEvent"
] | def __init__(self, *args, **kwargs):
"""__init__(self, Object generator, int id, bool collapsed) -> CollapsiblePaneEvent"""
_controls_.CollapsiblePaneEvent_swiginit(self,_controls_.new_CollapsiblePaneEvent(*args, **kwargs)) | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_controls_",
".",
"CollapsiblePaneEvent_swiginit",
"(",
"self",
",",
"_controls_",
".",
"new_CollapsiblePaneEvent",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_controls.py#L7403-L7405 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/richtext.py | python | RichTextFileHandler.CanSave | (*args, **kwargs) | return _richtext.RichTextFileHandler_CanSave(*args, **kwargs) | CanSave(self) -> bool | CanSave(self) -> bool | [
"CanSave",
"(",
"self",
")",
"-",
">",
"bool"
] | def CanSave(*args, **kwargs):
"""CanSave(self) -> bool"""
return _richtext.RichTextFileHandler_CanSave(*args, **kwargs) | [
"def",
"CanSave",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"RichTextFileHandler_CanSave",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/richtext.py#L2772-L2774 | |
pirobot/rbx2 | 2a6544799fcf062e7b6bd5cf2981b2a84c0c7d2a | rbx2_utils/src/rbx2_utils/srv/_LaunchProcess.py | python | LaunchProcessRequest.deserialize_numpy | (self, str, numpy) | unpack serialized message in str into this message instance using numpy for array types
:param str: byte array of serialized message, ``str``
:param numpy: numpy python module | unpack serialized message in str into this message instance using numpy for array types
:param str: byte array of serialized message, ``str``
:param numpy: numpy python module | [
"unpack",
"serialized",
"message",
"in",
"str",
"into",
"this",
"message",
"instance",
"using",
"numpy",
"for",
"array",
"types",
":",
"param",
"str",
":",
"byte",
"array",
"of",
"serialized",
"message",
"str",
":",
"param",
"numpy",
":",
"numpy",
"python",
... | def deserialize_numpy(self, str, numpy):
"""
unpack serialized message in str into this message instance using numpy for array types
:param str: byte array of serialized message, ``str``
:param numpy: numpy python module
"""
try:
end = 0
start = end
end += 4
(length,) = _... | [
"def",
"deserialize_numpy",
"(",
"self",
",",
"str",
",",
"numpy",
")",
":",
"try",
":",
"end",
"=",
"0",
"start",
"=",
"end",
"end",
"+=",
"4",
"(",
"length",
",",
")",
"=",
"_struct_I",
".",
"unpack",
"(",
"str",
"[",
"start",
":",
"end",
"]",
... | https://github.com/pirobot/rbx2/blob/2a6544799fcf062e7b6bd5cf2981b2a84c0c7d2a/rbx2_utils/src/rbx2_utils/srv/_LaunchProcess.py#L98-L117 | ||
domino-team/openwrt-cc | 8b181297c34d14d3ca521cc9f31430d561dbc688 | package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py | python | AddArch | (output, arch) | return '%s.%s%s' % (output, arch, extension) | Adds an arch string to an output path. | Adds an arch string to an output path. | [
"Adds",
"an",
"arch",
"string",
"to",
"an",
"output",
"path",
"."
] | def AddArch(output, arch):
"""Adds an arch string to an output path."""
output, extension = os.path.splitext(output)
return '%s.%s%s' % (output, arch, extension) | [
"def",
"AddArch",
"(",
"output",
",",
"arch",
")",
":",
"output",
",",
"extension",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"output",
")",
"return",
"'%s.%s%s'",
"%",
"(",
"output",
",",
"arch",
",",
"extension",
")"
] | https://github.com/domino-team/openwrt-cc/blob/8b181297c34d14d3ca521cc9f31430d561dbc688/package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py#L95-L98 | |
microsoft/CNTK | e9396480025b9ca457d26b6f33dd07c474c6aa04 | bindings/python/cntk/contrib/crosstalk/__init__.py | python | Crosstalk.reset | (self) | Reset all variables and passes, setter/getter functions for variable types are kept | Reset all variables and passes, setter/getter functions for variable types are kept | [
"Reset",
"all",
"variables",
"and",
"passes",
"setter",
"/",
"getter",
"functions",
"for",
"variable",
"types",
"are",
"kept"
] | def reset(self):
'''
Reset all variables and passes, setter/getter functions for variable types are kept
'''
self.vars = {}
self.passes = 0 | [
"def",
"reset",
"(",
"self",
")",
":",
"self",
".",
"vars",
"=",
"{",
"}",
"self",
".",
"passes",
"=",
"0"
] | https://github.com/microsoft/CNTK/blob/e9396480025b9ca457d26b6f33dd07c474c6aa04/bindings/python/cntk/contrib/crosstalk/__init__.py#L301-L306 | ||
jiangxiluning/FOTS.PyTorch | b1851c170b4f1ad18406766352cb5171648ce603 | FOTS/utils/detect.py | python | adjust_ratio | (boxes, ratio_w, ratio_h) | return np.around(boxes) | refine boxes
Input:
boxes : detected polys <numpy.ndarray, (n,9)>
ratio_w: ratio of width
ratio_h: ratio of height
Output:
refined boxes | refine boxes
Input:
boxes : detected polys <numpy.ndarray, (n,9)>
ratio_w: ratio of width
ratio_h: ratio of height
Output:
refined boxes | [
"refine",
"boxes",
"Input",
":",
"boxes",
":",
"detected",
"polys",
"<numpy",
".",
"ndarray",
"(",
"n",
"9",
")",
">",
"ratio_w",
":",
"ratio",
"of",
"width",
"ratio_h",
":",
"ratio",
"of",
"height",
"Output",
":",
"refined",
"boxes"
] | def adjust_ratio(boxes, ratio_w, ratio_h):
'''refine boxes
Input:
boxes : detected polys <numpy.ndarray, (n,9)>
ratio_w: ratio of width
ratio_h: ratio of height
Output:
refined boxes
'''
if boxes is None or boxes.size == 0:
return None
boxes[:,[0,2,4,6]] ... | [
"def",
"adjust_ratio",
"(",
"boxes",
",",
"ratio_w",
",",
"ratio_h",
")",
":",
"if",
"boxes",
"is",
"None",
"or",
"boxes",
".",
"size",
"==",
"0",
":",
"return",
"None",
"boxes",
"[",
":",
",",
"[",
"0",
",",
"2",
",",
"4",
",",
"6",
"]",
"]",
... | https://github.com/jiangxiluning/FOTS.PyTorch/blob/b1851c170b4f1ad18406766352cb5171648ce603/FOTS/utils/detect.py#L137-L150 | |
google/syzygy | 8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5 | third_party/numpy/files/numpy/ma/core.py | python | MaskedArray.__float__ | (self) | return float(self.item()) | Convert to float. | Convert to float. | [
"Convert",
"to",
"float",
"."
] | def __float__(self):
"Convert to float."
if self.size > 1:
raise TypeError("Only length-1 arrays can be converted "\
"to Python scalars")
elif self._mask:
warnings.warn("Warning: converting a masked element to nan.")
return np.nan
... | [
"def",
"__float__",
"(",
"self",
")",
":",
"if",
"self",
".",
"size",
">",
"1",
":",
"raise",
"TypeError",
"(",
"\"Only length-1 arrays can be converted \"",
"\"to Python scalars\"",
")",
"elif",
"self",
".",
"_mask",
":",
"warnings",
".",
"warn",
"(",
"\"Warn... | https://github.com/google/syzygy/blob/8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5/third_party/numpy/files/numpy/ma/core.py#L3779-L3787 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/parfor.py | python | push_call_vars | (blocks, saved_globals, saved_getattrs, nested=False) | return | push call variables to right before their call site.
assuming one global/getattr is created for each call site and control flow
doesn't change it. | push call variables to right before their call site.
assuming one global/getattr is created for each call site and control flow
doesn't change it. | [
"push",
"call",
"variables",
"to",
"right",
"before",
"their",
"call",
"site",
".",
"assuming",
"one",
"global",
"/",
"getattr",
"is",
"created",
"for",
"each",
"call",
"site",
"and",
"control",
"flow",
"doesn",
"t",
"change",
"it",
"."
] | def push_call_vars(blocks, saved_globals, saved_getattrs, nested=False):
"""push call variables to right before their call site.
assuming one global/getattr is created for each call site and control flow
doesn't change it.
"""
for block in blocks.values():
new_body = []
# global/attr... | [
"def",
"push_call_vars",
"(",
"blocks",
",",
"saved_globals",
",",
"saved_getattrs",
",",
"nested",
"=",
"False",
")",
":",
"for",
"block",
"in",
"blocks",
".",
"values",
"(",
")",
":",
"new_body",
"=",
"[",
"]",
"# global/attr variables that are defined in this... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/parfor.py#L3929-L3968 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py3/numpy/core/defchararray.py | python | join | (sep, seq) | return _to_string_or_unicode_array(
_vec_string(sep, object_, 'join', (seq,))) | Return a string which is the concatenation of the strings in the
sequence `seq`.
Calls `str.join` element-wise.
Parameters
----------
sep : array_like of str or unicode
seq : array_like of str or unicode
Returns
-------
out : ndarray
Output array of str or unicode, dependi... | Return a string which is the concatenation of the strings in the
sequence `seq`. | [
"Return",
"a",
"string",
"which",
"is",
"the",
"concatenation",
"of",
"the",
"strings",
"in",
"the",
"sequence",
"seq",
"."
] | def join(sep, seq):
"""
Return a string which is the concatenation of the strings in the
sequence `seq`.
Calls `str.join` element-wise.
Parameters
----------
sep : array_like of str or unicode
seq : array_like of str or unicode
Returns
-------
out : ndarray
Output ... | [
"def",
"join",
"(",
"sep",
",",
"seq",
")",
":",
"return",
"_to_string_or_unicode_array",
"(",
"_vec_string",
"(",
"sep",
",",
"object_",
",",
"'join'",
",",
"(",
"seq",
",",
")",
")",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py3/numpy/core/defchararray.py#L939-L961 | |
intel/caffe | 3f494b442ee3f9d17a07b09ecbd5fa2bbda00836 | examples/faster-rcnn/lib/fast_rcnn/config.py | python | _merge_a_into_b | (a, b) | Merge config dictionary a into config dictionary b, clobbering the
options in b whenever they are also specified in a. | Merge config dictionary a into config dictionary b, clobbering the
options in b whenever they are also specified in a. | [
"Merge",
"config",
"dictionary",
"a",
"into",
"config",
"dictionary",
"b",
"clobbering",
"the",
"options",
"in",
"b",
"whenever",
"they",
"are",
"also",
"specified",
"in",
"a",
"."
] | def _merge_a_into_b(a, b):
"""Merge config dictionary a into config dictionary b, clobbering the
options in b whenever they are also specified in a.
"""
if type(a) is not edict:
return
for k, v in a.iteritems():
# a must specify keys that are in b
if not b.has_key(k):
... | [
"def",
"_merge_a_into_b",
"(",
"a",
",",
"b",
")",
":",
"if",
"type",
"(",
"a",
")",
"is",
"not",
"edict",
":",
"return",
"for",
"k",
",",
"v",
"in",
"a",
".",
"iteritems",
"(",
")",
":",
"# a must specify keys that are in b",
"if",
"not",
"b",
".",
... | https://github.com/intel/caffe/blob/3f494b442ee3f9d17a07b09ecbd5fa2bbda00836/examples/faster-rcnn/lib/fast_rcnn/config.py#L225-L255 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_windows.py | python | VarHScrollHelper.RefreshColumns | (*args, **kwargs) | return _windows_.VarHScrollHelper_RefreshColumns(*args, **kwargs) | RefreshColumns(self, size_t from, size_t to) | RefreshColumns(self, size_t from, size_t to) | [
"RefreshColumns",
"(",
"self",
"size_t",
"from",
"size_t",
"to",
")"
] | def RefreshColumns(*args, **kwargs):
"""RefreshColumns(self, size_t from, size_t to)"""
return _windows_.VarHScrollHelper_RefreshColumns(*args, **kwargs) | [
"def",
"RefreshColumns",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"VarHScrollHelper_RefreshColumns",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_windows.py#L2340-L2342 | |
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/python/ops/nn_ops.py | python | xw_plus_b_v1 | (x, weights, biases, name=None) | Computes matmul(x, weights) + biases.
This is a deprecated version of that will soon be removed.
Args:
x: a 2D tensor. Dimensions typically: batch, in_units
weights: a 2D tensor. Dimensions typically: in_units, out_units
biases: a 1D tensor. Dimensions: out_units
name: A name for the operation ... | Computes matmul(x, weights) + biases. | [
"Computes",
"matmul",
"(",
"x",
"weights",
")",
"+",
"biases",
"."
] | def xw_plus_b_v1(x, weights, biases, name=None): # pylint: disable=invalid-name
"""Computes matmul(x, weights) + biases.
This is a deprecated version of that will soon be removed.
Args:
x: a 2D tensor. Dimensions typically: batch, in_units
weights: a 2D tensor. Dimensions typically: in_units, out_uni... | [
"def",
"xw_plus_b_v1",
"(",
"x",
",",
"weights",
",",
"biases",
",",
"name",
"=",
"None",
")",
":",
"# pylint: disable=invalid-name",
"with",
"ops",
".",
"op_scope",
"(",
"[",
"x",
",",
"weights",
",",
"biases",
"]",
",",
"name",
",",
"\"xw_plus_b_v1\"",
... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/python/ops/nn_ops.py#L1053-L1074 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/image_ops_impl.py | python | _Assert3DImage | (image) | return control_flow_ops.with_dependencies(
_Check3DImage(image, require_static=False), image) | Assert that we are working with a properly shaped image.
Performs the check statically if possible (i.e. if the shape
is statically known). Otherwise adds a control dependency
to an assert op that checks the dynamic shape.
Args:
image: 3-D Tensor of shape [height, width, channels]
Raises:
ValueErro... | Assert that we are working with a properly shaped image. | [
"Assert",
"that",
"we",
"are",
"working",
"with",
"a",
"properly",
"shaped",
"image",
"."
] | def _Assert3DImage(image):
"""Assert that we are working with a properly shaped image.
Performs the check statically if possible (i.e. if the shape
is statically known). Otherwise adds a control dependency
to an assert op that checks the dynamic shape.
Args:
image: 3-D Tensor of shape [height, width, ch... | [
"def",
"_Assert3DImage",
"(",
"image",
")",
":",
"return",
"control_flow_ops",
".",
"with_dependencies",
"(",
"_Check3DImage",
"(",
"image",
",",
"require_static",
"=",
"False",
")",
",",
"image",
")"
] | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/image_ops_impl.py#L153-L172 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/py/py/_path/svnurl.py | python | SvnCommandPath.mkdir | (self, *args, **kwargs) | return createpath | create & return the directory joined with args.
pass a 'msg' keyword argument to set the commit message. | create & return the directory joined with args.
pass a 'msg' keyword argument to set the commit message. | [
"create",
"&",
"return",
"the",
"directory",
"joined",
"with",
"args",
".",
"pass",
"a",
"msg",
"keyword",
"argument",
"to",
"set",
"the",
"commit",
"message",
"."
] | def mkdir(self, *args, **kwargs):
""" create & return the directory joined with args.
pass a 'msg' keyword argument to set the commit message.
"""
commit_msg = kwargs.get('msg', "mkdir by py lib invocation")
createpath = self.join(*args)
createpath._svnwrite('mkdir', '-m'... | [
"def",
"mkdir",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"commit_msg",
"=",
"kwargs",
".",
"get",
"(",
"'msg'",
",",
"\"mkdir by py lib invocation\"",
")",
"createpath",
"=",
"self",
".",
"join",
"(",
"*",
"args",
")",
"createp... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/py/py/_path/svnurl.py#L123-L131 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/ed_main.py | python | MainWindow.GetShelf | (self) | return self._shelf | Get this windows Shelf
@return: reference to L{iface.Shelf} instance
@note: returns the plugin instance not the actual notebook, if
a reference to the notebook is needed for parenting call
GetWindow on the object returned by this function. | Get this windows Shelf
@return: reference to L{iface.Shelf} instance
@note: returns the plugin instance not the actual notebook, if
a reference to the notebook is needed for parenting call
GetWindow on the object returned by this function. | [
"Get",
"this",
"windows",
"Shelf",
"@return",
":",
"reference",
"to",
"L",
"{",
"iface",
".",
"Shelf",
"}",
"instance",
"@note",
":",
"returns",
"the",
"plugin",
"instance",
"not",
"the",
"actual",
"notebook",
"if",
"a",
"reference",
"to",
"the",
"notebook... | def GetShelf(self):
"""Get this windows Shelf
@return: reference to L{iface.Shelf} instance
@note: returns the plugin instance not the actual notebook, if
a reference to the notebook is needed for parenting call
GetWindow on the object returned by this function.
... | [
"def",
"GetShelf",
"(",
"self",
")",
":",
"return",
"self",
".",
"_shelf"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/ed_main.py#L515-L523 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.