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
huqinghua/pyui4win
8835b39cf6f6a78514bb263cef1033705d54c51d
Tamplate/PyFrameBase.py
python
PyFrameBase.RestoreWindow
(self)
RestoreWindow
RestoreWindow
[ "RestoreWindow" ]
def RestoreWindow(self): """ RestoreWindow """ PyWinUtils().SendMessageA(self.GetHWnd(), win32con.WM_SYSCOMMAND, win32con.SC_RESTORE, 0)
[ "def", "RestoreWindow", "(", "self", ")", ":", "PyWinUtils", "(", ")", ".", "SendMessageA", "(", "self", ".", "GetHWnd", "(", ")", ",", "win32con", ".", "WM_SYSCOMMAND", ",", "win32con", ".", "SC_RESTORE", ",", "0", ")" ]
https://github.com/huqinghua/pyui4win/blob/8835b39cf6f6a78514bb263cef1033705d54c51d/Tamplate/PyFrameBase.py#L558-L562
EOSIO/eosio.cdt
798162d323680fa6d4691bcea7928729213c7172
tools/jsoncons/build/scons/site_scons/SCutils.py
python
setup_quiet_build
(env, colorblind=False)
Will fill an SCons env object with nice colors and quiet build strings. Makes warnings evident.
Will fill an SCons env object with nice colors and quiet build strings. Makes warnings evident.
[ "Will", "fill", "an", "SCons", "env", "object", "with", "nice", "colors", "and", "quiet", "build", "strings", ".", "Makes", "warnings", "evident", "." ]
def setup_quiet_build(env, colorblind=False): """Will fill an SCons env object with nice colors and quiet build strings. Makes warnings evident.""" # colors c = dict() c['cyan'] = '\033[96m' c['purple'] = '\033[95m' c['blue'] = '\033[94m' c['bold_blue'] = '\033[94;1m' c['green'] =...
[ "def", "setup_quiet_build", "(", "env", ",", "colorblind", "=", "False", ")", ":", "# colors", "c", "=", "dict", "(", ")", "c", "[", "'cyan'", "]", "=", "'\\033[96m'", "c", "[", "'purple'", "]", "=", "'\\033[95m'", "c", "[", "'blue'", "]", "=", "'\\0...
https://github.com/EOSIO/eosio.cdt/blob/798162d323680fa6d4691bcea7928729213c7172/tools/jsoncons/build/scons/site_scons/SCutils.py#L28-L86
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/pandas/py2/pandas/core/groupby/ops.py
python
BinGrouper.get_iterator
(self, data, axis=0)
Groupby iterator Returns ------- Generator yielding sequence of (name, subsetted object) for each group
Groupby iterator
[ "Groupby", "iterator" ]
def get_iterator(self, data, axis=0): """ Groupby iterator Returns ------- Generator yielding sequence of (name, subsetted object) for each group """ if isinstance(data, NDFrame): slicer = lambda start, edge: data._slice( slice...
[ "def", "get_iterator", "(", "self", ",", "data", ",", "axis", "=", "0", ")", ":", "if", "isinstance", "(", "data", ",", "NDFrame", ")", ":", "slicer", "=", "lambda", "start", ",", "edge", ":", "data", ".", "_slice", "(", "slice", "(", "start", ",",...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/core/groupby/ops.py#L689-L713
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/pandas/py3/pandas/core/indexes/base.py
python
Index.notna
(self)
return ~self.isna()
Detect existing (non-missing) values. Return a boolean same-sized object indicating if the values are not NA. Non-missing values get mapped to ``True``. Characters such as empty strings ``''`` or :attr:`numpy.inf` are not considered NA values (unless you set ``pandas.options.mode.use_in...
Detect existing (non-missing) values.
[ "Detect", "existing", "(", "non", "-", "missing", ")", "values", "." ]
def notna(self) -> np.ndarray: """ Detect existing (non-missing) values. Return a boolean same-sized object indicating if the values are not NA. Non-missing values get mapped to ``True``. Characters such as empty strings ``''`` or :attr:`numpy.inf` are not considered NA values ...
[ "def", "notna", "(", "self", ")", "->", "np", ".", "ndarray", ":", "return", "~", "self", ".", "isna", "(", ")" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/core/indexes/base.py#L2513-L2555
chromiumembedded/cef
80caf947f3fe2210e5344713c5281d8af9bdc295
tools/cef_parser.py
python
obj_analysis.is_result_vector_ownptr
(self)
return self.result_value[0]['result_type'] == 'ownptr'
Returns true if this is a OwnPtr vector.
Returns true if this is a OwnPtr vector.
[ "Returns", "true", "if", "this", "is", "a", "OwnPtr", "vector", "." ]
def is_result_vector_ownptr(self): """ Returns true if this is a OwnPtr vector. """ return self.result_value[0]['result_type'] == 'ownptr'
[ "def", "is_result_vector_ownptr", "(", "self", ")", ":", "return", "self", ".", "result_value", "[", "0", "]", "[", "'result_type'", "]", "==", "'ownptr'" ]
https://github.com/chromiumembedded/cef/blob/80caf947f3fe2210e5344713c5281d8af9bdc295/tools/cef_parser.py#L1962-L1964
turi-code/SFrame
796b9bdfb2fa1b881d82080754643c7e68629cd2
oss_src/unity/python/sframe/data_structures/sarray.py
python
SArray.__rtruediv__
(self, other)
Divides a scalar value by each element in the array Returned array has the same type as the array on the right hand side
Divides a scalar value by each element in the array Returned array has the same type as the array on the right hand side
[ "Divides", "a", "scalar", "value", "by", "each", "element", "in", "the", "array", "Returned", "array", "has", "the", "same", "type", "as", "the", "array", "on", "the", "right", "hand", "side" ]
def __rtruediv__(self, other): """ Divides a scalar value by each element in the array Returned array has the same type as the array on the right hand side """ with cython_context(): return SArray(_proxy = self.__proxy__.right_scalar_operator(other, '/'))
[ "def", "__rtruediv__", "(", "self", ",", "other", ")", ":", "with", "cython_context", "(", ")", ":", "return", "SArray", "(", "_proxy", "=", "self", ".", "__proxy__", ".", "right_scalar_operator", "(", "other", ",", "'/'", ")", ")" ]
https://github.com/turi-code/SFrame/blob/796b9bdfb2fa1b881d82080754643c7e68629cd2/oss_src/unity/python/sframe/data_structures/sarray.py#L1116-L1122
bairdzhang/smallhardface
76fa1d87a9602d9b13d7a7fe693fc7aec91cab80
caffe/examples/pycaffe/tools.py
python
SimpleTransformer.set_scale
(self, scale)
Set the data scaling.
Set the data scaling.
[ "Set", "the", "data", "scaling", "." ]
def set_scale(self, scale): """ Set the data scaling. """ self.scale = scale
[ "def", "set_scale", "(", "self", ",", "scale", ")", ":", "self", ".", "scale", "=", "scale" ]
https://github.com/bairdzhang/smallhardface/blob/76fa1d87a9602d9b13d7a7fe693fc7aec91cab80/caffe/examples/pycaffe/tools.py#L21-L25
google/mysql-protobuf
467cda676afaa49e762c5c9164a43f6ad31a1fbf
storage/ndb/mcc/request_handler.py
python
get_cred
(body)
return (body['ssh']['user'], body['ssh']['pwd'])
Get the credentials from the message in the form of a (user, pwd) tuple. If there is no ssh object present, or keyBased is present and True, a (None, None) tuple is returned.
Get the credentials from the message in the form of a (user, pwd) tuple. If there is no ssh object present, or keyBased is present and True, a (None, None) tuple is returned.
[ "Get", "the", "credentials", "from", "the", "message", "in", "the", "form", "of", "a", "(", "user", "pwd", ")", "tuple", ".", "If", "there", "is", "no", "ssh", "object", "present", "or", "keyBased", "is", "present", "and", "True", "a", "(", "None", "...
def get_cred(body): """Get the credentials from the message in the form of a (user, pwd) tuple. If there is no ssh object present, or keyBased is present and True, a (None, None) tuple is returned.""" if not body.has_key('ssh') or util.get_val(body['ssh'], 'keyBased', False): return (None, None...
[ "def", "get_cred", "(", "body", ")", ":", "if", "not", "body", ".", "has_key", "(", "'ssh'", ")", "or", "util", ".", "get_val", "(", "body", "[", "'ssh'", "]", ",", "'keyBased'", ",", "False", ")", ":", "return", "(", "None", ",", "None", ")", "r...
https://github.com/google/mysql-protobuf/blob/467cda676afaa49e762c5c9164a43f6ad31a1fbf/storage/ndb/mcc/request_handler.py#L106-L112
apple/turicreate
cce55aa5311300e3ce6af93cb45ba791fd1bdf49
deps/src/libxml2-2.9.1/python/libxml2class.py
python
xmlNode.newProp
(self, name, value)
return __tmp
Create a new property carried by a node.
Create a new property carried by a node.
[ "Create", "a", "new", "property", "carried", "by", "a", "node", "." ]
def newProp(self, name, value): """Create a new property carried by a node. """ ret = libxml2mod.xmlNewProp(self._o, name, value) if ret is None:raise treeError('xmlNewProp() failed') __tmp = xmlAttr(_obj=ret) return __tmp
[ "def", "newProp", "(", "self", ",", "name", ",", "value", ")", ":", "ret", "=", "libxml2mod", ".", "xmlNewProp", "(", "self", ".", "_o", ",", "name", ",", "value", ")", "if", "ret", "is", "None", ":", "raise", "treeError", "(", "'xmlNewProp() failed'",...
https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/deps/src/libxml2-2.9.1/python/libxml2class.py#L2607-L2612
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
tools/cygprofile/patch_orderfile.py
python
_GroupSymbolInfosFromBinary
(binary_filename)
return _GroupSymbolInfos(symbol_infos)
Group all the symbols from a binary by name and offset. Args: binary_filename: path to the binary. Returns: A tuple of dict: (offset_to_symbol_infos, name_to_symbol_infos): - offset_to_symbol_infos: {offset: [symbol_info1, ...]} - name_to_symbol_infos: {name: [symbol_info1, ...]}
Group all the symbols from a binary by name and offset.
[ "Group", "all", "the", "symbols", "from", "a", "binary", "by", "name", "and", "offset", "." ]
def _GroupSymbolInfosFromBinary(binary_filename): """Group all the symbols from a binary by name and offset. Args: binary_filename: path to the binary. Returns: A tuple of dict: (offset_to_symbol_infos, name_to_symbol_infos): - offset_to_symbol_infos: {offset: [symbol_info1, ...]} - name_to_...
[ "def", "_GroupSymbolInfosFromBinary", "(", "binary_filename", ")", ":", "symbol_infos", "=", "symbol_extractor", ".", "SymbolInfosFromBinary", "(", "binary_filename", ")", "return", "_GroupSymbolInfos", "(", "symbol_infos", ")" ]
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/cygprofile/patch_orderfile.py#L108-L121
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
third_party/catapult/third_party/gsutil/gslib/boto_translation.py
python
BotoTranslation.XmlPassThroughSetLifecycle
(self, lifecycle_text, storage_url)
See CloudApiDelegator class for function doc strings.
See CloudApiDelegator class for function doc strings.
[ "See", "CloudApiDelegator", "class", "for", "function", "doc", "strings", "." ]
def XmlPassThroughSetLifecycle(self, lifecycle_text, storage_url): """See CloudApiDelegator class for function doc strings.""" # Parse XML document and convert into lifecycle object. if storage_url.scheme == 's3': lifecycle_obj = S3Lifecycle() else: lifecycle_obj = LifecycleConfig() h = ...
[ "def", "XmlPassThroughSetLifecycle", "(", "self", ",", "lifecycle_text", ",", "storage_url", ")", ":", "# Parse XML document and convert into lifecycle object.", "if", "storage_url", ".", "scheme", "==", "'s3'", ":", "lifecycle_obj", "=", "S3Lifecycle", "(", ")", "else"...
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/gslib/boto_translation.py#L1610-L1632
mantidproject/mantid
03deeb89254ec4289edb8771e0188c2090a02f32
qt/python/mantidqt/mantidqt/widgets/plotconfigdialog/legendtabwidget/presenter.py
python
LegendTabWidgetPresenter.check_font_in_list
(self, font)
For some reason the default matplotlib legend font isn't a system font so it's added to the font combo boxes here.
For some reason the default matplotlib legend font isn't a system font so it's added to the font combo boxes here.
[ "For", "some", "reason", "the", "default", "matplotlib", "legend", "font", "isn", "t", "a", "system", "font", "so", "it", "s", "added", "to", "the", "font", "combo", "boxes", "here", "." ]
def check_font_in_list(self, font): """For some reason the default matplotlib legend font isn't a system font so it's added to the font combo boxes here.""" if self.view.entries_font_combo_box.findText(font) == -1: self.fonts.append(font) self.fonts = sorted(self.fonts) ...
[ "def", "check_font_in_list", "(", "self", ",", "font", ")", ":", "if", "self", ".", "view", ".", "entries_font_combo_box", ".", "findText", "(", "font", ")", "==", "-", "1", ":", "self", ".", "fonts", ".", "append", "(", "font", ")", "self", ".", "fo...
https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqt/mantidqt/widgets/plotconfigdialog/legendtabwidget/presenter.py#L158-L167
apple/swift-lldb
d74be846ef3e62de946df343e8c234bde93a8912
scripts/Python/static-binding/lldb.py
python
SBTrace.StopTrace
(self, error, thread_id)
return _lldb.SBTrace_StopTrace(self, error, thread_id)
StopTrace(SBTrace self, SBError error, lldb::tid_t thread_id)
StopTrace(SBTrace self, SBError error, lldb::tid_t thread_id)
[ "StopTrace", "(", "SBTrace", "self", "SBError", "error", "lldb", "::", "tid_t", "thread_id", ")" ]
def StopTrace(self, error, thread_id): """StopTrace(SBTrace self, SBError error, lldb::tid_t thread_id)""" return _lldb.SBTrace_StopTrace(self, error, thread_id)
[ "def", "StopTrace", "(", "self", ",", "error", ",", "thread_id", ")", ":", "return", "_lldb", ".", "SBTrace_StopTrace", "(", "self", ",", "error", ",", "thread_id", ")" ]
https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/scripts/Python/static-binding/lldb.py#L12242-L12244
weolar/miniblink49
1c4678db0594a4abde23d3ebbcc7cd13c3170777
third_party/jinja2/compiler.py
python
CodeGenerator.macro_def
(self, node, frame)
Dump the macro definition for the def created by macro_body.
Dump the macro definition for the def created by macro_body.
[ "Dump", "the", "macro", "definition", "for", "the", "def", "created", "by", "macro_body", "." ]
def macro_def(self, node, frame): """Dump the macro definition for the def created by macro_body.""" arg_tuple = ', '.join(repr(x.name) for x in node.args) name = getattr(node, 'name', None) if len(node.args) == 1: arg_tuple += ',' self.write('Macro(environment, macro...
[ "def", "macro_def", "(", "self", ",", "node", ",", "frame", ")", ":", "arg_tuple", "=", "', '", ".", "join", "(", "repr", "(", "x", ".", "name", ")", "for", "x", "in", "node", ".", "args", ")", "name", "=", "getattr", "(", "node", ",", "'name'", ...
https://github.com/weolar/miniblink49/blob/1c4678db0594a4abde23d3ebbcc7cd13c3170777/third_party/jinja2/compiler.py#L731-L746
oracle/graaljs
36a56e8e993d45fc40939a3a4d9c0c24990720f1
graal-nodejs/tools/gyp/pylib/gyp/generator/msvs.py
python
_EscapeVCProjCommandLineArgListItem
(s)
return s
Escapes command line arguments for MSVS. The VCProj format stores string lists in a single string using commas and semi-colons as separators, which must be quoted if they are to be interpreted literally. However, command-line arguments may already have quotes, and the VCProj parser is ignorant of the backslash...
Escapes command line arguments for MSVS.
[ "Escapes", "command", "line", "arguments", "for", "MSVS", "." ]
def _EscapeVCProjCommandLineArgListItem(s): """Escapes command line arguments for MSVS. The VCProj format stores string lists in a single string using commas and semi-colons as separators, which must be quoted if they are to be interpreted literally. However, command-line arguments may already have quotes,...
[ "def", "_EscapeVCProjCommandLineArgListItem", "(", "s", ")", ":", "def", "_Replace", "(", "match", ")", ":", "# For a non-literal quote, CommandLineToArgv requires an even number of", "# backslashes preceding it, and it produces half as many literal", "# backslashes. So we need to produc...
https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/tools/gyp/pylib/gyp/generator/msvs.py#L795-L841
benoitsteiner/tensorflow-opencl
cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5
tensorflow/python/ops/data_flow_ops.py
python
Barrier.incomplete_size
(self, name=None)
return gen_data_flow_ops._barrier_incomplete_size( self._barrier_ref, name=name)
Compute the number of incomplete elements in the given barrier. Args: name: A name for the operation (optional). Returns: A single-element tensor containing the number of incomplete elements in the given barrier.
Compute the number of incomplete elements in the given barrier.
[ "Compute", "the", "number", "of", "incomplete", "elements", "in", "the", "given", "barrier", "." ]
def incomplete_size(self, name=None): """Compute the number of incomplete elements in the given barrier. Args: name: A name for the operation (optional). Returns: A single-element tensor containing the number of incomplete elements in the given barrier. """ if name is None: ...
[ "def", "incomplete_size", "(", "self", ",", "name", "=", "None", ")", ":", "if", "name", "is", "None", ":", "name", "=", "\"%s_BarrierIncompleteSize\"", "%", "self", ".", "_name", "return", "gen_data_flow_ops", ".", "_barrier_incomplete_size", "(", "self", "."...
https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/ops/data_flow_ops.py#L1067-L1080
bareos/bareos
56a10bb368b0a81e977bb51304033fe49d59efb0
core/src/plugins/stored/python/pyfiles/BareosSdPluginBaseclass.py
python
BareosSdPluginBaseclass.parse_plugin_definition
(self, plugindef)
return bareossd.bRC_OK
Called with the plugin options from the bareos configfiles You should overload this method with your own and do option checking here, return bRCs['bRC_Error'], if options are not ok or better call super.parse_plugin_definition in your own class and make sanity check on self.options after...
Called with the plugin options from the bareos configfiles You should overload this method with your own and do option checking here, return bRCs['bRC_Error'], if options are not ok or better call super.parse_plugin_definition in your own class and make sanity check on self.options after...
[ "Called", "with", "the", "plugin", "options", "from", "the", "bareos", "configfiles", "You", "should", "overload", "this", "method", "with", "your", "own", "and", "do", "option", "checking", "here", "return", "bRCs", "[", "bRC_Error", "]", "if", "options", "...
def parse_plugin_definition(self, plugindef): """ Called with the plugin options from the bareos configfiles You should overload this method with your own and do option checking here, return bRCs['bRC_Error'], if options are not ok or better call super.parse_plugin_definition in ...
[ "def", "parse_plugin_definition", "(", "self", ",", "plugindef", ")", ":", "bareossd", ".", "DebugMessage", "(", "100", ",", "\"plugin def parser called with %s\\n\"", "%", "(", "plugindef", ")", ")", "# Parse plugin options into a dict", "self", ".", "options", "=", ...
https://github.com/bareos/bareos/blob/56a10bb368b0a81e977bb51304033fe49d59efb0/core/src/plugins/stored/python/pyfiles/BareosSdPluginBaseclass.py#L62-L81
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/cli/cmdoptions.py
python
check_install_build_global
(options, check_options=None)
Disable wheels if per-setup.py call options are set. :param options: The OptionParser options to update. :param check_options: The options to check, if not supplied defaults to options.
Disable wheels if per-setup.py call options are set.
[ "Disable", "wheels", "if", "per", "-", "setup", ".", "py", "call", "options", "are", "set", "." ]
def check_install_build_global(options, check_options=None): # type: (Values, Optional[Values]) -> None """Disable wheels if per-setup.py call options are set. :param options: The OptionParser options to update. :param check_options: The options to check, if not supplied defaults to options. ...
[ "def", "check_install_build_global", "(", "options", ",", "check_options", "=", "None", ")", ":", "# type: (Values, Optional[Values]) -> None", "if", "check_options", "is", "None", ":", "check_options", "=", "options", "def", "getname", "(", "n", ")", ":", "# type: ...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/cli/cmdoptions.py#L67-L88
benoitsteiner/tensorflow-opencl
cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5
tensorflow/python/profiler/option_builder.py
python
ProfileOptionBuilder.build
(self)
return copy.deepcopy(self._options)
Build a profiling option. Returns: A dict of profiling options.
Build a profiling option.
[ "Build", "a", "profiling", "option", "." ]
def build(self): """Build a profiling option. Returns: A dict of profiling options. """ return copy.deepcopy(self._options)
[ "def", "build", "(", "self", ")", ":", "return", "copy", ".", "deepcopy", "(", "self", ".", "_options", ")" ]
https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/profiler/option_builder.py#L191-L197
deepmind/open_spiel
4ca53bea32bb2875c7385d215424048ae92f78c8
open_spiel/python/algorithms/deep_cfr_tf2.py
python
DeepCFRSolver._reinitialize_policy_network
(self)
Reinitalize policy network and optimizer for training.
Reinitalize policy network and optimizer for training.
[ "Reinitalize", "policy", "network", "and", "optimizer", "for", "training", "." ]
def _reinitialize_policy_network(self): """Reinitalize policy network and optimizer for training.""" with tf.device(self._train_device): self._policy_network = PolicyNetwork(self._embedding_size, self._policy_network_layers, ...
[ "def", "_reinitialize_policy_network", "(", "self", ")", ":", "with", "tf", ".", "device", "(", "self", ".", "_train_device", ")", ":", "self", ".", "_policy_network", "=", "PolicyNetwork", "(", "self", ".", "_embedding_size", ",", "self", ".", "_policy_networ...
https://github.com/deepmind/open_spiel/blob/4ca53bea32bb2875c7385d215424048ae92f78c8/open_spiel/python/algorithms/deep_cfr_tf2.py#L376-L384
ceph/ceph
959663007321a369c83218414a29bd9dbc8bda3a
qa/tasks/mon_thrash.py
python
MonitorThrasher.should_thrash_store
(self)
return self.rng.randrange(0, 101) < self.store_thrash_probability
If allowed, indicate that we should thrash a certain percentage of the time as determined by the store_thrash_probability value.
If allowed, indicate that we should thrash a certain percentage of the time as determined by the store_thrash_probability value.
[ "If", "allowed", "indicate", "that", "we", "should", "thrash", "a", "certain", "percentage", "of", "the", "time", "as", "determined", "by", "the", "store_thrash_probability", "value", "." ]
def should_thrash_store(self): """ If allowed, indicate that we should thrash a certain percentage of the time as determined by the store_thrash_probability value. """ if not self.store_thrash: return False return self.rng.randrange(0, 101) < self.store_thrash...
[ "def", "should_thrash_store", "(", "self", ")", ":", "if", "not", "self", ".", "store_thrash", ":", "return", "False", "return", "self", ".", "rng", ".", "randrange", "(", "0", ",", "101", ")", "<", "self", ".", "store_thrash_probability" ]
https://github.com/ceph/ceph/blob/959663007321a369c83218414a29bd9dbc8bda3a/qa/tasks/mon_thrash.py#L158-L165
ApolloAuto/apollo-platform
86d9dc6743b496ead18d597748ebabd34a513289
ros/third_party/lib_x86_64/python2.7/dist-packages/yaml/__init__.py
python
serialize_all
(nodes, stream=None, Dumper=Dumper, canonical=None, indent=None, width=None, allow_unicode=None, line_break=None, encoding='utf-8', explicit_start=None, explicit_end=None, version=None, tags=None)
Serialize a sequence of representation trees into a YAML stream. If stream is None, return the produced string instead.
Serialize a sequence of representation trees into a YAML stream. If stream is None, return the produced string instead.
[ "Serialize", "a", "sequence", "of", "representation", "trees", "into", "a", "YAML", "stream", ".", "If", "stream", "is", "None", "return", "the", "produced", "string", "instead", "." ]
def serialize_all(nodes, stream=None, Dumper=Dumper, canonical=None, indent=None, width=None, allow_unicode=None, line_break=None, encoding='utf-8', explicit_start=None, explicit_end=None, version=None, tags=None): """ Serialize a sequence of representation trees into a YAML stre...
[ "def", "serialize_all", "(", "nodes", ",", "stream", "=", "None", ",", "Dumper", "=", "Dumper", ",", "canonical", "=", "None", ",", "indent", "=", "None", ",", "width", "=", "None", ",", "allow_unicode", "=", "None", ",", "line_break", "=", "None", ","...
https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/yaml/__init__.py#L125-L154
lammps/lammps
b75c3065430a75b1b5543a10e10f46d9b4c91913
python/lammps/pylammps.py
python
AtomList.__getitem__
(self, index)
return self._loaded[index]
Return Atom with given local index :param index: Local index of atom :type index: int :rtype: Atom or Atom2D
Return Atom with given local index
[ "Return", "Atom", "with", "given", "local", "index" ]
def __getitem__(self, index): """ Return Atom with given local index :param index: Local index of atom :type index: int :rtype: Atom or Atom2D """ if index not in self._loaded: if self.dimensions == 2: atom = Atom2D(self._pylmp, index) else: atom = At...
[ "def", "__getitem__", "(", "self", ",", "index", ")", ":", "if", "index", "not", "in", "self", ".", "_loaded", ":", "if", "self", ".", "dimensions", "==", "2", ":", "atom", "=", "Atom2D", "(", "self", ".", "_pylmp", ",", "index", ")", "else", ":", ...
https://github.com/lammps/lammps/blob/b75c3065430a75b1b5543a10e10f46d9b4c91913/python/lammps/pylammps.py#L102-L116
PaddlePaddle/Paddle
1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c
python/paddle/fluid/incubate/fleet/parameter_server/pslib/__init__.py
python
_prepare_params
(input, size, is_sparse=False, is_distributed=False, padding_idx=None, param_attr=None, dtype='float32')
preprocess params, this interface is not for users. Args: input(Variable|list of Variable): Input is a Tensor<int64> Variable size(list of int): the embedding dim is_sparse(bool): whether input is sparse ids is_distributed(bool): whether in distributed mode padding_idx(int): ...
preprocess params, this interface is not for users. Args: input(Variable|list of Variable): Input is a Tensor<int64> Variable size(list of int): the embedding dim is_sparse(bool): whether input is sparse ids is_distributed(bool): whether in distributed mode padding_idx(int): ...
[ "preprocess", "params", "this", "interface", "is", "not", "for", "users", ".", "Args", ":", "input", "(", "Variable|list", "of", "Variable", ")", ":", "Input", "is", "a", "Tensor<int64", ">", "Variable", "size", "(", "list", "of", "int", ")", ":", "the",...
def _prepare_params(input, size, is_sparse=False, is_distributed=False, padding_idx=None, param_attr=None, dtype='float32'): """ preprocess params, this interface is not for users. Args: ...
[ "def", "_prepare_params", "(", "input", ",", "size", ",", "is_sparse", "=", "False", ",", "is_distributed", "=", "False", ",", "padding_idx", "=", "None", ",", "param_attr", "=", "None", ",", "dtype", "=", "'float32'", ")", ":", "if", "param_attr", "is", ...
https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/fluid/incubate/fleet/parameter_server/pslib/__init__.py#L809-L867
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
third_party/catapult/telemetry/third_party/altgraph/altgraph/Graph.py
python
Graph.number_of_edges
(self)
return len(self.edges)
Returns the number of edges
Returns the number of edges
[ "Returns", "the", "number", "of", "edges" ]
def number_of_edges(self): """ Returns the number of edges """ return len(self.edges)
[ "def", "number_of_edges", "(", "self", ")", ":", "return", "len", "(", "self", ".", "edges", ")" ]
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/third_party/altgraph/altgraph/Graph.py#L224-L228
thalium/icebox
99d147d5b9269222225443ce171b4fd46d8985d4
third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2class.py
python
xmlTextReader.Setup
(self, input, URL, encoding, options)
return ret
Setup an XML reader with new options
Setup an XML reader with new options
[ "Setup", "an", "XML", "reader", "with", "new", "options" ]
def Setup(self, input, URL, encoding, options): """Setup an XML reader with new options """ if input is None: input__o = None else: input__o = input._o ret = libxml2mod.xmlTextReaderSetup(self._o, input__o, URL, encoding, options) return ret
[ "def", "Setup", "(", "self", ",", "input", ",", "URL", ",", "encoding", ",", "options", ")", ":", "if", "input", "is", "None", ":", "input__o", "=", "None", "else", ":", "input__o", "=", "input", ".", "_o", "ret", "=", "libxml2mod", ".", "xmlTextRead...
https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2class.py#L6137-L6142
freesurfer/freesurfer
6dbe527d43ffa611acb2cd112e9469f9bfec8e36
deeplearn_utils/unet_model.py
python
compute_level_output_shape
(filters, depth, pool_size, image_shape)
return tuple([None, filters] + [int(x) for x in output_image_shape])
Each level has a particular output shape based on the number of filters used in that level and the depth or number of max pooling operations that have been done on the data at that point. :param image_shape: shape of the 3d image. :param pool_size: the pool_size parameter used in the max pooling operation. ...
Each level has a particular output shape based on the number of filters used in that level and the depth or number of max pooling operations that have been done on the data at that point. :param image_shape: shape of the 3d image. :param pool_size: the pool_size parameter used in the max pooling operation. ...
[ "Each", "level", "has", "a", "particular", "output", "shape", "based", "on", "the", "number", "of", "filters", "used", "in", "that", "level", "and", "the", "depth", "or", "number", "of", "max", "pooling", "operations", "that", "have", "been", "done", "on",...
def compute_level_output_shape(filters, depth, pool_size, image_shape): """ Each level has a particular output shape based on the number of filters used in that level and the depth or number of max pooling operations that have been done on the data at that point. :param image_shape: shape of the 3d imag...
[ "def", "compute_level_output_shape", "(", "filters", ",", "depth", ",", "pool_size", ",", "image_shape", ")", ":", "if", "depth", "!=", "0", ":", "output_image_shape", "=", "np", ".", "divide", "(", "image_shape", ",", "np", ".", "multiply", "(", "pool_size"...
https://github.com/freesurfer/freesurfer/blob/6dbe527d43ffa611acb2cd112e9469f9bfec8e36/deeplearn_utils/unet_model.py#L132-L146
gem5/gem5
141cc37c2d4b93959d4c249b8f7e6a8b2ef75338
ext/ply/example/ansic/cparse.py
python
p_init_declarator_1
(t)
init_declarator : declarator
init_declarator : declarator
[ "init_declarator", ":", "declarator" ]
def p_init_declarator_1(t): 'init_declarator : declarator' pass
[ "def", "p_init_declarator_1", "(", "t", ")", ":", "pass" ]
https://github.com/gem5/gem5/blob/141cc37c2d4b93959d4c249b8f7e6a8b2ef75338/ext/ply/example/ansic/cparse.py#L173-L175
PX4/PX4-Autopilot
0b9f60a0370be53d683352c63fd92db3d6586e18
Tools/mavlink_px4.py
python
MAVLink.attitude_encode
(self, time_boot_ms, roll, pitch, yaw, rollspeed, pitchspeed, yawspeed)
return msg
The attitude in the aeronautical frame (right-handed, Z-down, X-front, Y-right). time_boot_ms : Timestamp (milliseconds since system boot) (uint32_t) roll : Roll angle (rad, -pi..+pi) (float) pitch : P...
The attitude in the aeronautical frame (right-handed, Z-down, X-front, Y-right).
[ "The", "attitude", "in", "the", "aeronautical", "frame", "(", "right", "-", "handed", "Z", "-", "down", "X", "-", "front", "Y", "-", "right", ")", "." ]
def attitude_encode(self, time_boot_ms, roll, pitch, yaw, rollspeed, pitchspeed, yawspeed): ''' The attitude in the aeronautical frame (right-handed, Z-down, X-front, Y-right). time_boot_ms : Timestamp (milliseconds since system boot) (uint32...
[ "def", "attitude_encode", "(", "self", ",", "time_boot_ms", ",", "roll", ",", "pitch", ",", "yaw", ",", "rollspeed", ",", "pitchspeed", ",", "yawspeed", ")", ":", "msg", "=", "MAVLink_attitude_message", "(", "time_boot_ms", ",", "roll", ",", "pitch", ",", ...
https://github.com/PX4/PX4-Autopilot/blob/0b9f60a0370be53d683352c63fd92db3d6586e18/Tools/mavlink_px4.py#L3043-L3059
KratosMultiphysics/Kratos
0000833054ed0503424eb28205d6508d9ca6cbbc
applications/MultilevelMonteCarloApplication/external_libraries/XMC/xmc/classDefs_solverWrapper/KratosSolverWrapper.py
python
KratosSolverWrapper.executeInstanceStochasticAdaptiveRefinement
(self,random_variable)
return qoi,time_for_qoi
Method executing an instance of the UQ algorithm, i.e. a single MC realization and eventually the refinement (that occurs before the simulation run). To be called if the selected refinement strategy is stochastic_adaptive_refinement. Inputs: random_variable: list. Random event in the form ...
Method executing an instance of the UQ algorithm, i.e. a single MC realization and eventually the refinement (that occurs before the simulation run). To be called if the selected refinement strategy is stochastic_adaptive_refinement.
[ "Method", "executing", "an", "instance", "of", "the", "UQ", "algorithm", "i", ".", "e", ".", "a", "single", "MC", "realization", "and", "eventually", "the", "refinement", "(", "that", "occurs", "before", "the", "simulation", "run", ")", ".", "To", "be", ...
def executeInstanceStochasticAdaptiveRefinement(self,random_variable): """ Method executing an instance of the UQ algorithm, i.e. a single MC realization and eventually the refinement (that occurs before the simulation run). To be called if the selected refinement strategy is stochastic_adaptive_refinem...
[ "def", "executeInstanceStochasticAdaptiveRefinement", "(", "self", ",", "random_variable", ")", ":", "# local variables", "current_index", "=", "self", ".", "solverWrapperIndex", "[", "0", "]", "pickled_coarse_model", "=", "self", ".", "pickled_model", "[", "0", "]", ...
https://github.com/KratosMultiphysics/Kratos/blob/0000833054ed0503424eb28205d6508d9ca6cbbc/applications/MultilevelMonteCarloApplication/external_libraries/XMC/xmc/classDefs_solverWrapper/KratosSolverWrapper.py#L246-L312
apple/turicreate
cce55aa5311300e3ce6af93cb45ba791fd1bdf49
src/python/turicreate/data_structures/sarray.py
python
SArray.where
(cls, condition, istrue, isfalse, dtype=None)
return cls( _proxy=condition.__proxy__.ternary_operator( istrue.__proxy__, isfalse.__proxy__ ) )
Selects elements from either istrue or isfalse depending on the value of the condition SArray. Parameters ---------- condition : SArray An SArray of values such that for each value, if non-zero, yields a value from istrue, otherwise from isfalse. istrue : SArray...
Selects elements from either istrue or isfalse depending on the value of the condition SArray.
[ "Selects", "elements", "from", "either", "istrue", "or", "isfalse", "depending", "on", "the", "value", "of", "the", "condition", "SArray", "." ]
def where(cls, condition, istrue, isfalse, dtype=None): """ Selects elements from either istrue or isfalse depending on the value of the condition SArray. Parameters ---------- condition : SArray An SArray of values such that for each value, if non-zero, yields a...
[ "def", "where", "(", "cls", ",", "condition", ",", "istrue", ",", "isfalse", ",", "dtype", "=", "None", ")", ":", "true_is_sarray", "=", "isinstance", "(", "istrue", ",", "SArray", ")", "false_is_sarray", "=", "isinstance", "(", "isfalse", ",", "SArray", ...
https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/python/turicreate/data_structures/sarray.py#L682-L770
google/or-tools
2cb85b4eead4c38e1c54b48044f92087cf165bce
ortools/constraint_solver/doc/routing_svg.py
python
DataModel.depot
(self)
return self._depot
Gets the depot node index.
Gets the depot node index.
[ "Gets", "the", "depot", "node", "index", "." ]
def depot(self): """Gets the depot node index.""" return self._depot
[ "def", "depot", "(", "self", ")", ":", "return", "self", ".", "_depot" ]
https://github.com/google/or-tools/blob/2cb85b4eead4c38e1c54b48044f92087cf165bce/ortools/constraint_solver/doc/routing_svg.py#L234-L236
Yelp/MOE
5b5a6a2c6c3cf47320126f7f5894e2a83e347f5c
moe/easy_interface/experiment.py
python
Experiment.build_json_payload
(self)
return { 'domain_info': self.domain.get_json_serializable_info(), 'gp_historical_info': self.historical_data.json_payload(), }
Construct a json serializeable and MOE REST recognizeable dictionary of the experiment.
Construct a json serializeable and MOE REST recognizeable dictionary of the experiment.
[ "Construct", "a", "json", "serializeable", "and", "MOE", "REST", "recognizeable", "dictionary", "of", "the", "experiment", "." ]
def build_json_payload(self): """Construct a json serializeable and MOE REST recognizeable dictionary of the experiment.""" return { 'domain_info': self.domain.get_json_serializable_info(), 'gp_historical_info': self.historical_data.json_payload(), }
[ "def", "build_json_payload", "(", "self", ")", ":", "return", "{", "'domain_info'", ":", "self", ".", "domain", ".", "get_json_serializable_info", "(", ")", ",", "'gp_historical_info'", ":", "self", ".", "historical_data", ".", "json_payload", "(", ")", ",", "...
https://github.com/Yelp/MOE/blob/5b5a6a2c6c3cf47320126f7f5894e2a83e347f5c/moe/easy_interface/experiment.py#L35-L40
benoitsteiner/tensorflow-opencl
cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5
tensorflow/contrib/rnn/python/ops/lstm_ops.py
python
LSTMBlockCell.__init__
(self, num_units, forget_bias=1.0, cell_clip=None, use_peephole=False, reuse=None)
Initialize the basic LSTM cell. Args: num_units: int, The number of units in the LSTM cell. forget_bias: float, The bias added to forget gates (see above). cell_clip: An optional `float`. Defaults to `-1` (no clipping). use_peephole: Whether to use peephole connections or not. reuse: ...
Initialize the basic LSTM cell.
[ "Initialize", "the", "basic", "LSTM", "cell", "." ]
def __init__(self, num_units, forget_bias=1.0, cell_clip=None, use_peephole=False, reuse=None): """Initialize the basic LSTM cell. Args: num_units: int, The number of units in the LSTM cell. forget_bias: float, The bias adde...
[ "def", "__init__", "(", "self", ",", "num_units", ",", "forget_bias", "=", "1.0", ",", "cell_clip", "=", "None", ",", "use_peephole", "=", "False", ",", "reuse", "=", "None", ")", ":", "super", "(", "LSTMBlockCell", ",", "self", ")", ".", "__init__", "...
https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/rnn/python/ops/lstm_ops.py#L343-L375
netket/netket
0d534e54ecbf25b677ea72af6b85947979420652
netket/hilbert/continuous_hilbert.py
python
ContinuousHilbert.__init__
(self, domain: Tuple[float, ...], pbc: Union[bool, Tuple[bool, ...]])
Constructs new ``Particles`` given specifications of the continuous space they are defined in. Args: domain: range of the continuous quantum numbers
Constructs new ``Particles`` given specifications of the continuous space they are defined in.
[ "Constructs", "new", "Particles", "given", "specifications", "of", "the", "continuous", "space", "they", "are", "defined", "in", "." ]
def __init__(self, domain: Tuple[float, ...], pbc: Union[bool, Tuple[bool, ...]]): """ Constructs new ``Particles`` given specifications of the continuous space they are defined in. Args: domain: range of the continuous quantum numbers """ self._extent = dom...
[ "def", "__init__", "(", "self", ",", "domain", ":", "Tuple", "[", "float", ",", "...", "]", ",", "pbc", ":", "Union", "[", "bool", ",", "Tuple", "[", "bool", ",", "...", "]", "]", ")", ":", "self", ".", "_extent", "=", "domain", "self", ".", "_...
https://github.com/netket/netket/blob/0d534e54ecbf25b677ea72af6b85947979420652/netket/hilbert/continuous_hilbert.py#L27-L41
okex/V3-Open-API-SDK
c5abb0db7e2287718e0055e17e57672ce0ec7fd9
okex-python-sdk-api/venv/Lib/site-packages/pip-19.0.3-py3.8.egg/pip/_vendor/distlib/_backport/tarfile.py
python
TarFile.extractfile
(self, member)
Extract a member from the archive as a file object. `member' may be a filename or a TarInfo object. If `member' is a regular file, a file-like object is returned. If `member' is a link, a file-like object is constructed from the link's target. If `member' is none of the above...
Extract a member from the archive as a file object. `member' may be a filename or a TarInfo object. If `member' is a regular file, a file-like object is returned. If `member' is a link, a file-like object is constructed from the link's target. If `member' is none of the above...
[ "Extract", "a", "member", "from", "the", "archive", "as", "a", "file", "object", ".", "member", "may", "be", "a", "filename", "or", "a", "TarInfo", "object", ".", "If", "member", "is", "a", "regular", "file", "a", "file", "-", "like", "object", "is", ...
def extractfile(self, member): """Extract a member from the archive as a file object. `member' may be a filename or a TarInfo object. If `member' is a regular file, a file-like object is returned. If `member' is a link, a file-like object is constructed from the link's target. I...
[ "def", "extractfile", "(", "self", ",", "member", ")", ":", "self", ".", "_check", "(", "\"r\"", ")", "if", "isinstance", "(", "member", ",", "str", ")", ":", "tarinfo", "=", "self", ".", "getmember", "(", "member", ")", "else", ":", "tarinfo", "=", ...
https://github.com/okex/V3-Open-API-SDK/blob/c5abb0db7e2287718e0055e17e57672ce0ec7fd9/okex-python-sdk-api/venv/Lib/site-packages/pip-19.0.3-py3.8.egg/pip/_vendor/distlib/_backport/tarfile.py#L2199-L2235
esa/pagmo
80281d549c8f1b470e1489a5d37c8f06b2e429c0
PyGMO/problem/_pl2pl.py
python
py_pl2pl.pretty
(self, x)
Decodes the decision vector x
Decodes the decision vector x
[ "Decodes", "the", "decision", "vector", "x" ]
def pretty(self, x): """Decodes the decision vector x""" import PyKEP start = PyKEP.epoch(x[0]) end = PyKEP.epoch(x[0] + x[1]) r, v = self.__departure.eph(start) v_list = list(v) v_list[0] += x[3] v_list[1] += x[4] v_list[2] += x[5] x0 = Py...
[ "def", "pretty", "(", "self", ",", "x", ")", ":", "import", "PyKEP", "start", "=", "PyKEP", ".", "epoch", "(", "x", "[", "0", "]", ")", "end", "=", "PyKEP", ".", "epoch", "(", "x", "[", "0", "]", "+", "x", "[", "1", "]", ")", "r", ",", "v...
https://github.com/esa/pagmo/blob/80281d549c8f1b470e1489a5d37c8f06b2e429c0/PyGMO/problem/_pl2pl.py#L134-L153
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/gtk/stc.py
python
StyledTextEvent.SetLength
(*args, **kwargs)
return _stc.StyledTextEvent_SetLength(*args, **kwargs)
SetLength(self, int len)
SetLength(self, int len)
[ "SetLength", "(", "self", "int", "len", ")" ]
def SetLength(*args, **kwargs): """SetLength(self, int len)""" return _stc.StyledTextEvent_SetLength(*args, **kwargs)
[ "def", "SetLength", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_stc", ".", "StyledTextEvent_SetLength", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/stc.py#L7046-L7048
FreeCAD/FreeCAD
ba42231b9c6889b89e064d6d563448ed81e376ec
src/Mod/Draft/draftguitools/gui_base_original.py
python
DraftTool.commit
(self, name, func)
Store actions in the commit list to be run later. Parameters ---------- name: str An arbitrary string that indicates the name of the operation to run. func: list of str Each element of the list is a string that will be run by `Gui.doComma...
Store actions in the commit list to be run later.
[ "Store", "actions", "in", "the", "commit", "list", "to", "be", "run", "later", "." ]
def commit(self, name, func): """Store actions in the commit list to be run later. Parameters ---------- name: str An arbitrary string that indicates the name of the operation to run. func: list of str Each element of the list is a string tha...
[ "def", "commit", "(", "self", ",", "name", ",", "func", ")", ":", "self", ".", "commitList", ".", "append", "(", "(", "name", ",", "func", ")", ")" ]
https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Draft/draftguitools/gui_base_original.py#L197-L212
daijifeng001/caffe-rfcn
543f8f6a4b7c88256ea1445ae951a12d1ad9cffd
python/caffe/pycaffe.py
python
_Net_forward_backward_all
(self, blobs=None, diffs=None, **kwargs)
return all_outs, all_diffs
Run net forward + backward in batches. Parameters ---------- blobs: list of blobs to extract as in forward() diffs: list of diffs to extract as in backward() kwargs: Keys are input (for forward) and output (for backward) blob names and values are ndarrays. Refer to forward() and backwar...
Run net forward + backward in batches.
[ "Run", "net", "forward", "+", "backward", "in", "batches", "." ]
def _Net_forward_backward_all(self, blobs=None, diffs=None, **kwargs): """ Run net forward + backward in batches. Parameters ---------- blobs: list of blobs to extract as in forward() diffs: list of diffs to extract as in backward() kwargs: Keys are input (for forward) and output (for backw...
[ "def", "_Net_forward_backward_all", "(", "self", ",", "blobs", "=", "None", ",", "diffs", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# Batch blobs and diffs.", "all_outs", "=", "{", "out", ":", "[", "]", "for", "out", "in", "set", "(", "self", "....
https://github.com/daijifeng001/caffe-rfcn/blob/543f8f6a4b7c88256ea1445ae951a12d1ad9cffd/python/caffe/pycaffe.py#L206-L248
wlanjie/AndroidFFmpeg
7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf
tools/fdk-aac-build/x86/toolchain/lib/python2.7/plat-mac/findertools.py
python
Print
(file)
return finder._print(fss)
Print a file thru the finder. Specify file by name or fsspec
Print a file thru the finder. Specify file by name or fsspec
[ "Print", "a", "file", "thru", "the", "finder", ".", "Specify", "file", "by", "name", "or", "fsspec" ]
def Print(file): """Print a file thru the finder. Specify file by name or fsspec""" finder = _getfinder() fss = Carbon.File.FSSpec(file) return finder._print(fss)
[ "def", "Print", "(", "file", ")", ":", "finder", "=", "_getfinder", "(", ")", "fss", "=", "Carbon", ".", "File", ".", "FSSpec", "(", "file", ")", "return", "finder", ".", "_print", "(", "fss", ")" ]
https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/plat-mac/findertools.py#L51-L55
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
wx/tools/Editra/src/extern/aui/auibar.py
python
AuiToolBar.AddSimpleTool
(self, tool_id, label, bitmap, short_help_string="", kind=ITEM_NORMAL, target=None)
return self.AddTool(tool_id, label, bitmap, wx.NullBitmap, kind, short_help_string, "", None, target)
Adds a tool to the toolbar. This is the simplest method you can use to ass an item to the :class:`AuiToolBar`. :param integer `tool_id`: an integer by which the tool may be identified in subsequent operations; :param string `label`: the toolbar tool label; :param Bitmap `bitmap`: the pr...
Adds a tool to the toolbar. This is the simplest method you can use to ass an item to the :class:`AuiToolBar`.
[ "Adds", "a", "tool", "to", "the", "toolbar", ".", "This", "is", "the", "simplest", "method", "you", "can", "use", "to", "ass", "an", "item", "to", "the", ":", "class", ":", "AuiToolBar", "." ]
def AddSimpleTool(self, tool_id, label, bitmap, short_help_string="", kind=ITEM_NORMAL, target=None): """ Adds a tool to the toolbar. This is the simplest method you can use to ass an item to the :class:`AuiToolBar`. :param integer `tool_id`: an integer by which the tool may be identifi...
[ "def", "AddSimpleTool", "(", "self", ",", "tool_id", ",", "label", ",", "bitmap", ",", "short_help_string", "=", "\"\"", ",", "kind", "=", "ITEM_NORMAL", ",", "target", "=", "None", ")", ":", "return", "self", ".", "AddTool", "(", "tool_id", ",", "label"...
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/extern/aui/auibar.py#L1719-L1746
seqan/seqan
f5f658343c366c9c3d44ba358ffc9317e78a09ed
apps/ngs_roi/tool_shed/ctd2galaxy.py
python
main
()
return 0
Main function.
Main function.
[ "Main", "function", "." ]
def main(): """Main function.""" # Setup argument parser. parser = argparse.ArgumentParser(description='Convert CTD to Galaxy XML') parser.add_argument('-i', '--in-file', metavar='FILE', help='CTD file to read.', dest='in_file', required=True) parser.a...
[ "def", "main", "(", ")", ":", "# Setup argument parser.", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "'Convert CTD to Galaxy XML'", ")", "parser", ".", "add_argument", "(", "'-i'", ",", "'--in-file'", ",", "metavar", "=", "'FILE'", ...
https://github.com/seqan/seqan/blob/f5f658343c366c9c3d44ba358ffc9317e78a09ed/apps/ngs_roi/tool_shed/ctd2galaxy.py#L575-L602
benoitsteiner/tensorflow-opencl
cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5
tensorflow/contrib/nccl/python/ops/nccl_ops.py
python
all_prod
(tensors)
return _apply_all_reduce('prod', tensors)
Returns a list of tensors with the all-reduce product across `tensors`. The computation is done with an all-reduce operation, so if only some of the returned tensors are evaluated then the computation will hang. Args: tensors: The input tensors across which to multiply; must be assigned to GPU devices...
Returns a list of tensors with the all-reduce product across `tensors`.
[ "Returns", "a", "list", "of", "tensors", "with", "the", "all", "-", "reduce", "product", "across", "tensors", "." ]
def all_prod(tensors): """Returns a list of tensors with the all-reduce product across `tensors`. The computation is done with an all-reduce operation, so if only some of the returned tensors are evaluated then the computation will hang. Args: tensors: The input tensors across which to multiply; must be a...
[ "def", "all_prod", "(", "tensors", ")", ":", "return", "_apply_all_reduce", "(", "'prod'", ",", "tensors", ")" ]
https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/nccl/python/ops/nccl_ops.py#L79-L93
redpony/cdec
f7c4899b174d86bc70b40b1cae68dcad364615cb
python/cdec/configobj.py
python
Section.walk
(self, function, raise_errors=True, call_on_sections=False, **keywargs)
return out
Walk every member and call a function on the keyword and value. Return a dictionary of the return values If the function raises an exception, raise the errror unless ``raise_errors=False``, in which case set the return value to ``False``. Any unrecognis...
Walk every member and call a function on the keyword and value. Return a dictionary of the return values If the function raises an exception, raise the errror unless ``raise_errors=False``, in which case set the return value to ``False``. Any unrecognis...
[ "Walk", "every", "member", "and", "call", "a", "function", "on", "the", "keyword", "and", "value", ".", "Return", "a", "dictionary", "of", "the", "return", "values", "If", "the", "function", "raises", "an", "exception", "raise", "the", "errror", "unless", ...
def walk(self, function, raise_errors=True, call_on_sections=False, **keywargs): """ Walk every member and call a function on the keyword and value. Return a dictionary of the return values If the function raises an exception, raise the errror unless...
[ "def", "walk", "(", "self", ",", "function", ",", "raise_errors", "=", "True", ",", "call_on_sections", "=", "False", ",", "*", "*", "keywargs", ")", ":", "out", "=", "{", "}", "# scalars first", "for", "i", "in", "range", "(", "len", "(", "self", "....
https://github.com/redpony/cdec/blob/f7c4899b174d86bc70b40b1cae68dcad364615cb/python/cdec/configobj.py#L855-L937
H-uru/Plasma
c2140ea046e82e9c199e257a7f2e7edb42602871
Scripts/Python/plasma/Plasma.py
python
PtFileExists
(filename)
Returns true if the specified file exists
Returns true if the specified file exists
[ "Returns", "true", "if", "the", "specified", "file", "exists" ]
def PtFileExists(filename): """Returns true if the specified file exists""" pass
[ "def", "PtFileExists", "(", "filename", ")", ":", "pass" ]
https://github.com/H-uru/Plasma/blob/c2140ea046e82e9c199e257a7f2e7edb42602871/Scripts/Python/plasma/Plasma.py#L305-L307
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
contrib/gizmos/osx_carbon/gizmos.py
python
TreeListCtrl.SetColumnShown
(*args, **kwargs)
return _gizmos.TreeListCtrl_SetColumnShown(*args, **kwargs)
SetColumnShown(self, int column, bool shown=True)
SetColumnShown(self, int column, bool shown=True)
[ "SetColumnShown", "(", "self", "int", "column", "bool", "shown", "=", "True", ")" ]
def SetColumnShown(*args, **kwargs): """SetColumnShown(self, int column, bool shown=True)""" return _gizmos.TreeListCtrl_SetColumnShown(*args, **kwargs)
[ "def", "SetColumnShown", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_gizmos", ".", "TreeListCtrl_SetColumnShown", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/contrib/gizmos/osx_carbon/gizmos.py#L634-L636
PX4/PX4-Autopilot
0b9f60a0370be53d683352c63fd92db3d6586e18
Tools/px4moduledoc/srcparser.py
python
SourceParser.GetModuleGroups
(self)
return groups
Returns a dictionary of all categories with a dictonary of subcategories that contain a list of associated modules.
Returns a dictionary of all categories with a dictonary of subcategories that contain a list of associated modules.
[ "Returns", "a", "dictionary", "of", "all", "categories", "with", "a", "dictonary", "of", "subcategories", "that", "contain", "a", "list", "of", "associated", "modules", "." ]
def GetModuleGroups(self): """ Returns a dictionary of all categories with a dictonary of subcategories that contain a list of associated modules. """ groups = {} for module_name in self._modules: module = self._modules[module_name] subcategory = m...
[ "def", "GetModuleGroups", "(", "self", ")", ":", "groups", "=", "{", "}", "for", "module_name", "in", "self", ".", "_modules", ":", "module", "=", "self", ".", "_modules", "[", "module_name", "]", "subcategory", "=", "module", ".", "subcategory", "(", ")...
https://github.com/PX4/PX4-Autopilot/blob/0b9f60a0370be53d683352c63fd92db3d6586e18/Tools/px4moduledoc/srcparser.py#L541-L563
ZhouWeikuan/DouDiZhu
0d84ff6c0bc54dba6ae37955de9ae9307513dc99
code/frameworks/cocos2d-x/tools/bindings-generator/backup/clang-llvm-3.3-pybinding/cindex.py
python
Cursor.type
(self)
return self._type
Retrieve the Type (if any) of the entity pointed at by the cursor.
Retrieve the Type (if any) of the entity pointed at by the cursor.
[ "Retrieve", "the", "Type", "(", "if", "any", ")", "of", "the", "entity", "pointed", "at", "by", "the", "cursor", "." ]
def type(self): """ Retrieve the Type (if any) of the entity pointed at by the cursor. """ if not hasattr(self, '_type'): self._type = conf.lib.clang_getCursorType(self) return self._type
[ "def", "type", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_type'", ")", ":", "self", ".", "_type", "=", "conf", ".", "lib", ".", "clang_getCursorType", "(", "self", ")", "return", "self", ".", "_type" ]
https://github.com/ZhouWeikuan/DouDiZhu/blob/0d84ff6c0bc54dba6ae37955de9ae9307513dc99/code/frameworks/cocos2d-x/tools/bindings-generator/backup/clang-llvm-3.3-pybinding/cindex.py#L1151-L1158
cms-sw/cmssw
fd9de012d503d3405420bcbeec0ec879baa57cf2
Validation/Tools/python/GenObject.py
python
GenObject.__call__
(self, key)
return object.__getattribute__ (self, key)
Makes object callable
Makes object callable
[ "Makes", "object", "callable" ]
def __call__ (self, key): """Makes object callable""" return object.__getattribute__ (self, key)
[ "def", "__call__", "(", "self", ",", "key", ")", ":", "return", "object", ".", "__getattribute__", "(", "self", ",", "key", ")" ]
https://github.com/cms-sw/cmssw/blob/fd9de012d503d3405420bcbeec0ec879baa57cf2/Validation/Tools/python/GenObject.py#L1617-L1619
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
third_party/catapult/telemetry/third_party/pyfakefs/pyfakefs/fake_filesystem.py
python
FakePathModule.join
(self, *p)
return self.filesystem.JoinPaths(*p)
Returns the completed path with a separator of the parts.
Returns the completed path with a separator of the parts.
[ "Returns", "the", "completed", "path", "with", "a", "separator", "of", "the", "parts", "." ]
def join(self, *p): """Returns the completed path with a separator of the parts.""" return self.filesystem.JoinPaths(*p)
[ "def", "join", "(", "self", ",", "*", "p", ")", ":", "return", "self", ".", "filesystem", ".", "JoinPaths", "(", "*", "p", ")" ]
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/third_party/pyfakefs/pyfakefs/fake_filesystem.py#L1115-L1117
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_carbon/combo.py
python
BitmapComboBox.GetItemBitmap
(*args, **kwargs)
return _combo.BitmapComboBox_GetItemBitmap(*args, **kwargs)
GetItemBitmap(self, int n) -> Bitmap Returns the image of the item with the given index.
GetItemBitmap(self, int n) -> Bitmap
[ "GetItemBitmap", "(", "self", "int", "n", ")", "-", ">", "Bitmap" ]
def GetItemBitmap(*args, **kwargs): """ GetItemBitmap(self, int n) -> Bitmap Returns the image of the item with the given index. """ return _combo.BitmapComboBox_GetItemBitmap(*args, **kwargs)
[ "def", "GetItemBitmap", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_combo", ".", "BitmapComboBox_GetItemBitmap", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/combo.py#L981-L987
PaddlePaddle/Paddle
1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c
python/paddle/fluid/layers/layer_function_generator.py
python
add_sample_code
(func, sample_code)
Append sample code for dynamically generated functions. Args: func: The function of the function to be append sample code to. sample_code: sample code session in rst format.
Append sample code for dynamically generated functions.
[ "Append", "sample", "code", "for", "dynamically", "generated", "functions", "." ]
def add_sample_code(func, sample_code): """ Append sample code for dynamically generated functions. Args: func: The function of the function to be append sample code to. sample_code: sample code session in rst format. """ func.__doc__ = func.__doc__ + sample_code
[ "def", "add_sample_code", "(", "func", ",", "sample_code", ")", ":", "func", ".", "__doc__", "=", "func", ".", "__doc__", "+", "sample_code" ]
https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/fluid/layers/layer_function_generator.py#L384-L392
mindspore-ai/mindspore
fb8fd3338605bb34fa5cea054e535a8b1d753fab
mindspore/python/mindspore/ops/_op_impl/_custom_op/transpose02314_impl.py
python
shape0
(tik_instance, input_x, res, dtype)
return tik_instance, res
input shape (32, 4, 112, 112, 16)
input shape (32, 4, 112, 112, 16)
[ "input", "shape", "(", "32", "4", "112", "112", "16", ")" ]
def shape0(tik_instance, input_x, res, dtype): """input shape (32, 4, 112, 112, 16)""" with tik_instance.for_range(0, 32, block_num=32) as block_idx, tik_instance.for_range(0, 14) as cc1_db, \ tik_instance.for_range(0, 2, thread_num=2) as db_idx: input_1_local_ub = tik_instance.Tensor(dtype,...
[ "def", "shape0", "(", "tik_instance", ",", "input_x", ",", "res", ",", "dtype", ")", ":", "with", "tik_instance", ".", "for_range", "(", "0", ",", "32", ",", "block_num", "=", "32", ")", "as", "block_idx", ",", "tik_instance", ".", "for_range", "(", "0...
https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/ops/_op_impl/_custom_op/transpose02314_impl.py#L104-L121
ricardoquesada/Spidermonkey
4a75ea2543408bd1b2c515aa95901523eeef7858
python/lldbutils/lldbutils/layout.py
python
frametreelimited
(debugger, command, result, dict)
Dumps the subtree of a frame tree rooted at the given nsIFrame*.
Dumps the subtree of a frame tree rooted at the given nsIFrame*.
[ "Dumps", "the", "subtree", "of", "a", "frame", "tree", "rooted", "at", "the", "given", "nsIFrame", "*", "." ]
def frametreelimited(debugger, command, result, dict): """Dumps the subtree of a frame tree rooted at the given nsIFrame*.""" debugger.HandleCommand('expr (' + command + ')->DumpFrameTreeLimited()')
[ "def", "frametreelimited", "(", "debugger", ",", "command", ",", "result", ",", "dict", ")", ":", "debugger", ".", "HandleCommand", "(", "'expr ('", "+", "command", "+", "')->DumpFrameTreeLimited()'", ")" ]
https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/python/lldbutils/lldbutils/layout.py#L7-L9
google/syzygy
8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5
third_party/numpy/files/numpy/numarray/alter_code1.py
python
converttree
(direc=os.path.curdir)
Convert all .py files in the tree given
Convert all .py files in the tree given
[ "Convert", "all", ".", "py", "files", "in", "the", "tree", "given" ]
def converttree(direc=os.path.curdir): """Convert all .py files in the tree given """ os.path.walk(direc, _func, None)
[ "def", "converttree", "(", "direc", "=", "os", ".", "path", ".", "curdir", ")", ":", "os", ".", "path", ".", "walk", "(", "direc", ",", "_func", ",", "None", ")" ]
https://github.com/google/syzygy/blob/8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5/third_party/numpy/files/numpy/numarray/alter_code1.py#L257-L261
Constellation/iv
64c3a9c7c517063f29d90d449180ea8f6f4d946f
tools/cpplint.py
python
_GetTextInside
(text, start_pattern)
return text[start_position:position - 1]
r"""Retrieves all the text between matching open and close parentheses. Given a string of lines and a regular expression string, retrieve all the text following the expression and between opening punctuation symbols like (, [, or {, and the matching close-punctuation symbol. This properly nested occurrences of...
r"""Retrieves all the text between matching open and close parentheses.
[ "r", "Retrieves", "all", "the", "text", "between", "matching", "open", "and", "close", "parentheses", "." ]
def _GetTextInside(text, start_pattern): r"""Retrieves all the text between matching open and close parentheses. Given a string of lines and a regular expression string, retrieve all the text following the expression and between opening punctuation symbols like (, [, or {, and the matching close-punctuation sy...
[ "def", "_GetTextInside", "(", "text", ",", "start_pattern", ")", ":", "# TODO(sugawarayu): Audit cpplint.py to see what places could be profitably", "# rewritten to use _GetTextInside (and use inferior regexp matching today).", "# Give opening punctuations to get the matching close-punctuations....
https://github.com/Constellation/iv/blob/64c3a9c7c517063f29d90d449180ea8f6f4d946f/tools/cpplint.py#L3640-L3693
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/pathlib.py
python
Path.is_socket
(self)
Whether this path is a socket.
Whether this path is a socket.
[ "Whether", "this", "path", "is", "a", "socket", "." ]
def is_socket(self): """ Whether this path is a socket. """ try: return S_ISSOCK(self.stat().st_mode) except OSError as e: if not _ignore_error(e): raise # Path doesn't exist or is a broken symlink # (see https://bit...
[ "def", "is_socket", "(", "self", ")", ":", "try", ":", "return", "S_ISSOCK", "(", "self", ".", "stat", "(", ")", ".", "st_mode", ")", "except", "OSError", "as", "e", ":", "if", "not", "_ignore_error", "(", "e", ")", ":", "raise", "# Path doesn't exist ...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/pathlib.py#L1467-L1478
apache/madlib
be297fe6beada0640f93317e8948834032718e32
src/madpack/yaml/__init__.py
python
dump
(data, stream=None, Dumper=Dumper, **kwds)
return dump_all([data], stream, Dumper=Dumper, **kwds)
Serialize a Python object into a YAML stream. If stream is None, return the produced string instead.
Serialize a Python object into a YAML stream. If stream is None, return the produced string instead.
[ "Serialize", "a", "Python", "object", "into", "a", "YAML", "stream", ".", "If", "stream", "is", "None", "return", "the", "produced", "string", "instead", "." ]
def dump(data, stream=None, Dumper=Dumper, **kwds): """ Serialize a Python object into a YAML stream. If stream is None, return the produced string instead. """ return dump_all([data], stream, Dumper=Dumper, **kwds)
[ "def", "dump", "(", "data", ",", "stream", "=", "None", ",", "Dumper", "=", "Dumper", ",", "*", "*", "kwds", ")", ":", "return", "dump_all", "(", "[", "data", "]", ",", "stream", ",", "Dumper", "=", "Dumper", ",", "*", "*", "kwds", ")" ]
https://github.com/apache/madlib/blob/be297fe6beada0640f93317e8948834032718e32/src/madpack/yaml/__init__.py#L172-L177
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/ipaddress.py
python
_find_address_range
(addresses)
Find a sequence of sorted deduplicated IPv#Address. Args: addresses: a list of IPv#Address objects. Yields: A tuple containing the first and last IP addresses in the sequence.
Find a sequence of sorted deduplicated IPv#Address.
[ "Find", "a", "sequence", "of", "sorted", "deduplicated", "IPv#Address", "." ]
def _find_address_range(addresses): """Find a sequence of sorted deduplicated IPv#Address. Args: addresses: a list of IPv#Address objects. Yields: A tuple containing the first and last IP addresses in the sequence. """ it = iter(addresses) first = last = next(it) for ip in...
[ "def", "_find_address_range", "(", "addresses", ")", ":", "it", "=", "iter", "(", "addresses", ")", "first", "=", "last", "=", "next", "(", "it", ")", "for", "ip", "in", "it", ":", "if", "ip", ".", "_ip", "!=", "last", ".", "_ip", "+", "1", ":", ...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/ipaddress.py#L286-L303
bulletphysics/bullet3
f0f2a952e146f016096db6f85cf0c44ed75b0b9a
examples/pybullet/gym/pybullet_envs/minitaur/agents/ppo/algorithm.py
python
PPOAlgorithm._define_end_episode
(self, agent_indices)
Implement the branch of end_episode() entered during training.
Implement the branch of end_episode() entered during training.
[ "Implement", "the", "branch", "of", "end_episode", "()", "entered", "during", "training", "." ]
def _define_end_episode(self, agent_indices): """Implement the branch of end_episode() entered during training.""" episodes, length = self._episodes.data(agent_indices) space_left = self._config.update_every - self._memory_index use_episodes = tf.range(tf.minimum(tf.shape(agent_indices)[0], space_left))...
[ "def", "_define_end_episode", "(", "self", ",", "agent_indices", ")", ":", "episodes", ",", "length", "=", "self", ".", "_episodes", ".", "data", "(", "agent_indices", ")", "space_left", "=", "self", ".", "_config", ".", "update_every", "-", "self", ".", "...
https://github.com/bulletphysics/bullet3/blob/f0f2a952e146f016096db6f85cf0c44ed75b0b9a/examples/pybullet/gym/pybullet_envs/minitaur/agents/ppo/algorithm.py#L205-L217
junhyukoh/caffe-lstm
598d45456fa2a1b127a644f4aa38daa8fb9fc722
scripts/cpp_lint.py
python
FileInfo.RepositoryName
(self)
return fullname
FullName after removing the local path to the repository. If we have a real absolute path name here we can try to do something smart: detecting the root of the checkout and truncating /path/to/checkout from the name so that we get header guards that don't include things like "C:\Documents and Settings\...
FullName after removing the local path to the repository.
[ "FullName", "after", "removing", "the", "local", "path", "to", "the", "repository", "." ]
def RepositoryName(self): """FullName after removing the local path to the repository. If we have a real absolute path name here we can try to do something smart: detecting the root of the checkout and truncating /path/to/checkout from the name so that we get header guards that don't include things lik...
[ "def", "RepositoryName", "(", "self", ")", ":", "fullname", "=", "self", ".", "FullName", "(", ")", "if", "os", ".", "path", ".", "exists", "(", "fullname", ")", ":", "project_dir", "=", "os", ".", "path", ".", "dirname", "(", "fullname", ")", "if", ...
https://github.com/junhyukoh/caffe-lstm/blob/598d45456fa2a1b127a644f4aa38daa8fb9fc722/scripts/cpp_lint.py#L885-L928
deepmodeling/deepmd-kit
159e45d248b0429844fb6a8cb3b3a201987c8d79
deepmd/fit/polar.py
python
GlobalPolarFittingSeA.build
(self, input_d, rot_mat, natoms, reuse = None, suffix = '')
return tf.reshape(outs, [-1])
Build the computational graph for fitting net Parameters ---------- input_d The input descriptor rot_mat The rotation matrix from the descriptor. natoms The number of atoms. This tensor has the length of Ntypes + 2 ...
Build the computational graph for fitting net Parameters ---------- input_d The input descriptor rot_mat The rotation matrix from the descriptor. natoms The number of atoms. This tensor has the length of Ntypes + 2 ...
[ "Build", "the", "computational", "graph", "for", "fitting", "net", "Parameters", "----------", "input_d", "The", "input", "descriptor", "rot_mat", "The", "rotation", "matrix", "from", "the", "descriptor", ".", "natoms", "The", "number", "of", "atoms", ".", "This...
def build (self, input_d, rot_mat, natoms, reuse = None, suffix = '') -> tf.Tensor: """ Build the computational graph for fitting net Parameters ---------- input_d The input descri...
[ "def", "build", "(", "self", ",", "input_d", ",", "rot_mat", ",", "natoms", ",", "reuse", "=", "None", ",", "suffix", "=", "''", ")", "->", "tf", ".", "Tensor", ":", "inputs", "=", "tf", ".", "reshape", "(", "input_d", ",", "[", "-", "1", ",", ...
https://github.com/deepmodeling/deepmd-kit/blob/159e45d248b0429844fb6a8cb3b3a201987c8d79/deepmd/fit/polar.py#L446-L482
ChromiumWebApps/chromium
c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7
build/android/pylib/android_commands.py
python
AndroidCommands.GetMonitoredLogCat
(self)
return self._logcat
Returns an "adb logcat" command as created by pexpected.spawn.
Returns an "adb logcat" command as created by pexpected.spawn.
[ "Returns", "an", "adb", "logcat", "command", "as", "created", "by", "pexpected", ".", "spawn", "." ]
def GetMonitoredLogCat(self): """Returns an "adb logcat" command as created by pexpected.spawn.""" if not self._logcat: self.StartMonitoringLogcat(clear=False) return self._logcat
[ "def", "GetMonitoredLogCat", "(", "self", ")", ":", "if", "not", "self", ".", "_logcat", ":", "self", ".", "StartMonitoringLogcat", "(", "clear", "=", "False", ")", "return", "self", ".", "_logcat" ]
https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/build/android/pylib/android_commands.py#L1289-L1293
CRYTEK/CRYENGINE
232227c59a220cbbd311576f0fbeba7bb53b2a8c
Code/Tools/waf-1.7.13/waflib/Tools/tex.py
python
tex.scan_aux
(self, node)
return nodes
A recursive regex-based scanner that finds included auxiliary files.
A recursive regex-based scanner that finds included auxiliary files.
[ "A", "recursive", "regex", "-", "based", "scanner", "that", "finds", "included", "auxiliary", "files", "." ]
def scan_aux(self, node): """ A recursive regex-based scanner that finds included auxiliary files. """ nodes = [node] re_aux = re.compile(r'\\@input{(?P<file>[^{}]*)}', re.M) def parse_node(node): code = node.read() for match in re_aux.finditer(code): path = match.group('file') found = node.p...
[ "def", "scan_aux", "(", "self", ",", "node", ")", ":", "nodes", "=", "[", "node", "]", "re_aux", "=", "re", ".", "compile", "(", "r'\\\\@input{(?P<file>[^{}]*)}'", ",", "re", ".", "M", ")", "def", "parse_node", "(", "node", ")", ":", "code", "=", "no...
https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Code/Tools/waf-1.7.13/waflib/Tools/tex.py#L109-L127
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/idlelib/multicall.py
python
MultiCallCreator
(widget)
return MultiCall
Return a MultiCall class which inherits its methods from the given widget class (for example, Tkinter.Text). This is used instead of a templating mechanism.
Return a MultiCall class which inherits its methods from the given widget class (for example, Tkinter.Text). This is used instead of a templating mechanism.
[ "Return", "a", "MultiCall", "class", "which", "inherits", "its", "methods", "from", "the", "given", "widget", "class", "(", "for", "example", "Tkinter", ".", "Text", ")", ".", "This", "is", "used", "instead", "of", "a", "templating", "mechanism", "." ]
def MultiCallCreator(widget): """Return a MultiCall class which inherits its methods from the given widget class (for example, Tkinter.Text). This is used instead of a templating mechanism. """ if widget in _multicall_dict: return _multicall_dict[widget] class MultiCall (widget): ...
[ "def", "MultiCallCreator", "(", "widget", ")", ":", "if", "widget", "in", "_multicall_dict", ":", "return", "_multicall_dict", "[", "widget", "]", "class", "MultiCall", "(", "widget", ")", ":", "assert", "issubclass", "(", "widget", ",", "tkinter", ".", "Mis...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/idlelib/multicall.py#L314-L414
mindspore-ai/mindspore
fb8fd3338605bb34fa5cea054e535a8b1d753fab
mindspore/python/mindspore/dataset/engine/datasets.py
python
_NumpySlicesDataset.process_dict
(self, input_data)
return data
Convert the dict like data into tuple format, when input is a tuple of dicts then compose it into a dict first.
Convert the dict like data into tuple format, when input is a tuple of dicts then compose it into a dict first.
[ "Convert", "the", "dict", "like", "data", "into", "tuple", "format", "when", "input", "is", "a", "tuple", "of", "dicts", "then", "compose", "it", "into", "a", "dict", "first", "." ]
def process_dict(self, input_data): """ Convert the dict like data into tuple format, when input is a tuple of dicts then compose it into a dict first. """ # Convert pandas like dict(has "values" column) into General dict data_keys = list(input_data.keys()) data_col = inp...
[ "def", "process_dict", "(", "self", ",", "input_data", ")", ":", "# Convert pandas like dict(has \"values\" column) into General dict", "data_keys", "=", "list", "(", "input_data", ".", "keys", "(", ")", ")", "data_col", "=", "input_data", "[", "data_keys", "[", "0"...
https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/dataset/engine/datasets.py#L8472-L8494
OPAE/opae-sdk
221124343c8275243a249eb72d69e0ea2d568d1b
binaries/qpafilter/qpafilter.py
python
qpamap.values_for
(self, ident)
return (self.id_map[ident]['filtered_warning'], self.id_map[ident]['filtered_fatal'])
Return a tuple of the filtered warning and filtered fatal values.
Return a tuple of the filtered warning and filtered fatal values.
[ "Return", "a", "tuple", "of", "the", "filtered", "warning", "and", "filtered", "fatal", "values", "." ]
def values_for(self, ident): """Return a tuple of the filtered warning and filtered fatal values.""" return (self.id_map[ident]['filtered_warning'], self.id_map[ident]['filtered_fatal'])
[ "def", "values_for", "(", "self", ",", "ident", ")", ":", "return", "(", "self", ".", "id_map", "[", "ident", "]", "[", "'filtered_warning'", "]", ",", "self", ".", "id_map", "[", "ident", "]", "[", "'filtered_fatal'", "]", ")" ]
https://github.com/OPAE/opae-sdk/blob/221124343c8275243a249eb72d69e0ea2d568d1b/binaries/qpafilter/qpafilter.py#L389-L392
tensorflow/tensorflow
419e3a6b650ea4bd1b0cba23c4348f8a69f3272e
tensorflow/python/keras/utils/tf_utils.py
python
is_extension_type
(tensor)
return isinstance(tensor, composite_tensor.CompositeTensor)
Returns whether a tensor is of an ExtensionType. github.com/tensorflow/community/pull/269 Currently it works by checking if `tensor` is a `CompositeTensor` instance, but this will be changed to use an appropriate extensiontype protocol check once ExtensionType is made public. Args: tensor: An object to ...
Returns whether a tensor is of an ExtensionType.
[ "Returns", "whether", "a", "tensor", "is", "of", "an", "ExtensionType", "." ]
def is_extension_type(tensor): """Returns whether a tensor is of an ExtensionType. github.com/tensorflow/community/pull/269 Currently it works by checking if `tensor` is a `CompositeTensor` instance, but this will be changed to use an appropriate extensiontype protocol check once ExtensionType is made public...
[ "def", "is_extension_type", "(", "tensor", ")", ":", "return", "isinstance", "(", "tensor", ",", "composite_tensor", ".", "CompositeTensor", ")" ]
https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/keras/utils/tf_utils.py#L288-L302
neoml-lib/neoml
a0d370fba05269a1b2258cef126f77bbd2054a3e
NeoML/Python/neoml/Dnn/Conv.py
python
TimeConv.filter
(self, blob)
Sets the filters. The dimensions: - **BatchLength** * **BatchWidth** * **ListSize** is filter_count - **Height**, **Width** are taken from filter_size - **Depth**, **Channels** are equal to the inputs' dimensions :param neoml.Blob.Blob blob: blob to be used as filter
Sets the filters. The dimensions: - **BatchLength** * **BatchWidth** * **ListSize** is filter_count - **Height**, **Width** are taken from filter_size - **Depth**, **Channels** are equal to the inputs' dimensions
[ "Sets", "the", "filters", ".", "The", "dimensions", ":", "-", "**", "BatchLength", "**", "*", "**", "BatchWidth", "**", "*", "**", "ListSize", "**", "is", "filter_count", "-", "**", "Height", "**", "**", "Width", "**", "are", "taken", "from", "filter_siz...
def filter(self, blob): """Sets the filters. The dimensions: - **BatchLength** * **BatchWidth** * **ListSize** is filter_count - **Height**, **Width** are taken from filter_size - **Depth**, **Channels** are equal to the inputs' dimensions :param neoml.Blob.Blob blob: blob to be...
[ "def", "filter", "(", "self", ",", "blob", ")", ":", "if", "not", "isinstance", "(", "blob", ",", "Blob", ".", "Blob", ")", ":", "raise", "ValueError", "(", "'The `blob` must be neoml.Blob.Blob.'", ")", "self", ".", "_internal", ".", "set_filter", "(", "bl...
https://github.com/neoml-lib/neoml/blob/a0d370fba05269a1b2258cef126f77bbd2054a3e/NeoML/Python/neoml/Dnn/Conv.py#L1170-L1181
microsoft/checkedc-clang
a173fefde5d7877b7750e7ce96dd08cf18baebf2
lldb/third_party/Python/module/pexpect-4.6/pexpect/FSM.py
python
FSM.__init__
(self, initial_state, memory=None)
This creates the FSM. You set the initial state here. The "memory" attribute is any object that you want to pass along to the action functions. It is not used by the FSM. For parsing you would typically pass a list to be used as a stack.
This creates the FSM. You set the initial state here. The "memory" attribute is any object that you want to pass along to the action functions. It is not used by the FSM. For parsing you would typically pass a list to be used as a stack.
[ "This", "creates", "the", "FSM", ".", "You", "set", "the", "initial", "state", "here", ".", "The", "memory", "attribute", "is", "any", "object", "that", "you", "want", "to", "pass", "along", "to", "the", "action", "functions", ".", "It", "is", "not", "...
def __init__(self, initial_state, memory=None): '''This creates the FSM. You set the initial state here. The "memory" attribute is any object that you want to pass along to the action functions. It is not used by the FSM. For parsing you would typically pass a list to be used as a stack...
[ "def", "__init__", "(", "self", ",", "initial_state", ",", "memory", "=", "None", ")", ":", "# Map (input_symbol, current_state) --> (action, next_state).", "self", ".", "state_transitions", "=", "{", "}", "# Map (current_state) --> (action, next_state).", "self", ".", "s...
https://github.com/microsoft/checkedc-clang/blob/a173fefde5d7877b7750e7ce96dd08cf18baebf2/lldb/third_party/Python/module/pexpect-4.6/pexpect/FSM.py#L102-L120
sfzhang15/FaceBoxes
b52cc92f9362d3adc08d54666aeb9ebb62fdb7da
scripts/cpp_lint.py
python
CleansedLines._CollapseStrings
(elided)
return elided
Collapses strings and chars on a line to simple "" or '' blocks. We nix strings first so we're not fooled by text like '"http://"' Args: elided: The line being processed. Returns: The line with collapsed strings.
Collapses strings and chars on a line to simple "" or '' blocks.
[ "Collapses", "strings", "and", "chars", "on", "a", "line", "to", "simple", "or", "blocks", "." ]
def _CollapseStrings(elided): """Collapses strings and chars on a line to simple "" or '' blocks. We nix strings first so we're not fooled by text like '"http://"' Args: elided: The line being processed. Returns: The line with collapsed strings. """ if not _RE_PATTERN_INCLUDE.matc...
[ "def", "_CollapseStrings", "(", "elided", ")", ":", "if", "not", "_RE_PATTERN_INCLUDE", ".", "match", "(", "elided", ")", ":", "# Remove escaped characters first to make quote/single quote collapsing", "# basic. Things that look like escaped characters shouldn't occur", "# outside...
https://github.com/sfzhang15/FaceBoxes/blob/b52cc92f9362d3adc08d54666aeb9ebb62fdb7da/scripts/cpp_lint.py#L1209-L1227
apiaryio/snowcrash
b5b39faa85f88ee17459edf39fdc6fe4fc70d2e3
tools/gyp/pylib/gyp/xcode_emulation.py
python
XcodeSettings._DefaultSdkRoot
(self)
return ''
Returns the default SDKROOT to use. Prior to version 5.0.0, if SDKROOT was not explicitly set in the Xcode project, then the environment variable was empty. Starting with this version, Xcode uses the name of the newest SDK installed.
Returns the default SDKROOT to use.
[ "Returns", "the", "default", "SDKROOT", "to", "use", "." ]
def _DefaultSdkRoot(self): """Returns the default SDKROOT to use. Prior to version 5.0.0, if SDKROOT was not explicitly set in the Xcode project, then the environment variable was empty. Starting with this version, Xcode uses the name of the newest SDK installed. """ xcode_version, xcode_build ...
[ "def", "_DefaultSdkRoot", "(", "self", ")", ":", "xcode_version", ",", "xcode_build", "=", "XcodeVersion", "(", ")", "if", "xcode_version", "<", "'0500'", ":", "return", "''", "default_sdk_path", "=", "self", ".", "_XcodeSdkPath", "(", "''", ")", "default_sdk_...
https://github.com/apiaryio/snowcrash/blob/b5b39faa85f88ee17459edf39fdc6fe4fc70d2e3/tools/gyp/pylib/gyp/xcode_emulation.py#L1139-L1165
tensorflow/tensorflow
419e3a6b650ea4bd1b0cba23c4348f8a69f3272e
tensorflow/python/ops/clustering_ops.py
python
_InitializeClustersOpFactory._kmc2_multiple_centers
(self)
return num_remaining
Adds new initial cluster centers using the k-MC2 algorithm. In each call to the op, the provided batch is split into subsets based on the specified `kmc2_chain_length`. On each subset, a single Markov chain of the k-MC2 algorithm is used to add *one* new center cluster center. If there are less than `k...
Adds new initial cluster centers using the k-MC2 algorithm.
[ "Adds", "new", "initial", "cluster", "centers", "using", "the", "k", "-", "MC2", "algorithm", "." ]
def _kmc2_multiple_centers(self): """Adds new initial cluster centers using the k-MC2 algorithm. In each call to the op, the provided batch is split into subsets based on the specified `kmc2_chain_length`. On each subset, a single Markov chain of the k-MC2 algorithm is used to add *one* new center clus...
[ "def", "_kmc2_multiple_centers", "(", "self", ")", ":", "# The op only operates on the first shard of data.", "first_shard", "=", "self", ".", "_inputs", "[", "0", "]", "# Number of points in the input that can be used.", "batch_size", "=", "array_ops", ".", "shape", "(", ...
https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/clustering_ops.py#L623-L704
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/tools/python/src/Lib/decimal.py
python
_group_lengths
(grouping)
Convert a localeconv-style grouping into a (possibly infinite) iterable of integers representing group lengths.
Convert a localeconv-style grouping into a (possibly infinite) iterable of integers representing group lengths.
[ "Convert", "a", "localeconv", "-", "style", "grouping", "into", "a", "(", "possibly", "infinite", ")", "iterable", "of", "integers", "representing", "group", "lengths", "." ]
def _group_lengths(grouping): """Convert a localeconv-style grouping into a (possibly infinite) iterable of integers representing group lengths. """ # The result from localeconv()['grouping'], and the input to this # function, should be a list of integers in one of the # following three forms: ...
[ "def", "_group_lengths", "(", "grouping", ")", ":", "# The result from localeconv()['grouping'], and the input to this", "# function, should be a list of integers in one of the", "# following three forms:", "#", "# (1) an empty list, or", "# (2) nonempty list of positive integers + [0]", ...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/decimal.py#L6096-L6117
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/AWSPythonSDK/1.5.8/docutils/utils/math/math2html.py
python
CommandBit.parsesquare
(self, pos)
return bracket
Parse a square bracket
Parse a square bracket
[ "Parse", "a", "square", "bracket" ]
def parsesquare(self, pos): "Parse a square bracket" self.factory.clearskipped(pos) if not self.factory.detecttype(SquareBracket, pos): return None bracket = self.factory.parsetype(SquareBracket, pos) self.add(bracket) return bracket
[ "def", "parsesquare", "(", "self", ",", "pos", ")", ":", "self", ".", "factory", ".", "clearskipped", "(", "pos", ")", "if", "not", "self", ".", "factory", ".", "detecttype", "(", "SquareBracket", ",", "pos", ")", ":", "return", "None", "bracket", "=",...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/docutils/utils/math/math2html.py#L4147-L4154
tensorflow/tensorflow
419e3a6b650ea4bd1b0cba23c4348f8a69f3272e
tensorflow/python/util/deprecation.py
python
silence
()
Temporarily silence deprecation warnings.
Temporarily silence deprecation warnings.
[ "Temporarily", "silence", "deprecation", "warnings", "." ]
def silence(): """Temporarily silence deprecation warnings.""" global _PRINT_DEPRECATION_WARNINGS print_deprecation_warnings = _PRINT_DEPRECATION_WARNINGS _PRINT_DEPRECATION_WARNINGS = False yield _PRINT_DEPRECATION_WARNINGS = print_deprecation_warnings
[ "def", "silence", "(", ")", ":", "global", "_PRINT_DEPRECATION_WARNINGS", "print_deprecation_warnings", "=", "_PRINT_DEPRECATION_WARNINGS", "_PRINT_DEPRECATION_WARNINGS", "=", "False", "yield", "_PRINT_DEPRECATION_WARNINGS", "=", "print_deprecation_warnings" ]
https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/util/deprecation.py#L651-L657
greg7mdp/parallel-hashmap
bf2d3fe7a276401cb2494eb93696930c001d8de7
phmap_lldb.py
python
_get_function_name
(instance=None)
return class_name + sys._getframe(1).f_code.co_name
Return the name of the calling function
Return the name of the calling function
[ "Return", "the", "name", "of", "the", "calling", "function" ]
def _get_function_name(instance=None): """Return the name of the calling function""" class_name = f"{type(instance).__name__}." if instance else "" return class_name + sys._getframe(1).f_code.co_name
[ "def", "_get_function_name", "(", "instance", "=", "None", ")", ":", "class_name", "=", "f\"{type(instance).__name__}.\"", "if", "instance", "else", "\"\"", "return", "class_name", "+", "sys", ".", "_getframe", "(", "1", ")", ".", "f_code", ".", "co_name" ]
https://github.com/greg7mdp/parallel-hashmap/blob/bf2d3fe7a276401cb2494eb93696930c001d8de7/phmap_lldb.py#L18-L21
TheLegendAli/DeepLab-Context
fb04e9e2fc2682490ad9f60533b9d6c4c0e0479c
examples/web_demo/app.py
python
embed_image_html
(image)
return 'data:image/png;base64,' + data
Creates an image embedded in HTML base64 format.
Creates an image embedded in HTML base64 format.
[ "Creates", "an", "image", "embedded", "in", "HTML", "base64", "format", "." ]
def embed_image_html(image): """Creates an image embedded in HTML base64 format.""" image_pil = PILImage.fromarray((255 * image).astype('uint8')) image_pil = image_pil.resize((256, 256)) string_buf = StringIO.StringIO() image_pil.save(string_buf, format='png') data = string_buf.getvalue().encode...
[ "def", "embed_image_html", "(", "image", ")", ":", "image_pil", "=", "PILImage", ".", "fromarray", "(", "(", "255", "*", "image", ")", ".", "astype", "(", "'uint8'", ")", ")", "image_pil", "=", "image_pil", ".", "resize", "(", "(", "256", ",", "256", ...
https://github.com/TheLegendAli/DeepLab-Context/blob/fb04e9e2fc2682490ad9f60533b9d6c4c0e0479c/examples/web_demo/app.py#L81-L88
apache/singa
93fd9da72694e68bfe3fb29d0183a65263d238a1
python/singa/autograd.py
python
acos
(x)
return Acos()(x)[0]
Calculates the arccosine (inverse of cosine) of the given input tensor, element-wise. Args: x (Tensor): Input tensor Returns: Tensor, the output
Calculates the arccosine (inverse of cosine) of the given input tensor, element-wise. Args: x (Tensor): Input tensor Returns: Tensor, the output
[ "Calculates", "the", "arccosine", "(", "inverse", "of", "cosine", ")", "of", "the", "given", "input", "tensor", "element", "-", "wise", ".", "Args", ":", "x", "(", "Tensor", ")", ":", "Input", "tensor", "Returns", ":", "Tensor", "the", "output" ]
def acos(x): """ Calculates the arccosine (inverse of cosine) of the given input tensor, element-wise. Args: x (Tensor): Input tensor Returns: Tensor, the output """ return Acos()(x)[0]
[ "def", "acos", "(", "x", ")", ":", "return", "Acos", "(", ")", "(", "x", ")", "[", "0", "]" ]
https://github.com/apache/singa/blob/93fd9da72694e68bfe3fb29d0183a65263d238a1/python/singa/autograd.py#L2088-L2097
jsupancic/deep_hand_pose
22cbeae1a8410ff5d37c060c7315719d0a5d608f
tools/extra/resize_and_crop_images.py
python
OpenCVResizeCrop.resize_and_crop_image
(self, input_file, output_file, output_side_length = 256)
Takes an image name, resize it and crop the center square
Takes an image name, resize it and crop the center square
[ "Takes", "an", "image", "name", "resize", "it", "and", "crop", "the", "center", "square" ]
def resize_and_crop_image(self, input_file, output_file, output_side_length = 256): '''Takes an image name, resize it and crop the center square ''' img = cv2.imread(input_file) height, width, depth = img.shape new_height = output_side_length new_width = output_side_lengt...
[ "def", "resize_and_crop_image", "(", "self", ",", "input_file", ",", "output_file", ",", "output_side_length", "=", "256", ")", ":", "img", "=", "cv2", ".", "imread", "(", "input_file", ")", "height", ",", "width", ",", "depth", "=", "img", ".", "shape", ...
https://github.com/jsupancic/deep_hand_pose/blob/22cbeae1a8410ff5d37c060c7315719d0a5d608f/tools/extra/resize_and_crop_images.py#L20-L36
wlanjie/AndroidFFmpeg
7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf
tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/idlelib/ParenMatch.py
python
ParenMatch.create_tag_default
(self, indices)
Highlight the single paren that matches
Highlight the single paren that matches
[ "Highlight", "the", "single", "paren", "that", "matches" ]
def create_tag_default(self, indices): """Highlight the single paren that matches""" self.text.tag_add("paren", indices[0]) self.text.tag_config("paren", self.HILITE_CONFIG)
[ "def", "create_tag_default", "(", "self", ",", "indices", ")", ":", "self", ".", "text", ".", "tag_add", "(", "\"paren\"", ",", "indices", "[", "0", "]", ")", "self", ".", "text", ".", "tag_config", "(", "\"paren\"", ",", "self", ".", "HILITE_CONFIG", ...
https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/idlelib/ParenMatch.py#L133-L136
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/scikit-learn/py3/sklearn/cluster/_agglomerative.py
python
_fix_connectivity
(X, connectivity, affinity)
return connectivity, n_connected_components
Fixes the connectivity matrix - copies it - makes it symmetric - converts it to LIL if necessary - completes it if necessary
Fixes the connectivity matrix
[ "Fixes", "the", "connectivity", "matrix" ]
def _fix_connectivity(X, connectivity, affinity): """ Fixes the connectivity matrix - copies it - makes it symmetric - converts it to LIL if necessary - completes it if necessary """ n_samples = X.shape[0] if (connectivity.shape[0] != n_samples or connect...
[ "def", "_fix_connectivity", "(", "X", ",", "connectivity", ",", "affinity", ")", ":", "n_samples", "=", "X", ".", "shape", "[", "0", "]", "if", "(", "connectivity", ".", "shape", "[", "0", "]", "!=", "n_samples", "or", "connectivity", ".", "shape", "["...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py3/sklearn/cluster/_agglomerative.py#L32-L79
forkineye/ESPixelStick
22926f1c0d1131f1369fc7cad405689a095ae3cb
dist/bin/esptool/serial/tools/list_ports_osx.py
python
get_string_property
(device_type, property)
return output
Search the given device for the specified string property @param device_type Type of Device @param property String to search for @return Python string containing the value, or None if not found.
Search the given device for the specified string property
[ "Search", "the", "given", "device", "for", "the", "specified", "string", "property" ]
def get_string_property(device_type, property): """ Search the given device for the specified string property @param device_type Type of Device @param property String to search for @return Python string containing the value, or None if not found. """ key = cf.CFStringCreateWithCString( ...
[ "def", "get_string_property", "(", "device_type", ",", "property", ")", ":", "key", "=", "cf", ".", "CFStringCreateWithCString", "(", "kCFAllocatorDefault", ",", "property", ".", "encode", "(", "\"mac_roman\"", ")", ",", "kCFStringEncodingMacRoman", ")", "CFContaine...
https://github.com/forkineye/ESPixelStick/blob/22926f1c0d1131f1369fc7cad405689a095ae3cb/dist/bin/esptool/serial/tools/list_ports_osx.py#L79-L104
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/gtk/propgrid.py
python
PropertyGrid.IsMainButtonEvent
(*args, **kwargs)
return _propgrid.PropertyGrid_IsMainButtonEvent(*args, **kwargs)
IsMainButtonEvent(self, Event event) -> bool
IsMainButtonEvent(self, Event event) -> bool
[ "IsMainButtonEvent", "(", "self", "Event", "event", ")", "-", ">", "bool" ]
def IsMainButtonEvent(*args, **kwargs): """IsMainButtonEvent(self, Event event) -> bool""" return _propgrid.PropertyGrid_IsMainButtonEvent(*args, **kwargs)
[ "def", "IsMainButtonEvent", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_propgrid", ".", "PropertyGrid_IsMainButtonEvent", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/propgrid.py#L2431-L2433
FreeCAD/FreeCAD
ba42231b9c6889b89e064d6d563448ed81e376ec
src/Mod/Draft/draftguitools/gui_groups.py
python
SetAutoGroup.proceed
(self, labelname)
Set the defined autogroup, or create a new layer. Parameters ---------- labelname: str The passed string with the name of the group or layer.
Set the defined autogroup, or create a new layer.
[ "Set", "the", "defined", "autogroup", "or", "create", "a", "new", "layer", "." ]
def proceed(self, labelname): """Set the defined autogroup, or create a new layer. Parameters ---------- labelname: str The passed string with the name of the group or layer. """ # Deactivate the source command of the `DraftToolBar` class # so that it...
[ "def", "proceed", "(", "self", ",", "labelname", ")", ":", "# Deactivate the source command of the `DraftToolBar` class", "# so that it doesn't do more with this command", "# when it finishes.", "self", ".", "ui", ".", "sourceCmd", "=", "None", "if", "labelname", "in", "sel...
https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Draft/draftguitools/gui_groups.py#L261-L284
rbgirshick/caffe-fast-rcnn
28a579eaf0668850705598b3075b8969f22226d9
scripts/cpp_lint.py
python
ProcessFile
(filename, vlevel, extra_check_functions=[])
Does google-lint on a single file. Args: filename: The name of the file to parse. vlevel: The level of errors to report. Every error of confidence >= verbose_level will be reported. 0 is a good default. extra_check_functions: An array of additional check functions that will be ...
Does google-lint on a single file.
[ "Does", "google", "-", "lint", "on", "a", "single", "file", "." ]
def ProcessFile(filename, vlevel, extra_check_functions=[]): """Does google-lint on a single file. Args: filename: The name of the file to parse. vlevel: The level of errors to report. Every error of confidence >= verbose_level will be reported. 0 is a good default. extra_check_functions: An ar...
[ "def", "ProcessFile", "(", "filename", ",", "vlevel", ",", "extra_check_functions", "=", "[", "]", ")", ":", "_SetVerboseLevel", "(", "vlevel", ")", "try", ":", "# Support the UNIX convention of using \"-\" for stdin. Note that", "# we are not opening the file with universal...
https://github.com/rbgirshick/caffe-fast-rcnn/blob/28a579eaf0668850705598b3075b8969f22226d9/scripts/cpp_lint.py#L4689-L4754
BSVino/DoubleAction
c550b168a3e919926c198c30240f506538b92e75
mp/src/thirdparty/protobuf-2.3.0/python/google/protobuf/internal/containers.py
python
BaseContainer.__init__
(self, message_listener)
Args: message_listener: A MessageListener implementation. The RepeatedScalarFieldContainer will call this object's Modified() method when it is modified.
Args: message_listener: A MessageListener implementation. The RepeatedScalarFieldContainer will call this object's Modified() method when it is modified.
[ "Args", ":", "message_listener", ":", "A", "MessageListener", "implementation", ".", "The", "RepeatedScalarFieldContainer", "will", "call", "this", "object", "s", "Modified", "()", "method", "when", "it", "is", "modified", "." ]
def __init__(self, message_listener): """ Args: message_listener: A MessageListener implementation. The RepeatedScalarFieldContainer will call this object's Modified() method when it is modified. """ self._message_listener = message_listener self._values = []
[ "def", "__init__", "(", "self", ",", "message_listener", ")", ":", "self", ".", "_message_listener", "=", "message_listener", "self", ".", "_values", "=", "[", "]" ]
https://github.com/BSVino/DoubleAction/blob/c550b168a3e919926c198c30240f506538b92e75/mp/src/thirdparty/protobuf-2.3.0/python/google/protobuf/internal/containers.py#L52-L60
mantidproject/mantid
03deeb89254ec4289edb8771e0188c2090a02f32
scripts/SANS/sans/command_interface/command_interface_state_director.py
python
CommandInterfaceStateDirector._get_data_commands
(self)
return data_commands
Grabs and removes the data commands from the command queue. @return: a list of data commands
Grabs and removes the data commands from the command queue.
[ "Grabs", "and", "removes", "the", "data", "commands", "from", "the", "command", "queue", "." ]
def _get_data_commands(self): """ Grabs and removes the data commands from the command queue. @return: a list of data commands """ # Grab the data commands data_commands = [element for element in self._commands if isinstance(element, DataCommand)] return data_com...
[ "def", "_get_data_commands", "(", "self", ")", ":", "# Grab the data commands", "data_commands", "=", "[", "element", "for", "element", "in", "self", ".", "_commands", "if", "isinstance", "(", "element", ",", "DataCommand", ")", "]", "return", "data_commands" ]
https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/SANS/sans/command_interface/command_interface_state_director.py#L198-L206
H-uru/Plasma
c2140ea046e82e9c199e257a7f2e7edb42602871
Scripts/Python/xAvatarCustomization.py
python
xAvatarCustomization.IMorphOneItem
(self,knobID,itemName)
Morph a specific item
Morph a specific item
[ "Morph", "a", "specific", "item" ]
def IMorphOneItem(self,knobID,itemName): "Morph a specific item" global TheCloset if knobID < kMorphSliderOffset or knobID >= kMorphSliderOffset+kNumberOfMorphs: return morphKnob = ptGUIControlValue(AvCustGUI.dialog.getControlFromTag(knobID)) morphVal = self.ISliderT...
[ "def", "IMorphOneItem", "(", "self", ",", "knobID", ",", "itemName", ")", ":", "global", "TheCloset", "if", "knobID", "<", "kMorphSliderOffset", "or", "knobID", ">=", "kMorphSliderOffset", "+", "kNumberOfMorphs", ":", "return", "morphKnob", "=", "ptGUIControlValue...
https://github.com/H-uru/Plasma/blob/c2140ea046e82e9c199e257a7f2e7edb42602871/Scripts/Python/xAvatarCustomization.py#L1614-L1632
kungfu-origin/kungfu
90c84b2b590855654cb9a6395ed050e0f7763512
core/deps/SQLiteCpp-2.3.0/cpplint.py
python
FindNextMultiLineCommentEnd
(lines, lineix)
return len(lines)
We are inside a comment, find the end marker.
We are inside a comment, find the end marker.
[ "We", "are", "inside", "a", "comment", "find", "the", "end", "marker", "." ]
def FindNextMultiLineCommentEnd(lines, lineix): """We are inside a comment, find the end marker.""" while lineix < len(lines): if lines[lineix].strip().endswith('*/'): return lineix lineix += 1 return len(lines)
[ "def", "FindNextMultiLineCommentEnd", "(", "lines", ",", "lineix", ")", ":", "while", "lineix", "<", "len", "(", "lines", ")", ":", "if", "lines", "[", "lineix", "]", ".", "strip", "(", ")", ".", "endswith", "(", "'*/'", ")", ":", "return", "lineix", ...
https://github.com/kungfu-origin/kungfu/blob/90c84b2b590855654cb9a6395ed050e0f7763512/core/deps/SQLiteCpp-2.3.0/cpplint.py#L1138-L1144
BlzFans/wke
b0fa21158312e40c5fbd84682d643022b6c34a93
cygwin/lib/python2.6/mailbox.py
python
Babyl.__init__
(self, path, factory=None, create=True)
Initialize a Babyl mailbox.
Initialize a Babyl mailbox.
[ "Initialize", "a", "Babyl", "mailbox", "." ]
def __init__(self, path, factory=None, create=True): """Initialize a Babyl mailbox.""" _singlefileMailbox.__init__(self, path, factory, create) self._labels = {}
[ "def", "__init__", "(", "self", ",", "path", ",", "factory", "=", "None", ",", "create", "=", "True", ")", ":", "_singlefileMailbox", ".", "__init__", "(", "self", ",", "path", ",", "factory", ",", "create", ")", "self", ".", "_labels", "=", "{", "}"...
https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/mailbox.py#L1122-L1125
oracle/graaljs
36a56e8e993d45fc40939a3a4d9c0c24990720f1
graal-nodejs/tools/inspector_protocol/jinja2/environment.py
python
Template.is_up_to_date
(self)
return self._uptodate()
If this variable is `False` there is a newer version available.
If this variable is `False` there is a newer version available.
[ "If", "this", "variable", "is", "False", "there", "is", "a", "newer", "version", "available", "." ]
def is_up_to_date(self): """If this variable is `False` there is a newer version available.""" if self._uptodate is None: return True return self._uptodate()
[ "def", "is_up_to_date", "(", "self", ")", ":", "if", "self", ".", "_uptodate", "is", "None", ":", "return", "True", "return", "self", ".", "_uptodate", "(", ")" ]
https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/tools/inspector_protocol/jinja2/environment.py#L1118-L1122
GoSSIP-SJTU/TripleDoggy
03648d6b19c812504b14e8b98c8c7b3f443f4e54
tools/clang/bindings/python/clang/cindex.py
python
CursorKind.is_reference
(self)
return conf.lib.clang_isReference(self)
Test if this is a reference kind.
Test if this is a reference kind.
[ "Test", "if", "this", "is", "a", "reference", "kind", "." ]
def is_reference(self): """Test if this is a reference kind.""" return conf.lib.clang_isReference(self)
[ "def", "is_reference", "(", "self", ")", ":", "return", "conf", ".", "lib", ".", "clang_isReference", "(", "self", ")" ]
https://github.com/GoSSIP-SJTU/TripleDoggy/blob/03648d6b19c812504b14e8b98c8c7b3f443f4e54/tools/clang/bindings/python/clang/cindex.py#L661-L663
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/tools/python/src/Lib/codecs.py
python
IncrementalDecoder.setstate
(self, state)
Set the current state of the decoder. state must have been returned by getstate(). The effect of setstate((b"", 0)) must be equivalent to reset().
Set the current state of the decoder.
[ "Set", "the", "current", "state", "of", "the", "decoder", "." ]
def setstate(self, state): """ Set the current state of the decoder. state must have been returned by getstate(). The effect of setstate((b"", 0)) must be equivalent to reset(). """
[ "def", "setstate", "(", "self", ",", "state", ")", ":" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/codecs.py#L288-L294
PaddlePaddle/Paddle
1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c
python/paddle/distributed/ps/utils/public.py
python
find_heter_ops
(program, default_device="cpu")
return origin_porgram, heter_ops, default_ops, program_block_ops
re-place sum op to fix bug for union forward backward op
re-place sum op to fix bug for union forward backward op
[ "re", "-", "place", "sum", "op", "to", "fix", "bug", "for", "union", "forward", "backward", "op" ]
def find_heter_ops(program, default_device="cpu"): if default_device not in DEVICE_LIST: raise ValueError("Given device {} is not in device list {}".format( default_device, DEVICE_LIST)) def _is_heter_op(op, current_heter_device, default_device="cpu"): heter_devices = list(DEVICE_LI...
[ "def", "find_heter_ops", "(", "program", ",", "default_device", "=", "\"cpu\"", ")", ":", "if", "default_device", "not", "in", "DEVICE_LIST", ":", "raise", "ValueError", "(", "\"Given device {} is not in device list {}\"", ".", "format", "(", "default_device", ",", ...
https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/distributed/ps/utils/public.py#L331-L577
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/unicode.py
python
unicode_partition
(data, sep)
return impl
Implements str.partition()
Implements str.partition()
[ "Implements", "str", ".", "partition", "()" ]
def unicode_partition(data, sep): """Implements str.partition()""" thety = sep # if the type is omitted, the concrete type is the value if isinstance(sep, types.Omitted): thety = sep.value # if the type is optional, the concrete type is the captured type elif isinstance(sep, types.Option...
[ "def", "unicode_partition", "(", "data", ",", "sep", ")", ":", "thety", "=", "sep", "# if the type is omitted, the concrete type is the value", "if", "isinstance", "(", "sep", ",", "types", ".", "Omitted", ")", ":", "thety", "=", "sep", ".", "value", "# if the t...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/unicode.py#L671-L702
SFTtech/openage
d6a08c53c48dc1e157807471df92197f6ca9e04d
openage/log/__init__.py
python
verbosity_to_level
(verbosity)
return levels[clamp(-verbosity + 3, 0, len(levels) - 1)]
Translates an integer verbosity to a log level.
Translates an integer verbosity to a log level.
[ "Translates", "an", "integer", "verbosity", "to", "a", "log", "level", "." ]
def verbosity_to_level(verbosity): """ Translates an integer verbosity to a log level. """ levels = [logging.getLevelName("MIN"), logging.getLevelName("SPAM"), logging.DEBUG, logging.INFO, logging.WARNING, logging.ERROR, ...
[ "def", "verbosity_to_level", "(", "verbosity", ")", ":", "levels", "=", "[", "logging", ".", "getLevelName", "(", "\"MIN\"", ")", ",", "logging", ".", "getLevelName", "(", "\"SPAM\"", ")", ",", "logging", ".", "DEBUG", ",", "logging", ".", "INFO", ",", "...
https://github.com/SFTtech/openage/blob/d6a08c53c48dc1e157807471df92197f6ca9e04d/openage/log/__init__.py#L129-L142
hpi-xnor/BMXNet
ed0b201da6667887222b8e4b5f997c4f6b61943d
example/ssd/dataset/pascal_voc.py
python
PascalVoc._get_imsize
(self, im_name)
return (img.shape[0], img.shape[1])
get image size info Returns: ---------- tuple of (height, width)
get image size info Returns: ---------- tuple of (height, width)
[ "get", "image", "size", "info", "Returns", ":", "----------", "tuple", "of", "(", "height", "width", ")" ]
def _get_imsize(self, im_name): """ get image size info Returns: ---------- tuple of (height, width) """ img = cv2.imread(im_name) return (img.shape[0], img.shape[1])
[ "def", "_get_imsize", "(", "self", ",", "im_name", ")", ":", "img", "=", "cv2", ".", "imread", "(", "im_name", ")", "return", "(", "img", ".", "shape", "[", "0", "]", ",", "img", ".", "shape", "[", "1", "]", ")" ]
https://github.com/hpi-xnor/BMXNet/blob/ed0b201da6667887222b8e4b5f997c4f6b61943d/example/ssd/dataset/pascal_voc.py#L278-L286
apple/turicreate
cce55aa5311300e3ce6af93cb45ba791fd1bdf49
src/external/boost/boost_1_68_0/tools/litre/cplusplus.py
python
CPlusPlusTranslator._execute
(self, code)
Override of litre._execute; sets up variable context before evaluating code
Override of litre._execute; sets up variable context before evaluating code
[ "Override", "of", "litre", ".", "_execute", ";", "sets", "up", "variable", "context", "before", "evaluating", "code" ]
def _execute(self, code): """Override of litre._execute; sets up variable context before evaluating code """ self.globals['example'] = self.example eval(code, self.globals)
[ "def", "_execute", "(", "self", ",", "code", ")", ":", "self", ".", "globals", "[", "'example'", "]", "=", "self", ".", "example", "eval", "(", "code", ",", "self", ".", "globals", ")" ]
https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/external/boost/boost_1_68_0/tools/litre/cplusplus.py#L320-L325