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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/contrib/bayesflow/python/ops/entropy_impl.py | python | renyi_ratio | (log_p, q, alpha, z=None, n=None, seed=None, name='renyi_ratio') | r"""Monte Carlo estimate of the ratio appearing in Renyi divergence.
This can be used to compute the Renyi (alpha) divergence, or a log evidence
approximation based on Renyi divergence.
#### Definition
With `z_i` iid samples from `q`, and `exp{log_p(z)} = p(z)`, this `Op` returns
the (biased for finite `n`... | r"""Monte Carlo estimate of the ratio appearing in Renyi divergence. | [
"r",
"Monte",
"Carlo",
"estimate",
"of",
"the",
"ratio",
"appearing",
"in",
"Renyi",
"divergence",
"."
] | def renyi_ratio(log_p, q, alpha, z=None, n=None, seed=None, name='renyi_ratio'):
r"""Monte Carlo estimate of the ratio appearing in Renyi divergence.
This can be used to compute the Renyi (alpha) divergence, or a log evidence
approximation based on Renyi divergence.
#### Definition
With `z_i` iid samples f... | [
"def",
"renyi_ratio",
"(",
"log_p",
",",
"q",
",",
"alpha",
",",
"z",
"=",
"None",
",",
"n",
"=",
"None",
",",
"seed",
"=",
"None",
",",
"name",
"=",
"'renyi_ratio'",
")",
":",
"with",
"ops",
".",
"name_scope",
"(",
"name",
",",
"values",
"=",
"[... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/bayesflow/python/ops/entropy_impl.py#L205-L321 | ||
linkingvision/rapidvms | 20a80c2aa78bd005a8a1556b47c2c50ee530c730 | 3rdparty/protobuf/gmock/scripts/fuse_gmock_files.py | python | FuseGMockH | (gmock_root, output_dir) | Scans folder gmock_root to generate gmock/gmock.h in output_dir. | Scans folder gmock_root to generate gmock/gmock.h in output_dir. | [
"Scans",
"folder",
"gmock_root",
"to",
"generate",
"gmock",
"/",
"gmock",
".",
"h",
"in",
"output_dir",
"."
] | def FuseGMockH(gmock_root, output_dir):
"""Scans folder gmock_root to generate gmock/gmock.h in output_dir."""
output_file = file(os.path.join(output_dir, GMOCK_H_OUTPUT), 'w')
processed_files = sets.Set() # Holds all gmock headers we've processed.
def ProcessFile(gmock_header_path):
"""Processes the giv... | [
"def",
"FuseGMockH",
"(",
"gmock_root",
",",
"output_dir",
")",
":",
"output_file",
"=",
"file",
"(",
"os",
".",
"path",
".",
"join",
"(",
"output_dir",
",",
"GMOCK_H_OUTPUT",
")",
",",
"'w'",
")",
"processed_files",
"=",
"sets",
".",
"Set",
"(",
")",
... | https://github.com/linkingvision/rapidvms/blob/20a80c2aa78bd005a8a1556b47c2c50ee530c730/3rdparty/protobuf/gmock/scripts/fuse_gmock_files.py#L119-L156 | ||
chromiumembedded/cef | 80caf947f3fe2210e5344713c5281d8af9bdc295 | tools/yapf/yapf/yapflib/split_penalty.py | python | _SplitPenaltyAssigner._SetUnbreakableOnChildren | (self, node) | Set an UNBREAKABLE penalty annotation on children of node. | Set an UNBREAKABLE penalty annotation on children of node. | [
"Set",
"an",
"UNBREAKABLE",
"penalty",
"annotation",
"on",
"children",
"of",
"node",
"."
] | def _SetUnbreakableOnChildren(self, node):
"""Set an UNBREAKABLE penalty annotation on children of node."""
for child in node.children:
self.Visit(child)
start = 2 if hasattr(node.children[0], 'is_pseudo') else 1
for i in py3compat.range(start, len(node.children)):
_SetUnbreakable(node.child... | [
"def",
"_SetUnbreakableOnChildren",
"(",
"self",
",",
"node",
")",
":",
"for",
"child",
"in",
"node",
".",
"children",
":",
"self",
".",
"Visit",
"(",
"child",
")",
"start",
"=",
"2",
"if",
"hasattr",
"(",
"node",
".",
"children",
"[",
"0",
"]",
",",... | https://github.com/chromiumembedded/cef/blob/80caf947f3fe2210e5344713c5281d8af9bdc295/tools/yapf/yapf/yapflib/split_penalty.py#L417-L423 | ||
vnpy/vnpy | f50f2535ed39dd33272e0985ed40c7078e4c19f6 | vnpy/trader/ui/widget.py | python | BaseMonitor.save_csv | (self) | Save table data into a csv file | Save table data into a csv file | [
"Save",
"table",
"data",
"into",
"a",
"csv",
"file"
] | def save_csv(self) -> None:
"""
Save table data into a csv file
"""
path, _ = QtWidgets.QFileDialog.getSaveFileName(
self, "保存数据", "", "CSV(*.csv)")
if not path:
return
with open(path, "w") as f:
writer = csv.writer(f, lineterminator=... | [
"def",
"save_csv",
"(",
"self",
")",
"->",
"None",
":",
"path",
",",
"_",
"=",
"QtWidgets",
".",
"QFileDialog",
".",
"getSaveFileName",
"(",
"self",
",",
"\"保存数据\", \"\", \"C",
"S",
"(*",
".",
"sv)\")",
"",
"if",
"not",
"path",
":",
"return",
"with",
"... | https://github.com/vnpy/vnpy/blob/f50f2535ed39dd33272e0985ed40c7078e4c19f6/vnpy/trader/ui/widget.py#L321-L348 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/prompt-toolkit/py3/prompt_toolkit/document.py | python | Document.find_enclosing_bracket_left | (
self, left_ch: str, right_ch: str, start_pos: Optional[int] = None
) | return None | Find the left bracket enclosing current position. Return the relative
position to the cursor position.
When `start_pos` is given, don't look past the position. | Find the left bracket enclosing current position. Return the relative
position to the cursor position. | [
"Find",
"the",
"left",
"bracket",
"enclosing",
"current",
"position",
".",
"Return",
"the",
"relative",
"position",
"to",
"the",
"cursor",
"position",
"."
] | def find_enclosing_bracket_left(
self, left_ch: str, right_ch: str, start_pos: Optional[int] = None
) -> Optional[int]:
"""
Find the left bracket enclosing current position. Return the relative
position to the cursor position.
When `start_pos` is given, don't look past the p... | [
"def",
"find_enclosing_bracket_left",
"(",
"self",
",",
"left_ch",
":",
"str",
",",
"right_ch",
":",
"str",
",",
"start_pos",
":",
"Optional",
"[",
"int",
"]",
"=",
"None",
")",
"->",
"Optional",
"[",
"int",
"]",
":",
"if",
"self",
".",
"current_char",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/prompt-toolkit/py3/prompt_toolkit/document.py#L795-L826 | |
idaholab/moose | 9eeebc65e098b4c30f8205fb41591fd5b61eb6ff | python/peacock/ExodusViewer/plugins/BackgroundPlugin.py | python | BackgroundPlugin._callbackColorbarBlackFontToggle | (self, value) | Called when the drop down black font option is toggled. | Called when the drop down black font option is toggled. | [
"Called",
"when",
"the",
"drop",
"down",
"black",
"font",
"option",
"is",
"toggled",
"."
] | def _callbackColorbarBlackFontToggle(self, value):
"""
Called when the drop down black font option is toggled.
"""
self._black_font_state = value
self.ColorbarBlackFontToggle.setChecked(value)
self.updateOptions()
self.windowRequiresUpdate.emit() | [
"def",
"_callbackColorbarBlackFontToggle",
"(",
"self",
",",
"value",
")",
":",
"self",
".",
"_black_font_state",
"=",
"value",
"self",
".",
"ColorbarBlackFontToggle",
".",
"setChecked",
"(",
"value",
")",
"self",
".",
"updateOptions",
"(",
")",
"self",
".",
"... | https://github.com/idaholab/moose/blob/9eeebc65e098b4c30f8205fb41591fd5b61eb6ff/python/peacock/ExodusViewer/plugins/BackgroundPlugin.py#L359-L366 | ||
cvxpy/cvxpy | 5165b4fb750dfd237de8659383ef24b4b2e33aaf | cvxpy/atoms/affine/index.py | python | special_index.grad | (self) | return lowered.grad | Gives the (sub/super)gradient of the expression w.r.t. each variable.
Matrix expressions are vectorized, so the gradient is a matrix.
None indicates variable values unknown or outside domain.
Returns:
A map of variable to SciPy CSC sparse matrix or None. | Gives the (sub/super)gradient of the expression w.r.t. each variable. | [
"Gives",
"the",
"(",
"sub",
"/",
"super",
")",
"gradient",
"of",
"the",
"expression",
"w",
".",
"r",
".",
"t",
".",
"each",
"variable",
"."
] | def grad(self):
"""Gives the (sub/super)gradient of the expression w.r.t. each variable.
Matrix expressions are vectorized, so the gradient is a matrix.
None indicates variable values unknown or outside domain.
Returns:
A map of variable to SciPy CSC sparse matrix or None.
... | [
"def",
"grad",
"(",
"self",
")",
":",
"select_vec",
"=",
"np",
".",
"reshape",
"(",
"self",
".",
"_select_mat",
",",
"self",
".",
"_select_mat",
".",
"size",
",",
"order",
"=",
"'F'",
")",
"identity",
"=",
"sp",
".",
"eye",
"(",
"self",
".",
"args"... | https://github.com/cvxpy/cvxpy/blob/5165b4fb750dfd237de8659383ef24b4b2e33aaf/cvxpy/atoms/affine/index.py#L161-L175 | |
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/tools/inspector_protocol/jinja2/ext.py | python | Extension.preprocess | (self, source, name, filename=None) | return source | This method is called before the actual lexing and can be used to
preprocess the source. The `filename` is optional. The return value
must be the preprocessed source. | This method is called before the actual lexing and can be used to
preprocess the source. The `filename` is optional. The return value
must be the preprocessed source. | [
"This",
"method",
"is",
"called",
"before",
"the",
"actual",
"lexing",
"and",
"can",
"be",
"used",
"to",
"preprocess",
"the",
"source",
".",
"The",
"filename",
"is",
"optional",
".",
"The",
"return",
"value",
"must",
"be",
"the",
"preprocessed",
"source",
... | def preprocess(self, source, name, filename=None):
"""This method is called before the actual lexing and can be used to
preprocess the source. The `filename` is optional. The return value
must be the preprocessed source.
"""
return source | [
"def",
"preprocess",
"(",
"self",
",",
"source",
",",
"name",
",",
"filename",
"=",
"None",
")",
":",
"return",
"source"
] | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/tools/inspector_protocol/jinja2/ext.py#L82-L87 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/setuptools/_vendor/pyparsing.py | python | ParserElement.leaveWhitespace | ( self ) | return self | Disables the skipping of whitespace before matching the characters in the
C{ParserElement}'s defined pattern. This is normally only used internally by
the pyparsing module, but may be needed in some whitespace-sensitive grammars. | Disables the skipping of whitespace before matching the characters in the
C{ParserElement}'s defined pattern. This is normally only used internally by
the pyparsing module, but may be needed in some whitespace-sensitive grammars. | [
"Disables",
"the",
"skipping",
"of",
"whitespace",
"before",
"matching",
"the",
"characters",
"in",
"the",
"C",
"{",
"ParserElement",
"}",
"s",
"defined",
"pattern",
".",
"This",
"is",
"normally",
"only",
"used",
"internally",
"by",
"the",
"pyparsing",
"module... | def leaveWhitespace( self ):
"""
Disables the skipping of whitespace before matching the characters in the
C{ParserElement}'s defined pattern. This is normally only used internally by
the pyparsing module, but may be needed in some whitespace-sensitive grammars.
"""
self... | [
"def",
"leaveWhitespace",
"(",
"self",
")",
":",
"self",
".",
"skipWhitespace",
"=",
"False",
"return",
"self"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/setuptools/_vendor/pyparsing.py#L2052-L2059 | |
hfinkel/llvm-project-cxxjit | 91084ef018240bbb8e24235ff5cd8c355a9c1a1e | lldb/utils/lui/lldbutil.py | python | get_symbol_names | (thread) | return map(GetSymbol, range(thread.GetNumFrames())) | Returns a sequence of symbols for this thread. | Returns a sequence of symbols for this thread. | [
"Returns",
"a",
"sequence",
"of",
"symbols",
"for",
"this",
"thread",
"."
] | def get_symbol_names(thread):
"""
Returns a sequence of symbols for this thread.
"""
def GetSymbol(i):
return thread.GetFrameAtIndex(i).GetSymbol().GetName()
return map(GetSymbol, range(thread.GetNumFrames())) | [
"def",
"get_symbol_names",
"(",
"thread",
")",
":",
"def",
"GetSymbol",
"(",
"i",
")",
":",
"return",
"thread",
".",
"GetFrameAtIndex",
"(",
"i",
")",
".",
"GetSymbol",
"(",
")",
".",
"GetName",
"(",
")",
"return",
"map",
"(",
"GetSymbol",
",",
"range"... | https://github.com/hfinkel/llvm-project-cxxjit/blob/91084ef018240bbb8e24235ff5cd8c355a9c1a1e/lldb/utils/lui/lldbutil.py#L712-L719 | |
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Draft/draftguitools/gui_mirror.py | python | Mirror.finish | (self, closed=False, cont=False) | Terminate the operation of the tool. | Terminate the operation of the tool. | [
"Terminate",
"the",
"operation",
"of",
"the",
"tool",
"."
] | def finish(self, closed=False, cont=False):
"""Terminate the operation of the tool."""
if self.ghost:
self.ghost.finalize()
super(Mirror, self).finish()
if cont and self.ui:
if self.ui.continueMode:
Gui.Selection.clearSelection()
se... | [
"def",
"finish",
"(",
"self",
",",
"closed",
"=",
"False",
",",
"cont",
"=",
"False",
")",
":",
"if",
"self",
".",
"ghost",
":",
"self",
".",
"ghost",
".",
"finalize",
"(",
")",
"super",
"(",
"Mirror",
",",
"self",
")",
".",
"finish",
"(",
")",
... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Draft/draftguitools/gui_mirror.py#L95-L103 | ||
kevin-ssy/Optical-Flow-Guided-Feature | 07d4501a29002ee7821c38c1820e4a64c1acf6e8 | lib/caffe-action/scripts/cpp_lint.py | python | CheckVlogArguments | (filename, clean_lines, linenum, error) | Checks that VLOG() is only used for defining a logging level.
For example, VLOG(2) is correct. VLOG(INFO), VLOG(WARNING), VLOG(ERROR), and
VLOG(FATAL) are not.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to ... | Checks that VLOG() is only used for defining a logging level. | [
"Checks",
"that",
"VLOG",
"()",
"is",
"only",
"used",
"for",
"defining",
"a",
"logging",
"level",
"."
] | def CheckVlogArguments(filename, clean_lines, linenum, error):
"""Checks that VLOG() is only used for defining a logging level.
For example, VLOG(2) is correct. VLOG(INFO), VLOG(WARNING), VLOG(ERROR), and
VLOG(FATAL) are not.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines i... | [
"def",
"CheckVlogArguments",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"if",
"Search",
"(",
"r'\\bVLOG\\((INFO|ERROR|WARNING|DFATAL|FATAL)\\)'",
",",
"line",
")",
... | https://github.com/kevin-ssy/Optical-Flow-Guided-Feature/blob/07d4501a29002ee7821c38c1820e4a64c1acf6e8/lib/caffe-action/scripts/cpp_lint.py#L1708-L1724 | ||
openvinotoolkit/openvino | dedcbeafa8b84cccdc55ca64b8da516682b381c7 | cmake/developer_package/cpplint/cpplint.py | python | ProcessFile | (filename, vlevel, extra_check_functions=None) | Does google-lint on a single file.
Args:
filename: The name of the file to parse.
vlevel: The level of errors to report. Every error of confidence
>= verbose_level will be reported. 0 is a good default.
extra_check_functions: An array of additional check functions that will be
... | Does google-lint on a single file. | [
"Does",
"google",
"-",
"lint",
"on",
"a",
"single",
"file",
"."
] | def ProcessFile(filename, vlevel, extra_check_functions=None):
"""Does google-lint on a single file.
Args:
filename: The name of the file to parse.
vlevel: The level of errors to report. Every error of confidence
>= verbose_level will be reported. 0 is a good default.
extra_check_functions: A... | [
"def",
"ProcessFile",
"(",
"filename",
",",
"vlevel",
",",
"extra_check_functions",
"=",
"None",
")",
":",
"_SetVerboseLevel",
"(",
"vlevel",
")",
"_BackupFilters",
"(",
")",
"old_errors",
"=",
"_cpplint_state",
".",
"error_count",
"if",
"not",
"ProcessConfigOverr... | https://github.com/openvinotoolkit/openvino/blob/dedcbeafa8b84cccdc55ca64b8da516682b381c7/cmake/developer_package/cpplint/cpplint.py#L6319-L6408 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/prompt-toolkit/py2/prompt_toolkit/key_binding/bindings/basic.py | python | load_mouse_bindings | () | return registry | Key bindings, required for mouse support.
(Mouse events enter through the key binding system.) | Key bindings, required for mouse support.
(Mouse events enter through the key binding system.) | [
"Key",
"bindings",
"required",
"for",
"mouse",
"support",
".",
"(",
"Mouse",
"events",
"enter",
"through",
"the",
"key",
"binding",
"system",
".",
")"
] | def load_mouse_bindings():
"""
Key bindings, required for mouse support.
(Mouse events enter through the key binding system.)
"""
registry = Registry()
@registry.add_binding(Keys.Vt100MouseEvent)
def _(event):
"""
Handling of incoming mouse event.
"""
# Typic... | [
"def",
"load_mouse_bindings",
"(",
")",
":",
"registry",
"=",
"Registry",
"(",
")",
"@",
"registry",
".",
"add_binding",
"(",
"Keys",
".",
"Vt100MouseEvent",
")",
"def",
"_",
"(",
"event",
")",
":",
"\"\"\"\n Handling of incoming mouse event.\n \"\"\""... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/prompt-toolkit/py2/prompt_toolkit/key_binding/bindings/basic.py#L235-L338 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/tkinter/__init__.py | python | Menu.entryconfigure | (self, index, cnf=None, **kw) | return self._configure(('entryconfigure', index), cnf, kw) | Configure a menu item at INDEX. | Configure a menu item at INDEX. | [
"Configure",
"a",
"menu",
"item",
"at",
"INDEX",
"."
] | def entryconfigure(self, index, cnf=None, **kw):
"""Configure a menu item at INDEX."""
return self._configure(('entryconfigure', index), cnf, kw) | [
"def",
"entryconfigure",
"(",
"self",
",",
"index",
",",
"cnf",
"=",
"None",
",",
"*",
"*",
"kw",
")",
":",
"return",
"self",
".",
"_configure",
"(",
"(",
"'entryconfigure'",
",",
"index",
")",
",",
"cnf",
",",
"kw",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/tkinter/__init__.py#L2931-L2933 | |
google/syzygy | 8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5 | third_party/numpy/files/numpy/distutils/command/scons.py | python | get_tool_path | (compiler) | return fullpath | Given a distutils.ccompiler.CCompiler class, returns the path of the
toolset related to C compilation. | Given a distutils.ccompiler.CCompiler class, returns the path of the
toolset related to C compilation. | [
"Given",
"a",
"distutils",
".",
"ccompiler",
".",
"CCompiler",
"class",
"returns",
"the",
"path",
"of",
"the",
"toolset",
"related",
"to",
"C",
"compilation",
"."
] | def get_tool_path(compiler):
"""Given a distutils.ccompiler.CCompiler class, returns the path of the
toolset related to C compilation."""
fullpath_exec = find_executable(get_compiler_executable(compiler))
if fullpath_exec:
fullpath = pdirname(fullpath_exec)
else:
raise DistutilsSetup... | [
"def",
"get_tool_path",
"(",
"compiler",
")",
":",
"fullpath_exec",
"=",
"find_executable",
"(",
"get_compiler_executable",
"(",
"compiler",
")",
")",
"if",
"fullpath_exec",
":",
"fullpath",
"=",
"pdirname",
"(",
"fullpath_exec",
")",
"else",
":",
"raise",
"Dist... | https://github.com/google/syzygy/blob/8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5/third_party/numpy/files/numpy/distutils/command/scons.py#L198-L206 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/AWSPythonSDK/1.5.8/dateutil/parser.py | python | parser._parse | (self, timestr, dayfirst=None, yearfirst=None, fuzzy=False,
fuzzy_with_tokens=False) | Private method which performs the heavy lifting of parsing, called from
``parse()``, which passes on its ``kwargs`` to this function.
:param timestr:
The string to parse.
:param dayfirst:
Whether to interpret the first value in an ambiguous 3-integer date
(e... | Private method which performs the heavy lifting of parsing, called from
``parse()``, which passes on its ``kwargs`` to this function. | [
"Private",
"method",
"which",
"performs",
"the",
"heavy",
"lifting",
"of",
"parsing",
"called",
"from",
"parse",
"()",
"which",
"passes",
"on",
"its",
"kwargs",
"to",
"this",
"function",
"."
] | def _parse(self, timestr, dayfirst=None, yearfirst=None, fuzzy=False,
fuzzy_with_tokens=False):
"""
Private method which performs the heavy lifting of parsing, called from
``parse()``, which passes on its ``kwargs`` to this function.
:param timestr:
The string... | [
"def",
"_parse",
"(",
"self",
",",
"timestr",
",",
"dayfirst",
"=",
"None",
",",
"yearfirst",
"=",
"None",
",",
"fuzzy",
"=",
"False",
",",
"fuzzy_with_tokens",
"=",
"False",
")",
":",
"if",
"fuzzy_with_tokens",
":",
"fuzzy",
"=",
"True",
"info",
"=",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/dateutil/parser.py#L622-L1067 | ||
weolar/miniblink49 | 1c4678db0594a4abde23d3ebbcc7cd13c3170777 | third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/coverage/html.py | python | HtmlReporter.make_local_static_report_files | (self) | Make local instances of static files for HTML report. | Make local instances of static files for HTML report. | [
"Make",
"local",
"instances",
"of",
"static",
"files",
"for",
"HTML",
"report",
"."
] | def make_local_static_report_files(self):
"""Make local instances of static files for HTML report."""
for static in self.STATIC_FILES:
shutil.copyfile(
data_filename("htmlfiles/" + static),
os.path.join(self.directory, static)
) | [
"def",
"make_local_static_report_files",
"(",
"self",
")",
":",
"for",
"static",
"in",
"self",
".",
"STATIC_FILES",
":",
"shutil",
".",
"copyfile",
"(",
"data_filename",
"(",
"\"htmlfiles/\"",
"+",
"static",
")",
",",
"os",
".",
"path",
".",
"join",
"(",
"... | https://github.com/weolar/miniblink49/blob/1c4678db0594a4abde23d3ebbcc7cd13c3170777/third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/coverage/html.py#L93-L99 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/AWS/resource-manager-code/lib/pkg_resources/__init__.py | python | IMetadataProvider.metadata_isdir | (name) | Is the named metadata a directory? (like ``os.path.isdir()``) | Is the named metadata a directory? (like ``os.path.isdir()``) | [
"Is",
"the",
"named",
"metadata",
"a",
"directory?",
"(",
"like",
"os",
".",
"path",
".",
"isdir",
"()",
")"
] | def metadata_isdir(name):
"""Is the named metadata a directory? (like ``os.path.isdir()``)""" | [
"def",
"metadata_isdir",
"(",
"name",
")",
":"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/AWS/resource-manager-code/lib/pkg_resources/__init__.py#L516-L517 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py3/pandas/core/indexes/multi.py | python | maybe_droplevels | (index: Index, key) | return index | Attempt to drop level or levels from the given index.
Parameters
----------
index: Index
key : scalar or tuple
Returns
-------
Index | Attempt to drop level or levels from the given index. | [
"Attempt",
"to",
"drop",
"level",
"or",
"levels",
"from",
"the",
"given",
"index",
"."
] | def maybe_droplevels(index: Index, key) -> Index:
"""
Attempt to drop level or levels from the given index.
Parameters
----------
index: Index
key : scalar or tuple
Returns
-------
Index
"""
# drop levels
original_index = index
if isinstance(key, tuple):
for... | [
"def",
"maybe_droplevels",
"(",
"index",
":",
"Index",
",",
"key",
")",
"->",
"Index",
":",
"# drop levels",
"original_index",
"=",
"index",
"if",
"isinstance",
"(",
"key",
",",
"tuple",
")",
":",
"for",
"_",
"in",
"key",
":",
"try",
":",
"index",
"=",... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/core/indexes/multi.py#L3813-L3841 | |
maidsafe-archive/MaidSafe | defd65e1c8cfb6a1cbdeaaa0eee31d065421792d | src/third_party_libs/googlemock/scripts/fuse_gmock_files.py | python | ValidateGMockRootDir | (gmock_root) | Makes sure gmock_root points to a valid gmock root directory.
The function aborts the program on failure. | Makes sure gmock_root points to a valid gmock root directory. | [
"Makes",
"sure",
"gmock_root",
"points",
"to",
"a",
"valid",
"gmock",
"root",
"directory",
"."
] | def ValidateGMockRootDir(gmock_root):
"""Makes sure gmock_root points to a valid gmock root directory.
The function aborts the program on failure.
"""
gtest.ValidateGTestRootDir(GetGTestRootDir(gmock_root))
gtest.VerifyFileExists(gmock_root, GMOCK_H_SEED)
gtest.VerifyFileExists(gmock_root, GMOCK_ALL_CC_SE... | [
"def",
"ValidateGMockRootDir",
"(",
"gmock_root",
")",
":",
"gtest",
".",
"ValidateGTestRootDir",
"(",
"GetGTestRootDir",
"(",
"gmock_root",
")",
")",
"gtest",
".",
"VerifyFileExists",
"(",
"gmock_root",
",",
"GMOCK_H_SEED",
")",
"gtest",
".",
"VerifyFileExists",
... | https://github.com/maidsafe-archive/MaidSafe/blob/defd65e1c8cfb6a1cbdeaaa0eee31d065421792d/src/third_party_libs/googlemock/scripts/fuse_gmock_files.py#L97-L105 | ||
ApolloAuto/apollo | 463fb82f9e979d02dcb25044e60931293ab2dba0 | modules/tools/sensor_calibration/sensor_msg_extractor.py | python | PoseParser.parse_sensor_message | (self, msg) | return True | parse localization information from localization estimate channel | parse localization information from localization estimate channel | [
"parse",
"localization",
"information",
"from",
"localization",
"estimate",
"channel"
] | def parse_sensor_message(self, msg):
""" parse localization information from localization estimate channel"""
loc_est = self._msg_parser
loc_est.ParseFromString(msg.message)
# all double, except point_type is int32
ts = loc_est.header.timestamp_sec
self._timestamps.appen... | [
"def",
"parse_sensor_message",
"(",
"self",
",",
"msg",
")",
":",
"loc_est",
"=",
"self",
".",
"_msg_parser",
"loc_est",
".",
"ParseFromString",
"(",
"msg",
".",
"message",
")",
"# all double, except point_type is int32",
"ts",
"=",
"loc_est",
".",
"header",
"."... | https://github.com/ApolloAuto/apollo/blob/463fb82f9e979d02dcb25044e60931293ab2dba0/modules/tools/sensor_calibration/sensor_msg_extractor.py#L141-L164 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/core/fromnumeric.py | python | put | (a, ind, v, mode='raise') | return a.put(ind, v, mode) | Replaces specified elements of an array with given values.
The indexing works on the flattened target array. `put` is roughly
equivalent to:
::
a.flat[ind] = v
Parameters
----------
a : ndarray
Target array.
ind : array_like
Target indices, interpreted as integers... | Replaces specified elements of an array with given values. | [
"Replaces",
"specified",
"elements",
"of",
"an",
"array",
"with",
"given",
"values",
"."
] | def put(a, ind, v, mode='raise'):
"""
Replaces specified elements of an array with given values.
The indexing works on the flattened target array. `put` is roughly
equivalent to:
::
a.flat[ind] = v
Parameters
----------
a : ndarray
Target array.
ind : array_like
... | [
"def",
"put",
"(",
"a",
",",
"ind",
",",
"v",
",",
"mode",
"=",
"'raise'",
")",
":",
"return",
"a",
".",
"put",
"(",
"ind",
",",
"v",
",",
"mode",
")"
] | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/core/fromnumeric.py#L393-L441 | |
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/contrib/metrics/python/ops/metric_ops.py | python | _streaming_false_positives | (predictions, labels, weights=None,
metrics_collections=None,
updates_collections=None,
name=None) | Sum the weights of false positives.
If `weights` is `None`, weights default to 1. Use weights of 0 to mask values.
Args:
predictions: The predicted values, a `bool` `Tensor` of arbitrary
dimensions.
labels: The ground truth values, a `bool` `Tensor` whose dimensions must
match `predictions`.
... | Sum the weights of false positives. | [
"Sum",
"the",
"weights",
"of",
"false",
"positives",
"."
] | def _streaming_false_positives(predictions, labels, weights=None,
metrics_collections=None,
updates_collections=None,
name=None):
"""Sum the weights of false positives.
If `weights` is `None`, weights default to 1. Use wei... | [
"def",
"_streaming_false_positives",
"(",
"predictions",
",",
"labels",
",",
"weights",
"=",
"None",
",",
"metrics_collections",
"=",
"None",
",",
"updates_collections",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"with",
"variable_scope",
".",
"variable_sc... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/contrib/metrics/python/ops/metric_ops.py#L221-L258 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/ed_search.py | python | SearchController.ReplaceInStc | (stc, matches, rstring, isregex=True) | Replace the strings at the position in the given StyledTextCtrl
@param stc: StyledTextCtrl
@param matches: list of match objects
@param rstring: Replace string
@keyword isregex: Is it a regular expression operation (bool) | Replace the strings at the position in the given StyledTextCtrl
@param stc: StyledTextCtrl
@param matches: list of match objects
@param rstring: Replace string
@keyword isregex: Is it a regular expression operation (bool) | [
"Replace",
"the",
"strings",
"at",
"the",
"position",
"in",
"the",
"given",
"StyledTextCtrl",
"@param",
"stc",
":",
"StyledTextCtrl",
"@param",
"matches",
":",
"list",
"of",
"match",
"objects",
"@param",
"rstring",
":",
"Replace",
"string",
"@keyword",
"isregex"... | def ReplaceInStc(stc, matches, rstring, isregex=True):
"""Replace the strings at the position in the given StyledTextCtrl
@param stc: StyledTextCtrl
@param matches: list of match objects
@param rstring: Replace string
@keyword isregex: Is it a regular expression operation (bool)
... | [
"def",
"ReplaceInStc",
"(",
"stc",
",",
"matches",
",",
"rstring",
",",
"isregex",
"=",
"True",
")",
":",
"if",
"not",
"len",
"(",
"matches",
")",
":",
"return",
"def",
"GetSub",
"(",
"match",
")",
":",
"\"\"\"replace substitution callable for re.sub\"\"\"",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/ed_search.py#L754-L781 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/stc.py | python | StyledTextCtrl.DoDragOver | (*args, **kwargs) | return _stc.StyledTextCtrl_DoDragOver(*args, **kwargs) | DoDragOver(self, int x, int y, int def) -> int
Allow for simulating a DnD DragOver. | DoDragOver(self, int x, int y, int def) -> int | [
"DoDragOver",
"(",
"self",
"int",
"x",
"int",
"y",
"int",
"def",
")",
"-",
">",
"int"
] | def DoDragOver(*args, **kwargs):
"""
DoDragOver(self, int x, int y, int def) -> int
Allow for simulating a DnD DragOver.
"""
return _stc.StyledTextCtrl_DoDragOver(*args, **kwargs) | [
"def",
"DoDragOver",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_stc",
".",
"StyledTextCtrl_DoDragOver",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/stc.py#L6653-L6659 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/jira/client.py | python | JIRA.worklogs | (self, issue) | return worklogs | Get a list of worklog Resources from the server for an issue.
:param issue: ID or key of the issue to get worklogs from | Get a list of worklog Resources from the server for an issue. | [
"Get",
"a",
"list",
"of",
"worklog",
"Resources",
"from",
"the",
"server",
"for",
"an",
"issue",
"."
] | def worklogs(self, issue):
"""Get a list of worklog Resources from the server for an issue.
:param issue: ID or key of the issue to get worklogs from
"""
r_json = self._get_json('issue/' + str(issue) + '/worklog')
worklogs = [Worklog(self._options, self._session, raw_worklog_jso... | [
"def",
"worklogs",
"(",
"self",
",",
"issue",
")",
":",
"r_json",
"=",
"self",
".",
"_get_json",
"(",
"'issue/'",
"+",
"str",
"(",
"issue",
")",
"+",
"'/worklog'",
")",
"worklogs",
"=",
"[",
"Worklog",
"(",
"self",
".",
"_options",
",",
"self",
".",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/jira/client.py#L1621-L1629 | |
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | torch/overrides.py | python | is_tensor_like | (inp) | return type(inp) is torch.Tensor or hasattr(type(inp), "__torch_function__") | Returns ``True`` if the passed-in input is a Tensor-like.
Currently, this occurs whenever there's a ``__torch_function__``
attribute on the type of the input.
Examples
--------
A subclass of tensor is generally a Tensor-like.
>>> class SubTensor(torch.Tensor): ...
>>> is_tensor_like(SubTe... | Returns ``True`` if the passed-in input is a Tensor-like. | [
"Returns",
"True",
"if",
"the",
"passed",
"-",
"in",
"input",
"is",
"a",
"Tensor",
"-",
"like",
"."
] | def is_tensor_like(inp):
"""
Returns ``True`` if the passed-in input is a Tensor-like.
Currently, this occurs whenever there's a ``__torch_function__``
attribute on the type of the input.
Examples
--------
A subclass of tensor is generally a Tensor-like.
>>> class SubTensor(torch.Tens... | [
"def",
"is_tensor_like",
"(",
"inp",
")",
":",
"return",
"type",
"(",
"inp",
")",
"is",
"torch",
".",
"Tensor",
"or",
"hasattr",
"(",
"type",
"(",
"inp",
")",
",",
"\"__torch_function__\"",
")"
] | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/torch/overrides.py#L1550-L1584 | |
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | torch/ao/quantization/quantize.py | python | _observer_forward_pre_hook | (self, input) | return self.activation_post_process(input[0]) | r"""Forward pre hook that calls observer on the output | r"""Forward pre hook that calls observer on the output | [
"r",
"Forward",
"pre",
"hook",
"that",
"calls",
"observer",
"on",
"the",
"output"
] | def _observer_forward_pre_hook(self, input):
r"""Forward pre hook that calls observer on the output
"""
return self.activation_post_process(input[0]) | [
"def",
"_observer_forward_pre_hook",
"(",
"self",
",",
"input",
")",
":",
"return",
"self",
".",
"activation_post_process",
"(",
"input",
"[",
"0",
"]",
")"
] | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/torch/ao/quantization/quantize.py#L89-L92 | |
Caffe-MPI/Caffe-MPI.github.io | df5992af571a2a19981b69635115c393f18d1c76 | python/caffe/pycaffe.py | python | _Net_blob_loss_weights | (self) | return self._blob_loss_weights_dict | An OrderedDict (bottom to top, i.e., input to output) of network
blob loss weights indexed by name | An OrderedDict (bottom to top, i.e., input to output) of network
blob loss weights indexed by name | [
"An",
"OrderedDict",
"(",
"bottom",
"to",
"top",
"i",
".",
"e",
".",
"input",
"to",
"output",
")",
"of",
"network",
"blob",
"loss",
"weights",
"indexed",
"by",
"name"
] | def _Net_blob_loss_weights(self):
"""
An OrderedDict (bottom to top, i.e., input to output) of network
blob loss weights indexed by name
"""
if not hasattr(self, '_blobs_loss_weights_dict'):
self._blob_loss_weights_dict = OrderedDict(zip(self._blob_names,
... | [
"def",
"_Net_blob_loss_weights",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'_blobs_loss_weights_dict'",
")",
":",
"self",
".",
"_blob_loss_weights_dict",
"=",
"OrderedDict",
"(",
"zip",
"(",
"self",
".",
"_blob_names",
",",
"self",
".",... | https://github.com/Caffe-MPI/Caffe-MPI.github.io/blob/df5992af571a2a19981b69635115c393f18d1c76/python/caffe/pycaffe.py#L36-L44 | |
LiquidPlayer/LiquidCore | 9405979363f2353ac9a71ad8ab59685dd7f919c9 | deps/node-10.15.3/tools/jinja2/runtime.py | python | markup_join | (seq) | return concat(buf) | Concatenation that escapes if necessary and converts to unicode. | Concatenation that escapes if necessary and converts to unicode. | [
"Concatenation",
"that",
"escapes",
"if",
"necessary",
"and",
"converts",
"to",
"unicode",
"."
] | def markup_join(seq):
"""Concatenation that escapes if necessary and converts to unicode."""
buf = []
iterator = imap(soft_unicode, seq)
for arg in iterator:
buf.append(arg)
if hasattr(arg, '__html__'):
return Markup(u'').join(chain(buf, iterator))
return concat(buf) | [
"def",
"markup_join",
"(",
"seq",
")",
":",
"buf",
"=",
"[",
"]",
"iterator",
"=",
"imap",
"(",
"soft_unicode",
",",
"seq",
")",
"for",
"arg",
"in",
"iterator",
":",
"buf",
".",
"append",
"(",
"arg",
")",
"if",
"hasattr",
"(",
"arg",
",",
"'__html_... | https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/node-10.15.3/tools/jinja2/runtime.py#L43-L51 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/distutils/ccompiler.py | python | CCompiler.create_static_lib | (self, objects, output_libname, output_dir=None,
debug=0, target_lang=None) | Link a bunch of stuff together to create a static library file.
The "bunch of stuff" consists of the list of object files supplied
as 'objects', the extra object files supplied to
'add_link_object()' and/or 'set_link_objects()', the libraries
supplied to 'add_library()' and/or 'set_libra... | Link a bunch of stuff together to create a static library file.
The "bunch of stuff" consists of the list of object files supplied
as 'objects', the extra object files supplied to
'add_link_object()' and/or 'set_link_objects()', the libraries
supplied to 'add_library()' and/or 'set_libra... | [
"Link",
"a",
"bunch",
"of",
"stuff",
"together",
"to",
"create",
"a",
"static",
"library",
"file",
".",
"The",
"bunch",
"of",
"stuff",
"consists",
"of",
"the",
"list",
"of",
"object",
"files",
"supplied",
"as",
"objects",
"the",
"extra",
"object",
"files",... | def create_static_lib(self, objects, output_libname, output_dir=None,
debug=0, target_lang=None):
"""Link a bunch of stuff together to create a static library file.
The "bunch of stuff" consists of the list of object files supplied
as 'objects', the extra object files s... | [
"def",
"create_static_lib",
"(",
"self",
",",
"objects",
",",
"output_libname",
",",
"output_dir",
"=",
"None",
",",
"debug",
"=",
"0",
",",
"target_lang",
"=",
"None",
")",
":",
"pass"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/distutils/ccompiler.py#L585-L609 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/android/loading/devtools_monitor.py | python | DevToolsConnection.StopMonitoring | (self) | Sets the timestamp when to stop monitoring.
Args:
address_delayed_stop: Whether the MonitorUrl()'s stop_delay_multiplier
should be addressed or not. | Sets the timestamp when to stop monitoring. | [
"Sets",
"the",
"timestamp",
"when",
"to",
"stop",
"monitoring",
"."
] | def StopMonitoring(self):
"""Sets the timestamp when to stop monitoring.
Args:
address_delayed_stop: Whether the MonitorUrl()'s stop_delay_multiplier
should be addressed or not.
"""
if self._stop_delay_multiplier == 0:
self._StopMonitoringImmediately()
elif self._monitoring_stop... | [
"def",
"StopMonitoring",
"(",
"self",
")",
":",
"if",
"self",
".",
"_stop_delay_multiplier",
"==",
"0",
":",
"self",
".",
"_StopMonitoringImmediately",
"(",
")",
"elif",
"self",
".",
"_monitoring_stop_timestamp",
"is",
"None",
":",
"assert",
"self",
".",
"_mon... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/android/loading/devtools_monitor.py#L262-L278 | ||
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | buildscripts/clang_format.py | python | extract_clang_format | (tar_path) | Extract the clang_format tar file. | Extract the clang_format tar file. | [
"Extract",
"the",
"clang_format",
"tar",
"file",
"."
] | def extract_clang_format(tar_path):
"""Extract the clang_format tar file."""
# Extract just the clang-format binary
# On OSX, we shell out to tar because tarfile doesn't support xz compression
if sys.platform == 'darwin':
subprocess.call(['tar', '-xzf', tar_path, '*clang-format*'])
# Otherwi... | [
"def",
"extract_clang_format",
"(",
"tar_path",
")",
":",
"# Extract just the clang-format binary",
"# On OSX, we shell out to tar because tarfile doesn't support xz compression",
"if",
"sys",
".",
"platform",
"==",
"'darwin'",
":",
"subprocess",
".",
"call",
"(",
"[",
"'tar'... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/clang_format.py#L78-L91 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_windows.py | python | VarVScrollHelper.GetVisibleRowsBegin | (*args, **kwargs) | return _windows_.VarVScrollHelper_GetVisibleRowsBegin(*args, **kwargs) | GetVisibleRowsBegin(self) -> size_t | GetVisibleRowsBegin(self) -> size_t | [
"GetVisibleRowsBegin",
"(",
"self",
")",
"-",
">",
"size_t"
] | def GetVisibleRowsBegin(*args, **kwargs):
"""GetVisibleRowsBegin(self) -> size_t"""
return _windows_.VarVScrollHelper_GetVisibleRowsBegin(*args, **kwargs) | [
"def",
"GetVisibleRowsBegin",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"VarVScrollHelper_GetVisibleRowsBegin",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_windows.py#L2301-L2303 | |
nnrg/opennero | 43e12a1bcba6e228639db3886fec1dc47ddc24cb | mods/Maze/agent.py | python | BFSSearchAgent.__init__ | (self) | A new Agent | A new Agent | [
"A",
"new",
"Agent"
] | def __init__(self):
"""
A new Agent
"""
# this line is crucial, otherwise the class is not recognized as an AgentBrainPtr by C++
GenericSearchAlgorithm.__init__(self) | [
"def",
"__init__",
"(",
"self",
")",
":",
"# this line is crucial, otherwise the class is not recognized as an AgentBrainPtr by C++",
"GenericSearchAlgorithm",
".",
"__init__",
"(",
"self",
")"
] | https://github.com/nnrg/opennero/blob/43e12a1bcba6e228639db3886fec1dc47ddc24cb/mods/Maze/agent.py#L506-L511 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/build/waf-1.7.13/waflib/Tools/fc_config.py | python | _parse_flink_line | (line, final_flags) | return final_flags | private | private | [
"private"
] | def _parse_flink_line(line, final_flags):
"""private"""
lexer = shlex.shlex(line, posix = True)
lexer.whitespace_split = True
t = lexer.get_token()
tmp_flags = []
while t:
def parse(token):
# Here we go (convention for wildcard is shell, not regex !)
# 1 TODO: we first get some root .a libraries
# ... | [
"def",
"_parse_flink_line",
"(",
"line",
",",
"final_flags",
")",
":",
"lexer",
"=",
"shlex",
".",
"shlex",
"(",
"line",
",",
"posix",
"=",
"True",
")",
"lexer",
".",
"whitespace_split",
"=",
"True",
"t",
"=",
"lexer",
".",
"get_token",
"(",
")",
"tmp_... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/build/waf-1.7.13/waflib/Tools/fc_config.py#L253-L302 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/examples/speech_commands/freeze.py | python | save_saved_model | (file_name, sess, input_tensor, output_tensor) | Writes a SavedModel out to disk.
Args:
file_name: Where to save the file.
sess: TensorFlow session containing the graph.
input_tensor: Tensor object defining the input's properties.
output_tensor: Tensor object defining the output's properties. | Writes a SavedModel out to disk. | [
"Writes",
"a",
"SavedModel",
"out",
"to",
"disk",
"."
] | def save_saved_model(file_name, sess, input_tensor, output_tensor):
"""Writes a SavedModel out to disk.
Args:
file_name: Where to save the file.
sess: TensorFlow session containing the graph.
input_tensor: Tensor object defining the input's properties.
output_tensor: Tensor object defining the outp... | [
"def",
"save_saved_model",
"(",
"file_name",
",",
"sess",
",",
"input_tensor",
",",
"output_tensor",
")",
":",
"# Store the frozen graph as a SavedModel for v2 compatibility.",
"builder",
"=",
"tf",
".",
"compat",
".",
"v1",
".",
"saved_model",
".",
"builder",
".",
... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/examples/speech_commands/freeze.py#L172-L204 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/requests/api.py | python | put | (url, data=None, **kwargs) | return request('put', url, data=data, **kwargs) | r"""Sends a PUT request.
:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary, list of tuples, bytes, or file-like
object to send in the body of the :class:`Request`.
:param json: (optional) json data to send in the body of the :class:`Request`.
:param \*\*kwa... | r"""Sends a PUT request. | [
"r",
"Sends",
"a",
"PUT",
"request",
"."
] | def put(url, data=None, **kwargs):
r"""Sends a PUT request.
:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary, list of tuples, bytes, or file-like
object to send in the body of the :class:`Request`.
:param json: (optional) json data to send in the body of t... | [
"def",
"put",
"(",
"url",
",",
"data",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"request",
"(",
"'put'",
",",
"url",
",",
"data",
"=",
"data",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/requests/api.py#L122-L134 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/html.py | python | HtmlDCRenderer.GetTotalHeight | (*args, **kwargs) | return _html.HtmlDCRenderer_GetTotalHeight(*args, **kwargs) | GetTotalHeight(self) -> int | GetTotalHeight(self) -> int | [
"GetTotalHeight",
"(",
"self",
")",
"-",
">",
"int"
] | def GetTotalHeight(*args, **kwargs):
"""GetTotalHeight(self) -> int"""
return _html.HtmlDCRenderer_GetTotalHeight(*args, **kwargs) | [
"def",
"GetTotalHeight",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_html",
".",
"HtmlDCRenderer_GetTotalHeight",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/html.py#L1259-L1261 | |
GoSSIP-SJTU/TripleDoggy | 03648d6b19c812504b14e8b98c8c7b3f443f4e54 | utils/lit/lit/util.py | python | executeCommand | (command, cwd=None, env=None, input=None, timeout=0) | return out, err, exitCode | Execute command ``command`` (list of arguments or string) with.
* working directory ``cwd`` (str), use None to use the current
working directory
* environment ``env`` (dict), use None for none
* Input to the command ``input`` (str), use string to pass
no input.
* Max execution time ``timeou... | Execute command ``command`` (list of arguments or string) with. | [
"Execute",
"command",
"command",
"(",
"list",
"of",
"arguments",
"or",
"string",
")",
"with",
"."
] | def executeCommand(command, cwd=None, env=None, input=None, timeout=0):
"""Execute command ``command`` (list of arguments or string) with.
* working directory ``cwd`` (str), use None to use the current
working directory
* environment ``env`` (dict), use None for none
* Input to the command ``inpu... | [
"def",
"executeCommand",
"(",
"command",
",",
"cwd",
"=",
"None",
",",
"env",
"=",
"None",
",",
"input",
"=",
"None",
",",
"timeout",
"=",
"0",
")",
":",
"if",
"input",
"is",
"not",
"None",
":",
"input",
"=",
"to_bytes",
"(",
"input",
")",
"p",
"... | https://github.com/GoSSIP-SJTU/TripleDoggy/blob/03648d6b19c812504b14e8b98c8c7b3f443f4e54/utils/lit/lit/util.py#L297-L362 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py2/sklearn/mixture/base.py | python | BaseMixture._e_step | (self, X) | return np.mean(log_prob_norm), log_resp | E step.
Parameters
----------
X : array-like, shape (n_samples, n_features)
Returns
-------
log_prob_norm : float
Mean of the logarithms of the probabilities of each sample in X
log_responsibility : array, shape (n_samples, n_components)
... | E step. | [
"E",
"step",
"."
] | def _e_step(self, X):
"""E step.
Parameters
----------
X : array-like, shape (n_samples, n_features)
Returns
-------
log_prob_norm : float
Mean of the logarithms of the probabilities of each sample in X
log_responsibility : array, shape (n_s... | [
"def",
"_e_step",
"(",
"self",
",",
"X",
")",
":",
"log_prob_norm",
",",
"log_resp",
"=",
"self",
".",
"_estimate_log_prob_resp",
"(",
"X",
")",
"return",
"np",
".",
"mean",
"(",
"log_prob_norm",
")",
",",
"log_resp"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py2/sklearn/mixture/base.py#L244-L261 | |
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/python/framework/ops.py | python | get_from_proto_function | (collection_name) | Returns the from_proto function for collection_name. | Returns the from_proto function for collection_name. | [
"Returns",
"the",
"from_proto",
"function",
"for",
"collection_name",
"."
] | def get_from_proto_function(collection_name):
"""Returns the from_proto function for collection_name."""
try:
return _proto_function_registry.lookup(collection_name)[2]
except LookupError:
return None | [
"def",
"get_from_proto_function",
"(",
"collection_name",
")",
":",
"try",
":",
"return",
"_proto_function_registry",
".",
"lookup",
"(",
"collection_name",
")",
"[",
"2",
"]",
"except",
"LookupError",
":",
"return",
"None"
] | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/python/framework/ops.py#L4079-L4084 | ||
CRYTEK/CRYENGINE | 232227c59a220cbbd311576f0fbeba7bb53b2a8c | Editor/Python/windows/Lib/site-packages/pkg_resources/__init__.py | python | _is_unpacked_egg | (path) | return (
_is_egg_path(path) and
os.path.isfile(os.path.join(path, 'EGG-INFO', 'PKG-INFO'))
) | Determine if given path appears to be an unpacked egg. | Determine if given path appears to be an unpacked egg. | [
"Determine",
"if",
"given",
"path",
"appears",
"to",
"be",
"an",
"unpacked",
"egg",
"."
] | def _is_unpacked_egg(path):
"""
Determine if given path appears to be an unpacked egg.
"""
return (
_is_egg_path(path) and
os.path.isfile(os.path.join(path, 'EGG-INFO', 'PKG-INFO'))
) | [
"def",
"_is_unpacked_egg",
"(",
"path",
")",
":",
"return",
"(",
"_is_egg_path",
"(",
"path",
")",
"and",
"os",
".",
"path",
".",
"isfile",
"(",
"os",
".",
"path",
".",
"join",
"(",
"path",
",",
"'EGG-INFO'",
",",
"'PKG-INFO'",
")",
")",
")"
] | https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Editor/Python/windows/Lib/site-packages/pkg_resources/__init__.py#L2351-L2358 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/botocore/credentials.py | python | BaseAssumeRoleCredentialFetcher._create_cache_key | (self) | return self._make_file_safe(argument_hash) | Create a predictable cache key for the current configuration.
The cache key is intended to be compatible with file names. | Create a predictable cache key for the current configuration. | [
"Create",
"a",
"predictable",
"cache",
"key",
"for",
"the",
"current",
"configuration",
"."
] | def _create_cache_key(self):
"""Create a predictable cache key for the current configuration.
The cache key is intended to be compatible with file names.
"""
args = deepcopy(self._assume_kwargs)
# The role session name gets randomly generated, so we don't want it
# in t... | [
"def",
"_create_cache_key",
"(",
"self",
")",
":",
"args",
"=",
"deepcopy",
"(",
"self",
".",
"_assume_kwargs",
")",
"# The role session name gets randomly generated, so we don't want it",
"# in the hash.",
"if",
"self",
".",
"_using_default_session_name",
":",
"del",
"ar... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/botocore/credentials.py#L714-L734 | |
BitMEX/api-connectors | 37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812 | auto-generated/python/swagger_client/models/chat.py | python | Chat._date | (self) | return self.__date | Gets the _date of this Chat. # noqa: E501
:return: The _date of this Chat. # noqa: E501
:rtype: datetime | Gets the _date of this Chat. # noqa: E501 | [
"Gets",
"the",
"_date",
"of",
"this",
"Chat",
".",
"#",
"noqa",
":",
"E501"
] | def _date(self):
"""Gets the _date of this Chat. # noqa: E501
:return: The _date of this Chat. # noqa: E501
:rtype: datetime
"""
return self.__date | [
"def",
"_date",
"(",
"self",
")",
":",
"return",
"self",
".",
"__date"
] | https://github.com/BitMEX/api-connectors/blob/37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812/auto-generated/python/swagger_client/models/chat.py#L98-L105 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/botocore/session.py | python | Session.get_available_partitions | (self) | return resolver.get_available_partitions() | Lists the available partitions found on disk
:rtype: list
:return: Returns a list of partition names (e.g., ["aws", "aws-cn"]) | Lists the available partitions found on disk | [
"Lists",
"the",
"available",
"partitions",
"found",
"on",
"disk"
] | def get_available_partitions(self):
"""Lists the available partitions found on disk
:rtype: list
:return: Returns a list of partition names (e.g., ["aws", "aws-cn"])
"""
resolver = self._get_internal_component('endpoint_resolver')
return resolver.get_available_partitions... | [
"def",
"get_available_partitions",
"(",
"self",
")",
":",
"resolver",
"=",
"self",
".",
"_get_internal_component",
"(",
"'endpoint_resolver'",
")",
"return",
"resolver",
".",
"get_available_partitions",
"(",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/botocore/session.py#L868-L875 | |
astra-toolbox/astra-toolbox | 1e7ec8af702e595b76654f2e500f4c00344b273f | python/astra/matlab.py | python | projector | (command, *args) | return getattr(projector_c, command)(*args) | MATLAB-like interface to the :mod:`astra.projector` module
For example:
``astra.m.projector('volume_geometry',i)`` -- Get volume geometry. | MATLAB-like interface to the :mod:`astra.projector` module
For example:
``astra.m.projector('volume_geometry',i)`` -- Get volume geometry. | [
"MATLAB",
"-",
"like",
"interface",
"to",
"the",
":",
"mod",
":",
"astra",
".",
"projector",
"module",
"For",
"example",
":",
"astra",
".",
"m",
".",
"projector",
"(",
"volume_geometry",
"i",
")",
"--",
"Get",
"volume",
"geometry",
"."
] | def projector(command, *args):
"""MATLAB-like interface to the :mod:`astra.projector` module
For example:
``astra.m.projector('volume_geometry',i)`` -- Get volume geometry.
"""
return getattr(projector_c, command)(*args) | [
"def",
"projector",
"(",
"command",
",",
"*",
"args",
")",
":",
"return",
"getattr",
"(",
"projector_c",
",",
"command",
")",
"(",
"*",
"args",
")"
] | https://github.com/astra-toolbox/astra-toolbox/blob/1e7ec8af702e595b76654f2e500f4c00344b273f/python/astra/matlab.py#L80-L88 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/ipython/py3/IPython/utils/path.py | python | filefind | (filename, path_dirs=None) | Find a file by looking through a sequence of paths.
This iterates through a sequence of paths looking for a file and returns
the full, absolute path of the first occurrence of the file. If no set of
path dirs is given, the filename is tested as is, after running through
:func:`expandvars` and :func:`e... | Find a file by looking through a sequence of paths. | [
"Find",
"a",
"file",
"by",
"looking",
"through",
"a",
"sequence",
"of",
"paths",
"."
] | def filefind(filename, path_dirs=None):
"""Find a file by looking through a sequence of paths.
This iterates through a sequence of paths looking for a file and returns
the full, absolute path of the first occurrence of the file. If no set of
path dirs is given, the filename is tested as is, after runn... | [
"def",
"filefind",
"(",
"filename",
",",
"path_dirs",
"=",
"None",
")",
":",
"# If paths are quoted, abspath gets confused, strip them...",
"filename",
"=",
"filename",
".",
"strip",
"(",
"'\"'",
")",
".",
"strip",
"(",
"\"'\"",
")",
"# If the input is an absolute pat... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py3/IPython/utils/path.py#L112-L163 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/share/doc/python3.7/examples/Tools/scripts/patchcheck.py | python | docs_modified | (file_paths) | return bool(file_paths) | Report if any file in the Doc directory has been changed. | Report if any file in the Doc directory has been changed. | [
"Report",
"if",
"any",
"file",
"in",
"the",
"Doc",
"directory",
"has",
"been",
"changed",
"."
] | def docs_modified(file_paths):
"""Report if any file in the Doc directory has been changed."""
return bool(file_paths) | [
"def",
"docs_modified",
"(",
"file_paths",
")",
":",
"return",
"bool",
"(",
"file_paths",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/share/doc/python3.7/examples/Tools/scripts/patchcheck.py#L190-L192 | |
google/sling | f408a148a06bc2d62e853a292a8ba7266c642839 | python/flags.py | python | parse | () | Parse command-line flags. | Parse command-line flags. | [
"Parse",
"command",
"-",
"line",
"flags",
"."
] | def parse():
"""Parse command-line flags."""
# Register all the C++ flags.
flags = api.get_flags()
for name, help, default in flags:
if type(default) == bool:
parser.add_argument("--" + name,
help=help,
default=default,
acti... | [
"def",
"parse",
"(",
")",
":",
"# Register all the C++ flags.",
"flags",
"=",
"api",
".",
"get_flags",
"(",
")",
"for",
"name",
",",
"help",
",",
"default",
"in",
"flags",
":",
"if",
"type",
"(",
"default",
")",
"==",
"bool",
":",
"parser",
".",
"add_a... | https://github.com/google/sling/blob/f408a148a06bc2d62e853a292a8ba7266c642839/python/flags.py#L38-L66 | ||
rootm0s/Protectors | 5b3f4d11687a5955caf9c3af30666c4bfc2c19ab | OWASP-ZSC/module/readline_windows/pyreadline/console/ironpython_console.py | python | Console.__del__ | (self) | Cleanup the console when finished. | Cleanup the console when finished. | [
"Cleanup",
"the",
"console",
"when",
"finished",
"."
] | def __del__(self):
'''Cleanup the console when finished.'''
# I don't think this ever gets called
pass | [
"def",
"__del__",
"(",
"self",
")",
":",
"# I don't think this ever gets called",
"pass"
] | https://github.com/rootm0s/Protectors/blob/5b3f4d11687a5955caf9c3af30666c4bfc2c19ab/OWASP-ZSC/module/readline_windows/pyreadline/console/ironpython_console.py#L110-L113 | ||
grpc/grpc | 27bc6fe7797e43298dc931b96dc57322d0852a9f | src/python/grpcio/grpc/aio/_base_call.py | python | RpcContext.cancelled | (self) | Return True if the RPC is cancelled.
The RPC is cancelled when the cancellation was requested with cancel().
Returns:
A bool indicates whether the RPC is cancelled or not. | Return True if the RPC is cancelled. | [
"Return",
"True",
"if",
"the",
"RPC",
"is",
"cancelled",
"."
] | def cancelled(self) -> bool:
"""Return True if the RPC is cancelled.
The RPC is cancelled when the cancellation was requested with cancel().
Returns:
A bool indicates whether the RPC is cancelled or not.
""" | [
"def",
"cancelled",
"(",
"self",
")",
"->",
"bool",
":"
] | https://github.com/grpc/grpc/blob/27bc6fe7797e43298dc931b96dc57322d0852a9f/src/python/grpcio/grpc/aio/_base_call.py#L40-L47 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/keras/layers/recurrent.py | python | _standardize_args | (inputs, initial_state, constants, num_constants) | return inputs, initial_state, constants | Standardizes `__call__` to a single list of tensor inputs.
When running a model loaded from a file, the input tensors
`initial_state` and `constants` can be passed to `RNN.__call__()` as part
of `inputs` instead of by the dedicated keyword arguments. This method
makes sure the arguments are separated and that ... | Standardizes `__call__` to a single list of tensor inputs. | [
"Standardizes",
"__call__",
"to",
"a",
"single",
"list",
"of",
"tensor",
"inputs",
"."
] | def _standardize_args(inputs, initial_state, constants, num_constants):
"""Standardizes `__call__` to a single list of tensor inputs.
When running a model loaded from a file, the input tensors
`initial_state` and `constants` can be passed to `RNN.__call__()` as part
of `inputs` instead of by the dedicated keyw... | [
"def",
"_standardize_args",
"(",
"inputs",
",",
"initial_state",
",",
"constants",
",",
"num_constants",
")",
":",
"if",
"isinstance",
"(",
"inputs",
",",
"list",
")",
":",
"# There are several situations here:",
"# In the graph mode, __call__ will be only called once. The ... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/keras/layers/recurrent.py#L2936-L2994 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py3/scipy/ndimage/morphology.py | python | binary_fill_holes | (input, structure=None, output=None, origin=0) | Fill the holes in binary objects.
Parameters
----------
input : array_like
n-dimensional binary array with holes to be filled
structure : array_like, optional
Structuring element used in the computation; large-size elements
make computations faster but may miss holes separated ... | Fill the holes in binary objects. | [
"Fill",
"the",
"holes",
"in",
"binary",
"objects",
"."
] | def binary_fill_holes(input, structure=None, output=None, origin=0):
"""
Fill the holes in binary objects.
Parameters
----------
input : array_like
n-dimensional binary array with holes to be filled
structure : array_like, optional
Structuring element used in the computation; l... | [
"def",
"binary_fill_holes",
"(",
"input",
",",
"structure",
"=",
"None",
",",
"output",
"=",
"None",
",",
"origin",
"=",
"0",
")",
":",
"mask",
"=",
"numpy",
".",
"logical_not",
"(",
"input",
")",
"tmp",
"=",
"numpy",
".",
"zeros",
"(",
"mask",
".",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py3/scipy/ndimage/morphology.py#L1019-L1100 | ||
panda3d/panda3d | 833ad89ebad58395d0af0b7ec08538e5e4308265 | direct/src/actor/Actor.py | python | Actor.getAnimControl | (self, animName, partName=None, lodName=None,
allowAsyncBind = True) | return None | getAnimControl(self, string, string, string="lodRoot")
Search the animControl dictionary indicated by lodName for
a given anim and part. If none specified, try the first part and lod.
Return the animControl if present, or None otherwise. | getAnimControl(self, string, string, string="lodRoot")
Search the animControl dictionary indicated by lodName for
a given anim and part. If none specified, try the first part and lod.
Return the animControl if present, or None otherwise. | [
"getAnimControl",
"(",
"self",
"string",
"string",
"string",
"=",
"lodRoot",
")",
"Search",
"the",
"animControl",
"dictionary",
"indicated",
"by",
"lodName",
"for",
"a",
"given",
"anim",
"and",
"part",
".",
"If",
"none",
"specified",
"try",
"the",
"first",
"... | def getAnimControl(self, animName, partName=None, lodName=None,
allowAsyncBind = True):
"""
getAnimControl(self, string, string, string="lodRoot")
Search the animControl dictionary indicated by lodName for
a given anim and part. If none specified, try the first par... | [
"def",
"getAnimControl",
"(",
"self",
",",
"animName",
",",
"partName",
"=",
"None",
",",
"lodName",
"=",
"None",
",",
"allowAsyncBind",
"=",
"True",
")",
":",
"if",
"not",
"partName",
":",
"partName",
"=",
"'modelRoot'",
"if",
"self",
".",
"mergeLODBundle... | https://github.com/panda3d/panda3d/blob/833ad89ebad58395d0af0b7ec08538e5e4308265/direct/src/actor/Actor.py#L1707-L1749 | |
idaholab/moose | 9eeebc65e098b4c30f8205fb41591fd5b61eb6ff | python/mooseutils/ImageDiffer.py | python | ImageDiffer.__readImage | (self, filename) | return plt.imread(filename) | A read function that appends an error message if the read fails. (private) | A read function that appends an error message if the read fails. (private) | [
"A",
"read",
"function",
"that",
"appends",
"an",
"error",
"message",
"if",
"the",
"read",
"fails",
".",
"(",
"private",
")"
] | def __readImage(self, filename):
"""
A read function that appends an error message if the read fails. (private)
"""
if not os.path.exists(filename):
self.__addError('Failed to open ' + filename + ', the file does not exist.')
return None
import matplotli... | [
"def",
"__readImage",
"(",
"self",
",",
"filename",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"filename",
")",
":",
"self",
".",
"__addError",
"(",
"'Failed to open '",
"+",
"filename",
"+",
"', the file does not exist.'",
")",
"return",
... | https://github.com/idaholab/moose/blob/9eeebc65e098b4c30f8205fb41591fd5b61eb6ff/python/mooseutils/ImageDiffer.py#L147-L157 | |
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/python/ops/nn_grad.py | python | _L2LossGrad | (op, grad) | return op.inputs[0] * grad | Return the gradients for L2Loss.
Args:
op: The L2LossOp for which we need to generate gradients.
grad: Tensor containing a single number.
Returns:
The gradient, which is (x * grad). | Return the gradients for L2Loss. | [
"Return",
"the",
"gradients",
"for",
"L2Loss",
"."
] | def _L2LossGrad(op, grad):
"""Return the gradients for L2Loss.
Args:
op: The L2LossOp for which we need to generate gradients.
grad: Tensor containing a single number.
Returns:
The gradient, which is (x * grad).
"""
return op.inputs[0] * grad | [
"def",
"_L2LossGrad",
"(",
"op",
",",
"grad",
")",
":",
"return",
"op",
".",
"inputs",
"[",
"0",
"]",
"*",
"grad"
] | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/python/ops/nn_grad.py#L392-L402 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/urllib3/contrib/securetransport.py | python | SecureTransportContext.check_hostname | (self, value) | SecureTransport cannot have its hostname checking disabled. For more,
see the comment on getpeercert() in this file. | SecureTransport cannot have its hostname checking disabled. For more,
see the comment on getpeercert() in this file. | [
"SecureTransport",
"cannot",
"have",
"its",
"hostname",
"checking",
"disabled",
".",
"For",
"more",
"see",
"the",
"comment",
"on",
"getpeercert",
"()",
"in",
"this",
"file",
"."
] | def check_hostname(self, value):
"""
SecureTransport cannot have its hostname checking disabled. For more,
see the comment on getpeercert() in this file.
"""
pass | [
"def",
"check_hostname",
"(",
"self",
",",
"value",
")",
":",
"pass"
] | 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/urllib3/contrib/securetransport.py#L810-L815 | ||
apple/swift-lldb | d74be846ef3e62de946df343e8c234bde93a8912 | scripts/Python/static-binding/lldb.py | python | SBVariablesOptions.GetInScopeOnly | (self) | return _lldb.SBVariablesOptions_GetInScopeOnly(self) | GetInScopeOnly(SBVariablesOptions self) -> bool | GetInScopeOnly(SBVariablesOptions self) -> bool | [
"GetInScopeOnly",
"(",
"SBVariablesOptions",
"self",
")",
"-",
">",
"bool"
] | def GetInScopeOnly(self):
"""GetInScopeOnly(SBVariablesOptions self) -> bool"""
return _lldb.SBVariablesOptions_GetInScopeOnly(self) | [
"def",
"GetInScopeOnly",
"(",
"self",
")",
":",
"return",
"_lldb",
".",
"SBVariablesOptions_GetInScopeOnly",
"(",
"self",
")"
] | https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/scripts/Python/static-binding/lldb.py#L15088-L15090 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/richtext.py | python | RichTextCtrl.LoadFile | (*args, **kwargs) | return _richtext.RichTextCtrl_LoadFile(*args, **kwargs) | LoadFile(self, String file, int type=RICHTEXT_TYPE_ANY) -> bool
Load the contents of the document from the given filename. | LoadFile(self, String file, int type=RICHTEXT_TYPE_ANY) -> bool | [
"LoadFile",
"(",
"self",
"String",
"file",
"int",
"type",
"=",
"RICHTEXT_TYPE_ANY",
")",
"-",
">",
"bool"
] | def LoadFile(*args, **kwargs):
"""
LoadFile(self, String file, int type=RICHTEXT_TYPE_ANY) -> bool
Load the contents of the document from the given filename.
"""
return _richtext.RichTextCtrl_LoadFile(*args, **kwargs) | [
"def",
"LoadFile",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"RichTextCtrl_LoadFile",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/richtext.py#L3077-L3083 | |
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/python/ops/parsing_ops.py | python | parse_single_sequence_example | (
serialized, context_features=None, sequence_features=None,
example_name=None, name=None) | return _parse_single_sequence_example_raw(
serialized, context_sparse_keys, context_sparse_types,
context_dense_keys, context_dense_types, context_dense_defaults,
context_dense_shapes, feature_list_sparse_keys,
feature_list_sparse_types, feature_list_dense_keys,
feature_list_dense_types, f... | Parses a single `SequenceExample` proto.
Parses a single serialized [`SequenceExample`]
(https://www.tensorflow.org/code/tensorflow/core/example/example.proto)
proto given in `serialized`.
This op parses a serialize sequence example into a tuple of dictionaries
mapping keys to `Tensor` and `SparseTensor` ob... | Parses a single `SequenceExample` proto. | [
"Parses",
"a",
"single",
"SequenceExample",
"proto",
"."
] | def parse_single_sequence_example(
serialized, context_features=None, sequence_features=None,
example_name=None, name=None):
# pylint: disable=line-too-long
"""Parses a single `SequenceExample` proto.
Parses a single serialized [`SequenceExample`]
(https://www.tensorflow.org/code/tensorflow/core/exampl... | [
"def",
"parse_single_sequence_example",
"(",
"serialized",
",",
"context_features",
"=",
"None",
",",
"sequence_features",
"=",
"None",
",",
"example_name",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"# pylint: disable=line-too-long",
"# pylint: enable=line-too-lo... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/python/ops/parsing_ops.py#L563-L657 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/lib-tk/Tkinter.py | python | Misc._options | (self, cnf, kw = None) | return res | Internal function. | Internal function. | [
"Internal",
"function",
"."
] | def _options(self, cnf, kw = None):
"""Internal function."""
if kw:
cnf = _cnfmerge((cnf, kw))
else:
cnf = _cnfmerge(cnf)
res = ()
for k, v in cnf.items():
if v is not None:
if k[-1] == '_': k = k[:-1]
if hasattr... | [
"def",
"_options",
"(",
"self",
",",
"cnf",
",",
"kw",
"=",
"None",
")",
":",
"if",
"kw",
":",
"cnf",
"=",
"_cnfmerge",
"(",
"(",
"cnf",
",",
"kw",
")",
")",
"else",
":",
"cnf",
"=",
"_cnfmerge",
"(",
"cnf",
")",
"res",
"=",
"(",
")",
"for",
... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/lib-tk/Tkinter.py#L1100-L1125 | |
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | current/deps/v8/third_party/jinja2/compiler.py | python | CodeGenerator.buffer | (self, frame) | Enable buffering for the frame from that point onwards. | Enable buffering for the frame from that point onwards. | [
"Enable",
"buffering",
"for",
"the",
"frame",
"from",
"that",
"point",
"onwards",
"."
] | def buffer(self, frame):
"""Enable buffering for the frame from that point onwards."""
frame.buffer = self.temporary_identifier()
self.writeline('%s = []' % frame.buffer) | [
"def",
"buffer",
"(",
"self",
",",
"frame",
")",
":",
"frame",
".",
"buffer",
"=",
"self",
".",
"temporary_identifier",
"(",
")",
"self",
".",
"writeline",
"(",
"'%s = []'",
"%",
"frame",
".",
"buffer",
")"
] | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/current/deps/v8/third_party/jinja2/compiler.py#L322-L325 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_controls.py | python | TextAttr.SetPageBreak | (*args, **kwargs) | return _controls_.TextAttr_SetPageBreak(*args, **kwargs) | SetPageBreak(self, bool pageBreak=True) | SetPageBreak(self, bool pageBreak=True) | [
"SetPageBreak",
"(",
"self",
"bool",
"pageBreak",
"=",
"True",
")"
] | def SetPageBreak(*args, **kwargs):
"""SetPageBreak(self, bool pageBreak=True)"""
return _controls_.TextAttr_SetPageBreak(*args, **kwargs) | [
"def",
"SetPageBreak",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"TextAttr_SetPageBreak",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_controls.py#L1623-L1625 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/saved_model/builder_impl.py | python | _SavedModelBuilder.add_meta_graph | (self,
tags,
signature_def_map=None,
assets_list=None,
clear_devices=False,
init_op=None,
train_op=None,
saver=None) | Adds the current meta graph to the SavedModel.
Creates a Saver in the current scope and uses the Saver to export the meta
graph def. Invoking this API requires the `add_meta_graph_and_variables()`
API to have been invoked before.
Args:
tags: The set of tags to annotate the meta graph def with.
... | Adds the current meta graph to the SavedModel. | [
"Adds",
"the",
"current",
"meta",
"graph",
"to",
"the",
"SavedModel",
"."
] | def add_meta_graph(self,
tags,
signature_def_map=None,
assets_list=None,
clear_devices=False,
init_op=None,
train_op=None,
saver=None):
"""Adds the current meta graph to... | [
"def",
"add_meta_graph",
"(",
"self",
",",
"tags",
",",
"signature_def_map",
"=",
"None",
",",
"assets_list",
"=",
"None",
",",
"clear_devices",
"=",
"False",
",",
"init_op",
"=",
"None",
",",
"train_op",
"=",
"None",
",",
"saver",
"=",
"None",
")",
":",... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/saved_model/builder_impl.py#L230-L300 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/PIL/BlpImagePlugin.py | python | decode_dxt1 | (data, alpha=False) | return ret | input: one "row" of data (i.e. will produce 4*width pixels) | input: one "row" of data (i.e. will produce 4*width pixels) | [
"input",
":",
"one",
"row",
"of",
"data",
"(",
"i",
".",
"e",
".",
"will",
"produce",
"4",
"*",
"width",
"pixels",
")"
] | def decode_dxt1(data, alpha=False):
"""
input: one "row" of data (i.e. will produce 4*width pixels)
"""
blocks = len(data) // 8 # number of blocks in row
ret = (bytearray(), bytearray(), bytearray(), bytearray())
for block in range(blocks):
# Decode next 8-byte block.
idx = bl... | [
"def",
"decode_dxt1",
"(",
"data",
",",
"alpha",
"=",
"False",
")",
":",
"blocks",
"=",
"len",
"(",
"data",
")",
"//",
"8",
"# number of blocks in row",
"ret",
"=",
"(",
"bytearray",
"(",
")",
",",
"bytearray",
"(",
")",
",",
"bytearray",
"(",
")",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/PIL/BlpImagePlugin.py#L52-L104 | |
falkTX/Carla | 74a1ae82c90db85f20550ddcdc8a927b8fb7e414 | source/modules/lilv/lilv-0.24.0/bindings/python/lilv.py | python | World.get | (self, subject, predicate, obj) | return Node.wrap(world_get(self.world,
subject.node if subject is not None else None,
predicate.node if predicate is not None else None,
obj.node if obj is not None else None)) | Find a single node that matches a pattern.
Exactly one of `subject`, `predicate`, `object` must be None.
Returns the first matching node, or None if no matches are found. | Find a single node that matches a pattern. | [
"Find",
"a",
"single",
"node",
"that",
"matches",
"a",
"pattern",
"."
] | def get(self, subject, predicate, obj):
"""Find a single node that matches a pattern.
Exactly one of `subject`, `predicate`, `object` must be None.
Returns the first matching node, or None if no matches are found.
"""
return Node.wrap(world_get(self.world,
... | [
"def",
"get",
"(",
"self",
",",
"subject",
",",
"predicate",
",",
"obj",
")",
":",
"return",
"Node",
".",
"wrap",
"(",
"world_get",
"(",
"self",
".",
"world",
",",
"subject",
".",
"node",
"if",
"subject",
"is",
"not",
"None",
"else",
"None",
",",
"... | https://github.com/falkTX/Carla/blob/74a1ae82c90db85f20550ddcdc8a927b8fb7e414/source/modules/lilv/lilv-0.24.0/bindings/python/lilv.py#L1132-L1142 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/setuptools/msvc.py | python | EnvironmentInfo.vs_ver | (self) | return self.si.vs_ver | Microsoft Visual Studio.
Return
------
float
version | Microsoft Visual Studio. | [
"Microsoft",
"Visual",
"Studio",
"."
] | def vs_ver(self):
"""
Microsoft Visual Studio.
Return
------
float
version
"""
return self.si.vs_ver | [
"def",
"vs_ver",
"(",
"self",
")",
":",
"return",
"self",
".",
"si",
".",
"vs_ver"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/setuptools/msvc.py#L1225-L1234 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/idlelib/macosxSupport.py | python | setupApp | (root, flist) | Perform setup for the OSX application bundle. | Perform setup for the OSX application bundle. | [
"Perform",
"setup",
"for",
"the",
"OSX",
"application",
"bundle",
"."
] | def setupApp(root, flist):
"""
Perform setup for the OSX application bundle.
"""
if not runningAsOSXApp(): return
hideTkConsole(root)
overrideRootMenu(root, flist)
addOpenEventSupport(root, flist) | [
"def",
"setupApp",
"(",
"root",
",",
"flist",
")",
":",
"if",
"not",
"runningAsOSXApp",
"(",
")",
":",
"return",
"hideTkConsole",
"(",
"root",
")",
"overrideRootMenu",
"(",
"root",
",",
"flist",
")",
"addOpenEventSupport",
"(",
"root",
",",
"flist",
")"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/idlelib/macosxSupport.py#L167-L175 | ||
CRYTEK/CRYENGINE | 232227c59a220cbbd311576f0fbeba7bb53b2a8c | Editor/Python/windows/Lib/site-packages/pip/_vendor/lockfile/__init__.py | python | LinkFileLock | (*args, **kwds) | return _fl_helper(linklockfile.LinkLockFile, "lockfile.linklockfile",
*args, **kwds) | Factory function provided for backwards compatibility.
Do not use in new code. Instead, import LinkLockFile from the
lockfile.linklockfile module. | Factory function provided for backwards compatibility. | [
"Factory",
"function",
"provided",
"for",
"backwards",
"compatibility",
"."
] | def LinkFileLock(*args, **kwds):
"""Factory function provided for backwards compatibility.
Do not use in new code. Instead, import LinkLockFile from the
lockfile.linklockfile module.
"""
from . import linklockfile
return _fl_helper(linklockfile.LinkLockFile, "lockfile.linklockfile",
... | [
"def",
"LinkFileLock",
"(",
"*",
"args",
",",
"*",
"*",
"kwds",
")",
":",
"from",
".",
"import",
"linklockfile",
"return",
"_fl_helper",
"(",
"linklockfile",
".",
"LinkLockFile",
",",
"\"lockfile.linklockfile\"",
",",
"*",
"args",
",",
"*",
"*",
"kwds",
")... | https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Editor/Python/windows/Lib/site-packages/pip/_vendor/lockfile/__init__.py#L264-L272 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/tools/quantization/quantize_graph.py | python | quantize_weight_rounded | (input_node) | return [
create_constant_node(
input_node.name,
tensor_value_rounded,
dtypes.float32,
shape=tensor_shape_list)
] | Returns a replacement node for input_node containing bucketed floats. | Returns a replacement node for input_node containing bucketed floats. | [
"Returns",
"a",
"replacement",
"node",
"for",
"input_node",
"containing",
"bucketed",
"floats",
"."
] | def quantize_weight_rounded(input_node):
"""Returns a replacement node for input_node containing bucketed floats."""
input_tensor = input_node.attr["value"].tensor
tensor_value = tensor_util.MakeNdarray(input_tensor)
shape = input_tensor.tensor_shape
# Currently, the parameter FLAGS.bitdepth is used to comput... | [
"def",
"quantize_weight_rounded",
"(",
"input_node",
")",
":",
"input_tensor",
"=",
"input_node",
".",
"attr",
"[",
"\"value\"",
"]",
".",
"tensor",
"tensor_value",
"=",
"tensor_util",
".",
"MakeNdarray",
"(",
"input_tensor",
")",
"shape",
"=",
"input_tensor",
"... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/tools/quantization/quantize_graph.py#L241-L262 | |
apple/swift-lldb | d74be846ef3e62de946df343e8c234bde93a8912 | scripts/Python/static-binding/lldb.py | python | SBMemoryRegionInfo.GetRegionEnd | (self) | return _lldb.SBMemoryRegionInfo_GetRegionEnd(self) | GetRegionEnd(SBMemoryRegionInfo self) -> lldb::addr_t | GetRegionEnd(SBMemoryRegionInfo self) -> lldb::addr_t | [
"GetRegionEnd",
"(",
"SBMemoryRegionInfo",
"self",
")",
"-",
">",
"lldb",
"::",
"addr_t"
] | def GetRegionEnd(self):
"""GetRegionEnd(SBMemoryRegionInfo self) -> lldb::addr_t"""
return _lldb.SBMemoryRegionInfo_GetRegionEnd(self) | [
"def",
"GetRegionEnd",
"(",
"self",
")",
":",
"return",
"_lldb",
".",
"SBMemoryRegionInfo_GetRegionEnd",
"(",
"self",
")"
] | https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/scripts/Python/static-binding/lldb.py#L6939-L6941 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/odr/odrpack.py | python | _conv | (obj, dtype=None) | Convert an object to the preferred form for input to the odr routine. | Convert an object to the preferred form for input to the odr routine. | [
"Convert",
"an",
"object",
"to",
"the",
"preferred",
"form",
"for",
"input",
"to",
"the",
"odr",
"routine",
"."
] | def _conv(obj, dtype=None):
""" Convert an object to the preferred form for input to the odr routine.
"""
if obj is None:
return obj
else:
if dtype is None:
obj = numpy.asarray(obj)
else:
obj = numpy.asarray(obj, dtype)
if obj.shape == ():
... | [
"def",
"_conv",
"(",
"obj",
",",
"dtype",
"=",
"None",
")",
":",
"if",
"obj",
"is",
"None",
":",
"return",
"obj",
"else",
":",
"if",
"dtype",
"is",
"None",
":",
"obj",
"=",
"numpy",
".",
"asarray",
"(",
"obj",
")",
"else",
":",
"obj",
"=",
"num... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/odr/odrpack.py#L87-L102 | ||
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/python/framework/ops.py | python | get_gradient_function | (op) | return _gradient_registry.lookup(op_type) | Returns the function that computes gradients for "op". | Returns the function that computes gradients for "op". | [
"Returns",
"the",
"function",
"that",
"computes",
"gradients",
"for",
"op",
"."
] | def get_gradient_function(op):
"""Returns the function that computes gradients for "op"."""
if not op.inputs: return None
try:
op_type = op.get_attr("_gradient_op_type")
except ValueError:
op_type = op.type
return _gradient_registry.lookup(op_type) | [
"def",
"get_gradient_function",
"(",
"op",
")",
":",
"if",
"not",
"op",
".",
"inputs",
":",
"return",
"None",
"try",
":",
"op_type",
"=",
"op",
".",
"get_attr",
"(",
"\"_gradient_op_type\"",
")",
"except",
"ValueError",
":",
"op_type",
"=",
"op",
".",
"t... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/framework/ops.py#L1708-L1715 | |
rdkit/rdkit | ede860ae316d12d8568daf5ee800921c3389c84e | rdkit/ML/Data/SplitData.py | python | SplitIndices | (nPts, frac, silent=1, legacy=0, replacement=0) | return resData, resTest | splits a set of indices into a data set into 2 pieces
**Arguments**
- nPts: the total number of points
- frac: the fraction of the data to be put in the first data set
- silent: (optional) toggles display of stats
- legacy: (optional) use the legacy splitting approach
- replacement: (... | splits a set of indices into a data set into 2 pieces | [
"splits",
"a",
"set",
"of",
"indices",
"into",
"a",
"data",
"set",
"into",
"2",
"pieces"
] | def SplitIndices(nPts, frac, silent=1, legacy=0, replacement=0):
""" splits a set of indices into a data set into 2 pieces
**Arguments**
- nPts: the total number of points
- frac: the fraction of the data to be put in the first data set
- silent: (optional) toggles display of stats
- lega... | [
"def",
"SplitIndices",
"(",
"nPts",
",",
"frac",
",",
"silent",
"=",
"1",
",",
"legacy",
"=",
"0",
",",
"replacement",
"=",
"0",
")",
":",
"if",
"frac",
"<",
"0.",
"or",
"frac",
">",
"1.",
":",
"raise",
"ValueError",
"(",
"'frac must be between 0.0 and... | https://github.com/rdkit/rdkit/blob/ede860ae316d12d8568daf5ee800921c3389c84e/rdkit/ML/Data/SplitData.py#L14-L133 | |
Z3Prover/z3 | d745d03afdfdf638d66093e2bfbacaf87187f35b | src/api/python/z3/z3.py | python | AstRef.eq | (self, other) | return Z3_is_eq_ast(self.ctx_ref(), self.as_ast(), other.as_ast()) | Return `True` if `self` and `other` are structurally identical.
>>> x = Int('x')
>>> n1 = x + 1
>>> n2 = 1 + x
>>> n1.eq(n2)
False
>>> n1 = simplify(n1)
>>> n2 = simplify(n2)
>>> n1.eq(n2)
True | Return `True` if `self` and `other` are structurally identical. | [
"Return",
"True",
"if",
"self",
"and",
"other",
"are",
"structurally",
"identical",
"."
] | def eq(self, other):
"""Return `True` if `self` and `other` are structurally identical.
>>> x = Int('x')
>>> n1 = x + 1
>>> n2 = 1 + x
>>> n1.eq(n2)
False
>>> n1 = simplify(n1)
>>> n2 = simplify(n2)
>>> n1.eq(n2)
True
"""
i... | [
"def",
"eq",
"(",
"self",
",",
"other",
")",
":",
"if",
"z3_debug",
"(",
")",
":",
"_z3_assert",
"(",
"is_ast",
"(",
"other",
")",
",",
"\"Z3 AST expected\"",
")",
"return",
"Z3_is_eq_ast",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"self",
".",
"as... | https://github.com/Z3Prover/z3/blob/d745d03afdfdf638d66093e2bfbacaf87187f35b/src/api/python/z3/z3.py#L403-L418 | |
msftguy/ssh-rd | a5f3a79daeac5844edebf01916c9613563f1c390 | _3rd/boost_1_48_0/tools/build/v2/tools/common.py | python | find_tool | (name, additional_paths = [], path_last = False) | Attempts to find tool (binary) named 'name' in PATH and in
'additional-paths'. If found in path, returns 'name'. If
found in additional paths, returns full name. If the tool
is found in several directories, returns the first path found.
Otherwise, returns the empty string. If 'path_l... | Attempts to find tool (binary) named 'name' in PATH and in
'additional-paths'. If found in path, returns 'name'. If
found in additional paths, returns full name. If the tool
is found in several directories, returns the first path found.
Otherwise, returns the empty string. If 'path_l... | [
"Attempts",
"to",
"find",
"tool",
"(",
"binary",
")",
"named",
"name",
"in",
"PATH",
"and",
"in",
"additional",
"-",
"paths",
".",
"If",
"found",
"in",
"path",
"returns",
"name",
".",
"If",
"found",
"in",
"additional",
"paths",
"returns",
"full",
"name",... | def find_tool(name, additional_paths = [], path_last = False):
""" Attempts to find tool (binary) named 'name' in PATH and in
'additional-paths'. If found in path, returns 'name'. If
found in additional paths, returns full name. If the tool
is found in several directories, returns the fir... | [
"def",
"find_tool",
"(",
"name",
",",
"additional_paths",
"=",
"[",
"]",
",",
"path_last",
"=",
"False",
")",
":",
"assert",
"(",
"isinstance",
"(",
"name",
",",
"str",
")",
")",
"assert",
"(",
"isinstance",
"(",
"additional_paths",
",",
"list",
")",
"... | https://github.com/msftguy/ssh-rd/blob/a5f3a79daeac5844edebf01916c9613563f1c390/_3rd/boost_1_48_0/tools/build/v2/tools/common.py#L354-L386 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/gslib/hashing_helper.py | python | Base64ToHexHash | (base64_hash) | return binascii.hexlify(base64.decodestring(base64_hash.strip('\n"\''))) | Returns the hex digest value of the input base64-encoded hash.
Args:
base64_hash: Base64-encoded hash, which may contain newlines and single or
double quotes.
Returns:
Hex digest of the input argument. | Returns the hex digest value of the input base64-encoded hash. | [
"Returns",
"the",
"hex",
"digest",
"value",
"of",
"the",
"input",
"base64",
"-",
"encoded",
"hash",
"."
] | def Base64ToHexHash(base64_hash):
"""Returns the hex digest value of the input base64-encoded hash.
Args:
base64_hash: Base64-encoded hash, which may contain newlines and single or
double quotes.
Returns:
Hex digest of the input argument.
"""
return binascii.hexlify(base64.decodestring(base6... | [
"def",
"Base64ToHexHash",
"(",
"base64_hash",
")",
":",
"return",
"binascii",
".",
"hexlify",
"(",
"base64",
".",
"decodestring",
"(",
"base64_hash",
".",
"strip",
"(",
"'\\n\"\\''",
")",
")",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/gslib/hashing_helper.py#L251-L261 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/generic.py | python | NDFrame._is_label_or_level_reference | (self, key: str, axis: int = 0) | return self._is_level_reference(key, axis=axis) or self._is_label_reference(
key, axis=axis
) | Test whether a key is a label or level reference for a given axis.
To be considered either a label or a level reference, `key` must be a
string that:
- (axis=0): Matches a column label or an index level
- (axis=1): Matches an index label or a column level
Parameters
... | Test whether a key is a label or level reference for a given axis. | [
"Test",
"whether",
"a",
"key",
"is",
"a",
"label",
"or",
"level",
"reference",
"for",
"a",
"given",
"axis",
"."
] | def _is_label_or_level_reference(self, key: str, axis: int = 0) -> bool_t:
"""
Test whether a key is a label or level reference for a given axis.
To be considered either a label or a level reference, `key` must be a
string that:
- (axis=0): Matches a column label or an index l... | [
"def",
"_is_label_or_level_reference",
"(",
"self",
",",
"key",
":",
"str",
",",
"axis",
":",
"int",
"=",
"0",
")",
"->",
"bool_t",
":",
"return",
"self",
".",
"_is_level_reference",
"(",
"key",
",",
"axis",
"=",
"axis",
")",
"or",
"self",
".",
"_is_la... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/generic.py#L1582-L1604 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_misc.py | python | Process.Exists | (*args, **kwargs) | return _misc_.Process_Exists(*args, **kwargs) | Exists(int pid) -> bool | Exists(int pid) -> bool | [
"Exists",
"(",
"int",
"pid",
")",
"-",
">",
"bool"
] | def Exists(*args, **kwargs):
"""Exists(int pid) -> bool"""
return _misc_.Process_Exists(*args, **kwargs) | [
"def",
"Exists",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"Process_Exists",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_misc.py#L1969-L1971 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/generic.py | python | NDFrame._is_cached | (self) | return getattr(self, "_cacher", None) is not None | Return boolean indicating if self is cached or not. | Return boolean indicating if self is cached or not. | [
"Return",
"boolean",
"indicating",
"if",
"self",
"is",
"cached",
"or",
"not",
"."
] | def _is_cached(self) -> bool_t:
"""Return boolean indicating if self is cached or not."""
return getattr(self, "_cacher", None) is not None | [
"def",
"_is_cached",
"(",
"self",
")",
"->",
"bool_t",
":",
"return",
"getattr",
"(",
"self",
",",
"\"_cacher\"",
",",
"None",
")",
"is",
"not",
"None"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/generic.py#L3244-L3246 | |
facebook/bistro | db9eff7e92f5cedcc917a440d5c88064c7980e40 | build/fbcode_builder/shell_quoting.py | python | raw_shell | (s) | Not a member of ShellQuoted so we get a useful error for raw strings | Not a member of ShellQuoted so we get a useful error for raw strings | [
"Not",
"a",
"member",
"of",
"ShellQuoted",
"so",
"we",
"get",
"a",
"useful",
"error",
"for",
"raw",
"strings"
] | def raw_shell(s):
"Not a member of ShellQuoted so we get a useful error for raw strings"
if isinstance(s, ShellQuoted):
return s.do_not_use_raw_str
raise RuntimeError("{0} should have been ShellQuoted".format(s)) | [
"def",
"raw_shell",
"(",
"s",
")",
":",
"if",
"isinstance",
"(",
"s",
",",
"ShellQuoted",
")",
":",
"return",
"s",
".",
"do_not_use_raw_str",
"raise",
"RuntimeError",
"(",
"\"{0} should have been ShellQuoted\"",
".",
"format",
"(",
"s",
")",
")"
] | https://github.com/facebook/bistro/blob/db9eff7e92f5cedcc917a440d5c88064c7980e40/build/fbcode_builder/shell_quoting.py#L77-L81 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/layers/python/layers/rev_block_lib.py | python | enable_with_args | (dec) | return new_dec | A decorator for decorators to enable their usage with or without args. | A decorator for decorators to enable their usage with or without args. | [
"A",
"decorator",
"for",
"decorators",
"to",
"enable",
"their",
"usage",
"with",
"or",
"without",
"args",
"."
] | def enable_with_args(dec):
"""A decorator for decorators to enable their usage with or without args."""
@_safe_wraps(dec)
def new_dec(*args, **kwargs):
if len(args) == 1 and not kwargs and callable(args[0]):
# Used as decorator without args
fn = args[0]
return dec(fn)
else:
return... | [
"def",
"enable_with_args",
"(",
"dec",
")",
":",
"@",
"_safe_wraps",
"(",
"dec",
")",
"def",
"new_dec",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"len",
"(",
"args",
")",
"==",
"1",
"and",
"not",
"kwargs",
"and",
"callable",
"(",
... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/layers/python/layers/rev_block_lib.py#L442-L454 | |
scummvm/scummvm | 9c039d027e7ffb9d83ae2e274147e2daf8d57ce2 | devtools/dumper-companion.py | python | needs_punyencoding | (orig: str) | return False | A filename needs to be punyencoded when it:
- contains a char that should be escaped or
- ends with a dot or a space. | A filename needs to be punyencoded when it: | [
"A",
"filename",
"needs",
"to",
"be",
"punyencoded",
"when",
"it",
":"
] | def needs_punyencoding(orig: str) -> bool:
"""
A filename needs to be punyencoded when it:
- contains a char that should be escaped or
- ends with a dot or a space.
"""
if orig != escape_string(orig):
return True
if orig[-1] in " .":
return True
return False | [
"def",
"needs_punyencoding",
"(",
"orig",
":",
"str",
")",
"->",
"bool",
":",
"if",
"orig",
"!=",
"escape_string",
"(",
"orig",
")",
":",
"return",
"True",
"if",
"orig",
"[",
"-",
"1",
"]",
"in",
"\" .\"",
":",
"return",
"True",
"return",
"False"
] | https://github.com/scummvm/scummvm/blob/9c039d027e7ffb9d83ae2e274147e2daf8d57ce2/devtools/dumper-companion.py#L213-L224 | |
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/4sum.py | python | Solution2.fourSum | (self, nums, target) | return result | :type nums: List[int]
:type target: int
:rtype: List[List[int]] | :type nums: List[int]
:type target: int
:rtype: List[List[int]] | [
":",
"type",
"nums",
":",
"List",
"[",
"int",
"]",
":",
"type",
"target",
":",
"int",
":",
"rtype",
":",
"List",
"[",
"List",
"[",
"int",
"]]"
] | def fourSum(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: List[List[int]]
"""
nums, result, lookup = sorted(nums), [], collections.defaultdict(list)
for i in xrange(0, len(nums) - 1):
for j in xrange(i + 1, len(nums)):
... | [
"def",
"fourSum",
"(",
"self",
",",
"nums",
",",
"target",
")",
":",
"nums",
",",
"result",
",",
"lookup",
"=",
"sorted",
"(",
"nums",
")",
",",
"[",
"]",
",",
"collections",
".",
"defaultdict",
"(",
"list",
")",
"for",
"i",
"in",
"xrange",
"(",
... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/4sum.py#L45-L72 | |
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Fem/ObjectsFem.py | python | makePostVtkFilterCutFunction | (
doc,
base_vtk_result,
name="VtkFilterCutFunction"
) | return obj | makePostVtkFilterCutFunction(document, base_vtk_result, [name]):
creates a FEM post processing cut function filter object (vtk based) | makePostVtkFilterCutFunction(document, base_vtk_result, [name]):
creates a FEM post processing cut function filter object (vtk based) | [
"makePostVtkFilterCutFunction",
"(",
"document",
"base_vtk_result",
"[",
"name",
"]",
")",
":",
"creates",
"a",
"FEM",
"post",
"processing",
"cut",
"function",
"filter",
"object",
"(",
"vtk",
"based",
")"
] | def makePostVtkFilterCutFunction(
doc,
base_vtk_result,
name="VtkFilterCutFunction"
):
"""makePostVtkFilterCutFunction(document, base_vtk_result, [name]):
creates a FEM post processing cut function filter object (vtk based)"""
obj = doc.addObject("Fem::FemPostClipFilter", name)
tmp_filter_li... | [
"def",
"makePostVtkFilterCutFunction",
"(",
"doc",
",",
"base_vtk_result",
",",
"name",
"=",
"\"VtkFilterCutFunction\"",
")",
":",
"obj",
"=",
"doc",
".",
"addObject",
"(",
"\"Fem::FemPostClipFilter\"",
",",
"name",
")",
"tmp_filter_list",
"=",
"base_vtk_result",
".... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Fem/ObjectsFem.py#L648-L660 | |
cms-sw/cmssw | fd9de012d503d3405420bcbeec0ec879baa57cf2 | Alignment/MillePedeAlignmentAlgorithm/scripts/mps_alisetup.py | python | main | (argv = None) | Main routine. Not called, if this module is loaded via `import`.
Arguments:
- `argv`: Command line arguments passed to the script. | Main routine. Not called, if this module is loaded via `import`. | [
"Main",
"routine",
".",
"Not",
"called",
"if",
"this",
"module",
"is",
"loaded",
"via",
"import",
"."
] | def main(argv = None):
"""Main routine. Not called, if this module is loaded via `import`.
Arguments:
- `argv`: Command line arguments passed to the script.
"""
if argv == None:
argv = sys.argv[1:]
setup_alignment = SetupAlignment(argv)
setup_alignment.setup() | [
"def",
"main",
"(",
"argv",
"=",
"None",
")",
":",
"if",
"argv",
"==",
"None",
":",
"argv",
"=",
"sys",
".",
"argv",
"[",
"1",
":",
"]",
"setup_alignment",
"=",
"SetupAlignment",
"(",
"argv",
")",
"setup_alignment",
".",
"setup",
"(",
")"
] | https://github.com/cms-sw/cmssw/blob/fd9de012d503d3405420bcbeec0ec879baa57cf2/Alignment/MillePedeAlignmentAlgorithm/scripts/mps_alisetup.py#L25-L36 | ||
devsisters/libquic | 8954789a056d8e7d5fcb6452fd1572ca57eb5c4e | src/third_party/protobuf/python/google/protobuf/descriptor.py | python | EnumDescriptor.CopyToProto | (self, proto) | Copies this to a descriptor_pb2.EnumDescriptorProto.
Args:
proto: An empty descriptor_pb2.EnumDescriptorProto. | Copies this to a descriptor_pb2.EnumDescriptorProto. | [
"Copies",
"this",
"to",
"a",
"descriptor_pb2",
".",
"EnumDescriptorProto",
"."
] | def CopyToProto(self, proto):
"""Copies this to a descriptor_pb2.EnumDescriptorProto.
Args:
proto: An empty descriptor_pb2.EnumDescriptorProto.
"""
# This function is overriden to give a better doc comment.
super(EnumDescriptor, self).CopyToProto(proto) | [
"def",
"CopyToProto",
"(",
"self",
",",
"proto",
")",
":",
"# This function is overriden to give a better doc comment.",
"super",
"(",
"EnumDescriptor",
",",
"self",
")",
".",
"CopyToProto",
"(",
"proto",
")"
] | https://github.com/devsisters/libquic/blob/8954789a056d8e7d5fcb6452fd1572ca57eb5c4e/src/third_party/protobuf/python/google/protobuf/descriptor.py#L623-L630 | ||
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/python/ops/control_flow_ops.py | python | ZerosLikeOutsideLoop | (op, index) | Create zeros_like for the specified output of an op. | Create zeros_like for the specified output of an op. | [
"Create",
"zeros_like",
"for",
"the",
"specified",
"output",
"of",
"an",
"op",
"."
] | def ZerosLikeOutsideLoop(op, index):
"""Create zeros_like for the specified output of an op."""
val = op.outputs[index]
if not IsSwitch(op):
return array_ops.zeros_like(val, optimize=False)
else:
op_ctxt = op._get_control_flow_context()
pred = op_ctxt.pred
branch = op_ctxt.branch
switch_val ... | [
"def",
"ZerosLikeOutsideLoop",
"(",
"op",
",",
"index",
")",
":",
"val",
"=",
"op",
".",
"outputs",
"[",
"index",
"]",
"if",
"not",
"IsSwitch",
"(",
"op",
")",
":",
"return",
"array_ops",
".",
"zeros_like",
"(",
"val",
",",
"optimize",
"=",
"False",
... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/ops/control_flow_ops.py#L1303-L1314 | ||
zeakey/DeepSkeleton | dc70170f8fd2ec8ca1157484ce66129981104486 | scripts/cpp_lint.py | python | PrintCategories | () | Prints a list of all the error-categories used by error messages.
These are the categories used to filter messages via --filter. | Prints a list of all the error-categories used by error messages. | [
"Prints",
"a",
"list",
"of",
"all",
"the",
"error",
"-",
"categories",
"used",
"by",
"error",
"messages",
"."
] | def PrintCategories():
"""Prints a list of all the error-categories used by error messages.
These are the categories used to filter messages via --filter.
"""
sys.stderr.write(''.join(' %s\n' % cat for cat in _ERROR_CATEGORIES))
sys.exit(0) | [
"def",
"PrintCategories",
"(",
")",
":",
"sys",
".",
"stderr",
".",
"write",
"(",
"''",
".",
"join",
"(",
"' %s\\n'",
"%",
"cat",
"for",
"cat",
"in",
"_ERROR_CATEGORIES",
")",
")",
"sys",
".",
"exit",
"(",
"0",
")"
] | https://github.com/zeakey/DeepSkeleton/blob/dc70170f8fd2ec8ca1157484ce66129981104486/scripts/cpp_lint.py#L4770-L4776 | ||
OSGeo/gdal | 3748fc4ba4fba727492774b2b908a2130c864a83 | swig/python/gdal-utils/osgeo_utils/gdal2tiles.py | python | GlobalMercator.GoogleTile | (self, tx, ty, zoom) | return tx, (2**zoom - 1) - ty | Converts TMS tile coordinates to Google Tile coordinates | Converts TMS tile coordinates to Google Tile coordinates | [
"Converts",
"TMS",
"tile",
"coordinates",
"to",
"Google",
"Tile",
"coordinates"
] | def GoogleTile(self, tx, ty, zoom):
"Converts TMS tile coordinates to Google Tile coordinates"
# coordinate origin is moved from bottom-left to top-left corner of the extent
return tx, (2**zoom - 1) - ty | [
"def",
"GoogleTile",
"(",
"self",
",",
"tx",
",",
"ty",
",",
"zoom",
")",
":",
"# coordinate origin is moved from bottom-left to top-left corner of the extent",
"return",
"tx",
",",
"(",
"2",
"**",
"zoom",
"-",
"1",
")",
"-",
"ty"
] | https://github.com/OSGeo/gdal/blob/3748fc4ba4fba727492774b2b908a2130c864a83/swig/python/gdal-utils/osgeo_utils/gdal2tiles.py#L437-L441 | |
wujian16/Cornell-MOE | df299d1be882d2af9796d7a68b3f9505cac7a53e | moe/optimal_learning/python/cpp_wrappers/knowledge_gradient.py | python | KnowledgeGradient.set_current_point | (self, points_to_sample) | Set current_point to the specified point; ordering must match.
:param points_to_sample: current_point at which to evaluate the objective function, ``f(x)``
:type points_to_sample: array of float64 with shape (problem_size) | Set current_point to the specified point; ordering must match.
:param points_to_sample: current_point at which to evaluate the objective function, ``f(x)``
:type points_to_sample: array of float64 with shape (problem_size) | [
"Set",
"current_point",
"to",
"the",
"specified",
"point",
";",
"ordering",
"must",
"match",
".",
":",
"param",
"points_to_sample",
":",
"current_point",
"at",
"which",
"to",
"evaluate",
"the",
"objective",
"function",
"f",
"(",
"x",
")",
":",
"type",
"point... | def set_current_point(self, points_to_sample):
"""Set current_point to the specified point; ordering must match.
:param points_to_sample: current_point at which to evaluate the objective function, ``f(x)``
:type points_to_sample: array of float64 with shape (problem_size)
"""
sel... | [
"def",
"set_current_point",
"(",
"self",
",",
"points_to_sample",
")",
":",
"self",
".",
"_points_to_sample",
"=",
"numpy",
".",
"copy",
"(",
"numpy",
".",
"atleast_2d",
"(",
"points_to_sample",
")",
")"
] | https://github.com/wujian16/Cornell-MOE/blob/df299d1be882d2af9796d7a68b3f9505cac7a53e/moe/optimal_learning/python/cpp_wrappers/knowledge_gradient.py#L420-L425 | ||
klzgrad/naiveproxy | ed2c513637c77b18721fe428d7ed395b4d284c83 | src/third_party/depot_tools/cpplint.py | python | IsCppString | (line) | return ((line.count('"') - line.count(r'\"') - line.count("'\"'")) & 1) == 1 | Does line terminate so, that the next symbol is in string constant.
This function does not consider single-line nor multi-line comments.
Args:
line: is a partial line of code starting from the 0..n.
Returns:
True, if next character appended to 'line' is inside a
string constant. | Does line terminate so, that the next symbol is in string constant. | [
"Does",
"line",
"terminate",
"so",
"that",
"the",
"next",
"symbol",
"is",
"in",
"string",
"constant",
"."
] | def IsCppString(line):
"""Does line terminate so, that the next symbol is in string constant.
This function does not consider single-line nor multi-line comments.
Args:
line: is a partial line of code starting from the 0..n.
Returns:
True, if next character appended to 'line' is inside a
string c... | [
"def",
"IsCppString",
"(",
"line",
")",
":",
"line",
"=",
"line",
".",
"replace",
"(",
"r'\\\\'",
",",
"'XX'",
")",
"# after this, \\\\\" does not match to \\\"",
"return",
"(",
"(",
"line",
".",
"count",
"(",
"'\"'",
")",
"-",
"line",
".",
"count",
"(",
... | https://github.com/klzgrad/naiveproxy/blob/ed2c513637c77b18721fe428d7ed395b4d284c83/src/third_party/depot_tools/cpplint.py#L1224-L1238 | |
rdkit/rdkit | ede860ae316d12d8568daf5ee800921c3389c84e | rdkit/Chem/Pharm3D/EmbedLib.py | python | _checkMatch | (match, mol, bounds, pcophore, use2DLimits) | return atomMatch | **INTERNAL USE ONLY**
checks whether a particular atom match can be satisfied by
a molecule | **INTERNAL USE ONLY** | [
"**",
"INTERNAL",
"USE",
"ONLY",
"**"
] | def _checkMatch(match, mol, bounds, pcophore, use2DLimits):
""" **INTERNAL USE ONLY**
checks whether a particular atom match can be satisfied by
a molecule
"""
atomMatch = ChemicalFeatures.GetAtomMatch(match)
if not atomMatch:
return None
elif use2DLimits:
if not Check2DBounds(atomMatch, mol, pc... | [
"def",
"_checkMatch",
"(",
"match",
",",
"mol",
",",
"bounds",
",",
"pcophore",
",",
"use2DLimits",
")",
":",
"atomMatch",
"=",
"ChemicalFeatures",
".",
"GetAtomMatch",
"(",
"match",
")",
"if",
"not",
"atomMatch",
":",
"return",
"None",
"elif",
"use2DLimits"... | https://github.com/rdkit/rdkit/blob/ede860ae316d12d8568daf5ee800921c3389c84e/rdkit/Chem/Pharm3D/EmbedLib.py#L1074-L1089 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/pkg_resources/_vendor/pyparsing.py | python | oneOf | ( strs, caseless=False, useRegex=True ) | return MatchFirst(parseElementClass(sym) for sym in symbols).setName(' | '.join(symbols)) | Helper to quickly define a set of alternative Literals, and makes sure to do
longest-first testing when there is a conflict, regardless of the input order,
but returns a C{L{MatchFirst}} for best performance.
Parameters:
- strs - a string of space-delimited literals, or a collection of string literals... | Helper to quickly define a set of alternative Literals, and makes sure to do
longest-first testing when there is a conflict, regardless of the input order,
but returns a C{L{MatchFirst}} for best performance. | [
"Helper",
"to",
"quickly",
"define",
"a",
"set",
"of",
"alternative",
"Literals",
"and",
"makes",
"sure",
"to",
"do",
"longest",
"-",
"first",
"testing",
"when",
"there",
"is",
"a",
"conflict",
"regardless",
"of",
"the",
"input",
"order",
"but",
"returns",
... | def oneOf( strs, caseless=False, useRegex=True ):
"""
Helper to quickly define a set of alternative Literals, and makes sure to do
longest-first testing when there is a conflict, regardless of the input order,
but returns a C{L{MatchFirst}} for best performance.
Parameters:
- strs - a string o... | [
"def",
"oneOf",
"(",
"strs",
",",
"caseless",
"=",
"False",
",",
"useRegex",
"=",
"True",
")",
":",
"if",
"caseless",
":",
"isequal",
"=",
"(",
"lambda",
"a",
",",
"b",
":",
"a",
".",
"upper",
"(",
")",
"==",
"b",
".",
"upper",
"(",
")",
")",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pkg_resources/_vendor/pyparsing.py#L4573-L4644 | |
hpi-xnor/BMXNet | ed0b201da6667887222b8e4b5f997c4f6b61943d | example/rcnn/demo.py | python | generate_batch | (im) | return data_batch, DATA_NAMES, im_scale | preprocess image, return batch
:param im: cv2.imread returns [height, width, channel] in BGR
:return:
data_batch: MXNet input batch
data_names: names in data_batch
im_scale: float number | preprocess image, return batch
:param im: cv2.imread returns [height, width, channel] in BGR
:return:
data_batch: MXNet input batch
data_names: names in data_batch
im_scale: float number | [
"preprocess",
"image",
"return",
"batch",
":",
"param",
"im",
":",
"cv2",
".",
"imread",
"returns",
"[",
"height",
"width",
"channel",
"]",
"in",
"BGR",
":",
"return",
":",
"data_batch",
":",
"MXNet",
"input",
"batch",
"data_names",
":",
"names",
"in",
"... | def generate_batch(im):
"""
preprocess image, return batch
:param im: cv2.imread returns [height, width, channel] in BGR
:return:
data_batch: MXNet input batch
data_names: names in data_batch
im_scale: float number
"""
im_array, im_scale = resize(im, SHORT_SIDE, LONG_SIDE)
im_arr... | [
"def",
"generate_batch",
"(",
"im",
")",
":",
"im_array",
",",
"im_scale",
"=",
"resize",
"(",
"im",
",",
"SHORT_SIDE",
",",
"LONG_SIDE",
")",
"im_array",
"=",
"transform",
"(",
"im_array",
",",
"PIXEL_MEANS",
")",
"im_info",
"=",
"np",
".",
"array",
"("... | https://github.com/hpi-xnor/BMXNet/blob/ed0b201da6667887222b8e4b5f997c4f6b61943d/example/rcnn/demo.py#L80-L95 | |
echronos/echronos | c996f1d2c8af6c6536205eb319c1bf1d4d84569c | external_tools/ply_info/example/BASIC/basparse.py | python | p_command_for_bad_initial | (p) | command : FOR ID EQUALS error TO expr optstep | command : FOR ID EQUALS error TO expr optstep | [
"command",
":",
"FOR",
"ID",
"EQUALS",
"error",
"TO",
"expr",
"optstep"
] | def p_command_for_bad_initial(p):
'''command : FOR ID EQUALS error TO expr optstep'''
p[0] = "BAD INITIAL VALUE IN FOR STATEMENT" | [
"def",
"p_command_for_bad_initial",
"(",
"p",
")",
":",
"p",
"[",
"0",
"]",
"=",
"\"BAD INITIAL VALUE IN FOR STATEMENT\""
] | https://github.com/echronos/echronos/blob/c996f1d2c8af6c6536205eb319c1bf1d4d84569c/external_tools/ply_info/example/BASIC/basparse.py#L168-L170 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/fitting_widgets/basic_fitting/basic_fitting_view.py | python | BasicFittingView.fit_to_raw | (self) | return self.fit_function_options.fit_to_raw | Returns whether or not fitting to raw data is ticked. | Returns whether or not fitting to raw data is ticked. | [
"Returns",
"whether",
"or",
"not",
"fitting",
"to",
"raw",
"data",
"is",
"ticked",
"."
] | def fit_to_raw(self) -> bool:
"""Returns whether or not fitting to raw data is ticked."""
return self.fit_function_options.fit_to_raw | [
"def",
"fit_to_raw",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"fit_function_options",
".",
"fit_to_raw"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/fitting_widgets/basic_fitting/basic_fitting_view.py#L282-L284 | |
aimerykong/Low-Rank-Bilinear-Pooling | 487eb2c857fd9c95357a5166b0c15ad0fe135b28 | caffe-20160312/scripts/cpp_lint.py | python | _NestingState.SeenOpenBrace | (self) | return (not self.stack) or self.stack[-1].seen_open_brace | Check if we have seen the opening brace for the innermost block.
Returns:
True if we have seen the opening brace, False if the innermost
block is still expecting an opening brace. | Check if we have seen the opening brace for the innermost block. | [
"Check",
"if",
"we",
"have",
"seen",
"the",
"opening",
"brace",
"for",
"the",
"innermost",
"block",
"."
] | def SeenOpenBrace(self):
"""Check if we have seen the opening brace for the innermost block.
Returns:
True if we have seen the opening brace, False if the innermost
block is still expecting an opening brace.
"""
return (not self.stack) or self.stack[-1].seen_open_brace | [
"def",
"SeenOpenBrace",
"(",
"self",
")",
":",
"return",
"(",
"not",
"self",
".",
"stack",
")",
"or",
"self",
".",
"stack",
"[",
"-",
"1",
"]",
".",
"seen_open_brace"
] | https://github.com/aimerykong/Low-Rank-Bilinear-Pooling/blob/487eb2c857fd9c95357a5166b0c15ad0fe135b28/caffe-20160312/scripts/cpp_lint.py#L1931-L1938 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.