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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
tum-vision/fusenet | a1451be2971b348a01b0f525c2a3a7a0e215a591 | scripts/cpp_lint.py | python | GetHeaderGuardCPPVariable | (filename) | return re.sub(r'[-./\s]', '_', file_path_from_root).upper() + '_' | Returns the CPP variable that should be used as a header guard.
Args:
filename: The name of a C++ header file.
Returns:
The CPP variable that should be used as a header guard in the
named file. | Returns the CPP variable that should be used as a header guard. | [
"Returns",
"the",
"CPP",
"variable",
"that",
"should",
"be",
"used",
"as",
"a",
"header",
"guard",
"."
] | def GetHeaderGuardCPPVariable(filename):
"""Returns the CPP variable that should be used as a header guard.
Args:
filename: The name of a C++ header file.
Returns:
The CPP variable that should be used as a header guard in the
named file.
"""
# Restores original filename in case that cpplint is... | [
"def",
"GetHeaderGuardCPPVariable",
"(",
"filename",
")",
":",
"# Restores original filename in case that cpplint is invoked from Emacs's",
"# flymake.",
"filename",
"=",
"re",
".",
"sub",
"(",
"r'_flymake\\.h$'",
",",
"'.h'",
",",
"filename",
")",
"filename",
"=",
"re",
... | https://github.com/tum-vision/fusenet/blob/a1451be2971b348a01b0f525c2a3a7a0e215a591/scripts/cpp_lint.py#L1384-L1405 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/propgrid.py | python | PGProperty.GetGrid | (*args, **kwargs) | return _propgrid.PGProperty_GetGrid(*args, **kwargs) | GetGrid(self) -> PropertyGrid | GetGrid(self) -> PropertyGrid | [
"GetGrid",
"(",
"self",
")",
"-",
">",
"PropertyGrid"
] | def GetGrid(*args, **kwargs):
"""GetGrid(self) -> PropertyGrid"""
return _propgrid.PGProperty_GetGrid(*args, **kwargs) | [
"def",
"GetGrid",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_propgrid",
".",
"PGProperty_GetGrid",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/propgrid.py#L516-L518 | |
microsoft/ELL | a1d6bacc37a14879cc025d9be2ba40b1a0632315 | tools/importers/common/converters.py | python | ConvertPassthrough.convert | (self, conversion_parameters: typing.Mapping[str, typing.Any]) | return None | Return nothing | Return nothing | [
"Return",
"nothing"
] | def convert(self, conversion_parameters: typing.Mapping[str, typing.Any]):
"""
Return nothing
"""
return None | [
"def",
"convert",
"(",
"self",
",",
"conversion_parameters",
":",
"typing",
".",
"Mapping",
"[",
"str",
",",
"typing",
".",
"Any",
"]",
")",
":",
"return",
"None"
] | https://github.com/microsoft/ELL/blob/a1d6bacc37a14879cc025d9be2ba40b1a0632315/tools/importers/common/converters.py#L1278-L1282 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py3/scipy/stats/mstats_basic.py | python | mode | (a, axis=0) | return ModeResult(*output) | Returns an array of the modal (most common) value in the passed array.
Parameters
----------
a : array_like
n-dimensional array of which to find mode(s).
axis : int or None, optional
Axis along which to operate. Default is 0. If None, compute over
the whole array `a`.
Retur... | Returns an array of the modal (most common) value in the passed array. | [
"Returns",
"an",
"array",
"of",
"the",
"modal",
"(",
"most",
"common",
")",
"value",
"in",
"the",
"passed",
"array",
"."
] | def mode(a, axis=0):
"""
Returns an array of the modal (most common) value in the passed array.
Parameters
----------
a : array_like
n-dimensional array of which to find mode(s).
axis : int or None, optional
Axis along which to operate. Default is 0. If None, compute over
... | [
"def",
"mode",
"(",
"a",
",",
"axis",
"=",
"0",
")",
":",
"a",
",",
"axis",
"=",
"_chk_asarray",
"(",
"a",
",",
"axis",
")",
"def",
"_mode1D",
"(",
"a",
")",
":",
"(",
"rep",
",",
"cnt",
")",
"=",
"find_repeats",
"(",
"a",
")",
"if",
"not",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py3/scipy/stats/mstats_basic.py#L274-L333 | |
omnisci/omniscidb | b9c95f1bd602b4ffc8b0edf18bfad61031e08d86 | python/omnisci/thrift/OmniSci.py | python | Client.load_table_binary_columnar | (self, session, table_name, cols, column_names) | Parameters:
- session
- table_name
- cols
- column_names | Parameters:
- session
- table_name
- cols
- column_names | [
"Parameters",
":",
"-",
"session",
"-",
"table_name",
"-",
"cols",
"-",
"column_names"
] | def load_table_binary_columnar(self, session, table_name, cols, column_names):
"""
Parameters:
- session
- table_name
- cols
- column_names
"""
self.send_load_table_binary_columnar(session, table_name, cols, column_names)
self.recv_load_table_... | [
"def",
"load_table_binary_columnar",
"(",
"self",
",",
"session",
",",
"table_name",
",",
"cols",
",",
"column_names",
")",
":",
"self",
".",
"send_load_table_binary_columnar",
"(",
"session",
",",
"table_name",
",",
"cols",
",",
"column_names",
")",
"self",
"."... | https://github.com/omnisci/omniscidb/blob/b9c95f1bd602b4ffc8b0edf18bfad61031e08d86/python/omnisci/thrift/OmniSci.py#L3235-L3245 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/propgrid.py | python | PropertyGrid.DoHidePropertyError | (*args, **kwargs) | return _propgrid.PropertyGrid_DoHidePropertyError(*args, **kwargs) | DoHidePropertyError(self, PGProperty property) | DoHidePropertyError(self, PGProperty property) | [
"DoHidePropertyError",
"(",
"self",
"PGProperty",
"property",
")"
] | def DoHidePropertyError(*args, **kwargs):
"""DoHidePropertyError(self, PGProperty property)"""
return _propgrid.PropertyGrid_DoHidePropertyError(*args, **kwargs) | [
"def",
"DoHidePropertyError",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_propgrid",
".",
"PropertyGrid_DoHidePropertyError",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/propgrid.py#L2435-L2437 | |
rdkit/rdkit | ede860ae316d12d8568daf5ee800921c3389c84e | rdkit/Chem/AtomPairs/Utils.py | python | DiceSimilarity | (v1, v2, bounds=None) | return res | Implements the DICE similarity metric.
This is the recommended metric in both the Topological torsions
and Atom pairs papers.
**Arguments**:
- two vectors (sequences of bit ids)
**Returns**: a float.
**Notes**
- the vectors must be sorted
>>> DiceSimilarity( (1,2,3), (1,2,3)... | Implements the DICE similarity metric.
This is the recommended metric in both the Topological torsions
and Atom pairs papers. | [
"Implements",
"the",
"DICE",
"similarity",
"metric",
".",
"This",
"is",
"the",
"recommended",
"metric",
"in",
"both",
"the",
"Topological",
"torsions",
"and",
"Atom",
"pairs",
"papers",
"."
] | def DiceSimilarity(v1, v2, bounds=None):
""" Implements the DICE similarity metric.
This is the recommended metric in both the Topological torsions
and Atom pairs papers.
**Arguments**:
- two vectors (sequences of bit ids)
**Returns**: a float.
**Notes**
- the vectors must be ... | [
"def",
"DiceSimilarity",
"(",
"v1",
",",
"v2",
",",
"bounds",
"=",
"None",
")",
":",
"denom",
"=",
"1.0",
"*",
"(",
"len",
"(",
"v1",
")",
"+",
"len",
"(",
"v2",
")",
")",
"if",
"not",
"denom",
":",
"res",
"=",
"0.0",
"else",
":",
"if",
"boun... | https://github.com/rdkit/rdkit/blob/ede860ae316d12d8568daf5ee800921c3389c84e/rdkit/Chem/AtomPairs/Utils.py#L199-L260 | |
SFTtech/openage | d6a08c53c48dc1e157807471df92197f6ca9e04d | openage/convert/value_object/read/media/datfile/unit.py | python | LivingUnit.get_data_format_members | (cls, game_version) | return data_format | Return the members in this struct. | Return the members in this struct. | [
"Return",
"the",
"members",
"in",
"this",
"struct",
"."
] | def get_data_format_members(cls, game_version):
"""
Return the members in this struct.
"""
data_format = [
(READ_GEN, None, None, IncludeMembers(cls=ProjectileUnit)),
(READ_GEN, "resource_cost", StorageType.ARRAY_CONTAINER, SubdataMember(
ref_type=... | [
"def",
"get_data_format_members",
"(",
"cls",
",",
"game_version",
")",
":",
"data_format",
"=",
"[",
"(",
"READ_GEN",
",",
"None",
",",
"None",
",",
"IncludeMembers",
"(",
"cls",
"=",
"ProjectileUnit",
")",
")",
",",
"(",
"READ_GEN",
",",
"\"resource_cost\"... | https://github.com/SFTtech/openage/blob/d6a08c53c48dc1e157807471df92197f6ca9e04d/openage/convert/value_object/read/media/datfile/unit.py#L791-L892 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_core.py | python | Point.SetDefaults | (*args, **kwargs) | return _core_.Point_SetDefaults(*args, **kwargs) | SetDefaults(self, Point pt) | SetDefaults(self, Point pt) | [
"SetDefaults",
"(",
"self",
"Point",
"pt",
")"
] | def SetDefaults(*args, **kwargs):
"""SetDefaults(self, Point pt)"""
return _core_.Point_SetDefaults(*args, **kwargs) | [
"def",
"SetDefaults",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"Point_SetDefaults",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_core.py#L1183-L1185 | |
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/remove-colored-pieces-if-both-neighbors-are-the-same-color.py | python | Solution.winnerOfGame | (self, colors) | return cnt1 > cnt2 | :type colors: str
:rtype: bool | :type colors: str
:rtype: bool | [
":",
"type",
"colors",
":",
"str",
":",
"rtype",
":",
"bool"
] | def winnerOfGame(self, colors):
"""
:type colors: str
:rtype: bool
"""
cnt1 = cnt2 = 0
for i in xrange(1, len(colors)-1):
if not (colors[i-1] == colors[i] == colors[i+1]):
continue
if colors[i] == 'A':
cnt1 += 1
... | [
"def",
"winnerOfGame",
"(",
"self",
",",
"colors",
")",
":",
"cnt1",
"=",
"cnt2",
"=",
"0",
"for",
"i",
"in",
"xrange",
"(",
"1",
",",
"len",
"(",
"colors",
")",
"-",
"1",
")",
":",
"if",
"not",
"(",
"colors",
"[",
"i",
"-",
"1",
"]",
"==",
... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/remove-colored-pieces-if-both-neighbors-are-the-same-color.py#L5-L18 | |
falkTX/Carla | 74a1ae82c90db85f20550ddcdc8a927b8fb7e414 | source/modules/lilv/lilv-0.24.0/bindings/python/lilv.py | python | World.new_uri | (self, uri) | return Node.wrap(_lib.lilv_new_uri(self.world, uri)) | Create a new URI node. | Create a new URI node. | [
"Create",
"a",
"new",
"URI",
"node",
"."
] | def new_uri(self, uri):
"""Create a new URI node."""
return Node.wrap(_lib.lilv_new_uri(self.world, uri)) | [
"def",
"new_uri",
"(",
"self",
",",
"uri",
")",
":",
"return",
"Node",
".",
"wrap",
"(",
"_lib",
".",
"lilv_new_uri",
"(",
"self",
".",
"world",
",",
"uri",
")",
")"
] | https://github.com/falkTX/Carla/blob/74a1ae82c90db85f20550ddcdc8a927b8fb7e414/source/modules/lilv/lilv-0.24.0/bindings/python/lilv.py#L1155-L1157 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/multiprocessing/process.py | python | BaseProcess.kill | (self) | Terminate process; sends SIGKILL signal or uses TerminateProcess() | Terminate process; sends SIGKILL signal or uses TerminateProcess() | [
"Terminate",
"process",
";",
"sends",
"SIGKILL",
"signal",
"or",
"uses",
"TerminateProcess",
"()"
] | def kill(self):
'''
Terminate process; sends SIGKILL signal or uses TerminateProcess()
'''
self._check_closed()
self._popen.kill() | [
"def",
"kill",
"(",
"self",
")",
":",
"self",
".",
"_check_closed",
"(",
")",
"self",
".",
"_popen",
".",
"kill",
"(",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/multiprocessing/process.py#L126-L131 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/fitting_widgets/basic_fitting/fit_controls_view.py | python | FitControlsView.set_slot_for_undo_fit_clicked | (self, slot) | Connect the slot for the Undo Fit button. | Connect the slot for the Undo Fit button. | [
"Connect",
"the",
"slot",
"for",
"the",
"Undo",
"Fit",
"button",
"."
] | def set_slot_for_undo_fit_clicked(self, slot) -> None:
"""Connect the slot for the Undo Fit button."""
self.undo_fit_button.clicked.connect(slot) | [
"def",
"set_slot_for_undo_fit_clicked",
"(",
"self",
",",
"slot",
")",
"->",
"None",
":",
"self",
".",
"undo_fit_button",
".",
"clicked",
".",
"connect",
"(",
"slot",
")"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/fitting_widgets/basic_fitting/fit_controls_view.py#L42-L44 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py2/pandas/core/frame.py | python | DataFrame.cov | (self, min_periods=None) | return self._constructor(baseCov, index=idx, columns=cols) | Compute pairwise covariance of columns, excluding NA/null values.
Compute the pairwise covariance among the series of a DataFrame.
The returned data frame is the `covariance matrix
<https://en.wikipedia.org/wiki/Covariance_matrix>`__ of the columns
of the DataFrame.
Both NA and... | Compute pairwise covariance of columns, excluding NA/null values. | [
"Compute",
"pairwise",
"covariance",
"of",
"columns",
"excluding",
"NA",
"/",
"null",
"values",
"."
] | def cov(self, min_periods=None):
"""
Compute pairwise covariance of columns, excluding NA/null values.
Compute the pairwise covariance among the series of a DataFrame.
The returned data frame is the `covariance matrix
<https://en.wikipedia.org/wiki/Covariance_matrix>`__ of the c... | [
"def",
"cov",
"(",
"self",
",",
"min_periods",
"=",
"None",
")",
":",
"numeric_df",
"=",
"self",
".",
"_get_numeric_data",
"(",
")",
"cols",
"=",
"numeric_df",
".",
"columns",
"idx",
"=",
"cols",
".",
"copy",
"(",
")",
"mat",
"=",
"numeric_df",
".",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/core/frame.py#L7040-L7149 | |
desura/Desurium | 7d218139682cf1ddcc64beffdcecc984955436f0 | third_party/courgette/tools/file_util.py | python | file_exists | (name) | return os.path.exists(name) | Returns true if the file currently exists. | Returns true if the file currently exists. | [
"Returns",
"true",
"if",
"the",
"file",
"currently",
"exists",
"."
] | def file_exists(name):
""" Returns true if the file currently exists. """
return os.path.exists(name) | [
"def",
"file_exists",
"(",
"name",
")",
":",
"return",
"os",
".",
"path",
".",
"exists",
"(",
"name",
")"
] | https://github.com/desura/Desurium/blob/7d218139682cf1ddcc64beffdcecc984955436f0/third_party/courgette/tools/file_util.py#L38-L40 | |
mapnik/mapnik | f3da900c355e1d15059c4a91b00203dcc9d9f0ef | scons/scons-local-4.1.0/SCons/Util.py | python | Proxy.__getattr__ | (self, name) | return getattr(self._subject, name) | Retrieve an attribute from the wrapped object. If the named
attribute doesn't exist, AttributeError is raised | Retrieve an attribute from the wrapped object. If the named
attribute doesn't exist, AttributeError is raised | [
"Retrieve",
"an",
"attribute",
"from",
"the",
"wrapped",
"object",
".",
"If",
"the",
"named",
"attribute",
"doesn",
"t",
"exist",
"AttributeError",
"is",
"raised"
] | def __getattr__(self, name):
"""Retrieve an attribute from the wrapped object. If the named
attribute doesn't exist, AttributeError is raised"""
return getattr(self._subject, name) | [
"def",
"__getattr__",
"(",
"self",
",",
"name",
")",
":",
"return",
"getattr",
"(",
"self",
".",
"_subject",
",",
"name",
")"
] | https://github.com/mapnik/mapnik/blob/f3da900c355e1d15059c4a91b00203dcc9d9f0ef/scons/scons-local-4.1.0/SCons/Util.py#L602-L605 | |
hszhao/PSPNet | cf7e5a99ba37e46118026e96be5821a9bc63bde0 | scripts/cpp_lint.py | python | _CppLintState.ResetErrorCounts | (self) | Sets the module's error statistic back to zero. | Sets the module's error statistic back to zero. | [
"Sets",
"the",
"module",
"s",
"error",
"statistic",
"back",
"to",
"zero",
"."
] | def ResetErrorCounts(self):
"""Sets the module's error statistic back to zero."""
self.error_count = 0
self.errors_by_category = {} | [
"def",
"ResetErrorCounts",
"(",
"self",
")",
":",
"self",
".",
"error_count",
"=",
"0",
"self",
".",
"errors_by_category",
"=",
"{",
"}"
] | https://github.com/hszhao/PSPNet/blob/cf7e5a99ba37e46118026e96be5821a9bc63bde0/scripts/cpp_lint.py#L742-L745 | ||
google/filament | d21f092645b8e1e312307cbf89f1484891347c63 | third_party/libassimp/port/PyAssimp/scripts/transformations.py | python | Arcball.drag | (self, point) | Update current cursor window coordinates. | Update current cursor window coordinates. | [
"Update",
"current",
"cursor",
"window",
"coordinates",
"."
] | def drag(self, point):
"""Update current cursor window coordinates."""
vnow = arcball_map_to_sphere(point, self._center, self._radius)
if self._axis is not None:
vnow = arcball_constrain_to_axis(vnow, self._axis)
self._qpre = self._qnow
t = numpy.cross(self._vdown,... | [
"def",
"drag",
"(",
"self",
",",
"point",
")",
":",
"vnow",
"=",
"arcball_map_to_sphere",
"(",
"point",
",",
"self",
".",
"_center",
",",
"self",
".",
"_radius",
")",
"if",
"self",
".",
"_axis",
"is",
"not",
"None",
":",
"vnow",
"=",
"arcball_constrain... | https://github.com/google/filament/blob/d21f092645b8e1e312307cbf89f1484891347c63/third_party/libassimp/port/PyAssimp/scripts/transformations.py#L1446-L1460 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/extern/flatnotebook.py | python | PageContainer.DoDeletePage | (self, page) | Does the actual page deletion. | Does the actual page deletion. | [
"Does",
"the",
"actual",
"page",
"deletion",
"."
] | def DoDeletePage(self, page):
""" Does the actual page deletion. """
# Remove the page from the vector
book = self.GetParent()
self._pagesInfoVec.pop(page)
# Thanks to Yiaanis AKA Mandrav
if self._iActivePage >= page:
self._iActivePage = self._iActivePage - ... | [
"def",
"DoDeletePage",
"(",
"self",
",",
"page",
")",
":",
"# Remove the page from the vector",
"book",
"=",
"self",
".",
"GetParent",
"(",
")",
"self",
".",
"_pagesInfoVec",
".",
"pop",
"(",
"page",
")",
"# Thanks to Yiaanis AKA Mandrav",
"if",
"self",
".",
"... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/extern/flatnotebook.py#L4258-L4295 | ||
HKUST-Aerial-Robotics/Teach-Repeat-Replan | 98505a7f74b13c8b501176ff838a38423dbef536 | utils/pose_utils/build/catkin_generated/installspace/_setup_util.py | python | _get_workspaces | (environ, include_fuerte=False, include_non_existing=False) | return workspaces | Based on CMAKE_PREFIX_PATH return all catkin workspaces.
:param include_fuerte: The flag if paths starting with '/opt/ros/fuerte' should be considered workspaces, ``bool`` | Based on CMAKE_PREFIX_PATH return all catkin workspaces. | [
"Based",
"on",
"CMAKE_PREFIX_PATH",
"return",
"all",
"catkin",
"workspaces",
"."
] | def _get_workspaces(environ, include_fuerte=False, include_non_existing=False):
'''
Based on CMAKE_PREFIX_PATH return all catkin workspaces.
:param include_fuerte: The flag if paths starting with '/opt/ros/fuerte' should be considered workspaces, ``bool``
'''
# get all cmake prefix paths
env_na... | [
"def",
"_get_workspaces",
"(",
"environ",
",",
"include_fuerte",
"=",
"False",
",",
"include_non_existing",
"=",
"False",
")",
":",
"# get all cmake prefix paths",
"env_name",
"=",
"'CMAKE_PREFIX_PATH'",
"value",
"=",
"environ",
"[",
"env_name",
"]",
"if",
"env_name... | https://github.com/HKUST-Aerial-Robotics/Teach-Repeat-Replan/blob/98505a7f74b13c8b501176ff838a38423dbef536/utils/pose_utils/build/catkin_generated/installspace/_setup_util.py#L114-L126 | |
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/onnx/mx2onnx/_op_translations/_op_translations_opset12.py | python | convert_broadcast_div | (node, **kwargs) | return create_basic_op_node('Div', node, kwargs) | Map MXNet's broadcast_div operator attributes to onnx's Div operator
and return the created node. | Map MXNet's broadcast_div operator attributes to onnx's Div operator
and return the created node. | [
"Map",
"MXNet",
"s",
"broadcast_div",
"operator",
"attributes",
"to",
"onnx",
"s",
"Div",
"operator",
"and",
"return",
"the",
"created",
"node",
"."
] | def convert_broadcast_div(node, **kwargs):
"""Map MXNet's broadcast_div operator attributes to onnx's Div operator
and return the created node.
"""
return create_basic_op_node('Div', node, kwargs) | [
"def",
"convert_broadcast_div",
"(",
"node",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"create_basic_op_node",
"(",
"'Div'",
",",
"node",
",",
"kwargs",
")"
] | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/onnx/mx2onnx/_op_translations/_op_translations_opset12.py#L1717-L1721 | |
nasa/fprime | 595cf3682d8365943d86c1a6fe7c78f0a116acf0 | Autocoders/Python/src/fprime_ac/utils/pyparsing.py | python | ParserElement.__and__ | (self, other) | return Each([self, other]) | Implementation of & operator - returns Each | Implementation of & operator - returns Each | [
"Implementation",
"of",
"&",
"operator",
"-",
"returns",
"Each"
] | def __and__(self, other):
"""Implementation of & operator - returns Each"""
if isinstance(other, str):
other = Literal(other)
if not isinstance(other, ParserElement):
warnings.warn(
"Cannot add element of type %s to ParserElement" % type(other),
... | [
"def",
"__and__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"str",
")",
":",
"other",
"=",
"Literal",
"(",
"other",
")",
"if",
"not",
"isinstance",
"(",
"other",
",",
"ParserElement",
")",
":",
"warnings",
".",
"warn... | https://github.com/nasa/fprime/blob/595cf3682d8365943d86c1a6fe7c78f0a116acf0/Autocoders/Python/src/fprime_ac/utils/pyparsing.py#L1053-L1063 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/defusedxml/expatbuilder.py | python | parseString | (string, namespaces=True, forbid_dtd=False,
forbid_entities=True, forbid_external=True) | return builder.parseString(string) | Parse a document from a string, returning the resulting
Document node. | Parse a document from a string, returning the resulting
Document node. | [
"Parse",
"a",
"document",
"from",
"a",
"string",
"returning",
"the",
"resulting",
"Document",
"node",
"."
] | def parseString(string, namespaces=True, forbid_dtd=False,
forbid_entities=True, forbid_external=True):
"""Parse a document from a string, returning the resulting
Document node.
"""
if namespaces:
build_builder = DefusedExpatBuilderNS
else:
build_builder = DefusedExpa... | [
"def",
"parseString",
"(",
"string",
",",
"namespaces",
"=",
"True",
",",
"forbid_dtd",
"=",
"False",
",",
"forbid_entities",
"=",
"True",
",",
"forbid_external",
"=",
"True",
")",
":",
"if",
"namespaces",
":",
"build_builder",
"=",
"DefusedExpatBuilderNS",
"e... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/defusedxml/expatbuilder.py#L98-L110 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/types.py | python | new_class | (name, bases=(), kwds=None, exec_body=None) | return meta(name, resolved_bases, ns, **kwds) | Create a class object dynamically using the appropriate metaclass. | Create a class object dynamically using the appropriate metaclass. | [
"Create",
"a",
"class",
"object",
"dynamically",
"using",
"the",
"appropriate",
"metaclass",
"."
] | def new_class(name, bases=(), kwds=None, exec_body=None):
"""Create a class object dynamically using the appropriate metaclass."""
resolved_bases = resolve_bases(bases)
meta, ns, kwds = prepare_class(name, resolved_bases, kwds)
if exec_body is not None:
exec_body(ns)
if resolved_bases is not... | [
"def",
"new_class",
"(",
"name",
",",
"bases",
"=",
"(",
")",
",",
"kwds",
"=",
"None",
",",
"exec_body",
"=",
"None",
")",
":",
"resolved_bases",
"=",
"resolve_bases",
"(",
"bases",
")",
"meta",
",",
"ns",
",",
"kwds",
"=",
"prepare_class",
"(",
"na... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/types.py#L62-L70 | |
Kitware/ParaView | f760af9124ff4634b23ebbeab95a4f56e0261955 | Wrapping/Python/paraview/servermanager.py | python | DoubleMapProperty.values | (self) | return self.GetData().values() | Returns the values | Returns the values | [
"Returns",
"the",
"values"
] | def values(self):
"""Returns the values"""
return self.GetData().values() | [
"def",
"values",
"(",
"self",
")",
":",
"return",
"self",
".",
"GetData",
"(",
")",
".",
"values",
"(",
")"
] | https://github.com/Kitware/ParaView/blob/f760af9124ff4634b23ebbeab95a4f56e0261955/Wrapping/Python/paraview/servermanager.py#L918-L920 | |
shedskin/shedskin | ae88dbca7b1d9671cd8be448cb0b497122758936 | examples/sha.py | python | sha.digest | (self) | return digest | Terminate the message-digest computation and return digest.
Return the digest of the strings passed to the update()
method so far. This is a 16-byte string which may contain
non-ASCII characters, including null bytes. | Terminate the message-digest computation and return digest. | [
"Terminate",
"the",
"message",
"-",
"digest",
"computation",
"and",
"return",
"digest",
"."
] | def digest(self):
"""Terminate the message-digest computation and return digest.
Return the digest of the strings passed to the update()
method so far. This is a 16-byte string which may contain
non-ASCII characters, including null bytes.
"""
H0 = self.H0
H1 = s... | [
"def",
"digest",
"(",
"self",
")",
":",
"H0",
"=",
"self",
".",
"H0",
"H1",
"=",
"self",
".",
"H1",
"H2",
"=",
"self",
".",
"H2",
"H3",
"=",
"self",
".",
"H3",
"H4",
"=",
"self",
".",
"H4",
"input",
"=",
"[",
"]",
"+",
"self",
".",
"input",... | https://github.com/shedskin/shedskin/blob/ae88dbca7b1d9671cd8be448cb0b497122758936/examples/sha.py#L281-L327 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/re.py | python | search | (pattern, string, flags=0) | return _compile(pattern, flags).search(string) | Scan through string looking for a match to the pattern, returning
a match object, or None if no match was found. | Scan through string looking for a match to the pattern, returning
a match object, or None if no match was found. | [
"Scan",
"through",
"string",
"looking",
"for",
"a",
"match",
"to",
"the",
"pattern",
"returning",
"a",
"match",
"object",
"or",
"None",
"if",
"no",
"match",
"was",
"found",
"."
] | def search(pattern, string, flags=0):
"""Scan through string looking for a match to the pattern, returning
a match object, or None if no match was found."""
return _compile(pattern, flags).search(string) | [
"def",
"search",
"(",
"pattern",
",",
"string",
",",
"flags",
"=",
"0",
")",
":",
"return",
"_compile",
"(",
"pattern",
",",
"flags",
")",
".",
"search",
"(",
"string",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/re.py#L143-L146 | |
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/gluon/parameter.py | python | Parameter.set_data | (self, data) | Sets this parameter's value on all devices. | Sets this parameter's value on all devices. | [
"Sets",
"this",
"parameter",
"s",
"value",
"on",
"all",
"devices",
"."
] | def set_data(self, data):
"""Sets this parameter's value on all devices."""
self.shape = data.shape
if self._data is None:
assert self._deferred_init, \
"Parameter '%s' has not been initialized"%self.name
self._deferred_init = self._deferred_init[:3] + (d... | [
"def",
"set_data",
"(",
"self",
",",
"data",
")",
":",
"self",
".",
"shape",
"=",
"data",
".",
"shape",
"if",
"self",
".",
"_data",
"is",
"None",
":",
"assert",
"self",
".",
"_deferred_init",
",",
"\"Parameter '%s' has not been initialized\"",
"%",
"self",
... | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/gluon/parameter.py#L524-L541 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_vendor/pyparsing.py | python | ParserElement.__rsub__ | (self, other) | return other - self | Implementation of - operator when left operand is not a :class:`ParserElement` | [] | def __rsub__(self, other):
"""
Implementation of - operator when left operand is not a :class:`ParserElement`
"""
if isinstance(other, basestring):
other = self._literalStringClass(other)
if not isinstance(other, ParserElement):
warnings.warn("Canno... | [
"def",
"__rsub__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"basestring",
")",
":",
"other",
"=",
"self",
".",
"_literalStringClass",
"(",
"other",
")",
"if",
"not",
"isinstance",
"(",
"other",
",",
"ParserElement",
")"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_vendor/pyparsing.py#L4405-L4425 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py2/numpy/linalg/linalg.py | python | slogdet | (a) | return sign, logdet | Compute the sign and (natural) logarithm of the determinant of an array.
If an array has a very small or very large determinant, then a call to
`det` may overflow or underflow. This routine is more robust against such
issues, because it computes the logarithm of the determinant rather than
the determin... | Compute the sign and (natural) logarithm of the determinant of an array. | [
"Compute",
"the",
"sign",
"and",
"(",
"natural",
")",
"logarithm",
"of",
"the",
"determinant",
"of",
"an",
"array",
"."
] | def slogdet(a):
"""
Compute the sign and (natural) logarithm of the determinant of an array.
If an array has a very small or very large determinant, then a call to
`det` may overflow or underflow. This routine is more robust against such
issues, because it computes the logarithm of the determinant ... | [
"def",
"slogdet",
"(",
"a",
")",
":",
"a",
"=",
"asarray",
"(",
"a",
")",
"_assertRankAtLeast2",
"(",
"a",
")",
"_assertNdSquareness",
"(",
"a",
")",
"t",
",",
"result_t",
"=",
"_commonType",
"(",
"a",
")",
"real_t",
"=",
"_realType",
"(",
"result_t",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py2/numpy/linalg/linalg.py#L1954-L2037 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py2/pandas/core/nanops.py | python | _wrap_results | (result, dtype, fill_value=None) | return result | wrap our results if needed | wrap our results if needed | [
"wrap",
"our",
"results",
"if",
"needed"
] | def _wrap_results(result, dtype, fill_value=None):
""" wrap our results if needed """
if is_datetime64_dtype(dtype) or is_datetime64tz_dtype(dtype):
if fill_value is None:
# GH#24293
fill_value = iNaT
if not isinstance(result, np.ndarray):
tz = getattr(dtype,... | [
"def",
"_wrap_results",
"(",
"result",
",",
"dtype",
",",
"fill_value",
"=",
"None",
")",
":",
"if",
"is_datetime64_dtype",
"(",
"dtype",
")",
"or",
"is_datetime64tz_dtype",
"(",
"dtype",
")",
":",
"if",
"fill_value",
"is",
"None",
":",
"# GH#24293",
"fill_v... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/core/nanops.py#L276-L304 | |
Tencent/CMONGO | c40380caa14e05509f46993aa8b8da966b09b0b5 | src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Variables/__init__.py | python | Variables.__init__ | (self, files=None, args=None, is_global=1) | files - [optional] List of option configuration files to load
(backward compatibility) If a single string is passed it is
automatically placed in a file list | files - [optional] List of option configuration files to load
(backward compatibility) If a single string is passed it is
automatically placed in a file list | [
"files",
"-",
"[",
"optional",
"]",
"List",
"of",
"option",
"configuration",
"files",
"to",
"load",
"(",
"backward",
"compatibility",
")",
"If",
"a",
"single",
"string",
"is",
"passed",
"it",
"is",
"automatically",
"placed",
"in",
"a",
"file",
"list"
] | def __init__(self, files=None, args=None, is_global=1):
"""
files - [optional] List of option configuration files to load
(backward compatibility) If a single string is passed it is
automatically placed in a file list
"""
# initialize argu... | [
"def",
"__init__",
"(",
"self",
",",
"files",
"=",
"None",
",",
"args",
"=",
"None",
",",
"is_global",
"=",
"1",
")",
":",
"# initialize arguments",
"if",
"files",
"is",
"None",
":",
"files",
"=",
"[",
"]",
"if",
"args",
"is",
"None",
":",
"args",
... | https://github.com/Tencent/CMONGO/blob/c40380caa14e05509f46993aa8b8da966b09b0b5/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Variables/__init__.py#L53-L79 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_windows.py | python | PyWindow.DoSetSize | (*args, **kwargs) | return _windows_.PyWindow_DoSetSize(*args, **kwargs) | DoSetSize(self, int x, int y, int width, int height, int sizeFlags=SIZE_AUTO) | DoSetSize(self, int x, int y, int width, int height, int sizeFlags=SIZE_AUTO) | [
"DoSetSize",
"(",
"self",
"int",
"x",
"int",
"y",
"int",
"width",
"int",
"height",
"int",
"sizeFlags",
"=",
"SIZE_AUTO",
")"
] | def DoSetSize(*args, **kwargs):
"""DoSetSize(self, int x, int y, int width, int height, int sizeFlags=SIZE_AUTO)"""
return _windows_.PyWindow_DoSetSize(*args, **kwargs) | [
"def",
"DoSetSize",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"PyWindow_DoSetSize",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_windows.py#L4150-L4152 | |
microsoft/onnxruntime | f92e47e95b13a240e37caf7b36577983544f98fc | orttraining/tools/scripts/nv_run_pretraining.py | python | pretraining_dataset.__len__ | (self) | return len(self.inputs[0]) | Denotes the total number of samples | Denotes the total number of samples | [
"Denotes",
"the",
"total",
"number",
"of",
"samples"
] | def __len__(self):
'Denotes the total number of samples'
return len(self.inputs[0]) | [
"def",
"__len__",
"(",
"self",
")",
":",
"return",
"len",
"(",
"self",
".",
"inputs",
"[",
"0",
"]",
")"
] | https://github.com/microsoft/onnxruntime/blob/f92e47e95b13a240e37caf7b36577983544f98fc/orttraining/tools/scripts/nv_run_pretraining.py#L82-L84 | |
google/flatbuffers | b3006913369e0a7550795e477011ac5bebb93497 | python/flatbuffers/encode.py | python | Get | (packer_type, buf, head) | return packer_type.unpack_from(memoryview_type(buf), head)[0] | Get decodes a value at buf[head] using `packer_type`. | Get decodes a value at buf[head] using `packer_type`. | [
"Get",
"decodes",
"a",
"value",
"at",
"buf",
"[",
"head",
"]",
"using",
"packer_type",
"."
] | def Get(packer_type, buf, head):
""" Get decodes a value at buf[head] using `packer_type`. """
return packer_type.unpack_from(memoryview_type(buf), head)[0] | [
"def",
"Get",
"(",
"packer_type",
",",
"buf",
",",
"head",
")",
":",
"return",
"packer_type",
".",
"unpack_from",
"(",
"memoryview_type",
"(",
"buf",
")",
",",
"head",
")",
"[",
"0",
"]"
] | https://github.com/google/flatbuffers/blob/b3006913369e0a7550795e477011ac5bebb93497/python/flatbuffers/encode.py#L24-L26 | |
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/numpy/multiarray.py | python | ravel | (x, order='C') | return _mx_nd_np.ravel(x, order) | r"""
ravel(x)
Return a contiguous flattened array.
A 1-D array, containing the elements of the input, is returned. A copy is
made only if needed.
Parameters
----------
x : ndarray
Input array. The elements in `x` are read in row-major, C-style order and
packed as a 1-D ar... | r"""
ravel(x) | [
"r",
"ravel",
"(",
"x",
")"
] | def ravel(x, order='C'):
r"""
ravel(x)
Return a contiguous flattened array.
A 1-D array, containing the elements of the input, is returned. A copy is
made only if needed.
Parameters
----------
x : ndarray
Input array. The elements in `x` are read in row-major, C-style order a... | [
"def",
"ravel",
"(",
"x",
",",
"order",
"=",
"'C'",
")",
":",
"return",
"_mx_nd_np",
".",
"ravel",
"(",
"x",
",",
"order",
")"
] | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/numpy/multiarray.py#L8799-L8841 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/keras/saving/saved_model/load.py | python | KerasObjectLoader._add_children_recreated_from_config | (self, obj, proto, node_id) | Recursively records objects recreated from config. | Recursively records objects recreated from config. | [
"Recursively",
"records",
"objects",
"recreated",
"from",
"config",
"."
] | def _add_children_recreated_from_config(self, obj, proto, node_id):
"""Recursively records objects recreated from config."""
# pylint: disable=protected-access
if node_id in self._traversed_nodes_from_config:
return
parent_path = self._node_paths[node_id]
self._traversed_nodes_from_config.add... | [
"def",
"_add_children_recreated_from_config",
"(",
"self",
",",
"obj",
",",
"proto",
",",
"node_id",
")",
":",
"# pylint: disable=protected-access",
"if",
"node_id",
"in",
"self",
".",
"_traversed_nodes_from_config",
":",
"return",
"parent_path",
"=",
"self",
".",
"... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/keras/saving/saved_model/load.py#L308-L379 | ||
SFTtech/openage | d6a08c53c48dc1e157807471df92197f6ca9e04d | openage/convert/entity_object/conversion/genie_structure.py | python | GenieStructure.get_data_format | (cls, game_version, allowed_modes=False,
flatten_includes=False, is_parent=False) | return all members of this exportable (a struct.)
can filter by export modes and can also return included members:
inherited members can either be returned as to-be-included,
or can be fetched and displayed as if they weren't inherited. | return all members of this exportable (a struct.) | [
"return",
"all",
"members",
"of",
"this",
"exportable",
"(",
"a",
"struct",
".",
")"
] | def get_data_format(cls, game_version, allowed_modes=False,
flatten_includes=False, is_parent=False):
"""
return all members of this exportable (a struct.)
can filter by export modes and can also return included members:
inherited members can either be returned a... | [
"def",
"get_data_format",
"(",
"cls",
",",
"game_version",
",",
"allowed_modes",
"=",
"False",
",",
"flatten_includes",
"=",
"False",
",",
"is_parent",
"=",
"False",
")",
":",
"for",
"member",
"in",
"cls",
".",
"get_data_format_members",
"(",
"game_version",
"... | https://github.com/SFTtech/openage/blob/d6a08c53c48dc1e157807471df92197f6ca9e04d/openage/convert/entity_object/conversion/genie_structure.py#L507-L542 | ||
widelands/widelands | e9f047d46a23d81312237d52eabf7d74e8de52d6 | utils/glossary_checks.py | python | translation_has_term | (entry, target) | return result | Verify the target translation against all translation variations from
the glossary. | Verify the target translation against all translation variations from
the glossary. | [
"Verify",
"the",
"target",
"translation",
"against",
"all",
"translation",
"variations",
"from",
"the",
"glossary",
"."
] | def translation_has_term(entry, target):
"""Verify the target translation against all translation variations from
the glossary."""
result = False
for translation in entry.translations:
if contains_term(target, translation):
result = True
break
return result | [
"def",
"translation_has_term",
"(",
"entry",
",",
"target",
")",
":",
"result",
"=",
"False",
"for",
"translation",
"in",
"entry",
".",
"translations",
":",
"if",
"contains_term",
"(",
"target",
",",
"translation",
")",
":",
"result",
"=",
"True",
"break",
... | https://github.com/widelands/widelands/blob/e9f047d46a23d81312237d52eabf7d74e8de52d6/utils/glossary_checks.py#L331-L339 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/autocomp/pycomp.py | python | PyCompleter.get_completions | (self, context, match='', ctip=False) | Get the completions for the given context
@param context: command string to get completions for
@keyword match: for matching an incomplete command string
@keyword ctip: Get a calltip for the context instead of completion list
@return: list of dictionaries | Get the completions for the given context
@param context: command string to get completions for
@keyword match: for matching an incomplete command string
@keyword ctip: Get a calltip for the context instead of completion list
@return: list of dictionaries | [
"Get",
"the",
"completions",
"for",
"the",
"given",
"context",
"@param",
"context",
":",
"command",
"string",
"to",
"get",
"completions",
"for",
"@keyword",
"match",
":",
"for",
"matching",
"an",
"incomplete",
"command",
"string",
"@keyword",
"ctip",
":",
"Get... | def get_completions(self, context, match='', ctip=False):
"""Get the completions for the given context
@param context: command string to get completions for
@keyword match: for matching an incomplete command string
@keyword ctip: Get a calltip for the context instead of completion list
... | [
"def",
"get_completions",
"(",
"self",
",",
"context",
",",
"match",
"=",
"''",
",",
"ctip",
"=",
"False",
")",
":",
"dbg",
"(",
"\"[pycomp] get_completions('%s','%s')\"",
"%",
"(",
"context",
",",
"match",
")",
")",
"stmt",
"=",
"context",
"+",
"match",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/autocomp/pycomp.py#L284-L394 | ||
takemaru/graphillion | 51879f92bb96b53ef8f914ef37a05252ce383617 | graphillion/graphset.py | python | GraphSet.quotient_update | (self, other) | return self | Updates `self` by the quotient.
Examples:
>>> graph1 = [(1, 2), (1, 4)]
>>> graph2 = [(2, 3), (2, 5)]
>>> graph3 = [(1, 4)]
>>> gs = GraphSet([graph1, graph2])
>>> gs /= GraphSet([graph3])
>>> gs
GraphSet([[(1, 2)]])
Returns:
... | Updates `self` by the quotient. | [
"Updates",
"self",
"by",
"the",
"quotient",
"."
] | def quotient_update(self, other):
"""Updates `self` by the quotient.
Examples:
>>> graph1 = [(1, 2), (1, 4)]
>>> graph2 = [(2, 3), (2, 5)]
>>> graph3 = [(1, 4)]
>>> gs = GraphSet([graph1, graph2])
>>> gs /= GraphSet([graph3])
>>> gs
... | [
"def",
"quotient_update",
"(",
"self",
",",
"other",
")",
":",
"self",
".",
"_ss",
".",
"quotient_update",
"(",
"other",
".",
"_ss",
")",
"return",
"self"
] | https://github.com/takemaru/graphillion/blob/51879f92bb96b53ef8f914ef37a05252ce383617/graphillion/graphset.py#L399-L418 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/difflib.py | python | context_diff | (a, b, fromfile='', tofile='',
fromfiledate='', tofiledate='', n=3, lineterm='\n') | r"""
Compare two sequences of lines; generate the delta as a context diff.
Context diffs are a compact way of showing line changes and a few
lines of context. The number of context lines is set by 'n' which
defaults to three.
By default, the diff control lines (those with *** or ---) are
crea... | r"""
Compare two sequences of lines; generate the delta as a context diff. | [
"r",
"Compare",
"two",
"sequences",
"of",
"lines",
";",
"generate",
"the",
"delta",
"as",
"a",
"context",
"diff",
"."
] | def context_diff(a, b, fromfile='', tofile='',
fromfiledate='', tofiledate='', n=3, lineterm='\n'):
r"""
Compare two sequences of lines; generate the delta as a context diff.
Context diffs are a compact way of showing line changes and a few
lines of context. The number of context line... | [
"def",
"context_diff",
"(",
"a",
",",
"b",
",",
"fromfile",
"=",
"''",
",",
"tofile",
"=",
"''",
",",
"fromfiledate",
"=",
"''",
",",
"tofiledate",
"=",
"''",
",",
"n",
"=",
"3",
",",
"lineterm",
"=",
"'\\n'",
")",
":",
"_check_types",
"(",
"a",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/difflib.py#L1221-L1295 | ||
fifengine/fifengine | 4b62c42e85bec19893cef8e63e6855927cff2c47 | engine/python/fife/extensions/serializers/simplexml.py | python | SimpleSerializer.getModuleNameList | (self) | @note: Returns all the module names that are present in the
settings.xml file as a list of strings | [] | def getModuleNameList(self):
"""
@note: Returns all the module names that are present in the
settings.xml file as a list of strings
"""
pass | [
"def",
"getModuleNameList",
"(",
"self",
")",
":",
"pass"
] | https://github.com/fifengine/fifengine/blob/4b62c42e85bec19893cef8e63e6855927cff2c47/engine/python/fife/extensions/serializers/simplexml.py#L71-L76 | |||
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | build/android/valgrind_tools.py | python | ValgrindTool.NeedsDebugInfo | (self) | return True | Whether this tool requires debug info.
Returns True if this tool can not work with stripped binaries. | Whether this tool requires debug info. | [
"Whether",
"this",
"tool",
"requires",
"debug",
"info",
"."
] | def NeedsDebugInfo(self):
"""Whether this tool requires debug info.
Returns True if this tool can not work with stripped binaries.
"""
return True | [
"def",
"NeedsDebugInfo",
"(",
"self",
")",
":",
"return",
"True"
] | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/build/android/valgrind_tools.py#L110-L115 | |
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/contrib/tensor_forest/python/tensor_forest.py | python | ForestHParams.fill | (self) | return self | Intelligently sets any non-specific parameters. | Intelligently sets any non-specific parameters. | [
"Intelligently",
"sets",
"any",
"non",
"-",
"specific",
"parameters",
"."
] | def fill(self):
"""Intelligently sets any non-specific parameters."""
# Fail fast if num_classes or num_features isn't set.
_ = getattr(self, 'num_classes')
_ = getattr(self, 'num_features')
self.bagged_num_features = int(self.feature_bagging_fraction *
self.num_f... | [
"def",
"fill",
"(",
"self",
")",
":",
"# Fail fast if num_classes or num_features isn't set.",
"_",
"=",
"getattr",
"(",
"self",
",",
"'num_classes'",
")",
"_",
"=",
"getattr",
"(",
"self",
",",
"'num_features'",
")",
"self",
".",
"bagged_num_features",
"=",
"in... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/contrib/tensor_forest/python/tensor_forest.py#L83-L142 | |
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Show/mTempoVis.py | python | TempoVis.sketchClipPlane | (self, sketch, enable = None) | sketchClipPlane(sketch, enable = None): Clips all objects by plane of sketch.
If enable argument is omitted, calling the routine repeatedly will toggle clipping plane. | sketchClipPlane(sketch, enable = None): Clips all objects by plane of sketch.
If enable argument is omitted, calling the routine repeatedly will toggle clipping plane. | [
"sketchClipPlane",
"(",
"sketch",
"enable",
"=",
"None",
")",
":",
"Clips",
"all",
"objects",
"by",
"plane",
"of",
"sketch",
".",
"If",
"enable",
"argument",
"is",
"omitted",
"calling",
"the",
"routine",
"repeatedly",
"will",
"toggle",
"clipping",
"plane",
"... | def sketchClipPlane(self, sketch, enable = None):
'''sketchClipPlane(sketch, enable = None): Clips all objects by plane of sketch.
If enable argument is omitted, calling the routine repeatedly will toggle clipping plane.'''
from .SceneDetails.ClipPlane import ClipPlane
... | [
"def",
"sketchClipPlane",
"(",
"self",
",",
"sketch",
",",
"enable",
"=",
"None",
")",
":",
"from",
".",
"SceneDetails",
".",
"ClipPlane",
"import",
"ClipPlane",
"editDoc",
"=",
"Gui",
".",
"editDocument",
"(",
")",
"if",
"editDoc",
"is",
"None",
":",
"d... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Show/mTempoVis.py#L438-L453 | ||
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/OpenSCAD/importCSG.py | python | p_resize_action | (p) | resize_action : resize LPAREN keywordargument_list RPAREN OBRACE block_list EBRACE | resize_action : resize LPAREN keywordargument_list RPAREN OBRACE block_list EBRACE | [
"resize_action",
":",
"resize",
"LPAREN",
"keywordargument_list",
"RPAREN",
"OBRACE",
"block_list",
"EBRACE"
] | def p_resize_action(p):
'''
resize_action : resize LPAREN keywordargument_list RPAREN OBRACE block_list EBRACE '''
new_size = p[3]['newsize']
auto = p[3]['auto']
p[6][0].recompute()
if p[6][0].Shape.isNull():
doc.recompute()
p[6][0].Shape.tessellate(0.05)
old_bbox = p[6][0].S... | [
"def",
"p_resize_action",
"(",
"p",
")",
":",
"new_size",
"=",
"p",
"[",
"3",
"]",
"[",
"'newsize'",
"]",
"auto",
"=",
"p",
"[",
"3",
"]",
"[",
"'auto'",
"]",
"p",
"[",
"6",
"]",
"[",
"0",
"]",
".",
"recompute",
"(",
")",
"if",
"p",
"[",
"6... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/OpenSCAD/importCSG.py#L497-L533 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/decimal.py | python | Context.compare_total_mag | (self, a, b) | return a.compare_total_mag(b) | Compares two operands using their abstract representation ignoring sign.
Like compare_total, but with operand's sign ignored and assumed to be 0. | Compares two operands using their abstract representation ignoring sign. | [
"Compares",
"two",
"operands",
"using",
"their",
"abstract",
"representation",
"ignoring",
"sign",
"."
] | def compare_total_mag(self, a, b):
"""Compares two operands using their abstract representation ignoring sign.
Like compare_total, but with operand's sign ignored and assumed to be 0.
"""
a = _convert_other(a, raiseit=True)
return a.compare_total_mag(b) | [
"def",
"compare_total_mag",
"(",
"self",
",",
"a",
",",
"b",
")",
":",
"a",
"=",
"_convert_other",
"(",
"a",
",",
"raiseit",
"=",
"True",
")",
"return",
"a",
".",
"compare_total_mag",
"(",
"b",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/decimal.py#L4113-L4119 | |
thalium/icebox | 99d147d5b9269222225443ce171b4fd46d8985d4 | third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2class.py | python | URI.path | (self) | return ret | Get the path part from an URI | Get the path part from an URI | [
"Get",
"the",
"path",
"part",
"from",
"an",
"URI"
] | def path(self):
"""Get the path part from an URI """
ret = libxml2mod.xmlURIGetPath(self._o)
return ret | [
"def",
"path",
"(",
"self",
")",
":",
"ret",
"=",
"libxml2mod",
".",
"xmlURIGetPath",
"(",
"self",
".",
"_o",
")",
"return",
"ret"
] | https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2class.py#L6196-L6199 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | chrome/common/extensions/docs/server2/document_parser.py | python | ParseDocument | (document, expect_title=False) | return parser.parse_result | Parses the title and a document structure form |document| and returns a
ParseResult. | Parses the title and a document structure form |document| and returns a
ParseResult. | [
"Parses",
"the",
"title",
"and",
"a",
"document",
"structure",
"form",
"|document|",
"and",
"returns",
"a",
"ParseResult",
"."
] | def ParseDocument(document, expect_title=False):
'''Parses the title and a document structure form |document| and returns a
ParseResult.
'''
parser = _DocumentParser(expect_title)
parser.feed(document)
parser.close()
return parser.parse_result | [
"def",
"ParseDocument",
"(",
"document",
",",
"expect_title",
"=",
"False",
")",
":",
"parser",
"=",
"_DocumentParser",
"(",
"expect_title",
")",
"parser",
".",
"feed",
"(",
"document",
")",
"parser",
".",
"close",
"(",
")",
"return",
"parser",
".",
"parse... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/chrome/common/extensions/docs/server2/document_parser.py#L60-L67 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/android/loading/controller.py | python | LocalChromeController.__init__ | (self) | Initialize the controller.
Caution: The browser state might need to be manually reseted. | Initialize the controller. | [
"Initialize",
"the",
"controller",
"."
] | def __init__(self):
"""Initialize the controller.
Caution: The browser state might need to be manually reseted.
"""
super(LocalChromeController, self).__init__()
if OPTIONS.no_sandbox:
self.AddChromeArguments(['--no-sandbox'])
self._profile_dir = OPTIONS.local_profile_dir
self._using_... | [
"def",
"__init__",
"(",
"self",
")",
":",
"super",
"(",
"LocalChromeController",
",",
"self",
")",
".",
"__init__",
"(",
")",
"if",
"OPTIONS",
".",
"no_sandbox",
":",
"self",
".",
"AddChromeArguments",
"(",
"[",
"'--no-sandbox'",
"]",
")",
"self",
".",
"... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/android/loading/controller.py#L464-L480 | ||
grpc/grpc | 27bc6fe7797e43298dc931b96dc57322d0852a9f | src/python/grpcio/grpc/__init__.py | python | ServicerContext.set_trailing_metadata | (self, trailing_metadata) | Sets the trailing metadata for the RPC.
Sets the trailing metadata to be sent upon completion of the RPC.
If this method is invoked multiple times throughout the lifetime of an
RPC, the value supplied in the final invocation will be the value sent
over the wire.
This method ne... | Sets the trailing metadata for the RPC. | [
"Sets",
"the",
"trailing",
"metadata",
"for",
"the",
"RPC",
"."
] | def set_trailing_metadata(self, trailing_metadata):
"""Sets the trailing metadata for the RPC.
Sets the trailing metadata to be sent upon completion of the RPC.
If this method is invoked multiple times throughout the lifetime of an
RPC, the value supplied in the final invocation will b... | [
"def",
"set_trailing_metadata",
"(",
"self",
",",
"trailing_metadata",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | https://github.com/grpc/grpc/blob/27bc6fe7797e43298dc931b96dc57322d0852a9f/src/python/grpcio/grpc/__init__.py#L1164-L1179 | ||
SoarGroup/Soar | a1c5e249499137a27da60533c72969eef3b8ab6b | scons/scons-local-4.1.0/SCons/Util.py | python | AddMethod | (obj, function, name=None) | Adds a method to an object.
Adds `function` to `obj` if `obj` is a class object.
Adds `function` as a bound method if `obj` is an instance object.
If `obj` looks like an environment instance, use `MethodWrapper`
to add it. If `name` is supplied it is used as the name of `function`.
Although this ... | Adds a method to an object. | [
"Adds",
"a",
"method",
"to",
"an",
"object",
"."
] | def AddMethod(obj, function, name=None):
"""Adds a method to an object.
Adds `function` to `obj` if `obj` is a class object.
Adds `function` as a bound method if `obj` is an instance object.
If `obj` looks like an environment instance, use `MethodWrapper`
to add it. If `name` is supplied it is use... | [
"def",
"AddMethod",
"(",
"obj",
",",
"function",
",",
"name",
"=",
"None",
")",
":",
"if",
"name",
"is",
"None",
":",
"name",
"=",
"function",
".",
"__name__",
"else",
":",
"# \"rename\"",
"function",
"=",
"FunctionType",
"(",
"function",
".",
"__code__"... | https://github.com/SoarGroup/Soar/blob/a1c5e249499137a27da60533c72969eef3b8ab6b/scons/scons-local-4.1.0/SCons/Util.py#L1424-L1469 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/AWSPythonSDK/1.5.8/docutils/utils/math/math2html.py | python | FilePosition.extract | (self, length) | return self.reader.currentline()[self.pos : self.pos + length] | Extract the next string of the given length, or None if not enough text. | Extract the next string of the given length, or None if not enough text. | [
"Extract",
"the",
"next",
"string",
"of",
"the",
"given",
"length",
"or",
"None",
"if",
"not",
"enough",
"text",
"."
] | def extract(self, length):
"Extract the next string of the given length, or None if not enough text."
if self.pos + length > len(self.reader.currentline()):
return None
return self.reader.currentline()[self.pos : self.pos + length] | [
"def",
"extract",
"(",
"self",
",",
"length",
")",
":",
"if",
"self",
".",
"pos",
"+",
"length",
">",
"len",
"(",
"self",
".",
"reader",
".",
"currentline",
"(",
")",
")",
":",
"return",
"None",
"return",
"self",
".",
"reader",
".",
"currentline",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/docutils/utils/math/math2html.py#L2165-L2169 | |
NVIDIA/DALI | bf16cc86ba8f091b145f91962f21fe1b6aff243d | docs/examples/use_cases/tensorflow/efficientdet/dataset/create_pascal_tfrecord.py | python | get_ann_id | () | return GLOBAL_ANN_ID | Return unique annotation id across images. | Return unique annotation id across images. | [
"Return",
"unique",
"annotation",
"id",
"across",
"images",
"."
] | def get_ann_id():
"""Return unique annotation id across images."""
global GLOBAL_ANN_ID
GLOBAL_ANN_ID += 1
return GLOBAL_ANN_ID | [
"def",
"get_ann_id",
"(",
")",
":",
"global",
"GLOBAL_ANN_ID",
"GLOBAL_ANN_ID",
"+=",
"1",
"return",
"GLOBAL_ANN_ID"
] | https://github.com/NVIDIA/DALI/blob/bf16cc86ba8f091b145f91962f21fe1b6aff243d/docs/examples/use_cases/tensorflow/efficientdet/dataset/create_pascal_tfrecord.py#L100-L104 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/ros_comm/rospy/src/rospy/impl/udpros.py | python | UDPROSHandler.init_publisher | (self, topic_name, protocol_params) | return 1, "ready", [UDPROS] | Initialize this node to start publishing to a new UDP location.
@param resolved_name: topic name
@type resolved__name: str
@param protocol_params: requested protocol
parameters. protocol[0] must be the string 'UDPROS'
@type protocol_params: [str, value*]
... | Initialize this node to start publishing to a new UDP location. | [
"Initialize",
"this",
"node",
"to",
"start",
"publishing",
"to",
"a",
"new",
"UDP",
"location",
"."
] | def init_publisher(self, topic_name, protocol_params):
"""
Initialize this node to start publishing to a new UDP location.
@param resolved_name: topic name
@type resolved__name: str
@param protocol_params: requested protocol
parameters. protocol[0] m... | [
"def",
"init_publisher",
"(",
"self",
",",
"topic_name",
",",
"protocol_params",
")",
":",
"if",
"protocol_params",
"[",
"0",
"]",
"!=",
"UDPROS",
":",
"return",
"0",
",",
"\"Internal error: protocol does not match UDPROS: %s\"",
"%",
"protocol",
",",
"[",
"]",
... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/ros_comm/rospy/src/rospy/impl/udpros.py#L152-L171 | |
cms-sw/cmssw | fd9de012d503d3405420bcbeec0ec879baa57cf2 | FWCore/PythonUtilities/python/LumiList.py | python | LumiList.removeRuns | (self, runList) | return | removes runs from runList from collection | removes runs from runList from collection | [
"removes",
"runs",
"from",
"runList",
"from",
"collection"
] | def removeRuns (self, runList):
'''
removes runs from runList from collection
'''
for run in runList:
run = str(run)
if run in self.compactList:
del self.compactList[run]
return | [
"def",
"removeRuns",
"(",
"self",
",",
"runList",
")",
":",
"for",
"run",
"in",
"runList",
":",
"run",
"=",
"str",
"(",
"run",
")",
"if",
"run",
"in",
"self",
".",
"compactList",
":",
"del",
"self",
".",
"compactList",
"[",
"run",
"]",
"return"
] | https://github.com/cms-sw/cmssw/blob/fd9de012d503d3405420bcbeec0ec879baa57cf2/FWCore/PythonUtilities/python/LumiList.py#L322-L331 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/src/robotsim.py | python | PointCloud.transform | (self, R: "double const [9]", t: "double const [3]") | return _robotsim.PointCloud_transform(self, R, t) | r"""
transform(PointCloud self, double const [9] R, double const [3] t)
Transforms all the points by the rigid transform v=R*v+t. | r"""
transform(PointCloud self, double const [9] R, double const [3] t) | [
"r",
"transform",
"(",
"PointCloud",
"self",
"double",
"const",
"[",
"9",
"]",
"R",
"double",
"const",
"[",
"3",
"]",
"t",
")"
] | def transform(self, R: "double const [9]", t: "double const [3]") -> "void":
r"""
transform(PointCloud self, double const [9] R, double const [3] t)
Transforms all the points by the rigid transform v=R*v+t.
"""
return _robotsim.PointCloud_transform(self, R, t) | [
"def",
"transform",
"(",
"self",
",",
"R",
":",
"\"double const [9]\"",
",",
"t",
":",
"\"double const [3]\"",
")",
"->",
"\"void\"",
":",
"return",
"_robotsim",
".",
"PointCloud_transform",
"(",
"self",
",",
"R",
",",
"t",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/src/robotsim.py#L1338-L1346 | |
3drobotics/ardupilot-solo | 05a123b002c11dccc905d4d7703a38e5f36ee723 | Tools/LogAnalyzer/DataflashLog.py | python | LogIterator.next | (self) | return self | increment iterator to next log line | increment iterator to next log line | [
"increment",
"iterator",
"to",
"next",
"log",
"line"
] | def next(self):
'''increment iterator to next log line'''
self.currentLine += 1
if self.currentLine > self.logdata.lineCount:
return self
for lineLabel in self.iterators.keys():
# check if the currentLine has gone past our the line we're pointing to for this type ... | [
"def",
"next",
"(",
"self",
")",
":",
"self",
".",
"currentLine",
"+=",
"1",
"if",
"self",
".",
"currentLine",
">",
"self",
".",
"logdata",
".",
"lineCount",
":",
"return",
"self",
"for",
"lineLabel",
"in",
"self",
".",
"iterators",
".",
"keys",
"(",
... | https://github.com/3drobotics/ardupilot-solo/blob/05a123b002c11dccc905d4d7703a38e5f36ee723/Tools/LogAnalyzer/DataflashLog.py#L297-L311 | |
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | example/reinforcement-learning/ddpg/policies.py | python | DeterministicMLPPolicy.define_loss | (self, loss_exp) | Define loss of the policy. No need to do so here. | Define loss of the policy. No need to do so here. | [
"Define",
"loss",
"of",
"the",
"policy",
".",
"No",
"need",
"to",
"do",
"so",
"here",
"."
] | def define_loss(self, loss_exp):
"""
Define loss of the policy. No need to do so here.
"""
raise NotImplementedError | [
"def",
"define_loss",
"(",
"self",
",",
"loss_exp",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/example/reinforcement-learning/ddpg/policies.py#L72-L77 | ||
deepmind/open_spiel | 4ca53bea32bb2875c7385d215424048ae92f78c8 | open_spiel/python/algorithms/adidas_utils/helpers/symmetric/updates.py | python | Solver.__init__ | (self, proj_grad=True, euclidean=False, rnd_init=False,
seed=None) | Ctor. | Ctor. | [
"Ctor",
"."
] | def __init__(self, proj_grad=True, euclidean=False, rnd_init=False,
seed=None):
"""Ctor."""
self.num_players = None
self.proj_grad = proj_grad
self.rnd_init = rnd_init
self.lrs = (None, None, None)
self.has_aux = False
self.euclidean = euclidean
if euclidean:
self.u... | [
"def",
"__init__",
"(",
"self",
",",
"proj_grad",
"=",
"True",
",",
"euclidean",
"=",
"False",
",",
"rnd_init",
"=",
"False",
",",
"seed",
"=",
"None",
")",
":",
"self",
".",
"num_players",
"=",
"None",
"self",
".",
"proj_grad",
"=",
"proj_grad",
"self... | https://github.com/deepmind/open_spiel/blob/4ca53bea32bb2875c7385d215424048ae92f78c8/open_spiel/python/algorithms/adidas_utils/helpers/symmetric/updates.py#L30-L46 | ||
gv22ga/dlib-face-recognition-android | 42d6305cbd85833f2b85bb79b70ab9ab004153c9 | tools/lint/cpplint.py | python | _OutputFormat | () | return _cpplint_state.output_format | Gets the module's output format. | Gets the module's output format. | [
"Gets",
"the",
"module",
"s",
"output",
"format",
"."
] | def _OutputFormat():
"""Gets the module's output format."""
return _cpplint_state.output_format | [
"def",
"_OutputFormat",
"(",
")",
":",
"return",
"_cpplint_state",
".",
"output_format"
] | https://github.com/gv22ga/dlib-face-recognition-android/blob/42d6305cbd85833f2b85bb79b70ab9ab004153c9/tools/lint/cpplint.py#L886-L888 | |
su2code/SU2 | 72b2fa977b64b9683a388920f05298a40d39e5c5 | SU2_PY/SU2_Nastran/pysu2_nastran.py | python | Solver.__setInitialConditions | (self) | This method uses the list of initial modal amplitudes to set the initial conditions | This method uses the list of initial modal amplitudes to set the initial conditions | [
"This",
"method",
"uses",
"the",
"list",
"of",
"initial",
"modal",
"amplitudes",
"to",
"set",
"the",
"initial",
"conditions"
] | def __setInitialConditions(self):
"""
This method uses the list of initial modal amplitudes to set the initial conditions
"""
print('Setting initial conditions.')
print('Using modal amplitudes from config file')
for imode in range(self.nDof):
if imode in self.Config["INITIAL_MODES"].ke... | [
"def",
"__setInitialConditions",
"(",
"self",
")",
":",
"print",
"(",
"'Setting initial conditions.'",
")",
"print",
"(",
"'Using modal amplitudes from config file'",
")",
"for",
"imode",
"in",
"range",
"(",
"self",
".",
"nDof",
")",
":",
"if",
"imode",
"in",
"s... | https://github.com/su2code/SU2/blob/72b2fa977b64b9683a388920f05298a40d39e5c5/SU2_PY/SU2_Nastran/pysu2_nastran.py#L697-L717 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/cuda/simulator/cudadrv/devicearray.py | python | verify_cuda_ndarray_interface | (obj) | Verify the CUDA ndarray interface for an obj | Verify the CUDA ndarray interface for an obj | [
"Verify",
"the",
"CUDA",
"ndarray",
"interface",
"for",
"an",
"obj"
] | def verify_cuda_ndarray_interface(obj):
"Verify the CUDA ndarray interface for an obj"
require_cuda_ndarray(obj)
def requires_attr(attr, typ):
if not hasattr(obj, attr):
raise AttributeError(attr)
if not isinstance(getattr(obj, attr), typ):
raise AttributeError('%s m... | [
"def",
"verify_cuda_ndarray_interface",
"(",
"obj",
")",
":",
"require_cuda_ndarray",
"(",
"obj",
")",
"def",
"requires_attr",
"(",
"attr",
",",
"typ",
")",
":",
"if",
"not",
"hasattr",
"(",
"obj",
",",
"attr",
")",
":",
"raise",
"AttributeError",
"(",
"at... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/cuda/simulator/cudadrv/devicearray.py#L268-L281 | ||
apache/impala | 8ddac48f3428c86f2cbd037ced89cfb903298b12 | shell/ext-py/prettytable-0.7.2/prettytable.py | python | PrettyTable.__init__ | (self, field_names=None, **kwargs) | Return a new PrettyTable instance
Arguments:
encoding - Unicode encoding scheme used to decode any encoded input
field_names - list or tuple of field names
fields - list or tuple of field names to include in displays
start - index of first data row to include in output
... | Return a new PrettyTable instance | [
"Return",
"a",
"new",
"PrettyTable",
"instance"
] | def __init__(self, field_names=None, **kwargs):
"""Return a new PrettyTable instance
Arguments:
encoding - Unicode encoding scheme used to decode any encoded input
field_names - list or tuple of field names
fields - list or tuple of field names to include in displays
s... | [
"def",
"__init__",
"(",
"self",
",",
"field_names",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"encoding",
"=",
"kwargs",
".",
"get",
"(",
"\"encoding\"",
",",
"\"UTF-8\"",
")",
"# Data",
"self",
".",
"_field_names",
"=",
"[",
"]",
... | https://github.com/apache/impala/blob/8ddac48f3428c86f2cbd037ced89cfb903298b12/shell/ext-py/prettytable-0.7.2/prettytable.py#L84-L175 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/saved_model/loader_impl.py | python | _get_asset_tensors | (export_dir, meta_graph_def_to_load) | return asset_tensor_dict | Gets the asset tensors, if defined in the meta graph def to load.
Args:
export_dir: Directory where the SavedModel is located.
meta_graph_def_to_load: The meta graph def from the SavedModel to be loaded.
Returns:
A dictionary of asset tensors, keyed by the name of the asset tensor. The
value in th... | Gets the asset tensors, if defined in the meta graph def to load. | [
"Gets",
"the",
"asset",
"tensors",
"if",
"defined",
"in",
"the",
"meta",
"graph",
"def",
"to",
"load",
"."
] | def _get_asset_tensors(export_dir, meta_graph_def_to_load):
"""Gets the asset tensors, if defined in the meta graph def to load.
Args:
export_dir: Directory where the SavedModel is located.
meta_graph_def_to_load: The meta graph def from the SavedModel to be loaded.
Returns:
A dictionary of asset te... | [
"def",
"_get_asset_tensors",
"(",
"export_dir",
",",
"meta_graph_def_to_load",
")",
":",
"# Collection-def that may contain the assets key.",
"collection_def",
"=",
"meta_graph_def_to_load",
".",
"collection_def",
"asset_tensor_dict",
"=",
"{",
"}",
"if",
"constants",
".",
... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/saved_model/loader_impl.py#L81-L109 | |
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/device.py | python | Device.device_type | (self) | return Device.devtype2str[self.device_typeid] | Returns the device type of current device.
Examples
-------
>>> mx.device.current_device().device_type
'cpu'
>>> mx.current_device().device_type
'cpu'
Returns
-------
device_type : str | Returns the device type of current device. | [
"Returns",
"the",
"device",
"type",
"of",
"current",
"device",
"."
] | def device_type(self):
"""Returns the device type of current device.
Examples
-------
>>> mx.device.current_device().device_type
'cpu'
>>> mx.current_device().device_type
'cpu'
Returns
-------
device_type : str
"""
return ... | [
"def",
"device_type",
"(",
"self",
")",
":",
"return",
"Device",
".",
"devtype2str",
"[",
"self",
".",
"device_typeid",
"]"
] | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/device.py#L77-L91 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/pdb.py | python | Pdb.do_unalias | (self, arg) | unalias name
Delete the specified alias. | unalias name
Delete the specified alias. | [
"unalias",
"name",
"Delete",
"the",
"specified",
"alias",
"."
] | def do_unalias(self, arg):
"""unalias name
Delete the specified alias.
"""
args = arg.split()
if len(args) == 0: return
if args[0] in self.aliases:
del self.aliases[args[0]] | [
"def",
"do_unalias",
"(",
"self",
",",
"arg",
")",
":",
"args",
"=",
"arg",
".",
"split",
"(",
")",
"if",
"len",
"(",
"args",
")",
"==",
"0",
":",
"return",
"if",
"args",
"[",
"0",
"]",
"in",
"self",
".",
"aliases",
":",
"del",
"self",
".",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/pdb.py#L1432-L1439 | ||
ARM-software/armnn | 5e9965cae1cc6162649910f423ebd86001fc1931 | python/pyarmnn/examples/common/cv_utils.py | python | resize_with_aspect_ratio | (frame: np.ndarray, input_binding_info: tuple) | return frame | Resizes frame while maintaining aspect ratio, padding any empty space.
Args:
frame: Captured frame.
input_binding_info: Contains shape of model input layer.
Returns:
Frame resized to the size of model input layer. | Resizes frame while maintaining aspect ratio, padding any empty space. | [
"Resizes",
"frame",
"while",
"maintaining",
"aspect",
"ratio",
"padding",
"any",
"empty",
"space",
"."
] | def resize_with_aspect_ratio(frame: np.ndarray, input_binding_info: tuple):
"""
Resizes frame while maintaining aspect ratio, padding any empty space.
Args:
frame: Captured frame.
input_binding_info: Contains shape of model input layer.
Returns:
Frame resized to the size of mod... | [
"def",
"resize_with_aspect_ratio",
"(",
"frame",
":",
"np",
".",
"ndarray",
",",
"input_binding_info",
":",
"tuple",
")",
":",
"aspect_ratio",
"=",
"frame",
".",
"shape",
"[",
"1",
"]",
"/",
"frame",
".",
"shape",
"[",
"0",
"]",
"model_height",
",",
"mod... | https://github.com/ARM-software/armnn/blob/5e9965cae1cc6162649910f423ebd86001fc1931/python/pyarmnn/examples/common/cv_utils.py#L49-L74 | |
google/certificate-transparency | 2588562fd306a447958471b6f06c1069619c1641 | python/utilities/log_list/openssl_generator.py | python | generate_openssl_conf | (json_log_list, output_path) | Given a log list read from JSON, writes an OpenSSL log list to a file | Given a log list read from JSON, writes an OpenSSL log list to a file | [
"Given",
"a",
"log",
"list",
"read",
"from",
"JSON",
"writes",
"an",
"OpenSSL",
"log",
"list",
"to",
"a",
"file"
] | def generate_openssl_conf(json_log_list, output_path):
'''Given a log list read from JSON, writes an OpenSSL log list to a file'''
with open(output_path, "w") as output:
logs = json_log_list["logs"]
log_confs = (_log_conf(log) for log in logs)
output.write(_enabled_logs_conf(logs) + "\n... | [
"def",
"generate_openssl_conf",
"(",
"json_log_list",
",",
"output_path",
")",
":",
"with",
"open",
"(",
"output_path",
",",
"\"w\"",
")",
"as",
"output",
":",
"logs",
"=",
"json_log_list",
"[",
"\"logs\"",
"]",
"log_confs",
"=",
"(",
"_log_conf",
"(",
"log"... | https://github.com/google/certificate-transparency/blob/2588562fd306a447958471b6f06c1069619c1641/python/utilities/log_list/openssl_generator.py#L36-L43 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/ptyprocess/ptyprocess/ptyprocess.py | python | PtyProcess.__del__ | (self) | This makes sure that no system resources are left open. Python only
garbage collects Python objects. OS file descriptors are not Python
objects, so they must be handled explicitly. If the child file
descriptor was opened outside of this class (passed to the constructor)
then this does no... | This makes sure that no system resources are left open. Python only
garbage collects Python objects. OS file descriptors are not Python
objects, so they must be handled explicitly. If the child file
descriptor was opened outside of this class (passed to the constructor)
then this does no... | [
"This",
"makes",
"sure",
"that",
"no",
"system",
"resources",
"are",
"left",
"open",
".",
"Python",
"only",
"garbage",
"collects",
"Python",
"objects",
".",
"OS",
"file",
"descriptors",
"are",
"not",
"Python",
"objects",
"so",
"they",
"must",
"be",
"handled"... | def __del__(self):
'''This makes sure that no system resources are left open. Python only
garbage collects Python objects. OS file descriptors are not Python
objects, so they must be handled explicitly. If the child file
descriptor was opened outside of this class (passed to the construc... | [
"def",
"__del__",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"closed",
":",
"# It is possible for __del__ methods to execute during the",
"# teardown of the Python VM itself. Thus self.close() may",
"# trigger an exception because os.close may be None.",
"try",
":",
"self",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ptyprocess/ptyprocess/ptyprocess.py#L370-L385 | ||
plaidml/plaidml | f3c6681db21460e5fdc11ae651d6d7b6c27f8262 | plaidml/edsl/__init__.py | python | TensorIndex.__rmul__ | (self, lhs) | return TensorIndex(_poly_op(lib.PLAIDML_INT_OP_MUL, lhs, self)) | Performs a multiplication between a TensorIndex and another operand
in a polynomial expression.
Example:
>>> i, j = TensorIndexes(2)
>>> A = Placeholder(DType.FLOAT32, [3, 3])
>>> R = Contraction().sum(A[5 * i, j]).build() | Performs a multiplication between a TensorIndex and another operand
in a polynomial expression. | [
"Performs",
"a",
"multiplication",
"between",
"a",
"TensorIndex",
"and",
"another",
"operand",
"in",
"a",
"polynomial",
"expression",
"."
] | def __rmul__(self, lhs):
"""Performs a multiplication between a TensorIndex and another operand
in a polynomial expression.
Example:
>>> i, j = TensorIndexes(2)
>>> A = Placeholder(DType.FLOAT32, [3, 3])
>>> R = Contraction().sum(A[5 * i, j]).build()
... | [
"def",
"__rmul__",
"(",
"self",
",",
"lhs",
")",
":",
"return",
"TensorIndex",
"(",
"_poly_op",
"(",
"lib",
".",
"PLAIDML_INT_OP_MUL",
",",
"lhs",
",",
"self",
")",
")"
] | https://github.com/plaidml/plaidml/blob/f3c6681db21460e5fdc11ae651d6d7b6c27f8262/plaidml/edsl/__init__.py#L258-L267 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py2/pandas/core/indexes/multi.py | python | MultiIndex.reindex | (self, target, method=None, level=None, limit=None,
tolerance=None) | return target, indexer | Create index with target's values (move/add/delete values as necessary)
Returns
-------
new_index : pd.MultiIndex
Resulting index
indexer : np.ndarray or None
Indices of output values in original index | Create index with target's values (move/add/delete values as necessary) | [
"Create",
"index",
"with",
"target",
"s",
"values",
"(",
"move",
"/",
"add",
"/",
"delete",
"values",
"as",
"necessary",
")"
] | def reindex(self, target, method=None, level=None, limit=None,
tolerance=None):
"""
Create index with target's values (move/add/delete values as necessary)
Returns
-------
new_index : pd.MultiIndex
Resulting index
indexer : np.ndarray or None
... | [
"def",
"reindex",
"(",
"self",
",",
"target",
",",
"method",
"=",
"None",
",",
"level",
"=",
"None",
",",
"limit",
"=",
"None",
",",
"tolerance",
"=",
"None",
")",
":",
"# GH6552: preserve names when reindexing to non-named target",
"# (i.e. neither Index nor Series... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/core/indexes/multi.py#L2182-L2243 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/setuptools/py2/setuptools/msvc.py | python | RegistryInfo.vc | (self) | return join(self.sxs, 'VC7') | Microsoft Visual C++ VC7 registry key.
Return
------
str
Registry key | Microsoft Visual C++ VC7 registry key. | [
"Microsoft",
"Visual",
"C",
"++",
"VC7",
"registry",
"key",
"."
] | def vc(self):
"""
Microsoft Visual C++ VC7 registry key.
Return
------
str
Registry key
"""
return join(self.sxs, 'VC7') | [
"def",
"vc",
"(",
"self",
")",
":",
"return",
"join",
"(",
"self",
".",
"sxs",
",",
"'VC7'",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/setuptools/py2/setuptools/msvc.py#L383-L392 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/aui/framemanager.py | python | AuiPaneInfo.MinSize2 | (self, x, y) | return self | Sets the minimum size of the pane.
:see: :meth:`MinSize` for an explanation of input parameters. | Sets the minimum size of the pane. | [
"Sets",
"the",
"minimum",
"size",
"of",
"the",
"pane",
"."
] | def MinSize2(self, x, y):
"""
Sets the minimum size of the pane.
:see: :meth:`MinSize` for an explanation of input parameters.
"""
self.min_size = wx.Size(x, y)
return self | [
"def",
"MinSize2",
"(",
"self",
",",
"x",
",",
"y",
")",
":",
"self",
".",
"min_size",
"=",
"wx",
".",
"Size",
"(",
"x",
",",
"y",
")",
"return",
"self"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/aui/framemanager.py#L1071-L1079 | |
idaholab/moose | 9eeebc65e098b4c30f8205fb41591fd5b61eb6ff | python/peacock/PostprocessorViewer/plugins/PostprocessorTableWidget.py | python | PostprocessorTableWidget.sizeHint | (self, *args) | Return the saved size. | Return the saved size. | [
"Return",
"the",
"saved",
"size",
"."
] | def sizeHint(self, *args):
"""
Return the saved size.
"""
if self._size:
return self._size
else:
return super(PostprocessorTableWidget, self).size() | [
"def",
"sizeHint",
"(",
"self",
",",
"*",
"args",
")",
":",
"if",
"self",
".",
"_size",
":",
"return",
"self",
".",
"_size",
"else",
":",
"return",
"super",
"(",
"PostprocessorTableWidget",
",",
"self",
")",
".",
"size",
"(",
")"
] | https://github.com/idaholab/moose/blob/9eeebc65e098b4c30f8205fb41591fd5b61eb6ff/python/peacock/PostprocessorViewer/plugins/PostprocessorTableWidget.py#L25-L32 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/inline_closurecall.py | python | _find_iter_range | (func_ir, range_iter_var, swapped) | Find the iterator's actual range if it is either range(n), or range(m, n),
otherwise return raise GuardException. | Find the iterator's actual range if it is either range(n), or range(m, n),
otherwise return raise GuardException. | [
"Find",
"the",
"iterator",
"s",
"actual",
"range",
"if",
"it",
"is",
"either",
"range",
"(",
"n",
")",
"or",
"range",
"(",
"m",
"n",
")",
"otherwise",
"return",
"raise",
"GuardException",
"."
] | def _find_iter_range(func_ir, range_iter_var, swapped):
"""Find the iterator's actual range if it is either range(n), or range(m, n),
otherwise return raise GuardException.
"""
debug_print = _make_debug_print("find_iter_range")
range_iter_def = get_definition(func_ir, range_iter_var)
debug_print... | [
"def",
"_find_iter_range",
"(",
"func_ir",
",",
"range_iter_var",
",",
"swapped",
")",
":",
"debug_print",
"=",
"_make_debug_print",
"(",
"\"find_iter_range\"",
")",
"range_iter_def",
"=",
"get_definition",
"(",
"func_ir",
",",
"range_iter_var",
")",
"debug_print",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/inline_closurecall.py#L605-L634 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/locale.py | python | getlocale | (category=LC_CTYPE) | return _parse_localename(localename) | Returns the current setting for the given locale category as
tuple (language code, encoding).
category may be one of the LC_* value except LC_ALL. It
defaults to LC_CTYPE.
Except for the code 'C', the language code corresponds to RFC
1766. code and encoding can be None in case... | Returns the current setting for the given locale category as
tuple (language code, encoding). | [
"Returns",
"the",
"current",
"setting",
"for",
"the",
"given",
"locale",
"category",
"as",
"tuple",
"(",
"language",
"code",
"encoding",
")",
"."
] | def getlocale(category=LC_CTYPE):
""" Returns the current setting for the given locale category as
tuple (language code, encoding).
category may be one of the LC_* value except LC_ALL. It
defaults to LC_CTYPE.
Except for the code 'C', the language code corresponds to RFC
1... | [
"def",
"getlocale",
"(",
"category",
"=",
"LC_CTYPE",
")",
":",
"localename",
"=",
"_setlocale",
"(",
"category",
")",
"if",
"category",
"==",
"LC_ALL",
"and",
"';'",
"in",
"localename",
":",
"raise",
"TypeError",
"(",
"'category LC_ALL is not supported'",
")",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/locale.py#L577-L593 | |
lmb-freiburg/ogn | 974f72ef4bf840d6f6693d22d1843a79223e77ce | python/caffe/pycaffe.py | python | _Net_blob_loss_weights | (self) | return self._blob_loss_weights_dict | An OrderedDict (bottom to top, i.e., input to output) of network
blob loss weights indexed by name | An OrderedDict (bottom to top, i.e., input to output) of network
blob loss weights indexed by name | [
"An",
"OrderedDict",
"(",
"bottom",
"to",
"top",
"i",
".",
"e",
".",
"input",
"to",
"output",
")",
"of",
"network",
"blob",
"loss",
"weights",
"indexed",
"by",
"name"
] | def _Net_blob_loss_weights(self):
"""
An OrderedDict (bottom to top, i.e., input to output) of network
blob loss weights indexed by name
"""
if not hasattr(self, '_blobs_loss_weights_dict'):
self._blob_loss_weights_dict = OrderedDict(zip(self._blob_names,
... | [
"def",
"_Net_blob_loss_weights",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'_blobs_loss_weights_dict'",
")",
":",
"self",
".",
"_blob_loss_weights_dict",
"=",
"OrderedDict",
"(",
"zip",
"(",
"self",
".",
"_blob_names",
",",
"self",
".",... | https://github.com/lmb-freiburg/ogn/blob/974f72ef4bf840d6f6693d22d1843a79223e77ce/python/caffe/pycaffe.py#L36-L44 | |
RobotLocomotion/drake | 0e18a34604c45ed65bc9018a54f7610f91cdad5b | tools/workspace/drake_visualizer/_drake_visualizer_builtin_scripts/show_image.py | python | create_image | (w, h, num_channels=1, dtype=np.uint8) | return image | Creates a VTK image. | Creates a VTK image. | [
"Creates",
"a",
"VTK",
"image",
"."
] | def create_image(w, h, num_channels=1, dtype=np.uint8):
""" Creates a VTK image. """
image = vtk.vtkImageData()
image.SetExtent(0, w - 1, 0, h - 1, 0, 0)
image.SetSpacing(1., 1., 1.)
image.SetOrigin(0., 0., 0.)
if _is_vtk_5:
image.SetWholeExtent(image.GetExtent())
image.SetScalar... | [
"def",
"create_image",
"(",
"w",
",",
"h",
",",
"num_channels",
"=",
"1",
",",
"dtype",
"=",
"np",
".",
"uint8",
")",
":",
"image",
"=",
"vtk",
".",
"vtkImageData",
"(",
")",
"image",
".",
"SetExtent",
"(",
"0",
",",
"w",
"-",
"1",
",",
"0",
",... | https://github.com/RobotLocomotion/drake/blob/0e18a34604c45ed65bc9018a54f7610f91cdad5b/tools/workspace/drake_visualizer/_drake_visualizer_builtin_scripts/show_image.py#L274-L287 | |
microsoft/clang | 86d4513d3e0daa4d5a29b0b1de7c854ca15f9fe5 | bindings/python/clang/cindex.py | python | Cursor.lexical_parent | (self) | return self._lexical_parent | Return the lexical parent for this cursor. | Return the lexical parent for this cursor. | [
"Return",
"the",
"lexical",
"parent",
"for",
"this",
"cursor",
"."
] | def lexical_parent(self):
"""Return the lexical parent for this cursor."""
if not hasattr(self, '_lexical_parent'):
self._lexical_parent = conf.lib.clang_getCursorLexicalParent(self)
return self._lexical_parent | [
"def",
"lexical_parent",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'_lexical_parent'",
")",
":",
"self",
".",
"_lexical_parent",
"=",
"conf",
".",
"lib",
".",
"clang_getCursorLexicalParent",
"(",
"self",
")",
"return",
"self",
".",
... | https://github.com/microsoft/clang/blob/86d4513d3e0daa4d5a29b0b1de7c854ca15f9fe5/bindings/python/clang/cindex.py#L1747-L1752 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/ros/rosunit/src/rosunit/pmon.py | python | ProcessMonitor.get_active_names | (self) | return retval | @return [str]: list of active process names | [] | def get_active_names(self):
"""
@return [str]: list of active process names
"""
with self.plock:
retval = [p.name for p in self.procs]
return retval | [
"def",
"get_active_names",
"(",
"self",
")",
":",
"with",
"self",
".",
"plock",
":",
"retval",
"=",
"[",
"p",
".",
"name",
"for",
"p",
"in",
"self",
".",
"procs",
"]",
"return",
"retval"
] | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/ros/rosunit/src/rosunit/pmon.py#L345-L351 | ||
Ewenwan/MVision | 97b394dfa48cb21c82cd003b1a952745e413a17f | vSLAM/ch8/data/associate.py | python | associate | (first_list, second_list,offset,max_difference) | return matches | Associate two dictionaries of (stamp,data). As the time stamps never match exactly, we aim
to find the closest match for every input tuple.
Input:
first_list -- first dictionary of (stamp,data) tuples
second_list -- second dictionary of (stamp,data) tuples
offset -- time offset between both di... | Associate two dictionaries of (stamp,data). As the time stamps never match exactly, we aim
to find the closest match for every input tuple.
Input:
first_list -- first dictionary of (stamp,data) tuples
second_list -- second dictionary of (stamp,data) tuples
offset -- time offset between both di... | [
"Associate",
"two",
"dictionaries",
"of",
"(",
"stamp",
"data",
")",
".",
"As",
"the",
"time",
"stamps",
"never",
"match",
"exactly",
"we",
"aim",
"to",
"find",
"the",
"closest",
"match",
"for",
"every",
"input",
"tuple",
".",
"Input",
":",
"first_list",
... | def associate(first_list, second_list,offset,max_difference):
"""
Associate two dictionaries of (stamp,data). As the time stamps never match exactly, we aim
to find the closest match for every input tuple.
Input:
first_list -- first dictionary of (stamp,data) tuples
second_list -- second d... | [
"def",
"associate",
"(",
"first_list",
",",
"second_list",
",",
"offset",
",",
"max_difference",
")",
":",
"first_keys",
"=",
"first_list",
".",
"keys",
"(",
")",
"second_keys",
"=",
"second_list",
".",
"keys",
"(",
")",
"potential_matches",
"=",
"[",
"(",
... | https://github.com/Ewenwan/MVision/blob/97b394dfa48cb21c82cd003b1a952745e413a17f/vSLAM/ch8/data/associate.py#L71-L101 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/learn/python/learn/estimators/linear.py | python | LinearRegressor.predict | (self, x=None, input_fn=None, batch_size=None, outputs=None,
as_iterable=True) | return super(LinearRegressor, self).predict(
x=x,
input_fn=input_fn,
batch_size=batch_size,
outputs=outputs,
as_iterable=as_iterable) | Returns predictions for given features.
By default, returns predicted scores. But this default will be dropped
soon. Users should either pass `outputs`, or call `predict_scores` method.
Args:
x: features.
input_fn: Input function. If set, x must be None.
batch_size: Override default batc... | Returns predictions for given features. | [
"Returns",
"predictions",
"for",
"given",
"features",
"."
] | def predict(self, x=None, input_fn=None, batch_size=None, outputs=None,
as_iterable=True):
"""Returns predictions for given features.
By default, returns predicted scores. But this default will be dropped
soon. Users should either pass `outputs`, or call `predict_scores` method.
Args:
... | [
"def",
"predict",
"(",
"self",
",",
"x",
"=",
"None",
",",
"input_fn",
"=",
"None",
",",
"batch_size",
"=",
"None",
",",
"outputs",
"=",
"None",
",",
"as_iterable",
"=",
"True",
")",
":",
"if",
"not",
"outputs",
":",
"return",
"self",
".",
"predict_s... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/learn/python/learn/estimators/linear.py#L768-L803 | |
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | current/tools/configure.d/nodedownload.py | python | reporthook | (count, size, total) | internal hook used by retrievefile | internal hook used by retrievefile | [
"internal",
"hook",
"used",
"by",
"retrievefile"
] | def reporthook(count, size, total):
"""internal hook used by retrievefile"""
sys.stdout.write(' Fetch: %c %sMB total, %sMB downloaded \r' %
(spin(count),
formatSize(total),
formatSize(count*size))) | [
"def",
"reporthook",
"(",
"count",
",",
"size",
",",
"total",
")",
":",
"sys",
".",
"stdout",
".",
"write",
"(",
"' Fetch: %c %sMB total, %sMB downloaded \\r'",
"%",
"(",
"spin",
"(",
"count",
")",
",",
"formatSize",
"(",
"total",
")",
",",
"formatSize",
... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/current/tools/configure.d/nodedownload.py#L29-L34 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow2.x/tensorflow_model_optimization/python/core/quantization/keras/vitis/vitis_quantize.py | python | VitisQuantizer.get_analysed_model | (self, dataset) | return self._analysed_model, model_info | Get analysed model. | Get analysed model. | [
"Get",
"analysed",
"model",
"."
] | def get_analysed_model(self, dataset):
"""Get analysed model."""
if not self._analyse_model:
with self._custom_object_scope:
model_info = self._create_analysed_model(dataset)
return self._analysed_model, model_info | [
"def",
"get_analysed_model",
"(",
"self",
",",
"dataset",
")",
":",
"if",
"not",
"self",
".",
"_analyse_model",
":",
"with",
"self",
".",
"_custom_object_scope",
":",
"model_info",
"=",
"self",
".",
"_create_analysed_model",
"(",
"dataset",
")",
"return",
"sel... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow2.x/tensorflow_model_optimization/python/core/quantization/keras/vitis/vitis_quantize.py#L457-L462 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_controls.py | python | ToolBarBase.GetToolClientData | (*args, **kwargs) | return _controls_.ToolBarBase_GetToolClientData(*args, **kwargs) | GetToolClientData(self, int id) -> PyObject | GetToolClientData(self, int id) -> PyObject | [
"GetToolClientData",
"(",
"self",
"int",
"id",
")",
"-",
">",
"PyObject"
] | def GetToolClientData(*args, **kwargs):
"""GetToolClientData(self, int id) -> PyObject"""
return _controls_.ToolBarBase_GetToolClientData(*args, **kwargs) | [
"def",
"GetToolClientData",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"ToolBarBase_GetToolClientData",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_controls.py#L3803-L3805 | |
cyberbotics/webots | af7fa7d68dcf7b4550f1f2e132092b41e83698fc | projects/humans/c3d/controllers/c3d_viewer/c3d.py | python | Param.uint32_value | (self) | return self._as('I') | Get the param as a 32-bit unsigned integer. | Get the param as a 32-bit unsigned integer. | [
"Get",
"the",
"param",
"as",
"a",
"32",
"-",
"bit",
"unsigned",
"integer",
"."
] | def uint32_value(self):
'''Get the param as a 32-bit unsigned integer.'''
return self._as('I') | [
"def",
"uint32_value",
"(",
"self",
")",
":",
"return",
"self",
".",
"_as",
"(",
"'I'",
")"
] | https://github.com/cyberbotics/webots/blob/af7fa7d68dcf7b4550f1f2e132092b41e83698fc/projects/humans/c3d/controllers/c3d_viewer/c3d.py#L305-L307 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/keras/python/keras/backend.py | python | spatial_2d_padding | (x, padding=((1, 1), (1, 1)), data_format=None) | return array_ops.pad(x, pattern) | Pads the 2nd and 3rd dimensions of a 4D tensor.
Arguments:
x: Tensor or variable.
padding: Tuple of 2 tuples, padding pattern.
data_format: One of `channels_last` or `channels_first`.
Returns:
A padded 4D tensor.
Raises:
ValueError: if `data_format` is neither
`channels_... | Pads the 2nd and 3rd dimensions of a 4D tensor. | [
"Pads",
"the",
"2nd",
"and",
"3rd",
"dimensions",
"of",
"a",
"4D",
"tensor",
"."
] | def spatial_2d_padding(x, padding=((1, 1), (1, 1)), data_format=None):
"""Pads the 2nd and 3rd dimensions of a 4D tensor.
Arguments:
x: Tensor or variable.
padding: Tuple of 2 tuples, padding pattern.
data_format: One of `channels_last` or `channels_first`.
Returns:
A padded 4D tensor.
... | [
"def",
"spatial_2d_padding",
"(",
"x",
",",
"padding",
"=",
"(",
"(",
"1",
",",
"1",
")",
",",
"(",
"1",
",",
"1",
")",
")",
",",
"data_format",
"=",
"None",
")",
":",
"assert",
"len",
"(",
"padding",
")",
"==",
"2",
"assert",
"len",
"(",
"padd... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/keras/python/keras/backend.py#L2148-L2175 | |
devpack/android-python27 | d42dd67565e104cf7b0b50eb473f615db3e69901 | python-build-with-qt/sip-4.11.2/siputils.py | python | Makefile.optional_string | (self, name, default="") | return s | Return an optional Makefile macro as a string.
name is the name of the macro.
default is the default value | Return an optional Makefile macro as a string. | [
"Return",
"an",
"optional",
"Makefile",
"macro",
"as",
"a",
"string",
"."
] | def optional_string(self, name, default=""):
"""Return an optional Makefile macro as a string.
name is the name of the macro.
default is the default value
"""
s = ' '.join(self.optional_list(name))
if not s:
s = default
return s | [
"def",
"optional_string",
"(",
"self",
",",
"name",
",",
"default",
"=",
"\"\"",
")",
":",
"s",
"=",
"' '",
".",
"join",
"(",
"self",
".",
"optional_list",
"(",
"name",
")",
")",
"if",
"not",
"s",
":",
"s",
"=",
"default",
"return",
"s"
] | https://github.com/devpack/android-python27/blob/d42dd67565e104cf7b0b50eb473f615db3e69901/python-build-with-qt/sip-4.11.2/siputils.py#L790-L801 | |
google/clif | cab24d6a105609a65c95a36a1712ae3c20c7b5df | clif/python/postproc.py | python | RuntimeErrorOnFalse | (ok, *args) | return _RaiseOnFalse('RuntimeErrorOnFalse', RuntimeError, ok, *args) | Returns None / arg / (args,...) if ok, otherwise raises RuntimeError. | Returns None / arg / (args,...) if ok, otherwise raises RuntimeError. | [
"Returns",
"None",
"/",
"arg",
"/",
"(",
"args",
"...",
")",
"if",
"ok",
"otherwise",
"raises",
"RuntimeError",
"."
] | def RuntimeErrorOnFalse(ok, *args):
"""Returns None / arg / (args,...) if ok, otherwise raises RuntimeError."""
return _RaiseOnFalse('RuntimeErrorOnFalse', RuntimeError, ok, *args) | [
"def",
"RuntimeErrorOnFalse",
"(",
"ok",
",",
"*",
"args",
")",
":",
"return",
"_RaiseOnFalse",
"(",
"'RuntimeErrorOnFalse'",
",",
"RuntimeError",
",",
"ok",
",",
"*",
"args",
")"
] | https://github.com/google/clif/blob/cab24d6a105609a65c95a36a1712ae3c20c7b5df/clif/python/postproc.py#L54-L56 | |
bareos/bareos | 56a10bb368b0a81e977bb51304033fe49d59efb0 | restapi/bareos_restapi/__init__.py | python | read_catalog_info_for_all_clients | (
response: Response,
current_user: User = Depends(get_current_user),
name: Optional[str] = None,
) | Read status information from catalog about all clients or just one client by name.
Built on console command _llist client_ | Read status information from catalog about all clients or just one client by name.
Built on console command _llist client_ | [
"Read",
"status",
"information",
"from",
"catalog",
"about",
"all",
"clients",
"or",
"just",
"one",
"client",
"by",
"name",
".",
"Built",
"on",
"console",
"command",
"_llist",
"client_"
] | def read_catalog_info_for_all_clients(
response: Response,
current_user: User = Depends(get_current_user),
name: Optional[str] = None,
):
"""
Read status information from catalog about all clients or just one client by name.
Built on console command _llist client_
"""
if name:
li... | [
"def",
"read_catalog_info_for_all_clients",
"(",
"response",
":",
"Response",
",",
"current_user",
":",
"User",
"=",
"Depends",
"(",
"get_current_user",
")",
",",
"name",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
",",
")",
":",
"if",
"name",
":",
"lis... | https://github.com/bareos/bareos/blob/56a10bb368b0a81e977bb51304033fe49d59efb0/restapi/bareos_restapi/__init__.py#L429-L455 | ||
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Arch/ArchIFC.py | python | IfcRoot.setupIfcComplexAttributes | (self, obj) | Add the IFC type's complex attributes to the object.
Get the object's IFC type schema, and add the schema for the type's
complex attributes within the IfcData property. | Add the IFC type's complex attributes to the object. | [
"Add",
"the",
"IFC",
"type",
"s",
"complex",
"attributes",
"to",
"the",
"object",
"."
] | def setupIfcComplexAttributes(self, obj):
"""Add the IFC type's complex attributes to the object.
Get the object's IFC type schema, and add the schema for the type's
complex attributes within the IfcData property.
"""
ifcTypeSchema = self.getIfcTypeSchema(obj.IfcType)
i... | [
"def",
"setupIfcComplexAttributes",
"(",
"self",
",",
"obj",
")",
":",
"ifcTypeSchema",
"=",
"self",
".",
"getIfcTypeSchema",
"(",
"obj",
".",
"IfcType",
")",
"if",
"ifcTypeSchema",
"is",
"None",
":",
"return",
"IfcData",
"=",
"obj",
".",
"IfcData",
"if",
... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Arch/ArchIFC.py#L121-L139 | ||
NVIDIA/MDL-SDK | aa9642b2546ad7b6236b5627385d882c2ed83c5d | src/mdl/jit/llvm/dist/examples/Kaleidoscope/MCJIT/cached/genk-timing.py | python | KScriptGenerator.updateCalledFunctionList | (self, callee) | Maintains a list of functions that will actually be called | Maintains a list of functions that will actually be called | [
"Maintains",
"a",
"list",
"of",
"functions",
"that",
"will",
"actually",
"be",
"called"
] | def updateCalledFunctionList(self, callee):
"""Maintains a list of functions that will actually be called"""
# Update the total call count
self.updateTotalCallCount(callee)
# If this function is already in the list, don't do anything else
if callee in self.calledFunctions:
... | [
"def",
"updateCalledFunctionList",
"(",
"self",
",",
"callee",
")",
":",
"# Update the total call count",
"self",
".",
"updateTotalCallCount",
"(",
"callee",
")",
"# If this function is already in the list, don't do anything else",
"if",
"callee",
"in",
"self",
".",
"called... | https://github.com/NVIDIA/MDL-SDK/blob/aa9642b2546ad7b6236b5627385d882c2ed83c5d/src/mdl/jit/llvm/dist/examples/Kaleidoscope/MCJIT/cached/genk-timing.py#L66-L78 | ||
microsoft/onnxruntime | f92e47e95b13a240e37caf7b36577983544f98fc | orttraining/orttraining/python/training/ortmodule/_io.py | python | _combine_input_buffers_initializers | (params, onnx_input_names, input_info, buffer_names, inputs, kwargs, device) | return result | Creates forward `*inputs` list from user input and PyTorch initializers
ONNX Runtime forward requires an ordered list of:
* User input: computed from forward InferenceSession
* Initializers: computed from original PyTorch model parameters | Creates forward `*inputs` list from user input and PyTorch initializers | [
"Creates",
"forward",
"*",
"inputs",
"list",
"from",
"user",
"input",
"and",
"PyTorch",
"initializers"
] | def _combine_input_buffers_initializers(params, onnx_input_names, input_info, buffer_names, inputs, kwargs, device):
'''Creates forward `*inputs` list from user input and PyTorch initializers
ONNX Runtime forward requires an ordered list of:
* User input: computed from forward InferenceSession
... | [
"def",
"_combine_input_buffers_initializers",
"(",
"params",
",",
"onnx_input_names",
",",
"input_info",
",",
"buffer_names",
",",
"inputs",
",",
"kwargs",
",",
"device",
")",
":",
"def",
"_expand_inputs",
"(",
"current_input",
",",
"non_none_inputs",
")",
":",
"#... | https://github.com/microsoft/onnxruntime/blob/f92e47e95b13a240e37caf7b36577983544f98fc/orttraining/orttraining/python/training/ortmodule/_io.py#L132-L206 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | tools/git/move_source_file.py | python | MakeIncludeGuardName | (path_from_root) | return guard.upper() | Returns an include guard name given a path from root. | Returns an include guard name given a path from root. | [
"Returns",
"an",
"include",
"guard",
"name",
"given",
"a",
"path",
"from",
"root",
"."
] | def MakeIncludeGuardName(path_from_root):
"""Returns an include guard name given a path from root."""
guard = path_from_root.replace('/', '_')
guard = guard.replace('\\', '_')
guard = guard.replace('.', '_')
guard += '_'
return guard.upper() | [
"def",
"MakeIncludeGuardName",
"(",
"path_from_root",
")",
":",
"guard",
"=",
"path_from_root",
".",
"replace",
"(",
"'/'",
",",
"'_'",
")",
"guard",
"=",
"guard",
".",
"replace",
"(",
"'\\\\'",
",",
"'_'",
")",
"guard",
"=",
"guard",
".",
"replace",
"("... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/tools/git/move_source_file.py#L119-L125 | |
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/contrib/slim/python/slim/model_analyzer.py | python | analyze_ops | (graph, print_info=False) | return total_size | Compute the estimated size of the ops.outputs in the graph.
Args:
graph: the graph containing the operations.
print_info: Optional, if true print ops and their outputs.
Returns:
total size of the ops.outputs | Compute the estimated size of the ops.outputs in the graph. | [
"Compute",
"the",
"estimated",
"size",
"of",
"the",
"ops",
".",
"outputs",
"in",
"the",
"graph",
"."
] | def analyze_ops(graph, print_info=False):
"""Compute the estimated size of the ops.outputs in the graph.
Args:
graph: the graph containing the operations.
print_info: Optional, if true print ops and their outputs.
Returns:
total size of the ops.outputs
"""
if print_info:
print('---------')
... | [
"def",
"analyze_ops",
"(",
"graph",
",",
"print_info",
"=",
"False",
")",
":",
"if",
"print_info",
":",
"print",
"(",
"'---------'",
")",
"print",
"(",
"'Operations: name -> (type shapes) [size]'",
")",
"print",
"(",
"'---------'",
")",
"total_size",
"=",
"0",
... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/contrib/slim/python/slim/model_analyzer.py#L53-L80 | |
snap-stanford/snap-python | d53c51b0a26aa7e3e7400b014cdf728948fde80a | setup/snap.py | python | TIntIntVH.Swap | (self, *args) | return _snap.TIntIntVH_Swap(self, *args) | Swap(TIntIntVH self, TIntIntVH Hash)
Parameters:
Hash: THash< TInt,TVec< TInt,int > > & | Swap(TIntIntVH self, TIntIntVH Hash) | [
"Swap",
"(",
"TIntIntVH",
"self",
"TIntIntVH",
"Hash",
")"
] | def Swap(self, *args):
"""
Swap(TIntIntVH self, TIntIntVH Hash)
Parameters:
Hash: THash< TInt,TVec< TInt,int > > &
"""
return _snap.TIntIntVH_Swap(self, *args) | [
"def",
"Swap",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_snap",
".",
"TIntIntVH_Swap",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/setup/snap.py#L18098-L18106 | |
openmm/openmm | cb293447c4fc8b03976dfe11399f107bab70f3d9 | wrappers/python/openmm/unit/quantity.py | python | Quantity.min | (self, *args, **kwargs) | return Quantity(mymin, self.unit) | Computes the minimum value of the sequence, with the result having the
same unit as the current sequence.
If the value is not iterable, it raises a TypeError
This function can take as arguments any arguments recognized by
`numpy.min`. If arguments are passed to a non-numpy array, a Typ... | Computes the minimum value of the sequence, with the result having the
same unit as the current sequence. | [
"Computes",
"the",
"minimum",
"value",
"of",
"the",
"sequence",
"with",
"the",
"result",
"having",
"the",
"same",
"unit",
"as",
"the",
"current",
"sequence",
"."
] | def min(self, *args, **kwargs):
"""
Computes the minimum value of the sequence, with the result having the
same unit as the current sequence.
If the value is not iterable, it raises a TypeError
This function can take as arguments any arguments recognized by
`numpy.min`.... | [
"def",
"min",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"# Faster for numpy arrays",
"mymin",
"=",
"self",
".",
"_value",
".",
"min",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"except",
"AttributeError",
":",... | https://github.com/openmm/openmm/blob/cb293447c4fc8b03976dfe11399f107bab70f3d9/wrappers/python/openmm/unit/quantity.py#L549-L567 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/ops/lookup_ops.py | python | index_table_from_file | (vocabulary_file=None,
num_oov_buckets=0,
vocab_size=None,
default_value=-1,
hasher_spec=FastHashSpec,
key_dtype=dtypes.string,
name=None) | Returns a lookup table that converts a string tensor into int64 IDs.
This operation constructs a lookup table to convert tensor of strings into
int64 IDs. The mapping can be initialized from a vocabulary file specified in
`vocabulary_file`, where the whole line is the key and the zero-based line
number is the ... | Returns a lookup table that converts a string tensor into int64 IDs. | [
"Returns",
"a",
"lookup",
"table",
"that",
"converts",
"a",
"string",
"tensor",
"into",
"int64",
"IDs",
"."
] | def index_table_from_file(vocabulary_file=None,
num_oov_buckets=0,
vocab_size=None,
default_value=-1,
hasher_spec=FastHashSpec,
key_dtype=dtypes.string,
name=None):... | [
"def",
"index_table_from_file",
"(",
"vocabulary_file",
"=",
"None",
",",
"num_oov_buckets",
"=",
"0",
",",
"vocab_size",
"=",
"None",
",",
"default_value",
"=",
"-",
"1",
",",
"hasher_spec",
"=",
"FastHashSpec",
",",
"key_dtype",
"=",
"dtypes",
".",
"string",... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/ops/lookup_ops.py#L856-L962 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.