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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/indexing.py | python | maybe_convert_ix | (*args) | We likely want to take the cross-product. | We likely want to take the cross-product. | [
"We",
"likely",
"want",
"to",
"take",
"the",
"cross",
"-",
"product",
"."
] | def maybe_convert_ix(*args):
"""
We likely want to take the cross-product.
"""
ixify = True
for arg in args:
if not isinstance(arg, (np.ndarray, list, ABCSeries, Index)):
ixify = False
if ixify:
return np.ix_(*args)
else:
return args | [
"def",
"maybe_convert_ix",
"(",
"*",
"args",
")",
":",
"ixify",
"=",
"True",
"for",
"arg",
"in",
"args",
":",
"if",
"not",
"isinstance",
"(",
"arg",
",",
"(",
"np",
".",
"ndarray",
",",
"list",
",",
"ABCSeries",
",",
"Index",
")",
")",
":",
"ixify"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/indexing.py#L2361-L2373 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/rulerctrl.py | python | Indicator.GetPosition | (self) | return xpos, ypos | Returns the position at which we should draw the indicator bitmap. | Returns the position at which we should draw the indicator bitmap. | [
"Returns",
"the",
"position",
"at",
"which",
"we",
"should",
"draw",
"the",
"indicator",
"bitmap",
"."
] | def GetPosition(self):
""" Returns the position at which we should draw the indicator bitmap. """
orient = self._parent._orientation
flip = self._parent._flip
left, top, right, bottom = self._parent.GetBounds()
minval = self._parent._min
maxval = self._parent._max
... | [
"def",
"GetPosition",
"(",
"self",
")",
":",
"orient",
"=",
"self",
".",
"_parent",
".",
"_orientation",
"flip",
"=",
"self",
".",
"_parent",
".",
"_flip",
"left",
",",
"top",
",",
"right",
",",
"bottom",
"=",
"self",
".",
"_parent",
".",
"GetBounds",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/rulerctrl.py#L401-L432 | |
rrwick/Unicycler | 96ffea71e3a78d63ade19d6124946773e65cf129 | unicycler/unicycler.py | python | main | () | Script execution starts here. | Script execution starts here. | [
"Script",
"execution",
"starts",
"here",
"."
] | def main():
"""
Script execution starts here.
"""
random.seed(0) # Fixed seed so the program produces the same output every time it's run.
full_command = ' '.join(('"' + x + '"' if ' ' in x else x) for x in sys.argv)
args = get_arguments()
out_dir_message = make_output_directory(args.out, ... | [
"def",
"main",
"(",
")",
":",
"random",
".",
"seed",
"(",
"0",
")",
"# Fixed seed so the program produces the same output every time it's run.",
"full_command",
"=",
"' '",
".",
"join",
"(",
"(",
"'\"'",
"+",
"x",
"+",
"'\"'",
"if",
"' '",
"in",
"x",
"else",
... | https://github.com/rrwick/Unicycler/blob/96ffea71e3a78d63ade19d6124946773e65cf129/unicycler/unicycler.py#L48-L189 | ||
emsesp/EMS-ESP | 65c4a381bf8df61d1e18ba00223b1a55933fc547 | scripts/esptool.py | python | ESPLoader.run_spiflash_command | (self, spiflash_command, data=b"", read_bits=0) | return status | Run an arbitrary SPI flash command.
This function uses the "USR_COMMAND" functionality in the ESP
SPI hardware, rather than the precanned commands supported by
hardware. So the value of spiflash_command is an actual command
byte, sent over the wire.
After writing command byte, ... | Run an arbitrary SPI flash command. | [
"Run",
"an",
"arbitrary",
"SPI",
"flash",
"command",
"."
] | def run_spiflash_command(self, spiflash_command, data=b"", read_bits=0):
"""Run an arbitrary SPI flash command.
This function uses the "USR_COMMAND" functionality in the ESP
SPI hardware, rather than the precanned commands supported by
hardware. So the value of spiflash_command is an ac... | [
"def",
"run_spiflash_command",
"(",
"self",
",",
"spiflash_command",
",",
"data",
"=",
"b\"\"",
",",
"read_bits",
"=",
"0",
")",
":",
"# SPI_USR register flags",
"SPI_USR_COMMAND",
"=",
"(",
"1",
"<<",
"31",
")",
"SPI_USR_MISO",
"=",
"(",
"1",
"<<",
"28",
... | https://github.com/emsesp/EMS-ESP/blob/65c4a381bf8df61d1e18ba00223b1a55933fc547/scripts/esptool.py#L753-L845 | |
akai-katto/dandere2x | bf1a46d5c9f9ffc8145a412c3571b283345b8512 | src/dandere2x/dandere2xlib/wrappers/frame_new/__init__.py | python | Frame.from_file_wait | (cls, file_path: str, controller=Dandere2xController()) | Repeatedly calls the "from_file" method until the image is properly loaded - this is a result of window's
file handler labeling a file as ready-to-be-read but not actually, thus resulting in a string of potential
errors.
@param file_path: Location of the file on disk
@param controller: ... | Repeatedly calls the "from_file" method until the image is properly loaded - this is a result of window's
file handler labeling a file as ready-to-be-read but not actually, thus resulting in a string of potential
errors. | [
"Repeatedly",
"calls",
"the",
"from_file",
"method",
"until",
"the",
"image",
"is",
"properly",
"loaded",
"-",
"this",
"is",
"a",
"result",
"of",
"window",
"s",
"file",
"handler",
"labeling",
"a",
"file",
"as",
"ready",
"-",
"to",
"-",
"be",
"-",
"read",... | def from_file_wait(cls, file_path: str, controller=Dandere2xController()):
"""
Repeatedly calls the "from_file" method until the image is properly loaded - this is a result of window's
file handler labeling a file as ready-to-be-read but not actually, thus resulting in a string of potential
... | [
"def",
"from_file_wait",
"(",
"cls",
",",
"file_path",
":",
"str",
",",
"controller",
"=",
"Dandere2xController",
"(",
")",
")",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
")",
"pass"
] | https://github.com/akai-katto/dandere2x/blob/bf1a46d5c9f9ffc8145a412c3571b283345b8512/src/dandere2x/dandere2xlib/wrappers/frame_new/__init__.py#L51-L62 | ||
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/ops/_op_impl/tbe/fill.py | python | _fill_op_tbe | () | return | FillD TBE register | FillD TBE register | [
"FillD",
"TBE",
"register"
] | def _fill_op_tbe():
"""FillD TBE register"""
return | [
"def",
"_fill_op_tbe",
"(",
")",
":",
"return"
] | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/ops/_op_impl/tbe/fill.py#L54-L56 | |
Slicer/Slicer | ba9fadf332cb0303515b68d8d06a344c82e3e3e5 | Utilities/Scripts/SlicerWizard/Utilities.py | python | createEmptyRepo | (path, tool=None) | return git.Repo.init(path) | Create a repository in an empty or nonexistent location.
:param path:
Location which should contain the newly created repository.
:type path:
:class:`str`
:param tool:
Name of the |VCS| tool to use to create the repository (e.g. ``'git'``). If
``None``, a default tool (git) is used.
:type tool:... | Create a repository in an empty or nonexistent location. | [
"Create",
"a",
"repository",
"in",
"an",
"empty",
"or",
"nonexistent",
"location",
"."
] | def createEmptyRepo(path, tool=None):
"""Create a repository in an empty or nonexistent location.
:param path:
Location which should contain the newly created repository.
:type path:
:class:`str`
:param tool:
Name of the |VCS| tool to use to create the repository (e.g. ``'git'``). If
``None``, ... | [
"def",
"createEmptyRepo",
"(",
"path",
",",
"tool",
"=",
"None",
")",
":",
"# Check that the requested tool is supported",
"if",
"not",
"haveGit",
"(",
")",
"or",
"tool",
"not",
"in",
"(",
"None",
",",
"\"git\"",
")",
":",
"raise",
"Exception",
"(",
"\"unabl... | https://github.com/Slicer/Slicer/blob/ba9fadf332cb0303515b68d8d06a344c82e3e3e5/Utilities/Scripts/SlicerWizard/Utilities.py#L298-L334 | |
ricardoquesada/Spidermonkey | 4a75ea2543408bd1b2c515aa95901523eeef7858 | media/webrtc/trunk/tools/gyp/pylib/gyp/msvs_emulation.py | python | PrecompiledHeader.GetObjDependencies | (self, sources, objs) | return [] | Given a list of sources files and the corresponding object files,
returns a list of the pch files that should be depended upon. The
additional wrapping in the return value is for interface compatability
with make.py on Mac, and xcode_emulation.py. | Given a list of sources files and the corresponding object files,
returns a list of the pch files that should be depended upon. The
additional wrapping in the return value is for interface compatability
with make.py on Mac, and xcode_emulation.py. | [
"Given",
"a",
"list",
"of",
"sources",
"files",
"and",
"the",
"corresponding",
"object",
"files",
"returns",
"a",
"list",
"of",
"the",
"pch",
"files",
"that",
"should",
"be",
"depended",
"upon",
".",
"The",
"additional",
"wrapping",
"in",
"the",
"return",
... | def GetObjDependencies(self, sources, objs):
"""Given a list of sources files and the corresponding object files,
returns a list of the pch files that should be depended upon. The
additional wrapping in the return value is for interface compatability
with make.py on Mac, and xcode_emulation.py."""
i... | [
"def",
"GetObjDependencies",
"(",
"self",
",",
"sources",
",",
"objs",
")",
":",
"if",
"not",
"self",
".",
"_PchHeader",
"(",
")",
":",
"return",
"[",
"]",
"source",
"=",
"self",
".",
"_PchSource",
"(",
")",
"assert",
"source",
"pch_ext",
"=",
"os",
... | https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/media/webrtc/trunk/tools/gyp/pylib/gyp/msvs_emulation.py#L577-L590 | |
google/syzygy | 8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5 | syzygy/scripts/graph/graph.py | python | GenerateGraph | (info, file_name, width, height, dpi, data_start=None,
categorize=None) | Generates a graph from collected information.
Args:
info: a dictionary of pid->_ProcessFault instances.
file_name: output file name, or None to show the graph interactively.
width: the width (in inches) of the generated graph.
height: the height (in inches) of the generated graph.
dpi: the DPI of... | Generates a graph from collected information. | [
"Generates",
"a",
"graph",
"from",
"collected",
"information",
"."
] | def GenerateGraph(info, file_name, width, height, dpi, data_start=None,
categorize=None):
"""Generates a graph from collected information.
Args:
info: a dictionary of pid->_ProcessFault instances.
file_name: output file name, or None to show the graph interactively.
width: the width (... | [
"def",
"GenerateGraph",
"(",
"info",
",",
"file_name",
",",
"width",
",",
"height",
",",
"dpi",
",",
"data_start",
"=",
"None",
",",
"categorize",
"=",
"None",
")",
":",
"fig",
"=",
"pyplot",
".",
"figure",
"(",
"figsize",
"=",
"(",
"width",
",",
"he... | https://github.com/google/syzygy/blob/8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5/syzygy/scripts/graph/graph.py#L333-L540 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/share/gdb/python/gdb/prompt.py | python | _prompt_r | (attr) | return '\r' | A carriage return. | A carriage return. | [
"A",
"carriage",
"return",
"."
] | def _prompt_r(attr):
"A carriage return."
return '\r' | [
"def",
"_prompt_r",
"(",
"attr",
")",
":",
"return",
"'\\r'"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/share/gdb/python/gdb/prompt.py#L66-L68 | |
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | current/tools/gyp/pylib/gyp/xcodeproj_file.py | python | PBXProject.RootGroupsTakeOverOnlyChildren | (self, recurse=False) | Calls TakeOverOnlyChild for all groups in the main group. | Calls TakeOverOnlyChild for all groups in the main group. | [
"Calls",
"TakeOverOnlyChild",
"for",
"all",
"groups",
"in",
"the",
"main",
"group",
"."
] | def RootGroupsTakeOverOnlyChildren(self, recurse=False):
"""Calls TakeOverOnlyChild for all groups in the main group."""
for group in self._properties['mainGroup']._properties['children']:
if isinstance(group, PBXGroup):
group.TakeOverOnlyChild(recurse) | [
"def",
"RootGroupsTakeOverOnlyChildren",
"(",
"self",
",",
"recurse",
"=",
"False",
")",
":",
"for",
"group",
"in",
"self",
".",
"_properties",
"[",
"'mainGroup'",
"]",
".",
"_properties",
"[",
"'children'",
"]",
":",
"if",
"isinstance",
"(",
"group",
",",
... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/current/tools/gyp/pylib/gyp/xcodeproj_file.py#L2694-L2699 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/imaplib.py | python | IMAP4.xatom | (self, name, *args) | return self._simple_command(name, *args) | Allow simple extension commands
notified by server in CAPABILITY response.
Assumes command is legal in current state.
(typ, [data]) = <instance>.xatom(name, arg, ...)
Returns response appropriate to extension command `name'. | Allow simple extension commands
notified by server in CAPABILITY response. | [
"Allow",
"simple",
"extension",
"commands",
"notified",
"by",
"server",
"in",
"CAPABILITY",
"response",
"."
] | def xatom(self, name, *args):
"""Allow simple extension commands
notified by server in CAPABILITY response.
Assumes command is legal in current state.
(typ, [data]) = <instance>.xatom(name, arg, ...)
Returns response appropriate to extension command `name'.
"""... | [
"def",
"xatom",
"(",
"self",
",",
"name",
",",
"*",
"args",
")",
":",
"name",
"=",
"name",
".",
"upper",
"(",
")",
"#if not name in self.capabilities: # Let the server decide!",
"# raise self.error('unknown extension command: %s' % name)",
"if",
"not",
"name",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/imaplib.py#L895-L910 | |
physercoe/starquant | c00cad64d1de2da05081b3dc320ef264c6295e08 | source/engine/strategy_engine.py | python | StrategyEngine.get_all_positions | (self) | return list(self.positions.values()) | Get all position data. | Get all position data. | [
"Get",
"all",
"position",
"data",
"."
] | def get_all_positions(self):
"""
Get all position data.
"""
return list(self.positions.values()) | [
"def",
"get_all_positions",
"(",
"self",
")",
":",
"return",
"list",
"(",
"self",
".",
"positions",
".",
"values",
"(",
")",
")"
] | https://github.com/physercoe/starquant/blob/c00cad64d1de2da05081b3dc320ef264c6295e08/source/engine/strategy_engine.py#L913-L917 | |
alibaba/MNN | c4d9566171d589c3ded23aa18ffb197016995a12 | pymnn/pip_package/MNN/tools/mnnconvert.py | python | main | () | return 0 | main funcion | main funcion | [
"main",
"funcion"
] | def main():
""" main funcion """
Tools.mnnconvert(sys.argv)
arg_dict = parse_args()
if mnn_logger is not None:
if "modelFile" not in arg_dict.keys() or "MNNModel" not in arg_dict.keys():
return 0
log_dict = {}
log_dict["tool"] = "mnnconvert_python"
log_dict... | [
"def",
"main",
"(",
")",
":",
"Tools",
".",
"mnnconvert",
"(",
"sys",
".",
"argv",
")",
"arg_dict",
"=",
"parse_args",
"(",
")",
"if",
"mnn_logger",
"is",
"not",
"None",
":",
"if",
"\"modelFile\"",
"not",
"in",
"arg_dict",
".",
"keys",
"(",
")",
"or"... | https://github.com/alibaba/MNN/blob/c4d9566171d589c3ded23aa18ffb197016995a12/pymnn/pip_package/MNN/tools/mnnconvert.py#L35-L56 | |
thalium/icebox | 99d147d5b9269222225443ce171b4fd46d8985d4 | third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2class.py | python | xmlNode.addContent | (self, content) | Append the extra substring to the node content. NOTE: In
contrast to xmlNodeSetContent(), @content is supposed to be
raw text, so unescaped XML special chars are allowed,
entity references are not supported. | Append the extra substring to the node content. NOTE: In
contrast to xmlNodeSetContent(), | [
"Append",
"the",
"extra",
"substring",
"to",
"the",
"node",
"content",
".",
"NOTE",
":",
"In",
"contrast",
"to",
"xmlNodeSetContent",
"()"
] | def addContent(self, content):
"""Append the extra substring to the node content. NOTE: In
contrast to xmlNodeSetContent(), @content is supposed to be
raw text, so unescaped XML special chars are allowed,
entity references are not supported. """
libxml2mod.xmlNodeAddConten... | [
"def",
"addContent",
"(",
"self",
",",
"content",
")",
":",
"libxml2mod",
".",
"xmlNodeAddContent",
"(",
"self",
".",
"_o",
",",
"content",
")"
] | https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2class.py#L2312-L2317 | ||
rampageX/firmware-mod-kit | c94cd6aeee50d92ec5280a6dba6d74828fd3606b | src/binwalk-2.1.1/src/binwalk/core/module.py | python | process_kwargs | (obj, kwargs) | return kwargs | Convenience wrapper around binwalk.core.module.Modules.kwargs.
@obj - The class object (an instance of a sub-class of binwalk.core.module.Module).
@kwargs - The kwargs provided to the object's __init__ method.
Returns None. | Convenience wrapper around binwalk.core.module.Modules.kwargs. | [
"Convenience",
"wrapper",
"around",
"binwalk",
".",
"core",
".",
"module",
".",
"Modules",
".",
"kwargs",
"."
] | def process_kwargs(obj, kwargs):
'''
Convenience wrapper around binwalk.core.module.Modules.kwargs.
@obj - The class object (an instance of a sub-class of binwalk.core.module.Module).
@kwargs - The kwargs provided to the object's __init__ method.
Returns None.
'''
with Modules() as m:
... | [
"def",
"process_kwargs",
"(",
"obj",
",",
"kwargs",
")",
":",
"with",
"Modules",
"(",
")",
"as",
"m",
":",
"kwargs",
"=",
"m",
".",
"kwargs",
"(",
"obj",
",",
"kwargs",
")",
"return",
"kwargs"
] | https://github.com/rampageX/firmware-mod-kit/blob/c94cd6aeee50d92ec5280a6dba6d74828fd3606b/src/binwalk-2.1.1/src/binwalk/core/module.py#L930-L941 | |
neopenx/Dragon | 0e639a7319035ddc81918bd3df059230436ee0a1 | Dragon/python/dragon/operators/activation.py | python | Elu | (inputs, alpha=1.0, **kwargs) | return output | Exponential Linear Unit function, introduces by `[Clevert et.al, 2015] <https://arxiv.org/abs/1511.07289>`_.
Parameters
----------
inputs : Tensor
The input tensor.
alpha : float
The alpha.
Returns
-------
Tensor
The output tensor, calculated as: |elu_function| | Exponential Linear Unit function, introduces by `[Clevert et.al, 2015] <https://arxiv.org/abs/1511.07289>`_. | [
"Exponential",
"Linear",
"Unit",
"function",
"introduces",
"by",
"[",
"Clevert",
"et",
".",
"al",
"2015",
"]",
"<https",
":",
"//",
"arxiv",
".",
"org",
"/",
"abs",
"/",
"1511",
".",
"07289",
">",
"_",
"."
] | def Elu(inputs, alpha=1.0, **kwargs):
"""Exponential Linear Unit function, introduces by `[Clevert et.al, 2015] <https://arxiv.org/abs/1511.07289>`_.
Parameters
----------
inputs : Tensor
The input tensor.
alpha : float
The alpha.
Returns
-------
Tensor
The outp... | [
"def",
"Elu",
"(",
"inputs",
",",
"alpha",
"=",
"1.0",
",",
"*",
"*",
"kwargs",
")",
":",
"CheckInputs",
"(",
"inputs",
",",
"1",
")",
"arguments",
"=",
"ParseArguments",
"(",
"locals",
"(",
")",
")",
"output",
"=",
"Tensor",
".",
"CreateOperator",
"... | https://github.com/neopenx/Dragon/blob/0e639a7319035ddc81918bd3df059230436ee0a1/Dragon/python/dragon/operators/activation.py#L95-L119 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/xrc.py | python | XmlResource.CompareVersion | (*args, **kwargs) | return _xrc.XmlResource_CompareVersion(*args, **kwargs) | CompareVersion(self, int major, int minor, int release, int revision) -> int | CompareVersion(self, int major, int minor, int release, int revision) -> int | [
"CompareVersion",
"(",
"self",
"int",
"major",
"int",
"minor",
"int",
"release",
"int",
"revision",
")",
"-",
">",
"int"
] | def CompareVersion(*args, **kwargs):
"""CompareVersion(self, int major, int minor, int release, int revision) -> int"""
return _xrc.XmlResource_CompareVersion(*args, **kwargs) | [
"def",
"CompareVersion",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_xrc",
".",
"XmlResource_CompareVersion",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/xrc.py#L196-L198 | |
eclipse/sumo | 7132a9b8b6eea734bdec38479026b4d8c4336d03 | tools/sumolib/geomhelper.py | python | polygonOffsetWithMinimumDistanceToPoint | (point, polygon, perpendicular=False) | return polygonOffsetAndDistanceToPoint(point, polygon, perpendicular)[0] | Return the offset from the polygon start where the distance to the point is minimal | Return the offset from the polygon start where the distance to the point is minimal | [
"Return",
"the",
"offset",
"from",
"the",
"polygon",
"start",
"where",
"the",
"distance",
"to",
"the",
"point",
"is",
"minimal"
] | def polygonOffsetWithMinimumDistanceToPoint(point, polygon, perpendicular=False):
"""Return the offset from the polygon start where the distance to the point is minimal"""
return polygonOffsetAndDistanceToPoint(point, polygon, perpendicular)[0] | [
"def",
"polygonOffsetWithMinimumDistanceToPoint",
"(",
"point",
",",
"polygon",
",",
"perpendicular",
"=",
"False",
")",
":",
"return",
"polygonOffsetAndDistanceToPoint",
"(",
"point",
",",
"polygon",
",",
"perpendicular",
")",
"[",
"0",
"]"
] | https://github.com/eclipse/sumo/blob/7132a9b8b6eea734bdec38479026b4d8c4336d03/tools/sumolib/geomhelper.py#L108-L110 | |
mysql/mysql-router | cc0179f982bb9739a834eb6fd205a56224616133 | ext/gmock/scripts/upload.py | python | VersionControlSystem.GetUnknownFiles | (self) | Return a list of files unknown to the VCS. | Return a list of files unknown to the VCS. | [
"Return",
"a",
"list",
"of",
"files",
"unknown",
"to",
"the",
"VCS",
"."
] | def GetUnknownFiles(self):
"""Return a list of files unknown to the VCS."""
raise NotImplementedError(
"abstract method -- subclass %s must override" % self.__class__) | [
"def",
"GetUnknownFiles",
"(",
"self",
")",
":",
"raise",
"NotImplementedError",
"(",
"\"abstract method -- subclass %s must override\"",
"%",
"self",
".",
"__class__",
")"
] | https://github.com/mysql/mysql-router/blob/cc0179f982bb9739a834eb6fd205a56224616133/ext/gmock/scripts/upload.py#L608-L611 | ||
jiangxiluning/FOTS.PyTorch | b1851c170b4f1ad18406766352cb5171648ce603 | FOTS/utils/eval_tools/icdar2015/script.py | python | default_evaluation_params | () | return {
'IOU_CONSTRAINT' :0.5,
'AREA_PRECISION_CONSTRAINT' :0.5,
'WORD_SPOTTING' :False,
'MIN_LENGTH_CARE_WORD' :3,
'GT_SAMPLE_NAME_2_ID':'gt_img_([0-9]+).txt',
'DET_SAMPLE_NAME_2_ID':'res_img_([0-9]+).txt',
'LTRB':False, #... | default_evaluation_params: Default parameters to use for the validation and evaluation. | default_evaluation_params: Default parameters to use for the validation and evaluation. | [
"default_evaluation_params",
":",
"Default",
"parameters",
"to",
"use",
"for",
"the",
"validation",
"and",
"evaluation",
"."
] | def default_evaluation_params():
"""
default_evaluation_params: Default parameters to use for the validation and evaluation.
"""
return {
'IOU_CONSTRAINT' :0.5,
'AREA_PRECISION_CONSTRAINT' :0.5,
'WORD_SPOTTING' :False,
'MIN_LENGTH_CARE_WORD' :3,
... | [
"def",
"default_evaluation_params",
"(",
")",
":",
"return",
"{",
"'IOU_CONSTRAINT'",
":",
"0.5",
",",
"'AREA_PRECISION_CONSTRAINT'",
":",
"0.5",
",",
"'WORD_SPOTTING'",
":",
"False",
",",
"'MIN_LENGTH_CARE_WORD'",
":",
"3",
",",
"'GT_SAMPLE_NAME_2_ID'",
":",
"'gt_i... | https://github.com/jiangxiluning/FOTS.PyTorch/blob/b1851c170b4f1ad18406766352cb5171648ce603/FOTS/utils/eval_tools/icdar2015/script.py#L27-L43 | |
CaoWGG/TensorRT-YOLOv4 | 4d7c2edce99e8794a4cb4ea3540d51ce91158a36 | onnx-tensorrt/third_party/onnx/third_party/pybind11/tools/clang/cindex.py | python | Type.is_volatile_qualified | (self) | return conf.lib.clang_isVolatileQualifiedType(self) | Determine whether a Type has the "volatile" qualifier set.
This does not look through typedefs that may have added "volatile"
at a different level. | Determine whether a Type has the "volatile" qualifier set. | [
"Determine",
"whether",
"a",
"Type",
"has",
"the",
"volatile",
"qualifier",
"set",
"."
] | def is_volatile_qualified(self):
"""Determine whether a Type has the "volatile" qualifier set.
This does not look through typedefs that may have added "volatile"
at a different level.
"""
return conf.lib.clang_isVolatileQualifiedType(self) | [
"def",
"is_volatile_qualified",
"(",
"self",
")",
":",
"return",
"conf",
".",
"lib",
".",
"clang_isVolatileQualifiedType",
"(",
"self",
")"
] | https://github.com/CaoWGG/TensorRT-YOLOv4/blob/4d7c2edce99e8794a4cb4ea3540d51ce91158a36/onnx-tensorrt/third_party/onnx/third_party/pybind11/tools/clang/cindex.py#L2016-L2022 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/boto/boto/iam/connection.py | python | IAMConnection.list_saml_providers | (self) | return self.get_response('ListSAMLProviders', {}, list_marker='SAMLProviderList') | Lists the SAML providers in the account.
This operation requires `Signature Version 4`_. | Lists the SAML providers in the account.
This operation requires `Signature Version 4`_. | [
"Lists",
"the",
"SAML",
"providers",
"in",
"the",
"account",
".",
"This",
"operation",
"requires",
"Signature",
"Version",
"4",
"_",
"."
] | def list_saml_providers(self):
"""
Lists the SAML providers in the account.
This operation requires `Signature Version 4`_.
"""
return self.get_response('ListSAMLProviders', {}, list_marker='SAMLProviderList') | [
"def",
"list_saml_providers",
"(",
"self",
")",
":",
"return",
"self",
".",
"get_response",
"(",
"'ListSAMLProviders'",
",",
"{",
"}",
",",
"list_marker",
"=",
"'SAMLProviderList'",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/boto/boto/iam/connection.py#L1438-L1443 | |
microsoft/LightGBM | 904b2d5158703c4900b68008617951dd2f9ff21b | python-package/lightgbm/basic.py | python | Dataset.get_init_score | (self) | return self.init_score | Get the initial score of the Dataset.
Returns
-------
init_score : numpy array or None
Init score of Booster. | Get the initial score of the Dataset. | [
"Get",
"the",
"initial",
"score",
"of",
"the",
"Dataset",
"."
] | def get_init_score(self):
"""Get the initial score of the Dataset.
Returns
-------
init_score : numpy array or None
Init score of Booster.
"""
if self.init_score is None:
self.init_score = self.get_field('init_score')
return self.init_scor... | [
"def",
"get_init_score",
"(",
"self",
")",
":",
"if",
"self",
".",
"init_score",
"is",
"None",
":",
"self",
".",
"init_score",
"=",
"self",
".",
"get_field",
"(",
"'init_score'",
")",
"return",
"self",
".",
"init_score"
] | https://github.com/microsoft/LightGBM/blob/904b2d5158703c4900b68008617951dd2f9ff21b/python-package/lightgbm/basic.py#L2277-L2287 | |
llvm/llvm-project | ffa6262cb4e2a335d26416fad39a581b4f98c5f4 | llvm/utils/lit/lit/worker.py | python | execute | (test) | return test | Run one test in a multiprocessing.Pool
Side effects in this function and functions it calls are not visible in the
main lit process.
Arguments and results of this function are pickled, so they should be cheap
to copy. | Run one test in a multiprocessing.Pool | [
"Run",
"one",
"test",
"in",
"a",
"multiprocessing",
".",
"Pool"
] | def execute(test):
"""Run one test in a multiprocessing.Pool
Side effects in this function and functions it calls are not visible in the
main lit process.
Arguments and results of this function are pickled, so they should be cheap
to copy.
"""
with _get_parallelism_semaphore(test):
... | [
"def",
"execute",
"(",
"test",
")",
":",
"with",
"_get_parallelism_semaphore",
"(",
"test",
")",
":",
"result",
"=",
"_execute",
"(",
"test",
",",
"_lit_config",
")",
"test",
".",
"setResult",
"(",
"result",
")",
"return",
"test"
] | https://github.com/llvm/llvm-project/blob/ffa6262cb4e2a335d26416fad39a581b4f98c5f4/llvm/utils/lit/lit/worker.py#L35-L48 | |
PaddlePaddle/PaddleOCR | b756bf5f8c90142e0d89d3db0163965c686b6ffe | ppocr/modeling/heads/rec_nrtr_head.py | python | TransformerEncoderLayer.forward | (self, src, src_mask=None, src_key_padding_mask=None) | return src | Pass the input through the endocder layer.
Args:
src: the sequnce to the encoder layer (required).
src_mask: the mask for the src sequence (optional).
src_key_padding_mask: the mask for the src keys per batch (optional). | Pass the input through the endocder layer.
Args:
src: the sequnce to the encoder layer (required).
src_mask: the mask for the src sequence (optional).
src_key_padding_mask: the mask for the src keys per batch (optional). | [
"Pass",
"the",
"input",
"through",
"the",
"endocder",
"layer",
".",
"Args",
":",
"src",
":",
"the",
"sequnce",
"to",
"the",
"encoder",
"layer",
"(",
"required",
")",
".",
"src_mask",
":",
"the",
"mask",
"for",
"the",
"src",
"sequence",
"(",
"optional",
... | def forward(self, src, src_mask=None, src_key_padding_mask=None):
"""Pass the input through the endocder layer.
Args:
src: the sequnce to the encoder layer (required).
src_mask: the mask for the src sequence (optional).
src_key_padding_mask: the mask for the src keys ... | [
"def",
"forward",
"(",
"self",
",",
"src",
",",
"src_mask",
"=",
"None",
",",
"src_key_padding_mask",
"=",
"None",
")",
":",
"src2",
"=",
"self",
".",
"self_attn",
"(",
"src",
",",
"src",
",",
"src",
",",
"attn_mask",
"=",
"src_mask",
",",
"key_padding... | https://github.com/PaddlePaddle/PaddleOCR/blob/b756bf5f8c90142e0d89d3db0163965c686b6ffe/ppocr/modeling/heads/rec_nrtr_head.py#L486-L512 | |
SequoiaDB/SequoiaDB | 2894ed7e5bd6fe57330afc900cf76d0ff0df9f64 | driver/python/pysequoiadb/collectionspace.py | python | collectionspace.drop_collection | (self, cl_name) | Drop the specified collection in current collection space.
Parameters:
Name Type Info:
cl_name str The collection name.
Exceptions:
pysequoiadb.error.SDBTypeError
pysequoiadb.error.SDBBaseError | Drop the specified collection in current collection space. | [
"Drop",
"the",
"specified",
"collection",
"in",
"current",
"collection",
"space",
"."
] | def drop_collection(self, cl_name):
"""Drop the specified collection in current collection space.
Parameters:
Name Type Info:
cl_name str The collection name.
Exceptions:
pysequoiadb.error.SDBTypeError
pysequoiadb.error.SDBBaseError
... | [
"def",
"drop_collection",
"(",
"self",
",",
"cl_name",
")",
":",
"if",
"not",
"isinstance",
"(",
"cl_name",
",",
"str_type",
")",
":",
"raise",
"SDBTypeError",
"(",
"\"collection must be an instance of str_type\"",
")",
"rc",
"=",
"sdb",
".",
"cs_drop_collection",... | https://github.com/SequoiaDB/SequoiaDB/blob/2894ed7e5bd6fe57330afc900cf76d0ff0df9f64/driver/python/pysequoiadb/collectionspace.py#L191-L205 | ||
Komnomnomnom/swigibpy | cfd307fdbfaffabc69a2dc037538d7e34a8b8daf | examples/contractdetails.py | python | ContractDetailsExample.openOrderEnd | (self) | Always called by TWS but not relevant for our example | Always called by TWS but not relevant for our example | [
"Always",
"called",
"by",
"TWS",
"but",
"not",
"relevant",
"for",
"our",
"example"
] | def openOrderEnd(self):
'''Always called by TWS but not relevant for our example'''
pass | [
"def",
"openOrderEnd",
"(",
"self",
")",
":",
"pass"
] | https://github.com/Komnomnomnom/swigibpy/blob/cfd307fdbfaffabc69a2dc037538d7e34a8b8daf/examples/contractdetails.py#L39-L41 | ||
moderngl/moderngl | 32fe79927e02b0fa893b3603d677bdae39771e14 | moderngl/context.py | python | create_standalone_context | (require=None, share=False, **settings) | return ctx | Create a standalone/headless ModernGL context.
The preferred way of making a context is through :py:func:`moderngl.create_context`.
Example::
# Create a context with highest possible supported version
ctx = moderngl.create_context()
# Require at least OpenGL 4.3
... | Create a standalone/headless ModernGL context.
The preferred way of making a context is through :py:func:`moderngl.create_context`. | [
"Create",
"a",
"standalone",
"/",
"headless",
"ModernGL",
"context",
".",
"The",
"preferred",
"way",
"of",
"making",
"a",
"context",
"is",
"through",
":",
"py",
":",
"func",
":",
"moderngl",
".",
"create_context",
"."
] | def create_standalone_context(require=None, share=False, **settings) -> 'Context':
'''
Create a standalone/headless ModernGL context.
The preferred way of making a context is through :py:func:`moderngl.create_context`.
Example::
# Create a context with highest possible supporte... | [
"def",
"create_standalone_context",
"(",
"require",
"=",
"None",
",",
"share",
"=",
"False",
",",
"*",
"*",
"settings",
")",
"->",
"'Context'",
":",
"if",
"require",
"is",
"None",
":",
"require",
"=",
"330",
"mode",
"=",
"'share'",
"if",
"share",
"is",
... | https://github.com/moderngl/moderngl/blob/32fe79927e02b0fa893b3603d677bdae39771e14/moderngl/context.py#L1823-L1860 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | tools/telemetry/third_party/pyserial/serial/__init__.py | python | serial_for_url | (url, *args, **kwargs) | return instance | \
Get an instance of the Serial class, depending on port/url. The port is not
opened when the keyword parameter 'do_not_open' is true, by default it
is. All other parameters are directly passed to the __init__ method when
the port is instantiated.
The list of package names that is searched for prot... | \
Get an instance of the Serial class, depending on port/url. The port is not
opened when the keyword parameter 'do_not_open' is true, by default it
is. All other parameters are directly passed to the __init__ method when
the port is instantiated. | [
"\\",
"Get",
"an",
"instance",
"of",
"the",
"Serial",
"class",
"depending",
"on",
"port",
"/",
"url",
".",
"The",
"port",
"is",
"not",
"opened",
"when",
"the",
"keyword",
"parameter",
"do_not_open",
"is",
"true",
"by",
"default",
"it",
"is",
".",
"All",
... | def serial_for_url(url, *args, **kwargs):
"""\
Get an instance of the Serial class, depending on port/url. The port is not
opened when the keyword parameter 'do_not_open' is true, by default it
is. All other parameters are directly passed to the __init__ method when
the port is instantiated.
Th... | [
"def",
"serial_for_url",
"(",
"url",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# check remove extra parameter to not confuse the Serial class",
"do_open",
"=",
"'do_not_open'",
"not",
"in",
"kwargs",
"or",
"not",
"kwargs",
"[",
"'do_not_open'",
"]",
"i... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/tools/telemetry/third_party/pyserial/serial/__init__.py#L32-L79 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/dashboard/dashboard/bisect_fyi.py | python | _StartBisectFYIJob | (test_name, bisect_config) | return bisect_result | Re-starts a bisect-job after modifying it's config based on run count.
Args:
test_name: Name of the test case.
bisect_job: TryJob entity with initialized bot name and config.
Returns:
If successful, a dict containing "issue_id" and "issue_url" for the
bisect job. Otherwise, a dict containing "erro... | Re-starts a bisect-job after modifying it's config based on run count. | [
"Re",
"-",
"starts",
"a",
"bisect",
"-",
"job",
"after",
"modifying",
"it",
"s",
"config",
"based",
"on",
"run",
"count",
"."
] | def _StartBisectFYIJob(test_name, bisect_config):
"""Re-starts a bisect-job after modifying it's config based on run count.
Args:
test_name: Name of the test case.
bisect_job: TryJob entity with initialized bot name and config.
Returns:
If successful, a dict containing "issue_id" and "issue_url" for... | [
"def",
"_StartBisectFYIJob",
"(",
"test_name",
",",
"bisect_config",
")",
":",
"try",
":",
"bisect_job",
"=",
"_MakeBisectFYITryJob",
"(",
"test_name",
",",
"bisect_config",
")",
"except",
"auto_bisect",
".",
"NotBisectableError",
"as",
"e",
":",
"return",
"{",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/dashboard/dashboard/bisect_fyi.py#L58-L81 | |
netket/netket | 0d534e54ecbf25b677ea72af6b85947979420652 | netket/optimizer/qgt/qgt_jacobian_pytree_logic.py | python | _vjp | (oks: PyTree, w: Array) | return jax.tree_map(lambda x: mpi.mpi_sum_jax(x)[0], res) | Compute the vector-matrix product between the vector w and the pytree jacobian oks | Compute the vector-matrix product between the vector w and the pytree jacobian oks | [
"Compute",
"the",
"vector",
"-",
"matrix",
"product",
"between",
"the",
"vector",
"w",
"and",
"the",
"pytree",
"jacobian",
"oks"
] | def _vjp(oks: PyTree, w: Array) -> PyTree:
"""
Compute the vector-matrix product between the vector w and the pytree jacobian oks
"""
res = jax.tree_map(partial(jnp.tensordot, w, axes=1), oks)
return jax.tree_map(lambda x: mpi.mpi_sum_jax(x)[0], res) | [
"def",
"_vjp",
"(",
"oks",
":",
"PyTree",
",",
"w",
":",
"Array",
")",
"->",
"PyTree",
":",
"res",
"=",
"jax",
".",
"tree_map",
"(",
"partial",
"(",
"jnp",
".",
"tensordot",
",",
"w",
",",
"axes",
"=",
"1",
")",
",",
"oks",
")",
"return",
"jax"... | https://github.com/netket/netket/blob/0d534e54ecbf25b677ea72af6b85947979420652/netket/optimizer/qgt/qgt_jacobian_pytree_logic.py#L182-L187 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/ops/metrics_impl.py | python | false_negatives | (labels, predictions, weights=None,
metrics_collections=None,
updates_collections=None,
name=None) | Computes the total number of false negatives.
If `weights` is `None`, weights default to 1. Use weights of 0 to mask values.
Args:
labels: The ground truth values, a `Tensor` whose dimensions must match
`predictions`. Will be cast to `bool`.
predictions: The predicted values, a `Tensor` of arbitrary... | Computes the total number of false negatives. | [
"Computes",
"the",
"total",
"number",
"of",
"false",
"negatives",
"."
] | def false_negatives(labels, predictions, weights=None,
metrics_collections=None,
updates_collections=None,
name=None):
"""Computes the total number of false negatives.
If `weights` is `None`, weights default to 1. Use weights of 0 to mask values.
Args:... | [
"def",
"false_negatives",
"(",
"labels",
",",
"predictions",
",",
"weights",
"=",
"None",
",",
"metrics_collections",
"=",
"None",
",",
"updates_collections",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"with",
"variable_scope",
".",
"variable_scope",
"("... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/ops/metrics_impl.py#L1272-L1313 | ||
rodeofx/OpenWalter | 6116fbe3f04f1146c854afbfbdbe944feaee647e | walter/maya/scripts/walterPanel/mergeExpressions.py | python | MergeExpressions.diff | (self, i, j) | Compare sub-strings and return the expression that matches both parts of
the sub-strings.
:param int i: The number of the symbol of the first string to compare.
:param int j: The number of the symbol of the second string to compare.
:returns: The expression that matches both parts of th... | Compare sub-strings and return the expression that matches both parts of
the sub-strings. | [
"Compare",
"sub",
"-",
"strings",
"and",
"return",
"the",
"expression",
"that",
"matches",
"both",
"parts",
"of",
"the",
"sub",
"-",
"strings",
"."
] | def diff(self, i, j):
"""
Compare sub-strings and return the expression that matches both parts of
the sub-strings.
:param int i: The number of the symbol of the first string to compare.
:param int j: The number of the symbol of the second string to compare.
:returns: Th... | [
"def",
"diff",
"(",
"self",
",",
"i",
",",
"j",
")",
":",
"if",
"i",
">",
"0",
"and",
"j",
">",
"0",
"and",
"self",
".",
"first",
"[",
"i",
"-",
"1",
"]",
"==",
"self",
".",
"second",
"[",
"j",
"-",
"1",
"]",
":",
"# Match",
"return",
"se... | https://github.com/rodeofx/OpenWalter/blob/6116fbe3f04f1146c854afbfbdbe944feaee647e/walter/maya/scripts/walterPanel/mergeExpressions.py#L36-L65 | ||
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/ops/_grad/grad_nn_ops.py | python | get_bprop_avg_pool_grad | (self) | return bprop | Grad definition for `AvgPool` operation. | Grad definition for `AvgPool` operation. | [
"Grad",
"definition",
"for",
"AvgPool",
"operation",
"."
] | def get_bprop_avg_pool_grad(self):
"""Grad definition for `AvgPool` operation."""
avgpool_grad = G.AvgPoolGrad(
kernel_size=self.kernel_size,
strides=self.strides,
pad_mode=self.pad_mode,
data_format=self.format)
def bprop(x, out, dout):
dx = avgpool_grad(x, out, dou... | [
"def",
"get_bprop_avg_pool_grad",
"(",
"self",
")",
":",
"avgpool_grad",
"=",
"G",
".",
"AvgPoolGrad",
"(",
"kernel_size",
"=",
"self",
".",
"kernel_size",
",",
"strides",
"=",
"self",
".",
"strides",
",",
"pad_mode",
"=",
"self",
".",
"pad_mode",
",",
"da... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/ops/_grad/grad_nn_ops.py#L308-L320 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/propgrid.py | python | PyComboBoxEditor._SetSelf | (*args, **kwargs) | return _propgrid.PyComboBoxEditor__SetSelf(*args, **kwargs) | _SetSelf(self, PyObject self) | _SetSelf(self, PyObject self) | [
"_SetSelf",
"(",
"self",
"PyObject",
"self",
")"
] | def _SetSelf(*args, **kwargs):
"""_SetSelf(self, PyObject self)"""
return _propgrid.PyComboBoxEditor__SetSelf(*args, **kwargs) | [
"def",
"_SetSelf",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_propgrid",
".",
"PyComboBoxEditor__SetSelf",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/propgrid.py#L3977-L3979 | |
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | example/rnn/large_word_lm/custom_module.py | python | CustomModule.load | (prefix, epoch, load_optimizer_states=False, symbol=None, **kwargs) | return mod | Creates a model from previously saved checkpoint.
Parameters
----------
prefix : str
path prefix of saved model files. You should have
"prefix-symbol.json", "prefix-xxxx.params", and
optionally "prefix-xxxx.states", where xxxx is the
epoch number.... | Creates a model from previously saved checkpoint. | [
"Creates",
"a",
"model",
"from",
"previously",
"saved",
"checkpoint",
"."
] | def load(prefix, epoch, load_optimizer_states=False, symbol=None, **kwargs):
"""Creates a model from previously saved checkpoint.
Parameters
----------
prefix : str
path prefix of saved model files. You should have
"prefix-symbol.json", "prefix-xxxx.params", and
... | [
"def",
"load",
"(",
"prefix",
",",
"epoch",
",",
"load_optimizer_states",
"=",
"False",
",",
"symbol",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"sym",
",",
"args",
",",
"auxs",
"=",
"load_checkpoint",
"(",
"prefix",
",",
"epoch",
")",
"sym",
"... | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/example/rnn/large_word_lm/custom_module.py#L63-L100 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/ResourceManager/resource_manager/uploader.py | python | ResourceGroupUploader.execute_uploader_pre_hooks | (self) | Calls the upload_resource_group_pre_content methods defined by uploader hook modules.
The methods are called with the context, and this uploader as their only parameters.
Uploader hook modules are defined by upload.py files in the project's AWS directory
and in resource group directories. | Calls the upload_resource_group_pre_content methods defined by uploader hook modules. | [
"Calls",
"the",
"upload_resource_group_pre_content",
"methods",
"defined",
"by",
"uploader",
"hook",
"modules",
"."
] | def execute_uploader_pre_hooks(self):
"""Calls the upload_resource_group_pre_content methods defined by uploader hook modules.
The methods are called with the context, and this uploader as their only parameters.
Uploader hook modules are defined by upload.py files in the project's AWS director... | [
"def",
"execute_uploader_pre_hooks",
"(",
"self",
")",
":",
"self",
".",
"_execute_uploader_hooks",
"(",
"'upload_resource_group_content_pre'",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/ResourceManager/resource_manager/uploader.py#L732-L740 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/dateutil/tz/tz.py | python | datetime_ambiguous | (dt, tz=None) | return not (same_offset and same_dst) | Given a datetime and a time zone, determine whether or not a given datetime
is ambiguous (i.e if there are two times differentiated only by their DST
status).
:param dt:
A :class:`datetime.datetime` (whose time zone will be ignored if ``tz``
is provided.)
:param tz:
A :class:`d... | Given a datetime and a time zone, determine whether or not a given datetime
is ambiguous (i.e if there are two times differentiated only by their DST
status). | [
"Given",
"a",
"datetime",
"and",
"a",
"time",
"zone",
"determine",
"whether",
"or",
"not",
"a",
"given",
"datetime",
"is",
"ambiguous",
"(",
"i",
".",
"e",
"if",
"there",
"are",
"two",
"times",
"differentiated",
"only",
"by",
"their",
"DST",
"status",
")... | def datetime_ambiguous(dt, tz=None):
"""
Given a datetime and a time zone, determine whether or not a given datetime
is ambiguous (i.e if there are two times differentiated only by their DST
status).
:param dt:
A :class:`datetime.datetime` (whose time zone will be ignored if ``tz``
... | [
"def",
"datetime_ambiguous",
"(",
"dt",
",",
"tz",
"=",
"None",
")",
":",
"if",
"tz",
"is",
"None",
":",
"if",
"dt",
".",
"tzinfo",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"'Datetime is naive and no time zone provided.'",
")",
"tz",
"=",
"dt",
".",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/dateutil/tz/tz.py#L1717-L1760 | |
plumonito/dtslam | 5994bb9cf7a11981b830370db206bceb654c085d | 3rdparty/opencv-git/3rdparty/jinja2/environment.py | python | Template.stream | (self, *args, **kwargs) | return TemplateStream(self.generate(*args, **kwargs)) | Works exactly like :meth:`generate` but returns a
:class:`TemplateStream`. | Works exactly like :meth:`generate` but returns a
:class:`TemplateStream`. | [
"Works",
"exactly",
"like",
":",
"meth",
":",
"generate",
"but",
"returns",
"a",
":",
"class",
":",
"TemplateStream",
"."
] | def stream(self, *args, **kwargs):
"""Works exactly like :meth:`generate` but returns a
:class:`TemplateStream`.
"""
return TemplateStream(self.generate(*args, **kwargs)) | [
"def",
"stream",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"TemplateStream",
"(",
"self",
".",
"generate",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")"
] | https://github.com/plumonito/dtslam/blob/5994bb9cf7a11981b830370db206bceb654c085d/3rdparty/opencv-git/3rdparty/jinja2/environment.py#L971-L975 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/dataview.py | python | DataViewEvent.SetDataBuffer | (*args, **kwargs) | return _dataview.DataViewEvent_SetDataBuffer(*args, **kwargs) | SetDataBuffer(self, void buf) | SetDataBuffer(self, void buf) | [
"SetDataBuffer",
"(",
"self",
"void",
"buf",
")"
] | def SetDataBuffer(*args, **kwargs):
"""SetDataBuffer(self, void buf)"""
return _dataview.DataViewEvent_SetDataBuffer(*args, **kwargs) | [
"def",
"SetDataBuffer",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_dataview",
".",
"DataViewEvent_SetDataBuffer",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/dataview.py#L1991-L1993 | |
baidu/bigflow | 449245016c0df7d1252e85581e588bfc60cefad3 | bigflow_python/python/bigflow/core/serde/cloudpickle.py | python | CloudPickler.inject_timeseries | (self) | Handle bugs with pickling scikits timeseries | Handle bugs with pickling scikits timeseries | [
"Handle",
"bugs",
"with",
"pickling",
"scikits",
"timeseries"
] | def inject_timeseries(self):
"""Handle bugs with pickling scikits timeseries"""
tseries = sys.modules.get('scikits.timeseries.tseries')
if not tseries or not hasattr(tseries, 'Timeseries'):
return
self.dispatch[tseries.Timeseries] = self.__class__.save_timeseries | [
"def",
"inject_timeseries",
"(",
"self",
")",
":",
"tseries",
"=",
"sys",
".",
"modules",
".",
"get",
"(",
"'scikits.timeseries.tseries'",
")",
"if",
"not",
"tseries",
"or",
"not",
"hasattr",
"(",
"tseries",
",",
"'Timeseries'",
")",
":",
"return",
"self",
... | https://github.com/baidu/bigflow/blob/449245016c0df7d1252e85581e588bfc60cefad3/bigflow_python/python/bigflow/core/serde/cloudpickle.py#L752-L757 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/typeinfer.py | python | fold_arg_vars | (typevars, args, vararg, kws) | return pos_args, kw_args | Fold and resolve the argument variables of a function call. | Fold and resolve the argument variables of a function call. | [
"Fold",
"and",
"resolve",
"the",
"argument",
"variables",
"of",
"a",
"function",
"call",
"."
] | def fold_arg_vars(typevars, args, vararg, kws):
"""
Fold and resolve the argument variables of a function call.
"""
# Fetch all argument types, bail if any is unknown
n_pos_args = len(args)
kwds = [kw for (kw, var) in kws]
argtypes = [typevars[a.name] for a in args]
argtypes += [typevars... | [
"def",
"fold_arg_vars",
"(",
"typevars",
",",
"args",
",",
"vararg",
",",
"kws",
")",
":",
"# Fetch all argument types, bail if any is unknown",
"n_pos_args",
"=",
"len",
"(",
"args",
")",
"kwds",
"=",
"[",
"kw",
"for",
"(",
"kw",
",",
"var",
")",
"in",
"k... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/typeinfer.py#L416-L455 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/lib/function_base.py | python | insert | (arr, obj, values, axis=None) | return new | Insert values along the given axis before the given indices.
Parameters
----------
arr : array_like
Input array.
obj : int, slice or sequence of ints
Object that defines the index or indices before which `values` is
inserted.
.. versionadded:: 1.8.0
Support for... | Insert values along the given axis before the given indices. | [
"Insert",
"values",
"along",
"the",
"given",
"axis",
"before",
"the",
"given",
"indices",
"."
] | def insert(arr, obj, values, axis=None):
"""
Insert values along the given axis before the given indices.
Parameters
----------
arr : array_like
Input array.
obj : int, slice or sequence of ints
Object that defines the index or indices before which `values` is
inserted.
... | [
"def",
"insert",
"(",
"arr",
",",
"obj",
",",
"values",
",",
"axis",
"=",
"None",
")",
":",
"wrap",
"=",
"None",
"if",
"type",
"(",
"arr",
")",
"is",
"not",
"ndarray",
":",
"try",
":",
"wrap",
"=",
"arr",
".",
"__array_wrap__",
"except",
"Attribute... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/lib/function_base.py#L4430-L4633 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_core.py | python | FSFile.GetAnchor | (*args, **kwargs) | return _core_.FSFile_GetAnchor(*args, **kwargs) | GetAnchor(self) -> String | GetAnchor(self) -> String | [
"GetAnchor",
"(",
"self",
")",
"-",
">",
"String"
] | def GetAnchor(*args, **kwargs):
"""GetAnchor(self) -> String"""
return _core_.FSFile_GetAnchor(*args, **kwargs) | [
"def",
"GetAnchor",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"FSFile_GetAnchor",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_core.py#L2307-L2309 | |
RobotLocomotion/drake | 0e18a34604c45ed65bc9018a54f7610f91cdad5b | doc/doxygen_cxx/build.py | python | _generate_doxygen_header | (*, doxygen, temp_dir) | Creates Drake's header.html based on a patch to Doxygen's default
header template. | Creates Drake's header.html based on a patch to Doxygen's default
header template. | [
"Creates",
"Drake",
"s",
"header",
".",
"html",
"based",
"on",
"a",
"patch",
"to",
"Doxygen",
"s",
"default",
"header",
"template",
"."
] | def _generate_doxygen_header(*, doxygen, temp_dir):
"""Creates Drake's header.html based on a patch to Doxygen's default
header template.
"""
# This matches Doxyfile_CXX.
header_path = f"{temp_dir}/drake/doc/doxygen_cxx/header.html"
# Extract the default templates from the Doxygen binary. We on... | [
"def",
"_generate_doxygen_header",
"(",
"*",
",",
"doxygen",
",",
"temp_dir",
")",
":",
"# This matches Doxyfile_CXX.",
"header_path",
"=",
"f\"{temp_dir}/drake/doc/doxygen_cxx/header.html\"",
"# Extract the default templates from the Doxygen binary. We only want the",
"# header, but i... | https://github.com/RobotLocomotion/drake/blob/0e18a34604c45ed65bc9018a54f7610f91cdad5b/doc/doxygen_cxx/build.py#L105-L126 | ||
PX4/PX4-Autopilot | 0b9f60a0370be53d683352c63fd92db3d6586e18 | platforms/nuttx/Debug/Nuttx.py | python | NX_register_set.mon_reg_call | (self,register) | register is the register as a string e.g. 'pc'
return integer containing the value of the register | register is the register as a string e.g. 'pc'
return integer containing the value of the register | [
"register",
"is",
"the",
"register",
"as",
"a",
"string",
"e",
".",
"g",
".",
"pc",
"return",
"integer",
"containing",
"the",
"value",
"of",
"the",
"register"
] | def mon_reg_call(self,register):
"""
register is the register as a string e.g. 'pc'
return integer containing the value of the register
"""
str_to_eval = "info registers "+register
resp = gdb.execute(str_to_eval,to_string = True)
content = resp.split()[-1]
try:
return int(content)
except:
return... | [
"def",
"mon_reg_call",
"(",
"self",
",",
"register",
")",
":",
"str_to_eval",
"=",
"\"info registers \"",
"+",
"register",
"resp",
"=",
"gdb",
".",
"execute",
"(",
"str_to_eval",
",",
"to_string",
"=",
"True",
")",
"content",
"=",
"resp",
".",
"split",
"("... | https://github.com/PX4/PX4-Autopilot/blob/0b9f60a0370be53d683352c63fd92db3d6586e18/platforms/nuttx/Debug/Nuttx.py#L89-L100 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/resolvelib/reporters.py | python | BaseReporter.adding_requirement | (self, requirement, parent) | Called when adding a new requirement into the resolve criteria.
:param requirement: The additional requirement to be applied to filter
the available candidaites.
:param parent: The candidate that requires ``requirement`` as a
dependency, or None if ``requirement`` is one of the ... | Called when adding a new requirement into the resolve criteria. | [
"Called",
"when",
"adding",
"a",
"new",
"requirement",
"into",
"the",
"resolve",
"criteria",
"."
] | def adding_requirement(self, requirement, parent):
"""Called when adding a new requirement into the resolve criteria.
:param requirement: The additional requirement to be applied to filter
the available candidaites.
:param parent: The candidate that requires ``requirement`` as a
... | [
"def",
"adding_requirement",
"(",
"self",
",",
"requirement",
",",
"parent",
")",
":"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/resolvelib/reporters.py#L23-L31 | ||
cvxpy/cvxpy | 5165b4fb750dfd237de8659383ef24b4b2e33aaf | cvxpy/atoms/prod.py | python | Prod._column_grad | (self, value) | return np.prod(value) / value | Gives the (sub/super)gradient of the atom w.r.t. a column argument.
Matrix expressions are vectorized, so the gradient is a matrix.
Args:
value: A numeric value for a column.
Returns:
A NumPy ndarray or None. | Gives the (sub/super)gradient of the atom w.r.t. a column argument. | [
"Gives",
"the",
"(",
"sub",
"/",
"super",
")",
"gradient",
"of",
"the",
"atom",
"w",
".",
"r",
".",
"t",
".",
"a",
"column",
"argument",
"."
] | def _column_grad(self, value):
"""Gives the (sub/super)gradient of the atom w.r.t. a column argument.
Matrix expressions are vectorized, so the gradient is a matrix.
Args:
value: A numeric value for a column.
Returns:
A NumPy ndarray or None.
"""
... | [
"def",
"_column_grad",
"(",
"self",
",",
"value",
")",
":",
"return",
"np",
".",
"prod",
"(",
"value",
")",
"/",
"value"
] | https://github.com/cvxpy/cvxpy/blob/5165b4fb750dfd237de8659383ef24b4b2e33aaf/cvxpy/atoms/prod.py#L94-L105 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/nn/probability/distribution/normal.py | python | Normal._log_prob | (self, value, mean=None, sd=None) | return unnormalized_log_prob + neg_normalization | r"""
Evaluate log probability.
Args:
value (Tensor): The value to be evaluated.
mean (Tensor): The mean of the distribution. Default: self._mean_value.
sd (Tensor): The standard deviation the distribution. Default: self._sd_value.
.. math::
L(x) ... | r"""
Evaluate log probability. | [
"r",
"Evaluate",
"log",
"probability",
"."
] | def _log_prob(self, value, mean=None, sd=None):
r"""
Evaluate log probability.
Args:
value (Tensor): The value to be evaluated.
mean (Tensor): The mean of the distribution. Default: self._mean_value.
sd (Tensor): The standard deviation the distribution. Defau... | [
"def",
"_log_prob",
"(",
"self",
",",
"value",
",",
"mean",
"=",
"None",
",",
"sd",
"=",
"None",
")",
":",
"value",
"=",
"self",
".",
"_check_value",
"(",
"value",
",",
"'value'",
")",
"value",
"=",
"self",
".",
"cast",
"(",
"value",
",",
"self",
... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/nn/probability/distribution/normal.py#L263-L282 | |
google/fhir | d77f57706c1a168529b0b87ca7ccb1c0113e83c2 | py/google/fhir/fhir_errors.py | python | ListErrorReporter.report_fhir_path_warning | (self, element_path: str,
fhir_path_constraint: str, msg: str) | Logs to the `warning` context and stores `msg` in `warnings`. | Logs to the `warning` context and stores `msg` in `warnings`. | [
"Logs",
"to",
"the",
"warning",
"context",
"and",
"stores",
"msg",
"in",
"warnings",
"."
] | def report_fhir_path_warning(self, element_path: str,
fhir_path_constraint: str, msg: str) -> None:
"""Logs to the `warning` context and stores `msg` in `warnings`."""
logging.warning('%s:%s; %s', element_path, fhir_path_constraint, msg)
self.warnings.append(msg) | [
"def",
"report_fhir_path_warning",
"(",
"self",
",",
"element_path",
":",
"str",
",",
"fhir_path_constraint",
":",
"str",
",",
"msg",
":",
"str",
")",
"->",
"None",
":",
"logging",
".",
"warning",
"(",
"'%s:%s; %s'",
",",
"element_path",
",",
"fhir_path_constr... | https://github.com/google/fhir/blob/d77f57706c1a168529b0b87ca7ccb1c0113e83c2/py/google/fhir/fhir_errors.py#L143-L147 | ||
NVIDIA/DALI | bf16cc86ba8f091b145f91962f21fe1b6aff243d | dali/python/nvidia/dali/tensors.py | python | _tensor_to_string | (self) | return _join_string(params, False, 0, ',\n' + indent) | Returns string representation of Tensor. | Returns string representation of Tensor. | [
"Returns",
"string",
"representation",
"of",
"Tensor",
"."
] | def _tensor_to_string(self):
""" Returns string representation of Tensor."""
import numpy as np
type_name = type(self).__name__
indent = ' ' * 4
layout = self.layout()
data = np.array(_transfer_to_cpu(self, type_name[-3:]))
data_str = np.array2string(data, prefix=indent, edgeitems=2)
p... | [
"def",
"_tensor_to_string",
"(",
"self",
")",
":",
"import",
"numpy",
"as",
"np",
"type_name",
"=",
"type",
"(",
"self",
")",
".",
"__name__",
"indent",
"=",
"' '",
"*",
"4",
"layout",
"=",
"self",
".",
"layout",
"(",
")",
"data",
"=",
"np",
".",
"... | https://github.com/NVIDIA/DALI/blob/bf16cc86ba8f091b145f91962f21fe1b6aff243d/dali/python/nvidia/dali/tensors.py#L36-L50 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/aui/framemanager.py | python | AuiManager.DoDropLayer | (self, docks, target, dock_direction) | return self.ProcessDockResult(target, drop) | Handles the situation in which `target` is a single dock guide.
:param `docks`: a list of :class:`AuiDockInfo` classes;
:param AuiPaneInfo `target`: the target pane;
:param integer `dock_direction`: the docking direction. | Handles the situation in which `target` is a single dock guide. | [
"Handles",
"the",
"situation",
"in",
"which",
"target",
"is",
"a",
"single",
"dock",
"guide",
"."
] | def DoDropLayer(self, docks, target, dock_direction):
"""
Handles the situation in which `target` is a single dock guide.
:param `docks`: a list of :class:`AuiDockInfo` classes;
:param AuiPaneInfo `target`: the target pane;
:param integer `dock_direction`: the docking direction.... | [
"def",
"DoDropLayer",
"(",
"self",
",",
"docks",
",",
"target",
",",
"dock_direction",
")",
":",
"drop",
"=",
"self",
".",
"CopyTarget",
"(",
"target",
")",
"if",
"dock_direction",
"==",
"AUI_DOCK_LEFT",
":",
"drop",
".",
"Dock",
"(",
")",
".",
"Left",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/aui/framemanager.py#L7983-L8023 | |
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/fluid/dataset.py | python | DatasetBase.set_hdfs_config | (self, fs_name, fs_ugi) | Set hdfs config: fs name ad ugi
Examples:
.. code-block:: python
import paddle.fluid as fluid
dataset = fluid.DatasetFactory().create_dataset()
dataset.set_hdfs_config("my_fs_name", "my_fs_ugi")
Args:
fs_name(str): fs name
... | Set hdfs config: fs name ad ugi | [
"Set",
"hdfs",
"config",
":",
"fs",
"name",
"ad",
"ugi"
] | def set_hdfs_config(self, fs_name, fs_ugi):
"""
Set hdfs config: fs name ad ugi
Examples:
.. code-block:: python
import paddle.fluid as fluid
dataset = fluid.DatasetFactory().create_dataset()
dataset.set_hdfs_config("my_fs_name", "my_fs_ugi... | [
"def",
"set_hdfs_config",
"(",
"self",
",",
"fs_name",
",",
"fs_ugi",
")",
":",
"self",
".",
"dataset",
".",
"set_hdfs_config",
"(",
"fs_name",
",",
"fs_ugi",
")"
] | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/fluid/dataset.py#L280-L295 | ||
google/syzygy | 8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5 | syzygy/agent/asan/generate_memory_interceptors.py | python | MacroAssembler.get_value | (self, key, args, kwargs) | return super(MacroAssembler, self).get_value(key, args, kwargs) | Override to inject macro definitions. | Override to inject macro definitions. | [
"Override",
"to",
"inject",
"macro",
"definitions",
"."
] | def get_value(self, key, args, kwargs):
"""Override to inject macro definitions."""
if key in _MACROS:
macro = _MACROS[key].format(*args, **kwargs)
# Trim leading whitespace to allow natural use of AsanXXX macros.
macro = macro.lstrip()
return macro
return super(MacroAssembler, self)... | [
"def",
"get_value",
"(",
"self",
",",
"key",
",",
"args",
",",
"kwargs",
")",
":",
"if",
"key",
"in",
"_MACROS",
":",
"macro",
"=",
"_MACROS",
"[",
"key",
"]",
".",
"format",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"# Trim leading whitespace ... | https://github.com/google/syzygy/blob/8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5/syzygy/agent/asan/generate_memory_interceptors.py#L612-L619 | |
apache/singa | 93fd9da72694e68bfe3fb29d0183a65263d238a1 | python/singa/tensor.py | python | eltwise_mult | (lhs, rhs, ret=None) | Elementi-wise multiplication.
Args:
lhs (Tensor): lhs tensor
rhs (Tensor): rhs tensor
ret (Tensor, optional): if not None, the result is stored in it;
otherwise, a new Tensor would be created for the result.
Returns:
the result Tensor | Elementi-wise multiplication. | [
"Elementi",
"-",
"wise",
"multiplication",
"."
] | def eltwise_mult(lhs, rhs, ret=None):
'''Elementi-wise multiplication.
Args:
lhs (Tensor): lhs tensor
rhs (Tensor): rhs tensor
ret (Tensor, optional): if not None, the result is stored in it;
otherwise, a new Tensor would be created for the result.
Returns:
the ... | [
"def",
"eltwise_mult",
"(",
"lhs",
",",
"rhs",
",",
"ret",
"=",
"None",
")",
":",
"if",
"ret",
"is",
"None",
":",
"# call Tensor.__mul__()",
"return",
"lhs",
"*",
"rhs",
"else",
":",
"if",
"isinstance",
"(",
"rhs",
",",
"Tensor",
")",
":",
"singa",
"... | https://github.com/apache/singa/blob/93fd9da72694e68bfe3fb29d0183a65263d238a1/python/singa/tensor.py#L1278-L1299 | ||
lilypond/lilypond | 2a14759372979f5b796ee802b0ee3bc15d28b06b | release/binaries/lib/build.py | python | Package.license_files | (self) | return [] | Return the list of license files for this package | Return the list of license files for this package | [
"Return",
"the",
"list",
"of",
"license",
"files",
"for",
"this",
"package"
] | def license_files(self) -> List[str]:
"""Return the list of license files for this package"""
return [] | [
"def",
"license_files",
"(",
"self",
")",
"->",
"List",
"[",
"str",
"]",
":",
"return",
"[",
"]"
] | https://github.com/lilypond/lilypond/blob/2a14759372979f5b796ee802b0ee3bc15d28b06b/release/binaries/lib/build.py#L225-L227 | |
taichi-dev/taichi | 973c04d6ba40f34e9e3bd5a28ae0ee0802f136a6 | python/taichi/lang/struct.py | python | Struct.fill | (self, val) | return self.element_wise_writeback_binary(assign_renamed, val) | Fills the Struct with a specific value in Taichi scope.
Args:
val (Union[int, float]): Value to fill. | Fills the Struct with a specific value in Taichi scope. | [
"Fills",
"the",
"Struct",
"with",
"a",
"specific",
"value",
"in",
"Taichi",
"scope",
"."
] | def fill(self, val):
"""Fills the Struct with a specific value in Taichi scope.
Args:
val (Union[int, float]): Value to fill.
"""
def assign_renamed(x, y):
return ops.assign(x, y)
return self.element_wise_writeback_binary(assign_renamed, val) | [
"def",
"fill",
"(",
"self",
",",
"val",
")",
":",
"def",
"assign_renamed",
"(",
"x",
",",
"y",
")",
":",
"return",
"ops",
".",
"assign",
"(",
"x",
",",
"y",
")",
"return",
"self",
".",
"element_wise_writeback_binary",
"(",
"assign_renamed",
",",
"val",... | https://github.com/taichi-dev/taichi/blob/973c04d6ba40f34e9e3bd5a28ae0ee0802f136a6/python/taichi/lang/struct.py#L168-L177 | |
gimli-org/gimli | 17aa2160de9b15ababd9ef99e89b1bc3277bbb23 | pygimli/physics/sNMR/mrs.py | python | MRS.run | (self, verbose=True, uncertainty=False, **kwargs) | Easiest variant doing all (create fop and inv) in one call. | Easiest variant doing all (create fop and inv) in one call. | [
"Easiest",
"variant",
"doing",
"all",
"(",
"create",
"fop",
"and",
"inv",
")",
"in",
"one",
"call",
"."
] | def run(self, verbose=True, uncertainty=False, **kwargs):
"""Easiest variant doing all (create fop and inv) in one call."""
self.invert(verbose=verbose, **kwargs)
if uncertainty:
if verbose:
print("Computing uncertainty...")
self.modelL, self.modelU = iter... | [
"def",
"run",
"(",
"self",
",",
"verbose",
"=",
"True",
",",
"uncertainty",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"invert",
"(",
"verbose",
"=",
"verbose",
",",
"*",
"*",
"kwargs",
")",
"if",
"uncertainty",
":",
"if",
"verbo... | https://github.com/gimli-org/gimli/blob/17aa2160de9b15ababd9ef99e89b1bc3277bbb23/pygimli/physics/sNMR/mrs.py#L433-L442 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/stc.py | python | StyledTextCtrl.SetSelectionStart | (*args, **kwargs) | return _stc.StyledTextCtrl_SetSelectionStart(*args, **kwargs) | SetSelectionStart(self, int pos)
Sets the position that starts the selection - this becomes the anchor. | SetSelectionStart(self, int pos) | [
"SetSelectionStart",
"(",
"self",
"int",
"pos",
")"
] | def SetSelectionStart(*args, **kwargs):
"""
SetSelectionStart(self, int pos)
Sets the position that starts the selection - this becomes the anchor.
"""
return _stc.StyledTextCtrl_SetSelectionStart(*args, **kwargs) | [
"def",
"SetSelectionStart",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_stc",
".",
"StyledTextCtrl_SetSelectionStart",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/stc.py#L3428-L3434 | |
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/rexec.py | python | RExec.s_reload | (self, *args) | return self.s_apply(self.r_reload, args) | Reload the module object, re-parsing and re-initializing it.
This method is implicitly called by code executing in the
restricted environment. Overriding this method in a subclass is
used to change the policies enforced by a restricted environment.
Similar to the r_reload() method, bu... | Reload the module object, re-parsing and re-initializing it. | [
"Reload",
"the",
"module",
"object",
"re",
"-",
"parsing",
"and",
"re",
"-",
"initializing",
"it",
"."
] | def s_reload(self, *args):
"""Reload the module object, re-parsing and re-initializing it.
This method is implicitly called by code executing in the
restricted environment. Overriding this method in a subclass is
used to change the policies enforced by a restricted environment.
... | [
"def",
"s_reload",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"self",
".",
"s_apply",
"(",
"self",
".",
"r_reload",
",",
"args",
")"
] | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/rexec.py#L477-L489 | |
cvxpy/cvxpy | 5165b4fb750dfd237de8659383ef24b4b2e33aaf | cvxpy/transforms/partial_optimize.py | python | PartialProblem.is_imag | (self) | return False | Is the Leaf imaginary? | Is the Leaf imaginary? | [
"Is",
"the",
"Leaf",
"imaginary?"
] | def is_imag(self) -> bool:
"""Is the Leaf imaginary?
"""
return False | [
"def",
"is_imag",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"False"
] | https://github.com/cvxpy/cvxpy/blob/5165b4fb750dfd237de8659383ef24b4b2e33aaf/cvxpy/transforms/partial_optimize.py#L175-L178 | |
apple/swift-clang | d7403439fc6641751840b723e7165fb02f52db95 | bindings/python/clang/cindex.py | python | Cursor.get_template_argument_type | (self, num) | return conf.lib.clang_Cursor_getTemplateArgumentType(self, num) | Returns the CXType for the indicated template argument. | Returns the CXType for the indicated template argument. | [
"Returns",
"the",
"CXType",
"for",
"the",
"indicated",
"template",
"argument",
"."
] | def get_template_argument_type(self, num):
"""Returns the CXType for the indicated template argument."""
return conf.lib.clang_Cursor_getTemplateArgumentType(self, num) | [
"def",
"get_template_argument_type",
"(",
"self",
",",
"num",
")",
":",
"return",
"conf",
".",
"lib",
".",
"clang_Cursor_getTemplateArgumentType",
"(",
"self",
",",
"num",
")"
] | https://github.com/apple/swift-clang/blob/d7403439fc6641751840b723e7165fb02f52db95/bindings/python/clang/cindex.py#L1815-L1817 | |
google/earthenterprise | 0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9 | earth_enterprise/src/fusion/portableglobe/cutter/cgi-bin/globe_cutter_app.py | python | GlobeBuilder.ConvertPolygonToQtNodes | (self, polygon_level, is_mercator=False) | Convert polygon into a set of qt nodes at given level. | Convert polygon into a set of qt nodes at given level. | [
"Convert",
"polygon",
"into",
"a",
"set",
"of",
"qt",
"nodes",
"at",
"given",
"level",
"."
] | def ConvertPolygonToQtNodes(self, polygon_level, is_mercator=False):
"""Convert polygon into a set of qt nodes at given level."""
self.Status("Convert polygon to quadtree nodes ...")
try:
os.remove(self.qtnodes_file)
except OSError:
pass # Ok, if file isn't there.
os_cmd = ("%s/gepolyg... | [
"def",
"ConvertPolygonToQtNodes",
"(",
"self",
",",
"polygon_level",
",",
"is_mercator",
"=",
"False",
")",
":",
"self",
".",
"Status",
"(",
"\"Convert polygon to quadtree nodes ...\"",
")",
"try",
":",
"os",
".",
"remove",
"(",
"self",
".",
"qtnodes_file",
")",... | https://github.com/google/earthenterprise/blob/0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9/earth_enterprise/src/fusion/portableglobe/cutter/cgi-bin/globe_cutter_app.py#L224-L242 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | tools/scripts/update-pr-base-branch.py | python | update_base_branch | (prs, newbase, token) | Updates the base branch of each PR to newbas
:param prs: A list of PullRequest objects
:param newbase: A string giving the new base for each pull request
:param token: An authorization token for GitHub | Updates the base branch of each PR to newbas
:param prs: A list of PullRequest objects
:param newbase: A string giving the new base for each pull request
:param token: An authorization token for GitHub | [
"Updates",
"the",
"base",
"branch",
"of",
"each",
"PR",
"to",
"newbas",
":",
"param",
"prs",
":",
"A",
"list",
"of",
"PullRequest",
"objects",
":",
"param",
"newbase",
":",
"A",
"string",
"giving",
"the",
"new",
"base",
"for",
"each",
"pull",
"request",
... | def update_base_branch(prs, newbase, token):
"""
Updates the base branch of each PR to newbas
:param prs: A list of PullRequest objects
:param newbase: A string giving the new base for each pull request
:param token: An authorization token for GitHub
"""
for pr in prs:
update_pr_base... | [
"def",
"update_base_branch",
"(",
"prs",
",",
"newbase",
",",
"token",
")",
":",
"for",
"pr",
"in",
"prs",
":",
"update_pr_base_branch",
"(",
"pr",
",",
"newbase",
",",
"token",
")"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/tools/scripts/update-pr-base-branch.py#L123-L131 | ||
weolar/miniblink49 | 1c4678db0594a4abde23d3ebbcc7cd13c3170777 | third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/coverage/cmdline.py | python | CoverageScript.command_line | (self, argv) | return OK | The bulk of the command line interface to Coverage.
`argv` is the argument list to process.
Returns 0 if all is well, 1 if something went wrong. | The bulk of the command line interface to Coverage. | [
"The",
"bulk",
"of",
"the",
"command",
"line",
"interface",
"to",
"Coverage",
"."
] | def command_line(self, argv):
"""The bulk of the command line interface to Coverage.
`argv` is the argument list to process.
Returns 0 if all is well, 1 if something went wrong.
"""
# Collect the command-line options.
if not argv:
self.help_fn(topic='minim... | [
"def",
"command_line",
"(",
"self",
",",
"argv",
")",
":",
"# Collect the command-line options.",
"if",
"not",
"argv",
":",
"self",
".",
"help_fn",
"(",
"topic",
"=",
"'minimum_help'",
")",
"return",
"OK",
"# The command syntax we parse depends on the first argument. C... | https://github.com/weolar/miniblink49/blob/1c4678db0594a4abde23d3ebbcc7cd13c3170777/third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/coverage/cmdline.py#L370-L554 | |
ZhouWeikuan/DouDiZhu | 0d84ff6c0bc54dba6ae37955de9ae9307513dc99 | code/frameworks/cocos2d-x/tools/bindings-generator/backup/clang-llvm-3.3-pybinding/cindex.py | python | Type.argument_types | (self) | return ArgumentsIterator(self) | Retrieve a container for the non-variadic arguments for this type.
The returned object is iterable and indexable. Each item in the
container is a Type instance. | Retrieve a container for the non-variadic arguments for this type. | [
"Retrieve",
"a",
"container",
"for",
"the",
"non",
"-",
"variadic",
"arguments",
"for",
"this",
"type",
"."
] | def argument_types(self):
"""Retrieve a container for the non-variadic arguments for this type.
The returned object is iterable and indexable. Each item in the
container is a Type instance.
"""
class ArgumentsIterator(collections.Sequence):
def __init__(self, parent)... | [
"def",
"argument_types",
"(",
"self",
")",
":",
"class",
"ArgumentsIterator",
"(",
"collections",
".",
"Sequence",
")",
":",
"def",
"__init__",
"(",
"self",
",",
"parent",
")",
":",
"self",
".",
"parent",
"=",
"parent",
"self",
".",
"length",
"=",
"None"... | https://github.com/ZhouWeikuan/DouDiZhu/blob/0d84ff6c0bc54dba6ae37955de9ae9307513dc99/code/frameworks/cocos2d-x/tools/bindings-generator/backup/clang-llvm-3.3-pybinding/cindex.py#L1465-L1501 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py2/sklearn/utils/extmath.py | python | randomized_svd | (M, n_components, n_oversamples=10, n_iter='auto',
power_iteration_normalizer='auto', transpose='auto',
flip_sign=True, random_state=0) | Computes a truncated randomized SVD
Parameters
----------
M: ndarray or sparse matrix
Matrix to decompose
n_components: int
Number of singular values and vectors to extract.
n_oversamples: int (default is 10)
Additional number of random vectors to sample the range of M so ... | Computes a truncated randomized SVD | [
"Computes",
"a",
"truncated",
"randomized",
"SVD"
] | def randomized_svd(M, n_components, n_oversamples=10, n_iter='auto',
power_iteration_normalizer='auto', transpose='auto',
flip_sign=True, random_state=0):
"""Computes a truncated randomized SVD
Parameters
----------
M: ndarray or sparse matrix
Matrix to dec... | [
"def",
"randomized_svd",
"(",
"M",
",",
"n_components",
",",
"n_oversamples",
"=",
"10",
",",
"n_iter",
"=",
"'auto'",
",",
"power_iteration_normalizer",
"=",
"'auto'",
",",
"transpose",
"=",
"'auto'",
",",
"flip_sign",
"=",
"True",
",",
"random_state",
"=",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py2/sklearn/utils/extmath.py#L270-L386 | ||
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/decimal.py | python | Decimal._round | (self, places, rounding) | return ans | Round a nonzero, nonspecial Decimal to a fixed number of
significant figures, using the given rounding mode.
Infinities, NaNs and zeros are returned unaltered.
This operation is quiet: it raises no flags, and uses no
information from the context. | Round a nonzero, nonspecial Decimal to a fixed number of
significant figures, using the given rounding mode. | [
"Round",
"a",
"nonzero",
"nonspecial",
"Decimal",
"to",
"a",
"fixed",
"number",
"of",
"significant",
"figures",
"using",
"the",
"given",
"rounding",
"mode",
"."
] | def _round(self, places, rounding):
"""Round a nonzero, nonspecial Decimal to a fixed number of
significant figures, using the given rounding mode.
Infinities, NaNs and zeros are returned unaltered.
This operation is quiet: it raises no flags, and uses no
information from the c... | [
"def",
"_round",
"(",
"self",
",",
"places",
",",
"rounding",
")",
":",
"if",
"places",
"<=",
"0",
":",
"raise",
"ValueError",
"(",
"\"argument should be at least 1 in _round\"",
")",
"if",
"self",
".",
"_is_special",
"or",
"not",
"self",
":",
"return",
"Dec... | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/decimal.py#L2387-L2408 | |
fasiondog/hikyuu | 842751aa25283f9fdafc6f560ea262f79e67a307 | hikyuu/data/pytdx_to_h5.py | python | import_data | (connect, market, ktype, quotations, api, dest_dir, startDate=199012190000, progress=ProgressBar) | return add_record_count | 导入通达信指定盘后数据路径中的K线数据。注:只导入基础信息数据库中存在的股票。
:param connect : sqlit3链接
:param market : 'SH' | 'SZ'
:param ktype : 'DAY' | '1MIN' | '5MIN'
:param quotations: 'stock' | 'fund' | 'bond'
:param src_dir : 盘后K线数据路径,如上证5分钟线:D:\\Tdx\\vipdoc\\sh\\fzline
:param dest_dir : HDF5数据文件所在目录
:param p... | 导入通达信指定盘后数据路径中的K线数据。注:只导入基础信息数据库中存在的股票。 | [
"导入通达信指定盘后数据路径中的K线数据。注:只导入基础信息数据库中存在的股票。"
] | def import_data(connect, market, ktype, quotations, api, dest_dir, startDate=199012190000, progress=ProgressBar):
"""导入通达信指定盘后数据路径中的K线数据。注:只导入基础信息数据库中存在的股票。
:param connect : sqlit3链接
:param market : 'SH' | 'SZ'
:param ktype : 'DAY' | '1MIN' | '5MIN'
:param quotations: 'stock' | 'fund' | 'b... | [
"def",
"import_data",
"(",
"connect",
",",
"market",
",",
"ktype",
",",
"quotations",
",",
"api",
",",
"dest_dir",
",",
"startDate",
"=",
"199012190000",
",",
"progress",
"=",
"ProgressBar",
")",
":",
"add_record_count",
"=",
"0",
"market",
"=",
"market",
... | https://github.com/fasiondog/hikyuu/blob/842751aa25283f9fdafc6f560ea262f79e67a307/hikyuu/data/pytdx_to_h5.py#L283-L320 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/keras/saving/utils_v1/export_output.py | python | ExportOutput._wrap_and_check_outputs | (
self, outputs, single_output_default_name, error_label=None) | return output_dict | Wraps raw tensors as dicts and checks type.
Note that we create a new dict here so that we can overwrite the keys
if necessary.
Args:
outputs: A `Tensor` or a dict of string to `Tensor`.
single_output_default_name: A string key for use in the output dict
if the provided `outputs` is a ... | Wraps raw tensors as dicts and checks type. | [
"Wraps",
"raw",
"tensors",
"as",
"dicts",
"and",
"checks",
"type",
"."
] | def _wrap_and_check_outputs(
self, outputs, single_output_default_name, error_label=None):
"""Wraps raw tensors as dicts and checks type.
Note that we create a new dict here so that we can overwrite the keys
if necessary.
Args:
outputs: A `Tensor` or a dict of string to `Tensor`.
sin... | [
"def",
"_wrap_and_check_outputs",
"(",
"self",
",",
"outputs",
",",
"single_output_default_name",
",",
"error_label",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"outputs",
",",
"dict",
")",
":",
"outputs",
"=",
"{",
"single_output_default_name",
":",... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/keras/saving/utils_v1/export_output.py#L61-L95 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/targets/linalg.py | python | dot_3_mm | (context, builder, sig, args) | return impl_ret_borrowed(context, builder, sig.return_type,
out._getvalue()) | np.dot(matrix, matrix, out) | np.dot(matrix, matrix, out) | [
"np",
".",
"dot",
"(",
"matrix",
"matrix",
"out",
")"
] | def dot_3_mm(context, builder, sig, args):
"""
np.dot(matrix, matrix, out)
"""
xty, yty, outty = sig.args
assert outty == sig.return_type
dtype = xty.dtype
x = make_array(xty)(context, builder, args[0])
y = make_array(yty)(context, builder, args[1])
out = make_array(outty)(context, ... | [
"def",
"dot_3_mm",
"(",
"context",
",",
"builder",
",",
"sig",
",",
"args",
")",
":",
"xty",
",",
"yty",
",",
"outty",
"=",
"sig",
".",
"args",
"assert",
"outty",
"==",
"sig",
".",
"return_type",
"dtype",
"=",
"xty",
".",
"dtype",
"x",
"=",
"make_a... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/targets/linalg.py#L626-L700 | |
Tencent/CMONGO | c40380caa14e05509f46993aa8b8da966b09b0b5 | src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Environment.py | python | SubstitutionEnvironment.MergeFlags | (self, args, unique=1, dict=None) | return self | Merge the dict in args into the construction variables of this
env, or the passed-in dict. If args is not a dict, it is
converted into a dict using ParseFlags. If unique is not set,
the flags are appended rather than merged. | Merge the dict in args into the construction variables of this
env, or the passed-in dict. If args is not a dict, it is
converted into a dict using ParseFlags. If unique is not set,
the flags are appended rather than merged. | [
"Merge",
"the",
"dict",
"in",
"args",
"into",
"the",
"construction",
"variables",
"of",
"this",
"env",
"or",
"the",
"passed",
"-",
"in",
"dict",
".",
"If",
"args",
"is",
"not",
"a",
"dict",
"it",
"is",
"converted",
"into",
"a",
"dict",
"using",
"ParseF... | def MergeFlags(self, args, unique=1, dict=None):
"""
Merge the dict in args into the construction variables of this
env, or the passed-in dict. If args is not a dict, it is
converted into a dict using ParseFlags. If unique is not set,
the flags are appended rather than merged.
... | [
"def",
"MergeFlags",
"(",
"self",
",",
"args",
",",
"unique",
"=",
"1",
",",
"dict",
"=",
"None",
")",
":",
"if",
"dict",
"is",
"None",
":",
"dict",
"=",
"self",
"if",
"not",
"SCons",
".",
"Util",
".",
"is_Dict",
"(",
"args",
")",
":",
"args",
... | https://github.com/Tencent/CMONGO/blob/c40380caa14e05509f46993aa8b8da966b09b0b5/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Environment.py#L803-L858 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/requests_toolbelt/multipart/decoder.py | python | BodyPart.text | (self) | return self.content.decode(self.encoding) | Content of the ``BodyPart`` in unicode. | Content of the ``BodyPart`` in unicode. | [
"Content",
"of",
"the",
"BodyPart",
"in",
"unicode",
"."
] | def text(self):
"""Content of the ``BodyPart`` in unicode."""
return self.content.decode(self.encoding) | [
"def",
"text",
"(",
"self",
")",
":",
"return",
"self",
".",
"content",
".",
"decode",
"(",
"self",
".",
"encoding",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/requests_toolbelt/multipart/decoder.py#L69-L71 | |
osrf/gazebo | f570338107862253229a0514ffea10deab4f4517 | tools/cpplint.py | python | CheckForNewlineAtEOF | (filename, lines, error) | Logs an error if there is no newline char at the end of the file.
Args:
filename: The name of the current file.
lines: An array of strings, each representing a line of the file.
error: The function to call with any errors found. | Logs an error if there is no newline char at the end of the file. | [
"Logs",
"an",
"error",
"if",
"there",
"is",
"no",
"newline",
"char",
"at",
"the",
"end",
"of",
"the",
"file",
"."
] | def CheckForNewlineAtEOF(filename, lines, error):
"""Logs an error if there is no newline char at the end of the file.
Args:
filename: The name of the current file.
lines: An array of strings, each representing a line of the file.
error: The function to call with any errors found.
"""
# The array ... | [
"def",
"CheckForNewlineAtEOF",
"(",
"filename",
",",
"lines",
",",
"error",
")",
":",
"# The array lines() was created by adding two newlines to the",
"# original file (go figure), then splitting on \\n.",
"# To verify that the file ends in \\n, we just have to make sure the",
"# last-but-... | https://github.com/osrf/gazebo/blob/f570338107862253229a0514ffea10deab4f4517/tools/cpplint.py#L1119-L1134 | ||
dicecco1/fpga_caffe | 7a191704efd7873071cfef35772d7e7bf3e3cfd6 | scripts/cpp_lint.py | python | FileInfo.FullName | (self) | return os.path.abspath(self._filename).replace('\\', '/') | Make Windows paths like Unix. | Make Windows paths like Unix. | [
"Make",
"Windows",
"paths",
"like",
"Unix",
"."
] | def FullName(self):
"""Make Windows paths like Unix."""
return os.path.abspath(self._filename).replace('\\', '/') | [
"def",
"FullName",
"(",
"self",
")",
":",
"return",
"os",
".",
"path",
".",
"abspath",
"(",
"self",
".",
"_filename",
")",
".",
"replace",
"(",
"'\\\\'",
",",
"'/'",
")"
] | https://github.com/dicecco1/fpga_caffe/blob/7a191704efd7873071cfef35772d7e7bf3e3cfd6/scripts/cpp_lint.py#L885-L887 | |
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | caffe2/python/schema.py | python | Struct.get | (self, item, default_value) | return getattr(self, item, default_value) | similar to python's dictionary get method, return field of item if found
(i.e. self.item is valid) or otherwise return default_value
it's a syntax suger of python's builtin getattr method | similar to python's dictionary get method, return field of item if found
(i.e. self.item is valid) or otherwise return default_value | [
"similar",
"to",
"python",
"s",
"dictionary",
"get",
"method",
"return",
"field",
"of",
"item",
"if",
"found",
"(",
"i",
".",
"e",
".",
"self",
".",
"item",
"is",
"valid",
")",
"or",
"otherwise",
"return",
"default_value"
] | def get(self, item, default_value):
"""
similar to python's dictionary get method, return field of item if found
(i.e. self.item is valid) or otherwise return default_value
it's a syntax suger of python's builtin getattr method
"""
return getattr(self, item, default_valu... | [
"def",
"get",
"(",
"self",
",",
"item",
",",
"default_value",
")",
":",
"return",
"getattr",
"(",
"self",
",",
"item",
",",
"default_value",
")"
] | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/caffe2/python/schema.py#L535-L542 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/ipaddress.py | python | IPv6Address.packed | (self) | return v6_int_to_packed(self._ip) | The binary representation of this address. | The binary representation of this address. | [
"The",
"binary",
"representation",
"of",
"this",
"address",
"."
] | def packed(self):
"""The binary representation of this address."""
return v6_int_to_packed(self._ip) | [
"def",
"packed",
"(",
"self",
")",
":",
"return",
"v6_int_to_packed",
"(",
"self",
".",
"_ip",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/ipaddress.py#L1914-L1916 | |
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/contrib/factorization/python/ops/kmeans.py | python | KMeansClustering.__init__ | (self,
num_clusters,
model_dir=None,
initial_clusters=clustering_ops.RANDOM_INIT,
distance_metric=clustering_ops.SQUARED_EUCLIDEAN_DISTANCE,
random_seed=0,
use_mini_batch=True,
kmeans_plus_plus_num_retries=2,
... | Creates a model for running KMeans training and inference.
Args:
num_clusters: number of clusters to train.
model_dir: the directory to save the model results and log files.
initial_clusters: specifies how to initialize the clusters for training.
See clustering_ops.kmeans for the possible... | Creates a model for running KMeans training and inference. | [
"Creates",
"a",
"model",
"for",
"running",
"KMeans",
"training",
"and",
"inference",
"."
] | def __init__(self,
num_clusters,
model_dir=None,
initial_clusters=clustering_ops.RANDOM_INIT,
distance_metric=clustering_ops.SQUARED_EUCLIDEAN_DISTANCE,
random_seed=0,
use_mini_batch=True,
kmeans_plus_plus_num_retri... | [
"def",
"__init__",
"(",
"self",
",",
"num_clusters",
",",
"model_dir",
"=",
"None",
",",
"initial_clusters",
"=",
"clustering_ops",
".",
"RANDOM_INIT",
",",
"distance_metric",
"=",
"clustering_ops",
".",
"SQUARED_EUCLIDEAN_DISTANCE",
",",
"random_seed",
"=",
"0",
... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/contrib/factorization/python/ops/kmeans.py#L51-L89 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_controls.py | python | Slider.SetSelection | (*args, **kwargs) | return _controls_.Slider_SetSelection(*args, **kwargs) | SetSelection(self, int min, int max) | SetSelection(self, int min, int max) | [
"SetSelection",
"(",
"self",
"int",
"min",
"int",
"max",
")"
] | def SetSelection(*args, **kwargs):
"""SetSelection(self, int min, int max)"""
return _controls_.Slider_SetSelection(*args, **kwargs) | [
"def",
"SetSelection",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"Slider_SetSelection",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_controls.py#L2923-L2925 | |
Tokutek/mongo | 0653eabe2c5b9d12b4814617cb7fb2d799937a0f | src/third_party/v8/tools/stats-viewer.py | python | UiCounter.__init__ | (self, var, format) | Creates a new ui counter.
Args:
var: the Tkinter string variable for updating the ui
format: the format string used to format this counter | Creates a new ui counter. | [
"Creates",
"a",
"new",
"ui",
"counter",
"."
] | def __init__(self, var, format):
"""Creates a new ui counter.
Args:
var: the Tkinter string variable for updating the ui
format: the format string used to format this counter
"""
self.var = var
self.format = format
self.last_value = None | [
"def",
"__init__",
"(",
"self",
",",
"var",
",",
"format",
")",
":",
"self",
".",
"var",
"=",
"var",
"self",
".",
"format",
"=",
"format",
"self",
".",
"last_value",
"=",
"None"
] | https://github.com/Tokutek/mongo/blob/0653eabe2c5b9d12b4814617cb7fb2d799937a0f/src/third_party/v8/tools/stats-viewer.py#L271-L280 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_controls.py | python | HelpEvent.__init__ | (self, *args, **kwargs) | __init__(self, EventType type=wxEVT_NULL, int winid=0, Point pt=DefaultPosition,
int origin=Origin_Unknown) -> HelpEvent | __init__(self, EventType type=wxEVT_NULL, int winid=0, Point pt=DefaultPosition,
int origin=Origin_Unknown) -> HelpEvent | [
"__init__",
"(",
"self",
"EventType",
"type",
"=",
"wxEVT_NULL",
"int",
"winid",
"=",
"0",
"Point",
"pt",
"=",
"DefaultPosition",
"int",
"origin",
"=",
"Origin_Unknown",
")",
"-",
">",
"HelpEvent"
] | def __init__(self, *args, **kwargs):
"""
__init__(self, EventType type=wxEVT_NULL, int winid=0, Point pt=DefaultPosition,
int origin=Origin_Unknown) -> HelpEvent
"""
_controls_.HelpEvent_swiginit(self,_controls_.new_HelpEvent(*args, **kwargs)) | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_controls_",
".",
"HelpEvent_swiginit",
"(",
"self",
",",
"_controls_",
".",
"new_HelpEvent",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_controls.py#L6046-L6051 | ||
hszhao/PSPNet | cf7e5a99ba37e46118026e96be5821a9bc63bde0 | tools/extra/parse_log.py | python | save_csv_files | (logfile_path, output_dir, train_dict_list, test_dict_list,
delimiter=',', verbose=False) | Save CSV files to output_dir
If the input log file is, e.g., caffe.INFO, the names will be
caffe.INFO.train and caffe.INFO.test | Save CSV files to output_dir | [
"Save",
"CSV",
"files",
"to",
"output_dir"
] | def save_csv_files(logfile_path, output_dir, train_dict_list, test_dict_list,
delimiter=',', verbose=False):
"""Save CSV files to output_dir
If the input log file is, e.g., caffe.INFO, the names will be
caffe.INFO.train and caffe.INFO.test
"""
log_basename = os.path.basename(log... | [
"def",
"save_csv_files",
"(",
"logfile_path",
",",
"output_dir",
",",
"train_dict_list",
",",
"test_dict_list",
",",
"delimiter",
"=",
"','",
",",
"verbose",
"=",
"False",
")",
":",
"log_basename",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"logfile_path",
... | https://github.com/hszhao/PSPNet/blob/cf7e5a99ba37e46118026e96be5821a9bc63bde0/tools/extra/parse_log.py#L132-L145 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/setuptools/py3/setuptools/_distutils/dir_util.py | python | create_tree | (base_dir, files, mode=0o777, verbose=1, dry_run=0) | Create all the empty directories under 'base_dir' needed to put 'files'
there.
'base_dir' is just the name of a directory which doesn't necessarily
exist yet; 'files' is a list of filenames to be interpreted relative to
'base_dir'. 'base_dir' + the directory portion of every file in 'files'
will b... | Create all the empty directories under 'base_dir' needed to put 'files'
there. | [
"Create",
"all",
"the",
"empty",
"directories",
"under",
"base_dir",
"needed",
"to",
"put",
"files",
"there",
"."
] | def create_tree(base_dir, files, mode=0o777, verbose=1, dry_run=0):
"""Create all the empty directories under 'base_dir' needed to put 'files'
there.
'base_dir' is just the name of a directory which doesn't necessarily
exist yet; 'files' is a list of filenames to be interpreted relative to
'base_di... | [
"def",
"create_tree",
"(",
"base_dir",
",",
"files",
",",
"mode",
"=",
"0o777",
",",
"verbose",
"=",
"1",
",",
"dry_run",
"=",
"0",
")",
":",
"# First get the list of directories to create",
"need_dir",
"=",
"set",
"(",
")",
"for",
"file",
"in",
"files",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/setuptools/py3/setuptools/_distutils/dir_util.py#L80-L97 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/idlelib/configHandler.py | python | IdleConfParser.Get | (self, section, option, type=None, default=None, raw=False) | Get an option value for given section/option or return default.
If type is specified, return as type. | Get an option value for given section/option or return default.
If type is specified, return as type. | [
"Get",
"an",
"option",
"value",
"for",
"given",
"section",
"/",
"option",
"or",
"return",
"default",
".",
"If",
"type",
"is",
"specified",
"return",
"as",
"type",
"."
] | def Get(self, section, option, type=None, default=None, raw=False):
"""
Get an option value for given section/option or return default.
If type is specified, return as type.
"""
if not self.has_option(section, option):
return default
if type=='bool':
... | [
"def",
"Get",
"(",
"self",
",",
"section",
",",
"option",
",",
"type",
"=",
"None",
",",
"default",
"=",
"None",
",",
"raw",
"=",
"False",
")",
":",
"if",
"not",
"self",
".",
"has_option",
"(",
"section",
",",
"option",
")",
":",
"return",
"default... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/idlelib/configHandler.py#L42-L54 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/dataview.py | python | DataViewModel.IsContainer | (*args, **kwargs) | return _dataview.DataViewModel_IsContainer(*args, **kwargs) | IsContainer(self, DataViewItem item) -> bool
Override this to indicate whether an item is a container, in other
words, if it is a parent item that can have children. | IsContainer(self, DataViewItem item) -> bool | [
"IsContainer",
"(",
"self",
"DataViewItem",
"item",
")",
"-",
">",
"bool"
] | def IsContainer(*args, **kwargs):
"""
IsContainer(self, DataViewItem item) -> bool
Override this to indicate whether an item is a container, in other
words, if it is a parent item that can have children.
"""
return _dataview.DataViewModel_IsContainer(*args, **kwargs) | [
"def",
"IsContainer",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_dataview",
".",
"DataViewModel_IsContainer",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/dataview.py#L537-L544 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/getpass.py | python | unix_getpass | (prompt='Password: ', stream=None) | Prompt for a password, with echo turned off.
Args:
prompt: Written on stream to ask for the input. Default: 'Password: '
stream: A writable file object to display the prompt. Defaults to
the tty. If no tty is available defaults to sys.stderr.
Returns:
The seKr3t input.
Ra... | Prompt for a password, with echo turned off. | [
"Prompt",
"for",
"a",
"password",
"with",
"echo",
"turned",
"off",
"."
] | def unix_getpass(prompt='Password: ', stream=None):
"""Prompt for a password, with echo turned off.
Args:
prompt: Written on stream to ask for the input. Default: 'Password: '
stream: A writable file object to display the prompt. Defaults to
the tty. If no tty is available defaults... | [
"def",
"unix_getpass",
"(",
"prompt",
"=",
"'Password: '",
",",
"stream",
"=",
"None",
")",
":",
"passwd",
"=",
"None",
"with",
"contextlib",
".",
"ExitStack",
"(",
")",
"as",
"stack",
":",
"try",
":",
"# Always try reading and writing directly on the tty first.",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/getpass.py#L29-L94 | ||
apache/singa | 93fd9da72694e68bfe3fb29d0183a65263d238a1 | python/singa/autograd.py | python | Flatten.__init__ | (self, axis=1) | Args:
axis (int): Indicate up to which input dimensions (exclusive)
should be flattened to the outer dimension of the output. The
value for axis must be in the range [-r, r], where r is the
rank of the input tensor. Negative value means counting
... | Args:
axis (int): Indicate up to which input dimensions (exclusive)
should be flattened to the outer dimension of the output. The
value for axis must be in the range [-r, r], where r is the
rank of the input tensor. Negative value means counting
... | [
"Args",
":",
"axis",
"(",
"int",
")",
":",
"Indicate",
"up",
"to",
"which",
"input",
"dimensions",
"(",
"exclusive",
")",
"should",
"be",
"flattened",
"to",
"the",
"outer",
"dimension",
"of",
"the",
"output",
".",
"The",
"value",
"for",
"axis",
"must",
... | def __init__(self, axis=1):
"""
Args:
axis (int): Indicate up to which input dimensions (exclusive)
should be flattened to the outer dimension of the output. The
value for axis must be in the range [-r, r], where r is the
rank of the input tens... | [
"def",
"__init__",
"(",
"self",
",",
"axis",
"=",
"1",
")",
":",
"super",
"(",
"Flatten",
",",
"self",
")",
".",
"__init__",
"(",
")",
"self",
".",
"axis",
"=",
"axis"
] | https://github.com/apache/singa/blob/93fd9da72694e68bfe3fb29d0183a65263d238a1/python/singa/autograd.py#L1379-L1393 | ||
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | chrome/tools/extract_actions.py | python | AddExtensionActions | (actions) | Add actions reported by extensions via chrome.metricsPrivate API.
Arguments:
actions: set of actions to add to. | Add actions reported by extensions via chrome.metricsPrivate API. | [
"Add",
"actions",
"reported",
"by",
"extensions",
"via",
"chrome",
".",
"metricsPrivate",
"API",
"."
] | def AddExtensionActions(actions):
"""Add actions reported by extensions via chrome.metricsPrivate API.
Arguments:
actions: set of actions to add to.
"""
# Actions sent by Chrome OS File Browser.
actions.add('FileBrowser.CreateNewFolder')
actions.add('FileBrowser.PhotoEditor.Edit')
actions.add('FileBr... | [
"def",
"AddExtensionActions",
"(",
"actions",
")",
":",
"# Actions sent by Chrome OS File Browser.",
"actions",
".",
"add",
"(",
"'FileBrowser.CreateNewFolder'",
")",
"actions",
".",
"add",
"(",
"'FileBrowser.PhotoEditor.Edit'",
")",
"actions",
".",
"add",
"(",
"'FileBr... | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/chrome/tools/extract_actions.py#L226-L235 | ||
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | lts/tools/gyp/pylib/gyp/win_tool.py | python | WinTool.ExecStamp | (self, path) | Simple stamp command. | Simple stamp command. | [
"Simple",
"stamp",
"command",
"."
] | def ExecStamp(self, path):
"""Simple stamp command."""
open(path, 'w').close() | [
"def",
"ExecStamp",
"(",
"self",
",",
"path",
")",
":",
"open",
"(",
"path",
",",
"'w'",
")",
".",
"close",
"(",
")"
] | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/tools/gyp/pylib/gyp/win_tool.py#L88-L90 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/tkinter/__init__.py | python | Misc.update | (self) | Enter event loop until all pending events have been processed by Tcl. | Enter event loop until all pending events have been processed by Tcl. | [
"Enter",
"event",
"loop",
"until",
"all",
"pending",
"events",
"have",
"been",
"processed",
"by",
"Tcl",
"."
] | def update(self):
"""Enter event loop until all pending events have been processed by Tcl."""
self.tk.call('update') | [
"def",
"update",
"(",
"self",
")",
":",
"self",
".",
"tk",
".",
"call",
"(",
"'update'",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/tkinter/__init__.py#L1175-L1177 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/cookielib.py | python | time2isoz | (t=None) | return "%04d-%02d-%02d %02d:%02d:%02dZ" % (
year, mon, mday, hour, min, sec) | Return a string representing time in seconds since epoch, t.
If the function is called without an argument, it will use the current
time.
The format of the returned string is like "YYYY-MM-DD hh:mm:ssZ",
representing Universal Time (UTC, aka GMT). An example of this format is:
1994-11-24 08:49:3... | Return a string representing time in seconds since epoch, t. | [
"Return",
"a",
"string",
"representing",
"time",
"in",
"seconds",
"since",
"epoch",
"t",
"."
] | def time2isoz(t=None):
"""Return a string representing time in seconds since epoch, t.
If the function is called without an argument, it will use the current
time.
The format of the returned string is like "YYYY-MM-DD hh:mm:ssZ",
representing Universal Time (UTC, aka GMT). An example of this form... | [
"def",
"time2isoz",
"(",
"t",
"=",
"None",
")",
":",
"if",
"t",
"is",
"None",
":",
"t",
"=",
"time",
".",
"time",
"(",
")",
"year",
",",
"mon",
",",
"mday",
",",
"hour",
",",
"min",
",",
"sec",
"=",
"time",
".",
"gmtime",
"(",
"t",
")",
"["... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/cookielib.py#L86-L101 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/share/doc/python3.7/examples/Tools/demo/life.py | python | LifeBoard.erase | (self) | Clear the entire board and update the board display | Clear the entire board and update the board display | [
"Clear",
"the",
"entire",
"board",
"and",
"update",
"the",
"board",
"display"
] | def erase(self):
"""Clear the entire board and update the board display"""
self.state = {}
self.display(update_board=False) | [
"def",
"erase",
"(",
"self",
")",
":",
"self",
".",
"state",
"=",
"{",
"}",
"self",
".",
"display",
"(",
"update_board",
"=",
"False",
")"
] | 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/demo/life.py#L84-L87 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/telnetlib.py | python | Telnet.write | (self, buffer) | Write a string to the socket, doubling any IAC characters.
Can block if the connection is blocked. May raise
socket.error if the connection is closed. | Write a string to the socket, doubling any IAC characters. | [
"Write",
"a",
"string",
"to",
"the",
"socket",
"doubling",
"any",
"IAC",
"characters",
"."
] | def write(self, buffer):
"""Write a string to the socket, doubling any IAC characters.
Can block if the connection is blocked. May raise
socket.error if the connection is closed.
"""
if IAC in buffer:
buffer = buffer.replace(IAC, IAC+IAC)
self.msg("send %r"... | [
"def",
"write",
"(",
"self",
",",
"buffer",
")",
":",
"if",
"IAC",
"in",
"buffer",
":",
"buffer",
"=",
"buffer",
".",
"replace",
"(",
"IAC",
",",
"IAC",
"+",
"IAC",
")",
"self",
".",
"msg",
"(",
"\"send %r\"",
",",
"buffer",
")",
"self",
".",
"so... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/telnetlib.py#L272-L282 | ||
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | torch/package/package_exporter.py | python | PackageExporter.close | (self) | Write the package to the filesystem. Any calls after :meth:`close` are now invalid.
It is preferable to use resource guard syntax instead::
with PackageExporter("file.zip") as e:
... | Write the package to the filesystem. Any calls after :meth:`close` are now invalid.
It is preferable to use resource guard syntax instead:: | [
"Write",
"the",
"package",
"to",
"the",
"filesystem",
".",
"Any",
"calls",
"after",
":",
"meth",
":",
"close",
"are",
"now",
"invalid",
".",
"It",
"is",
"preferable",
"to",
"use",
"resource",
"guard",
"syntax",
"instead",
"::"
] | def close(self):
"""Write the package to the filesystem. Any calls after :meth:`close` are now invalid.
It is preferable to use resource guard syntax instead::
with PackageExporter("file.zip") as e:
...
"""
self._execute_dependency_graph()
self.scrip... | [
"def",
"close",
"(",
"self",
")",
":",
"self",
".",
"_execute_dependency_graph",
"(",
")",
"self",
".",
"script_module_serializer",
".",
"write_files",
"(",
")",
"self",
".",
"_finalize_zip",
"(",
")"
] | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/torch/package/package_exporter.py#L1008-L1018 | ||
rsummers11/CADLab | 976ed959a0b5208bb4173127a7ef732ac73a9b6f | lesion_detector_3DCE/rcnn/dataset/imdb.py | python | IMDB.cache_path | (self) | return cache_path | make a directory to store all caches
:return: cache path | make a directory to store all caches
:return: cache path | [
"make",
"a",
"directory",
"to",
"store",
"all",
"caches",
":",
"return",
":",
"cache",
"path"
] | def cache_path(self):
"""
make a directory to store all caches
:return: cache path
"""
cache_path = os.path.join(self.root_path, 'cache')
if not os.path.exists(cache_path):
os.mkdir(cache_path)
return cache_path | [
"def",
"cache_path",
"(",
"self",
")",
":",
"cache_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"root_path",
",",
"'cache'",
")",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"cache_path",
")",
":",
"os",
".",
"mkdir",
"(",
... | https://github.com/rsummers11/CADLab/blob/976ed959a0b5208bb4173127a7ef732ac73a9b6f/lesion_detector_3DCE/rcnn/dataset/imdb.py#L50-L58 | |
priyankchheda/algorithms | c361aa9071573fa9966d5b02d05e524815abcf2b | priority_queue/minheap.py | python | MinHeap.swim | (self, index) | swim moves element at index upward to maintain heap invariant | swim moves element at index upward to maintain heap invariant | [
"swim",
"moves",
"element",
"at",
"index",
"upward",
"to",
"maintain",
"heap",
"invariant"
] | def swim(self, index):
""" swim moves element at index upward to maintain heap invariant """
if index <= 1:
return
parent = index // 2
if self.data[parent] > self.data[index]:
self.data[parent], self.data[index] = self.data[index], self.data[parent]
s... | [
"def",
"swim",
"(",
"self",
",",
"index",
")",
":",
"if",
"index",
"<=",
"1",
":",
"return",
"parent",
"=",
"index",
"//",
"2",
"if",
"self",
".",
"data",
"[",
"parent",
"]",
">",
"self",
".",
"data",
"[",
"index",
"]",
":",
"self",
".",
"data"... | https://github.com/priyankchheda/algorithms/blob/c361aa9071573fa9966d5b02d05e524815abcf2b/priority_queue/minheap.py#L49-L57 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_windows.py | python | StatusBarPane.SetStyle | (*args, **kwargs) | return _windows_.StatusBarPane_SetStyle(*args, **kwargs) | SetStyle(self, int style) | SetStyle(self, int style) | [
"SetStyle",
"(",
"self",
"int",
"style",
")"
] | def SetStyle(*args, **kwargs):
"""SetStyle(self, int style)"""
return _windows_.StatusBarPane_SetStyle(*args, **kwargs) | [
"def",
"SetStyle",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"StatusBarPane_SetStyle",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_windows.py#L1205-L1207 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/cookielib.py | python | parse_ns_headers | (ns_headers) | return result | Ad-hoc parser for Netscape protocol cookie-attributes.
The old Netscape cookie format for Set-Cookie can for instance contain
an unquoted "," in the expires field, so we have to use this ad-hoc
parser instead of split_header_words.
XXX This may not make the best possible effort to parse all the crap
... | Ad-hoc parser for Netscape protocol cookie-attributes. | [
"Ad",
"-",
"hoc",
"parser",
"for",
"Netscape",
"protocol",
"cookie",
"-",
"attributes",
"."
] | def parse_ns_headers(ns_headers):
"""Ad-hoc parser for Netscape protocol cookie-attributes.
The old Netscape cookie format for Set-Cookie can for instance contain
an unquoted "," in the expires field, so we have to use this ad-hoc
parser instead of split_header_words.
XXX This may not make the bes... | [
"def",
"parse_ns_headers",
"(",
"ns_headers",
")",
":",
"known_attrs",
"=",
"(",
"\"expires\"",
",",
"\"domain\"",
",",
"\"path\"",
",",
"\"secure\"",
",",
"# RFC 2109 attrs (may turn up in Netscape cookies, too)",
"\"version\"",
",",
"\"port\"",
",",
"\"max-age\"",
")"... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/cookielib.py#L444-L493 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/tools/quantization/quantize_graph.py | python | GraphRewriter.should_merge_with_fake_quant_node | (self) | return top[1] == 0 and top[0].op in ["FakeQuantWithMinMaxVars"] | Should the current node merge with self.state.output_node_stack[-1]? | Should the current node merge with self.state.output_node_stack[-1]? | [
"Should",
"the",
"current",
"node",
"merge",
"with",
"self",
".",
"state",
".",
"output_node_stack",
"[",
"-",
"1",
"]",
"?"
] | def should_merge_with_fake_quant_node(self):
"""Should the current node merge with self.state.output_node_stack[-1]?"""
if not self.state.output_node_stack:
return False
top = self.state.output_node_stack[-1]
return top[1] == 0 and top[0].op in ["FakeQuantWithMinMaxVars"] | [
"def",
"should_merge_with_fake_quant_node",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"state",
".",
"output_node_stack",
":",
"return",
"False",
"top",
"=",
"self",
".",
"state",
".",
"output_node_stack",
"[",
"-",
"1",
"]",
"return",
"top",
"[",
"1... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/tools/quantization/quantize_graph.py#L554-L559 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.