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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
google/syzygy | 8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5 | third_party/numpy/files/numpy/distutils/system_info.py | python | system_info.check_libs | (self,lib_dir,libs,opt_libs =[]) | return info | If static or shared libraries are available then return
their info dictionary.
Checks for all libraries as shared libraries first, then
static (or vice versa if self.search_static_first is True). | If static or shared libraries are available then return
their info dictionary. | [
"If",
"static",
"or",
"shared",
"libraries",
"are",
"available",
"then",
"return",
"their",
"info",
"dictionary",
"."
] | def check_libs(self,lib_dir,libs,opt_libs =[]):
"""If static or shared libraries are available then return
their info dictionary.
Checks for all libraries as shared libraries first, then
static (or vice versa if self.search_static_first is True).
"""
exts = self.library_... | [
"def",
"check_libs",
"(",
"self",
",",
"lib_dir",
",",
"libs",
",",
"opt_libs",
"=",
"[",
"]",
")",
":",
"exts",
"=",
"self",
".",
"library_extensions",
"(",
")",
"info",
"=",
"None",
"for",
"ext",
"in",
"exts",
":",
"info",
"=",
"self",
".",
"_che... | https://github.com/google/syzygy/blob/8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5/third_party/numpy/files/numpy/distutils/system_info.py#L582-L597 | |
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | current/tools/inspector_protocol/jinja2/environment.py | python | Environment.get_or_select_template | (self, template_name_or_list,
parent=None, globals=None) | return self.select_template(template_name_or_list, parent, globals) | Does a typecheck and dispatches to :meth:`select_template`
if an iterable of template names is given, otherwise to
:meth:`get_template`.
.. versionadded:: 2.3 | Does a typecheck and dispatches to :meth:`select_template`
if an iterable of template names is given, otherwise to
:meth:`get_template`. | [
"Does",
"a",
"typecheck",
"and",
"dispatches",
"to",
":",
"meth",
":",
"select_template",
"if",
"an",
"iterable",
"of",
"template",
"names",
"is",
"given",
"otherwise",
"to",
":",
"meth",
":",
"get_template",
"."
] | def get_or_select_template(self, template_name_or_list,
parent=None, globals=None):
"""Does a typecheck and dispatches to :meth:`select_template`
if an iterable of template names is given, otherwise to
:meth:`get_template`.
.. versionadded:: 2.3
""... | [
"def",
"get_or_select_template",
"(",
"self",
",",
"template_name_or_list",
",",
"parent",
"=",
"None",
",",
"globals",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"template_name_or_list",
",",
"string_types",
")",
":",
"return",
"self",
".",
"get_template",... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/current/tools/inspector_protocol/jinja2/environment.py#L860-L872 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_misc.py | python | DateTime.__gt__ | (*args, **kwargs) | return _misc_.DateTime___gt__(*args, **kwargs) | __gt__(self, DateTime other) -> bool | __gt__(self, DateTime other) -> bool | [
"__gt__",
"(",
"self",
"DateTime",
"other",
")",
"-",
">",
"bool"
] | def __gt__(*args, **kwargs):
"""__gt__(self, DateTime other) -> bool"""
return _misc_.DateTime___gt__(*args, **kwargs) | [
"def",
"__gt__",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"DateTime___gt__",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_misc.py#L4114-L4116 | |
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/python/ops/array_ops.py | python | _EditDistanceShape | (op) | return [tensor_shape.unknown_shape()] | Shape function for the EditDistance op. | Shape function for the EditDistance op. | [
"Shape",
"function",
"for",
"the",
"EditDistance",
"op",
"."
] | def _EditDistanceShape(op):
"""Shape function for the EditDistance op."""
hypothesis_shape = tensor_util.constant_value(op.inputs[2])
truth_shape = tensor_util.constant_value(op.inputs[5])
if hypothesis_shape is not None and truth_shape is not None:
if len(hypothesis_shape) != len(truth_shape):
raise ... | [
"def",
"_EditDistanceShape",
"(",
"op",
")",
":",
"hypothesis_shape",
"=",
"tensor_util",
".",
"constant_value",
"(",
"op",
".",
"inputs",
"[",
"2",
"]",
")",
"truth_shape",
"=",
"tensor_util",
".",
"constant_value",
"(",
"op",
".",
"inputs",
"[",
"5",
"]"... | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/python/ops/array_ops.py#L2225-L2237 | |
cinder/Cinder | e83f5bb9c01a63eec20168d02953a0879e5100f7 | docs/libs/bs4/builder/_lxml.py | python | LXMLTreeBuilder.test_fragment_to_document | (self, fragment) | return u'<html><body>%s</body></html>' % fragment | See `TreeBuilder`. | See `TreeBuilder`. | [
"See",
"TreeBuilder",
"."
] | def test_fragment_to_document(self, fragment):
"""See `TreeBuilder`."""
return u'<html><body>%s</body></html>' % fragment | [
"def",
"test_fragment_to_document",
"(",
"self",
",",
"fragment",
")",
":",
"return",
"u'<html><body>%s</body></html>'",
"%",
"fragment"
] | https://github.com/cinder/Cinder/blob/e83f5bb9c01a63eec20168d02953a0879e5100f7/docs/libs/bs4/builder/_lxml.py#L231-L233 | |
Harick1/caffe-yolo | eea92bf3ddfe4d0ff6b0b3ba9b15c029a83ed9a3 | python/caffe/draw.py | python | get_layer_label | (layer, rankdir) | return node_label | Define node label based on layer type.
Parameters
----------
layer : ?
rankdir : {'LR', 'TB', 'BT'}
Direction of graph layout.
Returns
-------
string :
A label for the current layer | Define node label based on layer type. | [
"Define",
"node",
"label",
"based",
"on",
"layer",
"type",
"."
] | def get_layer_label(layer, rankdir):
"""Define node label based on layer type.
Parameters
----------
layer : ?
rankdir : {'LR', 'TB', 'BT'}
Direction of graph layout.
Returns
-------
string :
A label for the current layer
"""
if rankdir in ('TB', 'BT'):
... | [
"def",
"get_layer_label",
"(",
"layer",
",",
"rankdir",
")",
":",
"if",
"rankdir",
"in",
"(",
"'TB'",
",",
"'BT'",
")",
":",
"# If graph orientation is vertical, horizontal space is free and",
"# vertical space is not; separate words with spaces",
"separator",
"=",
"' '",
... | https://github.com/Harick1/caffe-yolo/blob/eea92bf3ddfe4d0ff6b0b3ba9b15c029a83ed9a3/python/caffe/draw.py#L62-L114 | |
JarveeLee/SynthText_Chinese_version | 4b2cbc7d14741f21d0bb17966a339ab3574b09a8 | synthgen.py | python | viz_masks | (fignum,rgb,seg,depth,label) | img,depth,seg are images of the same size.
visualizes depth masks for top NOBJ objects. | img,depth,seg are images of the same size.
visualizes depth masks for top NOBJ objects. | [
"img",
"depth",
"seg",
"are",
"images",
"of",
"the",
"same",
"size",
".",
"visualizes",
"depth",
"masks",
"for",
"top",
"NOBJ",
"objects",
"."
] | def viz_masks(fignum,rgb,seg,depth,label):
"""
img,depth,seg are images of the same size.
visualizes depth masks for top NOBJ objects.
"""
def mean_seg(rgb,seg,label):
mim = np.zeros_like(rgb)
for i in np.unique(seg.flat):
mask = seg==i
col = np.mean(rgb[mask,... | [
"def",
"viz_masks",
"(",
"fignum",
",",
"rgb",
",",
"seg",
",",
"depth",
",",
"label",
")",
":",
"def",
"mean_seg",
"(",
"rgb",
",",
"seg",
",",
"label",
")",
":",
"mim",
"=",
"np",
".",
"zeros_like",
"(",
"rgb",
")",
"for",
"i",
"in",
"np",
".... | https://github.com/JarveeLee/SynthText_Chinese_version/blob/4b2cbc7d14741f21d0bb17966a339ab3574b09a8/synthgen.py#L290-L325 | ||
OGRECave/ogre-next | 287307980e6de8910f04f3cc0994451b075071fd | Tools/Wings3DExporter/mesh.py | python | Mesh.triangulate | (self) | triangulate polygons | triangulate polygons | [
"triangulate",
"polygons"
] | def triangulate(self):
"triangulate polygons"
print "tesselating..."
self.gltris = []
self.tri_materials = []
for i in range(len(self.glfaces)):
face = self.glfaces[i]
mat = self.face_materials[i]
if len(face) == 3:
self.gltris.append(face)
self.tri_materials.append(mat)
else:
verts ... | [
"def",
"triangulate",
"(",
"self",
")",
":",
"print",
"\"tesselating...\"",
"self",
".",
"gltris",
"=",
"[",
"]",
"self",
".",
"tri_materials",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"self",
".",
"glfaces",
")",
")",
":",
"face",
... | https://github.com/OGRECave/ogre-next/blob/287307980e6de8910f04f3cc0994451b075071fd/Tools/Wings3DExporter/mesh.py#L332-L354 | ||
olliw42/storm32bgc | 99d62a6130ae2950514022f50eb669c45a8cc1ba | old/betacopter/old/betacopter36dev-v005/modules/uavcan/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/pyratemp.py | python | TemplateParseError.__init__ | (self, err, errpos) | :Parameters:
- `err`: error-message or exception to wrap
- `errpos`: ``(filename,row,col)`` where the error occured. | :Parameters:
- `err`: error-message or exception to wrap
- `errpos`: ``(filename,row,col)`` where the error occured. | [
":",
"Parameters",
":",
"-",
"err",
":",
"error",
"-",
"message",
"or",
"exception",
"to",
"wrap",
"-",
"errpos",
":",
"(",
"filename",
"row",
"col",
")",
"where",
"the",
"error",
"occured",
"."
] | def __init__(self, err, errpos):
"""
:Parameters:
- `err`: error-message or exception to wrap
- `errpos`: ``(filename,row,col)`` where the error occured.
"""
self.err = err
self.filename, self.row, self.col = errpos
TemplateException.__init__(se... | [
"def",
"__init__",
"(",
"self",
",",
"err",
",",
"errpos",
")",
":",
"self",
".",
"err",
"=",
"err",
"self",
".",
"filename",
",",
"self",
".",
"row",
",",
"self",
".",
"col",
"=",
"errpos",
"TemplateException",
".",
"__init__",
"(",
"self",
")"
] | https://github.com/olliw42/storm32bgc/blob/99d62a6130ae2950514022f50eb669c45a8cc1ba/old/betacopter/old/betacopter36dev-v005/modules/uavcan/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/pyratemp.py#L338-L346 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/training/basic_session_run_hooks.py | python | FinalOpsHook.__init__ | (self, final_ops, final_ops_feed_dict=None) | Initializes `FinalOpHook` with ops to run at the end of the session.
Args:
final_ops: A single `Tensor`, a list of `Tensors` or a dictionary of
names to `Tensors`.
final_ops_feed_dict: A feed dictionary to use when running
`final_ops_dict`. | Initializes `FinalOpHook` with ops to run at the end of the session. | [
"Initializes",
"FinalOpHook",
"with",
"ops",
"to",
"run",
"at",
"the",
"end",
"of",
"the",
"session",
"."
] | def __init__(self, final_ops, final_ops_feed_dict=None):
"""Initializes `FinalOpHook` with ops to run at the end of the session.
Args:
final_ops: A single `Tensor`, a list of `Tensors` or a dictionary of
names to `Tensors`.
final_ops_feed_dict: A feed dictionary to use when running
... | [
"def",
"__init__",
"(",
"self",
",",
"final_ops",
",",
"final_ops_feed_dict",
"=",
"None",
")",
":",
"self",
".",
"_final_ops",
"=",
"final_ops",
"self",
".",
"_final_ops_feed_dict",
"=",
"final_ops_feed_dict",
"self",
".",
"_final_ops_values",
"=",
"None"
] | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/training/basic_session_run_hooks.py#L713-L724 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/array_ops.py | python | size_v2 | (input, out_type=dtypes.int32, name=None) | return size(input, name, out_type) | Returns the size of a tensor.
See also `tf.shape`.
Returns a 0-D `Tensor` representing the number of elements in `input`
of type `out_type`. Defaults to tf.int32.
For example:
>>> t = tf.constant([[[1, 1, 1], [2, 2, 2]], [[3, 3, 3], [4, 4, 4]]])
>>> tf.size(t)
<tf.Tensor: shape=(), dtype=int32, numpy=... | Returns the size of a tensor. | [
"Returns",
"the",
"size",
"of",
"a",
"tensor",
"."
] | def size_v2(input, out_type=dtypes.int32, name=None):
# pylint: disable=redefined-builtin
"""Returns the size of a tensor.
See also `tf.shape`.
Returns a 0-D `Tensor` representing the number of elements in `input`
of type `out_type`. Defaults to tf.int32.
For example:
>>> t = tf.constant([[[1, 1, 1], ... | [
"def",
"size_v2",
"(",
"input",
",",
"out_type",
"=",
"dtypes",
".",
"int32",
",",
"name",
"=",
"None",
")",
":",
"# pylint: disable=redefined-builtin",
"return",
"size",
"(",
"input",
",",
"name",
",",
"out_type",
")"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/array_ops.py#L723-L752 | |
apple/swift | 469f72fdae2ea828b3b6c0d7d62d7e4cf98c4893 | utils/swift_build_support/swift_build_support/build_script_invocation.py | python | BuildScriptInvocation.compute_host_specific_variables | (self) | return options | compute_host_specific_variables(args) -> dict
Compute the host-specific options, organized as a dictionary keyed by
host of options. | compute_host_specific_variables(args) -> dict | [
"compute_host_specific_variables",
"(",
"args",
")",
"-",
">",
"dict"
] | def compute_host_specific_variables(self):
"""compute_host_specific_variables(args) -> dict
Compute the host-specific options, organized as a dictionary keyed by
host of options.
"""
args = self.args
args.build_root = self.workspace.build_root
options = {}
... | [
"def",
"compute_host_specific_variables",
"(",
"self",
")",
":",
"args",
"=",
"self",
".",
"args",
"args",
".",
"build_root",
"=",
"self",
".",
"workspace",
".",
"build_root",
"options",
"=",
"{",
"}",
"for",
"host_target",
"in",
"[",
"args",
".",
"host_ta... | https://github.com/apple/swift/blob/469f72fdae2ea828b3b6c0d7d62d7e4cf98c4893/utils/swift_build_support/swift_build_support/build_script_invocation.py#L482-L516 | |
wesnoth/wesnoth | 6ccac5a5e8ff75303c9190c0da60580925cb32c0 | data/tools/wesnoth/wmltools3.py | python | directory_namespace | (path) | Go from directory to namespace. | Go from directory to namespace. | [
"Go",
"from",
"directory",
"to",
"namespace",
"."
] | def directory_namespace(path):
"Go from directory to namespace."
if path.startswith("data/core/"):
return "core"
elif path.startswith("data/campaigns/"):
return path.split("/")[2]
else:
return None | [
"def",
"directory_namespace",
"(",
"path",
")",
":",
"if",
"path",
".",
"startswith",
"(",
"\"data/core/\"",
")",
":",
"return",
"\"core\"",
"elif",
"path",
".",
"startswith",
"(",
"\"data/campaigns/\"",
")",
":",
"return",
"path",
".",
"split",
"(",
"\"/\""... | https://github.com/wesnoth/wesnoth/blob/6ccac5a5e8ff75303c9190c0da60580925cb32c0/data/tools/wesnoth/wmltools3.py#L1086-L1093 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/ipython/py2/IPython/core/display.py | python | DisplayHandle.update | (self, obj, **kwargs) | Update existing displays with my id
Parameters
----------
obj:
object to display
**kwargs:
additional keyword arguments passed to update_display | Update existing displays with my id
Parameters
----------
obj:
object to display
**kwargs:
additional keyword arguments passed to update_display | [
"Update",
"existing",
"displays",
"with",
"my",
"id",
"Parameters",
"----------",
"obj",
":",
"object",
"to",
"display",
"**",
"kwargs",
":",
"additional",
"keyword",
"arguments",
"passed",
"to",
"update_display"
] | def update(self, obj, **kwargs):
"""Update existing displays with my id
Parameters
----------
obj:
object to display
**kwargs:
additional keyword arguments passed to update_display
"""
update_display(obj, display_id=self.d... | [
"def",
"update",
"(",
"self",
",",
"obj",
",",
"*",
"*",
"kwargs",
")",
":",
"update_display",
"(",
"obj",
",",
"display_id",
"=",
"self",
".",
"display_id",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py2/IPython/core/display.py#L384-L395 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/pickle.py | python | decode_long | (data) | return int.from_bytes(data, byteorder='little', signed=True) | r"""Decode a long from a two's complement little-endian binary string.
>>> decode_long(b'')
0
>>> decode_long(b"\xff\x00")
255
>>> decode_long(b"\xff\x7f")
32767
>>> decode_long(b"\x00\xff")
-256
>>> decode_long(b"\x00\x80")
-32768
>>> decode_long(b"\x80")
-128
>>> d... | r"""Decode a long from a two's complement little-endian binary string. | [
"r",
"Decode",
"a",
"long",
"from",
"a",
"two",
"s",
"complement",
"little",
"-",
"endian",
"binary",
"string",
"."
] | def decode_long(data):
r"""Decode a long from a two's complement little-endian binary string.
>>> decode_long(b'')
0
>>> decode_long(b"\xff\x00")
255
>>> decode_long(b"\xff\x7f")
32767
>>> decode_long(b"\x00\xff")
-256
>>> decode_long(b"\x00\x80")
-32768
>>> decode_long(... | [
"def",
"decode_long",
"(",
"data",
")",
":",
"return",
"int",
".",
"from_bytes",
"(",
"data",
",",
"byteorder",
"=",
"'little'",
",",
"signed",
"=",
"True",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/pickle.py#L349-L367 | |
pyne/pyne | 0c2714d7c0d1b5e20be6ae6527da2c660dd6b1b3 | pyne/xs/data_source.py | python | DataSource.shield_weights | (self, num_dens, temp) | Builds the weights used during the self shielding calculations.
Parameters
----------
mat : array of floats.
A map of the number densities of each of the nuclides of the material for
which self-shielding is being calculated.
data_source: pyne data_source
... | Builds the weights used during the self shielding calculations.
Parameters
----------
mat : array of floats.
A map of the number densities of each of the nuclides of the material for
which self-shielding is being calculated.
data_source: pyne data_source
... | [
"Builds",
"the",
"weights",
"used",
"during",
"the",
"self",
"shielding",
"calculations",
".",
"Parameters",
"----------",
"mat",
":",
"array",
"of",
"floats",
".",
"A",
"map",
"of",
"the",
"number",
"densities",
"of",
"each",
"of",
"the",
"nuclides",
"of",
... | def shield_weights(self, num_dens, temp):
"""Builds the weights used during the self shielding calculations.
Parameters
----------
mat : array of floats.
A map of the number densities of each of the nuclides of the material for
which self-shielding is being ca... | [
"def",
"shield_weights",
"(",
"self",
",",
"num_dens",
",",
"temp",
")",
":",
"reactions",
"=",
"{",
"}",
"for",
"i",
"in",
"num_dens",
":",
"rx",
"=",
"self",
".",
"reaction",
"(",
"i",
",",
"'total'",
",",
"temp",
")",
"reactions",
"[",
"i",
"]",... | https://github.com/pyne/pyne/blob/0c2714d7c0d1b5e20be6ae6527da2c660dd6b1b3/pyne/xs/data_source.py#L227-L249 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/AWSPythonSDK/1.5.8/boto3/__init__.py | python | resource | (*args, **kwargs) | return _get_default_session().resource(*args, **kwargs) | Create a resource service client by name using the default session.
See :py:meth:`boto3.session.Session.resource`. | Create a resource service client by name using the default session. | [
"Create",
"a",
"resource",
"service",
"client",
"by",
"name",
"using",
"the",
"default",
"session",
"."
] | def resource(*args, **kwargs):
"""
Create a resource service client by name using the default session.
See :py:meth:`boto3.session.Session.resource`.
"""
return _get_default_session().resource(*args, **kwargs) | [
"def",
"resource",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_get_default_session",
"(",
")",
".",
"resource",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/boto3/__init__.py#L86-L92 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/telemetry/third_party/altgraph/altgraph/GraphAlgo.py | python | _priorityDictionary.__setitem__ | (self,key,val) | Change value stored in dictionary and add corresponding pair to heap.
Rebuilds the heap if the number of deleted items gets large, to avoid memory leakage. | Change value stored in dictionary and add corresponding pair to heap.
Rebuilds the heap if the number of deleted items gets large, to avoid memory leakage. | [
"Change",
"value",
"stored",
"in",
"dictionary",
"and",
"add",
"corresponding",
"pair",
"to",
"heap",
".",
"Rebuilds",
"the",
"heap",
"if",
"the",
"number",
"of",
"deleted",
"items",
"gets",
"large",
"to",
"avoid",
"memory",
"leakage",
"."
] | def __setitem__(self,key,val):
'''
Change value stored in dictionary and add corresponding pair to heap.
Rebuilds the heap if the number of deleted items gets large, to avoid memory leakage.
'''
dict.__setitem__(self,key,val)
heap = self.__heap
if len(heap) > 2 * ... | [
"def",
"__setitem__",
"(",
"self",
",",
"key",
",",
"val",
")",
":",
"dict",
".",
"__setitem__",
"(",
"self",
",",
"key",
",",
"val",
")",
"heap",
"=",
"self",
".",
"__heap",
"if",
"len",
"(",
"heap",
")",
">",
"2",
"*",
"len",
"(",
"self",
")"... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/third_party/altgraph/altgraph/GraphAlgo.py#L122-L139 | ||
Chia-Network/bls-signatures | a61089d653fa3653ac94452c73e97efcd461bdf2 | python-impl/ec.py | python | scalar_mult_jacobian | (c, p1: JacobianPoint, ec=default_ec, FE=Fq) | return result | Double and add, see
https://en.wikipedia.org/wiki/Elliptic_curve_point_multiplication | Double and add, see
https://en.wikipedia.org/wiki/Elliptic_curve_point_multiplication | [
"Double",
"and",
"add",
"see",
"https",
":",
"//",
"en",
".",
"wikipedia",
".",
"org",
"/",
"wiki",
"/",
"Elliptic_curve_point_multiplication"
] | def scalar_mult_jacobian(c, p1: JacobianPoint, ec=default_ec, FE=Fq) -> JacobianPoint:
"""
Double and add, see
https://en.wikipedia.org/wiki/Elliptic_curve_point_multiplication
"""
if isinstance(c, FE):
c = c.value
if p1.infinity or c % ec.q == 0:
return JacobianPoint(FE.one(ec.q... | [
"def",
"scalar_mult_jacobian",
"(",
"c",
",",
"p1",
":",
"JacobianPoint",
",",
"ec",
"=",
"default_ec",
",",
"FE",
"=",
"Fq",
")",
"->",
"JacobianPoint",
":",
"if",
"isinstance",
"(",
"c",
",",
"FE",
")",
":",
"c",
"=",
"c",
".",
"value",
"if",
"p1... | https://github.com/Chia-Network/bls-signatures/blob/a61089d653fa3653ac94452c73e97efcd461bdf2/python-impl/ec.py#L449-L467 | |
polserver/polserver | b34a9de0e14cb16f1e0d358710a797ad4e42ebdc | lib/google-benchmark/tools/gbench/util.py | python | check_input_file | (filename) | return ftype | Classify the file named by 'filename' and return the classification.
If the file is classified as 'IT_Invalid' print an error message and exit
the program. | Classify the file named by 'filename' and return the classification.
If the file is classified as 'IT_Invalid' print an error message and exit
the program. | [
"Classify",
"the",
"file",
"named",
"by",
"filename",
"and",
"return",
"the",
"classification",
".",
"If",
"the",
"file",
"is",
"classified",
"as",
"IT_Invalid",
"print",
"an",
"error",
"message",
"and",
"exit",
"the",
"program",
"."
] | def check_input_file(filename):
"""
Classify the file named by 'filename' and return the classification.
If the file is classified as 'IT_Invalid' print an error message and exit
the program.
"""
ftype, msg = classify_input_file(filename)
if ftype == IT_Invalid:
print "Invalid input ... | [
"def",
"check_input_file",
"(",
"filename",
")",
":",
"ftype",
",",
"msg",
"=",
"classify_input_file",
"(",
"filename",
")",
"if",
"ftype",
"==",
"IT_Invalid",
":",
"print",
"\"Invalid input file: %s\"",
"%",
"msg",
"sys",
".",
"exit",
"(",
"1",
")",
"return... | https://github.com/polserver/polserver/blob/b34a9de0e14cb16f1e0d358710a797ad4e42ebdc/lib/google-benchmark/tools/gbench/util.py#L75-L85 | |
google/llvm-propeller | 45c226984fe8377ebfb2ad7713c680d652ba678d | clang/utils/check_cfc/check_cfc.py | python | flip_dash_g | (args) | Search for -g in args. If it exists then return args without. If not then
add it. | Search for -g in args. If it exists then return args without. If not then
add it. | [
"Search",
"for",
"-",
"g",
"in",
"args",
".",
"If",
"it",
"exists",
"then",
"return",
"args",
"without",
".",
"If",
"not",
"then",
"add",
"it",
"."
] | def flip_dash_g(args):
"""Search for -g in args. If it exists then return args without. If not then
add it."""
if '-g' in args:
# Return args without any -g
return [x for x in args if x != '-g']
else:
# No -g, add one
return args + ['-g'] | [
"def",
"flip_dash_g",
"(",
"args",
")",
":",
"if",
"'-g'",
"in",
"args",
":",
"# Return args without any -g",
"return",
"[",
"x",
"for",
"x",
"in",
"args",
"if",
"x",
"!=",
"'-g'",
"]",
"else",
":",
"# No -g, add one",
"return",
"args",
"+",
"[",
"'-g'",... | https://github.com/google/llvm-propeller/blob/45c226984fe8377ebfb2ad7713c680d652ba678d/clang/utils/check_cfc/check_cfc.py#L111-L119 | ||
TGAC/KAT | e8870331de2b4bb0a1b3b91c6afb8fb9d59e9216 | deps/boost/tools/build/src/build/build_request.py | python | __x_product_aux | (property_sets, seen_features) | Returns non-conflicting combinations of property sets.
property_sets is a list of PropertySet instances. seen_features is a set of Property
instances.
Returns a tuple of:
- list of lists of Property instances, such that within each list, no two Property instance
have the same feature, and no Prope... | Returns non-conflicting combinations of property sets. | [
"Returns",
"non",
"-",
"conflicting",
"combinations",
"of",
"property",
"sets",
"."
] | def __x_product_aux (property_sets, seen_features):
"""Returns non-conflicting combinations of property sets.
property_sets is a list of PropertySet instances. seen_features is a set of Property
instances.
Returns a tuple of:
- list of lists of Property instances, such that within each list, no tw... | [
"def",
"__x_product_aux",
"(",
"property_sets",
",",
"seen_features",
")",
":",
"assert",
"is_iterable_typed",
"(",
"property_sets",
",",
"property_set",
".",
"PropertySet",
")",
"assert",
"isinstance",
"(",
"seen_features",
",",
"set",
")",
"if",
"not",
"property... | https://github.com/TGAC/KAT/blob/e8870331de2b4bb0a1b3b91c6afb8fb9d59e9216/deps/boost/tools/build/src/build/build_request.py#L39-L91 | ||
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | buildscripts/idl/idl/errors.py | python | ParserErrorCollection.__init__ | (self) | Initialize ParserErrorCollection. | Initialize ParserErrorCollection. | [
"Initialize",
"ParserErrorCollection",
"."
] | def __init__(self):
# type: () -> None
"""Initialize ParserErrorCollection."""
self._errors = [] | [
"def",
"__init__",
"(",
"self",
")",
":",
"# type: () -> None",
"self",
".",
"_errors",
"=",
"[",
"]"
] | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/idl/idl/errors.py#L175-L178 | ||
y123456yz/reading-and-annotate-mongodb-3.6 | 93280293672ca7586dc24af18132aa61e4ed7fcf | mongo/buildscripts/buildlogger.py | python | run_and_echo | (command) | return proc.returncode | this just calls the command, and returns its return code,
allowing stdout and stderr to work as normal. it is used
as a fallback when environment variables or python
dependencies cannot be configured, or when the logging
webapp is unavailable, etc | this just calls the command, and returns its return code,
allowing stdout and stderr to work as normal. it is used
as a fallback when environment variables or python
dependencies cannot be configured, or when the logging
webapp is unavailable, etc | [
"this",
"just",
"calls",
"the",
"command",
"and",
"returns",
"its",
"return",
"code",
"allowing",
"stdout",
"and",
"stderr",
"to",
"work",
"as",
"normal",
".",
"it",
"is",
"used",
"as",
"a",
"fallback",
"when",
"environment",
"variables",
"or",
"python",
"... | def run_and_echo(command):
"""
this just calls the command, and returns its return code,
allowing stdout and stderr to work as normal. it is used
as a fallback when environment variables or python
dependencies cannot be configured, or when the logging
webapp is unavailable, etc
"""
proc ... | [
"def",
"run_and_echo",
"(",
"command",
")",
":",
"proc",
"=",
"subprocess",
".",
"Popen",
"(",
"command",
")",
"# We write the pid of the spawned process as the first line of buildlogger.py's stdout because",
"# smoke.py expects to use it to terminate processes individually if already ... | https://github.com/y123456yz/reading-and-annotate-mongodb-3.6/blob/93280293672ca7586dc24af18132aa61e4ed7fcf/mongo/buildscripts/buildlogger.py#L215-L241 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/graphy/graphy/backends/google_chart_api/encoders.py | python | BarChartEncoder.__init__ | (self, chart, style=None) | Construct a new BarChartEncoder.
Args:
style: DEPRECATED. Set style on the chart object itself. | Construct a new BarChartEncoder. | [
"Construct",
"a",
"new",
"BarChartEncoder",
"."
] | def __init__(self, chart, style=None):
"""Construct a new BarChartEncoder.
Args:
style: DEPRECATED. Set style on the chart object itself.
"""
super(BarChartEncoder, self).__init__(chart)
if style is not None:
warnings.warn(self.__STYLE_DEPRECATION, DeprecationWarning, stacklevel=2)
... | [
"def",
"__init__",
"(",
"self",
",",
"chart",
",",
"style",
"=",
"None",
")",
":",
"super",
"(",
"BarChartEncoder",
",",
"self",
")",
".",
"__init__",
"(",
"chart",
")",
"if",
"style",
"is",
"not",
"None",
":",
"warnings",
".",
"warn",
"(",
"self",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/graphy/graphy/backends/google_chart_api/encoders.py#L254-L263 | ||
facebookarchive/LogDevice | ce7726050edc49a1e15d9160e81c890736b779e2 | logdevice/ops/ldquery/py/lib.py | python | Cursor.complete | (self) | return self._result.metadata.success | Returns True if the result is not-partial due to trimming or
failures on the server side. | Returns True if the result is not-partial due to trimming or
failures on the server side. | [
"Returns",
"True",
"if",
"the",
"result",
"is",
"not",
"-",
"partial",
"due",
"to",
"trimming",
"or",
"failures",
"on",
"the",
"server",
"side",
"."
] | def complete(self):
"""
Returns True if the result is not-partial due to trimming or
failures on the server side.
"""
return self._result.metadata.success | [
"def",
"complete",
"(",
"self",
")",
":",
"return",
"self",
".",
"_result",
".",
"metadata",
".",
"success"
] | https://github.com/facebookarchive/LogDevice/blob/ce7726050edc49a1e15d9160e81c890736b779e2/logdevice/ops/ldquery/py/lib.py#L136-L141 | |
cvxpy/cvxpy | 5165b4fb750dfd237de8659383ef24b4b2e33aaf | cvxpy/problems/param_prob.py | python | ParamProb.is_mixed_integer | (self) | Is the problem mixed-integer? | Is the problem mixed-integer? | [
"Is",
"the",
"problem",
"mixed",
"-",
"integer?"
] | def is_mixed_integer(self) -> bool:
"""Is the problem mixed-integer?"""
raise NotImplementedError() | [
"def",
"is_mixed_integer",
"(",
"self",
")",
"->",
"bool",
":",
"raise",
"NotImplementedError",
"(",
")"
] | https://github.com/cvxpy/cvxpy/blob/5165b4fb750dfd237de8659383ef24b4b2e33aaf/cvxpy/problems/param_prob.py#L28-L30 | ||
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/AddonManager/AddonManager.py | python | CommandAddonManager.enable_updates | (self, number_of_updates: int) | enables the update button | enables the update button | [
"enables",
"the",
"update",
"button"
] | def enable_updates(self, number_of_updates: int) -> None:
"""enables the update button"""
if number_of_updates:
s = translate(
"AddonsInstaller", "Apply {} update(s)", "", number_of_updates
)
self.dialog.buttonUpdateAll.setText(s.format(number_of_upda... | [
"def",
"enable_updates",
"(",
"self",
",",
"number_of_updates",
":",
"int",
")",
"->",
"None",
":",
"if",
"number_of_updates",
":",
"s",
"=",
"translate",
"(",
"\"AddonsInstaller\"",
",",
"\"Apply {} update(s)\"",
",",
"\"\"",
",",
"number_of_updates",
")",
"sel... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/AddonManager/AddonManager.py#L761-L774 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/configparser.py | python | RawConfigParser._read | (self, fp, fpname) | Parse a sectioned configuration file.
Each section in a configuration file contains a header, indicated by
a name in square brackets (`[]'), plus key/value options, indicated by
`name' and `value' delimited with a specific substring (`=' or `:' by
default).
Values can span mult... | Parse a sectioned configuration file. | [
"Parse",
"a",
"sectioned",
"configuration",
"file",
"."
] | def _read(self, fp, fpname):
"""Parse a sectioned configuration file.
Each section in a configuration file contains a header, indicated by
a name in square brackets (`[]'), plus key/value options, indicated by
`name' and `value' delimited with a specific substring (`=' or `:' by
... | [
"def",
"_read",
"(",
"self",
",",
"fp",
",",
"fpname",
")",
":",
"elements_added",
"=",
"set",
"(",
")",
"cursect",
"=",
"None",
"# None, or a dictionary",
"sectname",
"=",
"None",
"optname",
"=",
"None",
"lineno",
"=",
"0",
"indent_level",
"=",
"0",
"e"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/configparser.py#L990-L1110 | ||
cms-sw/cmssw | fd9de012d503d3405420bcbeec0ec879baa57cf2 | Validation/RecoTrack/python/plotting/ntupleDataFormat.py | python | _TrackingParticleMatchAdaptor.bestMatchingTrackingParticleFromFirstHit | (self) | return TrackingParticle(self._tree, idx) | Returns best-matching TrackingParticle, even for fake tracks, or None if there is no best-matching TrackingParticle.
Best-matching is defined as the one with largest number of
hits matched to the hits of a track (>= 3) starting from the
beginning of the track. If there are many fulfilling the s... | Returns best-matching TrackingParticle, even for fake tracks, or None if there is no best-matching TrackingParticle. | [
"Returns",
"best",
"-",
"matching",
"TrackingParticle",
"even",
"for",
"fake",
"tracks",
"or",
"None",
"if",
"there",
"is",
"no",
"best",
"-",
"matching",
"TrackingParticle",
"."
] | def bestMatchingTrackingParticleFromFirstHit(self):
"""Returns best-matching TrackingParticle, even for fake tracks, or None if there is no best-matching TrackingParticle.
Best-matching is defined as the one with largest number of
hits matched to the hits of a track (>= 3) starting from the
... | [
"def",
"bestMatchingTrackingParticleFromFirstHit",
"(",
"self",
")",
":",
"idx",
"=",
"self",
".",
"bestFromFirstHitSimTrkIdx",
"(",
")",
"if",
"idx",
"<",
"0",
":",
"return",
"None",
"return",
"TrackingParticle",
"(",
"self",
".",
"_tree",
",",
"idx",
")"
] | https://github.com/cms-sw/cmssw/blob/fd9de012d503d3405420bcbeec0ec879baa57cf2/Validation/RecoTrack/python/plotting/ntupleDataFormat.py#L350-L362 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/setuptools/py2/setuptools/archive_util.py | python | unpack_directory | (filename, extract_dir, progress_filter=default_filter) | Unpack" a directory, using the same interface as for archives
Raises ``UnrecognizedFormat`` if `filename` is not a directory | Unpack" a directory, using the same interface as for archives | [
"Unpack",
"a",
"directory",
"using",
"the",
"same",
"interface",
"as",
"for",
"archives"
] | def unpack_directory(filename, extract_dir, progress_filter=default_filter):
""""Unpack" a directory, using the same interface as for archives
Raises ``UnrecognizedFormat`` if `filename` is not a directory
"""
if not os.path.isdir(filename):
raise UnrecognizedFormat("%s is not a directory" % fi... | [
"def",
"unpack_directory",
"(",
"filename",
",",
"extract_dir",
",",
"progress_filter",
"=",
"default_filter",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"filename",
")",
":",
"raise",
"UnrecognizedFormat",
"(",
"\"%s is not a directory\"",
"%"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/setuptools/py2/setuptools/archive_util.py#L63-L87 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/fitting_widgets/general_fitting/general_fitting_presenter.py | python | GeneralFittingPresenter.handle_fitting_mode_changed | (self) | Handle when the fitting mode is changed to or from simultaneous fitting. | Handle when the fitting mode is changed to or from simultaneous fitting. | [
"Handle",
"when",
"the",
"fitting",
"mode",
"is",
"changed",
"to",
"or",
"from",
"simultaneous",
"fitting",
"."
] | def handle_fitting_mode_changed(self) -> None:
"""Handle when the fitting mode is changed to or from simultaneous fitting."""
self.model.simultaneous_fitting_mode = self.view.simultaneous_fitting_mode
self.switch_fitting_mode_in_view()
self.update_fit_functions_in_model_from_view()
... | [
"def",
"handle_fitting_mode_changed",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"model",
".",
"simultaneous_fitting_mode",
"=",
"self",
".",
"view",
".",
"simultaneous_fitting_mode",
"self",
".",
"switch_fitting_mode_in_view",
"(",
")",
"self",
".",
"updat... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/fitting_widgets/general_fitting/general_fitting_presenter.py#L42-L58 | ||
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/ops/composite/multitype_ops/div_impl.py | python | _tensor_div_tuple | (x, y) | return F.tensor_div(x, y) | Tensor divided by tuple.
Args:
x (Tensor): x
y (Tuple): The dtype is same as x.
Returns:
Tensor, has the same dtype as x. | Tensor divided by tuple. | [
"Tensor",
"divided",
"by",
"tuple",
"."
] | def _tensor_div_tuple(x, y):
"""
Tensor divided by tuple.
Args:
x (Tensor): x
y (Tuple): The dtype is same as x.
Returns:
Tensor, has the same dtype as x.
"""
y = utils.sequence_to_tensor(y, x.dtype)
return F.tensor_div(x, y) | [
"def",
"_tensor_div_tuple",
"(",
"x",
",",
"y",
")",
":",
"y",
"=",
"utils",
".",
"sequence_to_tensor",
"(",
"y",
",",
"x",
".",
"dtype",
")",
"return",
"F",
".",
"tensor_div",
"(",
"x",
",",
"y",
")"
] | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/ops/composite/multitype_ops/div_impl.py#L107-L119 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/eager/def_function.py | python | Function._initialize | (self, args, kwds, add_initializers_to=None) | Initializes, on the first call.
Creates two `Function`s, one that will allow creation of variables
and one that won't.
Additionally runs a trace for the `Function` that allows creation
of variables.
Args:
args: Arguments to the underlying python callable.
kwds: Keyword arguments to th... | Initializes, on the first call. | [
"Initializes",
"on",
"the",
"first",
"call",
"."
] | def _initialize(self, args, kwds, add_initializers_to=None):
"""Initializes, on the first call.
Creates two `Function`s, one that will allow creation of variables
and one that won't.
Additionally runs a trace for the `Function` that allows creation
of variables.
Args:
args: Arguments to... | [
"def",
"_initialize",
"(",
"self",
",",
"args",
",",
"kwds",
",",
"add_initializers_to",
"=",
"None",
")",
":",
"created_variables",
"=",
"[",
"]",
"lifted_initializer_graph",
"=",
"func_graph_module",
".",
"FuncGraph",
"(",
"\"initializer\"",
")",
"def",
"varia... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/eager/def_function.py#L358-L401 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/signal/_peak_finding.py | python | _select_by_peak_threshold | (x, peaks, tmin, tmax) | return keep, stacked_thresholds[0], stacked_thresholds[1] | Evaluate which peaks fulfill the threshold condition.
Parameters
----------
x : ndarray
A one-dimensional array which is indexable by `peaks`.
peaks : ndarray
Indices of peaks in `x`.
tmin, tmax : scalar or ndarray or None
Minimal and / or maximal required thresholds. If su... | Evaluate which peaks fulfill the threshold condition. | [
"Evaluate",
"which",
"peaks",
"fulfill",
"the",
"threshold",
"condition",
"."
] | def _select_by_peak_threshold(x, peaks, tmin, tmax):
"""
Evaluate which peaks fulfill the threshold condition.
Parameters
----------
x : ndarray
A one-dimensional array which is indexable by `peaks`.
peaks : ndarray
Indices of peaks in `x`.
tmin, tmax : scalar or ndarray or ... | [
"def",
"_select_by_peak_threshold",
"(",
"x",
",",
"peaks",
",",
"tmin",
",",
"tmax",
")",
":",
"# Stack thresholds on both sides to make min / max operations easier:",
"# tmin is compared with the smaller, and tmax with the greater thresold to",
"# each peak's side",
"stacked_threshol... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/signal/_peak_finding.py#L681-L723 | |
sdhash/sdhash | b9eff63e4e5867e910f41fd69032bbb1c94a2a5e | external/tools/build/v2/build/property_set.py | python | PropertySet.get | (self, feature) | return self.feature_map_.get(feature, []) | Returns all values of 'feature'. | Returns all values of 'feature'. | [
"Returns",
"all",
"values",
"of",
"feature",
"."
] | def get (self, feature):
""" Returns all values of 'feature'.
"""
if type(feature) == type([]):
feature = feature[0]
if not isinstance(feature, b2.build.feature.Feature):
feature = b2.build.feature.get(feature)
if not self.feature_map_:
... | [
"def",
"get",
"(",
"self",
",",
"feature",
")",
":",
"if",
"type",
"(",
"feature",
")",
"==",
"type",
"(",
"[",
"]",
")",
":",
"feature",
"=",
"feature",
"[",
"0",
"]",
"if",
"not",
"isinstance",
"(",
"feature",
",",
"b2",
".",
"build",
".",
"f... | https://github.com/sdhash/sdhash/blob/b9eff63e4e5867e910f41fd69032bbb1c94a2a5e/external/tools/build/v2/build/property_set.py#L416-L432 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/polynomial/hermite.py | python | _normed_hermite_n | (x, n) | return c0 + c1*x*np.sqrt(2) | Evaluate a normalized Hermite polynomial.
Compute the value of the normalized Hermite polynomial of degree ``n``
at the points ``x``.
Parameters
----------
x : ndarray of double.
Points at which to evaluate the function
n : int
Degree of the normalized Hermite function to be e... | Evaluate a normalized Hermite polynomial. | [
"Evaluate",
"a",
"normalized",
"Hermite",
"polynomial",
"."
] | def _normed_hermite_n(x, n):
"""
Evaluate a normalized Hermite polynomial.
Compute the value of the normalized Hermite polynomial of degree ``n``
at the points ``x``.
Parameters
----------
x : ndarray of double.
Points at which to evaluate the function
n : int
Degree o... | [
"def",
"_normed_hermite_n",
"(",
"x",
",",
"n",
")",
":",
"if",
"n",
"==",
"0",
":",
"return",
"np",
".",
"full",
"(",
"x",
".",
"shape",
",",
"1",
"/",
"np",
".",
"sqrt",
"(",
"np",
".",
"sqrt",
"(",
"np",
".",
"pi",
")",
")",
")",
"c0",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/polynomial/hermite.py#L1485-L1525 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/six.py | python | add_metaclass | (metaclass) | return wrapper | Class decorator for creating a class with a metaclass. | Class decorator for creating a class with a metaclass. | [
"Class",
"decorator",
"for",
"creating",
"a",
"class",
"with",
"a",
"metaclass",
"."
] | def add_metaclass(metaclass):
"""Class decorator for creating a class with a metaclass."""
def wrapper(cls):
orig_vars = cls.__dict__.copy()
slots = orig_vars.get('__slots__')
if slots is not None:
if isinstance(slots, str):
slots = [slots]
for slo... | [
"def",
"add_metaclass",
"(",
"metaclass",
")",
":",
"def",
"wrapper",
"(",
"cls",
")",
":",
"orig_vars",
"=",
"cls",
".",
"__dict__",
".",
"copy",
"(",
")",
"slots",
"=",
"orig_vars",
".",
"get",
"(",
"'__slots__'",
")",
"if",
"slots",
"is",
"not",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/six.py#L801-L814 | |
Slicer/SlicerGitSVNArchive | 65e92bb16c2b32ea47a1a66bee71f238891ee1ca | Modules/Scripted/DICOMPlugins/DICOMScalarVolumePlugin.py | python | DICOMScalarVolumePluginClass.loadFilesWithSeriesReader | (self,imageIOName,files,name) | return(volumeNode) | Explicitly use the named imageIO to perform the loading | Explicitly use the named imageIO to perform the loading | [
"Explicitly",
"use",
"the",
"named",
"imageIO",
"to",
"perform",
"the",
"loading"
] | def loadFilesWithSeriesReader(self,imageIOName,files,name):
""" Explicitly use the named imageIO to perform the loading
"""
reader = vtkITK.vtkITKArchetypeImageSeriesScalarReader()
reader.SetArchetype(files[0]);
for f in files:
reader.AddFileName(f)
reader.SetSingleFile(0);
reader.Set... | [
"def",
"loadFilesWithSeriesReader",
"(",
"self",
",",
"imageIOName",
",",
"files",
",",
"name",
")",
":",
"reader",
"=",
"vtkITK",
".",
"vtkITKArchetypeImageSeriesScalarReader",
"(",
")",
"reader",
".",
"SetArchetype",
"(",
"files",
"[",
"0",
"]",
")",
"for",
... | https://github.com/Slicer/SlicerGitSVNArchive/blob/65e92bb16c2b32ea47a1a66bee71f238891ee1ca/Modules/Scripted/DICOMPlugins/DICOMScalarVolumePlugin.py#L300-L344 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/boto/boto/ec2/securitygroup.py | python | SecurityGroup.copy_to_region | (self, region, name=None, dry_run=False) | return sg | Create a copy of this security group in another region.
Note that the new security group will be a separate entity
and will not stay in sync automatically after the copy
operation.
:type region: :class:`boto.ec2.regioninfo.RegionInfo`
:param region: The region to which this secu... | Create a copy of this security group in another region.
Note that the new security group will be a separate entity
and will not stay in sync automatically after the copy
operation. | [
"Create",
"a",
"copy",
"of",
"this",
"security",
"group",
"in",
"another",
"region",
".",
"Note",
"that",
"the",
"new",
"security",
"group",
"will",
"be",
"a",
"separate",
"entity",
"and",
"will",
"not",
"stay",
"in",
"sync",
"automatically",
"after",
"the... | def copy_to_region(self, region, name=None, dry_run=False):
"""
Create a copy of this security group in another region.
Note that the new security group will be a separate entity
and will not stay in sync automatically after the copy
operation.
:type region: :class:`boto... | [
"def",
"copy_to_region",
"(",
"self",
",",
"region",
",",
"name",
"=",
"None",
",",
"dry_run",
"=",
"False",
")",
":",
"if",
"region",
".",
"name",
"==",
"self",
".",
"region",
":",
"raise",
"BotoClientError",
"(",
"'Unable to copy to the same Region'",
")",... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/boto/boto/ec2/securitygroup.py#L250-L288 | |
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/python/ops/sparse_ops.py | python | sparse_merge | (sp_ids, sp_values, vocab_size, name=None,
already_sorted=False) | Combines a batch of feature ids and values into a single `SparseTensor`.
The most common use case for this function occurs when feature ids and
their corresponding values are stored in `Example` protos on disk.
`parse_example` will return a batch of ids and a batch of values, and this
function joins them into ... | Combines a batch of feature ids and values into a single `SparseTensor`. | [
"Combines",
"a",
"batch",
"of",
"feature",
"ids",
"and",
"values",
"into",
"a",
"single",
"SparseTensor",
"."
] | def sparse_merge(sp_ids, sp_values, vocab_size, name=None,
already_sorted=False):
"""Combines a batch of feature ids and values into a single `SparseTensor`.
The most common use case for this function occurs when feature ids and
their corresponding values are stored in `Example` protos on disk.
... | [
"def",
"sparse_merge",
"(",
"sp_ids",
",",
"sp_values",
",",
"vocab_size",
",",
"name",
"=",
"None",
",",
"already_sorted",
"=",
"False",
")",
":",
"sp_ids",
"=",
"_convert_to_sparse_tensor",
"(",
"sp_ids",
")",
"sp_values",
"=",
"_convert_to_sparse_tensor",
"("... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/ops/sparse_ops.py#L754-L855 | ||
OSGeo/gdal | 3748fc4ba4fba727492774b2b908a2130c864a83 | swig/python/osgeo/ogr.py | python | FeatureDefn.IsStyleIgnored | (self, *args) | return _ogr.FeatureDefn_IsStyleIgnored(self, *args) | r"""
IsStyleIgnored(FeatureDefn self) -> int
int
OGR_FD_IsStyleIgnored(OGRFeatureDefnH hDefn)
Determine whether the style can be omitted when fetching features.
This function is the same as the C++ method
OGRFeatureDefn::IsStyleIgnored().
Parameters:
--... | r"""
IsStyleIgnored(FeatureDefn self) -> int
int
OGR_FD_IsStyleIgnored(OGRFeatureDefnH hDefn) | [
"r",
"IsStyleIgnored",
"(",
"FeatureDefn",
"self",
")",
"-",
">",
"int",
"int",
"OGR_FD_IsStyleIgnored",
"(",
"OGRFeatureDefnH",
"hDefn",
")"
] | def IsStyleIgnored(self, *args):
r"""
IsStyleIgnored(FeatureDefn self) -> int
int
OGR_FD_IsStyleIgnored(OGRFeatureDefnH hDefn)
Determine whether the style can be omitted when fetching features.
This function is the same as the C++ method
OGRFeatureDefn::IsStyleI... | [
"def",
"IsStyleIgnored",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_ogr",
".",
"FeatureDefn_IsStyleIgnored",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/OSGeo/gdal/blob/3748fc4ba4fba727492774b2b908a2130c864a83/swig/python/osgeo/ogr.py#L4870-L4889 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/docview.py | python | DocChildFrame.GetDocument | (self) | return self._childDocument | Returns the document associated with this frame. | Returns the document associated with this frame. | [
"Returns",
"the",
"document",
"associated",
"with",
"this",
"frame",
"."
] | def GetDocument(self):
"""
Returns the document associated with this frame.
"""
return self._childDocument | [
"def",
"GetDocument",
"(",
"self",
")",
":",
"return",
"self",
".",
"_childDocument"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/docview.py#L2582-L2586 | |
xhzdeng/crpn | a5aef0f80dbe486103123f740c634fb01e6cc9a1 | caffe-fast-rcnn/python/draw_net.py | python | parse_args | () | return args | Parse input arguments | Parse input arguments | [
"Parse",
"input",
"arguments"
] | def parse_args():
"""Parse input arguments
"""
parser = ArgumentParser(description=__doc__,
formatter_class=ArgumentDefaultsHelpFormatter)
parser.add_argument('input_net_proto_file',
help='Input network prototxt file')
parser.add_argument('output... | [
"def",
"parse_args",
"(",
")",
":",
"parser",
"=",
"ArgumentParser",
"(",
"description",
"=",
"__doc__",
",",
"formatter_class",
"=",
"ArgumentDefaultsHelpFormatter",
")",
"parser",
".",
"add_argument",
"(",
"'input_net_proto_file'",
",",
"help",
"=",
"'Input networ... | https://github.com/xhzdeng/crpn/blob/a5aef0f80dbe486103123f740c634fb01e6cc9a1/caffe-fast-rcnn/python/draw_net.py#L13-L38 | |
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/python/ops/array_grad.py | python | _UnpackGrad | (op, *grads) | return array_ops.pack(grads, axis=op.get_attr("axis")) | Gradient for unpack op. | Gradient for unpack op. | [
"Gradient",
"for",
"unpack",
"op",
"."
] | def _UnpackGrad(op, *grads):
"""Gradient for unpack op."""
return array_ops.pack(grads, axis=op.get_attr("axis")) | [
"def",
"_UnpackGrad",
"(",
"op",
",",
"*",
"grads",
")",
":",
"return",
"array_ops",
".",
"pack",
"(",
"grads",
",",
"axis",
"=",
"op",
".",
"get_attr",
"(",
"\"axis\"",
")",
")"
] | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/python/ops/array_grad.py#L37-L39 | |
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | chrome/tools/webforms_aggregator.py | python | WorkerThread.__init__ | (self, url) | Creates _url and page_found attri to populate urls_with_no_reg_page file.
Used after thread's termination for the creation of a file with a list of
the urls for which a registration page wasn't found.
Args:
url: will be used as an argument to create a Crawler object later. | Creates _url and page_found attri to populate urls_with_no_reg_page file. | [
"Creates",
"_url",
"and",
"page_found",
"attri",
"to",
"populate",
"urls_with_no_reg_page",
"file",
"."
] | def __init__(self, url):
"""Creates _url and page_found attri to populate urls_with_no_reg_page file.
Used after thread's termination for the creation of a file with a list of
the urls for which a registration page wasn't found.
Args:
url: will be used as an argument to create a Crawler object l... | [
"def",
"__init__",
"(",
"self",
",",
"url",
")",
":",
"threading",
".",
"Thread",
".",
"__init__",
"(",
"self",
")",
"self",
".",
"_url",
"=",
"url",
"self",
".",
"page_found",
"=",
"False"
] | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/chrome/tools/webforms_aggregator.py#L597-L608 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py2/sklearn/linear_model/passive_aggressive.py | python | PassiveAggressiveRegressor.partial_fit | (self, X, y) | return self._partial_fit(X, y, alpha=1.0, C=self.C,
loss="epsilon_insensitive",
learning_rate=lr, n_iter=1,
sample_weight=None,
coef_init=None, intercept_init=None) | Fit linear model with Passive Aggressive algorithm.
Parameters
----------
X : {array-like, sparse matrix}, shape = [n_samples, n_features]
Subset of training data
y : numpy array of shape [n_samples]
Subset of target values
Returns
-------
... | Fit linear model with Passive Aggressive algorithm. | [
"Fit",
"linear",
"model",
"with",
"Passive",
"Aggressive",
"algorithm",
"."
] | def partial_fit(self, X, y):
"""Fit linear model with Passive Aggressive algorithm.
Parameters
----------
X : {array-like, sparse matrix}, shape = [n_samples, n_features]
Subset of training data
y : numpy array of shape [n_samples]
Subset of target value... | [
"def",
"partial_fit",
"(",
"self",
",",
"X",
",",
"y",
")",
":",
"lr",
"=",
"\"pa1\"",
"if",
"self",
".",
"loss",
"==",
"\"epsilon_insensitive\"",
"else",
"\"pa2\"",
"return",
"self",
".",
"_partial_fit",
"(",
"X",
",",
"y",
",",
"alpha",
"=",
"1.0",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py2/sklearn/linear_model/passive_aggressive.py#L251-L271 | |
hakuna-m/wubiuefi | caec1af0a09c78fd5a345180ada1fe45e0c63493 | src/urlgrabber/keepalive.py | python | KeepAliveHandler._request_closed | (self, request, host, connection) | tells us that this request is now closed and the the
connection is ready for another request | tells us that this request is now closed and the the
connection is ready for another request | [
"tells",
"us",
"that",
"this",
"request",
"is",
"now",
"closed",
"and",
"the",
"the",
"connection",
"is",
"ready",
"for",
"another",
"request"
] | def _request_closed(self, request, host, connection):
"""tells us that this request is now closed and the the
connection is ready for another request"""
self._cm.set_ready(connection, 1) | [
"def",
"_request_closed",
"(",
"self",
",",
"request",
",",
"host",
",",
"connection",
")",
":",
"self",
".",
"_cm",
".",
"set_ready",
"(",
"connection",
",",
"1",
")"
] | https://github.com/hakuna-m/wubiuefi/blob/caec1af0a09c78fd5a345180ada1fe45e0c63493/src/urlgrabber/keepalive.py#L202-L205 | ||
kristjankorjus/Replicating-DeepMind | 68539394e792b34a4d6b430a2eb73b8b8f91d8db | Hybrid/src/ai/cc_layers.py | python | shuffle_pool_unshuffle | (input_layer, *args, **kwargs) | return l_c01b | The Krizhevskhy max pooling layer only supports square input. This function provides
a workaround that uses Theano's own max pooling op, flanked by two shuffling operations:
c01b to bc01 before pooling, and bc01 to c01b afterwards. | The Krizhevskhy max pooling layer only supports square input. This function provides
a workaround that uses Theano's own max pooling op, flanked by two shuffling operations:
c01b to bc01 before pooling, and bc01 to c01b afterwards. | [
"The",
"Krizhevskhy",
"max",
"pooling",
"layer",
"only",
"supports",
"square",
"input",
".",
"This",
"function",
"provides",
"a",
"workaround",
"that",
"uses",
"Theano",
"s",
"own",
"max",
"pooling",
"op",
"flanked",
"by",
"two",
"shuffling",
"operations",
":"... | def shuffle_pool_unshuffle(input_layer, *args, **kwargs):
"""
The Krizhevskhy max pooling layer only supports square input. This function provides
a workaround that uses Theano's own max pooling op, flanked by two shuffling operations:
c01b to bc01 before pooling, and bc01 to c01b afterwards.
"""
... | [
"def",
"shuffle_pool_unshuffle",
"(",
"input_layer",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"l_bc01",
"=",
"ShuffleC01BToBC01Layer",
"(",
"input_layer",
")",
"l_pool",
"=",
"layers",
".",
"Pooling2DLayer",
"(",
"l_bc01",
",",
"*",
"args",
",",
... | https://github.com/kristjankorjus/Replicating-DeepMind/blob/68539394e792b34a4d6b430a2eb73b8b8f91d8db/Hybrid/src/ai/cc_layers.py#L377-L387 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/AWS/resource-manager-code/lib/jsonschema/_utils.py | python | extras_msg | (extras) | return ", ".join(repr(extra) for extra in extras), verb | Create an error message for extra items or properties. | Create an error message for extra items or properties. | [
"Create",
"an",
"error",
"message",
"for",
"extra",
"items",
"or",
"properties",
"."
] | def extras_msg(extras):
"""
Create an error message for extra items or properties.
"""
if len(extras) == 1:
verb = "was"
else:
verb = "were"
return ", ".join(repr(extra) for extra in extras), verb | [
"def",
"extras_msg",
"(",
"extras",
")",
":",
"if",
"len",
"(",
"extras",
")",
"==",
"1",
":",
"verb",
"=",
"\"was\"",
"else",
":",
"verb",
"=",
"\"were\"",
"return",
"\", \"",
".",
"join",
"(",
"repr",
"(",
"extra",
")",
"for",
"extra",
"in",
"ext... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/AWS/resource-manager-code/lib/jsonschema/_utils.py#L103-L112 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/webapp2/webapp2_extras/security.py | python | hash_password | (password, method, salt=None, pepper=None) | return h.hexdigest() | Hashes a password.
Supports plaintext without salt, unsalted and salted passwords. In case
salted passwords are used hmac is used.
:param password:
The password to be hashed.
:param method:
A method from ``hashlib``, e.g., `sha1` or `md5`, or `plain`.
:param salt:
A random ... | Hashes a password. | [
"Hashes",
"a",
"password",
"."
] | def hash_password(password, method, salt=None, pepper=None):
"""Hashes a password.
Supports plaintext without salt, unsalted and salted passwords. In case
salted passwords are used hmac is used.
:param password:
The password to be hashed.
:param method:
A method from ``hashlib``, e... | [
"def",
"hash_password",
"(",
"password",
",",
"method",
",",
"salt",
"=",
"None",
",",
"pepper",
"=",
"None",
")",
":",
"password",
"=",
"webapp2",
".",
"_to_utf8",
"(",
"password",
")",
"if",
"method",
"==",
"'plain'",
":",
"return",
"password",
"method... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/webapp2/webapp2_extras/security.py#L155-L190 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/_pyio.py | python | IOBase.fileno | (self) | Returns underlying file descriptor (an int) if one exists.
An OSError is raised if the IO object does not use a file descriptor. | Returns underlying file descriptor (an int) if one exists. | [
"Returns",
"underlying",
"file",
"descriptor",
"(",
"an",
"int",
")",
"if",
"one",
"exists",
"."
] | def fileno(self):
"""Returns underlying file descriptor (an int) if one exists.
An OSError is raised if the IO object does not use a file descriptor.
"""
self._unsupported("fileno") | [
"def",
"fileno",
"(",
"self",
")",
":",
"self",
".",
"_unsupported",
"(",
"\"fileno\"",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/_pyio.py#L461-L466 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/lib2to3/pytree.py | python | Leaf.__init__ | (self, type, value,
context=None,
prefix=None,
fixers_applied=[]) | Initializer.
Takes a type constant (a token number < 256), a string value, and an
optional context keyword argument. | Initializer. | [
"Initializer",
"."
] | def __init__(self, type, value,
context=None,
prefix=None,
fixers_applied=[]):
"""
Initializer.
Takes a type constant (a token number < 256), a string value, and an
optional context keyword argument.
"""
assert 0 <= type... | [
"def",
"__init__",
"(",
"self",
",",
"type",
",",
"value",
",",
"context",
"=",
"None",
",",
"prefix",
"=",
"None",
",",
"fixers_applied",
"=",
"[",
"]",
")",
":",
"assert",
"0",
"<=",
"type",
"<",
"256",
",",
"type",
"if",
"context",
"is",
"not",
... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/lib2to3/pytree.py#L360-L377 | ||
arangodb/arangodb | 0d658689c7d1b721b314fa3ca27d38303e1570c8 | 3rdParty/V8/gyp/generator/xcodeproj_file.py | python | XCObject.Children | (self) | return children | Returns a list of all of this object's owned (strong) children. | Returns a list of all of this object's owned (strong) children. | [
"Returns",
"a",
"list",
"of",
"all",
"of",
"this",
"object",
"s",
"owned",
"(",
"strong",
")",
"children",
"."
] | def Children(self):
"""Returns a list of all of this object's owned (strong) children."""
children = []
for property, attributes in self._schema.items():
(is_list, property_type, is_strong) = attributes[0:3]
if is_strong and property in self._properties:
if not is_list:
childr... | [
"def",
"Children",
"(",
"self",
")",
":",
"children",
"=",
"[",
"]",
"for",
"property",
",",
"attributes",
"in",
"self",
".",
"_schema",
".",
"items",
"(",
")",
":",
"(",
"is_list",
",",
"property_type",
",",
"is_strong",
")",
"=",
"attributes",
"[",
... | https://github.com/arangodb/arangodb/blob/0d658689c7d1b721b314fa3ca27d38303e1570c8/3rdParty/V8/gyp/generator/xcodeproj_file.py#L479-L490 | |
cornell-zhang/heterocl | 6d9e4b4acc2ee2707b2d25b27298c0335bccedfd | python/heterocl/tvm/contrib/graph_runtime.py | python | GraphModule.__getitem__ | (self, key) | return self.module[key] | Get internal module function
Parameters
----------
key : str
The key to the module. | Get internal module function | [
"Get",
"internal",
"module",
"function"
] | def __getitem__(self, key):
"""Get internal module function
Parameters
----------
key : str
The key to the module.
"""
return self.module[key] | [
"def",
"__getitem__",
"(",
"self",
",",
"key",
")",
":",
"return",
"self",
".",
"module",
"[",
"key",
"]"
] | https://github.com/cornell-zhang/heterocl/blob/6d9e4b4acc2ee2707b2d25b27298c0335bccedfd/python/heterocl/tvm/contrib/graph_runtime.py#L155-L163 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | build/android/gyp/locale_pak_resources.py | python | ComputeMappings | (sources) | return mappings, lang_to_locale_map | Computes the mappings of sources -> resources.
Returns a tuple of:
- mappings: List of (src, dest) paths
- lang_to_locale_map: Map of language -> list of resource names
e.g. "en" -> ["en_gb.lpak"] | Computes the mappings of sources -> resources. | [
"Computes",
"the",
"mappings",
"of",
"sources",
"-",
">",
"resources",
"."
] | def ComputeMappings(sources):
"""Computes the mappings of sources -> resources.
Returns a tuple of:
- mappings: List of (src, dest) paths
- lang_to_locale_map: Map of language -> list of resource names
e.g. "en" -> ["en_gb.lpak"]
"""
lang_to_locale_map = collections.defaultdict(list)
mappings =... | [
"def",
"ComputeMappings",
"(",
"sources",
")",
":",
"lang_to_locale_map",
"=",
"collections",
".",
"defaultdict",
"(",
"list",
")",
"mappings",
"=",
"[",
"]",
"for",
"src_path",
"in",
"sources",
":",
"basename",
"=",
"os",
".",
"path",
".",
"basename",
"("... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/build/android/gyp/locale_pak_resources.py#L55-L79 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/indexes/base.py | python | Index._get_attributes_dict | (self) | return {k: getattr(self, k, None) for k in self._attributes} | Return an attributes dict for my class. | Return an attributes dict for my class. | [
"Return",
"an",
"attributes",
"dict",
"for",
"my",
"class",
"."
] | def _get_attributes_dict(self):
"""
Return an attributes dict for my class.
"""
return {k: getattr(self, k, None) for k in self._attributes} | [
"def",
"_get_attributes_dict",
"(",
"self",
")",
":",
"return",
"{",
"k",
":",
"getattr",
"(",
"self",
",",
"k",
",",
"None",
")",
"for",
"k",
"in",
"self",
".",
"_attributes",
"}"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/indexes/base.py#L505-L509 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/AWS/resource-manager-code/lib/setuptools/command/easy_install.py | python | _first_line_re | () | return re.compile(first_line_re.pattern.decode()) | Return a regular expression based on first_line_re suitable for matching
strings. | Return a regular expression based on first_line_re suitable for matching
strings. | [
"Return",
"a",
"regular",
"expression",
"based",
"on",
"first_line_re",
"suitable",
"for",
"matching",
"strings",
"."
] | def _first_line_re():
"""
Return a regular expression based on first_line_re suitable for matching
strings.
"""
if isinstance(first_line_re.pattern, str):
return first_line_re
# first_line_re in Python >=3.1.4 and >=3.2.1 is a bytes pattern.
return re.compile(first_line_re.pattern.d... | [
"def",
"_first_line_re",
"(",
")",
":",
"if",
"isinstance",
"(",
"first_line_re",
".",
"pattern",
",",
"str",
")",
":",
"return",
"first_line_re",
"# first_line_re in Python >=3.1.4 and >=3.2.1 is a bytes pattern.",
"return",
"re",
".",
"compile",
"(",
"first_line_re",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/AWS/resource-manager-code/lib/setuptools/command/easy_install.py#L1723-L1732 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_core.py | python | PyApp.SetMacExitMenuItemId | (*args, **kwargs) | return _core_.PyApp_SetMacExitMenuItemId(*args, **kwargs) | SetMacExitMenuItemId(long val) | SetMacExitMenuItemId(long val) | [
"SetMacExitMenuItemId",
"(",
"long",
"val",
")"
] | def SetMacExitMenuItemId(*args, **kwargs):
"""SetMacExitMenuItemId(long val)"""
return _core_.PyApp_SetMacExitMenuItemId(*args, **kwargs) | [
"def",
"SetMacExitMenuItemId",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"PyApp_SetMacExitMenuItemId",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_core.py#L8180-L8182 | |
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | python/mxnet/autograd.py | python | is_recording | () | return curr.value | Get status on recording/not recording.
Returns
-------
Current state of recording. | Get status on recording/not recording. | [
"Get",
"status",
"on",
"recording",
"/",
"not",
"recording",
"."
] | def is_recording():
"""Get status on recording/not recording.
Returns
-------
Current state of recording.
"""
curr = ctypes.c_bool()
check_call(_LIB.MXAutogradIsRecording(ctypes.byref(curr)))
return curr.value | [
"def",
"is_recording",
"(",
")",
":",
"curr",
"=",
"ctypes",
".",
"c_bool",
"(",
")",
"check_call",
"(",
"_LIB",
".",
"MXAutogradIsRecording",
"(",
"ctypes",
".",
"byref",
"(",
"curr",
")",
")",
")",
"return",
"curr",
".",
"value"
] | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/python/mxnet/autograd.py#L70-L79 | |
bigartm/bigartm | 47e37f982de87aa67bfd475ff1f39da696b181b3 | 3rdparty/protobuf-3.0.0/gmock/scripts/fuse_gmock_files.py | python | FuseGMockAllCcToFile | (gmock_root, output_file) | Scans folder gmock_root to fuse gmock-all.cc into output_file. | Scans folder gmock_root to fuse gmock-all.cc into output_file. | [
"Scans",
"folder",
"gmock_root",
"to",
"fuse",
"gmock",
"-",
"all",
".",
"cc",
"into",
"output_file",
"."
] | def FuseGMockAllCcToFile(gmock_root, output_file):
"""Scans folder gmock_root to fuse gmock-all.cc into output_file."""
processed_files = sets.Set()
def ProcessFile(gmock_source_file):
"""Processes the given gmock source file."""
# We don't process the same #included file twice.
if gmock_source_fil... | [
"def",
"FuseGMockAllCcToFile",
"(",
"gmock_root",
",",
"output_file",
")",
":",
"processed_files",
"=",
"sets",
".",
"Set",
"(",
")",
"def",
"ProcessFile",
"(",
"gmock_source_file",
")",
":",
"\"\"\"Processes the given gmock source file.\"\"\"",
"# We don't process the sa... | https://github.com/bigartm/bigartm/blob/47e37f982de87aa67bfd475ff1f39da696b181b3/3rdparty/protobuf-3.0.0/gmock/scripts/fuse_gmock_files.py#L159-L201 | ||
smilehao/xlua-framework | a03801538be2b0e92d39332d445b22caca1ef61f | ConfigData/trunk/tools/protobuf-2.5.0/protobuf-2.5.0/python/build/lib/google/protobuf/message.py | python | Message.MergeFromString | (self, serialized) | Merges serialized protocol buffer data into this message.
When we find a field in |serialized| that is already present
in this message:
- If it's a "repeated" field, we append to the end of our list.
- Else, if it's a scalar, we overwrite our field.
- Else, (it's a nonrepeated composite), we ... | Merges serialized protocol buffer data into this message. | [
"Merges",
"serialized",
"protocol",
"buffer",
"data",
"into",
"this",
"message",
"."
] | def MergeFromString(self, serialized):
"""Merges serialized protocol buffer data into this message.
When we find a field in |serialized| that is already present
in this message:
- If it's a "repeated" field, we append to the end of our list.
- Else, if it's a scalar, we overwrite our field.
... | [
"def",
"MergeFromString",
"(",
"self",
",",
"serialized",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/smilehao/xlua-framework/blob/a03801538be2b0e92d39332d445b22caca1ef61f/ConfigData/trunk/tools/protobuf-2.5.0/protobuf-2.5.0/python/build/lib/google/protobuf/message.py#L149-L177 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/botocore/signers.py | python | RequestSigner._choose_signer | (self, operation_name, signing_type, context) | return signature_version | Allow setting the signature version via the choose-signer event.
A value of `botocore.UNSIGNED` means no signing will be performed.
:param operation_name: The operation to sign.
:param signing_type: The type of signing that the signer is to be used
for.
:return: The signatur... | Allow setting the signature version via the choose-signer event.
A value of `botocore.UNSIGNED` means no signing will be performed. | [
"Allow",
"setting",
"the",
"signature",
"version",
"via",
"the",
"choose",
"-",
"signer",
"event",
".",
"A",
"value",
"of",
"botocore",
".",
"UNSIGNED",
"means",
"no",
"signing",
"will",
"be",
"performed",
"."
] | def _choose_signer(self, operation_name, signing_type, context):
"""
Allow setting the signature version via the choose-signer event.
A value of `botocore.UNSIGNED` means no signing will be performed.
:param operation_name: The operation to sign.
:param signing_type: The type of... | [
"def",
"_choose_signer",
"(",
"self",
",",
"operation_name",
",",
"signing_type",
",",
"context",
")",
":",
"signing_type_suffix_map",
"=",
"{",
"'presign-post'",
":",
"'-presign-post'",
",",
"'presign-url'",
":",
"'-query'",
"}",
"suffix",
"=",
"signing_type_suffix... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/botocore/signers.py#L162-L197 | |
thalium/icebox | 99d147d5b9269222225443ce171b4fd46d8985d4 | third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2.py | python | uCSIsOldItalic | (code) | return ret | Check whether the character is part of OldItalic UCS Block | Check whether the character is part of OldItalic UCS Block | [
"Check",
"whether",
"the",
"character",
"is",
"part",
"of",
"OldItalic",
"UCS",
"Block"
] | def uCSIsOldItalic(code):
"""Check whether the character is part of OldItalic UCS Block """
ret = libxml2mod.xmlUCSIsOldItalic(code)
return ret | [
"def",
"uCSIsOldItalic",
"(",
"code",
")",
":",
"ret",
"=",
"libxml2mod",
".",
"xmlUCSIsOldItalic",
"(",
"code",
")",
"return",
"ret"
] | https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2.py#L2796-L2799 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/setuptools/command/easy_install.py | python | is_python_script | (script_text, filename) | return False | Is this text, as a whole, a Python script? (as opposed to shell/bat/etc. | Is this text, as a whole, a Python script? (as opposed to shell/bat/etc. | [
"Is",
"this",
"text",
"as",
"a",
"whole",
"a",
"Python",
"script?",
"(",
"as",
"opposed",
"to",
"shell",
"/",
"bat",
"/",
"etc",
"."
] | def is_python_script(script_text, filename):
"""Is this text, as a whole, a Python script? (as opposed to shell/bat/etc.
"""
if filename.endswith('.py') or filename.endswith('.pyw'):
return True # extension says it's Python
if is_python(script_text, filename):
return True # it's syntac... | [
"def",
"is_python_script",
"(",
"script_text",
",",
"filename",
")",
":",
"if",
"filename",
".",
"endswith",
"(",
"'.py'",
")",
"or",
"filename",
".",
"endswith",
"(",
"'.pyw'",
")",
":",
"return",
"True",
"# extension says it's Python",
"if",
"is_python",
"("... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/setuptools/command/easy_install.py#L1931-L1942 | |
gimli-org/gimli | 17aa2160de9b15ababd9ef99e89b1bc3277bbb23 | pygimli/viewer/pv/show3d.py | python | Show3D.updateScalarBar | (self) | When user set limits are made and finished/accepted the color bar
needs to change. | When user set limits are made and finished/accepted the color bar
needs to change. | [
"When",
"user",
"set",
"limits",
"are",
"made",
"and",
"finished",
"/",
"accepted",
"the",
"color",
"bar",
"needs",
"to",
"change",
"."
] | def updateScalarBar(self):
"""
When user set limits are made and finished/accepted the color bar
needs to change.
"""
cmin = float(self.toolbar.spbx_cmin.value())
cmax = float(self.toolbar.spbx_cmax.value())
if cmax >= cmin:
# get the active scalar/par... | [
"def",
"updateScalarBar",
"(",
"self",
")",
":",
"cmin",
"=",
"float",
"(",
"self",
".",
"toolbar",
".",
"spbx_cmin",
".",
"value",
"(",
")",
")",
"cmax",
"=",
"float",
"(",
"self",
".",
"toolbar",
".",
"spbx_cmax",
".",
"value",
"(",
")",
")",
"if... | https://github.com/gimli-org/gimli/blob/17aa2160de9b15ababd9ef99e89b1bc3277bbb23/pygimli/viewer/pv/show3d.py#L332-L350 | ||
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | src/third_party/wiredtiger/src/docs/tools/doxypy.py | python | Doxypy.stopCommentSearch | (self, match) | Stops a comment search.
Closes the current commentblock, resets the triggering line and
appends the current line to the output. | Stops a comment search.
Closes the current commentblock, resets the triggering line and
appends the current line to the output. | [
"Stops",
"a",
"comment",
"search",
".",
"Closes",
"the",
"current",
"commentblock",
"resets",
"the",
"triggering",
"line",
"and",
"appends",
"the",
"current",
"line",
"to",
"the",
"output",
"."
] | def stopCommentSearch(self, match):
"""Stops a comment search.
Closes the current commentblock, resets the triggering line and
appends the current line to the output.
"""
if options.debug:
print("# CALLBACK: stopCommentSearch" , file=sys.stderr)
self.__closeComment()
self.defclass = []
self.outpu... | [
"def",
"stopCommentSearch",
"(",
"self",
",",
"match",
")",
":",
"if",
"options",
".",
"debug",
":",
"print",
"(",
"\"# CALLBACK: stopCommentSearch\"",
",",
"file",
"=",
"sys",
".",
"stderr",
")",
"self",
".",
"__closeComment",
"(",
")",
"self",
".",
"defc... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/src/third_party/wiredtiger/src/docs/tools/doxypy.py#L249-L260 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/distlib/index.py | python | PackageIndex.upload_documentation | (self, metadata, doc_dir) | return self.send_request(request) | Upload documentation to the index.
:param metadata: A :class:`Metadata` instance defining at least a name
and version number for the documentation to be
uploaded.
:param doc_dir: The pathname of the directory which contains the
d... | Upload documentation to the index. | [
"Upload",
"documentation",
"to",
"the",
"index",
"."
] | def upload_documentation(self, metadata, doc_dir):
"""
Upload documentation to the index.
:param metadata: A :class:`Metadata` instance defining at least a name
and version number for the documentation to be
uploaded.
:param doc_dir: The... | [
"def",
"upload_documentation",
"(",
"self",
",",
"metadata",
",",
"doc_dir",
")",
":",
"self",
".",
"check_credentials",
"(",
")",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"doc_dir",
")",
":",
"raise",
"DistlibException",
"(",
"'not a directory: %r... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/distlib/index.py#L296-L322 | |
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | example/cnn_chinese_text_classification/text_cnn.py | python | data_iter | (batch_size, num_embed, pre_trained_word2vec=False) | return train_set, valid, sentences_size, embedded_size, vocabulary_size | Construct data iter
Parameters
----------
batch_size: int
num_embed: int
pre_trained_word2vec: boolean
identify the pre-trained layers or not
Returns
----------
train_set: DataIter
Train DataIter
valid: DataIter
Valid DataIter
... | Construct data iter
Parameters
----------
batch_size: int
num_embed: int
pre_trained_word2vec: boolean
identify the pre-trained layers or not
Returns
----------
train_set: DataIter
Train DataIter
valid: DataIter
Valid DataIter
... | [
"Construct",
"data",
"iter",
"Parameters",
"----------",
"batch_size",
":",
"int",
"num_embed",
":",
"int",
"pre_trained_word2vec",
":",
"boolean",
"identify",
"the",
"pre",
"-",
"trained",
"layers",
"or",
"not",
"Returns",
"----------",
"train_set",
":",
"DataIte... | def data_iter(batch_size, num_embed, pre_trained_word2vec=False):
"""Construct data iter
Parameters
----------
batch_size: int
num_embed: int
pre_trained_word2vec: boolean
identify the pre-trained layers or not
Returns
----------
train_set: DataIter
... | [
"def",
"data_iter",
"(",
"batch_size",
",",
"num_embed",
",",
"pre_trained_word2vec",
"=",
"False",
")",
":",
"logger",
".",
"info",
"(",
"'Loading data...'",
")",
"if",
"pre_trained_word2vec",
":",
"word2vec",
"=",
"data_helpers",
".",
"load_pretrained_word2vec",
... | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/example/cnn_chinese_text_classification/text_cnn.py#L102-L158 | |
gimli-org/gimli | 17aa2160de9b15ababd9ef99e89b1bc3277bbb23 | doc/examples/2_seismics/plot_03_rays_layered_and_gradient_models.py | python | analyticalSolutionGradient | (x, a=1000, b=100) | return np.minimum(tdirect, trefrac) | Analytical solution for gradient model. | Analytical solution for gradient model. | [
"Analytical",
"solution",
"for",
"gradient",
"model",
"."
] | def analyticalSolutionGradient(x, a=1000, b=100):
"""Analytical solution for gradient model."""
tdirect = np.abs(x) / a # direct wave
tmp = 1 + ((b**2 * np.abs(x)**2) / (2 * a**2))
trefrac = np.abs(b**-1 * np.arccosh(tmp))
return np.minimum(tdirect, trefrac) | [
"def",
"analyticalSolutionGradient",
"(",
"x",
",",
"a",
"=",
"1000",
",",
"b",
"=",
"100",
")",
":",
"tdirect",
"=",
"np",
".",
"abs",
"(",
"x",
")",
"/",
"a",
"# direct wave",
"tmp",
"=",
"1",
"+",
"(",
"(",
"b",
"**",
"2",
"*",
"np",
".",
... | https://github.com/gimli-org/gimli/blob/17aa2160de9b15ababd9ef99e89b1bc3277bbb23/doc/examples/2_seismics/plot_03_rays_layered_and_gradient_models.py#L96-L101 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/richtext.py | python | TextBoxAttr.GetPadding | (*args) | return _richtext.TextBoxAttr_GetPadding(*args) | GetPadding(self) -> TextAttrDimensions
GetPadding(self) -> TextAttrDimensions | GetPadding(self) -> TextAttrDimensions
GetPadding(self) -> TextAttrDimensions | [
"GetPadding",
"(",
"self",
")",
"-",
">",
"TextAttrDimensions",
"GetPadding",
"(",
"self",
")",
"-",
">",
"TextAttrDimensions"
] | def GetPadding(*args):
"""
GetPadding(self) -> TextAttrDimensions
GetPadding(self) -> TextAttrDimensions
"""
return _richtext.TextBoxAttr_GetPadding(*args) | [
"def",
"GetPadding",
"(",
"*",
"args",
")",
":",
"return",
"_richtext",
".",
"TextBoxAttr_GetPadding",
"(",
"*",
"args",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/richtext.py#L698-L703 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/ros_comm/roscpp/rosbuild/scripts/msg_gen.py | python | write_constant_declaration | (s, constant) | Write a constant value as a static member
@param s: The stream to write to
@type s: stream
@param constant: The constant
@type constant: roslib.msgs.Constant | Write a constant value as a static member | [
"Write",
"a",
"constant",
"value",
"as",
"a",
"static",
"member"
] | def write_constant_declaration(s, constant):
"""
Write a constant value as a static member
@param s: The stream to write to
@type s: stream
@param constant: The constant
@type constant: roslib.msgs.Constant
"""
# integral types get their declarations as enums to allow use at co... | [
"def",
"write_constant_declaration",
"(",
"s",
",",
"constant",
")",
":",
"# integral types get their declarations as enums to allow use at compile time",
"if",
"(",
"constant",
".",
"type",
"in",
"[",
"'byte'",
",",
"'int8'",
",",
"'int16'",
",",
"'int32'",
",",
"'in... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/ros_comm/roscpp/rosbuild/scripts/msg_gen.py#L371-L385 | ||
seqan/seqan | f5f658343c366c9c3d44ba358ffc9317e78a09ed | util/py_lib/seqan/dox/write_html.py | python | escapeAnchor | (name) | return name | Escape a name such that it is safe to use for anchors. | Escape a name such that it is safe to use for anchors. | [
"Escape",
"a",
"name",
"such",
"that",
"it",
"is",
"safe",
"to",
"use",
"for",
"anchors",
"."
] | def escapeAnchor(name):
"""Escape a name such that it is safe to use for anchors."""
return name | [
"def",
"escapeAnchor",
"(",
"name",
")",
":",
"return",
"name"
] | https://github.com/seqan/seqan/blob/f5f658343c366c9c3d44ba358ffc9317e78a09ed/util/py_lib/seqan/dox/write_html.py#L36-L38 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/share/gdb/python/gdb/command/explore.py | python | Explorer.init_env | () | Initializes the Explorer environment.
This function should be invoked before starting any exploration. If
invoked before an exploration, it need not be invoked for subsequent
explorations. | Initializes the Explorer environment.
This function should be invoked before starting any exploration. If
invoked before an exploration, it need not be invoked for subsequent
explorations. | [
"Initializes",
"the",
"Explorer",
"environment",
".",
"This",
"function",
"should",
"be",
"invoked",
"before",
"starting",
"any",
"exploration",
".",
"If",
"invoked",
"before",
"an",
"exploration",
"it",
"need",
"not",
"be",
"invoked",
"for",
"subsequent",
"expl... | def init_env():
"""Initializes the Explorer environment.
This function should be invoked before starting any exploration. If
invoked before an exploration, it need not be invoked for subsequent
explorations.
"""
Explorer.type_code_to_explorer_map = {
gdb.TYPE... | [
"def",
"init_env",
"(",
")",
":",
"Explorer",
".",
"type_code_to_explorer_map",
"=",
"{",
"gdb",
".",
"TYPE_CODE_CHAR",
":",
"ScalarExplorer",
",",
"gdb",
".",
"TYPE_CODE_INT",
":",
"ScalarExplorer",
",",
"gdb",
".",
"TYPE_CODE_BOOL",
":",
"ScalarExplorer",
",",... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/share/gdb/python/gdb/command/explore.py#L118-L137 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/lib2to3/pytree.py | python | Node._eq | (self, other) | return (self.type, self.children) == (other.type, other.children) | Compare two nodes for equality. | Compare two nodes for equality. | [
"Compare",
"two",
"nodes",
"for",
"equality",
"."
] | def _eq(self, other):
"""Compare two nodes for equality."""
return (self.type, self.children) == (other.type, other.children) | [
"def",
"_eq",
"(",
"self",
",",
"other",
")",
":",
"return",
"(",
"self",
".",
"type",
",",
"self",
".",
"children",
")",
"==",
"(",
"other",
".",
"type",
",",
"other",
".",
"children",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/lib2to3/pytree.py#L285-L287 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_core.py | python | SizerItem.CalcMin | (*args, **kwargs) | return _core_.SizerItem_CalcMin(*args, **kwargs) | CalcMin(self) -> Size
Calculates the minimum desired size for the item, including any space
needed by borders. | CalcMin(self) -> Size | [
"CalcMin",
"(",
"self",
")",
"-",
">",
"Size"
] | def CalcMin(*args, **kwargs):
"""
CalcMin(self) -> Size
Calculates the minimum desired size for the item, including any space
needed by borders.
"""
return _core_.SizerItem_CalcMin(*args, **kwargs) | [
"def",
"CalcMin",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"SizerItem_CalcMin",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_core.py#L14068-L14075 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/extern/aui/framemanager.py | python | AuiManager.DestroyHintWindow | (self) | Destroys the standard wxAUI hint window. | Destroys the standard wxAUI hint window. | [
"Destroys",
"the",
"standard",
"wxAUI",
"hint",
"window",
"."
] | def DestroyHintWindow(self):
""" Destroys the standard wxAUI hint window. """
if self._hint_window:
self._hint_window.Destroy()
self._hint_window = None | [
"def",
"DestroyHintWindow",
"(",
"self",
")",
":",
"if",
"self",
".",
"_hint_window",
":",
"self",
".",
"_hint_window",
".",
"Destroy",
"(",
")",
"self",
".",
"_hint_window",
"=",
"None"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/extern/aui/framemanager.py#L4563-L4569 | ||
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Draft/draftguitools/gui_trackers.py | python | arcTracker.setCenter | (self, cen) | Set the center point. | Set the center point. | [
"Set",
"the",
"center",
"point",
"."
] | def setCenter(self, cen):
"""Set the center point."""
self.trans.translation.setValue([cen.x, cen.y, cen.z]) | [
"def",
"setCenter",
"(",
"self",
",",
"cen",
")",
":",
"self",
".",
"trans",
".",
"translation",
".",
"setValue",
"(",
"[",
"cen",
".",
"x",
",",
"cen",
".",
"y",
",",
"cen",
".",
"z",
"]",
")"
] | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Draft/draftguitools/gui_trackers.py#L555-L557 | ||
milvus-io/milvus | 3b1030de2b6c39e3512833e97f6044d63eb24237 | internal/core/build-support/cpplint.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/milvus-io/milvus/blob/3b1030de2b6c39e3512833e97f6044d63eb24237/internal/core/build-support/cpplint.py#L1560-L1562 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_misc.py | python | ConfigBase.SetRecordDefaults | (*args, **kwargs) | return _misc_.ConfigBase_SetRecordDefaults(*args, **kwargs) | SetRecordDefaults(self, bool doIt=True)
Set whether the config objec should record default values. | SetRecordDefaults(self, bool doIt=True) | [
"SetRecordDefaults",
"(",
"self",
"bool",
"doIt",
"=",
"True",
")"
] | def SetRecordDefaults(*args, **kwargs):
"""
SetRecordDefaults(self, bool doIt=True)
Set whether the config objec should record default values.
"""
return _misc_.ConfigBase_SetRecordDefaults(*args, **kwargs) | [
"def",
"SetRecordDefaults",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"ConfigBase_SetRecordDefaults",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_misc.py#L3389-L3395 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/scipy/spatial/kdtree.py | python | Rectangle.max_distance_rectangle | (self, other, p=2.) | return minkowski_distance(0, np.maximum(self.maxes-other.mins,other.maxes-self.mins),p) | Compute the maximum distance between points in the two hyperrectangles.
Parameters
----------
other : hyperrectangle
Input.
p : float, optional
Input. | Compute the maximum distance between points in the two hyperrectangles. | [
"Compute",
"the",
"maximum",
"distance",
"between",
"points",
"in",
"the",
"two",
"hyperrectangles",
"."
] | def max_distance_rectangle(self, other, p=2.):
"""
Compute the maximum distance between points in the two hyperrectangles.
Parameters
----------
other : hyperrectangle
Input.
p : float, optional
Input.
"""
return minkowski_distanc... | [
"def",
"max_distance_rectangle",
"(",
"self",
",",
"other",
",",
"p",
"=",
"2.",
")",
":",
"return",
"minkowski_distance",
"(",
"0",
",",
"np",
".",
"maximum",
"(",
"self",
".",
"maxes",
"-",
"other",
".",
"mins",
",",
"other",
".",
"maxes",
"-",
"se... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/scipy/spatial/kdtree.py#L161-L173 | |
google/or-tools | 2cb85b4eead4c38e1c54b48044f92087cf165bce | ortools/sat/python/cp_model.py | python | CpModel.AddDivisionEquality | (self, target, num, denom) | return ct | Adds `target == num // denom` (integer division rounded towards 0). | Adds `target == num // denom` (integer division rounded towards 0). | [
"Adds",
"target",
"==",
"num",
"//",
"denom",
"(",
"integer",
"division",
"rounded",
"towards",
"0",
")",
"."
] | def AddDivisionEquality(self, target, num, denom):
"""Adds `target == num // denom` (integer division rounded towards 0)."""
ct = Constraint(self.__model.constraints)
model_ct = self.__model.constraints[ct.Index()]
model_ct.int_div.exprs.append(self.ParseLinearExpression(num))
mo... | [
"def",
"AddDivisionEquality",
"(",
"self",
",",
"target",
",",
"num",
",",
"denom",
")",
":",
"ct",
"=",
"Constraint",
"(",
"self",
".",
"__model",
".",
"constraints",
")",
"model_ct",
"=",
"self",
".",
"__model",
".",
"constraints",
"[",
"ct",
".",
"I... | https://github.com/google/or-tools/blob/2cb85b4eead4c38e1c54b48044f92087cf165bce/ortools/sat/python/cp_model.py#L1514-L1521 | |
baidu/bigflow | 449245016c0df7d1252e85581e588bfc60cefad3 | bigflow_python/python/bigflow/serde.py | python | IntSerde.__init__ | (self) | init | init | [
"init"
] | def __init__(self):
""" init """
super(IntSerde, self).__init__() | [
"def",
"__init__",
"(",
"self",
")",
":",
"super",
"(",
"IntSerde",
",",
"self",
")",
".",
"__init__",
"(",
")"
] | https://github.com/baidu/bigflow/blob/449245016c0df7d1252e85581e588bfc60cefad3/bigflow_python/python/bigflow/serde.py#L162-L164 | ||
flexflow/FlexFlow | 581fad8ba8d10a16a3102ee2b406b0319586df24 | examples/python/keras/candle_uno/generic_utils.py | python | func_dump | (func) | return code, defaults, closure | Serialize user defined function. | Serialize user defined function. | [
"Serialize",
"user",
"defined",
"function",
"."
] | def func_dump(func):
""" Serialize user defined function. """
code = marshal.dumps(func.__code__).decode('raw_unicode_escape')
defaults = func.__defaults__
if func.__closure__:
closure = tuple(c.cell_contents for c in func.__closure__)
else:
closure = None
return code, defaults, ... | [
"def",
"func_dump",
"(",
"func",
")",
":",
"code",
"=",
"marshal",
".",
"dumps",
"(",
"func",
".",
"__code__",
")",
".",
"decode",
"(",
"'raw_unicode_escape'",
")",
"defaults",
"=",
"func",
".",
"__defaults__",
"if",
"func",
".",
"__closure__",
":",
"clo... | https://github.com/flexflow/FlexFlow/blob/581fad8ba8d10a16a3102ee2b406b0319586df24/examples/python/keras/candle_uno/generic_utils.py#L41-L49 | |
cyberbotics/webots | af7fa7d68dcf7b4550f1f2e132092b41e83698fc | scripts/image_tools/images/hdr.py | python | HDR.load_from_file | (cls, filename) | return hdr | Parse the HDR file. | Parse the HDR file. | [
"Parse",
"the",
"HDR",
"file",
"."
] | def load_from_file(cls, filename):
"""Parse the HDR file."""
# HDR Format Specifications: http://paulbourke.net/dataformats/pic/
#
# Typical header:
# #?RADIANCE
# SOFTWARE=gegl 0.4.12
# FORMAT=32-bit_rle_rgbe
#
# -Y 1024 +X 2048
... | [
"def",
"load_from_file",
"(",
"cls",
",",
"filename",
")",
":",
"# HDR Format Specifications: http://paulbourke.net/dataformats/pic/",
"#",
"# Typical header:",
"# #?RADIANCE",
"# SOFTWARE=gegl 0.4.12",
"# FORMAT=32-bit_rle_rgbe",
"#",
"# -Y 1024 +X 2048",
"# Data... | https://github.com/cyberbotics/webots/blob/af7fa7d68dcf7b4550f1f2e132092b41e83698fc/scripts/image_tools/images/hdr.py#L32-L102 | |
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Draft/draftguitools/gui_snaps.py | python | Draft_Snap_Parallel.GetResources | (self) | return {'Pixmap': 'Snap_Parallel',
'MenuText': QT_TRANSLATE_NOOP("Draft_Snap_Parallel", "Parallel"),
'ToolTip': QT_TRANSLATE_NOOP("Draft_Snap_Parallel", "Set snapping to a direction that is parallel to an edge.")} | Set icon, menu and tooltip. | Set icon, menu and tooltip. | [
"Set",
"icon",
"menu",
"and",
"tooltip",
"."
] | def GetResources(self):
"""Set icon, menu and tooltip."""
return {'Pixmap': 'Snap_Parallel',
'MenuText': QT_TRANSLATE_NOOP("Draft_Snap_Parallel", "Parallel"),
'ToolTip': QT_TRANSLATE_NOOP("Draft_Snap_Parallel", "Set snapping to a direction that is parallel to an edge.")} | [
"def",
"GetResources",
"(",
"self",
")",
":",
"return",
"{",
"'Pixmap'",
":",
"'Snap_Parallel'",
",",
"'MenuText'",
":",
"QT_TRANSLATE_NOOP",
"(",
"\"Draft_Snap_Parallel\"",
",",
"\"Parallel\"",
")",
",",
"'ToolTip'",
":",
"QT_TRANSLATE_NOOP",
"(",
"\"Draft_Snap_Par... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Draft/draftguitools/gui_snaps.py#L279-L284 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/optimize/optimize.py | python | brent | (func, args=(), brack=None, tol=1.48e-8, full_output=0, maxiter=500) | Given a function of one-variable and a possible bracket, return
the local minimum of the function isolated to a fractional precision
of tol.
Parameters
----------
func : callable f(x,*args)
Objective function.
args : tuple, optional
Additional arguments (if present).
brack :... | Given a function of one-variable and a possible bracket, return
the local minimum of the function isolated to a fractional precision
of tol. | [
"Given",
"a",
"function",
"of",
"one",
"-",
"variable",
"and",
"a",
"possible",
"bracket",
"return",
"the",
"local",
"minimum",
"of",
"the",
"function",
"isolated",
"to",
"a",
"fractional",
"precision",
"of",
"tol",
"."
] | def brent(func, args=(), brack=None, tol=1.48e-8, full_output=0, maxiter=500):
"""
Given a function of one-variable and a possible bracket, return
the local minimum of the function isolated to a fractional precision
of tol.
Parameters
----------
func : callable f(x,*args)
Objective ... | [
"def",
"brent",
"(",
"func",
",",
"args",
"=",
"(",
")",
",",
"brack",
"=",
"None",
",",
"tol",
"=",
"1.48e-8",
",",
"full_output",
"=",
"0",
",",
"maxiter",
"=",
"500",
")",
":",
"options",
"=",
"{",
"'xtol'",
":",
"tol",
",",
"'maxiter'",
":",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/optimize/optimize.py#L2011-L2087 | ||
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/python/mozbuild/mozbuild/preprocessor.py | python | Expression.evaluate | (self, context) | return opmap[self.e.type](self.e) | Evaluate the expression with the given context | Evaluate the expression with the given context | [
"Evaluate",
"the",
"expression",
"with",
"the",
"given",
"context"
] | def evaluate(self, context):
"""
Evaluate the expression with the given context
"""
# Helper function to evaluate __get_equality results
def eval_equality(tok):
left = opmap[tok[0].type](tok[0])
right = opmap[tok[2].type](tok[2])
rv = left == ... | [
"def",
"evaluate",
"(",
"self",
",",
"context",
")",
":",
"# Helper function to evaluate __get_equality results",
"def",
"eval_equality",
"(",
"tok",
")",
":",
"left",
"=",
"opmap",
"[",
"tok",
"[",
"0",
"]",
".",
"type",
"]",
"(",
"tok",
"[",
"0",
"]",
... | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/python/mozbuild/mozbuild/preprocessor.py#L179-L212 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_aarch64/python2.7/dist-packages/yaml/__init__.py | python | add_multi_representer | (data_type, multi_representer, Dumper=Dumper) | Add a representer for the given type.
Multi-representer is a function accepting a Dumper instance
and an instance of the given data type or subtype
and producing the corresponding representation node. | Add a representer for the given type.
Multi-representer is a function accepting a Dumper instance
and an instance of the given data type or subtype
and producing the corresponding representation node. | [
"Add",
"a",
"representer",
"for",
"the",
"given",
"type",
".",
"Multi",
"-",
"representer",
"is",
"a",
"function",
"accepting",
"a",
"Dumper",
"instance",
"and",
"an",
"instance",
"of",
"the",
"given",
"data",
"type",
"or",
"subtype",
"and",
"producing",
"... | def add_multi_representer(data_type, multi_representer, Dumper=Dumper):
"""
Add a representer for the given type.
Multi-representer is a function accepting a Dumper instance
and an instance of the given data type or subtype
and producing the corresponding representation node.
"""
Dumper.add_... | [
"def",
"add_multi_representer",
"(",
"data_type",
",",
"multi_representer",
",",
"Dumper",
"=",
"Dumper",
")",
":",
"Dumper",
".",
"add_multi_representer",
"(",
"data_type",
",",
"multi_representer",
")"
] | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_aarch64/python2.7/dist-packages/yaml/__init__.py#L267-L274 | ||
openweave/openweave-core | 11ceb6b7efd39fe05de7f79229247a5774d56766 | src/device-manager/python/weave-device-mgr.py | python | DeviceMgrCmd.do_stopsystemtest | (self, line) | stop-system-test
Stop system test on a device. | stop-system-test | [
"stop",
"-",
"system",
"-",
"test"
] | def do_stopsystemtest(self, line):
"""
stop-system-test
Stop system test on a device.
"""
args = shlex.split(line)
if (len(args) != 0):
print("Usage:")
self.do_help('stop-system-test')
return
try:
self.devMgr... | [
"def",
"do_stopsystemtest",
"(",
"self",
",",
"line",
")",
":",
"args",
"=",
"shlex",
".",
"split",
"(",
"line",
")",
"if",
"(",
"len",
"(",
"args",
")",
"!=",
"0",
")",
":",
"print",
"(",
"\"Usage:\"",
")",
"self",
".",
"do_help",
"(",
"'stop-syst... | https://github.com/openweave/openweave-core/blob/11ceb6b7efd39fe05de7f79229247a5774d56766/src/device-manager/python/weave-device-mgr.py#L2493-L2513 | ||
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/avoid-flood-in-the-city.py | python | Solution.avoidFlood | (self, rains) | return result if not min_heap else [] | :type rains: List[int]
:rtype: List[int] | :type rains: List[int]
:rtype: List[int] | [
":",
"type",
"rains",
":",
"List",
"[",
"int",
"]",
":",
"rtype",
":",
"List",
"[",
"int",
"]"
] | def avoidFlood(self, rains):
"""
:type rains: List[int]
:rtype: List[int]
"""
lookup = collections.defaultdict(list)
i = len(rains)-1
for lake in reversed(rains):
lookup[lake].append(i)
i -= 1
result, min_heap = [], []
for i... | [
"def",
"avoidFlood",
"(",
"self",
",",
"rains",
")",
":",
"lookup",
"=",
"collections",
".",
"defaultdict",
"(",
"list",
")",
"i",
"=",
"len",
"(",
"rains",
")",
"-",
"1",
"for",
"lake",
"in",
"reversed",
"(",
"rains",
")",
":",
"lookup",
"[",
"lak... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/avoid-flood-in-the-city.py#L9-L33 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/delayedresult.py | python | PreProcessChain.addSub | (self, callable, *args, **kwargs) | Add a sub-callable, ie a `callable(result, *args, **kwargs)`
that returns a transformed result to the previously added
sub-callable (or the handler given at construction, if this is
the first call to addSub). | Add a sub-callable, ie a `callable(result, *args, **kwargs)`
that returns a transformed result to the previously added
sub-callable (or the handler given at construction, if this is
the first call to addSub). | [
"Add",
"a",
"sub",
"-",
"callable",
"ie",
"a",
"callable",
"(",
"result",
"*",
"args",
"**",
"kwargs",
")",
"that",
"returns",
"a",
"transformed",
"result",
"to",
"the",
"previously",
"added",
"sub",
"-",
"callable",
"(",
"or",
"the",
"handler",
"given",... | def addSub(self, callable, *args, **kwargs):
"""Add a sub-callable, ie a `callable(result, *args, **kwargs)`
that returns a transformed result to the previously added
sub-callable (or the handler given at construction, if this is
the first call to addSub). """
self.__chain.appen... | [
"def",
"addSub",
"(",
"self",
",",
"callable",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"__chain",
".",
"append",
"(",
"Handler",
"(",
"callable",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/delayedresult.py#L365-L370 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/rnn/python/ops/rnn_cell.py | python | AttentionCellWrapper.__init__ | (self,
cell,
attn_length,
attn_size=None,
attn_vec_size=None,
input_size=None,
state_is_tuple=True,
reuse=None) | Create a cell with attention.
Args:
cell: an RNNCell, an attention is added to it.
attn_length: integer, the size of an attention window.
attn_size: integer, the size of an attention vector. Equal to
cell.output_size by default.
attn_vec_size: integer, the number of convolutional ... | Create a cell with attention. | [
"Create",
"a",
"cell",
"with",
"attention",
"."
] | def __init__(self,
cell,
attn_length,
attn_size=None,
attn_vec_size=None,
input_size=None,
state_is_tuple=True,
reuse=None):
"""Create a cell with attention.
Args:
cell: an RNNCell, an attention is ad... | [
"def",
"__init__",
"(",
"self",
",",
"cell",
",",
"attn_length",
",",
"attn_size",
"=",
"None",
",",
"attn_vec_size",
"=",
"None",
",",
"input_size",
"=",
"None",
",",
"state_is_tuple",
"=",
"True",
",",
"reuse",
"=",
"None",
")",
":",
"super",
"(",
"A... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/rnn/python/ops/rnn_cell.py#L1121-L1179 | ||
panda3d/panda3d | 833ad89ebad58395d0af0b7ec08538e5e4308265 | direct/src/distributed/ClientRepositoryBase.py | python | ClientRepositoryBase.getObjectsOfClass | (self, objClass) | return doDict | returns dict of doId:object, containing all objects
that inherit from 'class'. returned dict is safely mutable. | returns dict of doId:object, containing all objects
that inherit from 'class'. returned dict is safely mutable. | [
"returns",
"dict",
"of",
"doId",
":",
"object",
"containing",
"all",
"objects",
"that",
"inherit",
"from",
"class",
".",
"returned",
"dict",
"is",
"safely",
"mutable",
"."
] | def getObjectsOfClass(self, objClass):
""" returns dict of doId:object, containing all objects
that inherit from 'class'. returned dict is safely mutable. """
doDict = {}
for doId, do in self.doId2do.items():
if isinstance(do, objClass):
doDict[doId] = do
... | [
"def",
"getObjectsOfClass",
"(",
"self",
",",
"objClass",
")",
":",
"doDict",
"=",
"{",
"}",
"for",
"doId",
",",
"do",
"in",
"self",
".",
"doId2do",
".",
"items",
"(",
")",
":",
"if",
"isinstance",
"(",
"do",
",",
"objClass",
")",
":",
"doDict",
"[... | https://github.com/panda3d/panda3d/blob/833ad89ebad58395d0af0b7ec08538e5e4308265/direct/src/distributed/ClientRepositoryBase.py#L516-L523 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_misc.py | python | CustomDataObject.GetData | (*args, **kwargs) | return _misc_.CustomDataObject_GetData(*args, **kwargs) | GetData(self) -> String
Returns the data bytes from the data object as a string. | GetData(self) -> String | [
"GetData",
"(",
"self",
")",
"-",
">",
"String"
] | def GetData(*args, **kwargs):
"""
GetData(self) -> String
Returns the data bytes from the data object as a string.
"""
return _misc_.CustomDataObject_GetData(*args, **kwargs) | [
"def",
"GetData",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"CustomDataObject_GetData",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_misc.py#L5398-L5404 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py3/numpy/lib/scimath.py | python | _fix_int_lt_zero | (x) | return x | Convert `x` to double if it has real, negative components.
Otherwise, output is just the array version of the input (via asarray).
Parameters
----------
x : array_like
Returns
-------
array
Examples
--------
>>> np.lib.scimath._fix_int_lt_zero([1,2])
array([1, 2])
>>... | Convert `x` to double if it has real, negative components. | [
"Convert",
"x",
"to",
"double",
"if",
"it",
"has",
"real",
"negative",
"components",
"."
] | def _fix_int_lt_zero(x):
"""Convert `x` to double if it has real, negative components.
Otherwise, output is just the array version of the input (via asarray).
Parameters
----------
x : array_like
Returns
-------
array
Examples
--------
>>> np.lib.scimath._fix_int_lt_zero(... | [
"def",
"_fix_int_lt_zero",
"(",
"x",
")",
":",
"x",
"=",
"asarray",
"(",
"x",
")",
"if",
"any",
"(",
"isreal",
"(",
"x",
")",
"&",
"(",
"x",
"<",
"0",
")",
")",
":",
"x",
"=",
"x",
"*",
"1.0",
"return",
"x"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py3/numpy/lib/scimath.py#L141-L165 | |
google/zetasql | c2240edf7f20df40c1c810b520b5a3aab9626a97 | zetasql/resolved_ast/gen_resolved_ast.py | python | Field | (name,
ctype,
tag_id,
vector=False,
ignorable=NOT_IGNORABLE,
is_constructor_arg=True,
is_optional_constructor_arg=False,
to_string_method=None,
java_to_string_method=None,
comment=None,
propagate_order=False) | return {
'ctype': ctype,
'java_type': java_type,
'full_java_type': full_java_type,
'nullable_java_type': nullable_java_type,
'java_default': java_default,
'cpp_default': cpp_default,
'tag_id': tag_id,
'member_name': member_name, # member variable name
'name': name,... | Make a field to put in a node class.
Args:
name: field name
ctype: c++ type for this field
Should be a ScalarType like an int, string or enum type,
or the name of a node class type (e.g. ResolvedProjectScan).
Cannot be a pointer type, and should not include modifiers like
... | Make a field to put in a node class. | [
"Make",
"a",
"field",
"to",
"put",
"in",
"a",
"node",
"class",
"."
] | def Field(name,
ctype,
tag_id,
vector=False,
ignorable=NOT_IGNORABLE,
is_constructor_arg=True,
is_optional_constructor_arg=False,
to_string_method=None,
java_to_string_method=None,
comment=None,
propagate_order=False):
... | [
"def",
"Field",
"(",
"name",
",",
"ctype",
",",
"tag_id",
",",
"vector",
"=",
"False",
",",
"ignorable",
"=",
"NOT_IGNORABLE",
",",
"is_constructor_arg",
"=",
"True",
",",
"is_optional_constructor_arg",
"=",
"False",
",",
"to_string_method",
"=",
"None",
",",
... | https://github.com/google/zetasql/blob/c2240edf7f20df40c1c810b520b5a3aab9626a97/zetasql/resolved_ast/gen_resolved_ast.py#L223-L452 | |
macchina-io/macchina.io | ef24ba0e18379c3dd48fb84e6dbf991101cb8db0 | platform/JS/V8/v8/third_party/jinja2/environment.py | python | Environment.compile_expression | (self, source, undefined_to_none=True) | return TemplateExpression(template, undefined_to_none) | A handy helper method that returns a callable that accepts keyword
arguments that appear as variables in the expression. If called it
returns the result of the expression.
This is useful if applications want to use the same rules as Jinja
in template "configuration files" or similar si... | A handy helper method that returns a callable that accepts keyword
arguments that appear as variables in the expression. If called it
returns the result of the expression. | [
"A",
"handy",
"helper",
"method",
"that",
"returns",
"a",
"callable",
"that",
"accepts",
"keyword",
"arguments",
"that",
"appear",
"as",
"variables",
"in",
"the",
"expression",
".",
"If",
"called",
"it",
"returns",
"the",
"result",
"of",
"the",
"expression",
... | def compile_expression(self, source, undefined_to_none=True):
"""A handy helper method that returns a callable that accepts keyword
arguments that appear as variables in the expression. If called it
returns the result of the expression.
This is useful if applications want to use the sa... | [
"def",
"compile_expression",
"(",
"self",
",",
"source",
",",
"undefined_to_none",
"=",
"True",
")",
":",
"parser",
"=",
"Parser",
"(",
"self",
",",
"source",
",",
"state",
"=",
"'variable'",
")",
"exc_info",
"=",
"None",
"try",
":",
"expr",
"=",
"parser... | https://github.com/macchina-io/macchina.io/blob/ef24ba0e18379c3dd48fb84e6dbf991101cb8db0/platform/JS/V8/v8/third_party/jinja2/environment.py#L567-L610 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/botocore/session.py | python | Session.__init__ | (self, session_vars=None, event_hooks=None,
include_builtin_handlers=True, profile=None) | Create a new Session object.
:type session_vars: dict
:param session_vars: A dictionary that is used to override some or all
of the environment variables associated with this session. The
key/value pairs defined in this dictionary will override the
corresponding var... | Create a new Session object. | [
"Create",
"a",
"new",
"Session",
"object",
"."
] | def __init__(self, session_vars=None, event_hooks=None,
include_builtin_handlers=True, profile=None):
"""
Create a new Session object.
:type session_vars: dict
:param session_vars: A dictionary that is used to override some or all
of the environment variable... | [
"def",
"__init__",
"(",
"self",
",",
"session_vars",
"=",
"None",
",",
"event_hooks",
"=",
"None",
",",
"include_builtin_handlers",
"=",
"True",
",",
"profile",
"=",
"None",
")",
":",
"if",
"event_hooks",
"is",
"None",
":",
"self",
".",
"_original_handler",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/botocore/session.py#L73-L128 | ||
TimoSaemann/caffe-segnet-cudnn5 | abcf30dca449245e101bf4ced519f716177f0885 | scripts/cpp_lint.py | python | ParseArguments | (args) | return filenames | Parses the command line arguments.
This may set the output format and verbosity level as side-effects.
Args:
args: The command line arguments:
Returns:
The list of filenames to lint. | Parses the command line arguments. | [
"Parses",
"the",
"command",
"line",
"arguments",
"."
] | def ParseArguments(args):
"""Parses the command line arguments.
This may set the output format and verbosity level as side-effects.
Args:
args: The command line arguments:
Returns:
The list of filenames to lint.
"""
try:
(opts, filenames) = getopt.getopt(args, '', ['help', 'output=', 'verbose... | [
"def",
"ParseArguments",
"(",
"args",
")",
":",
"try",
":",
"(",
"opts",
",",
"filenames",
")",
"=",
"getopt",
".",
"getopt",
"(",
"args",
",",
"''",
",",
"[",
"'help'",
",",
"'output='",
",",
"'verbose='",
",",
"'counting='",
",",
"'filter='",
",",
... | https://github.com/TimoSaemann/caffe-segnet-cudnn5/blob/abcf30dca449245e101bf4ced519f716177f0885/scripts/cpp_lint.py#L4779-L4846 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.