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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | buildscripts/idl/idl/syntax.py | python | Validator.__init__ | (self, file_name, line, column) | Construct a Validator. | Construct a Validator. | [
"Construct",
"a",
"Validator",
"."
] | def __init__(self, file_name, line, column):
# type: (str, int, int) -> None
"""Construct a Validator."""
# Don't lint gt/lt as bad attibute names.
# pylint: disable=C0103
self.gt = None # type: Expression
self.lt = None # type: Expression
self.gte = None # typ... | [
"def",
"__init__",
"(",
"self",
",",
"file_name",
",",
"line",
",",
"column",
")",
":",
"# type: (str, int, int) -> None",
"# Don't lint gt/lt as bad attibute names.",
"# pylint: disable=C0103",
"self",
".",
"gt",
"=",
"None",
"# type: Expression",
"self",
".",
"lt",
... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/idl/idl/syntax.py#L417-L428 | ||
larroy/clearskies_core | 3574ddf0edc8555454c7044126e786a6c29444dc | tools/gyp/pylib/gyp/generator/make.py | python | MakefileWriter.Absolutify | (self, path) | return os.path.normpath(os.path.join(self.path, path)) | Convert a subdirectory-relative path into a base-relative path.
Skips over paths that contain variables. | Convert a subdirectory-relative path into a base-relative path.
Skips over paths that contain variables. | [
"Convert",
"a",
"subdirectory",
"-",
"relative",
"path",
"into",
"a",
"base",
"-",
"relative",
"path",
".",
"Skips",
"over",
"paths",
"that",
"contain",
"variables",
"."
] | def Absolutify(self, path):
"""Convert a subdirectory-relative path into a base-relative path.
Skips over paths that contain variables."""
if '$(' in path:
# Don't call normpath in this case, as it might collapse the
# path too aggressively if it features '..'. However it's still
# importa... | [
"def",
"Absolutify",
"(",
"self",
",",
"path",
")",
":",
"if",
"'$('",
"in",
"path",
":",
"# Don't call normpath in this case, as it might collapse the",
"# path too aggressively if it features '..'. However it's still",
"# important to strip trailing slashes.",
"return",
"path",
... | https://github.com/larroy/clearskies_core/blob/3574ddf0edc8555454c7044126e786a6c29444dc/tools/gyp/pylib/gyp/generator/make.py#L1866-L1874 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/extending.py | python | overload_attribute | (typ, attr, **kwargs) | return decorate | A decorator marking the decorated function as typing and implementing
attribute *attr* for the given Numba type in nopython mode.
*kwargs* are passed to the underlying `@overload` call.
Here is an example implementing .nbytes for array types::
@overload_attribute(types.Array, 'nbytes')
de... | A decorator marking the decorated function as typing and implementing
attribute *attr* for the given Numba type in nopython mode. | [
"A",
"decorator",
"marking",
"the",
"decorated",
"function",
"as",
"typing",
"and",
"implementing",
"attribute",
"*",
"attr",
"*",
"for",
"the",
"given",
"Numba",
"type",
"in",
"nopython",
"mode",
"."
] | def overload_attribute(typ, attr, **kwargs):
"""
A decorator marking the decorated function as typing and implementing
attribute *attr* for the given Numba type in nopython mode.
*kwargs* are passed to the underlying `@overload` call.
Here is an example implementing .nbytes for array types::
... | [
"def",
"overload_attribute",
"(",
"typ",
",",
"attr",
",",
"*",
"*",
"kwargs",
")",
":",
"# TODO implement setters",
"from",
".",
"typing",
".",
"templates",
"import",
"make_overload_attribute_template",
"def",
"decorate",
"(",
"overload_func",
")",
":",
"template... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/extending.py#L152-L179 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py2/sklearn/preprocessing/data.py | python | OneHotEncoder._transform | (self, X) | return out if self.sparse else out.toarray() | Assumes X contains only categorical features. | Assumes X contains only categorical features. | [
"Assumes",
"X",
"contains",
"only",
"categorical",
"features",
"."
] | def _transform(self, X):
"""Assumes X contains only categorical features."""
X = check_array(X, dtype=np.int)
if np.any(X < 0):
raise ValueError("X needs to contain only non-negative integers.")
n_samples, n_features = X.shape
indices = self.feature_indices_
... | [
"def",
"_transform",
"(",
"self",
",",
"X",
")",
":",
"X",
"=",
"check_array",
"(",
"X",
",",
"dtype",
"=",
"np",
".",
"int",
")",
"if",
"np",
".",
"any",
"(",
"X",
"<",
"0",
")",
":",
"raise",
"ValueError",
"(",
"\"X needs to contain only non-negati... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py2/sklearn/preprocessing/data.py#L1904-L1942 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/tabnanny.py | python | check | (file) | check(file_or_dir)
If file_or_dir is a directory and not a symbolic link, then recursively
descend the directory tree named by file_or_dir, checking all .py files
along the way. If file_or_dir is an ordinary Python source file, it is
checked for whitespace related problems. The diagnostic messages are
... | check(file_or_dir) | [
"check",
"(",
"file_or_dir",
")"
] | def check(file):
"""check(file_or_dir)
If file_or_dir is a directory and not a symbolic link, then recursively
descend the directory tree named by file_or_dir, checking all .py files
along the way. If file_or_dir is an ordinary Python source file, it is
checked for whitespace related problems. The ... | [
"def",
"check",
"(",
"file",
")",
":",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"file",
")",
"and",
"not",
"os",
".",
"path",
".",
"islink",
"(",
"file",
")",
":",
"if",
"verbose",
":",
"print",
"\"%r: listing directory\"",
"%",
"(",
"file",
","... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/tabnanny.py#L74-L130 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/telemetry/third_party/web-page-replay/third_party/dns/renderer.py | python | Renderer.get_wire | (self) | return self.output.getvalue() | Return the wire format message.
@rtype: string | Return the wire format message. | [
"Return",
"the",
"wire",
"format",
"message",
"."
] | def get_wire(self):
"""Return the wire format message.
@rtype: string
"""
return self.output.getvalue() | [
"def",
"get_wire",
"(",
"self",
")",
":",
"return",
"self",
".",
"output",
".",
"getvalue",
"(",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/third_party/web-page-replay/third_party/dns/renderer.py#L318-L324 | |
luliyucoordinate/Leetcode | 96afcdc54807d1d184e881a075d1dbf3371e31fb | src/0208-Implement-Trie-(Prefix-Tree)/0208.py | python | Trie.search | (self, word) | return cur != None and cur.isWord | Returns if the word is in the trie.
:type word: str
:rtype: bool | Returns if the word is in the trie.
:type word: str
:rtype: bool | [
"Returns",
"if",
"the",
"word",
"is",
"in",
"the",
"trie",
".",
":",
"type",
"word",
":",
"str",
":",
"rtype",
":",
"bool"
] | def search(self, word):
"""
Returns if the word is in the trie.
:type word: str
:rtype: bool
"""
cur = self._search(word)
return cur != None and cur.isWord | [
"def",
"search",
"(",
"self",
",",
"word",
")",
":",
"cur",
"=",
"self",
".",
"_search",
"(",
"word",
")",
"return",
"cur",
"!=",
"None",
"and",
"cur",
".",
"isWord"
] | https://github.com/luliyucoordinate/Leetcode/blob/96afcdc54807d1d184e881a075d1dbf3371e31fb/src/0208-Implement-Trie-(Prefix-Tree)/0208.py#L28-L35 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/tools/tensorflow_builder/config_detector/config_detector.py | python | get_cpu_arch | () | return out.strip(b"\n") | Retrieves processor architecture type (32-bit or 64-bit).
Returns:
String that is CPU architecture.
e.g. 'x86_64' | Retrieves processor architecture type (32-bit or 64-bit). | [
"Retrieves",
"processor",
"architecture",
"type",
"(",
"32",
"-",
"bit",
"or",
"64",
"-",
"bit",
")",
"."
] | def get_cpu_arch():
"""Retrieves processor architecture type (32-bit or 64-bit).
Returns:
String that is CPU architecture.
e.g. 'x86_64'
"""
key = "cpu_arch"
out, err = run_shell_cmd(cmds_all[PLATFORM][key])
if err and FLAGS.debug:
print("Error in detecting CPU arch:\n %s" % str(err))
retu... | [
"def",
"get_cpu_arch",
"(",
")",
":",
"key",
"=",
"\"cpu_arch\"",
"out",
",",
"err",
"=",
"run_shell_cmd",
"(",
"cmds_all",
"[",
"PLATFORM",
"]",
"[",
"key",
"]",
")",
"if",
"err",
"and",
"FLAGS",
".",
"debug",
":",
"print",
"(",
"\"Error in detecting CP... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/tools/tensorflow_builder/config_detector/config_detector.py#L191-L203 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/setuptools/sandbox.py | python | override_temp | (replacement) | Monkey-patch tempfile.tempdir with replacement, ensuring it exists | Monkey-patch tempfile.tempdir with replacement, ensuring it exists | [
"Monkey",
"-",
"patch",
"tempfile",
".",
"tempdir",
"with",
"replacement",
"ensuring",
"it",
"exists"
] | def override_temp(replacement):
"""
Monkey-patch tempfile.tempdir with replacement, ensuring it exists
"""
pkg_resources.py31compat.makedirs(replacement, exist_ok=True)
saved = tempfile.tempdir
tempfile.tempdir = replacement
try:
yield
finally:
tempfile.tempdir = saved | [
"def",
"override_temp",
"(",
"replacement",
")",
":",
"pkg_resources",
".",
"py31compat",
".",
"makedirs",
"(",
"replacement",
",",
"exist_ok",
"=",
"True",
")",
"saved",
"=",
"tempfile",
".",
"tempdir",
"tempfile",
".",
"tempdir",
"=",
"replacement",
"try",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/setuptools/sandbox.py#L69-L82 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/internals/blocks.py | python | Block._unstack | (self, unstacker_func, new_columns, n_rows, fill_value) | return blocks, mask | Return a list of unstacked blocks of self
Parameters
----------
unstacker_func : callable
Partially applied unstacker.
new_columns : Index
All columns of the unstacked BlockManager.
n_rows : int
Only used in ExtensionBlock._unstack
fil... | Return a list of unstacked blocks of self | [
"Return",
"a",
"list",
"of",
"unstacked",
"blocks",
"of",
"self"
] | def _unstack(self, unstacker_func, new_columns, n_rows, fill_value):
"""Return a list of unstacked blocks of self
Parameters
----------
unstacker_func : callable
Partially applied unstacker.
new_columns : Index
All columns of the unstacked BlockManager.
... | [
"def",
"_unstack",
"(",
"self",
",",
"unstacker_func",
",",
"new_columns",
",",
"n_rows",
",",
"fill_value",
")",
":",
"unstacker",
"=",
"unstacker_func",
"(",
"self",
".",
"values",
".",
"T",
")",
"new_items",
"=",
"unstacker",
".",
"get_new_columns",
"(",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/internals/blocks.py#L1458-L1489 | |
infinit/elle | a8154593c42743f45b9df09daf62b44630c24a02 | drake/src/drake/cxx/qt5.py | python | Moc.hash | (self) | return self.command | A hash for this builder | A hash for this builder | [
"A",
"hash",
"for",
"this",
"builder"
] | def hash(self):
"""A hash for this builder"""
return self.command | [
"def",
"hash",
"(",
"self",
")",
":",
"return",
"self",
".",
"command"
] | https://github.com/infinit/elle/blob/a8154593c42743f45b9df09daf62b44630c24a02/drake/src/drake/cxx/qt5.py#L398-L400 | |
thalium/icebox | 99d147d5b9269222225443ce171b4fd46d8985d4 | third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2.py | python | xmlNode.xpathNewValueTree | (self) | return xpathObjectRet(ret) | Create a new xmlXPathObjectPtr of type Value Tree (XSLT)
and initialize it with the tree root @val | Create a new xmlXPathObjectPtr of type Value Tree (XSLT)
and initialize it with the tree root | [
"Create",
"a",
"new",
"xmlXPathObjectPtr",
"of",
"type",
"Value",
"Tree",
"(",
"XSLT",
")",
"and",
"initialize",
"it",
"with",
"the",
"tree",
"root"
] | def xpathNewValueTree(self):
"""Create a new xmlXPathObjectPtr of type Value Tree (XSLT)
and initialize it with the tree root @val """
ret = libxml2mod.xmlXPathNewValueTree(self._o)
if ret is None:raise xpathError('xmlXPathNewValueTree() failed')
return xpathObjectRet(ret) | [
"def",
"xpathNewValueTree",
"(",
"self",
")",
":",
"ret",
"=",
"libxml2mod",
".",
"xmlXPathNewValueTree",
"(",
"self",
".",
"_o",
")",
"if",
"ret",
"is",
"None",
":",
"raise",
"xpathError",
"(",
"'xmlXPathNewValueTree() failed'",
")",
"return",
"xpathObjectRet",... | https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2.py#L3746-L3751 | |
commaai/openpilot | 4416c21b1e738ab7d04147c5ae52b5135e0cdb40 | pyextra/acados_template/acados_ocp.py | python | AcadosOcpDims.nh | (self) | return self.__nh | :math:`n_h` - number of nonlinear constraints.
Type: int; default: 0 | :math:`n_h` - number of nonlinear constraints.
Type: int; default: 0 | [
":",
"math",
":",
"n_h",
"-",
"number",
"of",
"nonlinear",
"constraints",
".",
"Type",
":",
"int",
";",
"default",
":",
"0"
] | def nh(self):
""":math:`n_h` - number of nonlinear constraints.
Type: int; default: 0"""
return self.__nh | [
"def",
"nh",
"(",
"self",
")",
":",
"return",
"self",
".",
"__nh"
] | https://github.com/commaai/openpilot/blob/4416c21b1e738ab7d04147c5ae52b5135e0cdb40/pyextra/acados_template/acados_ocp.py#L134-L137 | |
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/poplib.py | python | POP3.dele | (self, which) | return self._shortcmd('DELE %s' % which) | Delete message number 'which'.
Result is 'response'. | Delete message number 'which'. | [
"Delete",
"message",
"number",
"which",
"."
] | def dele(self, which):
"""Delete message number 'which'.
Result is 'response'.
"""
return self._shortcmd('DELE %s' % which) | [
"def",
"dele",
"(",
"self",
",",
"which",
")",
":",
"return",
"self",
".",
"_shortcmd",
"(",
"'DELE %s'",
"%",
"which",
")"
] | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/poplib.py#L227-L232 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/lib/twodim_base.py | python | tril | (m, k=0) | return out | Lower triangle of an array.
Return a copy of an array with elements above the `k`-th diagonal zeroed.
Parameters
----------
m : array_like, shape (M, N)
Input array.
k : int, optional
Diagonal above which to zero elements. `k = 0` (the default) is the
main diagonal, `k < 0... | Lower triangle of an array. | [
"Lower",
"triangle",
"of",
"an",
"array",
"."
] | def tril(m, k=0):
"""
Lower triangle of an array.
Return a copy of an array with elements above the `k`-th diagonal zeroed.
Parameters
----------
m : array_like, shape (M, N)
Input array.
k : int, optional
Diagonal above which to zero elements. `k = 0` (the default) is the... | [
"def",
"tril",
"(",
"m",
",",
"k",
"=",
"0",
")",
":",
"m",
"=",
"asanyarray",
"(",
"m",
")",
"out",
"=",
"multiply",
"(",
"tri",
"(",
"m",
".",
"shape",
"[",
"0",
"]",
",",
"m",
".",
"shape",
"[",
"1",
"]",
",",
"k",
"=",
"k",
",",
"dt... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/lib/twodim_base.py#L391-L425 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/Pygments/py2/pygments/lexer.py | python | ExtendedRegexLexer.get_tokens_unprocessed | (self, text=None, context=None) | Split ``text`` into (tokentype, text) pairs.
If ``context`` is given, use this lexer context instead. | Split ``text`` into (tokentype, text) pairs.
If ``context`` is given, use this lexer context instead. | [
"Split",
"text",
"into",
"(",
"tokentype",
"text",
")",
"pairs",
".",
"If",
"context",
"is",
"given",
"use",
"this",
"lexer",
"context",
"instead",
"."
] | def get_tokens_unprocessed(self, text=None, context=None):
"""
Split ``text`` into (tokentype, text) pairs.
If ``context`` is given, use this lexer context instead.
"""
tokendefs = self._tokens
if not context:
ctx = LexerContext(text, 0)
statetoken... | [
"def",
"get_tokens_unprocessed",
"(",
"self",
",",
"text",
"=",
"None",
",",
"context",
"=",
"None",
")",
":",
"tokendefs",
"=",
"self",
".",
"_tokens",
"if",
"not",
"context",
":",
"ctx",
"=",
"LexerContext",
"(",
"text",
",",
"0",
")",
"statetokens",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/Pygments/py2/pygments/lexer.py#L700-L765 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/reduction_gui/settings/application_settings.py | python | GeneralSettings.emit_key_value | (self, key, value) | Emit a signal to alert listeners of key/value update | Emit a signal to alert listeners of key/value update | [
"Emit",
"a",
"signal",
"to",
"alert",
"listeners",
"of",
"key",
"/",
"value",
"update"
] | def emit_key_value(self, key, value):
"""
Emit a signal to alert listeners of key/value update
"""
self.data_updated.emit(key, value) | [
"def",
"emit_key_value",
"(",
"self",
",",
"key",
",",
"value",
")",
":",
"self",
".",
"data_updated",
".",
"emit",
"(",
"key",
",",
"value",
")"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/reduction_gui/settings/application_settings.py#L61-L65 | ||
thalium/icebox | 99d147d5b9269222225443ce171b4fd46d8985d4 | third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2class.py | python | xmlNode.xpathNextFollowingSibling | (self, ctxt) | return __tmp | Traversal function for the "following-sibling" direction
The following-sibling axis contains the following siblings
of the context node in document order. | Traversal function for the "following-sibling" direction
The following-sibling axis contains the following siblings
of the context node in document order. | [
"Traversal",
"function",
"for",
"the",
"following",
"-",
"sibling",
"direction",
"The",
"following",
"-",
"sibling",
"axis",
"contains",
"the",
"following",
"siblings",
"of",
"the",
"context",
"node",
"in",
"document",
"order",
"."
] | def xpathNextFollowingSibling(self, ctxt):
"""Traversal function for the "following-sibling" direction
The following-sibling axis contains the following siblings
of the context node in document order. """
if ctxt is None: ctxt__o = None
else: ctxt__o = ctxt._o
ret = ... | [
"def",
"xpathNextFollowingSibling",
"(",
"self",
",",
"ctxt",
")",
":",
"if",
"ctxt",
"is",
"None",
":",
"ctxt__o",
"=",
"None",
"else",
":",
"ctxt__o",
"=",
"ctxt",
".",
"_o",
"ret",
"=",
"libxml2mod",
".",
"xmlXPathNextFollowingSibling",
"(",
"ctxt__o",
... | https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2class.py#L3054-L3063 | |
QMCPACK/qmcpack | d0948ab455e38364458740cc8e2239600a14c5cd | utils/determinants_tools.py | python | det_to_csf | (det) | return CSF(d, s) | >>> det_to_csf( ( ([1,0]),([2,0]) ) )
CSF(double=(0, 0), single=(3, 0)) | >>> det_to_csf( ( ([1,0]),([2,0]) ) )
CSF(double=(0, 0), single=(3, 0)) | [
">>>",
"det_to_csf",
"(",
"(",
"(",
"[",
"1",
"0",
"]",
")",
"(",
"[",
"2",
"0",
"]",
")",
")",
")",
"CSF",
"(",
"double",
"=",
"(",
"0",
"0",
")",
"single",
"=",
"(",
"3",
"0",
"))"
] | def det_to_csf(det):
'''
>>> det_to_csf( ( ([1,0]),([2,0]) ) )
CSF(double=(0, 0), single=(3, 0))
'''
# This function assume that determinant are zero-padded.
d = tuple(a & b for a, b in zip(*det))
s = tuple(a ^ b for a, b in zip(*det))
return CSF(d, s) | [
"def",
"det_to_csf",
"(",
"det",
")",
":",
"# This function assume that determinant are zero-padded.",
"d",
"=",
"tuple",
"(",
"a",
"&",
"b",
"for",
"a",
",",
"b",
"in",
"zip",
"(",
"*",
"det",
")",
")",
"s",
"=",
"tuple",
"(",
"a",
"^",
"b",
"for",
... | https://github.com/QMCPACK/qmcpack/blob/d0948ab455e38364458740cc8e2239600a14c5cd/utils/determinants_tools.py#L93-L101 | |
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | benchmarks/tensorexpr/benchmark.py | python | Benchmark.desc | (self) | return "%s: %s_%s_%s_%s" % (
self.engine.mode,
self.module(),
self.mode,
device,
config_str,
) | return the description of the current benchmark | return the description of the current benchmark | [
"return",
"the",
"description",
"of",
"the",
"current",
"benchmark"
] | def desc(self):
"""return the description of the current benchmark
"""
config = self.config()
config_str = "_".join([str(x) for x in config])
device = self.device
if "NNC_NUM_THREADS" in os.environ:
num_threads_str = os.environ["NNC_NUM_THREADS"]
d... | [
"def",
"desc",
"(",
"self",
")",
":",
"config",
"=",
"self",
".",
"config",
"(",
")",
"config_str",
"=",
"\"_\"",
".",
"join",
"(",
"[",
"str",
"(",
"x",
")",
"for",
"x",
"in",
"config",
"]",
")",
"device",
"=",
"self",
".",
"device",
"if",
"\"... | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/benchmarks/tensorexpr/benchmark.py#L60-L75 | |
flexflow/FlexFlow | 581fad8ba8d10a16a3102ee2b406b0319586df24 | examples/python/pytorch/mt5/mt5_torch.py | python | SinhaleseDataset.__getitem__ | (self, index) | return {
"source_ids": source_ids.to(dtype=torch.long),
"source_mask": source_mask.to(dtype=torch.long),
"target_ids": target_ids.to(dtype=torch.long),
"target_ids_y": target_ids.to(dtype=torch.long),
} | Returns the input IDs, target IDs, and attention masks for the
given index. | Returns the input IDs, target IDs, and attention masks for the
given index. | [
"Returns",
"the",
"input",
"IDs",
"target",
"IDs",
"and",
"attention",
"masks",
"for",
"the",
"given",
"index",
"."
] | def __getitem__(self, index):
"""Returns the input IDs, target IDs, and attention masks for the
given index."""
src_text = str(self.source_text[index])
tar_text = str(self.target_text[index])
src_text = " ".join(src_text.split())
tar_text = " ".join(tar_text.split())
... | [
"def",
"__getitem__",
"(",
"self",
",",
"index",
")",
":",
"src_text",
"=",
"str",
"(",
"self",
".",
"source_text",
"[",
"index",
"]",
")",
"tar_text",
"=",
"str",
"(",
"self",
".",
"target_text",
"[",
"index",
"]",
")",
"src_text",
"=",
"\" \"",
"."... | https://github.com/flexflow/FlexFlow/blob/581fad8ba8d10a16a3102ee2b406b0319586df24/examples/python/pytorch/mt5/mt5_torch.py#L103-L138 | |
FEniCS/dolfinx | 3dfdf038cccdb70962865b58a63bf29c2e55ec6e | python/dolfinx/fem/assemble.py | python | pack_coefficients | (form: typing.Union[FormMetaClass, typing.Sequence[FormMetaClass]]) | return _pack(form) | Compute form coefficients. If form is an array of forms, this
function returns an array of form coefficients with the same shape
as form. | Compute form coefficients. If form is an array of forms, this
function returns an array of form coefficients with the same shape
as form. | [
"Compute",
"form",
"coefficients",
".",
"If",
"form",
"is",
"an",
"array",
"of",
"forms",
"this",
"function",
"returns",
"an",
"array",
"of",
"form",
"coefficients",
"with",
"the",
"same",
"shape",
"as",
"form",
"."
] | def pack_coefficients(form: typing.Union[FormMetaClass, typing.Sequence[FormMetaClass]]):
"""Compute form coefficients. If form is an array of forms, this
function returns an array of form coefficients with the same shape
as form.
"""
def _pack(form):
if form is None:
return {}
... | [
"def",
"pack_coefficients",
"(",
"form",
":",
"typing",
".",
"Union",
"[",
"FormMetaClass",
",",
"typing",
".",
"Sequence",
"[",
"FormMetaClass",
"]",
"]",
")",
":",
"def",
"_pack",
"(",
"form",
")",
":",
"if",
"form",
"is",
"None",
":",
"return",
"{",... | https://github.com/FEniCS/dolfinx/blob/3dfdf038cccdb70962865b58a63bf29c2e55ec6e/python/dolfinx/fem/assemble.py#L47-L61 | |
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/python/client/session.py | python | _FetchMapper.for_fetch | (fetch) | Creates fetch mapper that handles the structure of `fetch`.
The default graph must be the one from which we want to fetch values when
this function is called.
Args:
fetch: An arbitrary fetch structure: singleton, list, tuple,
namedtuple, or dict.
Returns:
An instance of a subclass... | Creates fetch mapper that handles the structure of `fetch`. | [
"Creates",
"fetch",
"mapper",
"that",
"handles",
"the",
"structure",
"of",
"fetch",
"."
] | def for_fetch(fetch):
"""Creates fetch mapper that handles the structure of `fetch`.
The default graph must be the one from which we want to fetch values when
this function is called.
Args:
fetch: An arbitrary fetch structure: singleton, list, tuple,
namedtuple, or dict.
Returns:
... | [
"def",
"for_fetch",
"(",
"fetch",
")",
":",
"if",
"fetch",
"is",
"None",
":",
"raise",
"TypeError",
"(",
"'Fetch argument %r has invalid type %r'",
"%",
"(",
"fetch",
",",
"type",
"(",
"fetch",
")",
")",
")",
"elif",
"isinstance",
"(",
"fetch",
",",
"(",
... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/python/client/session.py#L163-L192 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Tools/bgen/bgen/bgenVariable.py | python | Variable.getargsArgs | (self) | return self.type.getargsArgs(self.name) | Call the type's getargsArgsmethod. | Call the type's getargsArgsmethod. | [
"Call",
"the",
"type",
"s",
"getargsArgsmethod",
"."
] | def getargsArgs(self):
"""Call the type's getargsArgsmethod."""
return self.type.getargsArgs(self.name) | [
"def",
"getargsArgs",
"(",
"self",
")",
":",
"return",
"self",
".",
"type",
".",
"getargsArgs",
"(",
"self",
".",
"name",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Tools/bgen/bgen/bgenVariable.py#L65-L67 | |
openvinotoolkit/openvino | dedcbeafa8b84cccdc55ca64b8da516682b381c7 | tools/mo/openvino/tools/mo/front/mxnet/gluoncv_ssd_anchors.py | python | calculate_prior_box_value | (value: Node, value_to_div: Port, value_to_add: Port) | return _min, _max | :param value: Node with value. Here is supposed the node with op='Split'
:param value_to_div: Output port with values to be divided by 2
:param value_to_add: Output port with values to be added to values from value_to_div port
:return: Sub and Add nodes
The sub-graph can be described by formulas:
m... | :param value: Node with value. Here is supposed the node with op='Split'
:param value_to_div: Output port with values to be divided by 2
:param value_to_add: Output port with values to be added to values from value_to_div port
:return: Sub and Add nodes | [
":",
"param",
"value",
":",
"Node",
"with",
"value",
".",
"Here",
"is",
"supposed",
"the",
"node",
"with",
"op",
"=",
"Split",
":",
"param",
"value_to_div",
":",
"Output",
"port",
"with",
"values",
"to",
"be",
"divided",
"by",
"2",
":",
"param",
"value... | def calculate_prior_box_value(value: Node, value_to_div: Port, value_to_add: Port):
"""
:param value: Node with value. Here is supposed the node with op='Split'
:param value_to_div: Output port with values to be divided by 2
:param value_to_add: Output port with values to be added to values from value_t... | [
"def",
"calculate_prior_box_value",
"(",
"value",
":",
"Node",
",",
"value_to_div",
":",
"Port",
",",
"value_to_add",
":",
"Port",
")",
":",
"graph",
"=",
"value",
".",
"graph",
"dtype",
"=",
"data_type_str_to_np",
"(",
"graph",
".",
"graph",
"[",
"'cmd_para... | https://github.com/openvinotoolkit/openvino/blob/dedcbeafa8b84cccdc55ca64b8da516682b381c7/tools/mo/openvino/tools/mo/front/mxnet/gluoncv_ssd_anchors.py#L20-L43 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py2/pandas/core/indexes/base.py | python | Index.symmetric_difference | (self, other, result_name=None, sort=None) | return self._shallow_copy_with_infer(the_diff, **attribs) | Compute the symmetric difference of two Index objects.
Parameters
----------
other : Index or array-like
result_name : str
sort : False or None, default None
Whether to sort the resulting index. By default, the
values are attempted to be sorted, but any T... | Compute the symmetric difference of two Index objects. | [
"Compute",
"the",
"symmetric",
"difference",
"of",
"two",
"Index",
"objects",
"."
] | def symmetric_difference(self, other, result_name=None, sort=None):
"""
Compute the symmetric difference of two Index objects.
Parameters
----------
other : Index or array-like
result_name : str
sort : False or None, default None
Whether to sort the r... | [
"def",
"symmetric_difference",
"(",
"self",
",",
"other",
",",
"result_name",
"=",
"None",
",",
"sort",
"=",
"None",
")",
":",
"self",
".",
"_validate_sort_keyword",
"(",
"sort",
")",
"self",
".",
"_assert_can_do_setop",
"(",
"other",
")",
"other",
",",
"r... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/core/indexes/base.py#L2510-L2588 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/training/saving/functional_saver.py | python | MultiDeviceSaver.to_proto | (self) | return saver_pb2.SaverDef(
filename_tensor_name=filename_tensor.name,
save_tensor_name=save_tensor.name,
restore_op_name=restore_op.name,
version=saver_pb2.SaverDef.V2) | Serializes to a SaverDef referencing the current graph. | Serializes to a SaverDef referencing the current graph. | [
"Serializes",
"to",
"a",
"SaverDef",
"referencing",
"the",
"current",
"graph",
"."
] | def to_proto(self):
"""Serializes to a SaverDef referencing the current graph."""
filename_tensor = array_ops.placeholder(
shape=[], dtype=dtypes.string, name="saver_filename")
save_tensor = self._traced_save(filename_tensor)
restore_op = self._traced_restore(filename_tensor).op
return saver... | [
"def",
"to_proto",
"(",
"self",
")",
":",
"filename_tensor",
"=",
"array_ops",
".",
"placeholder",
"(",
"shape",
"=",
"[",
"]",
",",
"dtype",
"=",
"dtypes",
".",
"string",
",",
"name",
"=",
"\"saver_filename\"",
")",
"save_tensor",
"=",
"self",
".",
"_tr... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/training/saving/functional_saver.py#L146-L156 | |
arangodb/arangodb | 0d658689c7d1b721b314fa3ca27d38303e1570c8 | 3rdParty/V8/v7.9.317/third_party/jinja2/lexer.py | python | describe_token | (token) | return _describe_token_type(token.type) | Returns a description of the token. | Returns a description of the token. | [
"Returns",
"a",
"description",
"of",
"the",
"token",
"."
] | def describe_token(token):
"""Returns a description of the token."""
if token.type == 'name':
return token.value
return _describe_token_type(token.type) | [
"def",
"describe_token",
"(",
"token",
")",
":",
"if",
"token",
".",
"type",
"==",
"'name'",
":",
"return",
"token",
".",
"value",
"return",
"_describe_token_type",
"(",
"token",
".",
"type",
")"
] | https://github.com/arangodb/arangodb/blob/0d658689c7d1b721b314fa3ca27d38303e1570c8/3rdParty/V8/v7.9.317/third_party/jinja2/lexer.py#L171-L175 | |
ricardoquesada/Spidermonkey | 4a75ea2543408bd1b2c515aa95901523eeef7858 | ipc/chromium/src/third_party/libevent/event_rpcgen.py | python | EntryArray.GetDeclaration | (self, funcname) | return code | Allows direct access to elements of the array. | Allows direct access to elements of the array. | [
"Allows",
"direct",
"access",
"to",
"elements",
"of",
"the",
"array",
"."
] | def GetDeclaration(self, funcname):
"""Allows direct access to elements of the array."""
code = [
'int %(funcname)s(struct %(parent_name)s *, int, %(ctype)s *);' %
self.GetTranslation({ 'funcname' : funcname }) ]
return code | [
"def",
"GetDeclaration",
"(",
"self",
",",
"funcname",
")",
":",
"code",
"=",
"[",
"'int %(funcname)s(struct %(parent_name)s *, int, %(ctype)s *);'",
"%",
"self",
".",
"GetTranslation",
"(",
"{",
"'funcname'",
":",
"funcname",
"}",
")",
"]",
"return",
"code"
] | https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/ipc/chromium/src/third_party/libevent/event_rpcgen.py#L1079-L1084 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/framework/composite_tensor_utils.py | python | is_composite_or_composite_value | (tensor) | return isinstance(
tensor,
(composite_tensor.CompositeTensor, sparse_tensor.SparseTensorValue,
ragged_tensor_value.RaggedTensorValue)) | Returns true if 'tensor' is a CompositeTensor or a CT Value object. | Returns true if 'tensor' is a CompositeTensor or a CT Value object. | [
"Returns",
"true",
"if",
"tensor",
"is",
"a",
"CompositeTensor",
"or",
"a",
"CT",
"Value",
"object",
"."
] | def is_composite_or_composite_value(tensor):
"""Returns true if 'tensor' is a CompositeTensor or a CT Value object."""
# TODO(b/125094323): This should be isinstance(CompositeTensor) or
# isinstance(CompositeTensorValue) once we support that.
return isinstance(
tensor,
(composite_tensor.CompositeTen... | [
"def",
"is_composite_or_composite_value",
"(",
"tensor",
")",
":",
"# TODO(b/125094323): This should be isinstance(CompositeTensor) or",
"# isinstance(CompositeTensorValue) once we support that.",
"return",
"isinstance",
"(",
"tensor",
",",
"(",
"composite_tensor",
".",
"CompositeTen... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/framework/composite_tensor_utils.py#L31-L38 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_misc.py | python | Log_GetRepetitionCounting | (*args) | return _misc_.Log_GetRepetitionCounting(*args) | Log_GetRepetitionCounting() -> bool | Log_GetRepetitionCounting() -> bool | [
"Log_GetRepetitionCounting",
"()",
"-",
">",
"bool"
] | def Log_GetRepetitionCounting(*args):
"""Log_GetRepetitionCounting() -> bool"""
return _misc_.Log_GetRepetitionCounting(*args) | [
"def",
"Log_GetRepetitionCounting",
"(",
"*",
"args",
")",
":",
"return",
"_misc_",
".",
"Log_GetRepetitionCounting",
"(",
"*",
"args",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_misc.py#L1692-L1694 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/setuptools/py3/setuptools/_distutils/command/bdist.py | python | show_formats | () | Print list of available formats (arguments to "--format" option). | Print list of available formats (arguments to "--format" option). | [
"Print",
"list",
"of",
"available",
"formats",
"(",
"arguments",
"to",
"--",
"format",
"option",
")",
"."
] | def show_formats():
"""Print list of available formats (arguments to "--format" option).
"""
from distutils.fancy_getopt import FancyGetopt
formats = []
for format in bdist.format_commands:
formats.append(("formats=" + format, None,
bdist.format_command[format][1]))
... | [
"def",
"show_formats",
"(",
")",
":",
"from",
"distutils",
".",
"fancy_getopt",
"import",
"FancyGetopt",
"formats",
"=",
"[",
"]",
"for",
"format",
"in",
"bdist",
".",
"format_commands",
":",
"formats",
".",
"append",
"(",
"(",
"\"formats=\"",
"+",
"format",... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/setuptools/py3/setuptools/_distutils/command/bdist.py#L12-L21 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/propgrid.py | python | PropertyGridPage.Init | (*args, **kwargs) | return _propgrid.PropertyGridPage_Init(*args, **kwargs) | Init(self) | Init(self) | [
"Init",
"(",
"self",
")"
] | def Init(*args, **kwargs):
"""Init(self)"""
return _propgrid.PropertyGridPage_Init(*args, **kwargs) | [
"def",
"Init",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_propgrid",
".",
"PropertyGridPage_Init",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/propgrid.py#L3383-L3385 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/urllib3/connection.py | python | HTTPConnection.host | (self) | return self._dns_host.rstrip(".") | Getter method to remove any trailing dots that indicate the hostname is an FQDN.
In general, SSL certificates don't include the trailing dot indicating a
fully-qualified domain name, and thus, they don't validate properly when
checked against a domain name that includes the dot. In addition, so... | Getter method to remove any trailing dots that indicate the hostname is an FQDN. | [
"Getter",
"method",
"to",
"remove",
"any",
"trailing",
"dots",
"that",
"indicate",
"the",
"hostname",
"is",
"an",
"FQDN",
"."
] | def host(self):
"""
Getter method to remove any trailing dots that indicate the hostname is an FQDN.
In general, SSL certificates don't include the trailing dot indicating a
fully-qualified domain name, and thus, they don't validate properly when
checked against a domain name th... | [
"def",
"host",
"(",
"self",
")",
":",
"return",
"self",
".",
"_dns_host",
".",
"rstrip",
"(",
"\".\"",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/urllib3/connection.py#L115-L131 | |
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/python/framework/ops.py | python | Graph._check_not_finalized | (self) | Check if the graph is finalized.
Raises:
RuntimeError: If the graph finalized. | Check if the graph is finalized. | [
"Check",
"if",
"the",
"graph",
"is",
"finalized",
"."
] | def _check_not_finalized(self):
"""Check if the graph is finalized.
Raises:
RuntimeError: If the graph finalized.
"""
if self._finalized:
raise RuntimeError("Graph is finalized and cannot be modified.") | [
"def",
"_check_not_finalized",
"(",
"self",
")",
":",
"if",
"self",
".",
"_finalized",
":",
"raise",
"RuntimeError",
"(",
"\"Graph is finalized and cannot be modified.\"",
")"
] | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/python/framework/ops.py#L2001-L2008 | ||
Ewenwan/MVision | 97b394dfa48cb21c82cd003b1a952745e413a17f | deepLearning/000_utils.py | python | tile_raster_images | (X, img_shape, tile_shape, tile_spacing=(0, 0),
scale_rows_to_unit_interval=True,
output_pixel_vals=True) | Transform an array with one flattened image per row, into an array in
which images are reshaped and layed out like tiles on a floor.
This function is useful for visualizing datasets whose rows are images,
and also columns of matrices for transforming those rows
(such as the first layer of a neural net)... | Transform an array with one flattened image per row, into an array in
which images are reshaped and layed out like tiles on a floor. | [
"Transform",
"an",
"array",
"with",
"one",
"flattened",
"image",
"per",
"row",
"into",
"an",
"array",
"in",
"which",
"images",
"are",
"reshaped",
"and",
"layed",
"out",
"like",
"tiles",
"on",
"a",
"floor",
"."
] | def tile_raster_images(X, img_shape, tile_shape, tile_spacing=(0, 0),
scale_rows_to_unit_interval=True,
output_pixel_vals=True):
"""
Transform an array with one flattened image per row, into an array in
which images are reshaped and layed out like tiles on a flo... | [
"def",
"tile_raster_images",
"(",
"X",
",",
"img_shape",
",",
"tile_shape",
",",
"tile_spacing",
"=",
"(",
"0",
",",
"0",
")",
",",
"scale_rows_to_unit_interval",
"=",
"True",
",",
"output_pixel_vals",
"=",
"True",
")",
":",
"assert",
"len",
"(",
"img_shape"... | https://github.com/Ewenwan/MVision/blob/97b394dfa48cb21c82cd003b1a952745e413a17f/deepLearning/000_utils.py#L20-L138 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/fastparquet/util.py | python | unique_everseen | (iterable, key=None) | List unique elements, preserving order. Remember all elements ever seen.
unique_everseen('AAAABBBCCDAABBB') --> A B C D
unique_everseen('ABBCcAD', str.lower) --> A B C D | List unique elements, preserving order. Remember all elements ever seen. | [
"List",
"unique",
"elements",
"preserving",
"order",
".",
"Remember",
"all",
"elements",
"ever",
"seen",
"."
] | def unique_everseen(iterable, key=None):
"""List unique elements, preserving order. Remember all elements ever seen.
unique_everseen('AAAABBBCCDAABBB') --> A B C D
unique_everseen('ABBCcAD', str.lower) --> A B C D
"""
seen = set()
seen_add = seen.add
if key is None:
for element... | [
"def",
"unique_everseen",
"(",
"iterable",
",",
"key",
"=",
"None",
")",
":",
"seen",
"=",
"set",
"(",
")",
"seen_add",
"=",
"seen",
".",
"add",
"if",
"key",
"is",
"None",
":",
"for",
"element",
"in",
"filterfalse",
"(",
"seen",
".",
"__contains__",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/fastparquet/util.py#L376-L394 | ||
google/mysql-protobuf | 467cda676afaa49e762c5c9164a43f6ad31a1fbf | protobuf/python/google/protobuf/internal/encoder.py | python | GroupEncoder | (field_number, is_repeated, is_packed) | Returns an encoder for a group field. | Returns an encoder for a group field. | [
"Returns",
"an",
"encoder",
"for",
"a",
"group",
"field",
"."
] | def GroupEncoder(field_number, is_repeated, is_packed):
"""Returns an encoder for a group field."""
start_tag = TagBytes(field_number, wire_format.WIRETYPE_START_GROUP)
end_tag = TagBytes(field_number, wire_format.WIRETYPE_END_GROUP)
assert not is_packed
if is_repeated:
def EncodeRepeatedField(write, val... | [
"def",
"GroupEncoder",
"(",
"field_number",
",",
"is_repeated",
",",
"is_packed",
")",
":",
"start_tag",
"=",
"TagBytes",
"(",
"field_number",
",",
"wire_format",
".",
"WIRETYPE_START_GROUP",
")",
"end_tag",
"=",
"TagBytes",
"(",
"field_number",
",",
"wire_format"... | https://github.com/google/mysql-protobuf/blob/467cda676afaa49e762c5c9164a43f6ad31a1fbf/protobuf/python/google/protobuf/internal/encoder.py#L742-L760 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/data/experimental/ops/interleave_ops.py | python | parallel_interleave | (map_func,
cycle_length,
block_length=1,
sloppy=False,
buffer_output_elements=None,
prefetch_input_elements=None) | return _apply_fn | A parallel version of the `Dataset.interleave()` transformation.
`parallel_interleave()` maps `map_func` across its input to produce nested
datasets, and outputs their elements interleaved. Unlike
`tf.data.Dataset.interleave`, it gets elements from `cycle_length` nested
datasets in parallel, which increases th... | A parallel version of the `Dataset.interleave()` transformation. | [
"A",
"parallel",
"version",
"of",
"the",
"Dataset",
".",
"interleave",
"()",
"transformation",
"."
] | def parallel_interleave(map_func,
cycle_length,
block_length=1,
sloppy=False,
buffer_output_elements=None,
prefetch_input_elements=None):
"""A parallel version of the `Dataset.interleave()` transfor... | [
"def",
"parallel_interleave",
"(",
"map_func",
",",
"cycle_length",
",",
"block_length",
"=",
"1",
",",
"sloppy",
"=",
"False",
",",
"buffer_output_elements",
"=",
"None",
",",
"prefetch_input_elements",
"=",
"None",
")",
":",
"def",
"_apply_fn",
"(",
"dataset",... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/data/experimental/ops/interleave_ops.py#L29-L86 | |
gimli-org/gimli | 17aa2160de9b15ababd9ef99e89b1bc3277bbb23 | pygimli/physics/petro/resistivity.py | python | test_Archie | () | Test Archie. | Test Archie. | [
"Test",
"Archie",
"."
] | def test_Archie():
"""Test Archie."""
import unittest
dx = 0.01
phivec = np.arange(dx, 0.5, dx)
swvec = np.arange(dx, 1, dx)
phi0 = 0.4 # 40% porosity
rhow = 20 # 20 Ohmm tap water
tFAPhi = transFwdArchiePhi(rFluid=rhow)
tFAS = transFwdArchieS(rFluid=rhow, phi=phi0)
tIAPhi = ... | [
"def",
"test_Archie",
"(",
")",
":",
"import",
"unittest",
"dx",
"=",
"0.01",
"phivec",
"=",
"np",
".",
"arange",
"(",
"dx",
",",
"0.5",
",",
"dx",
")",
"swvec",
"=",
"np",
".",
"arange",
"(",
"dx",
",",
"1",
",",
"dx",
")",
"phi0",
"=",
"0.4",... | https://github.com/gimli-org/gimli/blob/17aa2160de9b15ababd9ef99e89b1bc3277bbb23/pygimli/physics/petro/resistivity.py#L176-L216 | ||
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | current/tools/inspector_protocol/jinja2/parser.py | python | Parser.parse_expression | (self, with_condexpr=True) | return self.parse_or() | Parse an expression. Per default all expressions are parsed, if
the optional `with_condexpr` parameter is set to `False` conditional
expressions are not parsed. | Parse an expression. Per default all expressions are parsed, if
the optional `with_condexpr` parameter is set to `False` conditional
expressions are not parsed. | [
"Parse",
"an",
"expression",
".",
"Per",
"default",
"all",
"expressions",
"are",
"parsed",
"if",
"the",
"optional",
"with_condexpr",
"parameter",
"is",
"set",
"to",
"False",
"conditional",
"expressions",
"are",
"not",
"parsed",
"."
] | def parse_expression(self, with_condexpr=True):
"""Parse an expression. Per default all expressions are parsed, if
the optional `with_condexpr` parameter is set to `False` conditional
expressions are not parsed.
"""
if with_condexpr:
return self.parse_condexpr()
... | [
"def",
"parse_expression",
"(",
"self",
",",
"with_condexpr",
"=",
"True",
")",
":",
"if",
"with_condexpr",
":",
"return",
"self",
".",
"parse_condexpr",
"(",
")",
"return",
"self",
".",
"parse_or",
"(",
")"
] | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/current/tools/inspector_protocol/jinja2/parser.py#L426-L433 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/closure_linter/closure_linter/errorrules.py | python | GetMaxLineLength | () | return FLAGS.max_line_length | Returns allowed maximum length of line.
Returns:
Length of line allowed without any warning. | Returns allowed maximum length of line. | [
"Returns",
"allowed",
"maximum",
"length",
"of",
"line",
"."
] | def GetMaxLineLength():
"""Returns allowed maximum length of line.
Returns:
Length of line allowed without any warning.
"""
return FLAGS.max_line_length | [
"def",
"GetMaxLineLength",
"(",
")",
":",
"return",
"FLAGS",
".",
"max_line_length"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/closure_linter/closure_linter/errorrules.py#L37-L43 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/logging/__init__.py | python | makeLogRecord | (dict) | return rv | Make a LogRecord whose attributes are defined by the specified dictionary,
This function is useful for converting a logging event received over
a socket connection (which is sent as a dictionary) into a LogRecord
instance. | Make a LogRecord whose attributes are defined by the specified dictionary,
This function is useful for converting a logging event received over
a socket connection (which is sent as a dictionary) into a LogRecord
instance. | [
"Make",
"a",
"LogRecord",
"whose",
"attributes",
"are",
"defined",
"by",
"the",
"specified",
"dictionary",
"This",
"function",
"is",
"useful",
"for",
"converting",
"a",
"logging",
"event",
"received",
"over",
"a",
"socket",
"connection",
"(",
"which",
"is",
"s... | def makeLogRecord(dict):
"""
Make a LogRecord whose attributes are defined by the specified dictionary,
This function is useful for converting a logging event received over
a socket connection (which is sent as a dictionary) into a LogRecord
instance.
"""
rv = LogRecord(None, None, "", 0, ""... | [
"def",
"makeLogRecord",
"(",
"dict",
")",
":",
"rv",
"=",
"LogRecord",
"(",
"None",
",",
"None",
",",
"\"\"",
",",
"0",
",",
"\"\"",
",",
"(",
")",
",",
"None",
",",
"None",
")",
"rv",
".",
"__dict__",
".",
"update",
"(",
"dict",
")",
"return",
... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/logging/__init__.py#L331-L340 | |
Polidea/SiriusObfuscator | b0e590d8130e97856afe578869b83a209e2b19be | SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py | python | SBUnixSignals.SetShouldSuppress | (self, *args) | return _lldb.SBUnixSignals_SetShouldSuppress(self, *args) | SetShouldSuppress(self, int32_t signo, bool value) -> bool | SetShouldSuppress(self, int32_t signo, bool value) -> bool | [
"SetShouldSuppress",
"(",
"self",
"int32_t",
"signo",
"bool",
"value",
")",
"-",
">",
"bool"
] | def SetShouldSuppress(self, *args):
"""SetShouldSuppress(self, int32_t signo, bool value) -> bool"""
return _lldb.SBUnixSignals_SetShouldSuppress(self, *args) | [
"def",
"SetShouldSuppress",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_lldb",
".",
"SBUnixSignals_SetShouldSuppress",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py#L12733-L12735 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/idlelib/pyparse.py | python | Parser._study2 | (self) | study1 was sufficient to determine the continuation status,
but doing more requires looking at every character. study2
does this for the last interesting statement in the block.
Creates:
self.stmt_start, stmt_end
slice indices of last interesting stmt
sel... | study1 was sufficient to determine the continuation status,
but doing more requires looking at every character. study2
does this for the last interesting statement in the block.
Creates:
self.stmt_start, stmt_end
slice indices of last interesting stmt
sel... | [
"study1",
"was",
"sufficient",
"to",
"determine",
"the",
"continuation",
"status",
"but",
"doing",
"more",
"requires",
"looking",
"at",
"every",
"character",
".",
"study2",
"does",
"this",
"for",
"the",
"last",
"interesting",
"statement",
"in",
"the",
"block",
... | def _study2(self):
"""
study1 was sufficient to determine the continuation status,
but doing more requires looking at every character. study2
does this for the last interesting statement in the block.
Creates:
self.stmt_start, stmt_end
slice indices o... | [
"def",
"_study2",
"(",
"self",
")",
":",
"if",
"self",
".",
"study_level",
">=",
"2",
":",
"return",
"self",
".",
"_study1",
"(",
")",
"self",
".",
"study_level",
"=",
"2",
"# Set p and q to slice indices of last interesting stmt.",
"code",
",",
"goodlines",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/idlelib/pyparse.py#L339-L460 | ||
ricardoquesada/Spidermonkey | 4a75ea2543408bd1b2c515aa95901523eeef7858 | python/psutil/psutil/_pslinux.py | python | get_system_per_cpu_times | () | Return a list of namedtuple representing the CPU times
for every CPU available on the system. | Return a list of namedtuple representing the CPU times
for every CPU available on the system. | [
"Return",
"a",
"list",
"of",
"namedtuple",
"representing",
"the",
"CPU",
"times",
"for",
"every",
"CPU",
"available",
"on",
"the",
"system",
"."
] | def get_system_per_cpu_times():
"""Return a list of namedtuple representing the CPU times
for every CPU available on the system.
"""
nt, rindex = _get_cputimes_ntuple()
cpus = []
f = open('/proc/stat', 'r')
try:
# get rid of the first line which refers to system wide CPU stats
... | [
"def",
"get_system_per_cpu_times",
"(",
")",
":",
"nt",
",",
"rindex",
"=",
"_get_cputimes_ntuple",
"(",
")",
"cpus",
"=",
"[",
"]",
"f",
"=",
"open",
"(",
"'/proc/stat'",
",",
"'r'",
")",
"try",
":",
"# get rid of the first line which refers to system wide CPU st... | https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/python/psutil/psutil/_pslinux.py#L257-L275 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_gdi.py | python | DC.GetBoundingBox | (*args, **kwargs) | return _gdi_.DC_GetBoundingBox(*args, **kwargs) | GetBoundingBox() -> (x1,y1, x2,y2)
Returns the min and max points used in drawing commands so far. | GetBoundingBox() -> (x1,y1, x2,y2) | [
"GetBoundingBox",
"()",
"-",
">",
"(",
"x1",
"y1",
"x2",
"y2",
")"
] | def GetBoundingBox(*args, **kwargs):
"""
GetBoundingBox() -> (x1,y1, x2,y2)
Returns the min and max points used in drawing commands so far.
"""
return _gdi_.DC_GetBoundingBox(*args, **kwargs) | [
"def",
"GetBoundingBox",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"DC_GetBoundingBox",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_gdi.py#L4603-L4609 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/fitting_widgets/model_fitting/model_fitting_view.py | python | ModelFittingView.update_result_table_names | (self, table_names: list) | Update the data in the results table combo box. | Update the data in the results table combo box. | [
"Update",
"the",
"data",
"in",
"the",
"results",
"table",
"combo",
"box",
"."
] | def update_result_table_names(self, table_names: list) -> None:
"""Update the data in the results table combo box."""
self.model_fitting_data_selector.update_result_table_names(table_names) | [
"def",
"update_result_table_names",
"(",
"self",
",",
"table_names",
":",
"list",
")",
"->",
"None",
":",
"self",
".",
"model_fitting_data_selector",
".",
"update_result_table_names",
"(",
"table_names",
")"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/fitting_widgets/model_fitting/model_fitting_view.py#L49-L51 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/hotshot/__init__.py | python | Profile.runctx | (self, cmd, globals, locals) | return self | Evaluate an exec-compatible string in a specific
environment.
The string is compiled before profiling begins. | Evaluate an exec-compatible string in a specific
environment. | [
"Evaluate",
"an",
"exec",
"-",
"compatible",
"string",
"in",
"a",
"specific",
"environment",
"."
] | def runctx(self, cmd, globals, locals):
"""Evaluate an exec-compatible string in a specific
environment.
The string is compiled before profiling begins.
"""
code = compile(cmd, "<string>", "exec")
self._prof.runcode(code, globals, locals)
return self | [
"def",
"runctx",
"(",
"self",
",",
"cmd",
",",
"globals",
",",
"locals",
")",
":",
"code",
"=",
"compile",
"(",
"cmd",
",",
"\"<string>\"",
",",
"\"exec\"",
")",
"self",
".",
"_prof",
".",
"runcode",
"(",
"code",
",",
"globals",
",",
"locals",
")",
... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/hotshot/__init__.py#L60-L68 | |
snap-stanford/snap-python | d53c51b0a26aa7e3e7400b014cdf728948fde80a | setup/snap.py | python | TInt_Sign | (*args) | return _snap.TInt_Sign(*args) | TInt_Sign(int const & Int) -> int
Parameters:
Int: int const & | TInt_Sign(int const & Int) -> int | [
"TInt_Sign",
"(",
"int",
"const",
"&",
"Int",
")",
"-",
">",
"int"
] | def TInt_Sign(*args):
"""
TInt_Sign(int const & Int) -> int
Parameters:
Int: int const &
"""
return _snap.TInt_Sign(*args) | [
"def",
"TInt_Sign",
"(",
"*",
"args",
")",
":",
"return",
"_snap",
".",
"TInt_Sign",
"(",
"*",
"args",
")"
] | https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/setup/snap.py#L13351-L13359 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/optimize/_differentialevolution.py | python | DifferentialEvolutionSolver.x | (self) | return self._scale_parameters(self.population[0]) | The best solution from the solver | The best solution from the solver | [
"The",
"best",
"solution",
"from",
"the",
"solver"
] | def x(self):
"""
The best solution from the solver
"""
return self._scale_parameters(self.population[0]) | [
"def",
"x",
"(",
"self",
")",
":",
"return",
"self",
".",
"_scale_parameters",
"(",
"self",
".",
"population",
"[",
"0",
"]",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/optimize/_differentialevolution.py#L624-L628 | |
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | lts/deps/v8/third_party/jinja2/sandbox.py | python | SandboxedEnvironment.getattr | (self, obj, attribute) | return self.undefined(obj=obj, name=attribute) | Subscribe an object from sandboxed code and prefer the
attribute. The attribute passed *must* be a bytestring. | Subscribe an object from sandboxed code and prefer the
attribute. The attribute passed *must* be a bytestring. | [
"Subscribe",
"an",
"object",
"from",
"sandboxed",
"code",
"and",
"prefer",
"the",
"attribute",
".",
"The",
"attribute",
"passed",
"*",
"must",
"*",
"be",
"a",
"bytestring",
"."
] | def getattr(self, obj, attribute):
"""Subscribe an object from sandboxed code and prefer the
attribute. The attribute passed *must* be a bytestring.
"""
try:
value = getattr(obj, attribute)
except AttributeError:
try:
return obj[attribute]... | [
"def",
"getattr",
"(",
"self",
",",
"obj",
",",
"attribute",
")",
":",
"try",
":",
"value",
"=",
"getattr",
"(",
"obj",
",",
"attribute",
")",
"except",
"AttributeError",
":",
"try",
":",
"return",
"obj",
"[",
"attribute",
"]",
"except",
"(",
"TypeErro... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/deps/v8/third_party/jinja2/sandbox.py#L380-L395 | |
neopenx/Dragon | 0e639a7319035ddc81918bd3df059230436ee0a1 | Dragon/python/dragon/operators/misc.py | python | MovingAverage | (inputs, decay, **kwargs) | return output | Calculate the moving average.
Parameters
----------
inputs : list of Tensor
The inputs, represent [variable, value].
decay : float
The decay factor.
Returns
-------
Tensor
The output tensor, i.e., ``variable``, calculated as:
|moving_average_function| | Calculate the moving average. | [
"Calculate",
"the",
"moving",
"average",
"."
] | def MovingAverage(inputs, decay, **kwargs):
"""Calculate the moving average.
Parameters
----------
inputs : list of Tensor
The inputs, represent [variable, value].
decay : float
The decay factor.
Returns
-------
Tensor
The output tensor, i.e., ``variable``, calc... | [
"def",
"MovingAverage",
"(",
"inputs",
",",
"decay",
",",
"*",
"*",
"kwargs",
")",
":",
"CheckInputs",
"(",
"inputs",
",",
"2",
")",
"arguments",
"=",
"ParseArguments",
"(",
"locals",
"(",
")",
")",
"variable",
"=",
"arguments",
"[",
"'inputs'",
"]",
"... | https://github.com/neopenx/Dragon/blob/0e639a7319035ddc81918bd3df059230436ee0a1/Dragon/python/dragon/operators/misc.py#L135-L160 | |
v8/v8 | fee3bf095260bf657a3eea4d3d41f90c42c6c857 | tools/grokdump.py | python | InspectionPadawan.FindObjectOrSmi | (self, tagged_address) | When used as a mixin in place of V8Heap. | When used as a mixin in place of V8Heap. | [
"When",
"used",
"as",
"a",
"mixin",
"in",
"place",
"of",
"V8Heap",
"."
] | def FindObjectOrSmi(self, tagged_address):
"""When used as a mixin in place of V8Heap."""
found_obj = self.SenseObject(tagged_address)
if found_obj: return found_obj
if self.IsSmi(tagged_address):
return self.FormatSmi(tagged_address)
else:
return "Unknown(%s)" % self.reader.FormatIntPtr... | [
"def",
"FindObjectOrSmi",
"(",
"self",
",",
"tagged_address",
")",
":",
"found_obj",
"=",
"self",
".",
"SenseObject",
"(",
"tagged_address",
")",
"if",
"found_obj",
":",
"return",
"found_obj",
"if",
"self",
".",
"IsSmi",
"(",
"tagged_address",
")",
":",
"ret... | https://github.com/v8/v8/blob/fee3bf095260bf657a3eea4d3d41f90c42c6c857/tools/grokdump.py#L2122-L2129 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/richtext.py | python | TextBoxAttr.GetSize | (*args) | return _richtext.TextBoxAttr_GetSize(*args) | GetSize(self) -> wxTextAttrSize
GetSize(self) -> wxTextAttrSize | GetSize(self) -> wxTextAttrSize
GetSize(self) -> wxTextAttrSize | [
"GetSize",
"(",
"self",
")",
"-",
">",
"wxTextAttrSize",
"GetSize",
"(",
"self",
")",
"-",
">",
"wxTextAttrSize"
] | def GetSize(*args):
"""
GetSize(self) -> wxTextAttrSize
GetSize(self) -> wxTextAttrSize
"""
return _richtext.TextBoxAttr_GetSize(*args) | [
"def",
"GetSize",
"(",
"*",
"args",
")",
":",
"return",
"_richtext",
".",
"TextBoxAttr_GetSize",
"(",
"*",
"args",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/richtext.py#L803-L808 | |
rprichard/CxxCodeBrowser | a2fa83d2fe06119f0a7a1827b8167fab88b53561 | third_party/libre2/lib/codereview/codereview.py | python | GetRpcServer | (options) | return rpc_server_class(options.server, GetUserCredentials,
host_override=options.host, save_cookies=options.save_cookies) | Returns an instance of an AbstractRpcServer.
Returns:
A new AbstractRpcServer, on which RPC calls can be made. | Returns an instance of an AbstractRpcServer. | [
"Returns",
"an",
"instance",
"of",
"an",
"AbstractRpcServer",
"."
] | def GetRpcServer(options):
"""Returns an instance of an AbstractRpcServer.
Returns:
A new AbstractRpcServer, on which RPC calls can be made.
"""
rpc_server_class = HttpRpcServer
def GetUserCredentials():
"""Prompts the user for a username and password."""
# Disable status prints so they don't obscure the ... | [
"def",
"GetRpcServer",
"(",
"options",
")",
":",
"rpc_server_class",
"=",
"HttpRpcServer",
"def",
"GetUserCredentials",
"(",
")",
":",
"\"\"\"Prompts the user for a username and password.\"\"\"",
"# Disable status prints so they don't obscure the password prompt.",
"global",
"globa... | https://github.com/rprichard/CxxCodeBrowser/blob/a2fa83d2fe06119f0a7a1827b8167fab88b53561/third_party/libre2/lib/codereview/codereview.py#L3019-L3062 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/random.py | python | WichmannHill.__whseed | (self, x=0, y=0, z=0) | Set the Wichmann-Hill seed from (x, y, z).
These must be integers in the range [0, 256). | Set the Wichmann-Hill seed from (x, y, z). | [
"Set",
"the",
"Wichmann",
"-",
"Hill",
"seed",
"from",
"(",
"x",
"y",
"z",
")",
"."
] | def __whseed(self, x=0, y=0, z=0):
"""Set the Wichmann-Hill seed from (x, y, z).
These must be integers in the range [0, 256).
"""
if not type(x) == type(y) == type(z) == int:
raise TypeError('seeds must be integers')
if not (0 <= x < 256 and 0 <= y < 256 and 0 <= z... | [
"def",
"__whseed",
"(",
"self",
",",
"x",
"=",
"0",
",",
"y",
"=",
"0",
",",
"z",
"=",
"0",
")",
":",
"if",
"not",
"type",
"(",
"x",
")",
"==",
"type",
"(",
"y",
")",
"==",
"type",
"(",
"z",
")",
"==",
"int",
":",
"raise",
"TypeError",
"(... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/random.py#L751-L772 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/hmac.py | python | digest | (key, msg, digest) | return outer.digest() | Fast inline implementation of HMAC
key: key for the keyed hash object.
msg: input message
digest: A hash name suitable for hashlib.new() for best performance. *OR*
A hashlib constructor returning a new hash object. *OR*
A module supporting PEP 247.
Note: key and msg must ... | Fast inline implementation of HMAC | [
"Fast",
"inline",
"implementation",
"of",
"HMAC"
] | def digest(key, msg, digest):
"""Fast inline implementation of HMAC
key: key for the keyed hash object.
msg: input message
digest: A hash name suitable for hashlib.new() for best performance. *OR*
A hashlib constructor returning a new hash object. *OR*
A module supporting ... | [
"def",
"digest",
"(",
"key",
",",
"msg",
",",
"digest",
")",
":",
"if",
"(",
"_hashopenssl",
"is",
"not",
"None",
"and",
"isinstance",
"(",
"digest",
",",
"str",
")",
"and",
"digest",
"in",
"_openssl_md_meths",
")",
":",
"return",
"_hashopenssl",
".",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/hmac.py#L156-L188 | |
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | lts/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py | python | _RegistryQueryBase | (sysdir, key, value) | return text | Use reg.exe to read a particular key.
While ideally we might use the win32 module, we would like gyp to be
python neutral, so for instance cygwin python lacks this module.
Arguments:
sysdir: The system subdirectory to attempt to launch reg.exe from.
key: The registry key to read from.
value: The par... | Use reg.exe to read a particular key. | [
"Use",
"reg",
".",
"exe",
"to",
"read",
"a",
"particular",
"key",
"."
] | def _RegistryQueryBase(sysdir, key, value):
"""Use reg.exe to read a particular key.
While ideally we might use the win32 module, we would like gyp to be
python neutral, so for instance cygwin python lacks this module.
Arguments:
sysdir: The system subdirectory to attempt to launch reg.exe from.
key: ... | [
"def",
"_RegistryQueryBase",
"(",
"sysdir",
",",
"key",
",",
"value",
")",
":",
"# Skip if not on Windows or Python Win32 setup issue",
"if",
"sys",
".",
"platform",
"not",
"in",
"(",
"'win32'",
",",
"'cygwin'",
")",
":",
"return",
"None",
"# Setup params to pass to... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py#L112-L142 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/lite/experimental/micro/examples/micro_vision/utils/raw_to_bitmap.py | python | parse_file | (inputfile, width, height, channels) | return frame_list | Convert log file to array of pixels.
Args:
inputfile: log file to parse
width: image width in pixels
height: image height in pixels
channels: color channel count
Returns:
list 1-D arrays to represent raw image data. | Convert log file to array of pixels. | [
"Convert",
"log",
"file",
"to",
"array",
"of",
"pixels",
"."
] | def parse_file(inputfile, width, height, channels):
"""Convert log file to array of pixels.
Args:
inputfile: log file to parse
width: image width in pixels
height: image height in pixels
channels: color channel count
Returns:
list 1-D arrays to represent raw image data.
"""
data = None
... | [
"def",
"parse_file",
"(",
"inputfile",
",",
"width",
",",
"height",
",",
"channels",
")",
":",
"data",
"=",
"None",
"bytes_written",
"=",
"0",
"frame_start",
"=",
"False",
"frame_stop",
"=",
"False",
"frame_list",
"=",
"list",
"(",
")",
"# collect all pixel ... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/lite/experimental/micro/examples/micro_vision/utils/raw_to_bitmap.py#L108-L155 | |
llvm-mirror/clang-tools-extra | 5c40544fa40bfb85ec888b6a03421b3905e4a4e7 | clang-tidy/tool/run-clang-tidy.py | python | check_clang_apply_replacements_binary | (args) | Checks if invoking supplied clang-apply-replacements binary works. | Checks if invoking supplied clang-apply-replacements binary works. | [
"Checks",
"if",
"invoking",
"supplied",
"clang",
"-",
"apply",
"-",
"replacements",
"binary",
"works",
"."
] | def check_clang_apply_replacements_binary(args):
"""Checks if invoking supplied clang-apply-replacements binary works."""
try:
subprocess.check_call([args.clang_apply_replacements_binary, '--version'])
except:
print('Unable to run clang-apply-replacements. Is clang-apply-replacements '
'binary c... | [
"def",
"check_clang_apply_replacements_binary",
"(",
"args",
")",
":",
"try",
":",
"subprocess",
".",
"check_call",
"(",
"[",
"args",
".",
"clang_apply_replacements_binary",
",",
"'--version'",
"]",
")",
"except",
":",
"print",
"(",
"'Unable to run clang-apply-replace... | https://github.com/llvm-mirror/clang-tools-extra/blob/5c40544fa40bfb85ec888b6a03421b3905e4a4e7/clang-tidy/tool/run-clang-tidy.py#L134-L142 | ||
klzgrad/naiveproxy | ed2c513637c77b18721fe428d7ed395b4d284c83 | src/tools/grit/grit/gather/chrome_html.py | python | UrlToImageSet | (
src_match, base_path, scale_factors, distribution,
filename_expansion_function=None) | return GenerateImageSet(image_list, quote) | Regex replace function which replaces url() with -webkit-image-set.
Takes a regex match for url('path'). If the file is local, checks for
files of the same name in folders corresponding to the supported scale
factors. If the file is from a chrome://theme/ source, inserts the
supported @Nx scale factor request.... | Regex replace function which replaces url() with -webkit-image-set. | [
"Regex",
"replace",
"function",
"which",
"replaces",
"url",
"()",
"with",
"-",
"webkit",
"-",
"image",
"-",
"set",
"."
] | def UrlToImageSet(
src_match, base_path, scale_factors, distribution,
filename_expansion_function=None):
"""Regex replace function which replaces url() with -webkit-image-set.
Takes a regex match for url('path'). If the file is local, checks for
files of the same name in folders corresponding to the supp... | [
"def",
"UrlToImageSet",
"(",
"src_match",
",",
"base_path",
",",
"scale_factors",
",",
"distribution",
",",
"filename_expansion_function",
"=",
"None",
")",
":",
"quote",
"=",
"src_match",
".",
"group",
"(",
"'quote'",
")",
"filename",
"=",
"src_match",
".",
"... | https://github.com/klzgrad/naiveproxy/blob/ed2c513637c77b18721fe428d7ed395b4d284c83/src/tools/grit/grit/gather/chrome_html.py#L132-L163 | |
emscripten-core/emscripten | 0d413d3c5af8b28349682496edc14656f5700c2f | third_party/ply/example/classcalc/calc.py | python | Calc.p_expression_name | (self, p) | expression : NAME | expression : NAME | [
"expression",
":",
"NAME"
] | def p_expression_name(self, p):
'expression : NAME'
try:
p[0] = self.names[p[1]]
except LookupError:
print("Undefined name '%s'" % p[1])
p[0] = 0 | [
"def",
"p_expression_name",
"(",
"self",
",",
"p",
")",
":",
"try",
":",
"p",
"[",
"0",
"]",
"=",
"self",
".",
"names",
"[",
"p",
"[",
"1",
"]",
"]",
"except",
"LookupError",
":",
"print",
"(",
"\"Undefined name '%s'\"",
"%",
"p",
"[",
"1",
"]",
... | https://github.com/emscripten-core/emscripten/blob/0d413d3c5af8b28349682496edc14656f5700c2f/third_party/ply/example/classcalc/calc.py#L141-L147 | ||
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | chrome/common/extensions/docs/examples/apps/hello-python/oauth2/__init__.py | python | build_xoauth_string | (url, consumer, token=None) | return "%s %s %s" % ("GET", url, ','.join(params)) | Build an XOAUTH string for use in SMTP/IMPA authentication. | Build an XOAUTH string for use in SMTP/IMPA authentication. | [
"Build",
"an",
"XOAUTH",
"string",
"for",
"use",
"in",
"SMTP",
"/",
"IMPA",
"authentication",
"."
] | def build_xoauth_string(url, consumer, token=None):
"""Build an XOAUTH string for use in SMTP/IMPA authentication."""
request = Request.from_consumer_and_token(consumer, token,
"GET", url)
signing_method = SignatureMethod_HMAC_SHA1()
request.sign_request(signing_method, consumer, token)
pa... | [
"def",
"build_xoauth_string",
"(",
"url",
",",
"consumer",
",",
"token",
"=",
"None",
")",
":",
"request",
"=",
"Request",
".",
"from_consumer_and_token",
"(",
"consumer",
",",
"token",
",",
"\"GET\"",
",",
"url",
")",
"signing_method",
"=",
"SignatureMethod_H... | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/chrome/common/extensions/docs/examples/apps/hello-python/oauth2/__init__.py#L68-L81 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/android/loading/loading_trace.py | python | LoadingTrace.ToJsonDict | (self) | return result | Returns a dictionary representing this instance. | Returns a dictionary representing this instance. | [
"Returns",
"a",
"dictionary",
"representing",
"this",
"instance",
"."
] | def ToJsonDict(self):
"""Returns a dictionary representing this instance."""
result = {self._URL_KEY: self.url, self._METADATA_KEY: self.metadata,
self._PAGE_KEY: self.page_track.ToJsonDict(),
self._REQUEST_KEY: self.request_track.ToJsonDict(),
self._TRACING_KEY: (self.... | [
"def",
"ToJsonDict",
"(",
"self",
")",
":",
"result",
"=",
"{",
"self",
".",
"_URL_KEY",
":",
"self",
".",
"url",
",",
"self",
".",
"_METADATA_KEY",
":",
"self",
".",
"metadata",
",",
"self",
".",
"_PAGE_KEY",
":",
"self",
".",
"page_track",
".",
"To... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/android/loading/loading_trace.py#L45-L52 | |
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/python/ops/math_ops.py | python | reduce_any | (input_tensor, reduction_indices=None, keep_dims=False,
name=None) | return gen_math_ops._any(input_tensor, _ReductionDims(input_tensor,
reduction_indices),
keep_dims, name=name) | Computes the "logical or" of elements across dimensions of a tensor.
Reduces `input_tensor` along the dimensions given in `reduction_indices`.
Unless `keep_dims` is true, the rank of the tensor is reduced by 1 for each
entry in `reduction_indices`. If `keep_dims` is true, the reduced dimensions
are retained wi... | Computes the "logical or" of elements across dimensions of a tensor. | [
"Computes",
"the",
"logical",
"or",
"of",
"elements",
"across",
"dimensions",
"of",
"a",
"tensor",
"."
] | def reduce_any(input_tensor, reduction_indices=None, keep_dims=False,
name=None):
"""Computes the "logical or" of elements across dimensions of a tensor.
Reduces `input_tensor` along the dimensions given in `reduction_indices`.
Unless `keep_dims` is true, the rank of the tensor is reduced by 1 for... | [
"def",
"reduce_any",
"(",
"input_tensor",
",",
"reduction_indices",
"=",
"None",
",",
"keep_dims",
"=",
"False",
",",
"name",
"=",
"None",
")",
":",
"return",
"gen_math_ops",
".",
"_any",
"(",
"input_tensor",
",",
"_ReductionDims",
"(",
"input_tensor",
",",
... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/python/ops/math_ops.py#L1216-L1250 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/numpy/array_creations.py | python | _pad_empty | (arr, pad_width) | return arr | pads the array with constant values, used in mode: "empty" | pads the array with constant values, used in mode: "empty" | [
"pads",
"the",
"array",
"with",
"constant",
"values",
"used",
"in",
"mode",
":",
"empty"
] | def _pad_empty(arr, pad_width):
"""
pads the array with constant values, used in mode: "empty"
"""
dtype = arr.dtype
for i in range(arr.ndim):
shape = arr.shape
pad_before = ()
pad_after = ()
# To avoid any memory issues, we don't make tensor with 0s in their shapes
... | [
"def",
"_pad_empty",
"(",
"arr",
",",
"pad_width",
")",
":",
"dtype",
"=",
"arr",
".",
"dtype",
"for",
"i",
"in",
"range",
"(",
"arr",
".",
"ndim",
")",
":",
"shape",
"=",
"arr",
".",
"shape",
"pad_before",
"=",
"(",
")",
"pad_after",
"=",
"(",
"... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/numpy/array_creations.py#L2121-L2137 | |
koth/kcws | 88efbd36a7022de4e6e90f5a1fb880cf87cfae9f | third_party/setuptools/pkg_resources.py | python | find_eggs_in_zip | (importer, path_item, only=False) | Find eggs in zip files; possibly multiple nested eggs. | Find eggs in zip files; possibly multiple nested eggs. | [
"Find",
"eggs",
"in",
"zip",
"files",
";",
"possibly",
"multiple",
"nested",
"eggs",
"."
] | def find_eggs_in_zip(importer, path_item, only=False):
"""
Find eggs in zip files; possibly multiple nested eggs.
"""
if importer.archive.endswith('.whl'):
# wheels are not supported with this finder
# they don't have PKG-INFO metadata, and won't ever contain eggs
return
meta... | [
"def",
"find_eggs_in_zip",
"(",
"importer",
",",
"path_item",
",",
"only",
"=",
"False",
")",
":",
"if",
"importer",
".",
"archive",
".",
"endswith",
"(",
"'.whl'",
")",
":",
"# wheels are not supported with this finder",
"# they don't have PKG-INFO metadata, and won't ... | https://github.com/koth/kcws/blob/88efbd36a7022de4e6e90f5a1fb880cf87cfae9f/third_party/setuptools/pkg_resources.py#L1831-L1849 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/lib-tk/Tkinter.py | python | Misc.winfo_toplevel | (self) | return self._nametowidget(self.tk.call(
'winfo', 'toplevel', self._w)) | Return the toplevel widget of this widget. | Return the toplevel widget of this widget. | [
"Return",
"the",
"toplevel",
"widget",
"of",
"this",
"widget",
"."
] | def winfo_toplevel(self):
"""Return the toplevel widget of this widget."""
return self._nametowidget(self.tk.call(
'winfo', 'toplevel', self._w)) | [
"def",
"winfo_toplevel",
"(",
"self",
")",
":",
"return",
"self",
".",
"_nametowidget",
"(",
"self",
".",
"tk",
".",
"call",
"(",
"'winfo'",
",",
"'toplevel'",
",",
"self",
".",
"_w",
")",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/lib-tk/Tkinter.py#L890-L893 | |
Studio3T/robomongo | 2411cd032e2e69b968dadda13ac91ca4ef3483b0 | src/third-party/qscintilla-2.8.4/sources/Python/configure.py | python | _HostPythonConfiguration.__init__ | (self) | Initialise the configuration. | Initialise the configuration. | [
"Initialise",
"the",
"configuration",
"."
] | def __init__(self):
""" Initialise the configuration. """
self.platform = sys.platform
self.version = sys.hexversion >> 8
if hasattr(sysconfig, 'get_path'):
# The modern API.
self.inc_dir = sysconfig.get_path('include')
self.module_dir = sysconfig.ge... | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"platform",
"=",
"sys",
".",
"platform",
"self",
".",
"version",
"=",
"sys",
".",
"hexversion",
">>",
"8",
"if",
"hasattr",
"(",
"sysconfig",
",",
"'get_path'",
")",
":",
"# The modern API.",
"self",... | https://github.com/Studio3T/robomongo/blob/2411cd032e2e69b968dadda13ac91ca4ef3483b0/src/third-party/qscintilla-2.8.4/sources/Python/configure.py#L618-L638 | ||
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/_numpy_op_doc.py | python | _npx_nonzero | (a) | Return the indices of the elements that are non-zero.
Returns a ndarray with ndim is 2. Each row contains the indices
of the non-zero elements. The values in `a` are always tested and returned in
row-major, C-style order.
The result of this is always a 2-D array, with a row for
each non-zero eleme... | Return the indices of the elements that are non-zero. | [
"Return",
"the",
"indices",
"of",
"the",
"elements",
"that",
"are",
"non",
"-",
"zero",
"."
] | def _npx_nonzero(a):
"""
Return the indices of the elements that are non-zero.
Returns a ndarray with ndim is 2. Each row contains the indices
of the non-zero elements. The values in `a` are always tested and returned in
row-major, C-style order.
The result of this is always a 2-D array, with ... | [
"def",
"_npx_nonzero",
"(",
"a",
")",
":",
"pass"
] | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/_numpy_op_doc.py#L36-L80 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/scipy/optimize/_lsq/common.py | python | right_multiply | (J, d, copy=True) | return J | Compute J diag(d).
If `copy` is False, `J` is modified in place (unless being LinearOperator). | Compute J diag(d).
If `copy` is False, `J` is modified in place (unless being LinearOperator). | [
"Compute",
"J",
"diag",
"(",
"d",
")",
".",
"If",
"copy",
"is",
"False",
"J",
"is",
"modified",
"in",
"place",
"(",
"unless",
"being",
"LinearOperator",
")",
"."
] | def right_multiply(J, d, copy=True):
"""Compute J diag(d).
If `copy` is False, `J` is modified in place (unless being LinearOperator).
"""
if copy and not isinstance(J, LinearOperator):
J = J.copy()
if issparse(J):
J.data *= d.take(J.indices, mode='clip') # scikit-learn recipe... | [
"def",
"right_multiply",
"(",
"J",
",",
"d",
",",
"copy",
"=",
"True",
")",
":",
"if",
"copy",
"and",
"not",
"isinstance",
"(",
"J",
",",
"LinearOperator",
")",
":",
"J",
"=",
"J",
".",
"copy",
"(",
")",
"if",
"issparse",
"(",
"J",
")",
":",
"J... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/scipy/optimize/_lsq/common.py#L673-L688 | |
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Arch/importIFClegacy.py | python | getIfcElevation | (obj) | return 0 | getIfcElevation(obj): Returns the lowest height (Z coordinate) of this object | getIfcElevation(obj): Returns the lowest height (Z coordinate) of this object | [
"getIfcElevation",
"(",
"obj",
")",
":",
"Returns",
"the",
"lowest",
"height",
"(",
"Z",
"coordinate",
")",
"of",
"this",
"object"
] | def getIfcElevation(obj):
"""getIfcElevation(obj): Returns the lowest height (Z coordinate) of this object"""
if obj.isDerivedFrom("Part::Feature"):
b = obj.Shape.BoundBox
return b.ZMin
return 0 | [
"def",
"getIfcElevation",
"(",
"obj",
")",
":",
"if",
"obj",
".",
"isDerivedFrom",
"(",
"\"Part::Feature\"",
")",
":",
"b",
"=",
"obj",
".",
"Shape",
".",
"BoundBox",
"return",
"b",
".",
"ZMin",
"return",
"0"
] | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Arch/importIFClegacy.py#L1380-L1385 | |
Tencent/CMONGO | c40380caa14e05509f46993aa8b8da966b09b0b5 | src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Memoize.py | python | Dump | (title=None) | Dump the hit/miss count for all the counters
collected so far. | Dump the hit/miss count for all the counters
collected so far. | [
"Dump",
"the",
"hit",
"/",
"miss",
"count",
"for",
"all",
"the",
"counters",
"collected",
"so",
"far",
"."
] | def Dump(title=None):
""" Dump the hit/miss count for all the counters
collected so far.
"""
if title:
print title
for counter in sorted(CounterList):
CounterList[counter].display() | [
"def",
"Dump",
"(",
"title",
"=",
"None",
")",
":",
"if",
"title",
":",
"print",
"title",
"for",
"counter",
"in",
"sorted",
"(",
"CounterList",
")",
":",
"CounterList",
"[",
"counter",
"]",
".",
"display",
"(",
")"
] | https://github.com/Tencent/CMONGO/blob/c40380caa14e05509f46993aa8b8da966b09b0b5/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Memoize.py#L183-L190 | ||
deepmind/open_spiel | 4ca53bea32bb2875c7385d215424048ae92f78c8 | open_spiel/python/algorithms/adidas_utils/solvers/nonsymmetric/regmatch.py | python | Solver.update | (self, params, grads, t) | return new_params | Update cumulative regret and strategy (dist).
Args:
params: tuple of variables to be updated (dist, regret)
grads: tuple of variable gradients (grad_dist, grad_regret)
t: int, solver iteration (not used)
Returns:
new_params: tuple of update params (new_dist, new_regret) | Update cumulative regret and strategy (dist). | [
"Update",
"cumulative",
"regret",
"and",
"strategy",
"(",
"dist",
")",
"."
] | def update(self, params, grads, t):
"""Update cumulative regret and strategy (dist).
Args:
params: tuple of variables to be updated (dist, regret)
grads: tuple of variable gradients (grad_dist, grad_regret)
t: int, solver iteration (not used)
Returns:
new_params: tuple of update par... | [
"def",
"update",
"(",
"self",
",",
"params",
",",
"grads",
",",
"t",
")",
":",
"dist",
",",
"regret",
"=",
"params",
"regret_delta",
"=",
"grads",
"[",
"1",
"]",
"if",
"self",
".",
"discount",
":",
"gamma",
"=",
"t",
"/",
"float",
"(",
"t",
"+",
... | https://github.com/deepmind/open_spiel/blob/4ca53bea32bb2875c7385d215424048ae92f78c8/open_spiel/python/algorithms/adidas_utils/solvers/nonsymmetric/regmatch.py#L93-L124 | |
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/python/turicreate/data_structures/gframe.py | python | GFrame.num_rows | (self) | Returns the number of rows.
Returns
-------
out : int
Number of rows in the SFrame. | Returns the number of rows. | [
"Returns",
"the",
"number",
"of",
"rows",
"."
] | def num_rows(self):
"""
Returns the number of rows.
Returns
-------
out : int
Number of rows in the SFrame.
"""
if self._is_vertex_frame():
return self.__graph__.summary()["num_vertices"]
elif self._is_edge_frame():
ret... | [
"def",
"num_rows",
"(",
"self",
")",
":",
"if",
"self",
".",
"_is_vertex_frame",
"(",
")",
":",
"return",
"self",
".",
"__graph__",
".",
"summary",
"(",
")",
"[",
"\"num_vertices\"",
"]",
"elif",
"self",
".",
"_is_edge_frame",
"(",
")",
":",
"return",
... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/python/turicreate/data_structures/gframe.py#L349-L361 | ||
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/decimal.py | python | Context.compare | (self, a, b) | return a.compare(b, context=self) | Compares values numerically.
If the signs of the operands differ, a value representing each operand
('-1' if the operand is less than zero, '0' if the operand is zero or
negative zero, or '1' if the operand is greater than zero) is used in
place of that operand for the comparison instea... | Compares values numerically. | [
"Compares",
"values",
"numerically",
"."
] | def compare(self, a, b):
"""Compares values numerically.
If the signs of the operands differ, a value representing each operand
('-1' if the operand is less than zero, '0' if the operand is zero or
negative zero, or '1' if the operand is greater than zero) is used in
place of th... | [
"def",
"compare",
"(",
"self",
",",
"a",
",",
"b",
")",
":",
"a",
"=",
"_convert_other",
"(",
"a",
",",
"raiseit",
"=",
"True",
")",
"return",
"a",
".",
"compare",
"(",
"b",
",",
"context",
"=",
"self",
")"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/decimal.py#L4013-L4047 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_windows.py | python | PageSetupDialogData.__init__ | (self, *args) | __init__(self) -> PageSetupDialogData
__init__(self, PageSetupDialogData data) -> PageSetupDialogData
__init__(self, PrintData data) -> PageSetupDialogData | __init__(self) -> PageSetupDialogData
__init__(self, PageSetupDialogData data) -> PageSetupDialogData
__init__(self, PrintData data) -> PageSetupDialogData | [
"__init__",
"(",
"self",
")",
"-",
">",
"PageSetupDialogData",
"__init__",
"(",
"self",
"PageSetupDialogData",
"data",
")",
"-",
">",
"PageSetupDialogData",
"__init__",
"(",
"self",
"PrintData",
"data",
")",
"-",
">",
"PageSetupDialogData"
] | def __init__(self, *args):
"""
__init__(self) -> PageSetupDialogData
__init__(self, PageSetupDialogData data) -> PageSetupDialogData
__init__(self, PrintData data) -> PageSetupDialogData
"""
_windows_.PageSetupDialogData_swiginit(self,_windows_.new_PageSetupDialogData(*a... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
")",
":",
"_windows_",
".",
"PageSetupDialogData_swiginit",
"(",
"self",
",",
"_windows_",
".",
"new_PageSetupDialogData",
"(",
"*",
"args",
")",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_windows.py#L4865-L4871 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | scripts/Calibration/Examples/TubeCalibDemoWish_Simple.py | python | CalibrateWish | (RunNumber, PanelNumber) | :param RunNumber: is the run number of the calibration.
:param PanelNumber: is a string of two-digit number of the panel being calibrated | :param RunNumber: is the run number of the calibration.
:param PanelNumber: is a string of two-digit number of the panel being calibrated | [
":",
"param",
"RunNumber",
":",
"is",
"the",
"run",
"number",
"of",
"the",
"calibration",
".",
":",
"param",
"PanelNumber",
":",
"is",
"a",
"string",
"of",
"two",
"-",
"digit",
"number",
"of",
"the",
"panel",
"being",
"calibrated"
] | def CalibrateWish(RunNumber, PanelNumber):
'''
:param RunNumber: is the run number of the calibration.
:param PanelNumber: is a string of two-digit number of the panel being calibrated
'''
# == Set parameters for calibration ==
previousDefaultInstrument = mantid.config['default.instrument']
... | [
"def",
"CalibrateWish",
"(",
"RunNumber",
",",
"PanelNumber",
")",
":",
"# == Set parameters for calibration ==",
"previousDefaultInstrument",
"=",
"mantid",
".",
"config",
"[",
"'default.instrument'",
"]",
"mantid",
".",
"config",
"[",
"'default.instrument'",
"]",
"=",... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/Calibration/Examples/TubeCalibDemoWish_Simple.py#L19-L73 | ||
microsoft/DirectX-Graphics-Samples | 316de71537a460f9b90a51b145d9fb9d67f5e7b8 | MiniEngine/Tools/Scripts/CreateNewProject.py | python | copy_app_template | (project, guid) | Instantiates a new solution from a template | Instantiates a new solution from a template | [
"Instantiates",
"a",
"new",
"solution",
"from",
"a",
"template"
] | def copy_app_template(project, guid):
'''Instantiates a new solution from a template'''
shutil.copy(os.path.join(TEMPLATES_FOLDER, 'packages.config'), project)
shutil.copy(os.path.join(TEMPLATES_FOLDER, 'pch.h'), project)
shutil.copy(os.path.join(TEMPLATES_FOLDER, 'pch.cpp'), project)
copy_template_... | [
"def",
"copy_app_template",
"(",
"project",
",",
"guid",
")",
":",
"shutil",
".",
"copy",
"(",
"os",
".",
"path",
".",
"join",
"(",
"TEMPLATES_FOLDER",
",",
"'packages.config'",
")",
",",
"project",
")",
"shutil",
".",
"copy",
"(",
"os",
".",
"path",
"... | https://github.com/microsoft/DirectX-Graphics-Samples/blob/316de71537a460f9b90a51b145d9fb9d67f5e7b8/MiniEngine/Tools/Scripts/CreateNewProject.py#L35-L45 | ||
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Draft/draftviewproviders/view_label.py | python | ViewProviderLabel.set_text_properties | (self, vobj, properties) | Set text properties only if they don't already exist. | Set text properties only if they don't already exist. | [
"Set",
"text",
"properties",
"only",
"if",
"they",
"don",
"t",
"already",
"exist",
"."
] | def set_text_properties(self, vobj, properties):
"""Set text properties only if they don't already exist."""
if "TextSize" not in properties:
_tip = QT_TRANSLATE_NOOP("App::Property",
"The size of the text")
vobj.addProperty("App::PropertyLeng... | [
"def",
"set_text_properties",
"(",
"self",
",",
"vobj",
",",
"properties",
")",
":",
"if",
"\"TextSize\"",
"not",
"in",
"properties",
":",
"_tip",
"=",
"QT_TRANSLATE_NOOP",
"(",
"\"App::Property\"",
",",
"\"The size of the text\"",
")",
"vobj",
".",
"addProperty",... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Draft/draftviewproviders/view_label.py#L69-L132 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/dtypes/missing.py | python | isna | (obj) | return _isna(obj) | Detect missing values for an array-like object.
This function takes a scalar or array-like object and indicates
whether values are missing (``NaN`` in numeric arrays, ``None`` or ``NaN``
in object arrays, ``NaT`` in datetimelike).
Parameters
----------
obj : scalar or array-like
Object... | Detect missing values for an array-like object. | [
"Detect",
"missing",
"values",
"for",
"an",
"array",
"-",
"like",
"object",
"."
] | def isna(obj):
"""
Detect missing values for an array-like object.
This function takes a scalar or array-like object and indicates
whether values are missing (``NaN`` in numeric arrays, ``None`` or ``NaN``
in object arrays, ``NaT`` in datetimelike).
Parameters
----------
obj : scalar o... | [
"def",
"isna",
"(",
"obj",
")",
":",
"return",
"_isna",
"(",
"obj",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/dtypes/missing.py#L49-L126 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/fitting_widgets/tf_asymmetry_fitting/tf_asymmetry_fitting_model.py | python | TFAsymmetryFittingModel.tf_asymmetry_single_functions | (self) | return self.fitting_context.tf_asymmetry_single_functions | Returns the fit functions used for single TF Asymmetry fitting. Each function corresponds to a dataset. | Returns the fit functions used for single TF Asymmetry fitting. Each function corresponds to a dataset. | [
"Returns",
"the",
"fit",
"functions",
"used",
"for",
"single",
"TF",
"Asymmetry",
"fitting",
".",
"Each",
"function",
"corresponds",
"to",
"a",
"dataset",
"."
] | def tf_asymmetry_single_functions(self) -> list:
"""Returns the fit functions used for single TF Asymmetry fitting. Each function corresponds to a dataset."""
return self.fitting_context.tf_asymmetry_single_functions | [
"def",
"tf_asymmetry_single_functions",
"(",
"self",
")",
"->",
"list",
":",
"return",
"self",
".",
"fitting_context",
".",
"tf_asymmetry_single_functions"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/fitting_widgets/tf_asymmetry_fitting/tf_asymmetry_fitting_model.py#L55-L57 | |
arangodb/arangodb | 0d658689c7d1b721b314fa3ca27d38303e1570c8 | 3rdParty/boost/1.78.0/libs/metaparse/tools/benchmark/generate.py | python | out_filename | (template, n_val, mode) | return '{0}_{1}_{2}.cpp'.format(template.name, n_val, mode.identifier) | Determine the output filename | Determine the output filename | [
"Determine",
"the",
"output",
"filename"
] | def out_filename(template, n_val, mode):
"""Determine the output filename"""
return '{0}_{1}_{2}.cpp'.format(template.name, n_val, mode.identifier) | [
"def",
"out_filename",
"(",
"template",
",",
"n_val",
",",
"mode",
")",
":",
"return",
"'{0}_{1}_{2}.cpp'",
".",
"format",
"(",
"template",
".",
"name",
",",
"n_val",
",",
"mode",
".",
"identifier",
")"
] | https://github.com/arangodb/arangodb/blob/0d658689c7d1b721b314fa3ca27d38303e1570c8/3rdParty/boost/1.78.0/libs/metaparse/tools/benchmark/generate.py#L233-L235 | |
vicaya/hypertable | e7386f799c238c109ae47973417c2a2c7f750825 | src/py/ThriftClient/gen-py/hyperthrift/gen/ClientService.py | python | Client.close_scanner | (self, scanner) | Close a table scanner
@param scanner - scanner id to close
Parameters:
- scanner | Close a table scanner | [
"Close",
"a",
"table",
"scanner"
] | def close_scanner(self, scanner):
"""
Close a table scanner
@param scanner - scanner id to close
Parameters:
- scanner
"""
self.send_close_scanner(scanner)
self.recv_close_scanner() | [
"def",
"close_scanner",
"(",
"self",
",",
"scanner",
")",
":",
"self",
".",
"send_close_scanner",
"(",
"scanner",
")",
"self",
".",
"recv_close_scanner",
"(",
")"
] | https://github.com/vicaya/hypertable/blob/e7386f799c238c109ae47973417c2a2c7f750825/src/py/ThriftClient/gen-py/hyperthrift/gen/ClientService.py#L408-L418 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_windows.py | python | VarVScrollHelper.RefreshRow | (*args, **kwargs) | return _windows_.VarVScrollHelper_RefreshRow(*args, **kwargs) | RefreshRow(self, size_t row) | RefreshRow(self, size_t row) | [
"RefreshRow",
"(",
"self",
"size_t",
"row",
")"
] | def RefreshRow(*args, **kwargs):
"""RefreshRow(self, size_t row)"""
return _windows_.VarVScrollHelper_RefreshRow(*args, **kwargs) | [
"def",
"RefreshRow",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"VarVScrollHelper_RefreshRow",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_windows.py#L2289-L2291 | |
OSGeo/gdal | 3748fc4ba4fba727492774b2b908a2130c864a83 | swig/python/gdal-utils/osgeo_utils/gdal2tiles.py | python | GlobalMercator.MetersToLatLon | (self, mx, my) | return lat, lon | Converts XY point from Spherical Mercator EPSG:3857 to lat/lon in WGS84 Datum | Converts XY point from Spherical Mercator EPSG:3857 to lat/lon in WGS84 Datum | [
"Converts",
"XY",
"point",
"from",
"Spherical",
"Mercator",
"EPSG",
":",
"3857",
"to",
"lat",
"/",
"lon",
"in",
"WGS84",
"Datum"
] | def MetersToLatLon(self, mx, my):
"Converts XY point from Spherical Mercator EPSG:3857 to lat/lon in WGS84 Datum"
lon = (mx / self.originShift) * 180.0
lat = (my / self.originShift) * 180.0
lat = 180 / math.pi * (2 * math.atan(math.exp(lat * math.pi / 180.0)) - math.pi / 2.0)
r... | [
"def",
"MetersToLatLon",
"(",
"self",
",",
"mx",
",",
"my",
")",
":",
"lon",
"=",
"(",
"mx",
"/",
"self",
".",
"originShift",
")",
"*",
"180.0",
"lat",
"=",
"(",
"my",
"/",
"self",
".",
"originShift",
")",
"*",
"180.0",
"lat",
"=",
"180",
"/",
... | https://github.com/OSGeo/gdal/blob/3748fc4ba4fba727492774b2b908a2130c864a83/swig/python/gdal-utils/osgeo_utils/gdal2tiles.py#L363-L370 | |
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Path/PathScripts/PathProbeGui.py | python | TaskPanelOpPage.getForm | (self) | return FreeCADGui.PySideUic.loadUi(":/panels/PageOpProbeEdit.ui") | getForm() ... returns UI | getForm() ... returns UI | [
"getForm",
"()",
"...",
"returns",
"UI"
] | def getForm(self):
"""getForm() ... returns UI"""
return FreeCADGui.PySideUic.loadUi(":/panels/PageOpProbeEdit.ui") | [
"def",
"getForm",
"(",
"self",
")",
":",
"return",
"FreeCADGui",
".",
"PySideUic",
".",
"loadUi",
"(",
"\":/panels/PageOpProbeEdit.ui\"",
")"
] | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Path/PathScripts/PathProbeGui.py#L52-L54 | |
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/media/webrtc/trunk/tools/gyp/pylib/gyp/__init__.py | python | RegeneratableOptionParser.add_option | (self, *args, **kw) | Add an option to the parser.
This accepts the same arguments as OptionParser.add_option, plus the
following:
regenerate: can be set to False to prevent this option from being included
in regeneration.
env_name: name of environment variable that additional values for this
... | Add an option to the parser. | [
"Add",
"an",
"option",
"to",
"the",
"parser",
"."
] | def add_option(self, *args, **kw):
"""Add an option to the parser.
This accepts the same arguments as OptionParser.add_option, plus the
following:
regenerate: can be set to False to prevent this option from being included
in regeneration.
env_name: name of environment variable... | [
"def",
"add_option",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kw",
")",
":",
"env_name",
"=",
"kw",
".",
"pop",
"(",
"'env_name'",
",",
"None",
")",
"if",
"'dest'",
"in",
"kw",
"and",
"kw",
".",
"pop",
"(",
"'regenerate'",
",",
"True",
")",... | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/media/webrtc/trunk/tools/gyp/pylib/gyp/__init__.py#L245-L274 | ||
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/contrib/distributions/python/ops/dirichlet_multinomial.py | python | DirichletMultinomial.name | (self) | return self._name | Name to prepend to all ops. | Name to prepend to all ops. | [
"Name",
"to",
"prepend",
"to",
"all",
"ops",
"."
] | def name(self):
"""Name to prepend to all ops."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/contrib/distributions/python/ops/dirichlet_multinomial.py#L191-L193 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/botocore/loaders.py | python | Loader.list_api_versions | (self, service_name, type_name) | return sorted(known_api_versions) | List all API versions available for a particular service type
:type service_name: str
:param service_name: The name of the service
:type type_name: str
:param type_name: The type name for the service (i.e service-2,
paginators-1, etc.)
:rtype: list
:return:... | List all API versions available for a particular service type | [
"List",
"all",
"API",
"versions",
"available",
"for",
"a",
"particular",
"service",
"type"
] | def list_api_versions(self, service_name, type_name):
"""List all API versions available for a particular service type
:type service_name: str
:param service_name: The name of the service
:type type_name: str
:param type_name: The type name for the service (i.e service-2,
... | [
"def",
"list_api_versions",
"(",
"self",
",",
"service_name",
",",
"type_name",
")",
":",
"known_api_versions",
"=",
"set",
"(",
")",
"for",
"possible_path",
"in",
"self",
".",
"_potential_locations",
"(",
"service_name",
",",
"must_exist",
"=",
"True",
",",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/botocore/loaders.py#L313-L340 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/setuptools/msvc.py | python | _msvc14_find_vc2015 | () | return best_version, best_dir | Python 3.8 "distutils/_msvccompiler.py" backport | Python 3.8 "distutils/_msvccompiler.py" backport | [
"Python",
"3",
".",
"8",
"distutils",
"/",
"_msvccompiler",
".",
"py",
"backport"
] | def _msvc14_find_vc2015():
"""Python 3.8 "distutils/_msvccompiler.py" backport"""
try:
key = winreg.OpenKey(
winreg.HKEY_LOCAL_MACHINE,
r"Software\Microsoft\VisualStudio\SxS\VC7",
0,
winreg.KEY_READ | winreg.KEY_WOW64_32KEY
)
except OSError:
... | [
"def",
"_msvc14_find_vc2015",
"(",
")",
":",
"try",
":",
"key",
"=",
"winreg",
".",
"OpenKey",
"(",
"winreg",
".",
"HKEY_LOCAL_MACHINE",
",",
"r\"Software\\Microsoft\\VisualStudio\\SxS\\VC7\"",
",",
"0",
",",
"winreg",
".",
"KEY_READ",
"|",
"winreg",
".",
"KEY_W... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/setuptools/msvc.py#L146-L173 | |
tensorflow/minigo | 6d89c202cdceaf449aefc3149ab2110d44f1a6a4 | oneoffs/joseki/opening_freqs_export.py | python | create_hourly_reports | (hour_directory) | Creates an html page showing the most common sequences for the given hour. | Creates an html page showing the most common sequences for the given hour. | [
"Creates",
"an",
"html",
"page",
"showing",
"the",
"most",
"common",
"sequences",
"for",
"the",
"given",
"hour",
"."
] | def create_hourly_reports(hour_directory):
"""
Creates an html page showing the most common sequences for the given hour.
"""
hr = os.path.basename(hour_directory.rstrip('/'))
db = sqlite3.connect(FLAGS.db_path)
cur = db.execute('''
select seq, sum(count) from joseki_counts... | [
"def",
"create_hourly_reports",
"(",
"hour_directory",
")",
":",
"hr",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"hour_directory",
".",
"rstrip",
"(",
"'/'",
")",
")",
"db",
"=",
"sqlite3",
".",
"connect",
"(",
"FLAGS",
".",
"db_path",
")",
"cur",
... | https://github.com/tensorflow/minigo/blob/6d89c202cdceaf449aefc3149ab2110d44f1a6a4/oneoffs/joseki/opening_freqs_export.py#L176-L190 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/richtext.py | python | RichTextLine.GetParent | (*args, **kwargs) | return _richtext.RichTextLine_GetParent(*args, **kwargs) | GetParent(self) -> RichTextParagraph | GetParent(self) -> RichTextParagraph | [
"GetParent",
"(",
"self",
")",
"-",
">",
"RichTextParagraph"
] | def GetParent(*args, **kwargs):
"""GetParent(self) -> RichTextParagraph"""
return _richtext.RichTextLine_GetParent(*args, **kwargs) | [
"def",
"GetParent",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"RichTextLine_GetParent",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/richtext.py#L1907-L1909 | |
anestisb/oatdump_plus | ba858c1596598f0d9ae79c14d08c708cecc50af3 | tools/cpplint.py | python | GetLineWidth | (line) | Determines the width of the line in column positions.
Args:
line: A string, which may be a Unicode string.
Returns:
The width of the line in column positions, accounting for Unicode
combining characters and wide characters. | Determines the width of the line in column positions. | [
"Determines",
"the",
"width",
"of",
"the",
"line",
"in",
"column",
"positions",
"."
] | def GetLineWidth(line):
"""Determines the width of the line in column positions.
Args:
line: A string, which may be a Unicode string.
Returns:
The width of the line in column positions, accounting for Unicode
combining characters and wide characters.
"""
if isinstance(line, unicode):
width =... | [
"def",
"GetLineWidth",
"(",
"line",
")",
":",
"if",
"isinstance",
"(",
"line",
",",
"unicode",
")",
":",
"width",
"=",
"0",
"for",
"uc",
"in",
"unicodedata",
".",
"normalize",
"(",
"'NFC'",
",",
"line",
")",
":",
"if",
"unicodedata",
".",
"east_asian_w... | https://github.com/anestisb/oatdump_plus/blob/ba858c1596598f0d9ae79c14d08c708cecc50af3/tools/cpplint.py#L2806-L2825 | ||
google/syzygy | 8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5 | third_party/numpy/files/numpy/lib/type_check.py | python | common_type | (*arrays) | Return a scalar type which is common to the input arrays.
The return type will always be an inexact (i.e. floating point) scalar
type, even if all the arrays are integer arrays. If one of the inputs is
an integer array, the minimum precision type that is returned is a
64-bit floating point dtype.
... | Return a scalar type which is common to the input arrays. | [
"Return",
"a",
"scalar",
"type",
"which",
"is",
"common",
"to",
"the",
"input",
"arrays",
"."
] | def common_type(*arrays):
"""
Return a scalar type which is common to the input arrays.
The return type will always be an inexact (i.e. floating point) scalar
type, even if all the arrays are integer arrays. If one of the inputs is
an integer array, the minimum precision type that is returned is a
... | [
"def",
"common_type",
"(",
"*",
"arrays",
")",
":",
"is_complex",
"=",
"False",
"precision",
"=",
"0",
"for",
"a",
"in",
"arrays",
":",
"t",
"=",
"a",
".",
"dtype",
".",
"type",
"if",
"iscomplexobj",
"(",
"a",
")",
":",
"is_complex",
"=",
"True",
"... | https://github.com/google/syzygy/blob/8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5/third_party/numpy/files/numpy/lib/type_check.py#L550-L602 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/ctypes/__init__.py | python | CFUNCTYPE | (restype, *argtypes, **kw) | CFUNCTYPE(restype, *argtypes,
use_errno=False, use_last_error=False) -> function prototype.
restype: the result type
argtypes: a sequence specifying the argument types
The function prototype can be called in different ways to create a
callable object:
prototype(integer address) -... | CFUNCTYPE(restype, *argtypes,
use_errno=False, use_last_error=False) -> function prototype. | [
"CFUNCTYPE",
"(",
"restype",
"*",
"argtypes",
"use_errno",
"=",
"False",
"use_last_error",
"=",
"False",
")",
"-",
">",
"function",
"prototype",
"."
] | def CFUNCTYPE(restype, *argtypes, **kw):
"""CFUNCTYPE(restype, *argtypes,
use_errno=False, use_last_error=False) -> function prototype.
restype: the result type
argtypes: a sequence specifying the argument types
The function prototype can be called in different ways to create a
ca... | [
"def",
"CFUNCTYPE",
"(",
"restype",
",",
"*",
"argtypes",
",",
"*",
"*",
"kw",
")",
":",
"flags",
"=",
"_FUNCFLAG_CDECL",
"if",
"kw",
".",
"pop",
"(",
"\"use_errno\"",
",",
"False",
")",
":",
"flags",
"|=",
"_FUNCFLAG_USE_ERRNO",
"if",
"kw",
".",
"pop"... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/ctypes/__init__.py#L78-L109 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py2/numpy/ma/core.py | python | inner | (a, b) | return np.inner(fa, fb).view(MaskedArray) | Returns the inner product of a and b for arrays of floating point types.
Like the generic NumPy equivalent the product sum is over the last dimension
of a and b. The first argument is not conjugated. | Returns the inner product of a and b for arrays of floating point types. | [
"Returns",
"the",
"inner",
"product",
"of",
"a",
"and",
"b",
"for",
"arrays",
"of",
"floating",
"point",
"types",
"."
] | def inner(a, b):
"""
Returns the inner product of a and b for arrays of floating point types.
Like the generic NumPy equivalent the product sum is over the last dimension
of a and b. The first argument is not conjugated.
"""
fa = filled(a, 0)
fb = filled(b, 0)
if fa.ndim == 0:
... | [
"def",
"inner",
"(",
"a",
",",
"b",
")",
":",
"fa",
"=",
"filled",
"(",
"a",
",",
"0",
")",
"fb",
"=",
"filled",
"(",
"b",
",",
"0",
")",
"if",
"fa",
".",
"ndim",
"==",
"0",
":",
"fa",
".",
"shape",
"=",
"(",
"1",
",",
")",
"if",
"fb",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py2/numpy/ma/core.py#L7450-L7464 | |
bareos/bareos | 56a10bb368b0a81e977bb51304033fe49d59efb0 | core/src/plugins/filed/python/libcloud/bareos-fd-libcloud.py | python | load_bareos_plugin | (plugindef) | return bRC_OK | This function is called by the Bareos-FD to load the plugin
We use it to instantiate the plugin class | This function is called by the Bareos-FD to load the plugin
We use it to instantiate the plugin class | [
"This",
"function",
"is",
"called",
"by",
"the",
"Bareos",
"-",
"FD",
"to",
"load",
"the",
"plugin",
"We",
"use",
"it",
"to",
"instantiate",
"the",
"plugin",
"class"
] | def load_bareos_plugin(plugindef):
"""
This function is called by the Bareos-FD to load the plugin
We use it to instantiate the plugin class
"""
# BareosFdWrapper.bareos_fd_plugin_object is the module attribute that
# holds the plugin class object
BareosFdWrapper.bareos_fd_plugin_object = (
... | [
"def",
"load_bareos_plugin",
"(",
"plugindef",
")",
":",
"# BareosFdWrapper.bareos_fd_plugin_object is the module attribute that",
"# holds the plugin class object",
"BareosFdWrapper",
".",
"bareos_fd_plugin_object",
"=",
"(",
"BareosFdPluginLibcloud",
".",
"BareosFdPluginLibcloud",
... | https://github.com/bareos/bareos/blob/56a10bb368b0a81e977bb51304033fe49d59efb0/core/src/plugins/filed/python/libcloud/bareos-fd-libcloud.py#L36-L46 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/dataclasses.py | python | make_dataclass | (cls_name, fields, *, bases=(), namespace=None, init=True,
repr=True, eq=True, order=False, unsafe_hash=False,
frozen=False) | return dataclass(cls, init=init, repr=repr, eq=eq, order=order,
unsafe_hash=unsafe_hash, frozen=frozen) | Return a new dynamically created dataclass.
The dataclass name will be 'cls_name'. 'fields' is an iterable
of either (name), (name, type) or (name, type, Field) objects. If type is
omitted, use the string 'typing.Any'. Field objects are created by
the equivalent of calling 'field(name, type [, Field-... | Return a new dynamically created dataclass. | [
"Return",
"a",
"new",
"dynamically",
"created",
"dataclass",
"."
] | def make_dataclass(cls_name, fields, *, bases=(), namespace=None, init=True,
repr=True, eq=True, order=False, unsafe_hash=False,
frozen=False):
"""Return a new dynamically created dataclass.
The dataclass name will be 'cls_name'. 'fields' is an iterable
of either (nam... | [
"def",
"make_dataclass",
"(",
"cls_name",
",",
"fields",
",",
"*",
",",
"bases",
"=",
"(",
")",
",",
"namespace",
"=",
"None",
",",
"init",
"=",
"True",
",",
"repr",
"=",
"True",
",",
"eq",
"=",
"True",
",",
"order",
"=",
"False",
",",
"unsafe_hash... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/dataclasses.py#L1159-L1222 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.