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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/python/debug/cli/analyzer_cli.py | python | DebugAnalyzer.print_tensor | (self, args, screen_info=None) | return tensor_format.format_tensor(
matching_data[0].get_tensor(),
matching_data[0].watch_key,
include_metadata=True,
np_printoptions=np_printoptions) | Command handler for print_tensor.
Print value of a given dumped tensor.
Args:
args: Command-line arguments, excluding the command prefix, as a list of
str.
screen_info: Optional dict input containing screen information such as
cols.
Returns:
Output text lines as a RichTe... | Command handler for print_tensor. | [
"Command",
"handler",
"for",
"print_tensor",
"."
] | def print_tensor(self, args, screen_info=None):
"""Command handler for print_tensor.
Print value of a given dumped tensor.
Args:
args: Command-line arguments, excluding the command prefix, as a list of
str.
screen_info: Optional dict input containing screen information such as
... | [
"def",
"print_tensor",
"(",
"self",
",",
"args",
",",
"screen_info",
"=",
"None",
")",
":",
"if",
"screen_info",
"and",
"\"cols\"",
"in",
"screen_info",
":",
"np_printoptions",
"=",
"{",
"\"linewidth\"",
":",
"screen_info",
"[",
"\"cols\"",
"]",
"}",
"else",... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/debug/cli/analyzer_cli.py#L435-L493 | |
apple/swift-lldb | d74be846ef3e62de946df343e8c234bde93a8912 | scripts/Python/static-binding/lldb.py | python | SBMemoryRegionInfo.GetName | (self) | return _lldb.SBMemoryRegionInfo_GetName(self) | GetName(SBMemoryRegionInfo self) -> char const * | GetName(SBMemoryRegionInfo self) -> char const * | [
"GetName",
"(",
"SBMemoryRegionInfo",
"self",
")",
"-",
">",
"char",
"const",
"*"
] | def GetName(self):
"""GetName(SBMemoryRegionInfo self) -> char const *"""
return _lldb.SBMemoryRegionInfo_GetName(self) | [
"def",
"GetName",
"(",
"self",
")",
":",
"return",
"_lldb",
".",
"SBMemoryRegionInfo_GetName",
"(",
"self",
")"
] | https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/scripts/Python/static-binding/lldb.py#L6964-L6966 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/richtext.py | python | RichTextCtrl.EndParagraphStyle | (*args, **kwargs) | return _richtext.RichTextCtrl_EndParagraphStyle(*args, **kwargs) | EndParagraphStyle(self) -> bool
End named character style | EndParagraphStyle(self) -> bool | [
"EndParagraphStyle",
"(",
"self",
")",
"-",
">",
"bool"
] | def EndParagraphStyle(*args, **kwargs):
"""
EndParagraphStyle(self) -> bool
End named character style
"""
return _richtext.RichTextCtrl_EndParagraphStyle(*args, **kwargs) | [
"def",
"EndParagraphStyle",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"RichTextCtrl_EndParagraphStyle",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/richtext.py#L3585-L3591 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/oldnumeric/ma.py | python | sort | (x, axis = -1, fill_value=None) | return masked_values(s, fill_value, copy=0) | If x does not have a mask, return a masked array formed from the
result of numeric.sort(x, axis).
Otherwise, fill x with fill_value. Sort it.
Set a mask where the result is equal to fill_value.
Note that this may have unintended consequences if the data contains the
fill value at a no... | If x does not have a mask, return a masked array formed from the
result of numeric.sort(x, axis).
Otherwise, fill x with fill_value. Sort it.
Set a mask where the result is equal to fill_value.
Note that this may have unintended consequences if the data contains the
fill value at a no... | [
"If",
"x",
"does",
"not",
"have",
"a",
"mask",
"return",
"a",
"masked",
"array",
"formed",
"from",
"the",
"result",
"of",
"numeric",
".",
"sort",
"(",
"x",
"axis",
")",
".",
"Otherwise",
"fill",
"x",
"with",
"fill_value",
".",
"Sort",
"it",
".",
"Set... | def sort (x, axis = -1, fill_value=None):
"""If x does not have a mask, return a masked array formed from the
result of numeric.sort(x, axis).
Otherwise, fill x with fill_value. Sort it.
Set a mask where the result is equal to fill_value.
Note that this may have unintended consequences i... | [
"def",
"sort",
"(",
"x",
",",
"axis",
"=",
"-",
"1",
",",
"fill_value",
"=",
"None",
")",
":",
"if",
"fill_value",
"is",
"None",
":",
"fill_value",
"=",
"default_fill_value",
"(",
"x",
")",
"d",
"=",
"filled",
"(",
"x",
",",
"fill_value",
")",
"s",... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/oldnumeric/ma.py#L2074-L2091 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/training/input.py | python | range_input_producer | (limit, num_epochs=None, shuffle=True, seed=None,
capacity=32, shared_name=None, name=None) | Produces the integers from 0 to limit-1 in a queue.
Note: if `num_epochs` is not `None`, this function creates local counter
`epochs`. Use `local_variables_initializer()` to initialize local variables.
Args:
limit: An int32 scalar tensor.
num_epochs: An integer (optional). If specified, `range_input_pro... | Produces the integers from 0 to limit-1 in a queue. | [
"Produces",
"the",
"integers",
"from",
"0",
"to",
"limit",
"-",
"1",
"in",
"a",
"queue",
"."
] | def range_input_producer(limit, num_epochs=None, shuffle=True, seed=None,
capacity=32, shared_name=None, name=None):
"""Produces the integers from 0 to limit-1 in a queue.
Note: if `num_epochs` is not `None`, this function creates local counter
`epochs`. Use `local_variables_initializer(... | [
"def",
"range_input_producer",
"(",
"limit",
",",
"num_epochs",
"=",
"None",
",",
"shuffle",
"=",
"True",
",",
"seed",
"=",
"None",
",",
"capacity",
"=",
"32",
",",
"shared_name",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"with",
"ops",
".",
"... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/training/input.py#L244-L273 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/ultimatelistctrl.py | python | UltimateListCtrl.ClearColumnImage | (self, col) | Clears all the images in the specified column.
:param `col`: the column index; | Clears all the images in the specified column. | [
"Clears",
"all",
"the",
"images",
"in",
"the",
"specified",
"column",
"."
] | def ClearColumnImage(self, col):
"""
Clears all the images in the specified column.
:param `col`: the column index;
"""
self.SetColumnImage(col, -1) | [
"def",
"ClearColumnImage",
"(",
"self",
",",
"col",
")",
":",
"self",
".",
"SetColumnImage",
"(",
"col",
",",
"-",
"1",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/ultimatelistctrl.py#L13128-L13135 | ||
muccc/gr-iridium | d0e7efcb6ee55a35042acd267d65af90847e5475 | docs/doxygen/update_pydoc.py | python | utoascii | (text) | return str(out) | Convert unicode text into ascii and escape quotes and backslashes. | Convert unicode text into ascii and escape quotes and backslashes. | [
"Convert",
"unicode",
"text",
"into",
"ascii",
"and",
"escape",
"quotes",
"and",
"backslashes",
"."
] | def utoascii(text):
"""
Convert unicode text into ascii and escape quotes and backslashes.
"""
if text is None:
return ''
out = text.encode('ascii', 'replace')
# swig will require us to replace blackslash with 4 backslashes
# TODO: evaluate what this should be for pybind11
out = ... | [
"def",
"utoascii",
"(",
"text",
")",
":",
"if",
"text",
"is",
"None",
":",
"return",
"''",
"out",
"=",
"text",
".",
"encode",
"(",
"'ascii'",
",",
"'replace'",
")",
"# swig will require us to replace blackslash with 4 backslashes",
"# TODO: evaluate what this should b... | https://github.com/muccc/gr-iridium/blob/d0e7efcb6ee55a35042acd267d65af90847e5475/docs/doxygen/update_pydoc.py#L70-L81 | |
manutdzou/KITTI_SSD | 5b620c2f291d36a0fe14489214f22a992f173f44 | examples/pycaffe/layers/pascal_multilabel_datalayers.py | python | PascalMultilabelDataLayerSync.forward | (self, bottom, top) | Load data. | Load data. | [
"Load",
"data",
"."
] | def forward(self, bottom, top):
"""
Load data.
"""
for itt in range(self.batch_size):
# Use the batch loader to load the next image.
im, multilabel = self.batch_loader.load_next_image()
# Add directly to the caffe data layer
top[0].data[it... | [
"def",
"forward",
"(",
"self",
",",
"bottom",
",",
"top",
")",
":",
"for",
"itt",
"in",
"range",
"(",
"self",
".",
"batch_size",
")",
":",
"# Use the batch loader to load the next image.",
"im",
",",
"multilabel",
"=",
"self",
".",
"batch_loader",
".",
"load... | https://github.com/manutdzou/KITTI_SSD/blob/5b620c2f291d36a0fe14489214f22a992f173f44/examples/pycaffe/layers/pascal_multilabel_datalayers.py#L55-L65 | ||
livecode/livecode | 4606a10ea10b16d5071d0f9f263ccdd7ede8b31d | gyp/pylib/gyp/generator/ninja.py | python | NinjaWriter.WriteLink | (self, spec, config_name, config, link_deps) | Write out a link step. Fills out target.binary. | Write out a link step. Fills out target.binary. | [
"Write",
"out",
"a",
"link",
"step",
".",
"Fills",
"out",
"target",
".",
"binary",
"."
] | def WriteLink(self, spec, config_name, config, link_deps):
"""Write out a link step. Fills out target.binary. """
if self.flavor != 'mac' or len(self.archs) == 1:
return self.WriteLinkForArch(
self.ninja, spec, config_name, config, link_deps)
else:
output = self.ComputeOutput(spec)
... | [
"def",
"WriteLink",
"(",
"self",
",",
"spec",
",",
"config_name",
",",
"config",
",",
"link_deps",
")",
":",
"if",
"self",
".",
"flavor",
"!=",
"'mac'",
"or",
"len",
"(",
"self",
".",
"archs",
")",
"==",
"1",
":",
"return",
"self",
".",
"WriteLinkFor... | https://github.com/livecode/livecode/blob/4606a10ea10b16d5071d0f9f263ccdd7ede8b31d/gyp/pylib/gyp/generator/ninja.py#L1049-L1074 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py3/scipy/sparse/linalg/interface.py | python | LinearOperator._rmatvec | (self, x) | Default implementation of _rmatvec; defers to adjoint. | Default implementation of _rmatvec; defers to adjoint. | [
"Default",
"implementation",
"of",
"_rmatvec",
";",
"defers",
"to",
"adjoint",
"."
] | def _rmatvec(self, x):
"""Default implementation of _rmatvec; defers to adjoint."""
if type(self)._adjoint == LinearOperator._adjoint:
# _adjoint not overridden, prevent infinite recursion
raise NotImplementedError
else:
return self.H.matvec(x) | [
"def",
"_rmatvec",
"(",
"self",
",",
"x",
")",
":",
"if",
"type",
"(",
"self",
")",
".",
"_adjoint",
"==",
"LinearOperator",
".",
"_adjoint",
":",
"# _adjoint not overridden, prevent infinite recursion",
"raise",
"NotImplementedError",
"else",
":",
"return",
"self... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py3/scipy/sparse/linalg/interface.py#L285-L291 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/pathlib.py | python | Path.rmdir | (self) | Remove this directory. The directory must be empty. | Remove this directory. The directory must be empty. | [
"Remove",
"this",
"directory",
".",
"The",
"directory",
"must",
"be",
"empty",
"."
] | def rmdir(self):
"""
Remove this directory. The directory must be empty.
"""
if self._closed:
self._raise_closed()
self._accessor.rmdir(self) | [
"def",
"rmdir",
"(",
"self",
")",
":",
"if",
"self",
".",
"_closed",
":",
"self",
".",
"_raise_closed",
"(",
")",
"self",
".",
"_accessor",
".",
"rmdir",
"(",
"self",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/pathlib.py#L1311-L1317 | ||
giuspen/cherrytree | 84712f206478fcf9acf30174009ad28c648c6344 | pygtk2/modules/core.py | python | CherryTree.nodes_expand_all | (self, action) | Expand all Tree Nodes | Expand all Tree Nodes | [
"Expand",
"all",
"Tree",
"Nodes"
] | def nodes_expand_all(self, action):
"""Expand all Tree Nodes"""
self.treeview.expand_all() | [
"def",
"nodes_expand_all",
"(",
"self",
",",
"action",
")",
":",
"self",
".",
"treeview",
".",
"expand_all",
"(",
")"
] | https://github.com/giuspen/cherrytree/blob/84712f206478fcf9acf30174009ad28c648c6344/pygtk2/modules/core.py#L1225-L1227 | ||
eclipse/sumo | 7132a9b8b6eea734bdec38479026b4d8c4336d03 | tools/contributed/sumopy/agilepy/lib_wx/ogleditor.py | python | SelectToolMixin.on_execute_selection | (self, event) | return False | Definively execute operation on currently selected drawobjects. | Definively execute operation on currently selected drawobjects. | [
"Definively",
"execute",
"operation",
"on",
"currently",
"selected",
"drawobjects",
"."
] | def on_execute_selection(self, event):
"""
Definively execute operation on currently selected drawobjects.
"""
self.set_objbrowser()
return False | [
"def",
"on_execute_selection",
"(",
"self",
",",
"event",
")",
":",
"self",
".",
"set_objbrowser",
"(",
")",
"return",
"False"
] | https://github.com/eclipse/sumo/blob/7132a9b8b6eea734bdec38479026b4d8c4336d03/tools/contributed/sumopy/agilepy/lib_wx/ogleditor.py#L399-L405 | |
lammps/lammps | b75c3065430a75b1b5543a10e10f46d9b4c91913 | python/lammps/pylammps.py | python | Atom.charge | (self) | return self.get("q", self.index) | Return the atom charge
:type: float | Return the atom charge | [
"Return",
"the",
"atom",
"charge"
] | def charge(self):
"""
Return the atom charge
:type: float
"""
return self.get("q", self.index) | [
"def",
"charge",
"(",
"self",
")",
":",
"return",
"self",
".",
"get",
"(",
"\"q\"",
",",
"self",
".",
"index",
")"
] | https://github.com/lammps/lammps/blob/b75c3065430a75b1b5543a10e10f46d9b4c91913/python/lammps/pylammps.py#L287-L293 | |
CaoWGG/TensorRT-CenterNet | f949252e37b51e60f873808f46d3683f15735e79 | onnx-tensorrt/third_party/onnx/onnx/utils.py | python | polish_model | (model) | return model | This function combines several useful utility functions together. | This function combines several useful utility functions together. | [
"This",
"function",
"combines",
"several",
"useful",
"utility",
"functions",
"together",
"."
] | def polish_model(model): # type: (ModelProto) -> ModelProto
'''
This function combines several useful utility functions together.
'''
onnx.checker.check_model(model)
onnx.helper.strip_doc_string(model)
model = onnx.shape_inference.infer_shapes(model)
model = onnx.optimizer.optimize(mode... | [
"def",
"polish_model",
"(",
"model",
")",
":",
"# type: (ModelProto) -> ModelProto",
"onnx",
".",
"checker",
".",
"check_model",
"(",
"model",
")",
"onnx",
".",
"helper",
".",
"strip_doc_string",
"(",
"model",
")",
"model",
"=",
"onnx",
".",
"shape_inference",
... | https://github.com/CaoWGG/TensorRT-CenterNet/blob/f949252e37b51e60f873808f46d3683f15735e79/onnx-tensorrt/third_party/onnx/onnx/utils.py#L14-L23 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/_abcoll.py | python | MutableSet.remove | (self, value) | Remove an element. If not a member, raise a KeyError. | Remove an element. If not a member, raise a KeyError. | [
"Remove",
"an",
"element",
".",
"If",
"not",
"a",
"member",
"raise",
"a",
"KeyError",
"."
] | def remove(self, value):
"""Remove an element. If not a member, raise a KeyError."""
if value not in self:
raise KeyError(value)
self.discard(value) | [
"def",
"remove",
"(",
"self",
",",
"value",
")",
":",
"if",
"value",
"not",
"in",
"self",
":",
"raise",
"KeyError",
"(",
"value",
")",
"self",
".",
"discard",
"(",
"value",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/_abcoll.py#L285-L289 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/richtext.py | python | RichTextObject.SetDescent | (*args, **kwargs) | return _richtext.RichTextObject_SetDescent(*args, **kwargs) | SetDescent(self, int descent) | SetDescent(self, int descent) | [
"SetDescent",
"(",
"self",
"int",
"descent",
")"
] | def SetDescent(*args, **kwargs):
"""SetDescent(self, int descent)"""
return _richtext.RichTextObject_SetDescent(*args, **kwargs) | [
"def",
"SetDescent",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"RichTextObject_SetDescent",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/richtext.py#L1362-L1364 | |
Xilinx/Vitis_Libraries | 4bd100518d93a8842d1678046ad7457f94eb355c | hpc/L3/src/sw/mlp/python_api/xfhpc_L3.py | python | XFHPCManager.freeMat | (self, A, idxKernel, idxDevice) | return self._lib.xfhpcFree(A, idxKernel, idxDevice) | free device memory for mat A
Parameters
A: ndarray
matrix in host memory
idxKernel: int
index of kernel to be used
idxDeivce: int
index of local device to be used | free device memory for mat A | [
"free",
"device",
"memory",
"for",
"mat",
"A"
] | def freeMat(self, A, idxKernel, idxDevice):
'''
free device memory for mat A
Parameters
A: ndarray
matrix in host memory
idxKernel: int
index of kernel to be used
idxDeivce: int
index of local device... | [
"def",
"freeMat",
"(",
"self",
",",
"A",
",",
"idxKernel",
",",
"idxDevice",
")",
":",
"return",
"self",
".",
"_lib",
".",
"xfhpcFree",
"(",
"A",
",",
"idxKernel",
",",
"idxDevice",
")"
] | https://github.com/Xilinx/Vitis_Libraries/blob/4bd100518d93a8842d1678046ad7457f94eb355c/hpc/L3/src/sw/mlp/python_api/xfhpc_L3.py#L141-L154 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/idlelib/browser.py | python | ModuleBrowser.__init__ | (self, master, path, *, _htest=False, _utest=False) | Create a window for browsing a module's structure.
Args:
master: parent for widgets.
path: full path of file to browse.
_htest - bool; change box location when running htest.
-utest - bool; suppress contents when running unittest.
Global variables:
... | Create a window for browsing a module's structure. | [
"Create",
"a",
"window",
"for",
"browsing",
"a",
"module",
"s",
"structure",
"."
] | def __init__(self, master, path, *, _htest=False, _utest=False):
"""Create a window for browsing a module's structure.
Args:
master: parent for widgets.
path: full path of file to browse.
_htest - bool; change box location when running htest.
-utest - boo... | [
"def",
"__init__",
"(",
"self",
",",
"master",
",",
"path",
",",
"*",
",",
"_htest",
"=",
"False",
",",
"_utest",
"=",
"False",
")",
":",
"self",
".",
"master",
"=",
"master",
"self",
".",
"path",
"=",
"path",
"self",
".",
"_htest",
"=",
"_htest",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/idlelib/browser.py#L65-L87 | ||
OSGeo/gdal | 3748fc4ba4fba727492774b2b908a2130c864a83 | swig/python/osgeo/gnm.py | python | _swig_add_metaclass | (metaclass) | return wrapper | Class decorator for adding a metaclass to a SWIG wrapped class - a slimmed down version of six.add_metaclass | Class decorator for adding a metaclass to a SWIG wrapped class - a slimmed down version of six.add_metaclass | [
"Class",
"decorator",
"for",
"adding",
"a",
"metaclass",
"to",
"a",
"SWIG",
"wrapped",
"class",
"-",
"a",
"slimmed",
"down",
"version",
"of",
"six",
".",
"add_metaclass"
] | def _swig_add_metaclass(metaclass):
"""Class decorator for adding a metaclass to a SWIG wrapped class - a slimmed down version of six.add_metaclass"""
def wrapper(cls):
return metaclass(cls.__name__, cls.__bases__, cls.__dict__.copy())
return wrapper | [
"def",
"_swig_add_metaclass",
"(",
"metaclass",
")",
":",
"def",
"wrapper",
"(",
"cls",
")",
":",
"return",
"metaclass",
"(",
"cls",
".",
"__name__",
",",
"cls",
".",
"__bases__",
",",
"cls",
".",
"__dict__",
".",
"copy",
"(",
")",
")",
"return",
"wrap... | https://github.com/OSGeo/gdal/blob/3748fc4ba4fba727492774b2b908a2130c864a83/swig/python/osgeo/gnm.py#L52-L56 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/distlib/database.py | python | InstalledDistribution.list_installed_files | (self) | Iterates over the ``RECORD`` entries and returns a tuple
``(path, hash, size)`` for each line.
:returns: iterator of (path, hash, size) | Iterates over the ``RECORD`` entries and returns a tuple
``(path, hash, size)`` for each line. | [
"Iterates",
"over",
"the",
"RECORD",
"entries",
"and",
"returns",
"a",
"tuple",
"(",
"path",
"hash",
"size",
")",
"for",
"each",
"line",
"."
] | def list_installed_files(self):
"""
Iterates over the ``RECORD`` entries and returns a tuple
``(path, hash, size)`` for each line.
:returns: iterator of (path, hash, size)
"""
for result in self._get_records():
yield result | [
"def",
"list_installed_files",
"(",
"self",
")",
":",
"for",
"result",
"in",
"self",
".",
"_get_records",
"(",
")",
":",
"yield",
"result"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/distlib/database.py#L663-L671 | ||
weolar/miniblink49 | 1c4678db0594a4abde23d3ebbcc7cd13c3170777 | third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/mod_pywebsocket/common.py | python | parse_extensions | (data) | return extension_list | Parses Sec-WebSocket-Extensions header value returns a list of
ExtensionParameter objects.
Leading LWSes must be trimmed. | Parses Sec-WebSocket-Extensions header value returns a list of
ExtensionParameter objects. | [
"Parses",
"Sec",
"-",
"WebSocket",
"-",
"Extensions",
"header",
"value",
"returns",
"a",
"list",
"of",
"ExtensionParameter",
"objects",
"."
] | def parse_extensions(data):
"""Parses Sec-WebSocket-Extensions header value returns a list of
ExtensionParameter objects.
Leading LWSes must be trimmed.
"""
state = http_header_util.ParsingState(data)
extension_list = []
while True:
extension = _parse_extension(state)
if e... | [
"def",
"parse_extensions",
"(",
"data",
")",
":",
"state",
"=",
"http_header_util",
".",
"ParsingState",
"(",
"data",
")",
"extension_list",
"=",
"[",
"]",
"while",
"True",
":",
"extension",
"=",
"_parse_extension",
"(",
"state",
")",
"if",
"extension",
"is"... | https://github.com/weolar/miniblink49/blob/1c4678db0594a4abde23d3ebbcc7cd13c3170777/third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/mod_pywebsocket/common.py#L246-L278 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/customtreectrl.py | python | CustomTreeCtrl.UnCheckRadioParent | (self, item, checked=False) | return True | Used internally to handle radio node parent correctly.
:param `item`: an instance of :class:`GenericTreeItem`;
:param bool `checked`: ``True`` to check an item, ``False`` to uncheck it. | Used internally to handle radio node parent correctly. | [
"Used",
"internally",
"to",
"handle",
"radio",
"node",
"parent",
"correctly",
"."
] | def UnCheckRadioParent(self, item, checked=False):
"""
Used internally to handle radio node parent correctly.
:param `item`: an instance of :class:`GenericTreeItem`;
:param bool `checked`: ``True`` to check an item, ``False`` to uncheck it.
"""
e = TreeEvent(wxEVT_TREE_... | [
"def",
"UnCheckRadioParent",
"(",
"self",
",",
"item",
",",
"checked",
"=",
"False",
")",
":",
"e",
"=",
"TreeEvent",
"(",
"wxEVT_TREE_ITEM_CHECKING",
",",
"self",
".",
"GetId",
"(",
")",
")",
"e",
".",
"SetItem",
"(",
"item",
")",
"e",
".",
"SetEventO... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/customtreectrl.py#L3187-L3210 | |
GoSSIP-SJTU/TripleDoggy | 03648d6b19c812504b14e8b98c8c7b3f443f4e54 | tools/clang/bindings/python/clang/cindex.py | python | TranslationUnit.get_file | (self, filename) | return File.from_name(self, filename) | Obtain a File from this translation unit. | Obtain a File from this translation unit. | [
"Obtain",
"a",
"File",
"from",
"this",
"translation",
"unit",
"."
] | def get_file(self, filename):
"""Obtain a File from this translation unit."""
return File.from_name(self, filename) | [
"def",
"get_file",
"(",
"self",
",",
"filename",
")",
":",
"return",
"File",
".",
"from_name",
"(",
"self",
",",
"filename",
")"
] | https://github.com/GoSSIP-SJTU/TripleDoggy/blob/03648d6b19c812504b14e8b98c8c7b3f443f4e54/tools/clang/bindings/python/clang/cindex.py#L2870-L2873 | |
cvxpy/cvxpy | 5165b4fb750dfd237de8659383ef24b4b2e33aaf | cvxpy/atoms/lambda_min.py | python | lambda_min | (X) | return -lambda_max(-X) | Minimum eigenvalue; :math:`\\lambda_{\\min}(A)`. | Minimum eigenvalue; :math:`\\lambda_{\\min}(A)`. | [
"Minimum",
"eigenvalue",
";",
":",
"math",
":",
"\\\\",
"lambda_",
"{",
"\\\\",
"min",
"}",
"(",
"A",
")",
"."
] | def lambda_min(X):
""" Minimum eigenvalue; :math:`\\lambda_{\\min}(A)`.
"""
X = Expression.cast_to_const(X)
return -lambda_max(-X) | [
"def",
"lambda_min",
"(",
"X",
")",
":",
"X",
"=",
"Expression",
".",
"cast_to_const",
"(",
"X",
")",
"return",
"-",
"lambda_max",
"(",
"-",
"X",
")"
] | https://github.com/cvxpy/cvxpy/blob/5165b4fb750dfd237de8659383ef24b4b2e33aaf/cvxpy/atoms/lambda_min.py#L21-L25 | |
D-X-Y/caffe-faster-rcnn | eb50c97ff48f3df115d0e85fe0a32b0c7e2aa4cb | scripts/cpp_lint.py | python | CheckCaffeRandom | (filename, clean_lines, linenum, error) | Checks for calls to C random functions (rand, rand_r, random, ...).
Caffe code should (almost) always use the caffe_rng_* functions rather
than these, as the internal state of these C functions is independent of the
native Caffe RNG system which should produce deterministic results for a
fixed Caffe seed set u... | Checks for calls to C random functions (rand, rand_r, random, ...). | [
"Checks",
"for",
"calls",
"to",
"C",
"random",
"functions",
"(",
"rand",
"rand_r",
"random",
"...",
")",
"."
] | def CheckCaffeRandom(filename, clean_lines, linenum, error):
"""Checks for calls to C random functions (rand, rand_r, random, ...).
Caffe code should (almost) always use the caffe_rng_* functions rather
than these, as the internal state of these C functions is independent of the
native Caffe RNG system which s... | [
"def",
"CheckCaffeRandom",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"for",
"function",
"in",
"c_random_function_list",
":",
"ix",
"=",
"line",
".",
"find",
... | https://github.com/D-X-Y/caffe-faster-rcnn/blob/eb50c97ff48f3df115d0e85fe0a32b0c7e2aa4cb/scripts/cpp_lint.py#L1644-L1667 | ||
vmtk/vmtk | 927331ad752265199390eabbbf2e07cdc2b4bcc6 | vtkVmtk/Utilities/Stellar_1.0/meshconvert.py | python | unique | (s) | return u | Return a list of the elements in s, but without duplicates.
For example, unique([1,2,3,1,2,3]) is some permutation of [1,2,3],
unique("abcabc") some permutation of ["a", "b", "c"], and
unique(([1, 2], [2, 3], [1, 2])) some permutation of
[[2, 3], [1, 2]].
For best speed, all sequence elements shou... | Return a list of the elements in s, but without duplicates. | [
"Return",
"a",
"list",
"of",
"the",
"elements",
"in",
"s",
"but",
"without",
"duplicates",
"."
] | def unique(s):
"""Return a list of the elements in s, but without duplicates.
For example, unique([1,2,3,1,2,3]) is some permutation of [1,2,3],
unique("abcabc") some permutation of ["a", "b", "c"], and
unique(([1, 2], [2, 3], [1, 2])) some permutation of
[[2, 3], [1, 2]].
For best speed, all ... | [
"def",
"unique",
"(",
"s",
")",
":",
"n",
"=",
"len",
"(",
"s",
")",
"if",
"n",
"==",
"0",
":",
"return",
"[",
"]",
"# Try using a dict first, as that's the fastest and will usually",
"# work. If it doesn't work, it will usually fail quickly, so it",
"# usually doesn't c... | https://github.com/vmtk/vmtk/blob/927331ad752265199390eabbbf2e07cdc2b4bcc6/vtkVmtk/Utilities/Stellar_1.0/meshconvert.py#L834-L900 | |
google/llvm-propeller | 45c226984fe8377ebfb2ad7713c680d652ba678d | clang/bindings/python/clang/cindex.py | python | Cursor.get_usr | (self) | return conf.lib.clang_getCursorUSR(self) | Return the Unified Symbol Resolution (USR) for the entity referenced
by the given cursor (or None).
A Unified Symbol Resolution (USR) is a string that identifies a
particular entity (function, class, variable, etc.) within a
program. USRs can be compared across translation units to dete... | Return the Unified Symbol Resolution (USR) for the entity referenced
by the given cursor (or None). | [
"Return",
"the",
"Unified",
"Symbol",
"Resolution",
"(",
"USR",
")",
"for",
"the",
"entity",
"referenced",
"by",
"the",
"given",
"cursor",
"(",
"or",
"None",
")",
"."
] | def get_usr(self):
"""Return the Unified Symbol Resolution (USR) for the entity referenced
by the given cursor (or None).
A Unified Symbol Resolution (USR) is a string that identifies a
particular entity (function, class, variable, etc.) within a
program. USRs can be compared ac... | [
"def",
"get_usr",
"(",
"self",
")",
":",
"return",
"conf",
".",
"lib",
".",
"clang_getCursorUSR",
"(",
"self",
")"
] | https://github.com/google/llvm-propeller/blob/45c226984fe8377ebfb2ad7713c680d652ba678d/clang/bindings/python/clang/cindex.py#L1521-L1530 | |
fifengine/fifengine | 4b62c42e85bec19893cef8e63e6855927cff2c47 | engine/python/fife/extensions/serializers/simplexml.py | python | SimpleXMLSerializer._validateTree | (self) | Iterates the XML tree and prints warning when an invalid tag is found.
Raises an InvalidFormat exception if there is a format error. | Iterates the XML tree and prints warning when an invalid tag is found.
Raises an InvalidFormat exception if there is a format error. | [
"Iterates",
"the",
"XML",
"tree",
"and",
"prints",
"warning",
"when",
"an",
"invalid",
"tag",
"is",
"found",
".",
"Raises",
"an",
"InvalidFormat",
"exception",
"if",
"there",
"is",
"a",
"format",
"error",
"."
] | def _validateTree(self):
"""
Iterates the XML tree and prints warning when an invalid tag is found.
Raises an InvalidFormat exception if there is a format error.
"""
for c in self._root_element:
if c.tag != "Module":
raise InvalidFormat("Invalid tag in " + self._file + \
". Expected Module... | [
"def",
"_validateTree",
"(",
"self",
")",
":",
"for",
"c",
"in",
"self",
".",
"_root_element",
":",
"if",
"c",
".",
"tag",
"!=",
"\"Module\"",
":",
"raise",
"InvalidFormat",
"(",
"\"Invalid tag in \"",
"+",
"self",
".",
"_file",
"+",
"\". Expected Module, go... | https://github.com/fifengine/fifengine/blob/4b62c42e85bec19893cef8e63e6855927cff2c47/engine/python/fife/extensions/serializers/simplexml.py#L380-L403 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py2/numpy/core/defchararray.py | python | find | (a, sub, start=0, end=None) | return _vec_string(
a, integer, 'find', [sub, start] + _clean_args(end)) | For each element, return the lowest index in the string where
substring `sub` is found.
Calls `str.find` element-wise.
For each element, return the lowest index in the string where
substring `sub` is found, such that `sub` is contained in the
range [`start`, `end`].
Parameters
----------
... | For each element, return the lowest index in the string where
substring `sub` is found. | [
"For",
"each",
"element",
"return",
"the",
"lowest",
"index",
"in",
"the",
"string",
"where",
"substring",
"sub",
"is",
"found",
"."
] | def find(a, sub, start=0, end=None):
"""
For each element, return the lowest index in the string where
substring `sub` is found.
Calls `str.find` element-wise.
For each element, return the lowest index in the string where
substring `sub` is found, such that `sub` is contained in the
range ... | [
"def",
"find",
"(",
"a",
",",
"sub",
",",
"start",
"=",
"0",
",",
"end",
"=",
"None",
")",
":",
"return",
"_vec_string",
"(",
"a",
",",
"integer",
",",
"'find'",
",",
"[",
"sub",
",",
"start",
"]",
"+",
"_clean_args",
"(",
"end",
")",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py2/numpy/core/defchararray.py#L693-L725 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/ops/dispatch.py | python | should_extension_dispatch | (left: ABCSeries, right: Any) | return False | Identify cases where Series operation should use dispatch_to_extension_op.
Parameters
----------
left : Series
right : object
Returns
-------
bool | Identify cases where Series operation should use dispatch_to_extension_op. | [
"Identify",
"cases",
"where",
"Series",
"operation",
"should",
"use",
"dispatch_to_extension_op",
"."
] | def should_extension_dispatch(left: ABCSeries, right: Any) -> bool:
"""
Identify cases where Series operation should use dispatch_to_extension_op.
Parameters
----------
left : Series
right : object
Returns
-------
bool
"""
if (
is_extension_array_dtype(left.dtype)
... | [
"def",
"should_extension_dispatch",
"(",
"left",
":",
"ABCSeries",
",",
"right",
":",
"Any",
")",
"->",
"bool",
":",
"if",
"(",
"is_extension_array_dtype",
"(",
"left",
".",
"dtype",
")",
"or",
"is_datetime64_dtype",
"(",
"left",
".",
"dtype",
")",
"or",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/ops/dispatch.py#L21-L45 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/types.py | python | resolve_bases | (bases) | return tuple(new_bases) | Resolve MRO entries dynamically as specified by PEP 560. | Resolve MRO entries dynamically as specified by PEP 560. | [
"Resolve",
"MRO",
"entries",
"dynamically",
"as",
"specified",
"by",
"PEP",
"560",
"."
] | def resolve_bases(bases):
"""Resolve MRO entries dynamically as specified by PEP 560."""
new_bases = list(bases)
updated = False
shift = 0
for i, base in enumerate(bases):
if isinstance(base, type):
continue
if not hasattr(base, "__mro_entries__"):
continue
... | [
"def",
"resolve_bases",
"(",
"bases",
")",
":",
"new_bases",
"=",
"list",
"(",
"bases",
")",
"updated",
"=",
"False",
"shift",
"=",
"0",
"for",
"i",
",",
"base",
"in",
"enumerate",
"(",
"bases",
")",
":",
"if",
"isinstance",
"(",
"base",
",",
"type",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/types.py#L72-L91 | |
bitcoin-sv/bitcoin-sv | 98064703540dc085bdee53408ff10644f4b8fe28 | contrib/devtools/security-check.py | python | check_ELF_RELRO | (executable) | return have_gnu_relro and have_bindnow | Check for read-only relocations.
GNU_RELRO program header must exist
Dynamic section must have BIND_NOW flag | Check for read-only relocations.
GNU_RELRO program header must exist
Dynamic section must have BIND_NOW flag | [
"Check",
"for",
"read",
"-",
"only",
"relocations",
".",
"GNU_RELRO",
"program",
"header",
"must",
"exist",
"Dynamic",
"section",
"must",
"have",
"BIND_NOW",
"flag"
] | def check_ELF_RELRO(executable):
'''
Check for read-only relocations.
GNU_RELRO program header must exist
Dynamic section must have BIND_NOW flag
'''
have_gnu_relro = False
for (typ, flags) in get_ELF_program_headers(executable):
# Note: not checking flags == 'R': here as linkers set... | [
"def",
"check_ELF_RELRO",
"(",
"executable",
")",
":",
"have_gnu_relro",
"=",
"False",
"for",
"(",
"typ",
",",
"flags",
")",
"in",
"get_ELF_program_headers",
"(",
"executable",
")",
":",
"# Note: not checking flags == 'R': here as linkers set the permission differently",
... | https://github.com/bitcoin-sv/bitcoin-sv/blob/98064703540dc085bdee53408ff10644f4b8fe28/contrib/devtools/security-check.py#L85-L111 | |
microsoft/ivy | 9f3c7ecc0b2383129fdd0953e10890d98d09a82d | ivy/ivy_logic_utils.py | python | apply_gen_to_clauses | (gen) | return lambda cls,*args: cls.gen(gen,*args) if isinstance(cls,Clauses) else gen(cls,*args) | return a function that returns a generator that applies a generator to a Clauses | return a function that returns a generator that applies a generator to a Clauses | [
"return",
"a",
"function",
"that",
"returns",
"a",
"generator",
"that",
"applies",
"a",
"generator",
"to",
"a",
"Clauses"
] | def apply_gen_to_clauses(gen):
""" return a function that returns a generator that applies a generator to a Clauses """
return lambda cls,*args: cls.gen(gen,*args) if isinstance(cls,Clauses) else gen(cls,*args) | [
"def",
"apply_gen_to_clauses",
"(",
"gen",
")",
":",
"return",
"lambda",
"cls",
",",
"*",
"args",
":",
"cls",
".",
"gen",
"(",
"gen",
",",
"*",
"args",
")",
"if",
"isinstance",
"(",
"cls",
",",
"Clauses",
")",
"else",
"gen",
"(",
"cls",
",",
"*",
... | https://github.com/microsoft/ivy/blob/9f3c7ecc0b2383129fdd0953e10890d98d09a82d/ivy/ivy_logic_utils.py#L129-L131 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/_config/config.py | python | _translate_key | (key) | if key id deprecated and a replacement key defined, will return the
replacement key, otherwise returns `key` as - is | if key id deprecated and a replacement key defined, will return the
replacement key, otherwise returns `key` as - is | [
"if",
"key",
"id",
"deprecated",
"and",
"a",
"replacement",
"key",
"defined",
"will",
"return",
"the",
"replacement",
"key",
"otherwise",
"returns",
"key",
"as",
"-",
"is"
] | def _translate_key(key):
"""
if key id deprecated and a replacement key defined, will return the
replacement key, otherwise returns `key` as - is
"""
d = _get_deprecated_option(key)
if d:
return d.rkey or key
else:
return key | [
"def",
"_translate_key",
"(",
"key",
")",
":",
"d",
"=",
"_get_deprecated_option",
"(",
"key",
")",
"if",
"d",
":",
"return",
"d",
".",
"rkey",
"or",
"key",
"else",
":",
"return",
"key"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/_config/config.py#L594-L604 | ||
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/python/lib/io/file_io.py | python | FileIO.readline | (self) | return compat.as_str_any(self._read_buf.ReadLineAsString()) | r"""Reads the next line from the file. Leaves the '\n' at the end. | r"""Reads the next line from the file. Leaves the '\n' at the end. | [
"r",
"Reads",
"the",
"next",
"line",
"from",
"the",
"file",
".",
"Leaves",
"the",
"\\",
"n",
"at",
"the",
"end",
"."
] | def readline(self):
r"""Reads the next line from the file. Leaves the '\n' at the end."""
self._preread_check()
return compat.as_str_any(self._read_buf.ReadLineAsString()) | [
"def",
"readline",
"(",
"self",
")",
":",
"self",
".",
"_preread_check",
"(",
")",
"return",
"compat",
".",
"as_str_any",
"(",
"self",
".",
"_read_buf",
".",
"ReadLineAsString",
"(",
")",
")"
] | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/lib/io/file_io.py#L119-L122 | |
CRYTEK/CRYENGINE | 232227c59a220cbbd311576f0fbeba7bb53b2a8c | Editor/Python/windows/Lib/site-packages/setuptools/ssl_support.py | python | find_ca_bundle | () | return (
get_win_certfile()
or next(extant_cert_paths, None)
or _certifi_where()
) | Return an existing CA bundle path, or None | Return an existing CA bundle path, or None | [
"Return",
"an",
"existing",
"CA",
"bundle",
"path",
"or",
"None"
] | def find_ca_bundle():
"""Return an existing CA bundle path, or None"""
extant_cert_paths = filter(os.path.isfile, cert_paths)
return (
get_win_certfile()
or next(extant_cert_paths, None)
or _certifi_where()
) | [
"def",
"find_ca_bundle",
"(",
")",
":",
"extant_cert_paths",
"=",
"filter",
"(",
"os",
".",
"path",
".",
"isfile",
",",
"cert_paths",
")",
"return",
"(",
"get_win_certfile",
"(",
")",
"or",
"next",
"(",
"extant_cert_paths",
",",
"None",
")",
"or",
"_certif... | https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Editor/Python/windows/Lib/site-packages/setuptools/ssl_support.py#L246-L253 | |
cms-sw/cmssw | fd9de012d503d3405420bcbeec0ec879baa57cf2 | HLTrigger/Tools/python/rrapi.py | python | RRApi.report | (self, workspace, report) | return self.get([workspace, report, "data"]) | Get report data (USER app only) | Get report data (USER app only) | [
"Get",
"report",
"data",
"(",
"USER",
"app",
"only",
")"
] | def report(self, workspace, report):
"""
Get report data (USER app only)
"""
if self.app != "user":
raise RRApiError("Reports available only in user app")
return self.get([workspace, report, "data"]) | [
"def",
"report",
"(",
"self",
",",
"workspace",
",",
"report",
")",
":",
"if",
"self",
".",
"app",
"!=",
"\"user\"",
":",
"raise",
"RRApiError",
"(",
"\"Reports available only in user app\"",
")",
"return",
"self",
".",
"get",
"(",
"[",
"workspace",
",",
"... | https://github.com/cms-sw/cmssw/blob/fd9de012d503d3405420bcbeec0ec879baa57cf2/HLTrigger/Tools/python/rrapi.py#L233-L239 | |
LiquidPlayer/LiquidCore | 9405979363f2353ac9a71ad8ab59685dd7f919c9 | deps/node-10.15.3/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py | python | MsvsSettings.GetArch | (self, config) | return {'Win32': 'x86', 'x64': 'x64'}.get(platform, 'x86') | Get architecture based on msvs_configuration_platform and
msvs_target_platform. Returns either 'x86' or 'x64'. | Get architecture based on msvs_configuration_platform and
msvs_target_platform. Returns either 'x86' or 'x64'. | [
"Get",
"architecture",
"based",
"on",
"msvs_configuration_platform",
"and",
"msvs_target_platform",
".",
"Returns",
"either",
"x86",
"or",
"x64",
"."
] | def GetArch(self, config):
"""Get architecture based on msvs_configuration_platform and
msvs_target_platform. Returns either 'x86' or 'x64'."""
configuration_platform = self.msvs_configuration_platform.get(config, '')
platform = self.msvs_target_platform.get(config, '')
if not platform: # If no spec... | [
"def",
"GetArch",
"(",
"self",
",",
"config",
")",
":",
"configuration_platform",
"=",
"self",
".",
"msvs_configuration_platform",
".",
"get",
"(",
"config",
",",
"''",
")",
"platform",
"=",
"self",
".",
"msvs_target_platform",
".",
"get",
"(",
"config",
","... | https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/node-10.15.3/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py#L294-L302 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/distribute/coordinator/cluster_coordinator.py | python | _maybe_get_remote_value | (val) | Gets the value of `val` if it is a `RemoteValue`. | Gets the value of `val` if it is a `RemoteValue`. | [
"Gets",
"the",
"value",
"of",
"val",
"if",
"it",
"is",
"a",
"RemoteValue",
"."
] | def _maybe_get_remote_value(val):
"""Gets the value of `val` if it is a `RemoteValue`."""
if isinstance(val, RemoteValue):
error = val._get_error() # pylint: disable=protected-access
if error:
raise AssertionError(
"RemoteValue doesn't have a value because it has errors.")
else:
r... | [
"def",
"_maybe_get_remote_value",
"(",
"val",
")",
":",
"if",
"isinstance",
"(",
"val",
",",
"RemoteValue",
")",
":",
"error",
"=",
"val",
".",
"_get_error",
"(",
")",
"# pylint: disable=protected-access",
"if",
"error",
":",
"raise",
"AssertionError",
"(",
"\... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/distribute/coordinator/cluster_coordinator.py#L111-L121 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_controls.py | python | TextAttr.GetFont | (*args, **kwargs) | return _controls_.TextAttr_GetFont(*args, **kwargs) | GetFont(self) -> Font | GetFont(self) -> Font | [
"GetFont",
"(",
"self",
")",
"-",
">",
"Font"
] | def GetFont(*args, **kwargs):
"""GetFont(self) -> Font"""
return _controls_.TextAttr_GetFont(*args, **kwargs) | [
"def",
"GetFont",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"TextAttr_GetFont",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_controls.py#L1703-L1705 | |
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/python/which/build.py | python | _getTargets | () | return targets | Find all targets and return a dict of targetName:targetFunc items. | Find all targets and return a dict of targetName:targetFunc items. | [
"Find",
"all",
"targets",
"and",
"return",
"a",
"dict",
"of",
"targetName",
":",
"targetFunc",
"items",
"."
] | def _getTargets():
"""Find all targets and return a dict of targetName:targetFunc items."""
targets = {}
for name, attr in sys.modules[__name__].__dict__.items():
if name.startswith('target_'):
targets[ name[len('target_'):] ] = attr
return targets | [
"def",
"_getTargets",
"(",
")",
":",
"targets",
"=",
"{",
"}",
"for",
"name",
",",
"attr",
"in",
"sys",
".",
"modules",
"[",
"__name__",
"]",
".",
"__dict__",
".",
"items",
"(",
")",
":",
"if",
"name",
".",
"startswith",
"(",
"'target_'",
")",
":",... | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/python/which/build.py#L179-L185 | |
SFTtech/openage | d6a08c53c48dc1e157807471df92197f6ca9e04d | openage/convert/entity_object/conversion/aoc/genie_unit.py | python | GenieStackBuildingGroup.__init__ | (self, stack_unit_id, head_building_id, full_data_set) | Creates a new Genie building line.
:param stack_unit_id: "Actual" building that appears when constructed.
:param head_building_id: The building used during construction.
:param full_data_set: GenieObjectContainer instance that
contains all relevant data for the con... | Creates a new Genie building line. | [
"Creates",
"a",
"new",
"Genie",
"building",
"line",
"."
] | def __init__(self, stack_unit_id, head_building_id, full_data_set):
"""
Creates a new Genie building line.
:param stack_unit_id: "Actual" building that appears when constructed.
:param head_building_id: The building used during construction.
:param full_data_set: GenieObjectCont... | [
"def",
"__init__",
"(",
"self",
",",
"stack_unit_id",
",",
"head_building_id",
",",
"full_data_set",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"stack_unit_id",
",",
"full_data_set",
")",
"self",
".",
"head",
"=",
"self",
".",
"data",
".",
"genie_u... | https://github.com/SFTtech/openage/blob/d6a08c53c48dc1e157807471df92197f6ca9e04d/openage/convert/entity_object/conversion/aoc/genie_unit.py#L711-L724 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/spatial/distance.py | python | num_obs_y | (Y) | return d | Return the number of original observations that correspond to a
condensed distance matrix.
Parameters
----------
Y : ndarray
Condensed distance matrix.
Returns
-------
n : int
The number of observations in the condensed distance matrix `Y`. | Return the number of original observations that correspond to a
condensed distance matrix. | [
"Return",
"the",
"number",
"of",
"original",
"observations",
"that",
"correspond",
"to",
"a",
"condensed",
"distance",
"matrix",
"."
] | def num_obs_y(Y):
"""
Return the number of original observations that correspond to a
condensed distance matrix.
Parameters
----------
Y : ndarray
Condensed distance matrix.
Returns
-------
n : int
The number of observations in the condensed distance matrix `Y`.
... | [
"def",
"num_obs_y",
"(",
"Y",
")",
":",
"Y",
"=",
"np",
".",
"asarray",
"(",
"Y",
",",
"order",
"=",
"'c'",
")",
"is_valid_y",
"(",
"Y",
",",
"throw",
"=",
"True",
",",
"name",
"=",
"'Y'",
")",
"k",
"=",
"Y",
".",
"shape",
"[",
"0",
"]",
"i... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/spatial/distance.py#L2364-L2390 | |
potassco/clingo | e0c91d8f95cc28de1c480a871f9c97c30de83d40 | libpyclingo/clingo/theory.py | python | Theory.register_options | (self, options: ApplicationOptions) | Register the theory's options with the given application options
object.
Arguments
---------
options
Target to register with. | Register the theory's options with the given application options
object. | [
"Register",
"the",
"theory",
"s",
"options",
"with",
"the",
"given",
"application",
"options",
"object",
"."
] | def register_options(self, options: ApplicationOptions) -> None:
'''
Register the theory's options with the given application options
object.
Arguments
---------
options
Target to register with.
'''
self.__call0('register_options', self._theor... | [
"def",
"register_options",
"(",
"self",
",",
"options",
":",
"ApplicationOptions",
")",
"->",
"None",
":",
"self",
".",
"__call0",
"(",
"'register_options'",
",",
"self",
".",
"_theory",
",",
"self",
".",
"_ffi",
".",
"cast",
"(",
"'clingo_options_t*'",
",",... | https://github.com/potassco/clingo/blob/e0c91d8f95cc28de1c480a871f9c97c30de83d40/libpyclingo/clingo/theory.py#L254-L264 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_internal/vcs/versioncontrol.py | python | VersionControl.unpack | (self, location, url) | Clean up current location and download the url repository
(and vcs infos) into location
:param url: the repository URL starting with a vcs prefix. | Clean up current location and download the url repository
(and vcs infos) into location | [
"Clean",
"up",
"current",
"location",
"and",
"download",
"the",
"url",
"repository",
"(",
"and",
"vcs",
"infos",
")",
"into",
"location"
] | def unpack(self, location, url):
# type: (str, HiddenText) -> None
"""
Clean up current location and download the url repository
(and vcs infos) into location
:param url: the repository URL starting with a vcs prefix.
"""
if os.path.exists(location):
... | [
"def",
"unpack",
"(",
"self",
",",
"location",
",",
"url",
")",
":",
"# type: (str, HiddenText) -> None",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"location",
")",
":",
"rmtree",
"(",
"location",
")",
"self",
".",
"obtain",
"(",
"location",
",",
"url... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_internal/vcs/versioncontrol.py#L627-L637 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/plotting/_misc.py | python | radviz | (frame, class_column, ax=None, color=None, colormap=None, **kwds) | return plot_backend.radviz(
frame=frame,
class_column=class_column,
ax=ax,
color=color,
colormap=colormap,
**kwds,
) | Plot a multidimensional dataset in 2D.
Each Series in the DataFrame is represented as a evenly distributed
slice on a circle. Each data point is rendered in the circle according to
the value on each Series. Highly correlated `Series` in the `DataFrame`
are placed closer on the unit circle.
RadViz ... | Plot a multidimensional dataset in 2D. | [
"Plot",
"a",
"multidimensional",
"dataset",
"in",
"2D",
"."
] | def radviz(frame, class_column, ax=None, color=None, colormap=None, **kwds):
"""
Plot a multidimensional dataset in 2D.
Each Series in the DataFrame is represented as a evenly distributed
slice on a circle. Each data point is rendered in the circle according to
the value on each Series. Highly corr... | [
"def",
"radviz",
"(",
"frame",
",",
"class_column",
",",
"ax",
"=",
"None",
",",
"color",
"=",
"None",
",",
"colormap",
"=",
"None",
",",
"*",
"*",
"kwds",
")",
":",
"plot_backend",
"=",
"_get_plot_backend",
"(",
"\"matplotlib\"",
")",
"return",
"plot_ba... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/plotting/_misc.py#L138-L208 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/AWSPythonSDK/1.5.8/docutils/writers/latex2e/__init__.py | python | LaTeXTranslator.stylesheet_call | (self, path) | return cmd % path | Return code to reference or embed stylesheet file `path` | Return code to reference or embed stylesheet file `path` | [
"Return",
"code",
"to",
"reference",
"or",
"embed",
"stylesheet",
"file",
"path"
] | def stylesheet_call(self, path):
"""Return code to reference or embed stylesheet file `path`"""
# is it a package (no extension or *.sty) or "normal" tex code:
(base, ext) = os.path.splitext(path)
is_package = ext in ['.sty', '']
# Embed content of style file:
if self.set... | [
"def",
"stylesheet_call",
"(",
"self",
",",
"path",
")",
":",
"# is it a package (no extension or *.sty) or \"normal\" tex code:",
"(",
"base",
",",
"ext",
")",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"path",
")",
"is_package",
"=",
"ext",
"in",
"[",
"'.... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/docutils/writers/latex2e/__init__.py#L1403-L1435 | |
PX4/PX4-Autopilot | 0b9f60a0370be53d683352c63fd92db3d6586e18 | platforms/nuttx/NuttX/tools/kconfiglib.py | python | split_expr | (expr, op) | return res | Returns a list containing the top-level AND or OR operands in the
expression 'expr', in the same (left-to-right) order as they appear in
the expression.
This can be handy e.g. for splitting (weak) reverse dependencies
from 'select' and 'imply' into individual selects/implies.
op:
Either AND ... | Returns a list containing the top-level AND or OR operands in the
expression 'expr', in the same (left-to-right) order as they appear in
the expression. | [
"Returns",
"a",
"list",
"containing",
"the",
"top",
"-",
"level",
"AND",
"or",
"OR",
"operands",
"in",
"the",
"expression",
"expr",
"in",
"the",
"same",
"(",
"left",
"-",
"to",
"-",
"right",
")",
"order",
"as",
"they",
"appear",
"in",
"the",
"expressio... | def split_expr(expr, op):
"""
Returns a list containing the top-level AND or OR operands in the
expression 'expr', in the same (left-to-right) order as they appear in
the expression.
This can be handy e.g. for splitting (weak) reverse dependencies
from 'select' and 'imply' into individual selec... | [
"def",
"split_expr",
"(",
"expr",
",",
"op",
")",
":",
"res",
"=",
"[",
"]",
"def",
"rec",
"(",
"subexpr",
")",
":",
"if",
"subexpr",
".",
"__class__",
"is",
"tuple",
"and",
"subexpr",
"[",
"0",
"]",
"is",
"op",
":",
"rec",
"(",
"subexpr",
"[",
... | https://github.com/PX4/PX4-Autopilot/blob/0b9f60a0370be53d683352c63fd92db3d6586e18/platforms/nuttx/NuttX/tools/kconfiglib.py#L5631-L5673 | |
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | chrome/tools/build/version.py | python | subst_file | (file_name, values) | return subst_template(template, values) | Returns the contents of the specified file_name with substited
values from the specified dictionary.
This is like subst_template, except it operates on a file. | Returns the contents of the specified file_name with substited
values from the specified dictionary. | [
"Returns",
"the",
"contents",
"of",
"the",
"specified",
"file_name",
"with",
"substited",
"values",
"from",
"the",
"specified",
"dictionary",
"."
] | def subst_file(file_name, values):
"""
Returns the contents of the specified file_name with substited
values from the specified dictionary.
This is like subst_template, except it operates on a file.
"""
template = open(file_name, 'r').read()
return subst_template(template, values); | [
"def",
"subst_file",
"(",
"file_name",
",",
"values",
")",
":",
"template",
"=",
"open",
"(",
"file_name",
",",
"'r'",
")",
".",
"read",
"(",
")",
"return",
"subst_template",
"(",
"template",
",",
"values",
")"
] | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/chrome/tools/build/version.py#L80-L88 | |
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | python/mxnet/ndarray/ndarray.py | python | NDArray.asnumpy | (self) | return data | Returns a ``numpy.ndarray`` object with value copied from this array.
Examples
--------
>>> x = mx.nd.ones((2,3))
>>> y = x.asnumpy()
>>> type(y)
<type 'numpy.ndarray'>
>>> y
array([[ 1., 1., 1.],
[ 1., 1., 1.]], dtype=float32)
... | Returns a ``numpy.ndarray`` object with value copied from this array. | [
"Returns",
"a",
"numpy",
".",
"ndarray",
"object",
"with",
"value",
"copied",
"from",
"this",
"array",
"."
] | def asnumpy(self):
"""Returns a ``numpy.ndarray`` object with value copied from this array.
Examples
--------
>>> x = mx.nd.ones((2,3))
>>> y = x.asnumpy()
>>> type(y)
<type 'numpy.ndarray'>
>>> y
array([[ 1., 1., 1.],
[ 1., 1., ... | [
"def",
"asnumpy",
"(",
"self",
")",
":",
"data",
"=",
"np",
".",
"empty",
"(",
"self",
".",
"shape",
",",
"dtype",
"=",
"self",
".",
"dtype",
")",
"check_call",
"(",
"_LIB",
".",
"MXNDArraySyncCopyToCPU",
"(",
"self",
".",
"handle",
",",
"data",
".",... | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/python/mxnet/ndarray/ndarray.py#L1999-L2021 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/src/robotsim.py | python | GeometricPrimitive.loadString | (self, str: "char const *") | return _robotsim.GeometricPrimitive_loadString(self, str) | r"""
loadString(GeometricPrimitive self, char const * str) -> bool | r"""
loadString(GeometricPrimitive self, char const * str) -> bool | [
"r",
"loadString",
"(",
"GeometricPrimitive",
"self",
"char",
"const",
"*",
"str",
")",
"-",
">",
"bool"
] | def loadString(self, str: "char const *") -> "bool":
r"""
loadString(GeometricPrimitive self, char const * str) -> bool
"""
return _robotsim.GeometricPrimitive_loadString(self, str) | [
"def",
"loadString",
"(",
"self",
",",
"str",
":",
"\"char const *\"",
")",
"->",
"\"bool\"",
":",
"return",
"_robotsim",
".",
"GeometricPrimitive_loadString",
"(",
"self",
",",
"str",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/src/robotsim.py#L1652-L1658 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/tools/quantization/quantize_graph.py | python | GraphRewriter.eightbitize_single_input_tensor_node | (self, original_node,
add_op_function) | Replaces a single-tensor node with the eight bit equivalent sub-graph.
Converts a node like this:
Shape(f) Input(f)
| |
+--------v v
Operation
|
v
(f)
Into a quantized equivalent:
... | Replaces a single-tensor node with the eight bit equivalent sub-graph. | [
"Replaces",
"a",
"single",
"-",
"tensor",
"node",
"with",
"the",
"eight",
"bit",
"equivalent",
"sub",
"-",
"graph",
"."
] | def eightbitize_single_input_tensor_node(self, original_node,
add_op_function):
"""Replaces a single-tensor node with the eight bit equivalent sub-graph.
Converts a node like this:
Shape(f) Input(f)
| |
+--------v v
... | [
"def",
"eightbitize_single_input_tensor_node",
"(",
"self",
",",
"original_node",
",",
"add_op_function",
")",
":",
"quantized_op_name",
"=",
"original_node",
".",
"name",
"+",
"\"_eightbit_quantized\"",
"quantized_op_type",
"=",
"\"Quantized\"",
"+",
"original_node",
"."... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/tools/quantization/quantize_graph.py#L830-L884 | ||
facebook/watchman | 0917460c71b000b96be9b9575d77f06f2f6053bb | build/fbcode_builder/getdeps/dyndeps.py | python | WinDeps.compute_dependency_paths | (self, build_dir) | return sorted(dep_dirs) | Return a list of all directories that need to be added to $PATH to ensure
that library dependencies can be found correctly. This is computed by scanning
binaries to determine exactly the right list of dependencies.
The compute_dependency_paths_fast() is a alternative function that runs faster
... | Return a list of all directories that need to be added to $PATH to ensure
that library dependencies can be found correctly. This is computed by scanning
binaries to determine exactly the right list of dependencies. | [
"Return",
"a",
"list",
"of",
"all",
"directories",
"that",
"need",
"to",
"be",
"added",
"to",
"$PATH",
"to",
"ensure",
"that",
"library",
"dependencies",
"can",
"be",
"found",
"correctly",
".",
"This",
"is",
"computed",
"by",
"scanning",
"binaries",
"to",
... | def compute_dependency_paths(self, build_dir):
"""Return a list of all directories that need to be added to $PATH to ensure
that library dependencies can be found correctly. This is computed by scanning
binaries to determine exactly the right list of dependencies.
The compute_dependenc... | [
"def",
"compute_dependency_paths",
"(",
"self",
",",
"build_dir",
")",
":",
"dep_dirs",
"=",
"set",
"(",
")",
"# Find paths by scanning the binaries.",
"for",
"dep",
"in",
"self",
".",
"find_all_dependencies",
"(",
"build_dir",
")",
":",
"dep_dirs",
".",
"add",
... | https://github.com/facebook/watchman/blob/0917460c71b000b96be9b9575d77f06f2f6053bb/build/fbcode_builder/getdeps/dyndeps.py#L250-L264 | |
JumpingYang001/webrtc | c03d6e965e1f54aeadd670e491eabe5fdb8db968 | PRESUBMIT.py | python | CheckChangeHasBugField | (input_api, output_api) | Requires that the changelist is associated with a bug.
This check is stricter than the one in depot_tools/presubmit_canned_checks.py
since it fails the presubmit if the bug field is missing or doesn't contain
a bug reference.
This supports both 'BUG=' and 'Bug:' since we are in the process of migrating
to G... | Requires that the changelist is associated with a bug. | [
"Requires",
"that",
"the",
"changelist",
"is",
"associated",
"with",
"a",
"bug",
"."
] | def CheckChangeHasBugField(input_api, output_api):
"""Requires that the changelist is associated with a bug.
This check is stricter than the one in depot_tools/presubmit_canned_checks.py
since it fails the presubmit if the bug field is missing or doesn't contain
a bug reference.
This supports both 'BUG=' ... | [
"def",
"CheckChangeHasBugField",
"(",
"input_api",
",",
"output_api",
")",
":",
"if",
"input_api",
".",
"change",
".",
"BugsFromDescription",
"(",
")",
":",
"return",
"[",
"]",
"else",
":",
"return",
"[",
"output_api",
".",
"PresubmitError",
"(",
"'The \"Bug: ... | https://github.com/JumpingYang001/webrtc/blob/c03d6e965e1f54aeadd670e491eabe5fdb8db968/PRESUBMIT.py#L775-L795 | ||
bioglaze/aether3d | 6e782f06d5ac9f87ee18c04d417d0dc747228b85 | Tools/io_export_aether3d.py | python | Aether3DExporter.writeFile | ( self, context, FilePath ) | Writes selected meshes to .ae3d file. | Writes selected meshes to .ae3d file. | [
"Writes",
"selected",
"meshes",
"to",
".",
"ae3d",
"file",
"."
] | def writeFile( self, context, FilePath ):
"""Writes selected meshes to .ae3d file."""
f = open( FilePath, "wb" )
# Writes header.
data1 = struct.pack( 'b', 97 ) # 'a'
data2 = struct.pack( 'b', 57 ) # '9'
f.write( data1 )
f.write( data2 )
... | [
"def",
"writeFile",
"(",
"self",
",",
"context",
",",
"FilePath",
")",
":",
"f",
"=",
"open",
"(",
"FilePath",
",",
"\"wb\"",
")",
"# Writes header.",
"data1",
"=",
"struct",
".",
"pack",
"(",
"'b'",
",",
"97",
")",
"# 'a'",
"data2",
"=",
"struct",
"... | https://github.com/bioglaze/aether3d/blob/6e782f06d5ac9f87ee18c04d417d0dc747228b85/Tools/io_export_aether3d.py#L429-L642 | ||
KratosMultiphysics/Kratos | 0000833054ed0503424eb28205d6508d9ca6cbbc | applications/SwimmingDEMApplication/python_scripts/apply_porosity_solution_body_force_process.py | python | ApplyPorositySolutionTransientBodyForceProcess.__init__ | (self, model, settings) | The default constructor of the class.
Keyword arguments:
self -- It signifies an instance of a class.
model -- the container of the fluid model part.
settings -- Kratos parameters containing process settings. | The default constructor of the class. | [
"The",
"default",
"constructor",
"of",
"the",
"class",
"."
] | def __init__(self, model, settings):
"""The default constructor of the class.
Keyword arguments:
self -- It signifies an instance of a class.
model -- the container of the fluid model part.
settings -- Kratos parameters containing process settings.
"""
KratosMult... | [
"def",
"__init__",
"(",
"self",
",",
"model",
",",
"settings",
")",
":",
"KratosMultiphysics",
".",
"Process",
".",
"__init__",
"(",
"self",
")",
"default_settings",
"=",
"KratosMultiphysics",
".",
"Parameters",
"(",
"\"\"\"\n {\n \"model_par... | https://github.com/KratosMultiphysics/Kratos/blob/0000833054ed0503424eb28205d6508d9ca6cbbc/applications/SwimmingDEMApplication/python_scripts/apply_porosity_solution_body_force_process.py#L12-L41 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/pathlib.py | python | Path.unlink | (self) | Remove this file or link.
If the path is a directory, use rmdir() instead. | Remove this file or link.
If the path is a directory, use rmdir() instead. | [
"Remove",
"this",
"file",
"or",
"link",
".",
"If",
"the",
"path",
"is",
"a",
"directory",
"use",
"rmdir",
"()",
"instead",
"."
] | def unlink(self):
"""
Remove this file or link.
If the path is a directory, use rmdir() instead.
"""
if self._closed:
self._raise_closed()
self._accessor.unlink(self) | [
"def",
"unlink",
"(",
"self",
")",
":",
"if",
"self",
".",
"_closed",
":",
"self",
".",
"_raise_closed",
"(",
")",
"self",
".",
"_accessor",
".",
"unlink",
"(",
"self",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/pathlib.py#L1302-L1309 | ||
osrf/gazebo | f570338107862253229a0514ffea10deab4f4517 | tools/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/osrf/gazebo/blob/f570338107862253229a0514ffea10deab4f4517/tools/cpplint.py#L634-L637 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/llvmlite/ir/builder.py | python | _label_suffix | (label, suffix) | Returns (label + suffix) or a truncated version if it's too long.
Parameters
----------
label : str
Label name
suffix : str
Label suffix | Returns (label + suffix) or a truncated version if it's too long.
Parameters
----------
label : str
Label name
suffix : str
Label suffix | [
"Returns",
"(",
"label",
"+",
"suffix",
")",
"or",
"a",
"truncated",
"version",
"if",
"it",
"s",
"too",
"long",
".",
"Parameters",
"----------",
"label",
":",
"str",
"Label",
"name",
"suffix",
":",
"str",
"Label",
"suffix"
] | def _label_suffix(label, suffix):
"""Returns (label + suffix) or a truncated version if it's too long.
Parameters
----------
label : str
Label name
suffix : str
Label suffix
"""
if len(label) > 50:
nhead = 25
return ''.join([label[:nhead], '..', suffix])
e... | [
"def",
"_label_suffix",
"(",
"label",
",",
"suffix",
")",
":",
"if",
"len",
"(",
"label",
")",
">",
"50",
":",
"nhead",
"=",
"25",
"return",
"''",
".",
"join",
"(",
"[",
"label",
"[",
":",
"nhead",
"]",
",",
"'..'",
",",
"suffix",
"]",
")",
"el... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/llvmlite/ir/builder.py#L153-L166 | ||
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/external/bazel_tools/tools/build_defs/docker/create_image_config.py | python | KeyValueToDict | (pair) | return d | Converts an iterable object of key=value pairs to dictionary. | Converts an iterable object of key=value pairs to dictionary. | [
"Converts",
"an",
"iterable",
"object",
"of",
"key",
"=",
"value",
"pairs",
"to",
"dictionary",
"."
] | def KeyValueToDict(pair):
"""Converts an iterable object of key=value pairs to dictionary."""
d = dict()
for kv in pair:
(k, v) = kv.split('=', 1)
d[k] = v
return d | [
"def",
"KeyValueToDict",
"(",
"pair",
")",
":",
"d",
"=",
"dict",
"(",
")",
"for",
"kv",
"in",
"pair",
":",
"(",
"k",
",",
"v",
")",
"=",
"kv",
".",
"split",
"(",
"'='",
",",
"1",
")",
"d",
"[",
"k",
"]",
"=",
"v",
"return",
"d"
] | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/external/bazel_tools/tools/build_defs/docker/create_image_config.py#L107-L113 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/telemetry/telemetry/web_perf/metrics/gpu_timeline.py | python | _CalculateFrameTimes | (events_per_frame, event_data_func) | return times_per_frame | Given a list of events per frame and a function to extract event time data,
returns a list of frame times. | Given a list of events per frame and a function to extract event time data,
returns a list of frame times. | [
"Given",
"a",
"list",
"of",
"events",
"per",
"frame",
"and",
"a",
"function",
"to",
"extract",
"event",
"time",
"data",
"returns",
"a",
"list",
"of",
"frame",
"times",
"."
] | def _CalculateFrameTimes(events_per_frame, event_data_func):
"""Given a list of events per frame and a function to extract event time data,
returns a list of frame times."""
times_per_frame = []
for event_list in events_per_frame:
event_times = [event_data_func(event) for event in event_list]
times_p... | [
"def",
"_CalculateFrameTimes",
"(",
"events_per_frame",
",",
"event_data_func",
")",
":",
"times_per_frame",
"=",
"[",
"]",
"for",
"event_list",
"in",
"events_per_frame",
":",
"event_times",
"=",
"[",
"event_data_func",
"(",
"event",
")",
"for",
"event",
"in",
"... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/telemetry/web_perf/metrics/gpu_timeline.py#L26-L33 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/richtext.py | python | RichTextCtrl.GetTextCursor | (*args, **kwargs) | return _richtext.RichTextCtrl_GetTextCursor(*args, **kwargs) | GetTextCursor(self) -> Cursor
Get text cursor | GetTextCursor(self) -> Cursor | [
"GetTextCursor",
"(",
"self",
")",
"-",
">",
"Cursor"
] | def GetTextCursor(*args, **kwargs):
"""
GetTextCursor(self) -> Cursor
Get text cursor
"""
return _richtext.RichTextCtrl_GetTextCursor(*args, **kwargs) | [
"def",
"GetTextCursor",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"RichTextCtrl_GetTextCursor",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/richtext.py#L2997-L3003 | |
CRYTEK/CRYENGINE | 232227c59a220cbbd311576f0fbeba7bb53b2a8c | Code/Tools/waf-1.7.13/waflib/TaskGen.py | python | subst_pc.sig_vars | (self) | return self.m.digest() | Compute a hash (signature) of the variables used in the substitution | Compute a hash (signature) of the variables used in the substitution | [
"Compute",
"a",
"hash",
"(",
"signature",
")",
"of",
"the",
"variables",
"used",
"in",
"the",
"substitution"
] | def sig_vars(self):
"""
Compute a hash (signature) of the variables used in the substitution
"""
bld = self.generator.bld
env = self.env
upd = self.m.update
if getattr(self.generator, 'fun', None):
upd(Utils.h_fun(self.generator.fun).encode())
if getattr(self.generator, 'subst_fun', None):
upd(Ut... | [
"def",
"sig_vars",
"(",
"self",
")",
":",
"bld",
"=",
"self",
".",
"generator",
".",
"bld",
"env",
"=",
"self",
".",
"env",
"upd",
"=",
"self",
".",
"m",
".",
"update",
"if",
"getattr",
"(",
"self",
".",
"generator",
",",
"'fun'",
",",
"None",
")... | https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Code/Tools/waf-1.7.13/waflib/TaskGen.py#L704-L727 | |
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/tools/cpplint.py | python | _VerboseLevel | () | return _cpplint_state.verbose_level | Returns the module's verbosity setting. | Returns the module's verbosity setting. | [
"Returns",
"the",
"module",
"s",
"verbosity",
"setting",
"."
] | def _VerboseLevel():
"""Returns the module's verbosity setting."""
return _cpplint_state.verbose_level | [
"def",
"_VerboseLevel",
"(",
")",
":",
"return",
"_cpplint_state",
".",
"verbose_level"
] | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/tools/cpplint.py#L1447-L1449 | |
fatih/subvim | 241b6d170597857105da219c9b7d36059e9f11fb | vim/base/YouCompleteMe/third_party/jedi/jedi/evaluate_representation.py | python | Execution.get_return_types | (self, evaluate_generator=False) | return imports.strip_imports(stmts) | Get the return types of a function. | Get the return types of a function. | [
"Get",
"the",
"return",
"types",
"of",
"a",
"function",
"."
] | def get_return_types(self, evaluate_generator=False):
""" Get the return types of a function. """
base = self.decorated
stmts = []
if base.parent == builtin.Builtin.scope \
and not isinstance(base, (Generator, Array)):
func_name = str(base.name)
#... | [
"def",
"get_return_types",
"(",
"self",
",",
"evaluate_generator",
"=",
"False",
")",
":",
"base",
"=",
"self",
".",
"decorated",
"stmts",
"=",
"[",
"]",
"if",
"base",
".",
"parent",
"==",
"builtin",
".",
"Builtin",
".",
"scope",
"and",
"not",
"isinstanc... | https://github.com/fatih/subvim/blob/241b6d170597857105da219c9b7d36059e9f11fb/vim/base/YouCompleteMe/third_party/jedi/jedi/evaluate_representation.py#L430-L498 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/lib-tk/Tkinter.py | python | Misc.after_idle | (self, func, *args) | return self.after('idle', func, *args) | Call FUNC once if the Tcl main loop has no event to
process.
Return an identifier to cancel the scheduling with
after_cancel. | Call FUNC once if the Tcl main loop has no event to
process. | [
"Call",
"FUNC",
"once",
"if",
"the",
"Tcl",
"main",
"loop",
"has",
"no",
"event",
"to",
"process",
"."
] | def after_idle(self, func, *args):
"""Call FUNC once if the Tcl main loop has no event to
process.
Return an identifier to cancel the scheduling with
after_cancel."""
return self.after('idle', func, *args) | [
"def",
"after_idle",
"(",
"self",
",",
"func",
",",
"*",
"args",
")",
":",
"return",
"self",
".",
"after",
"(",
"'idle'",
",",
"func",
",",
"*",
"args",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/lib-tk/Tkinter.py#L605-L611 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/dtypes/inference.py | python | is_re | (obj) | return isinstance(obj, Pattern) | Check if the object is a regex pattern instance.
Parameters
----------
obj : The object to check
Returns
-------
is_regex : bool
Whether `obj` is a regex pattern.
Examples
--------
>>> is_re(re.compile(".*"))
True
>>> is_re("foo")
False | Check if the object is a regex pattern instance. | [
"Check",
"if",
"the",
"object",
"is",
"a",
"regex",
"pattern",
"instance",
"."
] | def is_re(obj) -> bool:
"""
Check if the object is a regex pattern instance.
Parameters
----------
obj : The object to check
Returns
-------
is_regex : bool
Whether `obj` is a regex pattern.
Examples
--------
>>> is_re(re.compile(".*"))
True
>>> is_re("foo"... | [
"def",
"is_re",
"(",
"obj",
")",
"->",
"bool",
":",
"return",
"isinstance",
"(",
"obj",
",",
"Pattern",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/dtypes/inference.py#L168-L188 | |
rapidsai/cudf | d5b2448fc69f17509304d594f029d0df56984962 | python/cudf/cudf/core/frame.py | python | Frame.to_cupy | (
self,
dtype: Union[Dtype, None] = None,
copy: bool = False,
na_value=None,
) | return self._to_array(
(lambda col: col.values.copy())
if copy
else (lambda col: col.values),
cupy.empty,
dtype,
na_value,
) | Convert the Frame to a CuPy array.
Parameters
----------
dtype : str or numpy.dtype, optional
The dtype to pass to :meth:`numpy.asarray`.
copy : bool, default False
Whether to ensure that the returned value is not a view on
another array. Note that ``... | Convert the Frame to a CuPy array. | [
"Convert",
"the",
"Frame",
"to",
"a",
"CuPy",
"array",
"."
] | def to_cupy(
self,
dtype: Union[Dtype, None] = None,
copy: bool = False,
na_value=None,
) -> cupy.ndarray:
"""Convert the Frame to a CuPy array.
Parameters
----------
dtype : str or numpy.dtype, optional
The dtype to pass to :meth:`numpy.a... | [
"def",
"to_cupy",
"(",
"self",
",",
"dtype",
":",
"Union",
"[",
"Dtype",
",",
"None",
"]",
"=",
"None",
",",
"copy",
":",
"bool",
"=",
"False",
",",
"na_value",
"=",
"None",
",",
")",
"->",
"cupy",
".",
"ndarray",
":",
"return",
"self",
".",
"_to... | https://github.com/rapidsai/cudf/blob/d5b2448fc69f17509304d594f029d0df56984962/python/cudf/cudf/core/frame.py#L678-L710 | |
hpi-xnor/BMXNet | ed0b201da6667887222b8e4b5f997c4f6b61943d | example/ssd/symbol/legacy_vgg16_ssd_300.py | python | get_symbol | (num_classes=20, nms_thresh=0.5, force_suppress=False,
nms_topk=400, **kwargs) | return out | Single-shot multi-box detection with VGG 16 layers ConvNet
This is a modified version, with fc6/fc7 layers replaced by conv layers
And the network is slightly smaller than original VGG 16 network
This is the detection network
Parameters:
----------
num_classes: int
number of object clas... | Single-shot multi-box detection with VGG 16 layers ConvNet
This is a modified version, with fc6/fc7 layers replaced by conv layers
And the network is slightly smaller than original VGG 16 network
This is the detection network | [
"Single",
"-",
"shot",
"multi",
"-",
"box",
"detection",
"with",
"VGG",
"16",
"layers",
"ConvNet",
"This",
"is",
"a",
"modified",
"version",
"with",
"fc6",
"/",
"fc7",
"layers",
"replaced",
"by",
"conv",
"layers",
"And",
"the",
"network",
"is",
"slightly",... | def get_symbol(num_classes=20, nms_thresh=0.5, force_suppress=False,
nms_topk=400, **kwargs):
"""
Single-shot multi-box detection with VGG 16 layers ConvNet
This is a modified version, with fc6/fc7 layers replaced by conv layers
And the network is slightly smaller than original VGG 16 net... | [
"def",
"get_symbol",
"(",
"num_classes",
"=",
"20",
",",
"nms_thresh",
"=",
"0.5",
",",
"force_suppress",
"=",
"False",
",",
"nms_topk",
"=",
"400",
",",
"*",
"*",
"kwargs",
")",
":",
"net",
"=",
"get_symbol_train",
"(",
"num_classes",
")",
"cls_preds",
... | https://github.com/hpi-xnor/BMXNet/blob/ed0b201da6667887222b8e4b5f997c4f6b61943d/example/ssd/symbol/legacy_vgg16_ssd_300.py#L175-L208 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/py/shell.py | python | Shell.prompt | (self) | Display proper prompt for the context: ps1, ps2 or ps3.
If this is a continuation line, autoindent as necessary. | Display proper prompt for the context: ps1, ps2 or ps3. | [
"Display",
"proper",
"prompt",
"for",
"the",
"context",
":",
"ps1",
"ps2",
"or",
"ps3",
"."
] | def prompt(self):
"""Display proper prompt for the context: ps1, ps2 or ps3.
If this is a continuation line, autoindent as necessary."""
isreading = self.reader.isreading
skip = False
if isreading:
prompt = str(sys.ps3)
elif self.more:
prompt = st... | [
"def",
"prompt",
"(",
"self",
")",
":",
"isreading",
"=",
"self",
".",
"reader",
".",
"isreading",
"skip",
"=",
"False",
"if",
"isreading",
":",
"prompt",
"=",
"str",
"(",
"sys",
".",
"ps3",
")",
"elif",
"self",
".",
"more",
":",
"prompt",
"=",
"st... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/py/shell.py#L1022-L1077 | ||
nnrg/opennero | 43e12a1bcba6e228639db3886fec1dc47ddc24cb | mods/nero_mod.py | python | is_special | (name) | return name in SPECIAL_MOD_NAMES or name.startswith(SPECIAL_MOD_PREFIX) | True if the mod name is reserved | True if the mod name is reserved | [
"True",
"if",
"the",
"mod",
"name",
"is",
"reserved"
] | def is_special(name):
" True if the mod name is reserved "
return name in SPECIAL_MOD_NAMES or name.startswith(SPECIAL_MOD_PREFIX) | [
"def",
"is_special",
"(",
"name",
")",
":",
"return",
"name",
"in",
"SPECIAL_MOD_NAMES",
"or",
"name",
".",
"startswith",
"(",
"SPECIAL_MOD_PREFIX",
")"
] | https://github.com/nnrg/opennero/blob/43e12a1bcba6e228639db3886fec1dc47ddc24cb/mods/nero_mod.py#L72-L74 | |
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | lts/deps/v8/third_party/jinja2/environment.py | python | copy_cache | (cache) | return LRUCache(cache.capacity) | Create an empty copy of the given cache. | Create an empty copy of the given cache. | [
"Create",
"an",
"empty",
"copy",
"of",
"the",
"given",
"cache",
"."
] | def copy_cache(cache):
"""Create an empty copy of the given cache."""
if cache is None:
return None
elif type(cache) is dict:
return {}
return LRUCache(cache.capacity) | [
"def",
"copy_cache",
"(",
"cache",
")",
":",
"if",
"cache",
"is",
"None",
":",
"return",
"None",
"elif",
"type",
"(",
"cache",
")",
"is",
"dict",
":",
"return",
"{",
"}",
"return",
"LRUCache",
"(",
"cache",
".",
"capacity",
")"
] | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/deps/v8/third_party/jinja2/environment.py#L69-L75 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_controls.py | python | GenericDatePickerCtrl.Create | (*args, **kwargs) | return _controls_.GenericDatePickerCtrl_Create(*args, **kwargs) | Create(self, Window parent, int id=-1, DateTime dt=wxDefaultDateTime,
Point pos=DefaultPosition, Size size=DefaultSize,
long style=wxDP_DEFAULT|wxDP_SHOWCENTURY,
Validator validator=DefaultValidator,
String name=DatePickerCtrlNameStr) -> bool
Create the GUI p... | Create(self, Window parent, int id=-1, DateTime dt=wxDefaultDateTime,
Point pos=DefaultPosition, Size size=DefaultSize,
long style=wxDP_DEFAULT|wxDP_SHOWCENTURY,
Validator validator=DefaultValidator,
String name=DatePickerCtrlNameStr) -> bool | [
"Create",
"(",
"self",
"Window",
"parent",
"int",
"id",
"=",
"-",
"1",
"DateTime",
"dt",
"=",
"wxDefaultDateTime",
"Point",
"pos",
"=",
"DefaultPosition",
"Size",
"size",
"=",
"DefaultSize",
"long",
"style",
"=",
"wxDP_DEFAULT|wxDP_SHOWCENTURY",
"Validator",
"va... | def Create(*args, **kwargs):
"""
Create(self, Window parent, int id=-1, DateTime dt=wxDefaultDateTime,
Point pos=DefaultPosition, Size size=DefaultSize,
long style=wxDP_DEFAULT|wxDP_SHOWCENTURY,
Validator validator=DefaultValidator,
String name=DatePic... | [
"def",
"Create",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"GenericDatePickerCtrl_Create",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_controls.py#L6556-L6567 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/fastparquet/writer.py | python | convert | (data, se) | return out | Convert data according to the schema encoding | Convert data according to the schema encoding | [
"Convert",
"data",
"according",
"to",
"the",
"schema",
"encoding"
] | def convert(data, se):
"""Convert data according to the schema encoding"""
dtype = data.dtype
type = se.type
converted_type = se.converted_type
if dtype.name in typemap:
if type in revmap:
out = data.values.astype(revmap[type], copy=False)
elif type == parquet_thrift.Type... | [
"def",
"convert",
"(",
"data",
",",
"se",
")",
":",
"dtype",
"=",
"data",
".",
"dtype",
"type",
"=",
"se",
".",
"type",
"converted_type",
"=",
"se",
".",
"converted_type",
"if",
"dtype",
".",
"name",
"in",
"typemap",
":",
"if",
"type",
"in",
"revmap"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/fastparquet/writer.py#L156-L213 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/telemetry/telemetry/benchmark.py | python | Benchmark.ValueCanBeAddedPredicate | (cls, value, is_first_result) | return True | Returns whether |value| can be added to the test results.
Override this method to customize the logic of adding values to test
results.
Args:
value: a value.Value instance (except failure.FailureValue,
skip.SkipValue or trace.TraceValue which will always be added).
is_first_result: Tru... | Returns whether |value| can be added to the test results. | [
"Returns",
"whether",
"|value|",
"can",
"be",
"added",
"to",
"the",
"test",
"results",
"."
] | def ValueCanBeAddedPredicate(cls, value, is_first_result):
"""Returns whether |value| can be added to the test results.
Override this method to customize the logic of adding values to test
results.
Args:
value: a value.Value instance (except failure.FailureValue,
skip.SkipValue or trace.... | [
"def",
"ValueCanBeAddedPredicate",
"(",
"cls",
",",
"value",
",",
"is_first_result",
")",
":",
"return",
"True"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/telemetry/benchmark.py#L187-L203 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/_abcoll.py | python | MutableSequence.remove | (self, value) | S.remove(value) -- remove first occurrence of value.
Raise ValueError if the value is not present. | S.remove(value) -- remove first occurrence of value.
Raise ValueError if the value is not present. | [
"S",
".",
"remove",
"(",
"value",
")",
"--",
"remove",
"first",
"occurrence",
"of",
"value",
".",
"Raise",
"ValueError",
"if",
"the",
"value",
"is",
"not",
"present",
"."
] | def remove(self, value):
'''S.remove(value) -- remove first occurrence of value.
Raise ValueError if the value is not present.
'''
del self[self.index(value)] | [
"def",
"remove",
"(",
"self",
",",
"value",
")",
":",
"del",
"self",
"[",
"self",
".",
"index",
"(",
"value",
")",
"]"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/_abcoll.py#L661-L665 | ||
google/syzygy | 8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5 | third_party/numpy/files/numpy/core/defchararray.py | python | replace | (a, old, new, count=None) | return _to_string_or_unicode_array(
_vec_string(
a, object_, 'replace', [old, new] +_clean_args(count))) | For each element in `a`, return a copy of the string with all
occurrences of substring `old` replaced by `new`.
Calls `str.replace` element-wise.
Parameters
----------
a : array-like of str or unicode
old, new : str or unicode
count : int, optional
If the optional argument `count... | For each element in `a`, return a copy of the string with all
occurrences of substring `old` replaced by `new`. | [
"For",
"each",
"element",
"in",
"a",
"return",
"a",
"copy",
"of",
"the",
"string",
"with",
"all",
"occurrences",
"of",
"substring",
"old",
"replaced",
"by",
"new",
"."
] | def replace(a, old, new, count=None):
"""
For each element in `a`, return a copy of the string with all
occurrences of substring `old` replaced by `new`.
Calls `str.replace` element-wise.
Parameters
----------
a : array-like of str or unicode
old, new : str or unicode
count : int... | [
"def",
"replace",
"(",
"a",
",",
"old",
",",
"new",
",",
"count",
"=",
"None",
")",
":",
"return",
"_to_string_or_unicode_array",
"(",
"_vec_string",
"(",
"a",
",",
"object_",
",",
"'replace'",
",",
"[",
"old",
",",
"new",
"]",
"+",
"_clean_args",
"(",... | https://github.com/google/syzygy/blob/8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5/third_party/numpy/files/numpy/core/defchararray.py#L1071-L1100 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/aui/framemanager.py | python | AuiManager.OnGripperClicked | (self, pane_window, start, offset) | Handles the mouse click on the pane gripper.
:param Window `pane_window`: the window managed by the pane;
:param Point `start`: the mouse-click position;
:param Point `offset`: an offset point from the `start` position. | Handles the mouse click on the pane gripper. | [
"Handles",
"the",
"mouse",
"click",
"on",
"the",
"pane",
"gripper",
"."
] | def OnGripperClicked(self, pane_window, start, offset):
"""
Handles the mouse click on the pane gripper.
:param Window `pane_window`: the window managed by the pane;
:param Point `start`: the mouse-click position;
:param Point `offset`: an offset point from the `start` position.... | [
"def",
"OnGripperClicked",
"(",
"self",
",",
"pane_window",
",",
"start",
",",
"offset",
")",
":",
"# try to find the pane",
"paneInfo",
"=",
"self",
".",
"GetPane",
"(",
"pane_window",
")",
"if",
"not",
"paneInfo",
".",
"IsOk",
"(",
")",
":",
"raise",
"Ex... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/aui/framemanager.py#L8583-L8632 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/logging/config.py | python | stopListening | () | Stop the listening server which was created with a call to listen(). | Stop the listening server which was created with a call to listen(). | [
"Stop",
"the",
"listening",
"server",
"which",
"was",
"created",
"with",
"a",
"call",
"to",
"listen",
"()",
"."
] | def stopListening():
"""
Stop the listening server which was created with a call to listen().
"""
global _listener
logging._acquireLock()
try:
if _listener:
_listener.abort = 1
_listener = None
finally:
logging._releaseLock() | [
"def",
"stopListening",
"(",
")",
":",
"global",
"_listener",
"logging",
".",
"_acquireLock",
"(",
")",
"try",
":",
"if",
"_listener",
":",
"_listener",
".",
"abort",
"=",
"1",
"_listener",
"=",
"None",
"finally",
":",
"logging",
".",
"_releaseLock",
"(",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/logging/config.py#L908-L919 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_controls.py | python | PreChoice | (*args, **kwargs) | return val | PreChoice() -> Choice
Precreate a Choice control for 2-phase creation. | PreChoice() -> Choice | [
"PreChoice",
"()",
"-",
">",
"Choice"
] | def PreChoice(*args, **kwargs):
"""
PreChoice() -> Choice
Precreate a Choice control for 2-phase creation.
"""
val = _controls_.new_PreChoice(*args, **kwargs)
return val | [
"def",
"PreChoice",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"val",
"=",
"_controls_",
".",
"new_PreChoice",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"val"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_controls.py#L549-L556 | |
openai/triton | 7b48340ffddd7d2624b0330b219eb05b673c086b | python/triton/code_gen.py | python | jit | (*args, **kwargs) | Decorator for JIT-compiling a function using the Triton compiler.
:note: When a jit'd function is called, :code:`torch.tensor` arguments are implicitly converted to pointers using the :code:`.data_ptr()` method.
:note: This function will be compiled and run on the GPU. It will only have access to:
... | Decorator for JIT-compiling a function using the Triton compiler. | [
"Decorator",
"for",
"JIT",
"-",
"compiling",
"a",
"function",
"using",
"the",
"Triton",
"compiler",
"."
] | def jit(*args, **kwargs):
"""
Decorator for JIT-compiling a function using the Triton compiler.
:note: When a jit'd function is called, :code:`torch.tensor` arguments are implicitly converted to pointers using the :code:`.data_ptr()` method.
:note: This function will be compiled and run on the GPU. It... | [
"def",
"jit",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"args",
":",
"assert",
"len",
"(",
"args",
")",
"==",
"1",
"assert",
"callable",
"(",
"args",
"[",
"0",
"]",
")",
"return",
"JITFunction",
"(",
"args",
"[",
"0",
"]",
",",... | https://github.com/openai/triton/blob/7b48340ffddd7d2624b0330b219eb05b673c086b/python/triton/code_gen.py#L1146-L1169 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/lib-tk/turtle.py | python | Screen | () | return Turtle._screen | Return the singleton screen object.
If none exists at the moment, create a new one and return it,
else return the existing one. | Return the singleton screen object.
If none exists at the moment, create a new one and return it,
else return the existing one. | [
"Return",
"the",
"singleton",
"screen",
"object",
".",
"If",
"none",
"exists",
"at",
"the",
"moment",
"create",
"a",
"new",
"one",
"and",
"return",
"it",
"else",
"return",
"the",
"existing",
"one",
"."
] | def Screen():
"""Return the singleton screen object.
If none exists at the moment, create a new one and return it,
else return the existing one."""
if Turtle._screen is None:
Turtle._screen = _Screen()
return Turtle._screen | [
"def",
"Screen",
"(",
")",
":",
"if",
"Turtle",
".",
"_screen",
"is",
"None",
":",
"Turtle",
".",
"_screen",
"=",
"_Screen",
"(",
")",
"return",
"Turtle",
".",
"_screen"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/lib-tk/turtle.py#L3548-L3554 | |
astra-toolbox/astra-toolbox | 1e7ec8af702e595b76654f2e500f4c00344b273f | python/astra/log.py | python | warn | (message) | Log a warning message.
:param message: Message to log.
:type message: :class:`string` | Log a warning message.
:param message: Message to log.
:type message: :class:`string` | [
"Log",
"a",
"warning",
"message",
".",
":",
"param",
"message",
":",
"Message",
"to",
"log",
".",
":",
"type",
"message",
":",
":",
"class",
":",
"string"
] | def warn(message):
"""Log a warning message.
:param message: Message to log.
:type message: :class:`string`
"""
prev_f = inspect.getframeinfo(inspect.currentframe().f_back)
l.log_warn(prev_f.filename,prev_f.lineno,message) | [
"def",
"warn",
"(",
"message",
")",
":",
"prev_f",
"=",
"inspect",
".",
"getframeinfo",
"(",
"inspect",
".",
"currentframe",
"(",
")",
".",
"f_back",
")",
"l",
".",
"log_warn",
"(",
"prev_f",
".",
"filename",
",",
"prev_f",
".",
"lineno",
",",
"message... | https://github.com/astra-toolbox/astra-toolbox/blob/1e7ec8af702e595b76654f2e500f4c00344b273f/python/astra/log.py#L48-L55 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/wsgiref/headers.py | python | Headers.setdefault | (self,name,value) | Return first matching header value for 'name', or 'value'
If there is no header named 'name', add a new header with name 'name'
and value 'value'. | Return first matching header value for 'name', or 'value' | [
"Return",
"first",
"matching",
"header",
"value",
"for",
"name",
"or",
"value"
] | def setdefault(self,name,value):
"""Return first matching header value for 'name', or 'value'
If there is no header named 'name', add a new header with name 'name'
and value 'value'."""
result = self.get(name)
if result is None:
self._headers.append((name,value))
... | [
"def",
"setdefault",
"(",
"self",
",",
"name",
",",
"value",
")",
":",
"result",
"=",
"self",
".",
"get",
"(",
"name",
")",
"if",
"result",
"is",
"None",
":",
"self",
".",
"_headers",
".",
"append",
"(",
"(",
"name",
",",
"value",
")",
")",
"retu... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/wsgiref/headers.py#L133-L143 | ||
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | example/gluon/embedding_learning/train.py | python | get_lr | (lr, epoch, steps, factor) | return lr | Get learning rate based on schedule. | Get learning rate based on schedule. | [
"Get",
"learning",
"rate",
"based",
"on",
"schedule",
"."
] | def get_lr(lr, epoch, steps, factor):
"""Get learning rate based on schedule."""
for s in steps:
if epoch >= s:
lr *= factor
return lr | [
"def",
"get_lr",
"(",
"lr",
",",
"epoch",
",",
"steps",
",",
"factor",
")",
":",
"for",
"s",
"in",
"steps",
":",
"if",
"epoch",
">=",
"s",
":",
"lr",
"*=",
"factor",
"return",
"lr"
] | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/example/gluon/embedding_learning/train.py#L161-L166 | |
MythTV/mythtv | d282a209cb8be85d036f85a62a8ec971b67d45f4 | mythtv/programs/scripts/internetcontent/nv_python_libs/xsltfunctions/nasa_api.py | python | OutStreamEncoder.__getattr__ | (self, attr) | return getattr(self.out, attr) | Delegate everything but write to the stream | Delegate everything but write to the stream | [
"Delegate",
"everything",
"but",
"write",
"to",
"the",
"stream"
] | def __getattr__(self, attr):
"""Delegate everything but write to the stream"""
return getattr(self.out, attr) | [
"def",
"__getattr__",
"(",
"self",
",",
"attr",
")",
":",
"return",
"getattr",
"(",
"self",
".",
"out",
",",
"attr",
")"
] | https://github.com/MythTV/mythtv/blob/d282a209cb8be85d036f85a62a8ec971b67d45f4/mythtv/programs/scripts/internetcontent/nv_python_libs/xsltfunctions/nasa_api.py#L58-L60 | |
qt/qtbase | 81b9ee66b8e40ed145185fe46b7c91929688cafd | util/cmake/condition_simplifier_cache.py | python | merge_dicts_recursive | (a: Dict[str, Any], other: Dict[str, Any]) | return a | Merges values of "other" into "a", mutates a. | Merges values of "other" into "a", mutates a. | [
"Merges",
"values",
"of",
"other",
"into",
"a",
"mutates",
"a",
"."
] | def merge_dicts_recursive(a: Dict[str, Any], other: Dict[str, Any]) -> Dict[str, Any]:
"""Merges values of "other" into "a", mutates a."""
for key in other:
if key in a:
if isinstance(a[key], dict) and isinstance(other[key], dict):
merge_dicts_recursive(a[key], other[key])
... | [
"def",
"merge_dicts_recursive",
"(",
"a",
":",
"Dict",
"[",
"str",
",",
"Any",
"]",
",",
"other",
":",
"Dict",
"[",
"str",
",",
"Any",
"]",
")",
"->",
"Dict",
"[",
"str",
",",
"Any",
"]",
":",
"for",
"key",
"in",
"other",
":",
"if",
"key",
"in"... | https://github.com/qt/qtbase/blob/81b9ee66b8e40ed145185fe46b7c91929688cafd/util/cmake/condition_simplifier_cache.py#L89-L99 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/lib-tk/ttk.py | python | Treeview.__init__ | (self, master=None, **kw) | Construct a Ttk Treeview with parent master.
STANDARD OPTIONS
class, cursor, style, takefocus, xscrollcommand,
yscrollcommand
WIDGET-SPECIFIC OPTIONS
columns, displaycolumns, height, padding, selectmode, show
ITEM OPTIONS
text, image, values,... | Construct a Ttk Treeview with parent master. | [
"Construct",
"a",
"Ttk",
"Treeview",
"with",
"parent",
"master",
"."
] | def __init__(self, master=None, **kw):
"""Construct a Ttk Treeview with parent master.
STANDARD OPTIONS
class, cursor, style, takefocus, xscrollcommand,
yscrollcommand
WIDGET-SPECIFIC OPTIONS
columns, displaycolumns, height, padding, selectmode, show
... | [
"def",
"__init__",
"(",
"self",
",",
"master",
"=",
"None",
",",
"*",
"*",
"kw",
")",
":",
"Widget",
".",
"__init__",
"(",
"self",
",",
"master",
",",
"\"ttk::treeview\"",
",",
"kw",
")"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/lib-tk/ttk.py#L1154-L1174 | ||
CaoWGG/TensorRT-CenterNet | f949252e37b51e60f873808f46d3683f15735e79 | onnx-tensorrt/third_party/onnx/third_party/pybind11/tools/clang/cindex.py | python | CompilationDatabase.getAllCompileCommands | (self) | return conf.lib.clang_CompilationDatabase_getAllCompileCommands(self) | Get an iterable object providing all the CompileCommands available from
the database. | Get an iterable object providing all the CompileCommands available from
the database. | [
"Get",
"an",
"iterable",
"object",
"providing",
"all",
"the",
"CompileCommands",
"available",
"from",
"the",
"database",
"."
] | def getAllCompileCommands(self):
"""
Get an iterable object providing all the CompileCommands available from
the database.
"""
return conf.lib.clang_CompilationDatabase_getAllCompileCommands(self) | [
"def",
"getAllCompileCommands",
"(",
"self",
")",
":",
"return",
"conf",
".",
"lib",
".",
"clang_CompilationDatabase_getAllCompileCommands",
"(",
"self",
")"
] | https://github.com/CaoWGG/TensorRT-CenterNet/blob/f949252e37b51e60f873808f46d3683f15735e79/onnx-tensorrt/third_party/onnx/third_party/pybind11/tools/clang/cindex.py#L2969-L2974 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/Pygments/py3/pygments/formatters/latex.py | python | LatexEmbeddedLexer._filter_to | (self, it, pred) | Keep only the tokens that match `pred`, merge the others together | Keep only the tokens that match `pred`, merge the others together | [
"Keep",
"only",
"the",
"tokens",
"that",
"match",
"pred",
"merge",
"the",
"others",
"together"
] | def _filter_to(self, it, pred):
""" Keep only the tokens that match `pred`, merge the others together """
buf = ''
idx = 0
for i, t, v in it:
if pred(t):
if buf:
yield idx, None, buf
buf = ''
yield i, t, ... | [
"def",
"_filter_to",
"(",
"self",
",",
"it",
",",
"pred",
")",
":",
"buf",
"=",
"''",
"idx",
"=",
"0",
"for",
"i",
",",
"t",
",",
"v",
"in",
"it",
":",
"if",
"pred",
"(",
"t",
")",
":",
"if",
"buf",
":",
"yield",
"idx",
",",
"None",
",",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/Pygments/py3/pygments/formatters/latex.py#L478-L493 | ||
rapidsai/cudf | d5b2448fc69f17509304d594f029d0df56984962 | python/cudf/cudf/io/parquet.py | python | read_parquet_metadata | (path) | return num_rows, num_row_groups, col_names | {docstring} | {docstring} | [
"{",
"docstring",
"}"
] | def read_parquet_metadata(path):
"""{docstring}"""
pq_file = pq.ParquetFile(path)
num_rows = pq_file.metadata.num_rows
num_row_groups = pq_file.num_row_groups
col_names = pq_file.schema.names
return num_rows, num_row_groups, col_names | [
"def",
"read_parquet_metadata",
"(",
"path",
")",
":",
"pq_file",
"=",
"pq",
".",
"ParquetFile",
"(",
"path",
")",
"num_rows",
"=",
"pq_file",
".",
"metadata",
".",
"num_rows",
"num_row_groups",
"=",
"pq_file",
".",
"num_row_groups",
"col_names",
"=",
"pq_file... | https://github.com/rapidsai/cudf/blob/d5b2448fc69f17509304d594f029d0df56984962/python/cudf/cudf/io/parquet.py#L164-L173 | |
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | buildscripts/idl/idl/errors.py | python | ParserContext.add_array_enum_error | (self, location, field_name) | Add an error for a field being an array of enums. | Add an error for a field being an array of enums. | [
"Add",
"an",
"error",
"for",
"a",
"field",
"being",
"an",
"array",
"of",
"enums",
"."
] | def add_array_enum_error(self, location, field_name):
# type: (common.SourceLocation, str) -> None
"""Add an error for a field being an array of enums."""
self._add_error(location, ERROR_ID_NO_ARRAY_ENUM,
"Field '%s' cannot be an array of enums" % (field_name)) | [
"def",
"add_array_enum_error",
"(",
"self",
",",
"location",
",",
"field_name",
")",
":",
"# type: (common.SourceLocation, str) -> None",
"self",
".",
"_add_error",
"(",
"location",
",",
"ERROR_ID_NO_ARRAY_ENUM",
",",
"\"Field '%s' cannot be an array of enums\"",
"%",
"(",
... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/idl/idl/errors.py#L594-L598 | ||
llvm/llvm-project | ffa6262cb4e2a335d26416fad39a581b4f98c5f4 | lldb/third_party/Python/module/pexpect-4.6/pexpect/FSM.py | python | FSM.set_default_transition | (self, action, next_state) | This sets the default transition. This defines an action and
next_state if the FSM cannot find the input symbol and the current
state in the transition list and if the FSM cannot find the
current_state in the transition_any list. This is useful as a final
fall-through state for catching ... | This sets the default transition. This defines an action and
next_state if the FSM cannot find the input symbol and the current
state in the transition list and if the FSM cannot find the
current_state in the transition_any list. This is useful as a final
fall-through state for catching ... | [
"This",
"sets",
"the",
"default",
"transition",
".",
"This",
"defines",
"an",
"action",
"and",
"next_state",
"if",
"the",
"FSM",
"cannot",
"find",
"the",
"input",
"symbol",
"and",
"the",
"current",
"state",
"in",
"the",
"transition",
"list",
"and",
"if",
"... | def set_default_transition (self, action, next_state):
'''This sets the default transition. This defines an action and
next_state if the FSM cannot find the input symbol and the current
state in the transition list and if the FSM cannot find the
current_state in the transition_any list.... | [
"def",
"set_default_transition",
"(",
"self",
",",
"action",
",",
"next_state",
")",
":",
"self",
".",
"default_transition",
"=",
"(",
"action",
",",
"next_state",
")"
] | https://github.com/llvm/llvm-project/blob/ffa6262cb4e2a335d26416fad39a581b4f98c5f4/lldb/third_party/Python/module/pexpect-4.6/pexpect/FSM.py#L182-L193 | ||
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/contrib/quantization/tools/quantize_graph.py | python | GraphRewriter.quantize_weights | (self, input_graph, quantization_mode) | return output_graph | Quantize float Const ops.
There are two modes of operations, both replace float Const ops with
quantized values.
1. If quantization_mode is "weights_rounded", this function replaces float
Const ops with quantized float Const ops - same as the original op, but
float values being mapped to the center... | Quantize float Const ops. | [
"Quantize",
"float",
"Const",
"ops",
"."
] | def quantize_weights(self, input_graph, quantization_mode):
"""Quantize float Const ops.
There are two modes of operations, both replace float Const ops with
quantized values.
1. If quantization_mode is "weights_rounded", this function replaces float
Const ops with quantized float Const ops - same ... | [
"def",
"quantize_weights",
"(",
"self",
",",
"input_graph",
",",
"quantization_mode",
")",
":",
"output_graph",
"=",
"tf",
".",
"GraphDef",
"(",
")",
"for",
"input_node",
"in",
"input_graph",
".",
"node",
":",
"should_quantize",
"=",
"False",
"if",
"input_node... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/contrib/quantization/tools/quantize_graph.py#L914-L966 | |
rampageX/firmware-mod-kit | c94cd6aeee50d92ec5280a6dba6d74828fd3606b | src/binwalk-2.1.1/src/binwalk/modules/hashmatch.py | python | HashMatch._get_file_list | (self, directory) | return set(file_list) | Generates a directory tree.
@directory - The root directory to start from.
Returns a set of file paths, excluding the root directory. | Generates a directory tree. | [
"Generates",
"a",
"directory",
"tree",
"."
] | def _get_file_list(self, directory):
'''
Generates a directory tree.
@directory - The root directory to start from.
Returns a set of file paths, excluding the root directory.
'''
file_list = []
# Normalize directory path so that we can exclude it from each indi... | [
"def",
"_get_file_list",
"(",
"self",
",",
"directory",
")",
":",
"file_list",
"=",
"[",
"]",
"# Normalize directory path so that we can exclude it from each individual file path",
"directory",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"directory",
")",
"+",
"os",
... | https://github.com/rampageX/firmware-mod-kit/blob/c94cd6aeee50d92ec5280a6dba6d74828fd3606b/src/binwalk-2.1.1/src/binwalk/modules/hashmatch.py#L209-L231 | |
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | caffe2/experiments/python/SparseTransformer.py | python | maskNallocate | (weight_name) | return weight_name + "wcsr", weight_name + "iw", weight_name + "jw" | Combine mask and weights
create wcsr, iw, jw, return their names | Combine mask and weights
create wcsr, iw, jw, return their names | [
"Combine",
"mask",
"and",
"weights",
"create",
"wcsr",
"iw",
"jw",
"return",
"their",
"names"
] | def maskNallocate(weight_name):
"""
Combine mask and weights
create wcsr, iw, jw, return their names
"""
w = workspace.FetchBlob(weight_name)
w_csr = scipy.sparse.csr_matrix(w)
wcsr = w_csr.data
iw = w_csr.indptr
jw = w_csr.indices
workspace.FeedBlob(weight_name + "wcsr", wcsr)
... | [
"def",
"maskNallocate",
"(",
"weight_name",
")",
":",
"w",
"=",
"workspace",
".",
"FetchBlob",
"(",
"weight_name",
")",
"w_csr",
"=",
"scipy",
".",
"sparse",
".",
"csr_matrix",
"(",
"w",
")",
"wcsr",
"=",
"w_csr",
".",
"data",
"iw",
"=",
"w_csr",
".",
... | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/caffe2/experiments/python/SparseTransformer.py#L57-L70 | |
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | benchmarks/operator_benchmark/benchmark_utils.py | python | numpy_random | (dtype, *shapes) | return np.random.rand(*shapes).astype(dtype) | Return a random numpy tensor of the provided dtype.
Args:
shapes: int or a sequence of ints to defining the shapes of the tensor
dtype: use the dtypes from numpy
(https://docs.scipy.org/doc/numpy/user/basics.types.html)
Return:
numpy tensor of dtype | Return a random numpy tensor of the provided dtype.
Args:
shapes: int or a sequence of ints to defining the shapes of the tensor
dtype: use the dtypes from numpy
(https://docs.scipy.org/doc/numpy/user/basics.types.html)
Return:
numpy tensor of dtype | [
"Return",
"a",
"random",
"numpy",
"tensor",
"of",
"the",
"provided",
"dtype",
".",
"Args",
":",
"shapes",
":",
"int",
"or",
"a",
"sequence",
"of",
"ints",
"to",
"defining",
"the",
"shapes",
"of",
"the",
"tensor",
"dtype",
":",
"use",
"the",
"dtypes",
"... | def numpy_random(dtype, *shapes):
""" Return a random numpy tensor of the provided dtype.
Args:
shapes: int or a sequence of ints to defining the shapes of the tensor
dtype: use the dtypes from numpy
(https://docs.scipy.org/doc/numpy/user/basics.types.html)
Re... | [
"def",
"numpy_random",
"(",
"dtype",
",",
"*",
"shapes",
")",
":",
"# TODO: consider more complex/custom dynamic ranges for",
"# comprehensive test coverage.",
"return",
"np",
".",
"random",
".",
"rand",
"(",
"*",
"shapes",
")",
".",
"astype",
"(",
"dtype",
")"
] | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/benchmarks/operator_benchmark/benchmark_utils.py#L30-L41 | |
macchina-io/macchina.io | ef24ba0e18379c3dd48fb84e6dbf991101cb8db0 | platform/JS/V8/v8/third_party/jinja2/filters.py | python | do_lower | (s) | return soft_unicode(s).lower() | Convert a value to lowercase. | Convert a value to lowercase. | [
"Convert",
"a",
"value",
"to",
"lowercase",
"."
] | def do_lower(s):
"""Convert a value to lowercase."""
return soft_unicode(s).lower() | [
"def",
"do_lower",
"(",
"s",
")",
":",
"return",
"soft_unicode",
"(",
"s",
")",
".",
"lower",
"(",
")"
] | https://github.com/macchina-io/macchina.io/blob/ef24ba0e18379c3dd48fb84e6dbf991101cb8db0/platform/JS/V8/v8/third_party/jinja2/filters.py#L134-L136 | |
lballabio/quantlib-old | 136336947ed4fea9ecc1da6edad188700e821739 | QuantLib-SWIG/Python/examples/visualization/option.mayavi.py | python | surf_regular | (source) | Now visualize the data as done in mlab. | Now visualize the data as done in mlab. | [
"Now",
"visualize",
"the",
"data",
"as",
"done",
"in",
"mlab",
"."
] | def surf_regular(source):
"""Now visualize the data as done in mlab.
"""
w = WarpScalar()
source.add_child(w)
s = Surface()
w.add_child(s) | [
"def",
"surf_regular",
"(",
"source",
")",
":",
"w",
"=",
"WarpScalar",
"(",
")",
"source",
".",
"add_child",
"(",
"w",
")",
"s",
"=",
"Surface",
"(",
")",
"w",
".",
"add_child",
"(",
"s",
")"
] | https://github.com/lballabio/quantlib-old/blob/136336947ed4fea9ecc1da6edad188700e821739/QuantLib-SWIG/Python/examples/visualization/option.mayavi.py#L65-L71 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.