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
gnuradio/gnuradio
09c3c4fa4bfb1a02caac74cb5334dfe065391e3b
gr-utils/modtool/tools/util_functions.py
python
str_to_python_comment
(text)
return outstr
Return a string as a Python formatted comment.
Return a string as a Python formatted comment.
[ "Return", "a", "string", "as", "a", "Python", "formatted", "comment", "." ]
def str_to_python_comment(text): """ Return a string as a Python formatted comment. """ l_lines = text.splitlines() if len(l_lines[0]) == 0: outstr = "#\n" else: outstr = "# " + l_lines[0] + "\n" for line in l_lines[1:]: if len(line) == 0: outstr += "#\n" ...
[ "def", "str_to_python_comment", "(", "text", ")", ":", "l_lines", "=", "text", ".", "splitlines", "(", ")", "if", "len", "(", "l_lines", "[", "0", "]", ")", "==", "0", ":", "outstr", "=", "\"#\\n\"", "else", ":", "outstr", "=", "\"# \"", "+", "l_line...
https://github.com/gnuradio/gnuradio/blob/09c3c4fa4bfb1a02caac74cb5334dfe065391e3b/gr-utils/modtool/tools/util_functions.py#L61-L74
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
wx/lib/pubsub/core/topicmgr.py
python
TopicManager.getTopic
(self, name, okIfNone=False)
Get the Topic instance for the given topic name. By default, raises an TopicNameError exception if a topic with given name doesn't exist. If okIfNone=True, returns None instead of raising an exception.
Get the Topic instance for the given topic name. By default, raises an TopicNameError exception if a topic with given name doesn't exist. If okIfNone=True, returns None instead of raising an exception.
[ "Get", "the", "Topic", "instance", "for", "the", "given", "topic", "name", ".", "By", "default", "raises", "an", "TopicNameError", "exception", "if", "a", "topic", "with", "given", "name", "doesn", "t", "exist", ".", "If", "okIfNone", "=", "True", "returns...
def getTopic(self, name, okIfNone=False): """Get the Topic instance for the given topic name. By default, raises an TopicNameError exception if a topic with given name doesn't exist. If okIfNone=True, returns None instead of raising an exception.""" topicNameDotted = stringize(name) ...
[ "def", "getTopic", "(", "self", ",", "name", ",", "okIfNone", "=", "False", ")", ":", "topicNameDotted", "=", "stringize", "(", "name", ")", "#if not name:", "# raise TopicNameError(name, 'Empty topic name not allowed')", "obj", "=", "self", ".", "_topicsMap", "....
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/pubsub/core/topicmgr.py#L128-L152
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
third_party/catapult/third_party/html5lib-python/html5lib/inputstream.py
python
HTMLBinaryInputStream.openStream
(self, source)
return stream
Produces a file object from source. source can be either a file object, local filename or a string.
Produces a file object from source.
[ "Produces", "a", "file", "object", "from", "source", "." ]
def openStream(self, source): """Produces a file object from source. source can be either a file object, local filename or a string. """ # Already a file object if hasattr(source, 'read'): stream = source else: stream = BytesIO(source) t...
[ "def", "openStream", "(", "self", ",", "source", ")", ":", "# Already a file object", "if", "hasattr", "(", "source", ",", "'read'", ")", ":", "stream", "=", "source", "else", ":", "stream", "=", "BytesIO", "(", "source", ")", "try", ":", "stream", ".", ...
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/html5lib-python/html5lib/inputstream.py#L443-L460
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/pandas/py2/pandas/compat/numpy/function.py
python
validate_take_with_convert
(convert, args, kwargs)
return convert
If this function is called via the 'numpy' library, the third parameter in its signature is 'axis', which takes either an ndarray or 'None', so check if the 'convert' parameter is either an instance of ndarray or is None
If this function is called via the 'numpy' library, the third parameter in its signature is 'axis', which takes either an ndarray or 'None', so check if the 'convert' parameter is either an instance of ndarray or is None
[ "If", "this", "function", "is", "called", "via", "the", "numpy", "library", "the", "third", "parameter", "in", "its", "signature", "is", "axis", "which", "takes", "either", "an", "ndarray", "or", "None", "so", "check", "if", "the", "convert", "parameter", ...
def validate_take_with_convert(convert, args, kwargs): """ If this function is called via the 'numpy' library, the third parameter in its signature is 'axis', which takes either an ndarray or 'None', so check if the 'convert' parameter is either an instance of ndarray or is None """ if isin...
[ "def", "validate_take_with_convert", "(", "convert", ",", "args", ",", "kwargs", ")", ":", "if", "isinstance", "(", "convert", ",", "ndarray", ")", "or", "convert", "is", "None", ":", "args", "=", "(", "convert", ",", ")", "+", "args", "convert", "=", ...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/compat/numpy/function.py#L265-L278
xiaolonw/caffe-video_triplet
c39ea1ad6e937ccf7deba4510b7e555165abf05f
python/caffe/draw.py
python
get_layer_label
(layer, rankdir)
return node_label
Define node label based on layer type. Parameters ---------- layer : ? rankdir : {'LR', 'TB', 'BT'} Direction of graph layout. Returns ------- string : A label for the current layer
Define node label based on layer type.
[ "Define", "node", "label", "based", "on", "layer", "type", "." ]
def get_layer_label(layer, rankdir): """Define node label based on layer type. Parameters ---------- layer : ? rankdir : {'LR', 'TB', 'BT'} Direction of graph layout. Returns ------- string : A label for the current layer """ if rankdir in ('TB', 'BT'): ...
[ "def", "get_layer_label", "(", "layer", ",", "rankdir", ")", ":", "if", "rankdir", "in", "(", "'TB'", ",", "'BT'", ")", ":", "# If graph orientation is vertical, horizontal space is free and", "# vertical space is not; separate words with spaces", "separator", "=", "' '", ...
https://github.com/xiaolonw/caffe-video_triplet/blob/c39ea1ad6e937ccf7deba4510b7e555165abf05f/python/caffe/draw.py#L53-L105
thalium/icebox
99d147d5b9269222225443ce171b4fd46d8985d4
third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2class.py
python
xmlNode.debugDumpOneNode
(self, output, depth)
Dumps debug information for the element node, it is not recursive
Dumps debug information for the element node, it is not recursive
[ "Dumps", "debug", "information", "for", "the", "element", "node", "it", "is", "not", "recursive" ]
def debugDumpOneNode(self, output, depth): """Dumps debug information for the element node, it is not recursive """ libxml2mod.xmlDebugDumpOneNode(output, self._o, depth)
[ "def", "debugDumpOneNode", "(", "self", ",", "output", ",", "depth", ")", ":", "libxml2mod", ".", "xmlDebugDumpOneNode", "(", "output", ",", "self", ".", "_o", ",", "depth", ")" ]
https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2class.py#L2267-L2270
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/msw/stc.py
python
StyledTextCtrl.DocumentStart
(*args, **kwargs)
return _stc.StyledTextCtrl_DocumentStart(*args, **kwargs)
DocumentStart(self) Move caret to first position in document.
DocumentStart(self)
[ "DocumentStart", "(", "self", ")" ]
def DocumentStart(*args, **kwargs): """ DocumentStart(self) Move caret to first position in document. """ return _stc.StyledTextCtrl_DocumentStart(*args, **kwargs)
[ "def", "DocumentStart", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_stc", ".", "StyledTextCtrl_DocumentStart", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/stc.py#L4456-L4462
MythTV/mythtv
d282a209cb8be85d036f85a62a8ec971b67d45f4
mythtv/contrib/imports/mirobridge/mirobridge.py
python
is_not_punct_char
(char)
return not is_punct_char(char)
check if char is not punctuation char return True if char is not punctuation return False if char is punctuation
check if char is not punctuation char return True if char is not punctuation return False if char is punctuation
[ "check", "if", "char", "is", "not", "punctuation", "char", "return", "True", "if", "char", "is", "not", "punctuation", "return", "False", "if", "char", "is", "punctuation" ]
def is_not_punct_char(char): '''check if char is not punctuation char return True if char is not punctuation return False if char is punctuation ''' return not is_punct_char(char)
[ "def", "is_not_punct_char", "(", "char", ")", ":", "return", "not", "is_punct_char", "(", "char", ")" ]
https://github.com/MythTV/mythtv/blob/d282a209cb8be85d036f85a62a8ec971b67d45f4/mythtv/contrib/imports/mirobridge/mirobridge.py#L692-L697
klzgrad/naiveproxy
ed2c513637c77b18721fe428d7ed395b4d284c83
src/build/android/resource_sizes.py
python
_MeasureApkSignatureBlock
(zip_file)
return start_of_central_directory - end_of_last_file
Measures the size of the v2 / v3 signing block. Refer to: https://source.android.com/security/apksigning/v2
Measures the size of the v2 / v3 signing block.
[ "Measures", "the", "size", "of", "the", "v2", "/", "v3", "signing", "block", "." ]
def _MeasureApkSignatureBlock(zip_file): """Measures the size of the v2 / v3 signing block. Refer to: https://source.android.com/security/apksigning/v2 """ # Seek to "end of central directory" struct. eocd_offset_from_end = -22 - len(zip_file.comment) zip_file.fp.seek(eocd_offset_from_end, os.SEEK_END) a...
[ "def", "_MeasureApkSignatureBlock", "(", "zip_file", ")", ":", "# Seek to \"end of central directory\" struct.", "eocd_offset_from_end", "=", "-", "22", "-", "len", "(", "zip_file", ".", "comment", ")", "zip_file", ".", "fp", ".", "seek", "(", "eocd_offset_from_end", ...
https://github.com/klzgrad/naiveproxy/blob/ed2c513637c77b18721fe428d7ed395b4d284c83/src/build/android/resource_sizes.py#L148-L169
Xilinx/Vitis-AI
fc74d404563d9951b57245443c73bef389f3657f
tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/variables.py
python
RefVariable.initial_value
(self)
return self._initial_value
Returns the Tensor used as the initial value for the variable. Note that this is different from `initialized_value()` which runs the op that initializes the variable before returning its value. This method returns the tensor that is used by the op that initializes the variable. Returns: A `T...
Returns the Tensor used as the initial value for the variable.
[ "Returns", "the", "Tensor", "used", "as", "the", "initial", "value", "for", "the", "variable", "." ]
def initial_value(self): """Returns the Tensor used as the initial value for the variable. Note that this is different from `initialized_value()` which runs the op that initializes the variable before returning its value. This method returns the tensor that is used by the op that initializes the va...
[ "def", "initial_value", "(", "self", ")", ":", "return", "self", ".", "_initial_value" ]
https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/variables.py#L2027-L2038
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/numpy/py3/numpy/distutils/ccompiler_opt.py
python
_Feature.feature_get_til
(self, names, keyisfalse)
return self.feature_sorted(names)
same as `feature_implies_c()` but stop collecting implied features when feature's option that provided through parameter 'keyisfalse' is False, also sorting the returned features.
same as `feature_implies_c()` but stop collecting implied features when feature's option that provided through parameter 'keyisfalse' is False, also sorting the returned features.
[ "same", "as", "feature_implies_c", "()", "but", "stop", "collecting", "implied", "features", "when", "feature", "s", "option", "that", "provided", "through", "parameter", "keyisfalse", "is", "False", "also", "sorting", "the", "returned", "features", "." ]
def feature_get_til(self, names, keyisfalse): """ same as `feature_implies_c()` but stop collecting implied features when feature's option that provided through parameter 'keyisfalse' is False, also sorting the returned features. """ def til(tnames): #...
[ "def", "feature_get_til", "(", "self", ",", "names", ",", "keyisfalse", ")", ":", "def", "til", "(", "tnames", ")", ":", "# sort from highest to lowest interest then cut if \"key\" is False", "tnames", "=", "self", ".", "feature_implies_c", "(", "tnames", ")", "tnam...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py3/numpy/distutils/ccompiler_opt.py#L1390-L1415
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_vendor/requests/cookies.py
python
RequestsCookieJar.list_domains
(self)
return domains
Utility method to list all the domains in the jar.
Utility method to list all the domains in the jar.
[ "Utility", "method", "to", "list", "all", "the", "domains", "in", "the", "jar", "." ]
def list_domains(self): """Utility method to list all the domains in the jar.""" domains = [] for cookie in iter(self): if cookie.domain not in domains: domains.append(cookie.domain) return domains
[ "def", "list_domains", "(", "self", ")", ":", "domains", "=", "[", "]", "for", "cookie", "in", "iter", "(", "self", ")", ":", "if", "cookie", ".", "domain", "not", "in", "domains", ":", "domains", ".", "append", "(", "cookie", ".", "domain", ")", "...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_vendor/requests/cookies.py#L539-L551
deepmind/open_spiel
4ca53bea32bb2875c7385d215424048ae92f78c8
open_spiel/python/games/tic_tac_toe.py
python
BoardObserver.string_from
(self, state, player)
return _board_to_string(state.board)
Observation of `state` from the PoV of `player`, as a string.
Observation of `state` from the PoV of `player`, as a string.
[ "Observation", "of", "state", "from", "the", "PoV", "of", "player", "as", "a", "string", "." ]
def string_from(self, state, player): """Observation of `state` from the PoV of `player`, as a string.""" del player return _board_to_string(state.board)
[ "def", "string_from", "(", "self", ",", "state", ",", "player", ")", ":", "del", "player", "return", "_board_to_string", "(", "state", ".", "board", ")" ]
https://github.com/deepmind/open_spiel/blob/4ca53bea32bb2875c7385d215424048ae92f78c8/open_spiel/python/games/tic_tac_toe.py#L160-L163
turi-code/SFrame
796b9bdfb2fa1b881d82080754643c7e68629cd2
oss_src/unity/python/sframe/data_structures/sarray.py
python
SArray.std
(self, ddof=0)
Standard deviation of all the values in the SArray. Returns None on an empty SArray. Raises an exception if called on an SArray with non-numeric type or if `ddof` >= length of SArray. Parameters ---------- ddof : int, optional "delta degrees of freedom" in the varia...
Standard deviation of all the values in the SArray.
[ "Standard", "deviation", "of", "all", "the", "values", "in", "the", "SArray", "." ]
def std(self, ddof=0): """ Standard deviation of all the values in the SArray. Returns None on an empty SArray. Raises an exception if called on an SArray with non-numeric type or if `ddof` >= length of SArray. Parameters ---------- ddof : int, optional ...
[ "def", "std", "(", "self", ",", "ddof", "=", "0", ")", ":", "with", "cython_context", "(", ")", ":", "return", "self", ".", "__proxy__", ".", "std", "(", "ddof", ")" ]
https://github.com/turi-code/SFrame/blob/796b9bdfb2fa1b881d82080754643c7e68629cd2/oss_src/unity/python/sframe/data_structures/sarray.py#L2241-L2259
bryanyzhu/Hidden-Two-Stream
f7f684adbdacb6df6b1cf196c3a476cd23484a0f
scripts/cpp_lint.py
python
ProcessFileData
(filename, file_extension, lines, error, extra_check_functions=[])
Performs lint checks and reports any errors to the given error function. Args: filename: Filename of the file that is being processed. file_extension: The extension (dot not included) of the file. lines: An array of strings, each representing a line of the file, with the last element being emp...
Performs lint checks and reports any errors to the given error function.
[ "Performs", "lint", "checks", "and", "reports", "any", "errors", "to", "the", "given", "error", "function", "." ]
def ProcessFileData(filename, file_extension, lines, error, extra_check_functions=[]): """Performs lint checks and reports any errors to the given error function. Args: filename: Filename of the file that is being processed. file_extension: The extension (dot not included) of the file. ...
[ "def", "ProcessFileData", "(", "filename", ",", "file_extension", ",", "lines", ",", "error", ",", "extra_check_functions", "=", "[", "]", ")", ":", "lines", "=", "(", "[", "'// marker so line numbers and indices both start at 1'", "]", "+", "lines", "+", "[", "...
https://github.com/bryanyzhu/Hidden-Two-Stream/blob/f7f684adbdacb6df6b1cf196c3a476cd23484a0f/scripts/cpp_lint.py#L4644-L4687
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/botocore/client.py
python
BaseClient.waiter_names
(self)
return [xform_name(name) for name in model.waiter_names]
Returns a list of all available waiters.
Returns a list of all available waiters.
[ "Returns", "a", "list", "of", "all", "available", "waiters", "." ]
def waiter_names(self): """Returns a list of all available waiters.""" config = self._get_waiter_config() if not config: return [] model = waiter.WaiterModel(config) # Waiter configs is a dict, we just want the waiter names # which are the keys in the dict. ...
[ "def", "waiter_names", "(", "self", ")", ":", "config", "=", "self", ".", "_get_waiter_config", "(", ")", "if", "not", "config", ":", "return", "[", "]", "model", "=", "waiter", ".", "WaiterModel", "(", "config", ")", "# Waiter configs is a dict, we just want ...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/botocore/client.py#L800-L808
thalium/icebox
99d147d5b9269222225443ce171b4fd46d8985d4
third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2class.py
python
xmlTextReader.GetAttributeNs
(self, localName, namespaceURI)
return ret
Provides the value of the specified attribute
Provides the value of the specified attribute
[ "Provides", "the", "value", "of", "the", "specified", "attribute" ]
def GetAttributeNs(self, localName, namespaceURI): """Provides the value of the specified attribute """ ret = libxml2mod.xmlTextReaderGetAttributeNs(self._o, localName, namespaceURI) return ret
[ "def", "GetAttributeNs", "(", "self", ",", "localName", ",", "namespaceURI", ")", ":", "ret", "=", "libxml2mod", ".", "xmlTextReaderGetAttributeNs", "(", "self", ".", "_o", ",", "localName", ",", "namespaceURI", ")", "return", "ret" ]
https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2class.py#L5824-L5827
mantidproject/mantid
03deeb89254ec4289edb8771e0188c2090a02f32
scripts/Inelastic/Direct/DirectEnergyConversion.py
python
setup_reducer
(inst_name,reload_instrument=False)
Given an instrument name or prefix this sets up a converter object for the reduction. Deprecated method
Given an instrument name or prefix this sets up a converter object for the reduction. Deprecated method
[ "Given", "an", "instrument", "name", "or", "prefix", "this", "sets", "up", "a", "converter", "object", "for", "the", "reduction", ".", "Deprecated", "method" ]
def setup_reducer(inst_name,reload_instrument=False): """ Given an instrument name or prefix this sets up a converter object for the reduction. Deprecated method """ try: return DirectEnergyConversion(inst_name,reload_instrument) except RuntimeError: raise RuntimeError('Unknown i...
[ "def", "setup_reducer", "(", "inst_name", ",", "reload_instrument", "=", "False", ")", ":", "try", ":", "return", "DirectEnergyConversion", "(", "inst_name", ",", "reload_instrument", ")", "except", "RuntimeError", ":", "raise", "RuntimeError", "(", "'Unknown instru...
https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/Inelastic/Direct/DirectEnergyConversion.py#L27-L35
Kitware/ParaView
f760af9124ff4634b23ebbeab95a4f56e0261955
Wrapping/Python/paraview/servermanager.py
python
Connection.__repr__
(self)
return "Connection (%s) [%d]" % (self.Session.GetURI(), self.ID)
User friendly string representation
User friendly string representation
[ "User", "friendly", "string", "representation" ]
def __repr__(self): """User friendly string representation""" return "Connection (%s) [%d]" % (self.Session.GetURI(), self.ID)
[ "def", "__repr__", "(", "self", ")", ":", "return", "\"Connection (%s) [%d]\"", "%", "(", "self", ".", "Session", ".", "GetURI", "(", ")", ",", "self", ".", "ID", ")" ]
https://github.com/Kitware/ParaView/blob/f760af9124ff4634b23ebbeab95a4f56e0261955/Wrapping/Python/paraview/servermanager.py#L2079-L2081
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/pandas/py2/pandas/core/arrays/array_.py
python
array
(data, # type: Sequence[object] dtype=None, # type: Optional[Union[str, np.dtype, ExtensionDtype]] copy=True, # type: bool )
return result
Create an array. .. versionadded:: 0.24.0 Parameters ---------- data : Sequence of objects The scalars inside `data` should be instances of the scalar type for `dtype`. It's expected that `data` represents a 1-dimensional array of data. When `data` is an Index or Serie...
Create an array.
[ "Create", "an", "array", "." ]
def array(data, # type: Sequence[object] dtype=None, # type: Optional[Union[str, np.dtype, ExtensionDtype]] copy=True, # type: bool ): # type: (...) -> ExtensionArray """ Create an array. .. versionadded:: 0.24.0 Parameters ---------- data : Seque...
[ "def", "array", "(", "data", ",", "# type: Sequence[object]", "dtype", "=", "None", ",", "# type: Optional[Union[str, np.dtype, ExtensionDtype]]", "copy", "=", "True", ",", "# type: bool", ")", ":", "# type: (...) -> ExtensionArray", "from", "pandas", ".", "core", ".", ...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/core/arrays/array_.py#L10-L274
NVIDIA/DALI
bf16cc86ba8f091b145f91962f21fe1b6aff243d
tools/lint.py
python
lint
(dali_root_dir, file_list, process_includes, n_subproc)
return 0 if success else 1
n_subprocesses: how many subprocesses to use for linter processing Returns: 0 if lint passed, 1 otherwise
n_subprocesses: how many subprocesses to use for linter processing Returns: 0 if lint passed, 1 otherwise
[ "n_subprocesses", ":", "how", "many", "subprocesses", "to", "use", "for", "linter", "processing", "Returns", ":", "0", "if", "lint", "passed", "1", "otherwise" ]
def lint(dali_root_dir, file_list, process_includes, n_subproc): """ n_subprocesses: how many subprocesses to use for linter processing Returns: 0 if lint passed, 1 otherwise """ if len(file_list)==0: return 0 cmds = [] diff = int(len(file_list) / n_subproc) for process_idx in ra...
[ "def", "lint", "(", "dali_root_dir", ",", "file_list", ",", "process_includes", ",", "n_subproc", ")", ":", "if", "len", "(", "file_list", ")", "==", "0", ":", "return", "0", "cmds", "=", "[", "]", "diff", "=", "int", "(", "len", "(", "file_list", ")...
https://github.com/NVIDIA/DALI/blob/bf16cc86ba8f091b145f91962f21fe1b6aff243d/tools/lint.py#L96-L119
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/msw/grid.py
python
GridCellEditor.GetCellAttr
(*args, **kwargs)
return _grid.GridCellEditor_GetCellAttr(*args, **kwargs)
GetCellAttr(self) -> GridCellAttr
GetCellAttr(self) -> GridCellAttr
[ "GetCellAttr", "(", "self", ")", "-", ">", "GridCellAttr" ]
def GetCellAttr(*args, **kwargs): """GetCellAttr(self) -> GridCellAttr""" return _grid.GridCellEditor_GetCellAttr(*args, **kwargs)
[ "def", "GetCellAttr", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_grid", ".", "GridCellEditor_GetCellAttr", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/grid.py#L276-L278
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/Jinja2/py2/jinja2/runtime.py
python
identity
(x)
return x
Returns its argument. Useful for certain things in the environment.
Returns its argument. Useful for certain things in the environment.
[ "Returns", "its", "argument", ".", "Useful", "for", "certain", "things", "in", "the", "environment", "." ]
def identity(x): """Returns its argument. Useful for certain things in the environment. """ return x
[ "def", "identity", "(", "x", ")", ":", "return", "x" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/Jinja2/py2/jinja2/runtime.py#L55-L59
ricardoquesada/Spidermonkey
4a75ea2543408bd1b2c515aa95901523eeef7858
js/xpconnect/src/qsgen.py
python
parseMemberId
(memberId)
return tuple(pieces)
Split the geven member id into its parts.
Split the geven member id into its parts.
[ "Split", "the", "geven", "member", "id", "into", "its", "parts", "." ]
def parseMemberId(memberId): """ Split the geven member id into its parts. """ pieces = memberId.split('.') if len(pieces) < 2: raise UserError("Member %r: Missing dot." % memberId) if len(pieces) > 2: raise UserError("Member %r: Dots out of control." % memberId) return tuple(pieces)
[ "def", "parseMemberId", "(", "memberId", ")", ":", "pieces", "=", "memberId", ".", "split", "(", "'.'", ")", "if", "len", "(", "pieces", ")", "<", "2", ":", "raise", "UserError", "(", "\"Member %r: Missing dot.\"", "%", "memberId", ")", "if", "len", "(",...
https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/js/xpconnect/src/qsgen.py#L207-L214
idaholab/moose
9eeebc65e098b4c30f8205fb41591fd5b61eb6ff
python/MooseDocs/common/log.py
python
init_logging
(level=logging.INFO, silent=False)
Call this function to initialize the MooseDocs logging formatter.
Call this function to initialize the MooseDocs logging formatter.
[ "Call", "this", "function", "to", "initialize", "the", "MooseDocs", "logging", "formatter", "." ]
def init_logging(level=logging.INFO, silent=False): """ Call this function to initialize the MooseDocs logging formatter. """ # Custom format that colors and counts errors/warnings if silent: handler = moosesqa.SilentRecordHandler() else: handler = MultiprocessingHandler() ...
[ "def", "init_logging", "(", "level", "=", "logging", ".", "INFO", ",", "silent", "=", "False", ")", ":", "# Custom format that colors and counts errors/warnings", "if", "silent", ":", "handler", "=", "moosesqa", ".", "SilentRecordHandler", "(", ")", "else", ":", ...
https://github.com/idaholab/moose/blob/9eeebc65e098b4c30f8205fb41591fd5b61eb6ff/python/MooseDocs/common/log.py#L74-L93
OpenGenus/quark
225ad96efdfcc66cb6584a756c17eb3871e6eb62
code/code/cryptography/src/porta_cipher/porta.py
python
Porta.encipher
(self,string)
return ret
Encipher string using Porta cipher according to initialised key. Punctuation and whitespace are removed from the input. Example:: ciphertext = Porta('HELLO').encipher(plaintext) :param string: The string to encipher. :returns: The enciphered string.
Encipher string using Porta cipher according to initialised key. Punctuation and whitespace are removed from the input. Example:: ciphertext = Porta('HELLO').encipher(plaintext) :param string: The string to encipher. :returns: The enciphered string.
[ "Encipher", "string", "using", "Porta", "cipher", "according", "to", "initialised", "key", ".", "Punctuation", "and", "whitespace", "are", "removed", "from", "the", "input", ".", "Example", "::", "ciphertext", "=", "Porta", "(", "HELLO", ")", ".", "encipher", ...
def encipher(self,string): """Encipher string using Porta cipher according to initialised key. Punctuation and whitespace are removed from the input. Example:: ciphertext = Porta('HELLO').encipher(plaintext) :param string: The string to encipher. :returns:...
[ "def", "encipher", "(", "self", ",", "string", ")", ":", "string", "=", "self", ".", "remove_punctuation", "(", "string", ")", "ret", "=", "''", "for", "(", "i", ",", "c", ")", "in", "enumerate", "(", "string", ")", ":", "i", "=", "i", "%", "len"...
https://github.com/OpenGenus/quark/blob/225ad96efdfcc66cb6584a756c17eb3871e6eb62/code/code/cryptography/src/porta_cipher/porta.py#L12-L37
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/pydoc.py
python
cram
(text, maxlen)
return text
Omit part of a string if needed to make it fit in a maximum length.
Omit part of a string if needed to make it fit in a maximum length.
[ "Omit", "part", "of", "a", "string", "if", "needed", "to", "make", "it", "fit", "in", "a", "maximum", "length", "." ]
def cram(text, maxlen): """Omit part of a string if needed to make it fit in a maximum length.""" if len(text) > maxlen: pre = max(0, (maxlen-3)//2) post = max(0, maxlen-3-pre) return text[:pre] + '...' + text[len(text)-post:] return text
[ "def", "cram", "(", "text", ",", "maxlen", ")", ":", "if", "len", "(", "text", ")", ">", "maxlen", ":", "pre", "=", "max", "(", "0", ",", "(", "maxlen", "-", "3", ")", "//", "2", ")", "post", "=", "max", "(", "0", ",", "maxlen", "-", "3", ...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/pydoc.py#L127-L133
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/scikit-learn/py3/sklearn/feature_extraction/text.py
python
CountVectorizer.fit_transform
(self, raw_documents, y=None)
return X
Learn the vocabulary dictionary and return term-document matrix. This is equivalent to fit followed by transform, but more efficiently implemented. Parameters ---------- raw_documents : iterable An iterable which yields either str, unicode or file objects. ...
Learn the vocabulary dictionary and return term-document matrix.
[ "Learn", "the", "vocabulary", "dictionary", "and", "return", "term", "-", "document", "matrix", "." ]
def fit_transform(self, raw_documents, y=None): """Learn the vocabulary dictionary and return term-document matrix. This is equivalent to fit followed by transform, but more efficiently implemented. Parameters ---------- raw_documents : iterable An iterable ...
[ "def", "fit_transform", "(", "self", ",", "raw_documents", ",", "y", "=", "None", ")", ":", "# We intentionally don't call the transform method to make", "# fit_transform overridable without unwanted side effects in", "# TfidfVectorizer.", "if", "isinstance", "(", "raw_documents"...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py3/sklearn/feature_extraction/text.py#L1189-L1245
wlanjie/AndroidFFmpeg
7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf
tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/urlparse.py
python
unquote
(s)
return ''.join(res)
unquote('abc%20def') -> 'abc def'.
unquote('abc%20def') -> 'abc def'.
[ "unquote", "(", "abc%20def", ")", "-", ">", "abc", "def", "." ]
def unquote(s): """unquote('abc%20def') -> 'abc def'.""" if _is_unicode(s): if '%' not in s: return s bits = _asciire.split(s) res = [bits[0]] append = res.append for i in range(1, len(bits), 2): append(unquote(str(bits[i])).decode('latin1')) ...
[ "def", "unquote", "(", "s", ")", ":", "if", "_is_unicode", "(", "s", ")", ":", "if", "'%'", "not", "in", "s", ":", "return", "s", "bits", "=", "_asciire", ".", "split", "(", "s", ")", "res", "=", "[", "bits", "[", "0", "]", "]", "append", "="...
https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/urlparse.py#L335-L361
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/cuda/compiler.py
python
CUDAKernel.occupancy
(self)
return self.autotune.closest(thread_per_block)
Occupancy is the ratio of the number of active warps per multiprocessor to the maximum number of warps that can be active on the multiprocessor at once. Calculate the theoretical occupancy of the kernel given the current configuration.
Occupancy is the ratio of the number of active warps per multiprocessor to the maximum number of warps that can be active on the multiprocessor at once. Calculate the theoretical occupancy of the kernel given the current configuration.
[ "Occupancy", "is", "the", "ratio", "of", "the", "number", "of", "active", "warps", "per", "multiprocessor", "to", "the", "maximum", "number", "of", "warps", "that", "can", "be", "active", "on", "the", "multiprocessor", "at", "once", ".", "Calculate", "the", ...
def occupancy(self): """Occupancy is the ratio of the number of active warps per multiprocessor to the maximum number of warps that can be active on the multiprocessor at once. Calculate the theoretical occupancy of the kernel given the current configuration.""" warnings.warn(_de...
[ "def", "occupancy", "(", "self", ")", ":", "warnings", ".", "warn", "(", "_deprec_warn_msg", ".", "format", "(", "'occupancy'", ")", ",", "DeprecationWarning", ")", "thread_per_block", "=", "reduce", "(", "operator", ".", "mul", ",", "self", ".", "blockdim",...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/cuda/compiler.py#L737-L744
msracver/Deep-Image-Analogy
632b9287b42552e32dad64922967c8c9ec7fc4d3
python/caffe/pycaffe.py
python
_Net_blob_loss_weights
(self)
return self._blob_loss_weights_dict
An OrderedDict (bottom to top, i.e., input to output) of network blob loss weights indexed by name
An OrderedDict (bottom to top, i.e., input to output) of network blob loss weights indexed by name
[ "An", "OrderedDict", "(", "bottom", "to", "top", "i", ".", "e", ".", "input", "to", "output", ")", "of", "network", "blob", "loss", "weights", "indexed", "by", "name" ]
def _Net_blob_loss_weights(self): """ An OrderedDict (bottom to top, i.e., input to output) of network blob loss weights indexed by name """ if not hasattr(self, '_blobs_loss_weights_dict'): self._blob_loss_weights_dict = OrderedDict(zip(self._blob_names, ...
[ "def", "_Net_blob_loss_weights", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_blobs_loss_weights_dict'", ")", ":", "self", ".", "_blob_loss_weights_dict", "=", "OrderedDict", "(", "zip", "(", "self", ".", "_blob_names", ",", "self", ".",...
https://github.com/msracver/Deep-Image-Analogy/blob/632b9287b42552e32dad64922967c8c9ec7fc4d3/python/caffe/pycaffe.py#L36-L44
apiaryio/drafter
4634ebd07f6c6f257cc656598ccd535492fdfb55
tools/gyp/pylib/gyp/generator/android.py
python
AndroidMkWriter.WriteRules
(self, rules, extra_sources, extra_outputs)
Write Makefile code for any 'rules' from the gyp input. extra_sources: a list that will be filled in with newly generated source files, if any extra_outputs: a list that will be filled in with any outputs of these rules (used to make other pieces dependent on these rules)
Write Makefile code for any 'rules' from the gyp input.
[ "Write", "Makefile", "code", "for", "any", "rules", "from", "the", "gyp", "input", "." ]
def WriteRules(self, rules, extra_sources, extra_outputs): """Write Makefile code for any 'rules' from the gyp input. extra_sources: a list that will be filled in with newly generated source files, if any extra_outputs: a list that will be filled in with any outputs of these ...
[ "def", "WriteRules", "(", "self", ",", "rules", ",", "extra_sources", ",", "extra_outputs", ")", ":", "if", "len", "(", "rules", ")", "==", "0", ":", "return", "rule_trigger", "=", "'%s_rule_trigger'", "%", "self", ".", "android_module", "did_write_rule", "=...
https://github.com/apiaryio/drafter/blob/4634ebd07f6c6f257cc656598ccd535492fdfb55/tools/gyp/pylib/gyp/generator/android.py#L330-L421
miyosuda/TensorFlowAndroidDemo
35903e0221aa5f109ea2dbef27f20b52e317f42d
jni-build/jni/include/tensorflow/contrib/learn/python/learn/datasets/mnist.py
python
dense_to_one_hot
(labels_dense, num_classes)
return labels_one_hot
Convert class labels from scalars to one-hot vectors.
Convert class labels from scalars to one-hot vectors.
[ "Convert", "class", "labels", "from", "scalars", "to", "one", "-", "hot", "vectors", "." ]
def dense_to_one_hot(labels_dense, num_classes): """Convert class labels from scalars to one-hot vectors.""" num_labels = labels_dense.shape[0] index_offset = numpy.arange(num_labels) * num_classes labels_one_hot = numpy.zeros((num_labels, num_classes)) labels_one_hot.flat[index_offset + labels_dense.ravel()]...
[ "def", "dense_to_one_hot", "(", "labels_dense", ",", "num_classes", ")", ":", "num_labels", "=", "labels_dense", ".", "shape", "[", "0", "]", "index_offset", "=", "numpy", ".", "arange", "(", "num_labels", ")", "*", "num_classes", "labels_one_hot", "=", "numpy...
https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/contrib/learn/python/learn/datasets/mnist.py#L56-L62
GJDuck/LowFat
ecf6a0f0fa1b73a27a626cf493cc39e477b6faea
llvm-4.0.0.src/tools/clang/bindings/python/clang/cindex.py
python
CompilationDatabase.getCompileCommands
(self, filename)
return conf.lib.clang_CompilationDatabase_getCompileCommands(self, filename)
Get an iterable object providing all the CompileCommands available to build filename. Returns None if filename is not found in the database.
Get an iterable object providing all the CompileCommands available to build filename. Returns None if filename is not found in the database.
[ "Get", "an", "iterable", "object", "providing", "all", "the", "CompileCommands", "available", "to", "build", "filename", ".", "Returns", "None", "if", "filename", "is", "not", "found", "in", "the", "database", "." ]
def getCompileCommands(self, filename): """ Get an iterable object providing all the CompileCommands available to build filename. Returns None if filename is not found in the database. """ return conf.lib.clang_CompilationDatabase_getCompileCommands(self, ...
[ "def", "getCompileCommands", "(", "self", ",", "filename", ")", ":", "return", "conf", ".", "lib", ".", "clang_CompilationDatabase_getCompileCommands", "(", "self", ",", "filename", ")" ]
https://github.com/GJDuck/LowFat/blob/ecf6a0f0fa1b73a27a626cf493cc39e477b6faea/llvm-4.0.0.src/tools/clang/bindings/python/clang/cindex.py#L2987-L2993
facebook/folly
744a0a698074d1b013813065fe60f545aa2c9b94
build/fbcode_builder/getdeps/builder.py
python
CargoBuilder._resolve_crate_to_path
(crate, git_conf)
Tries to find <crate> in git_conf["inst_dir"] by searching a [package] keyword followed by name = "<crate>".
Tries to find <crate> in git_conf["inst_dir"] by searching a [package] keyword followed by name = "<crate>".
[ "Tries", "to", "find", "<crate", ">", "in", "git_conf", "[", "inst_dir", "]", "by", "searching", "a", "[", "package", "]", "keyword", "followed", "by", "name", "=", "<crate", ">", "." ]
def _resolve_crate_to_path(crate, git_conf): """ Tries to find <crate> in git_conf["inst_dir"] by searching a [package] keyword followed by name = "<crate>". """ source_dir = git_conf["source_dir"] search_pattern = '[package]\nname = "{}"'.format(crate) for root,...
[ "def", "_resolve_crate_to_path", "(", "crate", ",", "git_conf", ")", ":", "source_dir", "=", "git_conf", "[", "\"source_dir\"", "]", "search_pattern", "=", "'[package]\\nname = \"{}\"'", ".", "format", "(", "crate", ")", "for", "root", ",", "_", ",", "files", ...
https://github.com/facebook/folly/blob/744a0a698074d1b013813065fe60f545aa2c9b94/build/fbcode_builder/getdeps/builder.py#L1477-L1492
facebookincubator/BOLT
88c70afe9d388ad430cc150cc158641701397f70
clang/tools/scan-build-py/lib/libscanbuild/report.py
python
commonprefix
(files)
Fixed version of os.path.commonprefix. :param files: list of file names. :return: the longest path prefix that is a prefix of all files.
Fixed version of os.path.commonprefix.
[ "Fixed", "version", "of", "os", ".", "path", ".", "commonprefix", "." ]
def commonprefix(files): """ Fixed version of os.path.commonprefix. :param files: list of file names. :return: the longest path prefix that is a prefix of all files. """ result = None for current in files: if result is not None: result = os.path.commonprefix([result, current]) ...
[ "def", "commonprefix", "(", "files", ")", ":", "result", "=", "None", "for", "current", "in", "files", ":", "if", "result", "is", "not", "None", ":", "result", "=", "os", ".", "path", ".", "commonprefix", "(", "[", "result", ",", "current", "]", ")",...
https://github.com/facebookincubator/BOLT/blob/88c70afe9d388ad430cc150cc158641701397f70/clang/tools/scan-build-py/lib/libscanbuild/report.py#L587-L604
GeometryCollective/boundary-first-flattening
8250e5a0e85980ec50b5e8aa8f49dd6519f915cd
deps/nanogui/ext/pybind11/tools/clang/cindex.py
python
Cursor.get_usr
(self)
return conf.lib.clang_getCursorUSR(self)
Return the Unified Symbol Resultion (USR) for the entity referenced by the given cursor (or None). A Unified Symbol Resolution (USR) is a string that identifies a particular entity (function, class, variable, etc.) within a program. USRs can be compared across translation units to deter...
Return the Unified Symbol Resultion (USR) for the entity referenced by the given cursor (or None).
[ "Return", "the", "Unified", "Symbol", "Resultion", "(", "USR", ")", "for", "the", "entity", "referenced", "by", "the", "given", "cursor", "(", "or", "None", ")", "." ]
def get_usr(self): """Return the Unified Symbol Resultion (USR) for the entity referenced by the given cursor (or None). A Unified Symbol Resolution (USR) is a string that identifies a particular entity (function, class, variable, etc.) within a program. USRs can be compared acr...
[ "def", "get_usr", "(", "self", ")", ":", "return", "conf", ".", "lib", ".", "clang_getCursorUSR", "(", "self", ")" ]
https://github.com/GeometryCollective/boundary-first-flattening/blob/8250e5a0e85980ec50b5e8aa8f49dd6519f915cd/deps/nanogui/ext/pybind11/tools/clang/cindex.py#L1257-L1266
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/inspect.py
python
indentsize
(line)
return len(expline) - len(expline.lstrip())
Return the indent size, in spaces, at the start of a line of text.
Return the indent size, in spaces, at the start of a line of text.
[ "Return", "the", "indent", "size", "in", "spaces", "at", "the", "start", "of", "a", "line", "of", "text", "." ]
def indentsize(line): """Return the indent size, in spaces, at the start of a line of text.""" expline = line.expandtabs() return len(expline) - len(expline.lstrip())
[ "def", "indentsize", "(", "line", ")", ":", "expline", "=", "line", ".", "expandtabs", "(", ")", "return", "len", "(", "expline", ")", "-", "len", "(", "expline", ".", "lstrip", "(", ")", ")" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/inspect.py#L520-L523
apiaryio/drafter
4634ebd07f6c6f257cc656598ccd535492fdfb55
tools/gyp/pylib/gyp/mac_tool.py
python
MacTool._CopyXIBFile
(self, source, dest)
return ibtoolout.returncode
Compiles a XIB file with ibtool into a binary plist in the bundle.
Compiles a XIB file with ibtool into a binary plist in the bundle.
[ "Compiles", "a", "XIB", "file", "with", "ibtool", "into", "a", "binary", "plist", "in", "the", "bundle", "." ]
def _CopyXIBFile(self, source, dest): """Compiles a XIB file with ibtool into a binary plist in the bundle.""" # ibtool sometimes crashes with relative paths. See crbug.com/314728. base = os.path.dirname(os.path.realpath(__file__)) if os.path.relpath(source): source = os.path.join(base, source) ...
[ "def", "_CopyXIBFile", "(", "self", ",", "source", ",", "dest", ")", ":", "# ibtool sometimes crashes with relative paths. See crbug.com/314728.", "base", "=", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "realpath", "(", "__file__", ")", ")",...
https://github.com/apiaryio/drafter/blob/4634ebd07f6c6f257cc656598ccd535492fdfb55/tools/gyp/pylib/gyp/mac_tool.py#L72-L114
krishauser/Klampt
972cc83ea5befac3f653c1ba20f80155768ad519
Python/control-examples/OperationalSpaceController.py
python
OpSpaceController.setupTasks
(self,opSpaceController)
Overload this to add tasks to the operational space controller
Overload this to add tasks to the operational space controller
[ "Overload", "this", "to", "add", "tasks", "to", "the", "operational", "space", "controller" ]
def setupTasks(self,opSpaceController): """Overload this to add tasks to the operational space controller""" pass
[ "def", "setupTasks", "(", "self", ",", "opSpaceController", ")", ":", "pass" ]
https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/control-examples/OperationalSpaceController.py#L87-L89
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/pandas/py2/pandas/core/arrays/categorical.py
python
Categorical.remove_unused_categories
(self, inplace=False)
Removes categories which are not used. Parameters ---------- inplace : boolean (default: False) Whether or not to drop unused categories inplace or return a copy of this categorical with unused categories dropped. Returns ------- cat : Categorical ...
Removes categories which are not used.
[ "Removes", "categories", "which", "are", "not", "used", "." ]
def remove_unused_categories(self, inplace=False): """ Removes categories which are not used. Parameters ---------- inplace : boolean (default: False) Whether or not to drop unused categories inplace or return a copy of this categorical with unused categori...
[ "def", "remove_unused_categories", "(", "self", ",", "inplace", "=", "False", ")", ":", "inplace", "=", "validate_bool_kwarg", "(", "inplace", ",", "'inplace'", ")", "cat", "=", "self", "if", "inplace", "else", "self", ".", "copy", "(", ")", "idx", ",", ...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/core/arrays/categorical.py#L1097-L1133
vigsterkr/libjingle
92dcbb1aac08c35d1c002c4dd7e978528b8173d2
talk/site_scons/talk.py
python
DeclarePrebuiltLibraries
(env, libraries)
Informs the build engine about external static libraries. Informs the build engine that the given external library name(s) are prebuilt static libraries, as opposed to shared libraries. Args: env: The environment object. libraries: The library or libraries that are being declared as prebuilt sta...
Informs the build engine about external static libraries.
[ "Informs", "the", "build", "engine", "about", "external", "static", "libraries", "." ]
def DeclarePrebuiltLibraries(env, libraries): """Informs the build engine about external static libraries. Informs the build engine that the given external library name(s) are prebuilt static libraries, as opposed to shared libraries. Args: env: The environment object. libraries: The library or librar...
[ "def", "DeclarePrebuiltLibraries", "(", "env", ",", "libraries", ")", ":", "if", "not", "SCons", ".", "Util", ".", "is_List", "(", "libraries", ")", ":", "libraries", "=", "[", "libraries", "]", "for", "library", "in", "libraries", ":", "_RecordPrebuiltLibra...
https://github.com/vigsterkr/libjingle/blob/92dcbb1aac08c35d1c002c4dd7e978528b8173d2/talk/site_scons/talk.py#L158-L172
papyrussolution/OpenPapyrus
bbfb5ec2ea2109b8e2f125edd838e12eaf7b8b91
Src/OSF/harfbuzz/src/gen-tag-table.py
python
BCP47Parser.remove_extra_macrolanguages
(self)
Make every language have at most one macrolanguage.
Make every language have at most one macrolanguage.
[ "Make", "every", "language", "have", "at", "most", "one", "macrolanguage", "." ]
def remove_extra_macrolanguages (self): """Make every language have at most one macrolanguage.""" inverted = collections.defaultdict (list) for macrolanguage, languages in self.macrolanguages.items (): for language in languages: inverted[language].append (macrolanguage) for language, macrolanguages in in...
[ "def", "remove_extra_macrolanguages", "(", "self", ")", ":", "inverted", "=", "collections", ".", "defaultdict", "(", "list", ")", "for", "macrolanguage", ",", "languages", "in", "self", ".", "macrolanguages", ".", "items", "(", ")", ":", "for", "language", ...
https://github.com/papyrussolution/OpenPapyrus/blob/bbfb5ec2ea2109b8e2f125edd838e12eaf7b8b91/Src/OSF/harfbuzz/src/gen-tag-table.py#L612-L623
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/scipy/py2/scipy/misc/common.py
python
electrocardiogram
()
return ecg
Load an electrocardiogram as an example for a one-dimensional signal. The returned signal is a 5 minute long electrocardiogram (ECG), a medical recording of the heart's electrical activity, sampled at 360 Hz. Returns ------- ecg : ndarray The electrocardiogram in millivolt (mV) sampled at ...
Load an electrocardiogram as an example for a one-dimensional signal.
[ "Load", "an", "electrocardiogram", "as", "an", "example", "for", "a", "one", "-", "dimensional", "signal", "." ]
def electrocardiogram(): """ Load an electrocardiogram as an example for a one-dimensional signal. The returned signal is a 5 minute long electrocardiogram (ECG), a medical recording of the heart's electrical activity, sampled at 360 Hz. Returns ------- ecg : ndarray The electrocar...
[ "def", "electrocardiogram", "(", ")", ":", "import", "os", "file_path", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ",", "\"ecg.dat\"", ")", "with", "load", "(", "file_path", ")", "as", "file", "...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/misc/common.py#L207-L303
apple/swift-lldb
d74be846ef3e62de946df343e8c234bde93a8912
scripts/Python/static-binding/lldb.py
python
SBTarget.BreakpointCreateByLocation
(self, *args)
return _lldb.SBTarget_BreakpointCreateByLocation(self, *args)
BreakpointCreateByLocation(SBTarget self, char const * file, uint32_t line) -> SBBreakpoint BreakpointCreateByLocation(SBTarget self, SBFileSpec file_spec, uint32_t line) -> SBBreakpoint BreakpointCreateByLocation(SBTarget self, SBFileSpec file_spec, uint32_t line, lldb::addr_t offset) -> SBBreakpoint ...
BreakpointCreateByLocation(SBTarget self, char const * file, uint32_t line) -> SBBreakpoint BreakpointCreateByLocation(SBTarget self, SBFileSpec file_spec, uint32_t line) -> SBBreakpoint BreakpointCreateByLocation(SBTarget self, SBFileSpec file_spec, uint32_t line, lldb::addr_t offset) -> SBBreakpoint ...
[ "BreakpointCreateByLocation", "(", "SBTarget", "self", "char", "const", "*", "file", "uint32_t", "line", ")", "-", ">", "SBBreakpoint", "BreakpointCreateByLocation", "(", "SBTarget", "self", "SBFileSpec", "file_spec", "uint32_t", "line", ")", "-", ">", "SBBreakpoint...
def BreakpointCreateByLocation(self, *args): """ BreakpointCreateByLocation(SBTarget self, char const * file, uint32_t line) -> SBBreakpoint BreakpointCreateByLocation(SBTarget self, SBFileSpec file_spec, uint32_t line) -> SBBreakpoint BreakpointCreateByLocation(SBTarget self, SBFileSpec...
[ "def", "BreakpointCreateByLocation", "(", "self", ",", "*", "args", ")", ":", "return", "_lldb", ".", "SBTarget_BreakpointCreateByLocation", "(", "self", ",", "*", "args", ")" ]
https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/scripts/Python/static-binding/lldb.py#L10882-L10890
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/msw/_controls.py
python
Slider.SetThumbLength
(*args, **kwargs)
return _controls_.Slider_SetThumbLength(*args, **kwargs)
SetThumbLength(self, int lenPixels)
SetThumbLength(self, int lenPixels)
[ "SetThumbLength", "(", "self", "int", "lenPixels", ")" ]
def SetThumbLength(*args, **kwargs): """SetThumbLength(self, int lenPixels)""" return _controls_.Slider_SetThumbLength(*args, **kwargs)
[ "def", "SetThumbLength", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_controls_", ".", "Slider_SetThumbLength", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_controls.py#L2895-L2897
gem5/gem5
141cc37c2d4b93959d4c249b8f7e6a8b2ef75338
ext/ply/example/GardenSnake/GardenSnake.py
python
p_testlist
(p)
testlist : testlist_multi COMMA | testlist_multi
testlist : testlist_multi COMMA | testlist_multi
[ "testlist", ":", "testlist_multi", "COMMA", "|", "testlist_multi" ]
def p_testlist(p): """testlist : testlist_multi COMMA | testlist_multi """ if len(p) == 2: p[0] = p[1] else: # May need to promote singleton to tuple if isinstance(p[1], list): p[0] = p[1] else: p[0] = [p[1]] # Convert into a tuple?...
[ "def", "p_testlist", "(", "p", ")", ":", "if", "len", "(", "p", ")", "==", "2", ":", "p", "[", "0", "]", "=", "p", "[", "1", "]", "else", ":", "# May need to promote singleton to tuple", "if", "isinstance", "(", "p", "[", "1", "]", ",", "list", "...
https://github.com/gem5/gem5/blob/141cc37c2d4b93959d4c249b8f7e6a8b2ef75338/ext/ply/example/GardenSnake/GardenSnake.py#L574-L587
scribusproject/scribus
41ec7c775a060912cf251682a8b1437f753f80f4
codegen/cheetah/Cheetah/Tools/CGITemplate.py
python
CGITemplate.cgiHeaders
(self)
Outputs the CGI headers if this is a CGI script. Usage: $cgiHeaders#slurp Override .cgiHeadersHook() if you want to customize the headers.
Outputs the CGI headers if this is a CGI script.
[ "Outputs", "the", "CGI", "headers", "if", "this", "is", "a", "CGI", "script", "." ]
def cgiHeaders(self): """Outputs the CGI headers if this is a CGI script. Usage: $cgiHeaders#slurp Override .cgiHeadersHook() if you want to customize the headers. """ if self.isCgi(): return self.cgiHeadersHook()
[ "def", "cgiHeaders", "(", "self", ")", ":", "if", "self", ".", "isCgi", "(", ")", ":", "return", "self", ".", "cgiHeadersHook", "(", ")" ]
https://github.com/scribusproject/scribus/blob/41ec7c775a060912cf251682a8b1437f753f80f4/codegen/cheetah/Cheetah/Tools/CGITemplate.py#L51-L58
facebook/openr
ed38bdfd6bf290084bfab4821b59f83e7b59315d
build/fbcode_builder/getdeps/fetcher.py
python
ChangeStatus.__init__
(self, all_changed=False)
Construct a ChangeStatus object. The default is to create a status that indicates no changes, but passing all_changed=True will create one that indicates that everything changed
Construct a ChangeStatus object. The default is to create a status that indicates no changes, but passing all_changed=True will create one that indicates that everything changed
[ "Construct", "a", "ChangeStatus", "object", ".", "The", "default", "is", "to", "create", "a", "status", "that", "indicates", "no", "changes", "but", "passing", "all_changed", "=", "True", "will", "create", "one", "that", "indicates", "that", "everything", "cha...
def __init__(self, all_changed=False): """Construct a ChangeStatus object. The default is to create a status that indicates no changes, but passing all_changed=True will create one that indicates that everything changed""" if all_changed: self.source_files = 1 se...
[ "def", "__init__", "(", "self", ",", "all_changed", "=", "False", ")", ":", "if", "all_changed", ":", "self", ".", "source_files", "=", "1", "self", ".", "make_files", "=", "1", "else", ":", "self", ".", "source_files", "=", "0", "self", ".", "make_fil...
https://github.com/facebook/openr/blob/ed38bdfd6bf290084bfab4821b59f83e7b59315d/build/fbcode_builder/getdeps/fetcher.py#L53-L62
jiaxiang-wu/quantized-cnn
4d020e17026df90e40111d219e3eb74e0afb1588
cpplint.py
python
IsTemplateParameterList
(clean_lines, linenum, column)
return False
Check if the token ending on (linenum, column) is the end of template<>. Args: clean_lines: A CleansedLines instance containing the file. linenum: the number of the line to check. column: end column of the token to check. Returns: True if this token is end of a template parameter list, False otherw...
Check if the token ending on (linenum, column) is the end of template<>.
[ "Check", "if", "the", "token", "ending", "on", "(", "linenum", "column", ")", "is", "the", "end", "of", "template<", ">", "." ]
def IsTemplateParameterList(clean_lines, linenum, column): """Check if the token ending on (linenum, column) is the end of template<>. Args: clean_lines: A CleansedLines instance containing the file. linenum: the number of the line to check. column: end column of the token to check. Returns: True...
[ "def", "IsTemplateParameterList", "(", "clean_lines", ",", "linenum", ",", "column", ")", ":", "(", "_", ",", "startline", ",", "startpos", ")", "=", "ReverseCloseExpression", "(", "clean_lines", ",", "linenum", ",", "column", ")", "if", "(", "startpos", ">"...
https://github.com/jiaxiang-wu/quantized-cnn/blob/4d020e17026df90e40111d219e3eb74e0afb1588/cpplint.py#L3413-L3428
mantidproject/mantid
03deeb89254ec4289edb8771e0188c2090a02f32
qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/utilities/algorithm_utils.py
python
convert_to_freq
(workspace_name, output_name)
return alg.getProperty("OutputWorkspace").valueAsStr
Apply the ConvertAxisByFormula algorithm to convert from Field to MHz.
Apply the ConvertAxisByFormula algorithm to convert from Field to MHz.
[ "Apply", "the", "ConvertAxisByFormula", "algorithm", "to", "convert", "from", "Field", "to", "MHz", "." ]
def convert_to_freq(workspace_name, output_name): """ Apply the ConvertAxisByFormula algorithm to convert from Field to MHz. """ alg = mantid.AlgorithmManager.create("ConvertAxisByFormula") alg.initialize() alg.setAlwaysStoreInADS(True) alg.setProperty("InputWorkspace", workspace_name) a...
[ "def", "convert_to_freq", "(", "workspace_name", ",", "output_name", ")", ":", "alg", "=", "mantid", ".", "AlgorithmManager", ".", "create", "(", "\"ConvertAxisByFormula\"", ")", "alg", ".", "initialize", "(", ")", "alg", ".", "setAlwaysStoreInADS", "(", "True",...
https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/utilities/algorithm_utils.py#L268-L281
hpi-xnor/BMXNet-v2
af2b1859eafc5c721b1397cef02f946aaf2ce20d
python/mxnet/_ctypes/ndarray.py
python
CachedOp.__call__
(self, *args, **kwargs)
ctypes implementation of imperative invoke wrapper
ctypes implementation of imperative invoke wrapper
[ "ctypes", "implementation", "of", "imperative", "invoke", "wrapper" ]
def __call__(self, *args, **kwargs): """ctypes implementation of imperative invoke wrapper""" out = kwargs.pop('out', None) if out is not None: original_output = out if isinstance(out, NDArrayBase): out = (out,) num_output = ctypes.c_int(len(ou...
[ "def", "__call__", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "out", "=", "kwargs", ".", "pop", "(", "'out'", ",", "None", ")", "if", "out", "is", "not", "None", ":", "original_output", "=", "out", "if", "isinstance", "(", ...
https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/python/mxnet/_ctypes/ndarray.py#L121-L160
nyuwireless-unipd/ns3-mmwave
4ff9e87e8079764e04cbeccd8e85bff15ae16fb3
utils/check-style.py
python
PatchChunk.dst
(self)
return dst
! Get destination lines @param self The current class @return the destination lines
! Get destination lines
[ "!", "Get", "destination", "lines" ]
def dst(self): """! Get destination lines @param self The current class @return the destination lines """ dst = [] for line in self.__lines: if line.is_dst(): dst.append(line) return dst
[ "def", "dst", "(", "self", ")", ":", "dst", "=", "[", "]", "for", "line", "in", "self", ".", "__lines", ":", "if", "line", ".", "is_dst", "(", ")", ":", "dst", ".", "append", "(", "line", ")", "return", "dst" ]
https://github.com/nyuwireless-unipd/ns3-mmwave/blob/4ff9e87e8079764e04cbeccd8e85bff15ae16fb3/utils/check-style.py#L264-L273
wlanjie/AndroidFFmpeg
7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf
tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/sets.py
python
Set.remove
(self, element)
Remove an element from a set; it must be a member. If the element is not a member, raise a KeyError.
Remove an element from a set; it must be a member.
[ "Remove", "an", "element", "from", "a", "set", ";", "it", "must", "be", "a", "member", "." ]
def remove(self, element): """Remove an element from a set; it must be a member. If the element is not a member, raise a KeyError. """ try: del self._data[element] except TypeError: transform = getattr(element, "__as_temporarily_immutable__", None) ...
[ "def", "remove", "(", "self", ",", "element", ")", ":", "try", ":", "del", "self", ".", "_data", "[", "element", "]", "except", "TypeError", ":", "transform", "=", "getattr", "(", "element", ",", "\"__as_temporarily_immutable__\"", ",", "None", ")", "if", ...
https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/sets.py#L512-L523
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
third_party/catapult/telemetry/telemetry/internal/image_processing/screen_finder.py
python
ScreenFinder._FindIntersections
(self, lines)
return intersections
Finds intersections in a set of lines. Filters pairs of lines that are less than 45 degrees apart. Filtering these pairs helps dramatically reduce the number of points we have to process, as these points could not represent screen corners anyways. Returns: The intersections, represented as a tup...
Finds intersections in a set of lines.
[ "Finds", "intersections", "in", "a", "set", "of", "lines", "." ]
def _FindIntersections(self, lines): """Finds intersections in a set of lines. Filters pairs of lines that are less than 45 degrees apart. Filtering these pairs helps dramatically reduce the number of points we have to process, as these points could not represent screen corners anyways. Returns: ...
[ "def", "_FindIntersections", "(", "self", ",", "lines", ")", ":", "intersections", "=", "np", ".", "empty", "(", "(", "0", ",", "3", ")", ",", "np", ".", "float32", ")", "for", "i", "in", "xrange", "(", "0", ",", "len", "(", "lines", ")", ")", ...
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/telemetry/internal/image_processing/screen_finder.py#L231-L262
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/windows/Lib/pdb.py
python
Pdb.do_continue
(self, arg)
return 1
c(ont(inue)) Continue execution, only stop when a breakpoint is encountered.
c(ont(inue)) Continue execution, only stop when a breakpoint is encountered.
[ "c", "(", "ont", "(", "inue", "))", "Continue", "execution", "only", "stop", "when", "a", "breakpoint", "is", "encountered", "." ]
def do_continue(self, arg): """c(ont(inue)) Continue execution, only stop when a breakpoint is encountered. """ if not self.nosigint: try: Pdb._previous_sigint_handler = \ signal.signal(signal.SIGINT, self.sigint_handler) except...
[ "def", "do_continue", "(", "self", ",", "arg", ")", ":", "if", "not", "self", ".", "nosigint", ":", "try", ":", "Pdb", ".", "_previous_sigint_handler", "=", "signal", ".", "signal", "(", "signal", ".", "SIGINT", ",", "self", ".", "sigint_handler", ")", ...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/pdb.py#L1038-L1053
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/tools/python/src/Lib/decimal.py
python
Context.copy_negate
(self, a)
return a.copy_negate()
Returns a copy of the operand with the sign inverted. >>> ExtendedContext.copy_negate(Decimal('101.5')) Decimal('-101.5') >>> ExtendedContext.copy_negate(Decimal('-101.5')) Decimal('101.5') >>> ExtendedContext.copy_negate(1) Decimal('-1')
Returns a copy of the operand with the sign inverted.
[ "Returns", "a", "copy", "of", "the", "operand", "with", "the", "sign", "inverted", "." ]
def copy_negate(self, a): """Returns a copy of the operand with the sign inverted. >>> ExtendedContext.copy_negate(Decimal('101.5')) Decimal('-101.5') >>> ExtendedContext.copy_negate(Decimal('-101.5')) Decimal('101.5') >>> ExtendedContext.copy_negate(1) Decimal('...
[ "def", "copy_negate", "(", "self", ",", "a", ")", ":", "a", "=", "_convert_other", "(", "a", ",", "raiseit", "=", "True", ")", "return", "a", ".", "copy_negate", "(", ")" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/decimal.py#L4147-L4158
physercoe/starquant
c00cad64d1de2da05081b3dc320ef264c6295e08
source/gui/ui_dataview.py
python
OrderBookWidget.set_full_symbol
(self, symbol: str)
Set the tick depth data to monitor by full_symbol.
Set the tick depth data to monitor by full_symbol.
[ "Set", "the", "tick", "depth", "data", "to", "monitor", "by", "full_symbol", "." ]
def set_full_symbol(self, symbol: str): """ Set the tick depth data to monitor by full_symbol. """ # Update name line widget and clear all labels self.full_symbol = symbol self.symbol_line.setText(symbol) self.clear_label_text()
[ "def", "set_full_symbol", "(", "self", ",", "symbol", ":", "str", ")", ":", "# Update name line widget and clear all labels", "self", ".", "full_symbol", "=", "symbol", "self", ".", "symbol_line", ".", "setText", "(", "symbol", ")", "self", ".", "clear_label_text"...
https://github.com/physercoe/starquant/blob/c00cad64d1de2da05081b3dc320ef264c6295e08/source/gui/ui_dataview.py#L502-L510
libornovax/master_thesis_code
6eca474ed3cae673afde010caef338cf7349f839
caffe/scripts/cpp_lint.py
python
_BlockInfo.CheckEnd
(self, filename, clean_lines, linenum, error)
Run checks that applies to text after the closing brace. This is mostly used for checking end of namespace comments. Args: filename: The name of the current file. clean_lines: A CleansedLines instance containing the file. linenum: The number of the line to check. error: The function to...
Run checks that applies to text after the closing brace.
[ "Run", "checks", "that", "applies", "to", "text", "after", "the", "closing", "brace", "." ]
def CheckEnd(self, filename, clean_lines, linenum, error): """Run checks that applies to text after the closing brace. This is mostly used for checking end of namespace comments. Args: filename: The name of the current file. clean_lines: A CleansedLines instance containing the file. line...
[ "def", "CheckEnd", "(", "self", ",", "filename", ",", "clean_lines", ",", "linenum", ",", "error", ")", ":", "pass" ]
https://github.com/libornovax/master_thesis_code/blob/6eca474ed3cae673afde010caef338cf7349f839/caffe/scripts/cpp_lint.py#L1778-L1789
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/msw/_controls.py
python
ListCtrl.GetTopItem
(*args, **kwargs)
return _controls_.ListCtrl_GetTopItem(*args, **kwargs)
GetTopItem(self) -> long
GetTopItem(self) -> long
[ "GetTopItem", "(", "self", ")", "-", ">", "long" ]
def GetTopItem(*args, **kwargs): """GetTopItem(self) -> long""" return _controls_.ListCtrl_GetTopItem(*args, **kwargs)
[ "def", "GetTopItem", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_controls_", ".", "ListCtrl_GetTopItem", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_controls.py#L4600-L4602
logcabin/logcabin
ee6c55ae9744b82b451becd9707d26c7c1b6bbfb
scripts/cpplint.py
python
_FunctionState.Count
(self)
Count line in current function body.
Count line in current function body.
[ "Count", "line", "in", "current", "function", "body", "." ]
def Count(self): """Count line in current function body.""" if self.in_a_function: self.lines_in_function += 1
[ "def", "Count", "(", "self", ")", ":", "if", "self", ".", "in_a_function", ":", "self", ".", "lines_in_function", "+=", "1" ]
https://github.com/logcabin/logcabin/blob/ee6c55ae9744b82b451becd9707d26c7c1b6bbfb/scripts/cpplint.py#L594-L597
Xilinx/Vitis-AI
fc74d404563d9951b57245443c73bef389f3657f
tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/ctc_ops.py
python
_forward_backward_log
(state_trans_log_probs, initial_state_log_probs, final_state_log_probs, observed_log_probs, sequence_length)
return fwd_bwd_log_probs, log_likelihood
Forward-backward algorithm computed in log domain. Args: state_trans_log_probs: tensor of shape [states, states] or if different transition matrix per batch [batch_size, states, states] initial_state_log_probs: tensor of shape [batch_size, states] final_state_log_probs: tensor of shape [batch_size,...
Forward-backward algorithm computed in log domain.
[ "Forward", "-", "backward", "algorithm", "computed", "in", "log", "domain", "." ]
def _forward_backward_log(state_trans_log_probs, initial_state_log_probs, final_state_log_probs, observed_log_probs, sequence_length): """Forward-backward algorithm computed in log domain. Args: state_trans_log_probs: tensor of shape [states, states] or if di...
[ "def", "_forward_backward_log", "(", "state_trans_log_probs", ",", "initial_state_log_probs", ",", "final_state_log_probs", ",", "observed_log_probs", ",", "sequence_length", ")", ":", "if", "state_trans_log_probs", ".", "shape", ".", "ndims", "==", "2", ":", "perm", ...
https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/ctc_ops.py#L972-L1056
weolar/miniblink49
1c4678db0594a4abde23d3ebbcc7cd13c3170777
third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/irc/ircbot.py
python
SingleServerIRCBot._on_kick
(self, c, e)
[Internal]
[Internal]
[ "[", "Internal", "]" ]
def _on_kick(self, c, e): """[Internal]""" nick = e.arguments()[0] channel = e.target() if nick == c.get_nickname(): del self.channels[channel] else: self.channels[channel].remove_user(nick)
[ "def", "_on_kick", "(", "self", ",", "c", ",", "e", ")", ":", "nick", "=", "e", ".", "arguments", "(", ")", "[", "0", "]", "channel", "=", "e", ".", "target", "(", ")", "if", "nick", "==", "c", ".", "get_nickname", "(", ")", ":", "del", "self...
https://github.com/weolar/miniblink49/blob/1c4678db0594a4abde23d3ebbcc7cd13c3170777/third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/irc/ircbot.py#L114-L122
OpenLightingProject/ola
d1433a1bed73276fbe55ce18c03b1c208237decc
tools/ola_mon/ola_mon.py
python
OlaFetcher._FetchDebug
(self)
return None
Fetch the contents of the debug page.
Fetch the contents of the debug page.
[ "Fetch", "the", "contents", "of", "the", "debug", "page", "." ]
def _FetchDebug(self): """Fetch the contents of the debug page.""" connection = httplib.HTTPConnection('%s:%d' % (self._host, self._port)) try: connection.request('GET', '/debug') except socket.error: return None try: response = connection.getresponse() if response.status ==...
[ "def", "_FetchDebug", "(", "self", ")", ":", "connection", "=", "httplib", ".", "HTTPConnection", "(", "'%s:%d'", "%", "(", "self", ".", "_host", ",", "self", ".", "_port", ")", ")", "try", ":", "connection", ".", "request", "(", "'GET'", ",", "'/debug...
https://github.com/OpenLightingProject/ola/blob/d1433a1bed73276fbe55ce18c03b1c208237decc/tools/ola_mon/ola_mon.py#L59-L76
hpi-xnor/BMXNet
ed0b201da6667887222b8e4b5f997c4f6b61943d
python/mxnet/ndarray/ndarray.py
python
_new_empty_handle
()
return hdl
Returns a new empty handle. Empty handle can be used to hold a result. Returns ------- handle A new empty `NDArray` handle.
Returns a new empty handle.
[ "Returns", "a", "new", "empty", "handle", "." ]
def _new_empty_handle(): """Returns a new empty handle. Empty handle can be used to hold a result. Returns ------- handle A new empty `NDArray` handle. """ hdl = NDArrayHandle() check_call(_LIB.MXNDArrayCreateNone(ctypes.byref(hdl))) return hdl
[ "def", "_new_empty_handle", "(", ")", ":", "hdl", "=", "NDArrayHandle", "(", ")", "check_call", "(", "_LIB", ".", "MXNDArrayCreateNone", "(", "ctypes", ".", "byref", "(", "hdl", ")", ")", ")", "return", "hdl" ]
https://github.com/hpi-xnor/BMXNet/blob/ed0b201da6667887222b8e4b5f997c4f6b61943d/python/mxnet/ndarray/ndarray.py#L106-L118
PaddlePaddle/Anakin
5fd68a6cc4c4620cd1a30794c1bf06eebd3f4730
tools/external_converter_v2/parser/onnx/med_graph.py
python
MedGraphUtil._fusionScale
(med_node, med_graph)
fusion scale node after convolution node :param med_node: :param med_graph: :return:
fusion scale node after convolution node :param med_node: :param med_graph: :return:
[ "fusion", "scale", "node", "after", "convolution", "node", ":", "param", "med_node", ":", ":", "param", "med_graph", ":", ":", "return", ":" ]
def _fusionScale(med_node, med_graph): """ fusion scale node after convolution node :param med_node: :param med_graph: :return: """ if len(med_node['input']) == 1: input_node = med_graph[med_node['input'][0]] med_ak_attr = med_node['ak_attr...
[ "def", "_fusionScale", "(", "med_node", ",", "med_graph", ")", ":", "if", "len", "(", "med_node", "[", "'input'", "]", ")", "==", "1", ":", "input_node", "=", "med_graph", "[", "med_node", "[", "'input'", "]", "[", "0", "]", "]", "med_ak_attr", "=", ...
https://github.com/PaddlePaddle/Anakin/blob/5fd68a6cc4c4620cd1a30794c1bf06eebd3f4730/tools/external_converter_v2/parser/onnx/med_graph.py#L186-L285
kamyu104/LeetCode-Solutions
77605708a927ea3b85aee5a479db733938c7c211
Python/binary-tree-level-order-traversal-ii.py
python
Solution.levelOrderBottom
(self, root)
return result[::-1]
:type root: TreeNode :rtype: List[List[int]]
:type root: TreeNode :rtype: List[List[int]]
[ ":", "type", "root", ":", "TreeNode", ":", "rtype", ":", "List", "[", "List", "[", "int", "]]" ]
def levelOrderBottom(self, root): """ :type root: TreeNode :rtype: List[List[int]] """ if root is None: return [] result, current = [], [root] while current: next_level, vals = [], [] for node in current: vals.a...
[ "def", "levelOrderBottom", "(", "self", ",", "root", ")", ":", "if", "root", "is", "None", ":", "return", "[", "]", "result", ",", "current", "=", "[", "]", ",", "[", "root", "]", "while", "current", ":", "next_level", ",", "vals", "=", "[", "]", ...
https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/binary-tree-level-order-traversal-ii.py#L12-L32
Xilinx/Vitis-AI
fc74d404563d9951b57245443c73bef389f3657f
tools/RNN/rnn_quantizer/pytorch_binding/pytorch_nndct/nn/modules/fix_ops.py
python
NndctScale
(Tinput, scale)
if Tinput.device == torch.device("cpu"): Tinput.mul_(scale) else: nndct_kernels.Scale(Tinput, scale)
if Tinput.device == torch.device("cpu"): Tinput.mul_(scale) else: nndct_kernels.Scale(Tinput, scale)
[ "if", "Tinput", ".", "device", "==", "torch", ".", "device", "(", "cpu", ")", ":", "Tinput", ".", "mul_", "(", "scale", ")", "else", ":", "nndct_kernels", ".", "Scale", "(", "Tinput", "scale", ")" ]
def NndctScale(Tinput, scale): device_id = 1 if Tinput.device == torch.device("cpu") else 0 nndct_kernels.Scale(Tinput, scale, device_id) ''' if Tinput.device == torch.device("cpu"): Tinput.mul_(scale) else: nndct_kernels.Scale(Tinput, scale) '''
[ "def", "NndctScale", "(", "Tinput", ",", "scale", ")", ":", "device_id", "=", "1", "if", "Tinput", ".", "device", "==", "torch", ".", "device", "(", "\"cpu\"", ")", "else", "0", "nndct_kernels", ".", "Scale", "(", "Tinput", ",", "scale", ",", "device_i...
https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/RNN/rnn_quantizer/pytorch_binding/pytorch_nndct/nn/modules/fix_ops.py#L55-L63
Bareflank/hypervisor
10af879f58a0b1d9ace17b84cd9b1e41a1cc67d0
utils/iwyu_tool.py
python
Process.poll
(self)
return self.proc.poll()
Return the exit code if the process has completed, None otherwise.
Return the exit code if the process has completed, None otherwise.
[ "Return", "the", "exit", "code", "if", "the", "process", "has", "completed", "None", "otherwise", "." ]
def poll(self): """ Return the exit code if the process has completed, None otherwise. """ return self.proc.poll()
[ "def", "poll", "(", "self", ")", ":", "return", "self", ".", "proc", ".", "poll", "(", ")" ]
https://github.com/Bareflank/hypervisor/blob/10af879f58a0b1d9ace17b84cd9b1e41a1cc67d0/utils/iwyu_tool.py#L240-L243
ceph/ceph
959663007321a369c83218414a29bd9dbc8bda3a
src/pybind/mgr/orchestrator/module.py
python
OrchestratorCli._list_devices
(self, hostname: Optional[List[str]] = None, format: Format = Format.plain, refresh: bool = False, wide: bool = False)
List devices on a host
List devices on a host
[ "List", "devices", "on", "a", "host" ]
def _list_devices(self, hostname: Optional[List[str]] = None, format: Format = Format.plain, refresh: bool = False, wide: bool = False) -> HandleCommandResult: """ List devices on a host """ # Provide...
[ "def", "_list_devices", "(", "self", ",", "hostname", ":", "Optional", "[", "List", "[", "str", "]", "]", "=", "None", ",", "format", ":", "Format", "=", "Format", ".", "plain", ",", "refresh", ":", "bool", "=", "False", ",", "wide", ":", "bool", "...
https://github.com/ceph/ceph/blob/959663007321a369c83218414a29bd9dbc8bda3a/src/pybind/mgr/orchestrator/module.py#L456-L545
commaai/openpilot
4416c21b1e738ab7d04147c5ae52b5135e0cdb40
pyextra/acados_template/acados_ocp.py
python
AcadosOcpOptions.print_level
(self)
return self.__print_level
Verbosity of printing. Type: int >= 0 Default: 0
Verbosity of printing. Type: int >= 0 Default: 0
[ "Verbosity", "of", "printing", ".", "Type", ":", "int", ">", "=", "0", "Default", ":", "0" ]
def print_level(self): """ Verbosity of printing. Type: int >= 0 Default: 0 """ return self.__print_level
[ "def", "print_level", "(", "self", ")", ":", "return", "self", ".", "__print_level" ]
https://github.com/commaai/openpilot/blob/4416c21b1e738ab7d04147c5ae52b5135e0cdb40/pyextra/acados_template/acados_ocp.py#L2423-L2429
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_carbon/_controls.py
python
PyControl.DoSetVirtualSize
(*args, **kwargs)
return _controls_.PyControl_DoSetVirtualSize(*args, **kwargs)
DoSetVirtualSize(self, int x, int y)
DoSetVirtualSize(self, int x, int y)
[ "DoSetVirtualSize", "(", "self", "int", "x", "int", "y", ")" ]
def DoSetVirtualSize(*args, **kwargs): """DoSetVirtualSize(self, int x, int y)""" return _controls_.PyControl_DoSetVirtualSize(*args, **kwargs)
[ "def", "DoSetVirtualSize", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_controls_", ".", "PyControl_DoSetVirtualSize", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_controls.py#L5854-L5856
pmq20/node-packer
12c46c6e44fbc14d9ee645ebd17d5296b324f7e0
lts/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py
python
MsvsSettings._HasExplicitIdlActions
(self, spec)
return any([action.get('explicit_idl_action', 0) for action in spec.get('actions', [])])
Determine if an action should not run midl for .idl files.
Determine if an action should not run midl for .idl files.
[ "Determine", "if", "an", "action", "should", "not", "run", "midl", "for", ".", "idl", "files", "." ]
def _HasExplicitIdlActions(self, spec): """Determine if an action should not run midl for .idl files.""" return any([action.get('explicit_idl_action', 0) for action in spec.get('actions', [])])
[ "def", "_HasExplicitIdlActions", "(", "self", ",", "spec", ")", ":", "return", "any", "(", "[", "action", ".", "get", "(", "'explicit_idl_action'", ",", "0", ")", "for", "action", "in", "spec", ".", "get", "(", "'actions'", ",", "[", "]", ")", "]", "...
https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py#L835-L838
trailofbits/llvm-sanitizer-tutorial
d29dfeec7f51fbf234fd0080f28f2b30cd0b6e99
llvm/tools/clang/tools/scan-build-py/libscanbuild/analyze.py
python
report_directory
(hint, keep)
Responsible for the report directory. hint -- could specify the parent directory of the output directory. keep -- a boolean value to keep or delete the empty report directory.
Responsible for the report directory.
[ "Responsible", "for", "the", "report", "directory", "." ]
def report_directory(hint, keep): """ Responsible for the report directory. hint -- could specify the parent directory of the output directory. keep -- a boolean value to keep or delete the empty report directory. """ stamp_format = 'scan-build-%Y-%m-%d-%H-%M-%S-%f-' stamp = datetime.datetime.now(...
[ "def", "report_directory", "(", "hint", ",", "keep", ")", ":", "stamp_format", "=", "'scan-build-%Y-%m-%d-%H-%M-%S-%f-'", "stamp", "=", "datetime", ".", "datetime", ".", "now", "(", ")", ".", "strftime", "(", "stamp_format", ")", "parent_dir", "=", "os", ".", ...
https://github.com/trailofbits/llvm-sanitizer-tutorial/blob/d29dfeec7f51fbf234fd0080f28f2b30cd0b6e99/llvm/tools/clang/tools/scan-build-py/libscanbuild/analyze.py#L334-L363
deepmind/open_spiel
4ca53bea32bb2875c7385d215424048ae92f78c8
open_spiel/python/egt/utils.py
python
compute_payoff
(row_profile, col_profile, row_payoff_table)
return np.dot(np.dot(row_profile.T, row_payoff_table), col_profile)
Returns row's expected payoff in a bimatrix game. Args: row_profile: Row's strategy profile. col_profile: Column's strategy profile. row_payoff_table: Row's payoff table.
Returns row's expected payoff in a bimatrix game.
[ "Returns", "row", "s", "expected", "payoff", "in", "a", "bimatrix", "game", "." ]
def compute_payoff(row_profile, col_profile, row_payoff_table): """Returns row's expected payoff in a bimatrix game. Args: row_profile: Row's strategy profile. col_profile: Column's strategy profile. row_payoff_table: Row's payoff table. """ return np.dot(np.dot(row_profile.T, row_payoff_table), c...
[ "def", "compute_payoff", "(", "row_profile", ",", "col_profile", ",", "row_payoff_table", ")", ":", "return", "np", ".", "dot", "(", "np", ".", "dot", "(", "row_profile", ".", "T", ",", "row_payoff_table", ")", ",", "col_profile", ")" ]
https://github.com/deepmind/open_spiel/blob/4ca53bea32bb2875c7385d215424048ae92f78c8/open_spiel/python/egt/utils.py#L362-L371
tensorflow/tensorflow
419e3a6b650ea4bd1b0cba23c4348f8a69f3272e
tensorflow/python/keras/engine/training_utils_v1.py
python
collect_per_output_metric_info
(metrics, output_names, output_shapes, loss_fns, from_serialized=False, is_weighted=False)
return per_output_metrics
Maps metric names and functions to model outputs. Args: metrics: a list or a list of lists or a dict of metric functions. output_names: a list of the names (strings) of model outputs. output_shapes: a list of the shapes (strings) of model outputs. loss_fns: a list of the loss functions corres...
Maps metric names and functions to model outputs.
[ "Maps", "metric", "names", "and", "functions", "to", "model", "outputs", "." ]
def collect_per_output_metric_info(metrics, output_names, output_shapes, loss_fns, from_serialized=False, is_weighted=False): """Maps metric na...
[ "def", "collect_per_output_metric_info", "(", "metrics", ",", "output_names", ",", "output_shapes", ",", "loss_fns", ",", "from_serialized", "=", "False", ",", "is_weighted", "=", "False", ")", ":", "if", "not", "metrics", ":", "return", "[", "{", "}", "for", ...
https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/keras/engine/training_utils_v1.py#L839-L923
PaddlePaddle/Paddle
1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c
python/paddle/fluid/layers/rnn.py
python
dynamic_lstm
(input, size, h_0=None, c_0=None, param_attr=None, bias_attr=None, use_peepholes=True, is_reverse=False, gate_activation='sigmoid', cell_activation='tanh', ...
return hidden, cell
r""" :api_attr: Static Graph **Note**: 1. This OP only supports LoDTensor as inputs. If you need to deal with Tensor, please use :ref:`api_fluid_layers_lstm` . 2. In order to improve efficiency, users must first map the input of dimension [T, hidden_size] to input of [T, 4 * hidden_size], and then...
r""" :api_attr: Static Graph
[ "r", ":", "api_attr", ":", "Static", "Graph" ]
def dynamic_lstm(input, size, h_0=None, c_0=None, param_attr=None, bias_attr=None, use_peepholes=True, is_reverse=False, gate_activation='sigmoid', cell_activation='ta...
[ "def", "dynamic_lstm", "(", "input", ",", "size", ",", "h_0", "=", "None", ",", "c_0", "=", "None", ",", "param_attr", "=", "None", ",", "bias_attr", "=", "None", ",", "use_peepholes", "=", "True", ",", "is_reverse", "=", "False", ",", "gate_activation",...
https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/fluid/layers/rnn.py#L2264-L2434
gnuradio/gnuradio
09c3c4fa4bfb1a02caac74cb5334dfe065391e3b
grc/core/FlowGraph.py
python
FlowGraph.get_enabled_blocks
(self)
return list(self.iter_enabled_blocks())
Get a list of all blocks that are enabled and not bypassed. Returns: a list of blocks
Get a list of all blocks that are enabled and not bypassed.
[ "Get", "a", "list", "of", "all", "blocks", "that", "are", "enabled", "and", "not", "bypassed", "." ]
def get_enabled_blocks(self): """ Get a list of all blocks that are enabled and not bypassed. Returns: a list of blocks """ return list(self.iter_enabled_blocks())
[ "def", "get_enabled_blocks", "(", "self", ")", ":", "return", "list", "(", "self", ".", "iter_enabled_blocks", "(", ")", ")" ]
https://github.com/gnuradio/gnuradio/blob/09c3c4fa4bfb1a02caac74cb5334dfe065391e3b/grc/core/FlowGraph.py#L147-L154
jackaudio/jack2
21b293dbc37d42446141a08922cdec0d2550c6a0
waflib/Runner.py
python
Consumer.__init__
(self, spawner, task)
Task to execute
Task to execute
[ "Task", "to", "execute" ]
def __init__(self, spawner, task): Utils.threading.Thread.__init__(self) self.task = task """Task to execute""" self.spawner = spawner """Coordinator object""" self.setDaemon(1) self.start()
[ "def", "__init__", "(", "self", ",", "spawner", ",", "task", ")", ":", "Utils", ".", "threading", ".", "Thread", ".", "__init__", "(", "self", ")", "self", ".", "task", "=", "task", "self", ".", "spawner", "=", "spawner", "\"\"\"Coordinator object\"\"\"", ...
https://github.com/jackaudio/jack2/blob/21b293dbc37d42446141a08922cdec0d2550c6a0/waflib/Runner.py#L66-L73
GeometryCollective/boundary-first-flattening
8250e5a0e85980ec50b5e8aa8f49dd6519f915cd
deps/nanogui/ext/pybind11/tools/clang/cindex.py
python
TokenKind.__init__
(self, value, name)
Create a new TokenKind instance from a numeric value and a name.
Create a new TokenKind instance from a numeric value and a name.
[ "Create", "a", "new", "TokenKind", "instance", "from", "a", "numeric", "value", "and", "a", "name", "." ]
def __init__(self, value, name): """Create a new TokenKind instance from a numeric value and a name.""" self.value = value self.name = name
[ "def", "__init__", "(", "self", ",", "value", ",", "name", ")", ":", "self", ".", "value", "=", "value", "self", ".", "name", "=", "name" ]
https://github.com/GeometryCollective/boundary-first-flattening/blob/8250e5a0e85980ec50b5e8aa8f49dd6519f915cd/deps/nanogui/ext/pybind11/tools/clang/cindex.py#L483-L486
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/ipython/py3/IPython/core/completer.py
python
Completer.global_matches
(self, text)
return matches
Compute matches when text is a simple name. Return a list of all keywords, built-in functions and names currently defined in self.namespace or self.global_namespace that match.
Compute matches when text is a simple name.
[ "Compute", "matches", "when", "text", "is", "a", "simple", "name", "." ]
def global_matches(self, text): """Compute matches when text is a simple name. Return a list of all keywords, built-in functions and names currently defined in self.namespace or self.global_namespace that match. """ matches = [] match_append = matches.append n =...
[ "def", "global_matches", "(", "self", ",", "text", ")", ":", "matches", "=", "[", "]", "match_append", "=", "matches", ".", "append", "n", "=", "len", "(", "text", ")", "for", "lst", "in", "[", "keyword", ".", "kwlist", ",", "builtin_mod", ".", "__di...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py3/IPython/core/completer.py#L667-L693
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/scipy/scipy/spatial/distance.py
python
pdist
(X, metric='euclidean', p=2, w=None, V=None, VI=None)
return dm
Pairwise distances between observations in n-dimensional space. The following are common calling conventions. 1. ``Y = pdist(X, 'euclidean')`` Computes the distance between m points using Euclidean distance (2-norm) as the distance metric between the points. The points are arranged as m ...
Pairwise distances between observations in n-dimensional space.
[ "Pairwise", "distances", "between", "observations", "in", "n", "-", "dimensional", "space", "." ]
def pdist(X, metric='euclidean', p=2, w=None, V=None, VI=None): """ Pairwise distances between observations in n-dimensional space. The following are common calling conventions. 1. ``Y = pdist(X, 'euclidean')`` Computes the distance between m points using Euclidean distance (2-norm) as ...
[ "def", "pdist", "(", "X", ",", "metric", "=", "'euclidean'", ",", "p", "=", "2", ",", "w", "=", "None", ",", "V", "=", "None", ",", "VI", "=", "None", ")", ":", "# You can also call this as:", "# Y = pdist(X, 'test_abc')", "# where 'abc' is the metric bein...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/scipy/spatial/distance.py#L967-L1386
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
wx/lib/agw/customtreectrl.py
python
CustomTreeCtrl.SetItemHasChildren
(self, item, has=True)
Forces the appearance/disappearance of the button next to the item. :param `item`: an instance of :class:`GenericTreeItem`; :param bool `has`: ``True`` to have a button next to an item, ``False`` otherwise.
Forces the appearance/disappearance of the button next to the item.
[ "Forces", "the", "appearance", "/", "disappearance", "of", "the", "button", "next", "to", "the", "item", "." ]
def SetItemHasChildren(self, item, has=True): """ Forces the appearance/disappearance of the button next to the item. :param `item`: an instance of :class:`GenericTreeItem`; :param bool `has`: ``True`` to have a button next to an item, ``False`` otherwise. """ i...
[ "def", "SetItemHasChildren", "(", "self", ",", "item", ",", "has", "=", "True", ")", ":", "item", ".", "SetHasPlus", "(", "has", ")", "self", ".", "RefreshLine", "(", "item", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/customtreectrl.py#L3737-L3746
apple/swift-lldb
d74be846ef3e62de946df343e8c234bde93a8912
scripts/Python/static-binding/lldb.py
python
SBThread_GetStackFrameFromEvent
(event)
return _lldb.SBThread_GetStackFrameFromEvent(event)
SBThread_GetStackFrameFromEvent(SBEvent event) -> SBFrame
SBThread_GetStackFrameFromEvent(SBEvent event) -> SBFrame
[ "SBThread_GetStackFrameFromEvent", "(", "SBEvent", "event", ")", "-", ">", "SBFrame" ]
def SBThread_GetStackFrameFromEvent(event): """SBThread_GetStackFrameFromEvent(SBEvent event) -> SBFrame""" return _lldb.SBThread_GetStackFrameFromEvent(event)
[ "def", "SBThread_GetStackFrameFromEvent", "(", "event", ")", ":", "return", "_lldb", ".", "SBThread_GetStackFrameFromEvent", "(", "event", ")" ]
https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/scripts/Python/static-binding/lldb.py#L12023-L12025
freesurfer/freesurfer
6dbe527d43ffa611acb2cd112e9469f9bfec8e36
cnn_sphere_register/ext/neuron/neuron/models.py
python
_softmax
(x, axis=-1, alpha=1)
building on keras implementation, allow alpha parameter Softmax activation function. # Arguments x : Tensor. axis: Integer, axis along which the softmax normalization is applied. alpha: a value to multiply all x # Returns Tensor, output of softmax transformation. # Raise...
building on keras implementation, allow alpha parameter
[ "building", "on", "keras", "implementation", "allow", "alpha", "parameter" ]
def _softmax(x, axis=-1, alpha=1): """ building on keras implementation, allow alpha parameter Softmax activation function. # Arguments x : Tensor. axis: Integer, axis along which the softmax normalization is applied. alpha: a value to multiply all x # Returns Tensor...
[ "def", "_softmax", "(", "x", ",", "axis", "=", "-", "1", ",", "alpha", "=", "1", ")", ":", "x", "=", "alpha", "*", "x", "ndim", "=", "K", ".", "ndim", "(", "x", ")", "if", "ndim", "==", "2", ":", "return", "K", ".", "softmax", "(", "x", "...
https://github.com/freesurfer/freesurfer/blob/6dbe527d43ffa611acb2cd112e9469f9bfec8e36/cnn_sphere_register/ext/neuron/neuron/models.py#L979-L1002
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
wx/lib/agw/aui/auibook.py
python
AuiNotebookEvent.Allow
(self)
This is the opposite of :meth:`Veto`: it explicitly allows the event to be processed. For most events it is not necessary to call this method as the events are allowed anyhow but some are forbidden by default (this will be mentioned in the corresponding event description).
This is the opposite of :meth:`Veto`: it explicitly allows the event to be processed. For most events it is not necessary to call this method as the events are allowed anyhow but some are forbidden by default (this will be mentioned in the corresponding event description).
[ "This", "is", "the", "opposite", "of", ":", "meth", ":", "Veto", ":", "it", "explicitly", "allows", "the", "event", "to", "be", "processed", ".", "For", "most", "events", "it", "is", "not", "necessary", "to", "call", "this", "method", "as", "the", "eve...
def Allow(self): """ This is the opposite of :meth:`Veto`: it explicitly allows the event to be processed. For most events it is not necessary to call this method as the events are allowed anyhow but some are forbidden by default (this will be mentioned in the corresponding event...
[ "def", "Allow", "(", "self", ")", ":", "self", ".", "notify", ".", "Allow", "(", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/aui/auibook.py#L545-L553
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/llvmlite/ir/builder.py
python
IRBuilder.bitcast
(self, value, typ, name='')
Pointer cast to a different pointer type: name = (typ) value
Pointer cast to a different pointer type: name = (typ) value
[ "Pointer", "cast", "to", "a", "different", "pointer", "type", ":", "name", "=", "(", "typ", ")", "value" ]
def bitcast(self, value, typ, name=''): """ Pointer cast to a different pointer type: name = (typ) value """
[ "def", "bitcast", "(", "self", ",", "value", ",", "typ", ",", "name", "=", "''", ")", ":" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/llvmlite/ir/builder.py#L640-L644
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/idlelib/browser.py
python
ModuleBrowserTreeItem.GetText
(self)
return os.path.basename(self.file)
Return the module name as the text string to display.
Return the module name as the text string to display.
[ "Return", "the", "module", "name", "as", "the", "text", "string", "to", "display", "." ]
def GetText(self): "Return the module name as the text string to display." return os.path.basename(self.file)
[ "def", "GetText", "(", "self", ")", ":", "return", "os", ".", "path", ".", "basename", "(", "self", ".", "file", ")" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/idlelib/browser.py#L150-L152
tensorflow/tensorflow
419e3a6b650ea4bd1b0cba23c4348f8a69f3272e
tensorflow/python/saved_model/signature_def_utils_impl.py
python
_is_valid_predict_signature
(signature_def)
return True
Determine whether the argument is a servable 'predict' SignatureDef.
Determine whether the argument is a servable 'predict' SignatureDef.
[ "Determine", "whether", "the", "argument", "is", "a", "servable", "predict", "SignatureDef", "." ]
def _is_valid_predict_signature(signature_def): """Determine whether the argument is a servable 'predict' SignatureDef.""" if signature_def.method_name != signature_constants.PREDICT_METHOD_NAME: return False if not signature_def.inputs.keys(): return False if not signature_def.outputs.keys(): retur...
[ "def", "_is_valid_predict_signature", "(", "signature_def", ")", ":", "if", "signature_def", ".", "method_name", "!=", "signature_constants", ".", "PREDICT_METHOD_NAME", ":", "return", "False", "if", "not", "signature_def", ".", "inputs", ".", "keys", "(", ")", ":...
https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/saved_model/signature_def_utils_impl.py#L289-L297
mantidproject/mantid
03deeb89254ec4289edb8771e0188c2090a02f32
scripts/Inelastic/Direct/AbsorptionShapes.py
python
anAbsorptionShape._mc_abs_corrections
(self,correction_base_ws,kwarg={})
return adsrbtn_correctios
Method to correct absorption on a shape using Mont-Carlo integration Inputs: ws -- workspace to correct. Should be in the units of wavelength **kwarg -- dictionary of the additional keyword arguments to provide as input for the absorption corrections algorithm ...
Method to correct absorption on a shape using Mont-Carlo integration Inputs: ws -- workspace to correct. Should be in the units of wavelength **kwarg -- dictionary of the additional keyword arguments to provide as input for the absorption corrections algorithm ...
[ "Method", "to", "correct", "absorption", "on", "a", "shape", "using", "Mont", "-", "Carlo", "integration", "Inputs", ":", "ws", "--", "workspace", "to", "correct", ".", "Should", "be", "in", "the", "units", "of", "wavelength", "**", "kwarg", "--", "diction...
def _mc_abs_corrections(self,correction_base_ws,kwarg={}): """ Method to correct absorption on a shape using Mont-Carlo integration Inputs: ws -- workspace to correct. Should be in the units of wavelength **kwarg -- dictionary of the additional keyword arguments to provide as input ...
[ "def", "_mc_abs_corrections", "(", "self", ",", "correction_base_ws", ",", "kwarg", "=", "{", "}", ")", ":", "adsrbtn_correctios", "=", "MonteCarloAbsorption", "(", "correction_base_ws", ",", "*", "*", "kwarg", ")", "return", "adsrbtn_correctios" ]
https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/Inelastic/Direct/AbsorptionShapes.py#L223-L235
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/windows/Lib/mailbox.py
python
MH.list_folders
(self)
return result
Return a list of folder names.
Return a list of folder names.
[ "Return", "a", "list", "of", "folder", "names", "." ]
def list_folders(self): """Return a list of folder names.""" result = [] for entry in os.listdir(self._path): if os.path.isdir(os.path.join(self._path, entry)): result.append(entry) return result
[ "def", "list_folders", "(", "self", ")", ":", "result", "=", "[", "]", "for", "entry", "in", "os", ".", "listdir", "(", "self", ".", "_path", ")", ":", "if", "os", ".", "path", ".", "isdir", "(", "os", ".", "path", ".", "join", "(", "self", "."...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/mailbox.py#L1113-L1119
eclipse/sumo
7132a9b8b6eea734bdec38479026b4d8c4336d03
tools/contributed/sumopy/coremodules/demand/virtualpop.py
python
Virtualpopulation.create_pop_from_odflows
(self, is_use_landusetypes=False, **kwargs)
Creates a population and defines home and activity facility according to OD matrix defined in odflows. The population is distributed within the zones according to the area of the facility. if landusetype_orig and landusetype_dest also landuse types of facilities of origin and d...
Creates a population and defines home and activity facility according to OD matrix defined in odflows. The population is distributed within the zones according to the area of the facility. if landusetype_orig and landusetype_dest also landuse types of facilities of origin and d...
[ "Creates", "a", "population", "and", "defines", "home", "and", "activity", "facility", "according", "to", "OD", "matrix", "defined", "in", "odflows", ".", "The", "population", "is", "distributed", "within", "the", "zones", "according", "to", "the", "area", "of...
def create_pop_from_odflows(self, is_use_landusetypes=False, **kwargs): """ Creates a population and defines home and activity facility according to OD matrix defined in odflows. The population is distributed within the zones according to the area of the facility. if la...
[ "def", "create_pop_from_odflows", "(", "self", ",", "is_use_landusetypes", "=", "False", ",", "*", "*", "kwargs", ")", ":", "print", "'create_pop_from_odflows'", "demand", "=", "self", ".", "parent", "odflowtab", "=", "demand", ".", "odintervals", ".", "generate...
https://github.com/eclipse/sumo/blob/7132a9b8b6eea734bdec38479026b4d8c4336d03/tools/contributed/sumopy/coremodules/demand/virtualpop.py#L6202-L6318
Polidea/SiriusObfuscator
b0e590d8130e97856afe578869b83a209e2b19be
SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py
python
SBBreakpoint.GetBreakpointEventTypeFromEvent
(*args)
return _lldb.SBBreakpoint_GetBreakpointEventTypeFromEvent(*args)
GetBreakpointEventTypeFromEvent(SBEvent event) -> BreakpointEventType
GetBreakpointEventTypeFromEvent(SBEvent event) -> BreakpointEventType
[ "GetBreakpointEventTypeFromEvent", "(", "SBEvent", "event", ")", "-", ">", "BreakpointEventType" ]
def GetBreakpointEventTypeFromEvent(*args): """GetBreakpointEventTypeFromEvent(SBEvent event) -> BreakpointEventType""" return _lldb.SBBreakpoint_GetBreakpointEventTypeFromEvent(*args)
[ "def", "GetBreakpointEventTypeFromEvent", "(", "*", "args", ")", ":", "return", "_lldb", ".", "SBBreakpoint_GetBreakpointEventTypeFromEvent", "(", "*", "args", ")" ]
https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py#L1630-L1632
neoml-lib/neoml
a0d370fba05269a1b2258cef126f77bbd2054a3e
NeoML/Python/neoml/Dnn/Initializer.py
python
Uniform.lower_bound
(self, value)
Sets the distribution lower bound.
Sets the distribution lower bound.
[ "Sets", "the", "distribution", "lower", "bound", "." ]
def lower_bound(self, value): """Sets the distribution lower bound. """ self._internal.set_lower_bound(value)
[ "def", "lower_bound", "(", "self", ",", "value", ")", ":", "self", ".", "_internal", ".", "set_lower_bound", "(", "value", ")" ]
https://github.com/neoml-lib/neoml/blob/a0d370fba05269a1b2258cef126f77bbd2054a3e/NeoML/Python/neoml/Dnn/Initializer.py#L123-L126
baidu-research/tensorflow-allreduce
66d5b855e90b0949e9fa5cca5599fd729a70e874
tensorflow/python/tools/saved_model_cli.py
python
_show_inputs_outputs
(saved_model_dir, tag_set, signature_def_key)
Prints input and output TensorInfos. Prints the details of input and output TensorInfos for the SignatureDef mapped by the given signature_def_key. Args: saved_model_dir: Directory containing the SavedModel to inspect. tag_set: Group of tag(s) of the MetaGraphDef, in string format, separated by ...
Prints input and output TensorInfos.
[ "Prints", "input", "and", "output", "TensorInfos", "." ]
def _show_inputs_outputs(saved_model_dir, tag_set, signature_def_key): """Prints input and output TensorInfos. Prints the details of input and output TensorInfos for the SignatureDef mapped by the given signature_def_key. Args: saved_model_dir: Directory containing the SavedModel to inspect. tag_set: ...
[ "def", "_show_inputs_outputs", "(", "saved_model_dir", ",", "tag_set", ",", "signature_def_key", ")", ":", "meta_graph_def", "=", "get_meta_graph_def", "(", "saved_model_dir", ",", "tag_set", ")", "inputs_tensor_info", "=", "_get_inputs_tensor_info_from_meta_graph_def", "("...
https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/tools/saved_model_cli.py#L115-L144
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/msw/html.py
python
HtmlSelection.Set
(*args, **kwargs)
return _html.HtmlSelection_Set(*args, **kwargs)
Set(self, Point fromPos, HtmlCell fromCell, Point toPos, HtmlCell toCell)
Set(self, Point fromPos, HtmlCell fromCell, Point toPos, HtmlCell toCell)
[ "Set", "(", "self", "Point", "fromPos", "HtmlCell", "fromCell", "Point", "toPos", "HtmlCell", "toCell", ")" ]
def Set(*args, **kwargs): """Set(self, Point fromPos, HtmlCell fromCell, Point toPos, HtmlCell toCell)""" return _html.HtmlSelection_Set(*args, **kwargs)
[ "def", "Set", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_html", ".", "HtmlSelection_Set", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/html.py#L463-L465
mapnik/mapnik
f3da900c355e1d15059c4a91b00203dcc9d9f0ef
scons/scons-local-4.1.0/SCons/Tool/FortranCommon.py
python
add_f95_to_env
(env)
Add Builders and construction variables for f95 to an Environment.
Add Builders and construction variables for f95 to an Environment.
[ "Add", "Builders", "and", "construction", "variables", "for", "f95", "to", "an", "Environment", "." ]
def add_f95_to_env(env): """Add Builders and construction variables for f95 to an Environment.""" try: F95Suffixes = env['F95FILESUFFIXES'] except KeyError: F95Suffixes = ['.f95'] #print("Adding %s to f95 suffixes" % F95Suffixes) try: F95PPSuffixes = env['F95PPFILESUFFIXES']...
[ "def", "add_f95_to_env", "(", "env", ")", ":", "try", ":", "F95Suffixes", "=", "env", "[", "'F95FILESUFFIXES'", "]", "except", "KeyError", ":", "F95Suffixes", "=", "[", "'.f95'", "]", "#print(\"Adding %s to f95 suffixes\" % F95Suffixes)", "try", ":", "F95PPSuffixes"...
https://github.com/mapnik/mapnik/blob/f3da900c355e1d15059c4a91b00203dcc9d9f0ef/scons/scons-local-4.1.0/SCons/Tool/FortranCommon.py#L218-L232
mantidproject/mantid
03deeb89254ec4289edb8771e0188c2090a02f32
scripts/Inelastic/Direct/ReductionHelpers.py
python
gen_setter
(keyval_dict,key,val)
return None
function sets value to dictionary with substitution e.g. if keyval_dict[A] = 10, keyval_dict[B] = 20 and key_val[C] = [A,B] gen_setter(keyval_dict,A,20) causes keyval_dict[A] == 20 gen_setter(keyval_dict,B,30) causes keyval_dict[B] == 30 and gen_getter(keyval_dict,C,[1,2]) causes key...
function sets value to dictionary with substitution
[ "function", "sets", "value", "to", "dictionary", "with", "substitution" ]
def gen_setter(keyval_dict,key,val): """ function sets value to dictionary with substitution e.g. if keyval_dict[A] = 10, keyval_dict[B] = 20 and key_val[C] = [A,B] gen_setter(keyval_dict,A,20) causes keyval_dict[A] == 20 gen_setter(keyval_dict,B,30) causes keyval_dict[B] == 30 a...
[ "def", "gen_setter", "(", "keyval_dict", ",", "key", ",", "val", ")", ":", "if", "key", "not", "in", "keyval_dict", ":", "name", "=", "'_'", "+", "key", "if", "name", "not", "in", "keyval_dict", ":", "raise", "KeyError", "(", "' Property name: {0} is not d...
https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/Inelastic/Direct/ReductionHelpers.py#L274-L298
larq/compute-engine
a2611f8e33f5cb9b4d09b7c9aff7053620a24305
larq_compute_engine/mlir/python/util.py
python
_convert_model_from_object_to_bytearray
(model_object)
return bytes(builder.Output())
Converts a tflite model from a parsable object into a bytearray.
Converts a tflite model from a parsable object into a bytearray.
[ "Converts", "a", "tflite", "model", "from", "a", "parsable", "object", "into", "a", "bytearray", "." ]
def _convert_model_from_object_to_bytearray(model_object): """Converts a tflite model from a parsable object into a bytearray.""" # Initial size of the buffer, which will grow automatically if needed builder = flatbuffers.Builder(1024) model_offset = model_object.Pack(builder) builder.Finish(model_o...
[ "def", "_convert_model_from_object_to_bytearray", "(", "model_object", ")", ":", "# Initial size of the buffer, which will grow automatically if needed", "builder", "=", "flatbuffers", ".", "Builder", "(", "1024", ")", "model_offset", "=", "model_object", ".", "Pack", "(", ...
https://github.com/larq/compute-engine/blob/a2611f8e33f5cb9b4d09b7c9aff7053620a24305/larq_compute_engine/mlir/python/util.py#L48-L54
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
tools/grit/grit/format/data_pack.py
python
WriteDataPack
(resources, output_file, encoding)
Writes a map of id=>data into output_file as a data pack.
Writes a map of id=>data into output_file as a data pack.
[ "Writes", "a", "map", "of", "id", "=", ">", "data", "into", "output_file", "as", "a", "data", "pack", "." ]
def WriteDataPack(resources, output_file, encoding): """Writes a map of id=>data into output_file as a data pack.""" content = WriteDataPackToString(resources, encoding) with open(output_file, 'wb') as file: file.write(content)
[ "def", "WriteDataPack", "(", "resources", ",", "output_file", ",", "encoding", ")", ":", "content", "=", "WriteDataPackToString", "(", "resources", ",", "encoding", ")", "with", "open", "(", "output_file", ",", "'wb'", ")", "as", "file", ":", "file", ".", ...
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/grit/grit/format/data_pack.py#L105-L109