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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
OpenChemistry/tomviz | 0a903679318f191cb7dd3eb5ff5bc3a7d3320d9a | tomviz/python/tomviz/io/dm.py | python | FileDM._bin2str | (bin0) | return ''.join([chr(item) for item in bin0]) | Utility function to convert a numpy array of binary values
to a python string. | Utility function to convert a numpy array of binary values
to a python string. | [
"Utility",
"function",
"to",
"convert",
"a",
"numpy",
"array",
"of",
"binary",
"values",
"to",
"a",
"python",
"string",
"."
] | def _bin2str(bin0):
"""Utility function to convert a numpy array of binary values
to a python string.
"""
return ''.join([chr(item) for item in bin0]) | [
"def",
"_bin2str",
"(",
"bin0",
")",
":",
"return",
"''",
".",
"join",
"(",
"[",
"chr",
"(",
"item",
")",
"for",
"item",
"in",
"bin0",
"]",
")"
] | https://github.com/OpenChemistry/tomviz/blob/0a903679318f191cb7dd3eb5ff5bc3a7d3320d9a/tomviz/python/tomviz/io/dm.py#L569-L574 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/distutils/misc_util.py | python | Configuration.have_f77c | (self) | return flag | Check for availability of Fortran 77 compiler.
Use it inside source generating function to ensure that
setup distribution instance has been initialized.
Notes
-----
True if a Fortran 77 compiler is available (because a simple Fortran 77
code was able to be compiled succ... | Check for availability of Fortran 77 compiler. | [
"Check",
"for",
"availability",
"of",
"Fortran",
"77",
"compiler",
"."
] | def have_f77c(self):
"""Check for availability of Fortran 77 compiler.
Use it inside source generating function to ensure that
setup distribution instance has been initialized.
Notes
-----
True if a Fortran 77 compiler is available (because a simple Fortran 77
c... | [
"def",
"have_f77c",
"(",
"self",
")",
":",
"simple_fortran_subroutine",
"=",
"'''\n subroutine simple\n end\n '''",
"config_cmd",
"=",
"self",
".",
"get_config_cmd",
"(",
")",
"flag",
"=",
"config_cmd",
".",
"try_compile",
"(",
"simple_fortran_subrout... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/distutils/misc_util.py#L1715-L1732 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/XRCed/listener.py | python | _Listener.OnPasteSibling | (self, evt) | ID.PASTE_SIBLING handler. | ID.PASTE_SIBLING handler. | [
"ID",
".",
"PASTE_SIBLING",
"handler",
"."
] | def OnPasteSibling(self, evt):
'''ID.PASTE_SIBLING handler.'''
forceSibling = True
state = wx.GetMouseState()
forceInsert = state.ShiftDown()
g.Presenter.updateCreateState(forceSibling, forceInsert)
treeState = self.tree.GetFullState() # state just before
item = P... | [
"def",
"OnPasteSibling",
"(",
"self",
",",
"evt",
")",
":",
"forceSibling",
"=",
"True",
"state",
"=",
"wx",
".",
"GetMouseState",
"(",
")",
"forceInsert",
"=",
"state",
".",
"ShiftDown",
"(",
")",
"g",
".",
"Presenter",
".",
"updateCreateState",
"(",
"f... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/XRCed/listener.py#L453-L462 | ||
apache/qpid-proton | 6bcdfebb55ea3554bc29b1901422532db331a591 | python/proton/_endpoints.py | python | Link.is_sender | (self) | return pn_link_is_sender(self._impl) | ``True`` if this link is a sender, ``False`` otherwise. | ``True`` if this link is a sender, ``False`` otherwise. | [
"True",
"if",
"this",
"link",
"is",
"a",
"sender",
"False",
"otherwise",
"."
] | def is_sender(self) -> bool:
"""
``True`` if this link is a sender, ``False`` otherwise.
"""
return pn_link_is_sender(self._impl) | [
"def",
"is_sender",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"pn_link_is_sender",
"(",
"self",
".",
"_impl",
")"
] | https://github.com/apache/qpid-proton/blob/6bcdfebb55ea3554bc29b1901422532db331a591/python/proton/_endpoints.py#L1001-L1005 | |
logcabin/logcabin | ee6c55ae9744b82b451becd9707d26c7c1b6bbfb | scripts/cpplint.py | python | GetLineWidth | (line) | Determines the width of the line in column positions.
Args:
line: A string, which may be a Unicode string.
Returns:
The width of the line in column positions, accounting for Unicode
combining characters and wide characters. | Determines the width of the line in column positions. | [
"Determines",
"the",
"width",
"of",
"the",
"line",
"in",
"column",
"positions",
"."
] | def GetLineWidth(line):
"""Determines the width of the line in column positions.
Args:
line: A string, which may be a Unicode string.
Returns:
The width of the line in column positions, accounting for Unicode
combining characters and wide characters.
"""
if isinstance(line, unicode):
width =... | [
"def",
"GetLineWidth",
"(",
"line",
")",
":",
"if",
"isinstance",
"(",
"line",
",",
"unicode",
")",
":",
"width",
"=",
"0",
"for",
"c",
"in",
"unicodedata",
".",
"normalize",
"(",
"'NFC'",
",",
"line",
")",
":",
"if",
"unicodedata",
".",
"east_asian_wi... | https://github.com/logcabin/logcabin/blob/ee6c55ae9744b82b451becd9707d26c7c1b6bbfb/scripts/cpplint.py#L2007-L2026 | ||
hfinkel/llvm-project-cxxjit | 91084ef018240bbb8e24235ff5cd8c355a9c1a1e | clang/docs/tools/dump_ast_matchers.py | python | act_on_decl | (declaration, comment, allowed_types) | Parse the matcher out of the given declaration and comment.
If 'allowed_types' is set, it contains a list of node types the matcher
can match on, as extracted from the static type asserts in the matcher
definition. | Parse the matcher out of the given declaration and comment. | [
"Parse",
"the",
"matcher",
"out",
"of",
"the",
"given",
"declaration",
"and",
"comment",
"."
] | def act_on_decl(declaration, comment, allowed_types):
"""Parse the matcher out of the given declaration and comment.
If 'allowed_types' is set, it contains a list of node types the matcher
can match on, as extracted from the static type asserts in the matcher
definition.
"""
if declaration.strip()... | [
"def",
"act_on_decl",
"(",
"declaration",
",",
"comment",
",",
"allowed_types",
")",
":",
"if",
"declaration",
".",
"strip",
"(",
")",
":",
"# Node matchers are defined by writing:",
"# VariadicDynCastAllOfMatcher<ResultType, ArgumentType> name;",
"m",
"=",
"re",
".",
... | https://github.com/hfinkel/llvm-project-cxxjit/blob/91084ef018240bbb8e24235ff5cd8c355a9c1a1e/clang/docs/tools/dump_ast_matchers.py#L134-L320 | ||
microsoft/ELL | a1d6bacc37a14879cc025d9be2ba40b1a0632315 | tools/utilities/pythonlibs/audio/training/train_classifier.py | python | KeywordSpotter.export | (self, name, device) | Export the model to the ONNX file format | Export the model to the ONNX file format | [
"Export",
"the",
"model",
"to",
"the",
"ONNX",
"file",
"format"
] | def export(self, name, device):
""" Export the model to the ONNX file format """
self.init_hidden()
self.tracking = True
dummy_input = Variable(torch.randn(1, 1, self.input_dim))
if device:
dummy_input = dummy_input.to(device)
torch.onnx.export(self, dummy_inp... | [
"def",
"export",
"(",
"self",
",",
"name",
",",
"device",
")",
":",
"self",
".",
"init_hidden",
"(",
")",
"self",
".",
"tracking",
"=",
"True",
"dummy_input",
"=",
"Variable",
"(",
"torch",
".",
"randn",
"(",
"1",
",",
"1",
",",
"self",
".",
"input... | https://github.com/microsoft/ELL/blob/a1d6bacc37a14879cc025d9be2ba40b1a0632315/tools/utilities/pythonlibs/audio/training/train_classifier.py#L114-L122 | ||
trilinos/Trilinos | 6168be6dd51e35e1cd681e9c4b24433e709df140 | packages/seacas/scripts/exomerge2.py | python | ExodusModel.delete_empty_side_sets | (self) | Delete all side sets with zero members.
Example:
>>> model.delete_empty_side_sets() | Delete all side sets with zero members. | [
"Delete",
"all",
"side",
"sets",
"with",
"zero",
"members",
"."
] | def delete_empty_side_sets(self):
"""
Delete all side sets with zero members.
Example:
>>> model.delete_empty_side_sets()
"""
for id_ in self.get_side_set_ids():
if not self.get_side_set_members(id_):
self.delete_side_set(id_) | [
"def",
"delete_empty_side_sets",
"(",
"self",
")",
":",
"for",
"id_",
"in",
"self",
".",
"get_side_set_ids",
"(",
")",
":",
"if",
"not",
"self",
".",
"get_side_set_members",
"(",
"id_",
")",
":",
"self",
".",
"delete_side_set",
"(",
"id_",
")"
] | https://github.com/trilinos/Trilinos/blob/6168be6dd51e35e1cd681e9c4b24433e709df140/packages/seacas/scripts/exomerge2.py#L5748-L5758 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_windows.py | python | TopLevelWindow.Restore | (*args, **kwargs) | return _windows_.TopLevelWindow_Restore(*args, **kwargs) | Restore(self) | Restore(self) | [
"Restore",
"(",
"self",
")"
] | def Restore(*args, **kwargs):
"""Restore(self)"""
return _windows_.TopLevelWindow_Restore(*args, **kwargs) | [
"def",
"Restore",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"TopLevelWindow_Restore",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_windows.py#L409-L411 | |
infinit/memo | 3a8394d0f647efe03ccb8bfe885a7279cb8be8a6 | elle/drake/src/drake/__init__.py | python | Path.without_last_extension | (self) | return self.with_extension(ext) | Remove the last dot and what follows from the basename.
Does nothing if there is no dot.
>>> p = Path('foo.tar.bz2')
>>> p
Path("foo.tar.bz2")
>>> p = p.without_last_extension()
>>> p
Path("foo.tar")
>>> p = p.without_last_extension()
>>> p
Path("foo")
... | Remove the last dot and what follows from the basename. | [
"Remove",
"the",
"last",
"dot",
"and",
"what",
"follows",
"from",
"the",
"basename",
"."
] | def without_last_extension(self):
"""Remove the last dot and what follows from the basename.
Does nothing if there is no dot.
>>> p = Path('foo.tar.bz2')
>>> p
Path("foo.tar.bz2")
>>> p = p.without_last_extension()
>>> p
Path("foo.tar")
>>> p = p.without_last_exte... | [
"def",
"without_last_extension",
"(",
"self",
")",
":",
"ext",
"=",
"'.'",
".",
"join",
"(",
"self",
".",
"extension",
".",
"split",
"(",
"'.'",
")",
"[",
":",
"-",
"1",
"]",
")",
"return",
"self",
".",
"with_extension",
"(",
"ext",
")"
] | https://github.com/infinit/memo/blob/3a8394d0f647efe03ccb8bfe885a7279cb8be8a6/elle/drake/src/drake/__init__.py#L726-L744 | |
LiquidPlayer/LiquidCore | 9405979363f2353ac9a71ad8ab59685dd7f919c9 | deps/node-10.15.3/tools/gyp/pylib/gyp/generator/msvs.py | python | _MapFileToMsBuildSourceType | (source, rule_dependencies,
extension_to_rule_name) | return (group, element) | Returns the group and element type of the source file.
Arguments:
source: The source file name.
extension_to_rule_name: A dictionary mapping file extensions to rules.
Returns:
A pair of (group this file should be part of, the label of element) | Returns the group and element type of the source file. | [
"Returns",
"the",
"group",
"and",
"element",
"type",
"of",
"the",
"source",
"file",
"."
] | def _MapFileToMsBuildSourceType(source, rule_dependencies,
extension_to_rule_name):
"""Returns the group and element type of the source file.
Arguments:
source: The source file name.
extension_to_rule_name: A dictionary mapping file extensions to rules.
Returns:
... | [
"def",
"_MapFileToMsBuildSourceType",
"(",
"source",
",",
"rule_dependencies",
",",
"extension_to_rule_name",
")",
":",
"_",
",",
"ext",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"source",
")",
"ext",
"=",
"ext",
".",
"lower",
"(",
")",
"if",
"ext",
... | https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/node-10.15.3/tools/gyp/pylib/gyp/generator/msvs.py#L2147-L2184 | |
ablab/spades | 3a754192b88540524ce6fb69eef5ea9273a38465 | assembler/ext/src/python_libs/joblib3/func_inspect.py | python | filter_args | (func, ignore_lst, args=(), kwargs=dict()) | return arg_dict | Filters the given args and kwargs using a list of arguments to
ignore, and a function specification.
Parameters
----------
func: callable
Function giving the argument specification
ignore_lst: list of strings
List of arguments to ignore (either a name of ... | Filters the given args and kwargs using a list of arguments to
ignore, and a function specification. | [
"Filters",
"the",
"given",
"args",
"and",
"kwargs",
"using",
"a",
"list",
"of",
"arguments",
"to",
"ignore",
"and",
"a",
"function",
"specification",
"."
] | def filter_args(func, ignore_lst, args=(), kwargs=dict()):
""" Filters the given args and kwargs using a list of arguments to
ignore, and a function specification.
Parameters
----------
func: callable
Function giving the argument specification
ignore_lst: list of... | [
"def",
"filter_args",
"(",
"func",
",",
"ignore_lst",
",",
"args",
"=",
"(",
")",
",",
"kwargs",
"=",
"dict",
"(",
")",
")",
":",
"args",
"=",
"list",
"(",
"args",
")",
"if",
"isinstance",
"(",
"ignore_lst",
",",
"_basestring",
")",
":",
"# Catch a c... | https://github.com/ablab/spades/blob/3a754192b88540524ce6fb69eef5ea9273a38465/assembler/ext/src/python_libs/joblib3/func_inspect.py#L159-L265 | |
aimerykong/Low-Rank-Bilinear-Pooling | 487eb2c857fd9c95357a5166b0c15ad0fe135b28 | demo3_modelVisualization/vlfeat/docsrc/webdoc.py | python | DocBareNode.isA | (self, classInfo) | return isinstance(self, classInfo) | Returns TRUE if the node is of class CLASSINFO. | Returns TRUE if the node is of class CLASSINFO. | [
"Returns",
"TRUE",
"if",
"the",
"node",
"is",
"of",
"class",
"CLASSINFO",
"."
] | def isA(self, classInfo):
"""
Returns TRUE if the node is of class CLASSINFO.
"""
return isinstance(self, classInfo) | [
"def",
"isA",
"(",
"self",
",",
"classInfo",
")",
":",
"return",
"isinstance",
"(",
"self",
",",
"classInfo",
")"
] | https://github.com/aimerykong/Low-Rank-Bilinear-Pooling/blob/487eb2c857fd9c95357a5166b0c15ad0fe135b28/demo3_modelVisualization/vlfeat/docsrc/webdoc.py#L231-L235 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/pip/util.py | python | rmtree_errorhandler | (func, path, exc_info) | On Windows, the files in .svn are read-only, so when rmtree() tries to
remove them, an exception is thrown. We catch that here, remove the
read-only attribute, and hopefully continue without problems. | On Windows, the files in .svn are read-only, so when rmtree() tries to
remove them, an exception is thrown. We catch that here, remove the
read-only attribute, and hopefully continue without problems. | [
"On",
"Windows",
"the",
"files",
"in",
".",
"svn",
"are",
"read",
"-",
"only",
"so",
"when",
"rmtree",
"()",
"tries",
"to",
"remove",
"them",
"an",
"exception",
"is",
"thrown",
".",
"We",
"catch",
"that",
"here",
"remove",
"the",
"read",
"-",
"only",
... | def rmtree_errorhandler(func, path, exc_info):
"""On Windows, the files in .svn are read-only, so when rmtree() tries to
remove them, an exception is thrown. We catch that here, remove the
read-only attribute, and hopefully continue without problems."""
exctype, value = exc_info[:2]
if not ((exctyp... | [
"def",
"rmtree_errorhandler",
"(",
"func",
",",
"path",
",",
"exc_info",
")",
":",
"exctype",
",",
"value",
"=",
"exc_info",
"[",
":",
"2",
"]",
"if",
"not",
"(",
"(",
"exctype",
"is",
"WindowsError",
"and",
"value",
".",
"args",
"[",
"0",
"]",
"==",... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/pip/util.py#L45-L61 | ||
apache/kudu | 90895ce76590f10730ad7aac3613b69d89ff5422 | build-support/check_compatibility.py | python | get_japicmp_path | () | return os.path.join(get_repo_dir(), "thirdparty/src/" + JAPICMP_JAR) | Return the path where we download the japicmp jar. | Return the path where we download the japicmp jar. | [
"Return",
"the",
"path",
"where",
"we",
"download",
"the",
"japicmp",
"jar",
"."
] | def get_japicmp_path():
""" Return the path where we download the japicmp jar. """
return os.path.join(get_repo_dir(), "thirdparty/src/" + JAPICMP_JAR) | [
"def",
"get_japicmp_path",
"(",
")",
":",
"return",
"os",
".",
"path",
".",
"join",
"(",
"get_repo_dir",
"(",
")",
",",
"\"thirdparty/src/\"",
"+",
"JAPICMP_JAR",
")"
] | https://github.com/apache/kudu/blob/90895ce76590f10730ad7aac3613b69d89ff5422/build-support/check_compatibility.py#L104-L106 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/training/tracking/util.py | python | object_metadata | (save_path) | return object_graph_proto | Retrieves information about the objects in a checkpoint.
Example usage:
```python
object_graph = tf.contrib.checkpoint.object_metadata(
tf.train.latest_checkpoint(checkpoint_directory))
ckpt_variable_names = set()
for node in object_graph.nodes:
for attribute in node.attributes:
ckpt_variabl... | Retrieves information about the objects in a checkpoint. | [
"Retrieves",
"information",
"about",
"the",
"objects",
"in",
"a",
"checkpoint",
"."
] | def object_metadata(save_path):
"""Retrieves information about the objects in a checkpoint.
Example usage:
```python
object_graph = tf.contrib.checkpoint.object_metadata(
tf.train.latest_checkpoint(checkpoint_directory))
ckpt_variable_names = set()
for node in object_graph.nodes:
for attribute i... | [
"def",
"object_metadata",
"(",
"save_path",
")",
":",
"reader",
"=",
"pywrap_tensorflow",
".",
"NewCheckpointReader",
"(",
"save_path",
")",
"try",
":",
"object_graph_string",
"=",
"reader",
".",
"get_tensor",
"(",
"base",
".",
"OBJECT_GRAPH_PROTO_KEY",
")",
"exce... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/training/tracking/util.py#L442-L476 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/utilities/run_string_utils.py | python | run_list_to_string | (run_list, max_value=True) | return delimiter.join(range_list) | Converts a list of runs into a formatted string using a delimiter/range separator
:param run_list: list of integers
:return: string representation | Converts a list of runs into a formatted string using a delimiter/range separator
:param run_list: list of integers
:return: string representation | [
"Converts",
"a",
"list",
"of",
"runs",
"into",
"a",
"formatted",
"string",
"using",
"a",
"delimiter",
"/",
"range",
"separator",
":",
"param",
"run_list",
":",
"list",
"of",
"integers",
":",
"return",
":",
"string",
"representation"
] | def run_list_to_string(run_list, max_value=True):
"""
Converts a list of runs into a formatted string using a delimiter/range separator
:param run_list: list of integers
:return: string representation
"""
if not isinstance(run_list, list):
run_list = [run_list]
run_list = _remove_dup... | [
"def",
"run_list_to_string",
"(",
"run_list",
",",
"max_value",
"=",
"True",
")",
":",
"if",
"not",
"isinstance",
"(",
"run_list",
",",
"list",
")",
":",
"run_list",
"=",
"[",
"run_list",
"]",
"run_list",
"=",
"_remove_duplicates_from_list",
"(",
"run_list",
... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/utilities/run_string_utils.py#L37-L58 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/os.py | python | removedirs | (name) | removedirs(name)
Super-rmdir; remove a leaf directory and all empty intermediate
ones. Works like rmdir except that, if the leaf directory is
successfully removed, directories corresponding to rightmost path
segments will be pruned away until either the whole path is
consumed or an error occurs. ... | removedirs(name) | [
"removedirs",
"(",
"name",
")"
] | def removedirs(name):
"""removedirs(name)
Super-rmdir; remove a leaf directory and all empty intermediate
ones. Works like rmdir except that, if the leaf directory is
successfully removed, directories corresponding to rightmost path
segments will be pruned away until either the whole path is
c... | [
"def",
"removedirs",
"(",
"name",
")",
":",
"rmdir",
"(",
"name",
")",
"head",
",",
"tail",
"=",
"path",
".",
"split",
"(",
"name",
")",
"if",
"not",
"tail",
":",
"head",
",",
"tail",
"=",
"path",
".",
"split",
"(",
"head",
")",
"while",
"head",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/os.py#L232-L252 | ||
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/lib-tk/Tkinter.py | python | Misc.winfo_name | (self) | return self.tk.call('winfo', 'name', self._w) | Return the name of this widget. | Return the name of this widget. | [
"Return",
"the",
"name",
"of",
"this",
"widget",
"."
] | def winfo_name(self):
"""Return the name of this widget."""
return self.tk.call('winfo', 'name', self._w) | [
"def",
"winfo_name",
"(",
"self",
")",
":",
"return",
"self",
".",
"tk",
".",
"call",
"(",
"'winfo'",
",",
"'name'",
",",
"self",
".",
"_w",
")"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/lib-tk/Tkinter.py#L798-L800 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_windows.py | python | TaskBarIcon.SetIcon | (*args, **kwargs) | return _windows_.TaskBarIcon_SetIcon(*args, **kwargs) | SetIcon(self, Icon icon, String tooltip=EmptyString) -> bool | SetIcon(self, Icon icon, String tooltip=EmptyString) -> bool | [
"SetIcon",
"(",
"self",
"Icon",
"icon",
"String",
"tooltip",
"=",
"EmptyString",
")",
"-",
">",
"bool"
] | def SetIcon(*args, **kwargs):
"""SetIcon(self, Icon icon, String tooltip=EmptyString) -> bool"""
return _windows_.TaskBarIcon_SetIcon(*args, **kwargs) | [
"def",
"SetIcon",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"TaskBarIcon_SetIcon",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_windows.py#L2839-L2841 | |
RobotLocomotion/drake | 0e18a34604c45ed65bc9018a54f7610f91cdad5b | tools/workspace/drake_visualizer/_drake_visualizer_builtin_scripts/show_hydroelastic_contact.py | python | HydroelasticContactVisualizer.add_pressure_mesh_cb | (self, vis_item: VisualItem,
mesh_data: vtk.vtkPolyData) | The callback supplied to the VisualModel for when adding a pressure
mesh. | The callback supplied to the VisualModel for when adding a pressure
mesh. | [
"The",
"callback",
"supplied",
"to",
"the",
"VisualModel",
"for",
"when",
"adding",
"a",
"pressure",
"mesh",
"."
] | def add_pressure_mesh_cb(self, vis_item: VisualItem,
mesh_data: vtk.vtkPolyData):
"""The callback supplied to the VisualModel for when adding a pressure
mesh."""
# We subvert the standard pipeline that director uses to inject
# texture coordinate transformati... | [
"def",
"add_pressure_mesh_cb",
"(",
"self",
",",
"vis_item",
":",
"VisualItem",
",",
"mesh_data",
":",
"vtk",
".",
"vtkPolyData",
")",
":",
"# We subvert the standard pipeline that director uses to inject",
"# texture coordinate transformation (moving and scaling). Scaling the",
... | https://github.com/RobotLocomotion/drake/blob/0e18a34604c45ed65bc9018a54f7610f91cdad5b/tools/workspace/drake_visualizer/_drake_visualizer_builtin_scripts/show_hydroelastic_contact.py#L1424-L1464 | ||
snap-stanford/snap-python | d53c51b0a26aa7e3e7400b014cdf728948fde80a | setup/snap.py | python | TStrUtil.SplitWords | (*args) | return _snap.TStrUtil_SplitWords(*args) | SplitWords(TChA ChA, TVec< char * > & WrdV, bool const & SplitOnWs=True) -> int
Parameters:
ChA: TChA &
WrdV: TVec< char * > &
SplitOnWs: bool const &
SplitWords(TChA ChA, TVec< char * > & WrdV) -> int
Parameters:
ChA: TChA &
WrdV: T... | SplitWords(TChA ChA, TVec< char * > & WrdV, bool const & SplitOnWs=True) -> int | [
"SplitWords",
"(",
"TChA",
"ChA",
"TVec<",
"char",
"*",
">",
"&",
"WrdV",
"bool",
"const",
"&",
"SplitOnWs",
"=",
"True",
")",
"-",
">",
"int"
] | def SplitWords(*args):
"""
SplitWords(TChA ChA, TVec< char * > & WrdV, bool const & SplitOnWs=True) -> int
Parameters:
ChA: TChA &
WrdV: TVec< char * > &
SplitOnWs: bool const &
SplitWords(TChA ChA, TVec< char * > & WrdV) -> int
Parameters:
... | [
"def",
"SplitWords",
"(",
"*",
"args",
")",
":",
"return",
"_snap",
".",
"TStrUtil_SplitWords",
"(",
"*",
"args",
")"
] | https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/setup/snap.py#L7068-L7084 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/eclib/ctrlbox.py | python | SegmentBar.OnLeftDown | (self, evt) | Handle clicks on the bar
@param evt: wx.MouseEvent | Handle clicks on the bar
@param evt: wx.MouseEvent | [
"Handle",
"clicks",
"on",
"the",
"bar",
"@param",
"evt",
":",
"wx",
".",
"MouseEvent"
] | def OnLeftDown(self, evt):
"""Handle clicks on the bar
@param evt: wx.MouseEvent
"""
epos = evt.GetPosition()
index = self.GetIndexFromPosition(epos)
if index != wx.NOT_FOUND:
button = self._buttons[index]
pre = self._selected
self._se... | [
"def",
"OnLeftDown",
"(",
"self",
",",
"evt",
")",
":",
"epos",
"=",
"evt",
".",
"GetPosition",
"(",
")",
"index",
"=",
"self",
".",
"GetIndexFromPosition",
"(",
"epos",
")",
"if",
"index",
"!=",
"wx",
".",
"NOT_FOUND",
":",
"button",
"=",
"self",
".... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/eclib/ctrlbox.py#L958-L984 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/AWS/resource-manager-code/lib/setuptools/_vendor/pyparsing.py | python | matchOnlyAtCol | (n) | return verifyCol | Helper method for defining parse actions that require matching at a specific
column in the input text. | Helper method for defining parse actions that require matching at a specific
column in the input text. | [
"Helper",
"method",
"for",
"defining",
"parse",
"actions",
"that",
"require",
"matching",
"at",
"a",
"specific",
"column",
"in",
"the",
"input",
"text",
"."
] | def matchOnlyAtCol(n):
"""
Helper method for defining parse actions that require matching at a specific
column in the input text.
"""
def verifyCol(strg,locn,toks):
if col(locn,strg) != n:
raise ParseException(strg,locn,"matched token not at column %d" % n)
return verifyCol | [
"def",
"matchOnlyAtCol",
"(",
"n",
")",
":",
"def",
"verifyCol",
"(",
"strg",
",",
"locn",
",",
"toks",
")",
":",
"if",
"col",
"(",
"locn",
",",
"strg",
")",
"!=",
"n",
":",
"raise",
"ParseException",
"(",
"strg",
",",
"locn",
",",
"\"matched token n... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/AWS/resource-manager-code/lib/setuptools/_vendor/pyparsing.py#L4787-L4795 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/layers/base.py | python | Layer.build | (self, _) | Creates the variables of the layer. | Creates the variables of the layer. | [
"Creates",
"the",
"variables",
"of",
"the",
"layer",
"."
] | def build(self, _):
"""Creates the variables of the layer."""
self.built = True | [
"def",
"build",
"(",
"self",
",",
"_",
")",
":",
"self",
".",
"built",
"=",
"True"
] | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/layers/base.py#L363-L365 | ||
KhronosGroup/SPIR | f33c27876d9f3d5810162b60fa89cc13d2b55725 | bindings/python/clang/cindex.py | python | CursorKind.is_invalid | (self) | return conf.lib.clang_isInvalid(self) | Test if this is an invalid kind. | Test if this is an invalid kind. | [
"Test",
"if",
"this",
"is",
"an",
"invalid",
"kind",
"."
] | def is_invalid(self):
"""Test if this is an invalid kind."""
return conf.lib.clang_isInvalid(self) | [
"def",
"is_invalid",
"(",
"self",
")",
":",
"return",
"conf",
".",
"lib",
".",
"clang_isInvalid",
"(",
"self",
")"
] | https://github.com/KhronosGroup/SPIR/blob/f33c27876d9f3d5810162b60fa89cc13d2b55725/bindings/python/clang/cindex.py#L539-L541 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/AWS/resource-manager-code/lib/jsonschema/validators.py | python | validator_for | (schema, default=_LATEST_VERSION) | return meta_schemas.get(schema[u"$schema"], _LATEST_VERSION) | Retrieve the validator class appropriate for validating the given schema.
Uses the :validator:`$schema` property that should be present in the
given schema to look up the appropriate validator class.
Arguments:
schema (collections.Mapping or bool):
the schema to look at
defa... | Retrieve the validator class appropriate for validating the given schema. | [
"Retrieve",
"the",
"validator",
"class",
"appropriate",
"for",
"validating",
"the",
"given",
"schema",
"."
] | def validator_for(schema, default=_LATEST_VERSION):
"""
Retrieve the validator class appropriate for validating the given schema.
Uses the :validator:`$schema` property that should be present in the
given schema to look up the appropriate validator class.
Arguments:
schema (collections.Ma... | [
"def",
"validator_for",
"(",
"schema",
",",
"default",
"=",
"_LATEST_VERSION",
")",
":",
"if",
"schema",
"is",
"True",
"or",
"schema",
"is",
"False",
"or",
"u\"$schema\"",
"not",
"in",
"schema",
":",
"return",
"default",
"if",
"schema",
"[",
"u\"$schema\"",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/AWS/resource-manager-code/lib/jsonschema/validators.py#L937-L970 | |
eclipse/sumo | 7132a9b8b6eea734bdec38479026b4d8c4336d03 | tools/contributed/sumopy/coremodules/network/routing.py | python | MaRouter.import_results | (self, results=None) | Imports simulation resuts into results object. | Imports simulation resuts into results object. | [
"Imports",
"simulation",
"resuts",
"into",
"results",
"object",
"."
] | def import_results(self, results=None):
"""
Imports simulation resuts into results object.
"""
print 'import_results of marouter'
if results is None:
results = self._results
if results is None:
results = self.parent.simulation.results
... | [
"def",
"import_results",
"(",
"self",
",",
"results",
"=",
"None",
")",
":",
"print",
"'import_results of marouter'",
"if",
"results",
"is",
"None",
":",
"results",
"=",
"self",
".",
"_results",
"if",
"results",
"is",
"None",
":",
"results",
"=",
"self",
"... | https://github.com/eclipse/sumo/blob/7132a9b8b6eea734bdec38479026b4d8c4336d03/tools/contributed/sumopy/coremodules/network/routing.py#L1074-L1091 | ||
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | third_party/python_gflags/gflags.py | python | FlagValues.GetHelp | (self, prefix='') | return '\n'.join(helplist) | Generates a help string for all known flags. | Generates a help string for all known flags. | [
"Generates",
"a",
"help",
"string",
"for",
"all",
"known",
"flags",
"."
] | def GetHelp(self, prefix=''):
"""Generates a help string for all known flags."""
helplist = []
flags_by_module = self.FlagsByModuleDict()
if flags_by_module:
modules = sorted(flags_by_module)
# Print the help for the main module first, if possible.
main_module = _GetMainModule()
... | [
"def",
"GetHelp",
"(",
"self",
",",
"prefix",
"=",
"''",
")",
":",
"helplist",
"=",
"[",
"]",
"flags_by_module",
"=",
"self",
".",
"FlagsByModuleDict",
"(",
")",
"if",
"flags_by_module",
":",
"modules",
"=",
"sorted",
"(",
"flags_by_module",
")",
"# Print ... | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/third_party/python_gflags/gflags.py#L1359-L1387 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/keras/engine/base_layer_utils.py | python | is_subclassed | (layer) | return (layer.__module__.find('keras.engine') == -1 and
layer.__module__.find('keras.layers') == -1) | Returns True if the object is a subclassed layer or subclassed model. | Returns True if the object is a subclassed layer or subclassed model. | [
"Returns",
"True",
"if",
"the",
"object",
"is",
"a",
"subclassed",
"layer",
"or",
"subclassed",
"model",
"."
] | def is_subclassed(layer):
"""Returns True if the object is a subclassed layer or subclassed model."""
return (layer.__module__.find('keras.engine') == -1 and
layer.__module__.find('keras.layers') == -1) | [
"def",
"is_subclassed",
"(",
"layer",
")",
":",
"return",
"(",
"layer",
".",
"__module__",
".",
"find",
"(",
"'keras.engine'",
")",
"==",
"-",
"1",
"and",
"layer",
".",
"__module__",
".",
"find",
"(",
"'keras.layers'",
")",
"==",
"-",
"1",
")"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/keras/engine/base_layer_utils.py#L566-L569 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/tornado/tornado-6/tornado/httputil.py | python | parse_response_start_line | (line: str) | return ResponseStartLine(match.group(1), int(match.group(2)), match.group(3)) | Returns a (version, code, reason) tuple for an HTTP 1.x response line.
The response is a `collections.namedtuple`.
>>> parse_response_start_line("HTTP/1.1 200 OK")
ResponseStartLine(version='HTTP/1.1', code=200, reason='OK') | Returns a (version, code, reason) tuple for an HTTP 1.x response line. | [
"Returns",
"a",
"(",
"version",
"code",
"reason",
")",
"tuple",
"for",
"an",
"HTTP",
"1",
".",
"x",
"response",
"line",
"."
] | def parse_response_start_line(line: str) -> ResponseStartLine:
"""Returns a (version, code, reason) tuple for an HTTP 1.x response line.
The response is a `collections.namedtuple`.
>>> parse_response_start_line("HTTP/1.1 200 OK")
ResponseStartLine(version='HTTP/1.1', code=200, reason='OK')
"""
... | [
"def",
"parse_response_start_line",
"(",
"line",
":",
"str",
")",
"->",
"ResponseStartLine",
":",
"line",
"=",
"native_str",
"(",
"line",
")",
"match",
"=",
"_http_response_line_re",
".",
"match",
"(",
"line",
")",
"if",
"not",
"match",
":",
"raise",
"HTTPIn... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/tornado/tornado-6/tornado/httputil.py#L911-L923 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/postproc.py | python | PostProcessor._populate_generator_info | (self) | Fill `index` for the Yield instruction and create YieldPoints. | Fill `index` for the Yield instruction and create YieldPoints. | [
"Fill",
"index",
"for",
"the",
"Yield",
"instruction",
"and",
"create",
"YieldPoints",
"."
] | def _populate_generator_info(self):
"""
Fill `index` for the Yield instruction and create YieldPoints.
"""
dct = self.func_ir.generator_info.yield_points
assert not dct, 'rerunning _populate_generator_info'
for block in self.func_ir.blocks.values():
for inst i... | [
"def",
"_populate_generator_info",
"(",
"self",
")",
":",
"dct",
"=",
"self",
".",
"func_ir",
".",
"generator_info",
".",
"yield_points",
"assert",
"not",
"dct",
",",
"'rerunning _populate_generator_info'",
"for",
"block",
"in",
"self",
".",
"func_ir",
".",
"blo... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/postproc.py#L97-L111 | ||
fatih/subvim | 241b6d170597857105da219c9b7d36059e9f11fb | vim/base/YouCompleteMe/third_party/requests/requests/packages/urllib3/packages/ordered_dict.py | python | OrderedDict.__init__ | (self, *args, **kwds) | Initialize an ordered dictionary. Signature is the same as for
regular dictionaries, but keyword arguments are not recommended
because their insertion order is arbitrary. | Initialize an ordered dictionary. Signature is the same as for
regular dictionaries, but keyword arguments are not recommended
because their insertion order is arbitrary. | [
"Initialize",
"an",
"ordered",
"dictionary",
".",
"Signature",
"is",
"the",
"same",
"as",
"for",
"regular",
"dictionaries",
"but",
"keyword",
"arguments",
"are",
"not",
"recommended",
"because",
"their",
"insertion",
"order",
"is",
"arbitrary",
"."
] | def __init__(self, *args, **kwds):
'''Initialize an ordered dictionary. Signature is the same as for
regular dictionaries, but keyword arguments are not recommended
because their insertion order is arbitrary.
'''
if len(args) > 1:
raise TypeError('expected at most 1... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwds",
")",
":",
"if",
"len",
"(",
"args",
")",
">",
"1",
":",
"raise",
"TypeError",
"(",
"'expected at most 1 arguments, got %d'",
"%",
"len",
"(",
"args",
")",
")",
"try",
":",
"self... | https://github.com/fatih/subvim/blob/241b6d170597857105da219c9b7d36059e9f11fb/vim/base/YouCompleteMe/third_party/requests/requests/packages/urllib3/packages/ordered_dict.py#L29-L43 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/stc.py | python | StyledTextCtrl.GetLine | (*args, **kwargs) | return _stc.StyledTextCtrl_GetLine(*args, **kwargs) | GetLine(self, int line) -> String
Retrieve the contents of a line. | GetLine(self, int line) -> String | [
"GetLine",
"(",
"self",
"int",
"line",
")",
"-",
">",
"String"
] | def GetLine(*args, **kwargs):
"""
GetLine(self, int line) -> String
Retrieve the contents of a line.
"""
return _stc.StyledTextCtrl_GetLine(*args, **kwargs) | [
"def",
"GetLine",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_stc",
".",
"StyledTextCtrl_GetLine",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/stc.py#L3521-L3527 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py3/pandas/core/generic.py | python | NDFrame._find_valid_index | (self, *, how: str) | return self.index[idxpos] | Retrieves the index of the first valid value.
Parameters
----------
how : {'first', 'last'}
Use this parameter to change between the first or last valid index.
Returns
-------
idx_first_valid : type of index | Retrieves the index of the first valid value. | [
"Retrieves",
"the",
"index",
"of",
"the",
"first",
"valid",
"value",
"."
] | def _find_valid_index(self, *, how: str) -> Hashable | None:
"""
Retrieves the index of the first valid value.
Parameters
----------
how : {'first', 'last'}
Use this parameter to change between the first or last valid index.
Returns
-------
i... | [
"def",
"_find_valid_index",
"(",
"self",
",",
"*",
",",
"how",
":",
"str",
")",
"->",
"Hashable",
"|",
"None",
":",
"idxpos",
"=",
"find_valid_index",
"(",
"self",
".",
"_values",
",",
"how",
"=",
"how",
")",
"if",
"idxpos",
"is",
"None",
":",
"retur... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/core/generic.py#L11010-L11026 | |
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/distributed/fleet/dataset/dataset.py | python | BoxPSDataset._set_parse_logkey | (self, parse_logkey) | Set if Dataset need to parse logkey
Args:
parse_content(bool): if parse logkey or not
Examples:
.. code-block:: python
import paddle
dataset = paddle.distributed.fleet.BoxPSDataset()
dataset._set_parse_logkey(True) | Set if Dataset need to parse logkey | [
"Set",
"if",
"Dataset",
"need",
"to",
"parse",
"logkey"
] | def _set_parse_logkey(self, parse_logkey):
"""
Set if Dataset need to parse logkey
Args:
parse_content(bool): if parse logkey or not
Examples:
.. code-block:: python
import paddle
dataset = paddle.distributed.fleet.BoxPSDataset()
... | [
"def",
"_set_parse_logkey",
"(",
"self",
",",
"parse_logkey",
")",
":",
"self",
".",
"parse_logkey",
"=",
"parse_logkey"
] | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/distributed/fleet/dataset/dataset.py#L1378-L1393 | ||
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/ndarray/numpy/linalg.py | python | svd | (a) | return tuple(_api_internal.svd(a)) | r"""
Singular Value Decomposition.
When `a` is a 2D array, it is factorized as ``ut @ np.diag(s) @ v``,
where `ut` and `v` are 2D orthonormal arrays and `s` is a 1D
array of `a`'s singular values. When `a` is higher-dimensional, SVD is
applied in stacked mode as explained below.
Parameters
... | r"""
Singular Value Decomposition. | [
"r",
"Singular",
"Value",
"Decomposition",
"."
] | def svd(a):
r"""
Singular Value Decomposition.
When `a` is a 2D array, it is factorized as ``ut @ np.diag(s) @ v``,
where `ut` and `v` are 2D orthonormal arrays and `s` is a 1D
array of `a`'s singular values. When `a` is higher-dimensional, SVD is
applied in stacked mode as explained below.
... | [
"def",
"svd",
"(",
"a",
")",
":",
"return",
"tuple",
"(",
"_api_internal",
".",
"svd",
"(",
"a",
")",
")"
] | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/ndarray/numpy/linalg.py#L379-L450 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/distlib/_backport/tarfile.py | python | TarFile._dbg | (self, level, msg) | Write debugging output to sys.stderr. | Write debugging output to sys.stderr. | [
"Write",
"debugging",
"output",
"to",
"sys",
".",
"stderr",
"."
] | def _dbg(self, level, msg):
"""Write debugging output to sys.stderr.
"""
if level <= self.debug:
print(msg, file=sys.stderr) | [
"def",
"_dbg",
"(",
"self",
",",
"level",
",",
"msg",
")",
":",
"if",
"level",
"<=",
"self",
".",
"debug",
":",
"print",
"(",
"msg",
",",
"file",
"=",
"sys",
".",
"stderr",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/distlib/_backport/tarfile.py#L2532-L2536 | ||
Tencent/Pebble | 68315f176d9e328a233ace29b7579a829f89879f | thirdparty/gflags/gflags.py | python | DEFINE_list | (name, default, help, flag_values=FLAGS, **args) | Registers a flag whose value is a comma-separated list of strings. | Registers a flag whose value is a comma-separated list of strings. | [
"Registers",
"a",
"flag",
"whose",
"value",
"is",
"a",
"comma",
"-",
"separated",
"list",
"of",
"strings",
"."
] | def DEFINE_list(name, default, help, flag_values=FLAGS, **args):
"""Registers a flag whose value is a comma-separated list of strings."""
parser = ListParser()
serializer = ListSerializer(',')
DEFINE(parser, name, default, help, flag_values, serializer, **args) | [
"def",
"DEFINE_list",
"(",
"name",
",",
"default",
",",
"help",
",",
"flag_values",
"=",
"FLAGS",
",",
"*",
"*",
"args",
")",
":",
"parser",
"=",
"ListParser",
"(",
")",
"serializer",
"=",
"ListSerializer",
"(",
"','",
")",
"DEFINE",
"(",
"parser",
","... | https://github.com/Tencent/Pebble/blob/68315f176d9e328a233ace29b7579a829f89879f/thirdparty/gflags/gflags.py#L2611-L2615 | ||
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/python/platform/flags.py | python | _define_helper | (flag_name, default_value, docstring, flagtype) | Registers 'flag_name' with 'default_value' and 'docstring'. | Registers 'flag_name' with 'default_value' and 'docstring'. | [
"Registers",
"flag_name",
"with",
"default_value",
"and",
"docstring",
"."
] | def _define_helper(flag_name, default_value, docstring, flagtype):
"""Registers 'flag_name' with 'default_value' and 'docstring'."""
_global_parser.add_argument("--" + flag_name,
default=default_value,
help=docstring,
type=fla... | [
"def",
"_define_helper",
"(",
"flag_name",
",",
"default_value",
",",
"docstring",
",",
"flagtype",
")",
":",
"_global_parser",
".",
"add_argument",
"(",
"\"--\"",
"+",
"flag_name",
",",
"default",
"=",
"default_value",
",",
"help",
"=",
"docstring",
",",
"typ... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/python/platform/flags.py#L53-L58 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_vendor/distlib/_backport/shutil.py | python | rmtree | (path, ignore_errors=False, onerror=None) | Recursively delete a directory tree.
If ignore_errors is set, errors are ignored; otherwise, if onerror
is set, it is called to handle the error with arguments (func,
path, exc_info) where func is os.listdir, os.remove, or os.rmdir;
path is the argument to that function that caused it to fail; and... | Recursively delete a directory tree. | [
"Recursively",
"delete",
"a",
"directory",
"tree",
"."
] | def rmtree(path, ignore_errors=False, onerror=None):
"""Recursively delete a directory tree.
If ignore_errors is set, errors are ignored; otherwise, if onerror
is set, it is called to handle the error with arguments (func,
path, exc_info) where func is os.listdir, os.remove, or os.rmdir;
path... | [
"def",
"rmtree",
"(",
"path",
",",
"ignore_errors",
"=",
"False",
",",
"onerror",
"=",
"None",
")",
":",
"if",
"ignore_errors",
":",
"def",
"onerror",
"(",
"*",
"args",
")",
":",
"pass",
"elif",
"onerror",
"is",
"None",
":",
"def",
"onerror",
"(",
"*... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_vendor/distlib/_backport/shutil.py#L497-L589 | ||
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/python/ops/math_ops.py | python | reduced_shape | (input_shape, axes) | return gen_data_flow_ops.dynamic_stitch( # [2, 1, 1, 7]
[range(input_rank), # [0, 1, 2, 3]
axes], # [1, 2]
[input_shape, # [2, 3, 5, 7]
array_ops.fill(axes_shape, 1)]) | Helper function for reduction ops.
Args:
input_shape: 1-D Tensor, the shape of the Tensor being reduced.
axes: 1-D Tensor, the reduction axes.
Returns:
A 1-D Tensor, the output shape as if keep_dims were set to True. | Helper function for reduction ops. | [
"Helper",
"function",
"for",
"reduction",
"ops",
"."
] | def reduced_shape(input_shape, axes):
"""Helper function for reduction ops.
Args:
input_shape: 1-D Tensor, the shape of the Tensor being reduced.
axes: 1-D Tensor, the reduction axes.
Returns:
A 1-D Tensor, the output shape as if keep_dims were set to True.
"""
# Example:
# cast needed for Spar... | [
"def",
"reduced_shape",
"(",
"input_shape",
",",
"axes",
")",
":",
"# Example:",
"# cast needed for SparseTensor reductions",
"input_shape",
"=",
"to_int32",
"(",
"input_shape",
")",
"# [2, 3, 5, 7]",
"axes",
"=",
"to_int32",
"(",
"axes",
")",
"# [1, 2]",
"input_rank"... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/ops/math_ops.py#L1927-L1948 | |
devpack/android-python27 | d42dd67565e104cf7b0b50eb473f615db3e69901 | python-build-with-qt/PyQt-x11-gpl-4.8/pyuic/uic/driver.py | python | Driver.on_SyntaxError | (self, e) | Handle a SyntaxError exception. | Handle a SyntaxError exception. | [
"Handle",
"a",
"SyntaxError",
"exception",
"."
] | def on_SyntaxError(self, e):
""" Handle a SyntaxError exception. """
sys.stderr.write("Error in input file: %s\n" % e) | [
"def",
"on_SyntaxError",
"(",
"self",
",",
"e",
")",
":",
"sys",
".",
"stderr",
".",
"write",
"(",
"\"Error in input file: %s\\n\"",
"%",
"e",
")"
] | https://github.com/devpack/android-python27/blob/d42dd67565e104cf7b0b50eb473f615db3e69901/python-build-with-qt/PyQt-x11-gpl-4.8/pyuic/uic/driver.py#L75-L78 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/propgrid.py | python | ArrayStringProperty.OnCustomStringEdit | (*args, **kwargs) | return _propgrid.ArrayStringProperty_OnCustomStringEdit(*args, **kwargs) | OnCustomStringEdit(self, Window parent, String value) -> bool | OnCustomStringEdit(self, Window parent, String value) -> bool | [
"OnCustomStringEdit",
"(",
"self",
"Window",
"parent",
"String",
"value",
")",
"-",
">",
"bool"
] | def OnCustomStringEdit(*args, **kwargs):
"""OnCustomStringEdit(self, Window parent, String value) -> bool"""
return _propgrid.ArrayStringProperty_OnCustomStringEdit(*args, **kwargs) | [
"def",
"OnCustomStringEdit",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_propgrid",
".",
"ArrayStringProperty_OnCustomStringEdit",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/propgrid.py#L3139-L3141 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/ops/operations/_grad_ops.py | python | ReciprocalGrad.__init__ | (self) | Initialize ReciprocalGrad | Initialize ReciprocalGrad | [
"Initialize",
"ReciprocalGrad"
] | def __init__(self):
"""Initialize ReciprocalGrad""" | [
"def",
"__init__",
"(",
"self",
")",
":"
] | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/ops/operations/_grad_ops.py#L78-L79 | ||
esphome/esphome | 40e06c9819f17409615d4f4eec5cfe4dc9a3776d | esphome/components/i2c/__init__.py | python | register_i2c_device | (var, config) | Register an i2c device with the given config.
Sets the i2c bus to use and the i2c address.
This is a coroutine, you need to await it with a 'yield' expression! | Register an i2c device with the given config. | [
"Register",
"an",
"i2c",
"device",
"with",
"the",
"given",
"config",
"."
] | async def register_i2c_device(var, config):
"""Register an i2c device with the given config.
Sets the i2c bus to use and the i2c address.
This is a coroutine, you need to await it with a 'yield' expression!
"""
parent = await cg.get_variable(config[CONF_I2C_ID])
cg.add(var.set_i2c_bus(parent))... | [
"async",
"def",
"register_i2c_device",
"(",
"var",
",",
"config",
")",
":",
"parent",
"=",
"await",
"cg",
".",
"get_variable",
"(",
"config",
"[",
"CONF_I2C_ID",
"]",
")",
"cg",
".",
"add",
"(",
"var",
".",
"set_i2c_bus",
"(",
"parent",
")",
")",
"cg",... | https://github.com/esphome/esphome/blob/40e06c9819f17409615d4f4eec5cfe4dc9a3776d/esphome/components/i2c/__init__.py#L103-L112 | ||
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/ndarray/numpy_extension/_op.py | python | softmax | (data, axis=-1, length=None, temperature=None, use_length=False, dtype=None) | r"""Applies the softmax function.
The resulting array contains elements in the range (0,1) and the elements along the given axis sum up to 1.
.. math::
softmax(\mathbf{z/t})_j = \frac{e^{z_j/t}}{\sum_{k=1}^K e^{z_k/t}}
for :math:`j = 1, ..., K`
t is the temperature parameter in softmax functi... | r"""Applies the softmax function. | [
"r",
"Applies",
"the",
"softmax",
"function",
"."
] | def softmax(data, axis=-1, length=None, temperature=None, use_length=False, dtype=None):
r"""Applies the softmax function.
The resulting array contains elements in the range (0,1) and the elements along the given axis sum up to 1.
.. math::
softmax(\mathbf{z/t})_j = \frac{e^{z_j/t}}{\sum_{k=1}^K e^... | [
"def",
"softmax",
"(",
"data",
",",
"axis",
"=",
"-",
"1",
",",
"length",
"=",
"None",
",",
"temperature",
"=",
"None",
",",
"use_length",
"=",
"False",
",",
"dtype",
"=",
"None",
")",
":",
"if",
"dtype",
"and",
"not",
"isinstance",
"(",
"dtype",
"... | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/ndarray/numpy_extension/_op.py#L36-L86 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/distribute/distribute_lib.py | python | ReplicaContextBase.all_reduce | (self, reduce_op, value, options=None) | All-reduces `value` across all replicas.
>>> strategy = tf.distribute.MirroredStrategy(["GPU:0", "GPU:1"])
>>> def step_fn():
... ctx = tf.distribute.get_replica_context()
... value = tf.identity(1.)
... return ctx.all_reduce(tf.distribute.ReduceOp.SUM, value)
>>> strategy.experimental_lo... | All-reduces `value` across all replicas. | [
"All",
"-",
"reduces",
"value",
"across",
"all",
"replicas",
"."
] | def all_reduce(self, reduce_op, value, options=None):
"""All-reduces `value` across all replicas.
>>> strategy = tf.distribute.MirroredStrategy(["GPU:0", "GPU:1"])
>>> def step_fn():
... ctx = tf.distribute.get_replica_context()
... value = tf.identity(1.)
... return ctx.all_reduce(tf.dis... | [
"def",
"all_reduce",
"(",
"self",
",",
"reduce_op",
",",
"value",
",",
"options",
"=",
"None",
")",
":",
"flattened_value",
"=",
"nest",
".",
"flatten",
"(",
"value",
")",
"has_indexed_slices",
"=",
"False",
"for",
"v",
"in",
"flattened_value",
":",
"if",
... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/distribute/distribute_lib.py#L3171-L3281 | ||
ZintrulCre/LeetCode_Archiver | de23e16ead29336b5ee7aa1898a392a5d6463d27 | LeetCode/python/1065.py | python | Solution.indexPairs | (self, text, words) | return sorted(res) | :type text: str
:type words: List[str]
:rtype: List[List[int]] | :type text: str
:type words: List[str]
:rtype: List[List[int]] | [
":",
"type",
"text",
":",
"str",
":",
"type",
"words",
":",
"List",
"[",
"str",
"]",
":",
"rtype",
":",
"List",
"[",
"List",
"[",
"int",
"]]"
] | def indexPairs(self, text, words):
"""
:type text: str
:type words: List[str]
:rtype: List[List[int]]
"""
res = []
for word in words:
i = 0
j = text.find(word, i)
while j != -1:
res.append([j, j + len(word) - 1])... | [
"def",
"indexPairs",
"(",
"self",
",",
"text",
",",
"words",
")",
":",
"res",
"=",
"[",
"]",
"for",
"word",
"in",
"words",
":",
"i",
"=",
"0",
"j",
"=",
"text",
".",
"find",
"(",
"word",
",",
"i",
")",
"while",
"j",
"!=",
"-",
"1",
":",
"re... | https://github.com/ZintrulCre/LeetCode_Archiver/blob/de23e16ead29336b5ee7aa1898a392a5d6463d27/LeetCode/python/1065.py#L2-L16 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/typing/context.py | python | BaseContext.install_registry | (self, registry) | Install a *registry* (a templates.Registry instance) of function,
attribute and global declarations. | Install a *registry* (a templates.Registry instance) of function,
attribute and global declarations. | [
"Install",
"a",
"*",
"registry",
"*",
"(",
"a",
"templates",
".",
"Registry",
"instance",
")",
"of",
"function",
"attribute",
"and",
"global",
"declarations",
"."
] | def install_registry(self, registry):
"""
Install a *registry* (a templates.Registry instance) of function,
attribute and global declarations.
"""
try:
loader = self._registries[registry]
except KeyError:
loader = templates.RegistryLoader(registry)... | [
"def",
"install_registry",
"(",
"self",
",",
"registry",
")",
":",
"try",
":",
"loader",
"=",
"self",
".",
"_registries",
"[",
"registry",
"]",
"except",
"KeyError",
":",
"loader",
"=",
"templates",
".",
"RegistryLoader",
"(",
"registry",
")",
"self",
".",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/typing/context.py#L410-L435 | ||
avast/retdec | b9879088a5f0278508185ec645494e6c5c57a455 | scripts/type_extractor/type_extractor/params_info.py | python | parse_one_param | (param) | return one_param | Function parameter in function declaration needs additional parsing to
detect name and type or when it is array, (pointer to) function. | Function parameter in function declaration needs additional parsing to
detect name and type or when it is array, (pointer to) function. | [
"Function",
"parameter",
"in",
"function",
"declaration",
"needs",
"additional",
"parsing",
"to",
"detect",
"name",
"and",
"type",
"or",
"when",
"it",
"is",
"array",
"(",
"pointer",
"to",
")",
"function",
"."
] | def parse_one_param(param):
"""Function parameter in function declaration needs additional parsing to
detect name and type or when it is array, (pointer to) function.
"""
one_param = Param('', param)
one_param.parse_annotations()
param = one_param.type_text + one_param.name_text
if param.end... | [
"def",
"parse_one_param",
"(",
"param",
")",
":",
"one_param",
"=",
"Param",
"(",
"''",
",",
"param",
")",
"one_param",
".",
"parse_annotations",
"(",
")",
"param",
"=",
"one_param",
".",
"type_text",
"+",
"one_param",
".",
"name_text",
"if",
"param",
".",... | https://github.com/avast/retdec/blob/b9879088a5f0278508185ec645494e6c5c57a455/scripts/type_extractor/type_extractor/params_info.py#L135-L153 | |
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | current/deps/v8/third_party/jinja2/utils.py | python | unicode_urlencode | (obj, charset='utf-8', for_qs=False) | return rv | URL escapes a single bytestring or unicode string with the
given charset if applicable to URL safe quoting under all rules
that need to be considered under all supported Python versions.
If non strings are provided they are converted to their unicode
representation first. | URL escapes a single bytestring or unicode string with the
given charset if applicable to URL safe quoting under all rules
that need to be considered under all supported Python versions. | [
"URL",
"escapes",
"a",
"single",
"bytestring",
"or",
"unicode",
"string",
"with",
"the",
"given",
"charset",
"if",
"applicable",
"to",
"URL",
"safe",
"quoting",
"under",
"all",
"rules",
"that",
"need",
"to",
"be",
"considered",
"under",
"all",
"supported",
"... | def unicode_urlencode(obj, charset='utf-8', for_qs=False):
"""URL escapes a single bytestring or unicode string with the
given charset if applicable to URL safe quoting under all rules
that need to be considered under all supported Python versions.
If non strings are provided they are converted to thei... | [
"def",
"unicode_urlencode",
"(",
"obj",
",",
"charset",
"=",
"'utf-8'",
",",
"for_qs",
"=",
"False",
")",
":",
"if",
"not",
"isinstance",
"(",
"obj",
",",
"string_types",
")",
":",
"obj",
"=",
"text_type",
"(",
"obj",
")",
"if",
"isinstance",
"(",
"obj... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/current/deps/v8/third_party/jinja2/utils.py#L287-L303 | |
nasa/fprime | 595cf3682d8365943d86c1a6fe7c78f0a116acf0 | Autocoders/Python/src/fprime_ac/parsers/XmlPortsParser.py | python | XmlPortsParser.get_args | (self) | return self.__args | Returns a list of arg objects with all text and attrib needed. | Returns a list of arg objects with all text and attrib needed. | [
"Returns",
"a",
"list",
"of",
"arg",
"objects",
"with",
"all",
"text",
"and",
"attrib",
"needed",
"."
] | def get_args(self):
"""
Returns a list of arg objects with all text and attrib needed.
"""
return self.__args | [
"def",
"get_args",
"(",
"self",
")",
":",
"return",
"self",
".",
"__args"
] | https://github.com/nasa/fprime/blob/595cf3682d8365943d86c1a6fe7c78f0a116acf0/Autocoders/Python/src/fprime_ac/parsers/XmlPortsParser.py#L245-L249 | |
gnuradio/gnuradio | 09c3c4fa4bfb1a02caac74cb5334dfe065391e3b | gnuradio-runtime/python/gnuradio/gr/top_block.py | python | top_block.__init__ | (self, name="top_block", catch_exceptions=True) | Create a top block with a given name. | Create a top block with a given name. | [
"Create",
"a",
"top",
"block",
"with",
"a",
"given",
"name",
"."
] | def __init__(self, name="top_block", catch_exceptions=True):
"""
Create a top block with a given name.
"""
# not calling hier_block2.__init__, we set our own _impl
self._impl = top_block_pb(name, catch_exceptions)
self.handle_sigint = True | [
"def",
"__init__",
"(",
"self",
",",
"name",
"=",
"\"top_block\"",
",",
"catch_exceptions",
"=",
"True",
")",
":",
"# not calling hier_block2.__init__, we set our own _impl",
"self",
".",
"_impl",
"=",
"top_block_pb",
"(",
"name",
",",
"catch_exceptions",
")",
"self... | https://github.com/gnuradio/gnuradio/blob/09c3c4fa4bfb1a02caac74cb5334dfe065391e3b/gnuradio-runtime/python/gnuradio/gr/top_block.py#L88-L94 | ||
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | torch/nn/modules/module.py | python | Module.double | (self: T) | return self._apply(lambda t: t.double() if t.is_floating_point() else t) | r"""Casts all floating point parameters and buffers to ``double`` datatype.
.. note::
This method modifies the module in-place.
Returns:
Module: self | r"""Casts all floating point parameters and buffers to ``double`` datatype. | [
"r",
"Casts",
"all",
"floating",
"point",
"parameters",
"and",
"buffers",
"to",
"double",
"datatype",
"."
] | def double(self: T) -> T:
r"""Casts all floating point parameters and buffers to ``double`` datatype.
.. note::
This method modifies the module in-place.
Returns:
Module: self
"""
return self._apply(lambda t: t.double() if t.is_floating_point() else t) | [
"def",
"double",
"(",
"self",
":",
"T",
")",
"->",
"T",
":",
"return",
"self",
".",
"_apply",
"(",
"lambda",
"t",
":",
"t",
".",
"double",
"(",
")",
"if",
"t",
".",
"is_floating_point",
"(",
")",
"else",
"t",
")"
] | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/torch/nn/modules/module.py#L746-L755 | |
NVlabs/cule | d66712ec5cba2f80c9bbc7fd1d108bbe67b886ca | torchcule/atari/env.py | python | Env.step | (self, player_a_actions, player_b_actions=None, asyn=False) | return self.observations1, self.rewards, self.done, info | Take a step in the environment by apply a set of actions
Args:
actions (list[Action]): list of actions to apply to each environment
Returns:
ByteTensor: observations for each environment
IntTensor: sum of rewards for frameskip steps in each environment
B... | Take a step in the environment by apply a set of actions | [
"Take",
"a",
"step",
"in",
"the",
"environment",
"by",
"apply",
"a",
"set",
"of",
"actions"
] | def step(self, player_a_actions, player_b_actions=None, asyn=False):
"""Take a step in the environment by apply a set of actions
Args:
actions (list[Action]): list of actions to apply to each environment
Returns:
ByteTensor: observations for each environment
... | [
"def",
"step",
"(",
"self",
",",
"player_a_actions",
",",
"player_b_actions",
"=",
"None",
",",
"asyn",
"=",
"False",
")",
":",
"# sanity checks",
"assert",
"player_a_actions",
".",
"size",
"(",
"0",
")",
"==",
"self",
".",
"num_envs",
"self",
".",
"reward... | https://github.com/NVlabs/cule/blob/d66712ec5cba2f80c9bbc7fd1d108bbe67b886ca/torchcule/atari/env.py#L256-L307 | |
generalized-intelligence/GAAS | 29ab17d3e8a4ba18edef3a57c36d8db6329fac73 | deprecated/algorithms/sfm/OpenSfM/opensfm/reconstruction.py | python | resect | (graph, reconstruction, shot_id,
camera, metadata, threshold, min_inliers) | Try resecting and adding a shot to the reconstruction.
Return:
True on success. | Try resecting and adding a shot to the reconstruction. | [
"Try",
"resecting",
"and",
"adding",
"a",
"shot",
"to",
"the",
"reconstruction",
"."
] | def resect(graph, reconstruction, shot_id,
camera, metadata, threshold, min_inliers):
"""Try resecting and adding a shot to the reconstruction.
Return:
True on success.
"""
bs = []
Xs = []
for track in graph[shot_id]:
if track in reconstruction.points:
x ... | [
"def",
"resect",
"(",
"graph",
",",
"reconstruction",
",",
"shot_id",
",",
"camera",
",",
"metadata",
",",
"threshold",
",",
"min_inliers",
")",
":",
"bs",
"=",
"[",
"]",
"Xs",
"=",
"[",
"]",
"for",
"track",
"in",
"graph",
"[",
"shot_id",
"]",
":",
... | https://github.com/generalized-intelligence/GAAS/blob/29ab17d3e8a4ba18edef3a57c36d8db6329fac73/deprecated/algorithms/sfm/OpenSfM/opensfm/reconstruction.py#L712-L764 | ||
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | deps/src/libxml2-2.9.1/python/libxml2.py | python | SAXCallback.endElement | (self, tag) | called at the start of every element, tag is the name of
the element | called at the start of every element, tag is the name of
the element | [
"called",
"at",
"the",
"start",
"of",
"every",
"element",
"tag",
"is",
"the",
"name",
"of",
"the",
"element"
] | def endElement(self, tag):
"""called at the start of every element, tag is the name of
the element"""
pass | [
"def",
"endElement",
"(",
"self",
",",
"tag",
")",
":",
"pass"
] | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/deps/src/libxml2-2.9.1/python/libxml2.py#L177-L180 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/requests/auth.py | python | HTTPDigestAuth.build_digest_header | (self, method, url) | return 'Digest %s' % (base) | :rtype: str | :rtype: str | [
":",
"rtype",
":",
"str"
] | def build_digest_header(self, method, url):
"""
:rtype: str
"""
realm = self._thread_local.chal['realm']
nonce = self._thread_local.chal['nonce']
qop = self._thread_local.chal.get('qop')
algorithm = self._thread_local.chal.get('algorithm')
opaque = self._... | [
"def",
"build_digest_header",
"(",
"self",
",",
"method",
",",
"url",
")",
":",
"realm",
"=",
"self",
".",
"_thread_local",
".",
"chal",
"[",
"'realm'",
"]",
"nonce",
"=",
"self",
".",
"_thread_local",
".",
"chal",
"[",
"'nonce'",
"]",
"qop",
"=",
"sel... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/requests/auth.py#L127-L215 | |
eclipse/sumo | 7132a9b8b6eea734bdec38479026b4d8c4336d03 | tools/traci/main.py | python | setOrder | (order) | return _connections[""].setOrder(order) | Tells TraCI to give the current client the given position in the
execution order. It is mandatory to send this as the first command after
connecting to the TraCI server when using multiple clients. Each client
must be assigned a unique integer but there are not further restrictions
on numbering. | Tells TraCI to give the current client the given position in the
execution order. It is mandatory to send this as the first command after
connecting to the TraCI server when using multiple clients. Each client
must be assigned a unique integer but there are not further restrictions
on numbering. | [
"Tells",
"TraCI",
"to",
"give",
"the",
"current",
"client",
"the",
"given",
"position",
"in",
"the",
"execution",
"order",
".",
"It",
"is",
"mandatory",
"to",
"send",
"this",
"as",
"the",
"first",
"command",
"after",
"connecting",
"to",
"the",
"TraCI",
"se... | def setOrder(order):
"""
Tells TraCI to give the current client the given position in the
execution order. It is mandatory to send this as the first command after
connecting to the TraCI server when using multiple clients. Each client
must be assigned a unique integer but there are not further restr... | [
"def",
"setOrder",
"(",
"order",
")",
":",
"if",
"\"\"",
"not",
"in",
"_connections",
":",
"raise",
"FatalTraCIError",
"(",
"\"Not connected.\"",
")",
"return",
"_connections",
"[",
"\"\"",
"]",
".",
"setOrder",
"(",
"order",
")"
] | https://github.com/eclipse/sumo/blob/7132a9b8b6eea734bdec38479026b4d8c4336d03/tools/traci/main.py#L265-L275 | |
LiquidPlayer/LiquidCore | 9405979363f2353ac9a71ad8ab59685dd7f919c9 | deps/node-10.15.3/tools/jinja2/utils.py | python | LRUCache.keys | (self) | return list(self) | Return a list of all keys ordered by most recent usage. | Return a list of all keys ordered by most recent usage. | [
"Return",
"a",
"list",
"of",
"all",
"keys",
"ordered",
"by",
"most",
"recent",
"usage",
"."
] | def keys(self):
"""Return a list of all keys ordered by most recent usage."""
return list(self) | [
"def",
"keys",
"(",
"self",
")",
":",
"return",
"list",
"(",
"self",
")"
] | https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/node-10.15.3/tools/jinja2/utils.py#L462-L464 | |
luliyucoordinate/Leetcode | 96afcdc54807d1d184e881a075d1dbf3371e31fb | src/0114-Flatten-Binary-Tree-to-Linked-List/0114.py | python | Solution.flatten | (self, root) | :type root: TreeNode
:rtype: void Do not return anything, modify root in-place instead. | :type root: TreeNode
:rtype: void Do not return anything, modify root in-place instead. | [
":",
"type",
"root",
":",
"TreeNode",
":",
"rtype",
":",
"void",
"Do",
"not",
"return",
"anything",
"modify",
"root",
"in",
"-",
"place",
"instead",
"."
] | def flatten(self, root):
"""
:type root: TreeNode
:rtype: void Do not return anything, modify root in-place instead.
"""
cur = root
while cur:
if cur.left:
pre = cur.left
while pre.right:
pre = pre.right
... | [
"def",
"flatten",
"(",
"self",
",",
"root",
")",
":",
"cur",
"=",
"root",
"while",
"cur",
":",
"if",
"cur",
".",
"left",
":",
"pre",
"=",
"cur",
".",
"left",
"while",
"pre",
".",
"right",
":",
"pre",
"=",
"pre",
".",
"right",
"pre",
".",
"right... | https://github.com/luliyucoordinate/Leetcode/blob/96afcdc54807d1d184e881a075d1dbf3371e31fb/src/0114-Flatten-Binary-Tree-to-Linked-List/0114.py#L2-L17 | ||
qboticslabs/mastering_ros | d83e78f30acc45b0f18522c1d5fae3a7f52974b9 | chapter_10_codes/seven_dof_arm_gazebo/scripts/pick_and_place_both_working_good.py | python | CokeCanPickAndPlace._publish_places | (self, places) | Publish places as poses, using a PoseArray message | Publish places as poses, using a PoseArray message | [
"Publish",
"places",
"as",
"poses",
"using",
"a",
"PoseArray",
"message"
] | def _publish_places(self, places):
"""
Publish places as poses, using a PoseArray message
"""
if self._places_pub.get_num_connections() > 0:
msg = PoseArray()
msg.header.frame_id = self._robot.get_planning_frame()
msg.header.stamp = rospy.Time.now()
... | [
"def",
"_publish_places",
"(",
"self",
",",
"places",
")",
":",
"if",
"self",
".",
"_places_pub",
".",
"get_num_connections",
"(",
")",
">",
"0",
":",
"msg",
"=",
"PoseArray",
"(",
")",
"msg",
".",
"header",
".",
"frame_id",
"=",
"self",
".",
"_robot",... | https://github.com/qboticslabs/mastering_ros/blob/d83e78f30acc45b0f18522c1d5fae3a7f52974b9/chapter_10_codes/seven_dof_arm_gazebo/scripts/pick_and_place_both_working_good.py#L368-L381 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/contrib/data/python/ops/dataset_ops.py | python | Dataset.repeat | (self, count=None) | return Dataset(dataset_ops.RepeatDataset(self._dataset, count)) | Repeats this dataset `count` times.
Args:
count: (Optional.) A `tf.int64` scalar `tf.Tensor`, representing the
number of times the elements of this dataset should be repeated. The
default behavior (if `count` is `None` or `-1`) is for the elements to
be repeated indefinitely.
Ret... | Repeats this dataset `count` times. | [
"Repeats",
"this",
"dataset",
"count",
"times",
"."
] | def repeat(self, count=None):
"""Repeats this dataset `count` times.
Args:
count: (Optional.) A `tf.int64` scalar `tf.Tensor`, representing the
number of times the elements of this dataset should be repeated. The
default behavior (if `count` is `None` or `-1`) is for the elements to
... | [
"def",
"repeat",
"(",
"self",
",",
"count",
"=",
"None",
")",
":",
"return",
"Dataset",
"(",
"dataset_ops",
".",
"RepeatDataset",
"(",
"self",
".",
"_dataset",
",",
"count",
")",
")"
] | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/data/python/ops/dataset_ops.py#L276-L288 | |
ablab/quast | 5f6709528129a6ad266a6b24ef3f40b88f0fe04b | quast_libs/optimal_assembly.py | python | scaffolding | (regions, region_pairing) | return ref_coords_to_output | INPUT:
-- list of unique_covered_regions
-- pairs of region IDs in format [(s1, e1), (s2, e2), ...], sorted with default tuple sorting
OUTPUT: reference coordinates to extract as scaffolds | INPUT:
-- list of unique_covered_regions
-- pairs of region IDs in format [(s1, e1), (s2, e2), ...], sorted with default tuple sorting
OUTPUT: reference coordinates to extract as scaffolds | [
"INPUT",
":",
"--",
"list",
"of",
"unique_covered_regions",
"--",
"pairs",
"of",
"region",
"IDs",
"in",
"format",
"[",
"(",
"s1",
"e1",
")",
"(",
"s2",
"e2",
")",
"...",
"]",
"sorted",
"with",
"default",
"tuple",
"sorting",
"OUTPUT",
":",
"reference",
... | def scaffolding(regions, region_pairing):
'''
INPUT:
-- list of unique_covered_regions
-- pairs of region IDs in format [(s1, e1), (s2, e2), ...], sorted with default tuple sorting
OUTPUT: reference coordinates to extract as scaffolds
'''
if not region_pairing: # no scaffolding, so out... | [
"def",
"scaffolding",
"(",
"regions",
",",
"region_pairing",
")",
":",
"if",
"not",
"region_pairing",
":",
"# no scaffolding, so output existing regions \"as is\"",
"ref_coords_to_output",
"=",
"regions",
"else",
":",
"ref_coords_to_output",
"=",
"regions",
"[",
":",
"r... | https://github.com/ablab/quast/blob/5f6709528129a6ad266a6b24ef3f40b88f0fe04b/quast_libs/optimal_assembly.py#L188-L216 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/setuptools/py3/setuptools/_distutils/config.py | python | PyPIRCCommand.finalize_options | (self) | Finalizes options. | Finalizes options. | [
"Finalizes",
"options",
"."
] | def finalize_options(self):
"""Finalizes options."""
if self.repository is None:
self.repository = self.DEFAULT_REPOSITORY
if self.realm is None:
self.realm = self.DEFAULT_REALM | [
"def",
"finalize_options",
"(",
"self",
")",
":",
"if",
"self",
".",
"repository",
"is",
"None",
":",
"self",
".",
"repository",
"=",
"self",
".",
"DEFAULT_REPOSITORY",
"if",
"self",
".",
"realm",
"is",
"None",
":",
"self",
".",
"realm",
"=",
"self",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/setuptools/py3/setuptools/_distutils/config.py#L125-L130 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_gdi.py | python | Font.SetPixelSize | (*args, **kwargs) | return _gdi_.Font_SetPixelSize(*args, **kwargs) | SetPixelSize(self, Size pixelSize)
Sets the size in pixels rather than points. If there is platform API
support for this then it is used, otherwise a font with the closest
size is found using a binary search. | SetPixelSize(self, Size pixelSize) | [
"SetPixelSize",
"(",
"self",
"Size",
"pixelSize",
")"
] | def SetPixelSize(*args, **kwargs):
"""
SetPixelSize(self, Size pixelSize)
Sets the size in pixels rather than points. If there is platform API
support for this then it is used, otherwise a font with the closest
size is found using a binary search.
"""
return _gd... | [
"def",
"SetPixelSize",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"Font_SetPixelSize",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_gdi.py#L2305-L2313 | |
eclipse/sumo | 7132a9b8b6eea734bdec38479026b4d8c4336d03 | tools/osmWebWizard.py | python | Builder.makeConfigFile | (self) | Save the configuration for SUMO in a file | Save the configuration for SUMO in a file | [
"Save",
"the",
"configuration",
"for",
"SUMO",
"in",
"a",
"file"
] | def makeConfigFile(self):
"Save the configuration for SUMO in a file"
self.report("Generating configuration file")
self.filename("guisettings", ".view.xml")
with open(self.files["guisettings"], 'w') as f:
if self.data["decal"] and not self.decalError:
f.writ... | [
"def",
"makeConfigFile",
"(",
"self",
")",
":",
"self",
".",
"report",
"(",
"\"Generating configuration file\"",
")",
"self",
".",
"filename",
"(",
"\"guisettings\"",
",",
"\".view.xml\"",
")",
"with",
"open",
"(",
"self",
".",
"files",
"[",
"\"guisettings\"",
... | https://github.com/eclipse/sumo/blob/7132a9b8b6eea734bdec38479026b4d8c4336d03/tools/osmWebWizard.py#L369-L406 | ||
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/python/ops/image_ops.py | python | per_image_whitening | (image) | return image | Linearly scales `image` to have zero mean and unit norm.
This op computes `(x - mean) / adjusted_stddev`, where `mean` is the average
of all values in image, and
`adjusted_stddev = max(stddev, 1.0/sqrt(image.NumElements()))`.
`stddev` is the standard deviation of all values in `image`. It is capped
away fro... | Linearly scales `image` to have zero mean and unit norm. | [
"Linearly",
"scales",
"image",
"to",
"have",
"zero",
"mean",
"and",
"unit",
"norm",
"."
] | def per_image_whitening(image):
"""Linearly scales `image` to have zero mean and unit norm.
This op computes `(x - mean) / adjusted_stddev`, where `mean` is the average
of all values in image, and
`adjusted_stddev = max(stddev, 1.0/sqrt(image.NumElements()))`.
`stddev` is the standard deviation of all value... | [
"def",
"per_image_whitening",
"(",
"image",
")",
":",
"image",
"=",
"ops",
".",
"convert_to_tensor",
"(",
"image",
",",
"name",
"=",
"'image'",
")",
"_Check3DImage",
"(",
"image",
",",
"require_static",
"=",
"False",
")",
"num_pixels",
"=",
"math_ops",
".",
... | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/python/ops/image_ops.py#L813-L855 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/interpolate/polyint.py | python | _Interpolator1D.__call__ | (self, x) | return self._finish_y(y, x_shape) | Evaluate the interpolant
Parameters
----------
x : array_like
Points to evaluate the interpolant at.
Returns
-------
y : array_like
Interpolated values. Shape is determined by replacing
the interpolation axis in the original array wit... | Evaluate the interpolant | [
"Evaluate",
"the",
"interpolant"
] | def __call__(self, x):
"""
Evaluate the interpolant
Parameters
----------
x : array_like
Points to evaluate the interpolant at.
Returns
-------
y : array_like
Interpolated values. Shape is determined by replacing
the i... | [
"def",
"__call__",
"(",
"self",
",",
"x",
")",
":",
"x",
",",
"x_shape",
"=",
"self",
".",
"_prepare_x",
"(",
"x",
")",
"y",
"=",
"self",
".",
"_evaluate",
"(",
"x",
")",
"return",
"self",
".",
"_finish_y",
"(",
"y",
",",
"x_shape",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/interpolate/polyint.py#L62-L80 | |
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Path/PathScripts/PathWaterline.py | python | ObjectWaterline._experimentalWaterlineOp | (self, JOB, obj, mdlIdx, subShp=None) | return commands | _waterlineOp(JOB, obj, mdlIdx, subShp=None) ...
Main waterline function to perform waterline extraction from model. | _waterlineOp(JOB, obj, mdlIdx, subShp=None) ...
Main waterline function to perform waterline extraction from model. | [
"_waterlineOp",
"(",
"JOB",
"obj",
"mdlIdx",
"subShp",
"=",
"None",
")",
"...",
"Main",
"waterline",
"function",
"to",
"perform",
"waterline",
"extraction",
"from",
"model",
"."
] | def _experimentalWaterlineOp(self, JOB, obj, mdlIdx, subShp=None):
"""_waterlineOp(JOB, obj, mdlIdx, subShp=None) ...
Main waterline function to perform waterline extraction from model."""
PathLog.debug("_experimentalWaterlineOp()")
commands = []
base = JOB.Model.Group[mdlIdx]
... | [
"def",
"_experimentalWaterlineOp",
"(",
"self",
",",
"JOB",
",",
"obj",
",",
"mdlIdx",
",",
"subShp",
"=",
"None",
")",
":",
"PathLog",
".",
"debug",
"(",
"\"_experimentalWaterlineOp()\"",
")",
"commands",
"=",
"[",
"]",
"base",
"=",
"JOB",
".",
"Model",
... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Path/PathScripts/PathWaterline.py#L1730-L1883 | |
google/gemmlowp | e844ffd17118c1e17d94e1ba4354c075a4577b88 | meta/generators/transform_kernels_arm_32.py | python | Main | () | . | . | [
"."
] | def Main():
"""."""
cc = cc_emitter.CCEmitter()
common.GenerateHeader(cc, 'gemmlowp_meta_transform_kernels_arm_32',
'GEMMLOWP_NEON_32')
cc.EmitNamespaceBegin('gemmlowp')
cc.EmitNamespaceBegin('meta')
cc.EmitNewline()
transform_kernels_common.GenerateKernels(cc,
... | [
"def",
"Main",
"(",
")",
":",
"cc",
"=",
"cc_emitter",
".",
"CCEmitter",
"(",
")",
"common",
".",
"GenerateHeader",
"(",
"cc",
",",
"'gemmlowp_meta_transform_kernels_arm_32'",
",",
"'GEMMLOWP_NEON_32'",
")",
"cc",
".",
"EmitNamespaceBegin",
"(",
"'gemmlowp'",
")... | https://github.com/google/gemmlowp/blob/e844ffd17118c1e17d94e1ba4354c075a4577b88/meta/generators/transform_kernels_arm_32.py#L22-L40 | ||
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/four-divisors.py | python | Solution2.sumFourDivisors | (self, nums) | return result | :type nums: List[int]
:rtype: int | :type nums: List[int]
:rtype: int | [
":",
"type",
"nums",
":",
"List",
"[",
"int",
"]",
":",
"rtype",
":",
"int"
] | def sumFourDivisors(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
def factorize(x):
result = []
d = 2
while d*d <= x:
e = 0
while x%d == 0:
x //= d
e += 1
... | [
"def",
"sumFourDivisors",
"(",
"self",
",",
"nums",
")",
":",
"def",
"factorize",
"(",
"x",
")",
":",
"result",
"=",
"[",
"]",
"d",
"=",
"2",
"while",
"d",
"*",
"d",
"<=",
"x",
":",
"e",
"=",
"0",
"while",
"x",
"%",
"d",
"==",
"0",
":",
"x"... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/four-divisors.py#L34-L62 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/lib/utils.py | python | _lookfor_generate_cache | (module, import_modules, regenerate) | return cache | Generate docstring cache for given module.
Parameters
----------
module : str, None, module
Module for which to generate docstring cache
import_modules : bool
Whether to import sub-modules in packages.
regenerate : bool
Re-generate the docstring cache
Returns
------... | Generate docstring cache for given module. | [
"Generate",
"docstring",
"cache",
"for",
"given",
"module",
"."
] | def _lookfor_generate_cache(module, import_modules, regenerate):
"""
Generate docstring cache for given module.
Parameters
----------
module : str, None, module
Module for which to generate docstring cache
import_modules : bool
Whether to import sub-modules in packages.
rege... | [
"def",
"_lookfor_generate_cache",
"(",
"module",
",",
"import_modules",
",",
"regenerate",
")",
":",
"global",
"_lookfor_caches",
"# Local import to speed up numpy's import time.",
"import",
"inspect",
"if",
"sys",
".",
"version_info",
"[",
"0",
"]",
">=",
"3",
":",
... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/lib/utils.py#L794-L935 | |
htcondor/htcondor | 4829724575176d1d6c936e4693dfd78a728569b0 | src/condor_contrib/condor_pigeon/src/condor_pigeon_client/skype_linux_tools/Skype4Py/conversion.py | python | IConversion.ConnectionStatusToText | (self, Status) | return self._ToText('con', Status) | Returns connection status as text.
@param Status: Connection status.
@type Status: L{Connection status<enums.conUnknown>}
@return: Text describing the connection status.
@rtype: unicode | Returns connection status as text. | [
"Returns",
"connection",
"status",
"as",
"text",
"."
] | def ConnectionStatusToText(self, Status):
'''Returns connection status as text.
@param Status: Connection status.
@type Status: L{Connection status<enums.conUnknown>}
@return: Text describing the connection status.
@rtype: unicode
'''
return self._ToText('con', S... | [
"def",
"ConnectionStatusToText",
"(",
"self",
",",
"Status",
")",
":",
"return",
"self",
".",
"_ToText",
"(",
"'con'",
",",
"Status",
")"
] | https://github.com/htcondor/htcondor/blob/4829724575176d1d6c936e4693dfd78a728569b0/src/condor_contrib/condor_pigeon/src/condor_pigeon_client/skype_linux_tools/Skype4Py/conversion.py#L158-L166 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/ipython/py2/IPython/paths.py | python | get_ipython_package_dir | () | return py3compat.cast_unicode(ipdir, fs_encoding) | Get the base directory where IPython itself is installed. | Get the base directory where IPython itself is installed. | [
"Get",
"the",
"base",
"directory",
"where",
"IPython",
"itself",
"is",
"installed",
"."
] | def get_ipython_package_dir():
"""Get the base directory where IPython itself is installed."""
ipdir = os.path.dirname(IPython.__file__)
return py3compat.cast_unicode(ipdir, fs_encoding) | [
"def",
"get_ipython_package_dir",
"(",
")",
":",
"ipdir",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"IPython",
".",
"__file__",
")",
"return",
"py3compat",
".",
"cast_unicode",
"(",
"ipdir",
",",
"fs_encoding",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py2/IPython/paths.py#L89-L92 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/ros_comm/rospy/src/rospy/impl/tcpros_pubsub.py | python | TCPROSHandler.topic_connection_handler | (self, sock, client_addr, header) | Process incoming topic connection. Reads in topic name from
handshake and creates the appropriate L{TCPROSPub} handler for the
connection.
@param sock: socket connection
@type sock: socket.socket
@param client_addr: client address
@type client_addr: (str, int)
@pa... | Process incoming topic connection. Reads in topic name from
handshake and creates the appropriate L{TCPROSPub} handler for the
connection. | [
"Process",
"incoming",
"topic",
"connection",
".",
"Reads",
"in",
"topic",
"name",
"from",
"handshake",
"and",
"creates",
"the",
"appropriate",
"L",
"{",
"TCPROSPub",
"}",
"handler",
"for",
"the",
"connection",
"."
] | def topic_connection_handler(self, sock, client_addr, header):
"""
Process incoming topic connection. Reads in topic name from
handshake and creates the appropriate L{TCPROSPub} handler for the
connection.
@param sock: socket connection
@type sock: socket.socket
@... | [
"def",
"topic_connection_handler",
"(",
"self",
",",
"sock",
",",
"client_addr",
",",
"header",
")",
":",
"if",
"rospy",
".",
"core",
".",
"is_shutdown_requested",
"(",
")",
":",
"return",
"\"Node is shutting down\"",
"for",
"required",
"in",
"[",
"'topic'",
"... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/ros_comm/rospy/src/rospy/impl/tcpros_pubsub.py#L308-L367 | ||
luliyucoordinate/Leetcode | 96afcdc54807d1d184e881a075d1dbf3371e31fb | src/0091-Decode-Ways/0091.py | python | Solution.numDecodings | (self, s) | return mem[-1] | :type s: str
:rtype: int | :type s: str
:rtype: int | [
":",
"type",
"s",
":",
"str",
":",
"rtype",
":",
"int"
] | def numDecodings(self, s):
"""
:type s: str
:rtype: int
"""
if not s or s.startswith('0'):
return 0
if len(s) == 1 and s[0] != '0':
return 1
s_len = len(s)
mem = [0 for _ in range(s_len + 1)]
mem[0] = 1 if s[0] != '0' els... | [
"def",
"numDecodings",
"(",
"self",
",",
"s",
")",
":",
"if",
"not",
"s",
"or",
"s",
".",
"startswith",
"(",
"'0'",
")",
":",
"return",
"0",
"if",
"len",
"(",
"s",
")",
"==",
"1",
"and",
"s",
"[",
"0",
"]",
"!=",
"'0'",
":",
"return",
"1",
... | https://github.com/luliyucoordinate/Leetcode/blob/96afcdc54807d1d184e881a075d1dbf3371e31fb/src/0091-Decode-Ways/0091.py#L2-L24 | |
microsoft/checkedc-clang | a173fefde5d7877b7750e7ce96dd08cf18baebf2 | lldb/third_party/Python/module/pexpect-4.6/pexpect/screen.py | python | screen.set_tab | (self) | Sets a tab at the current position. | Sets a tab at the current position. | [
"Sets",
"a",
"tab",
"at",
"the",
"current",
"position",
"."
] | def set_tab (self): # <ESC>H
'''Sets a tab at the current position.'''
pass | [
"def",
"set_tab",
"(",
"self",
")",
":",
"# <ESC>H",
"pass"
] | https://github.com/microsoft/checkedc-clang/blob/a173fefde5d7877b7750e7ce96dd08cf18baebf2/lldb/third_party/Python/module/pexpect-4.6/pexpect/screen.py#L412-L415 | ||
tensorflow/deepmath | b5b721f54de1d5d6a02d78f5da5995237f9995f9 | deepmath/deephol/train/architectures.py | python | _pad_up_to | (value, size, axis, name=None) | Pad a tensor with zeros on the right along axis to a least the given size.
Args:
value: Tensor to pad.
size: Minimum size along axis.
axis: A nonnegative integer.
name: Optional name for this operation.
Returns:
Padded value. | Pad a tensor with zeros on the right along axis to a least the given size. | [
"Pad",
"a",
"tensor",
"with",
"zeros",
"on",
"the",
"right",
"along",
"axis",
"to",
"a",
"least",
"the",
"given",
"size",
"."
] | def _pad_up_to(value, size, axis, name=None):
"""Pad a tensor with zeros on the right along axis to a least the given size.
Args:
value: Tensor to pad.
size: Minimum size along axis.
axis: A nonnegative integer.
name: Optional name for this operation.
Returns:
Padded value.
"""
with tf.n... | [
"def",
"_pad_up_to",
"(",
"value",
",",
"size",
",",
"axis",
",",
"name",
"=",
"None",
")",
":",
"with",
"tf",
".",
"name_scope",
"(",
"name",
",",
"'pad_up_to'",
")",
"as",
"name",
":",
"value",
"=",
"tf",
".",
"convert_to_tensor",
"(",
"value",
","... | https://github.com/tensorflow/deepmath/blob/b5b721f54de1d5d6a02d78f5da5995237f9995f9/deepmath/deephol/train/architectures.py#L24-L50 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/py/py/_code/code.py | python | Traceback.filter | (self, fn=lambda x: not x.ishidden()) | return Traceback(filter(fn, self)) | return a Traceback instance with certain items removed
fn is a function that gets a single argument, a TracebackItem
instance, and should return True when the item should be added
to the Traceback, False when not
by default this removes all the TracebackItems which are ... | return a Traceback instance with certain items removed | [
"return",
"a",
"Traceback",
"instance",
"with",
"certain",
"items",
"removed"
] | def filter(self, fn=lambda x: not x.ishidden()):
""" return a Traceback instance with certain items removed
fn is a function that gets a single argument, a TracebackItem
instance, and should return True when the item should be added
to the Traceback, False when not
... | [
"def",
"filter",
"(",
"self",
",",
"fn",
"=",
"lambda",
"x",
":",
"not",
"x",
".",
"ishidden",
"(",
")",
")",
":",
"return",
"Traceback",
"(",
"filter",
"(",
"fn",
",",
"self",
")",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/py/py/_code/code.py#L295-L305 | |
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/tools/inspector_protocol/jinja2/filters.py | python | do_round | (value, precision=0, method='common') | return func(value * (10 ** precision)) / (10 ** precision) | Round the number to a given precision. The first
parameter specifies the precision (default is ``0``), the
second the rounding method:
- ``'common'`` rounds either up or down
- ``'ceil'`` always rounds up
- ``'floor'`` always rounds down
If you don't specify a method ``'common'`` is used.
... | Round the number to a given precision. The first
parameter specifies the precision (default is ``0``), the
second the rounding method: | [
"Round",
"the",
"number",
"to",
"a",
"given",
"precision",
".",
"The",
"first",
"parameter",
"specifies",
"the",
"precision",
"(",
"default",
"is",
"0",
")",
"the",
"second",
"the",
"rounding",
"method",
":"
] | def do_round(value, precision=0, method='common'):
"""Round the number to a given precision. The first
parameter specifies the precision (default is ``0``), the
second the rounding method:
- ``'common'`` rounds either up or down
- ``'ceil'`` always rounds up
- ``'floor'`` always rounds down
... | [
"def",
"do_round",
"(",
"value",
",",
"precision",
"=",
"0",
",",
"method",
"=",
"'common'",
")",
":",
"if",
"not",
"method",
"in",
"(",
"'common'",
",",
"'ceil'",
",",
"'floor'",
")",
":",
"raise",
"FilterArgumentError",
"(",
"'method must be common, ceil o... | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/tools/inspector_protocol/jinja2/filters.py#L768-L799 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/tkinter/__init__.py | python | Misc.option_get | (self, name, className) | return self.tk.call('option', 'get', self._w, name, className) | Return the value for an option NAME for this widget
with CLASSNAME.
Values with higher priority override lower values. | Return the value for an option NAME for this widget
with CLASSNAME. | [
"Return",
"the",
"value",
"for",
"an",
"option",
"NAME",
"for",
"this",
"widget",
"with",
"CLASSNAME",
"."
] | def option_get(self, name, className):
"""Return the value for an option NAME for this widget
with CLASSNAME.
Values with higher priority override lower values."""
return self.tk.call('option', 'get', self._w, name, className) | [
"def",
"option_get",
"(",
"self",
",",
"name",
",",
"className",
")",
":",
"return",
"self",
".",
"tk",
".",
"call",
"(",
"'option'",
",",
"'get'",
",",
"self",
".",
"_w",
",",
"name",
",",
"className",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/tkinter/__init__.py#L866-L871 | |
vtraag/leidenalg | b53366829360e10922a2dbf57eb405a516c23bc9 | setup.py | python | get_output_single_line | (args, encoding="utf-8") | return line, returncode | Returns the output of a command returning a single line of output,
stripped from any trailing newlines. | Returns the output of a command returning a single line of output,
stripped from any trailing newlines. | [
"Returns",
"the",
"output",
"of",
"a",
"command",
"returning",
"a",
"single",
"line",
"of",
"output",
"stripped",
"from",
"any",
"trailing",
"newlines",
"."
] | def get_output_single_line(args, encoding="utf-8"):
"""Returns the output of a command returning a single line of output,
stripped from any trailing newlines."""
stdout, returncode = get_output(args, encoding=encoding)
if stdout is not None:
line, _, _ = stdout.partition("\n")
else:
... | [
"def",
"get_output_single_line",
"(",
"args",
",",
"encoding",
"=",
"\"utf-8\"",
")",
":",
"stdout",
",",
"returncode",
"=",
"get_output",
"(",
"args",
",",
"encoding",
"=",
"encoding",
")",
"if",
"stdout",
"is",
"not",
"None",
":",
"line",
",",
"_",
","... | https://github.com/vtraag/leidenalg/blob/b53366829360e10922a2dbf57eb405a516c23bc9/setup.py#L108-L116 | |
vtraag/louvain-igraph | 124ea1be49ee74eec2eaca8006599d7fc5560db6 | src/louvain/Optimiser.py | python | Optimiser.consider_empty_community | (self) | return _c_louvain._Optimiser_get_consider_empty_community(self._optimiser) | boolean: if ``True`` consider also moving nodes to an empty community
(default). | boolean: if ``True`` consider also moving nodes to an empty community
(default). | [
"boolean",
":",
"if",
"True",
"consider",
"also",
"moving",
"nodes",
"to",
"an",
"empty",
"community",
"(",
"default",
")",
"."
] | def consider_empty_community(self):
""" boolean: if ``True`` consider also moving nodes to an empty community
(default). """
return _c_louvain._Optimiser_get_consider_empty_community(self._optimiser) | [
"def",
"consider_empty_community",
"(",
"self",
")",
":",
"return",
"_c_louvain",
".",
"_Optimiser_get_consider_empty_community",
"(",
"self",
".",
"_optimiser",
")"
] | https://github.com/vtraag/louvain-igraph/blob/124ea1be49ee74eec2eaca8006599d7fc5560db6/src/louvain/Optimiser.py#L65-L68 | |
apple/swift-lldb | d74be846ef3e62de946df343e8c234bde93a8912 | examples/python/gdbremote.py | python | TerminalColors.strike | (self, on=True) | return '' | Enable or disable strike through depending on the "on" parameter. | Enable or disable strike through depending on the "on" parameter. | [
"Enable",
"or",
"disable",
"strike",
"through",
"depending",
"on",
"the",
"on",
"parameter",
"."
] | def strike(self, on=True):
'''Enable or disable strike through depending on the "on" parameter.'''
if self.enabled:
if on:
return "\x1b[9m"
else:
return "\x1b[29m"
return '' | [
"def",
"strike",
"(",
"self",
",",
"on",
"=",
"True",
")",
":",
"if",
"self",
".",
"enabled",
":",
"if",
"on",
":",
"return",
"\"\\x1b[9m\"",
"else",
":",
"return",
"\"\\x1b[29m\"",
"return",
"''"
] | https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/examples/python/gdbremote.py#L91-L98 | |
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/transpose-matrix.py | python | Solution2.transpose | (self, A) | return zip(*A) | :type A: List[List[int]]
:rtype: List[List[int]] | :type A: List[List[int]]
:rtype: List[List[int]] | [
":",
"type",
"A",
":",
"List",
"[",
"List",
"[",
"int",
"]]",
":",
"rtype",
":",
"List",
"[",
"List",
"[",
"int",
"]]"
] | def transpose(self, A):
"""
:type A: List[List[int]]
:rtype: List[List[int]]
"""
return zip(*A) | [
"def",
"transpose",
"(",
"self",
",",
"A",
")",
":",
"return",
"zip",
"(",
"*",
"A",
")"
] | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/transpose-matrix.py#L21-L26 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | Framework/PythonInterface/mantid/fitfunctions.py | python | ConvolutionWrapper.__init__ | (self, *args, **kwargs) | Called when creating an instance
**It should not be called directly.**
:param args: names of functions in composite function
:param kwargs: any parameters or attributes that must be passed to the
composite function itself. | Called when creating an instance | [
"Called",
"when",
"creating",
"an",
"instance"
] | def __init__ (self, *args, **kwargs):
"""
Called when creating an instance
**It should not be called directly.**
:param args: names of functions in composite function
:param kwargs: any parameters or attributes that must be passed to the
composite funct... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"pureAddition",
"=",
"False",
"self",
".",
"pureMultiplication",
"=",
"False",
"self",
".",
"initByName",
"(",
"\"Convolution\"",
",",
"*",
"args",
",",
"... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/Framework/PythonInterface/mantid/fitfunctions.py#L690-L702 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/cuda/cudaimpl.py | python | ptx_shfl_sync_i32 | (context, builder, sig, args) | return ret | The NVVM intrinsic for shfl only supports i32, but the cuda intrinsic
function supports both 32 and 64 bit ints and floats, so for feature parity,
i64, f32, and f64 are implemented. Floats by way of bitcasting the float to
an int, then shuffling, then bitcasting back. And 64-bit values by packing
them i... | The NVVM intrinsic for shfl only supports i32, but the cuda intrinsic
function supports both 32 and 64 bit ints and floats, so for feature parity,
i64, f32, and f64 are implemented. Floats by way of bitcasting the float to
an int, then shuffling, then bitcasting back. And 64-bit values by packing
them i... | [
"The",
"NVVM",
"intrinsic",
"for",
"shfl",
"only",
"supports",
"i32",
"but",
"the",
"cuda",
"intrinsic",
"function",
"supports",
"both",
"32",
"and",
"64",
"bit",
"ints",
"and",
"floats",
"so",
"for",
"feature",
"parity",
"i64",
"f32",
"and",
"f64",
"are",... | def ptx_shfl_sync_i32(context, builder, sig, args):
"""
The NVVM intrinsic for shfl only supports i32, but the cuda intrinsic
function supports both 32 and 64 bit ints and floats, so for feature parity,
i64, f32, and f64 are implemented. Floats by way of bitcasting the float to
an int, then shufflin... | [
"def",
"ptx_shfl_sync_i32",
"(",
"context",
",",
"builder",
",",
"sig",
",",
"args",
")",
":",
"mask",
",",
"mode",
",",
"value",
",",
"index",
",",
"clamp",
"=",
"args",
"value_type",
"=",
"sig",
".",
"args",
"[",
"2",
"]",
"if",
"value_type",
"in",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/cuda/cudaimpl.py#L284-L326 | |
rapidsai/cudf | d5b2448fc69f17509304d594f029d0df56984962 | python/cudf/cudf/utils/cudautils.py | python | find_first | (arr, val, mask=None, compare="eq") | return -1 if min_index is None or np.isnan(min_index) else min_index | Returns the index of the first occurrence of *val* in *arr*..
Or the first occurrence of *arr* *compare* *val*, if *compare* is not eq
Otherwise, returns -1.
Parameters
----------
arr : device array
val : scalar
mask : mask of the array
compare: str ('gt', 'lt', or 'eq' (default)) | Returns the index of the first occurrence of *val* in *arr*..
Or the first occurrence of *arr* *compare* *val*, if *compare* is not eq
Otherwise, returns -1. | [
"Returns",
"the",
"index",
"of",
"the",
"first",
"occurrence",
"of",
"*",
"val",
"*",
"in",
"*",
"arr",
"*",
"..",
"Or",
"the",
"first",
"occurrence",
"of",
"*",
"arr",
"*",
"*",
"compare",
"*",
"*",
"val",
"*",
"if",
"*",
"compare",
"*",
"is",
"... | def find_first(arr, val, mask=None, compare="eq"):
"""
Returns the index of the first occurrence of *val* in *arr*..
Or the first occurrence of *arr* *compare* *val*, if *compare* is not eq
Otherwise, returns -1.
Parameters
----------
arr : device array
val : scalar
mask : mask of t... | [
"def",
"find_first",
"(",
"arr",
",",
"val",
",",
"mask",
"=",
"None",
",",
"compare",
"=",
"\"eq\"",
")",
":",
"found_col",
"=",
"find_index_of_val",
"(",
"arr",
",",
"val",
",",
"mask",
"=",
"mask",
",",
"compare",
"=",
"compare",
")",
"found_col",
... | https://github.com/rapidsai/cudf/blob/d5b2448fc69f17509304d594f029d0df56984962/python/cudf/cudf/utils/cudautils.py#L120-L138 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/richtext.py | python | RichTextCtrl.GetScrollPageSize | (*args, **kwargs) | return _richtext.RichTextCtrl_GetScrollPageSize(*args, **kwargs) | GetScrollPageSize(self, int orient) -> int | GetScrollPageSize(self, int orient) -> int | [
"GetScrollPageSize",
"(",
"self",
"int",
"orient",
")",
"-",
">",
"int"
] | def GetScrollPageSize(*args, **kwargs):
"""GetScrollPageSize(self, int orient) -> int"""
return _richtext.RichTextCtrl_GetScrollPageSize(*args, **kwargs) | [
"def",
"GetScrollPageSize",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"RichTextCtrl_GetScrollPageSize",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/richtext.py#L4144-L4146 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/nn/probability/distribution/cauchy.py | python | Cauchy._entropy | (self, loc=None, scale=None) | return self.log(scale) + self.entropy_const | r"""
Evaluate entropy.
.. math::
H(X) = \log(4 * \Pi * scale) | r"""
Evaluate entropy. | [
"r",
"Evaluate",
"entropy",
"."
] | def _entropy(self, loc=None, scale=None):
r"""
Evaluate entropy.
.. math::
H(X) = \log(4 * \Pi * scale)
"""
loc, scale = self._check_param_type(loc, scale)
return self.log(scale) + self.entropy_const | [
"def",
"_entropy",
"(",
"self",
",",
"loc",
"=",
"None",
",",
"scale",
"=",
"None",
")",
":",
"loc",
",",
"scale",
"=",
"self",
".",
"_check_param_type",
"(",
"loc",
",",
"scale",
")",
"return",
"self",
".",
"log",
"(",
"scale",
")",
"+",
"self",
... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/nn/probability/distribution/cauchy.py#L257-L265 | |
idaholab/moose | 9eeebc65e098b4c30f8205fb41591fd5b61eb6ff | python/peacock/ExodusViewer/plugins/BlockPlugin.py | python | BlockPlugin.onSetComponent | (self, *args) | Loads the selected items when the variable component changes. | Loads the selected items when the variable component changes. | [
"Loads",
"the",
"selected",
"items",
"when",
"the",
"variable",
"component",
"changes",
"."
] | def onSetComponent(self, *args):
"""
Loads the selected items when the variable component changes.
"""
super(BlockPlugin, self).onSetComponent(*args)
self._loadPlugin()
self.updateOptions() | [
"def",
"onSetComponent",
"(",
"self",
",",
"*",
"args",
")",
":",
"super",
"(",
"BlockPlugin",
",",
"self",
")",
".",
"onSetComponent",
"(",
"*",
"args",
")",
"self",
".",
"_loadPlugin",
"(",
")",
"self",
".",
"updateOptions",
"(",
")"
] | https://github.com/idaholab/moose/blob/9eeebc65e098b4c30f8205fb41591fd5b61eb6ff/python/peacock/ExodusViewer/plugins/BlockPlugin.py#L64-L70 | ||
ValveSoftware/source-sdk-2013 | 0d8dceea4310fde5706b3ce1c70609d72a38efdf | sp/src/thirdparty/protobuf-2.3.0/python/google/protobuf/reflection.py | python | _ExtensionDict.__setitem__ | (self, extension_handle, value) | If extension_handle specifies a non-repeated, scalar extension
field, sets the value of that field. | If extension_handle specifies a non-repeated, scalar extension
field, sets the value of that field. | [
"If",
"extension_handle",
"specifies",
"a",
"non",
"-",
"repeated",
"scalar",
"extension",
"field",
"sets",
"the",
"value",
"of",
"that",
"field",
"."
] | def __setitem__(self, extension_handle, value):
"""If extension_handle specifies a non-repeated, scalar extension
field, sets the value of that field.
"""
_VerifyExtensionHandle(self._extended_message, extension_handle)
if (extension_handle.label == _FieldDescriptor.LABEL_REPEATED or
exten... | [
"def",
"__setitem__",
"(",
"self",
",",
"extension_handle",
",",
"value",
")",
":",
"_VerifyExtensionHandle",
"(",
"self",
".",
"_extended_message",
",",
"extension_handle",
")",
"if",
"(",
"extension_handle",
".",
"label",
"==",
"_FieldDescriptor",
".",
"LABEL_RE... | https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/sp/src/thirdparty/protobuf-2.3.0/python/google/protobuf/reflection.py#L1118-L1137 | ||
continental/ecal | 204dab80a24fe01abca62541133b311bf0c09608 | lang/python/core/ecal/core/core.py | python | publisher.set_max_bandwidth_udp | (self, bandwidth) | return _ecal.pub_set_max_bandwidth_udp(self.thandle, bandwidth) | set publisher maximum transmit bandwidth for the udp layer.
:param bandwidth: maximum bandwidth in bytes/s (-1 == unlimited)
:type bandwidth: int | set publisher maximum transmit bandwidth for the udp layer. | [
"set",
"publisher",
"maximum",
"transmit",
"bandwidth",
"for",
"the",
"udp",
"layer",
"."
] | def set_max_bandwidth_udp(self, bandwidth):
""" set publisher maximum transmit bandwidth for the udp layer.
:param bandwidth: maximum bandwidth in bytes/s (-1 == unlimited)
:type bandwidth: int
"""
return _ecal.pub_set_max_bandwidth_udp(self.thandle, bandwidth) | [
"def",
"set_max_bandwidth_udp",
"(",
"self",
",",
"bandwidth",
")",
":",
"return",
"_ecal",
".",
"pub_set_max_bandwidth_udp",
"(",
"self",
".",
"thandle",
",",
"bandwidth",
")"
] | https://github.com/continental/ecal/blob/204dab80a24fe01abca62541133b311bf0c09608/lang/python/core/ecal/core/core.py#L613-L621 | |
intel/llvm | e6d0547e9d99b5a56430c4749f6c7e328bf221ab | lldb/third_party/Python/module/pexpect-4.6/pexpect/utils.py | python | split_command_line | (command_line) | return arg_list | This splits a command line into a list of arguments. It splits arguments
on spaces, but handles embedded quotes, doublequotes, and escaped
characters. It's impossible to do this with a regular expression, so I
wrote a little state machine to parse the command line. | This splits a command line into a list of arguments. It splits arguments
on spaces, but handles embedded quotes, doublequotes, and escaped
characters. It's impossible to do this with a regular expression, so I
wrote a little state machine to parse the command line. | [
"This",
"splits",
"a",
"command",
"line",
"into",
"a",
"list",
"of",
"arguments",
".",
"It",
"splits",
"arguments",
"on",
"spaces",
"but",
"handles",
"embedded",
"quotes",
"doublequotes",
"and",
"escaped",
"characters",
".",
"It",
"s",
"impossible",
"to",
"d... | def split_command_line(command_line):
'''This splits a command line into a list of arguments. It splits arguments
on spaces, but handles embedded quotes, doublequotes, and escaped
characters. It's impossible to do this with a regular expression, so I
wrote a little state machine to parse the command li... | [
"def",
"split_command_line",
"(",
"command_line",
")",
":",
"arg_list",
"=",
"[",
"]",
"arg",
"=",
"''",
"# Constants to name the states we can be in.",
"state_basic",
"=",
"0",
"state_esc",
"=",
"1",
"state_singlequote",
"=",
"2",
"state_doublequote",
"=",
"3",
"... | https://github.com/intel/llvm/blob/e6d0547e9d99b5a56430c4749f6c7e328bf221ab/lldb/third_party/Python/module/pexpect-4.6/pexpect/utils.py#L69-L127 | |
yan99033/CNN-SVO | d5591ea88103f8d1b26e5296129bf3b3196a14f1 | rpg_svo/svo_analysis/src/svo_analysis/tum_benchmark_tools/evaluate_rpe.py | python | read_trajectory | (filename, matrix=True) | return traj | Read a trajectory from a text file.
Input:
filename -- file to be read
matrix -- convert poses to 4x4 matrices
Output:
dictionary of stamped 3D poses | Read a trajectory from a text file.
Input:
filename -- file to be read
matrix -- convert poses to 4x4 matrices
Output:
dictionary of stamped 3D poses | [
"Read",
"a",
"trajectory",
"from",
"a",
"text",
"file",
".",
"Input",
":",
"filename",
"--",
"file",
"to",
"be",
"read",
"matrix",
"--",
"convert",
"poses",
"to",
"4x4",
"matrices",
"Output",
":",
"dictionary",
"of",
"stamped",
"3D",
"poses"
] | def read_trajectory(filename, matrix=True):
"""
Read a trajectory from a text file.
Input:
filename -- file to be read
matrix -- convert poses to 4x4 matrices
Output:
dictionary of stamped 3D poses
"""
file = open(filename)
data = file.read()
lines = data.replace("... | [
"def",
"read_trajectory",
"(",
"filename",
",",
"matrix",
"=",
"True",
")",
":",
"file",
"=",
"open",
"(",
"filename",
")",
"data",
"=",
"file",
".",
"read",
"(",
")",
"lines",
"=",
"data",
".",
"replace",
"(",
"\",\"",
",",
"\" \"",
")",
".",
"rep... | https://github.com/yan99033/CNN-SVO/blob/d5591ea88103f8d1b26e5296129bf3b3196a14f1/rpg_svo/svo_analysis/src/svo_analysis/tum_benchmark_tools/evaluate_rpe.py#L76-L108 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/debug/cli/stepper_cli.py | python | NodeStepperCLI._node_status_label_legend | (self) | return debugger_cli_common.rich_text_lines_from_rich_line_list([
"",
"Legend:",
(RL(" ") +
RL(self.STATE_IS_PLACEHOLDER,
self._STATE_COLORS[self.STATE_IS_PLACEHOLDER]) +
" - Placeholder"),
(RL(" ") +
RL(self.STATE_UNFEEDABLE,
self._STA... | Get legend for node-status labels.
Returns:
(debugger_cli_common.RichTextLines) Legend text. | Get legend for node-status labels. | [
"Get",
"legend",
"for",
"node",
"-",
"status",
"labels",
"."
] | def _node_status_label_legend(self):
"""Get legend for node-status labels.
Returns:
(debugger_cli_common.RichTextLines) Legend text.
"""
return debugger_cli_common.rich_text_lines_from_rich_line_list([
"",
"Legend:",
(RL(" ") +
RL(self.STATE_IS_PLACEHOLDER,
... | [
"def",
"_node_status_label_legend",
"(",
"self",
")",
":",
"return",
"debugger_cli_common",
".",
"rich_text_lines_from_rich_line_list",
"(",
"[",
"\"\"",
",",
"\"Legend:\"",
",",
"(",
"RL",
"(",
"\" \"",
")",
"+",
"RL",
"(",
"self",
".",
"STATE_IS_PLACEHOLDER",
... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/debug/cli/stepper_cli.py#L342-L376 | |
LiquidPlayer/LiquidCore | 9405979363f2353ac9a71ad8ab59685dd7f919c9 | deps/boost_1_66_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py | python | fix_input_files | (headerDir, sourceDir, containers=['vector', 'list', 'set', 'map'],
seqType='both', verbose=False) | Fixes source- and header-files used as input when pre-processing MPL-containers. | Fixes source- and header-files used as input when pre-processing MPL-containers. | [
"Fixes",
"source",
"-",
"and",
"header",
"-",
"files",
"used",
"as",
"input",
"when",
"pre",
"-",
"processing",
"MPL",
"-",
"containers",
"."
] | def fix_input_files(headerDir, sourceDir, containers=['vector', 'list', 'set', 'map'],
seqType='both', verbose=False):
"""Fixes source- and header-files used as input when pre-processing MPL-containers."""
# The new modification time.
timestamp = datetime.datetime.now();
# Fix the in... | [
"def",
"fix_input_files",
"(",
"headerDir",
",",
"sourceDir",
",",
"containers",
"=",
"[",
"'vector'",
",",
"'list'",
",",
"'set'",
",",
"'map'",
"]",
",",
"seqType",
"=",
"'both'",
",",
"verbose",
"=",
"False",
")",
":",
"# The new modification time.",
"tim... | https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/boost_1_66_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py#L123-L138 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/ipython/py3/IPython/utils/tokenutil.py | python | generate_tokens | (readline) | wrap generate_tokens to catch EOF errors | wrap generate_tokens to catch EOF errors | [
"wrap",
"generate_tokens",
"to",
"catch",
"EOF",
"errors"
] | def generate_tokens(readline):
"""wrap generate_tokens to catch EOF errors"""
try:
for token in tokenize.generate_tokens(readline):
yield token
except tokenize.TokenError:
# catch EOF error
return | [
"def",
"generate_tokens",
"(",
"readline",
")",
":",
"try",
":",
"for",
"token",
"in",
"tokenize",
".",
"generate_tokens",
"(",
"readline",
")",
":",
"yield",
"token",
"except",
"tokenize",
".",
"TokenError",
":",
"# catch EOF error",
"return"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py3/IPython/utils/tokenutil.py#L15-L22 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.