nwo stringlengths 5 86 | sha stringlengths 40 40 | path stringlengths 4 189 | language stringclasses 1
value | identifier stringlengths 1 94 | parameters stringlengths 2 4.03k | argument_list stringclasses 1
value | return_statement stringlengths 0 11.5k | docstring stringlengths 1 33.2k | docstring_summary stringlengths 0 5.15k | docstring_tokens list | function stringlengths 34 151k | function_tokens list | url stringlengths 90 278 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/ops/image_ops_impl.py | python | flip_left_right | (image) | return fix_image_flip_shape(image, array_ops.reverse(image, [1])) | Flip an image horizontally (left to right).
Outputs the contents of `image` flipped along the second dimension, which is
`width`.
See also `reverse()`.
Args:
image: A 3-D tensor of shape `[height, width, channels].`
Returns:
A 3-D tensor of the same type and shape as `image`.
Raises:
ValueE... | Flip an image horizontally (left to right). | [
"Flip",
"an",
"image",
"horizontally",
"(",
"left",
"to",
"right",
")",
"."
] | def flip_left_right(image):
"""Flip an image horizontally (left to right).
Outputs the contents of `image` flipped along the second dimension, which is
`width`.
See also `reverse()`.
Args:
image: A 3-D tensor of shape `[height, width, channels].`
Returns:
A 3-D tensor of the same type and shape ... | [
"def",
"flip_left_right",
"(",
"image",
")",
":",
"image",
"=",
"ops",
".",
"convert_to_tensor",
"(",
"image",
",",
"name",
"=",
"'image'",
")",
"image",
"=",
"control_flow_ops",
".",
"with_dependencies",
"(",
"_Check3DImage",
"(",
"image",
",",
"require_stati... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/ops/image_ops_impl.py#L262-L282 | |
InteractiveComputerGraphics/PositionBasedDynamics | 136469f03f7869666d907ea8d27872b098715f4a | extern/pybind/pybind11/setup_helpers.py | python | tmp_chdir | () | Prepare and enter a temporary directory, cleanup when done | Prepare and enter a temporary directory, cleanup when done | [
"Prepare",
"and",
"enter",
"a",
"temporary",
"directory",
"cleanup",
"when",
"done"
] | def tmp_chdir():
"Prepare and enter a temporary directory, cleanup when done"
# Threadsafe
with tmp_chdir_lock:
olddir = os.getcwd()
try:
tmpdir = tempfile.mkdtemp()
os.chdir(tmpdir)
yield tmpdir
finally:
os.chdir(olddir)
s... | [
"def",
"tmp_chdir",
"(",
")",
":",
"# Threadsafe",
"with",
"tmp_chdir_lock",
":",
"olddir",
"=",
"os",
".",
"getcwd",
"(",
")",
"try",
":",
"tmpdir",
"=",
"tempfile",
".",
"mkdtemp",
"(",
")",
"os",
".",
"chdir",
"(",
"tmpdir",
")",
"yield",
"tmpdir",
... | https://github.com/InteractiveComputerGraphics/PositionBasedDynamics/blob/136469f03f7869666d907ea8d27872b098715f4a/extern/pybind/pybind11/setup_helpers.py#L209-L221 | ||
apple/swift-lldb | d74be846ef3e62de946df343e8c234bde93a8912 | scripts/Python/static-binding/lldb.py | python | SBStream.write | (self, str) | return _lldb.SBStream_write(self, str) | write(SBStream self, char const * str) | write(SBStream self, char const * str) | [
"write",
"(",
"SBStream",
"self",
"char",
"const",
"*",
"str",
")"
] | def write(self, str):
"""write(SBStream self, char const * str)"""
return _lldb.SBStream_write(self, str) | [
"def",
"write",
"(",
"self",
",",
"str",
")",
":",
"return",
"_lldb",
".",
"SBStream_write",
"(",
"self",
",",
"str",
")"
] | https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/scripts/Python/static-binding/lldb.py#L9570-L9572 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/requests/sessions.py | python | Session.close | (self) | Closes all adapters and as such the session | Closes all adapters and as such the session | [
"Closes",
"all",
"adapters",
"and",
"as",
"such",
"the",
"session"
] | def close(self):
"""Closes all adapters and as such the session"""
for v in self.adapters.values():
v.close() | [
"def",
"close",
"(",
"self",
")",
":",
"for",
"v",
"in",
"self",
".",
"adapters",
".",
"values",
"(",
")",
":",
"v",
".",
"close",
"(",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/requests/sessions.py#L705-L708 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/packaging/_compat.py | python | with_metaclass | (meta, *bases) | return type.__new__(metaclass, "temporary_class", (), {}) | Create a base class with a metaclass. | Create a base class with a metaclass. | [
"Create",
"a",
"base",
"class",
"with",
"a",
"metaclass",
"."
] | def with_metaclass(meta, *bases):
# type: (Type[Any], Tuple[Type[Any], ...]) -> Any
"""
Create a base class with a metaclass.
"""
# This requires a bit of explanation: the basic idea is to make a dummy
# metaclass for one level of class instantiation that replaces itself with
# the actual me... | [
"def",
"with_metaclass",
"(",
"meta",
",",
"*",
"bases",
")",
":",
"# type: (Type[Any], Tuple[Type[Any], ...]) -> Any",
"# This requires a bit of explanation: the basic idea is to make a dummy",
"# metaclass for one level of class instantiation that replaces itself with",
"# the actual metac... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/packaging/_compat.py#L25-L38 | |
CRYTEK/CRYENGINE | 232227c59a220cbbd311576f0fbeba7bb53b2a8c | Editor/Python/windows/Lib/site-packages/setuptools/package_index.py | python | find_external_links | (url, page) | Find rel="homepage" and rel="download" links in `page`, yielding URLs | Find rel="homepage" and rel="download" links in `page`, yielding URLs | [
"Find",
"rel",
"=",
"homepage",
"and",
"rel",
"=",
"download",
"links",
"in",
"page",
"yielding",
"URLs"
] | def find_external_links(url, page):
"""Find rel="homepage" and rel="download" links in `page`, yielding URLs"""
for match in REL.finditer(page):
tag, rel = match.groups()
rels = set(map(str.strip, rel.lower().split(',')))
if 'homepage' in rels or 'download' in rels:
for matc... | [
"def",
"find_external_links",
"(",
"url",
",",
"page",
")",
":",
"for",
"match",
"in",
"REL",
".",
"finditer",
"(",
"page",
")",
":",
"tag",
",",
"rel",
"=",
"match",
".",
"groups",
"(",
")",
"rels",
"=",
"set",
"(",
"map",
"(",
"str",
".",
"stri... | https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Editor/Python/windows/Lib/site-packages/setuptools/package_index.py#L222-L237 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/scipy/interpolate/interpolate.py | python | _PPolyBase.construct_fast | (cls, c, x, extrapolate=None, axis=0) | return self | Construct the piecewise polynomial without making checks.
Takes the same parameters as the constructor. Input arguments
`c` and `x` must be arrays of the correct shape and type. The
`c` array can only be of dtypes float and complex, and `x`
array must have dtype float. | Construct the piecewise polynomial without making checks. | [
"Construct",
"the",
"piecewise",
"polynomial",
"without",
"making",
"checks",
"."
] | def construct_fast(cls, c, x, extrapolate=None, axis=0):
"""
Construct the piecewise polynomial without making checks.
Takes the same parameters as the constructor. Input arguments
`c` and `x` must be arrays of the correct shape and type. The
`c` array can only be of dtypes flo... | [
"def",
"construct_fast",
"(",
"cls",
",",
"c",
",",
"x",
",",
"extrapolate",
"=",
"None",
",",
"axis",
"=",
"0",
")",
":",
"self",
"=",
"object",
".",
"__new__",
"(",
"cls",
")",
"self",
".",
"c",
"=",
"c",
"self",
".",
"x",
"=",
"x",
"self",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/scipy/interpolate/interpolate.py#L686-L702 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/quopri.py | python | unhex | (s) | return bits | Get the integer value of a hexadecimal number. | Get the integer value of a hexadecimal number. | [
"Get",
"the",
"integer",
"value",
"of",
"a",
"hexadecimal",
"number",
"."
] | def unhex(s):
"""Get the integer value of a hexadecimal number."""
bits = 0
for c in s:
c = bytes((c,))
if b'0' <= c <= b'9':
i = ord('0')
elif b'a' <= c <= b'f':
i = ord('a')-10
elif b'A' <= c <= b'F':
i = ord(b'A')-10
else:
... | [
"def",
"unhex",
"(",
"s",
")",
":",
"bits",
"=",
"0",
"for",
"c",
"in",
"s",
":",
"c",
"=",
"bytes",
"(",
"(",
"c",
",",
")",
")",
"if",
"b'0'",
"<=",
"c",
"<=",
"b'9'",
":",
"i",
"=",
"ord",
"(",
"'0'",
")",
"elif",
"b'a'",
"<=",
"c",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/quopri.py#L177-L191 | |
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | gpu/command_buffer/build_gles2_cmd_buffer.py | python | HandWrittenHandler.WriteServiceImplementation | (self, func, file) | Overrriden from TypeHandler. | Overrriden from TypeHandler. | [
"Overrriden",
"from",
"TypeHandler",
"."
] | def WriteServiceImplementation(self, func, file):
"""Overrriden from TypeHandler."""
pass | [
"def",
"WriteServiceImplementation",
"(",
"self",
",",
"func",
",",
"file",
")",
":",
"pass"
] | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/gpu/command_buffer/build_gles2_cmd_buffer.py#L2453-L2455 | ||
apache/thrift | 0b29261a4f3c6882ef3b09aae47914f0012b0472 | lib/py/src/transport/TSocket.py | python | TSocket.__init__ | (self, host='localhost', port=9090, unix_socket=None,
socket_family=socket.AF_UNSPEC,
socket_keepalive=False) | Initialize a TSocket
@param host(str) The host to connect to.
@param port(int) The (TCP) port to connect to.
@param unix_socket(str) The filename of a unix socket to connect to.
(host and port will be ignored.)
@param socket_family(int) The socket fa... | Initialize a TSocket | [
"Initialize",
"a",
"TSocket"
] | def __init__(self, host='localhost', port=9090, unix_socket=None,
socket_family=socket.AF_UNSPEC,
socket_keepalive=False):
"""Initialize a TSocket
@param host(str) The host to connect to.
@param port(int) The (TCP) port to connect to.
@param unix_sock... | [
"def",
"__init__",
"(",
"self",
",",
"host",
"=",
"'localhost'",
",",
"port",
"=",
"9090",
",",
"unix_socket",
"=",
"None",
",",
"socket_family",
"=",
"socket",
".",
"AF_UNSPEC",
",",
"socket_keepalive",
"=",
"False",
")",
":",
"self",
".",
"host",
"=",
... | https://github.com/apache/thrift/blob/0b29261a4f3c6882ef3b09aae47914f0012b0472/lib/py/src/transport/TSocket.py#L53-L71 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/distutils/cmd.py | python | Command.announce | (self, msg, level=1) | If the current verbosity level is of greater than or equal to
'level' print 'msg' to stdout. | If the current verbosity level is of greater than or equal to
'level' print 'msg' to stdout. | [
"If",
"the",
"current",
"verbosity",
"level",
"is",
"of",
"greater",
"than",
"or",
"equal",
"to",
"level",
"print",
"msg",
"to",
"stdout",
"."
] | def announce(self, msg, level=1):
"""If the current verbosity level is of greater than or equal to
'level' print 'msg' to stdout.
"""
log.log(level, msg) | [
"def",
"announce",
"(",
"self",
",",
"msg",
",",
"level",
"=",
"1",
")",
":",
"log",
".",
"log",
"(",
"level",
",",
"msg",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/distutils/cmd.py#L180-L184 | ||
LiquidPlayer/LiquidCore | 9405979363f2353ac9a71ad8ab59685dd7f919c9 | deps/boost_1_66_0/libs/python/config/tools/sphinx4scons.py | python | _get_sphinxoptions | (env, target, source) | return " ".join(options) | Concatenates all the options for the sphinx command line. | Concatenates all the options for the sphinx command line. | [
"Concatenates",
"all",
"the",
"options",
"for",
"the",
"sphinx",
"command",
"line",
"."
] | def _get_sphinxoptions(env, target, source):
"""Concatenates all the options for the sphinx command line."""
options = []
builder = _get_sphinxbuilder(env)
options.append("-b %s" % env.subst(builder, target=target, source=source))
flags = env.get('options', env.get('SPHINXFLAGS', ''))
options.... | [
"def",
"_get_sphinxoptions",
"(",
"env",
",",
"target",
",",
"source",
")",
":",
"options",
"=",
"[",
"]",
"builder",
"=",
"_get_sphinxbuilder",
"(",
"env",
")",
"options",
".",
"append",
"(",
"\"-b %s\"",
"%",
"env",
".",
"subst",
"(",
"builder",
",",
... | https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/boost_1_66_0/libs/python/config/tools/sphinx4scons.py#L142-L181 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/integrate/quadpack.py | python | dblquad | (func, a, b, gfun, hfun, args=(), epsabs=1.49e-8, epsrel=1.49e-8) | return nquad(func, [temp_ranges, [a, b]], args=args,
opts={"epsabs": epsabs, "epsrel": epsrel}) | Compute a double integral.
Return the double (definite) integral of ``func(y, x)`` from ``x = a..b``
and ``y = gfun(x)..hfun(x)``.
Parameters
----------
func : callable
A Python function or method of at least two variables: y must be the
first argument and x the second argument.
... | Compute a double integral. | [
"Compute",
"a",
"double",
"integral",
"."
] | def dblquad(func, a, b, gfun, hfun, args=(), epsabs=1.49e-8, epsrel=1.49e-8):
"""
Compute a double integral.
Return the double (definite) integral of ``func(y, x)`` from ``x = a..b``
and ``y = gfun(x)..hfun(x)``.
Parameters
----------
func : callable
A Python function or method of ... | [
"def",
"dblquad",
"(",
"func",
",",
"a",
",",
"b",
",",
"gfun",
",",
"hfun",
",",
"args",
"=",
"(",
")",
",",
"epsabs",
"=",
"1.49e-8",
",",
"epsrel",
"=",
"1.49e-8",
")",
":",
"def",
"temp_ranges",
"(",
"*",
"args",
")",
":",
"return",
"[",
"g... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/integrate/quadpack.py#L515-L581 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/propgrid.py | python | PropertyGridIteratorBase.Prev | (*args, **kwargs) | return _propgrid.PropertyGridIteratorBase_Prev(*args, **kwargs) | Prev(self) | Prev(self) | [
"Prev",
"(",
"self",
")"
] | def Prev(*args, **kwargs):
"""Prev(self)"""
return _propgrid.PropertyGridIteratorBase_Prev(*args, **kwargs) | [
"def",
"Prev",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_propgrid",
".",
"PropertyGridIteratorBase_Prev",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/propgrid.py#L954-L956 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | demo/PropertyGrid.py | python | TrivialPropertyEditor.CreateControls | (self, propgrid, property, pos, sz) | Create the actual wxPython controls here for editing the
property value.
You must use propgrid.GetPanel() as parent for created controls.
Return value is either single editor control or tuple of two
editor controls, of which first is the primary one and second
... | Create the actual wxPython controls here for editing the
property value. | [
"Create",
"the",
"actual",
"wxPython",
"controls",
"here",
"for",
"editing",
"the",
"property",
"value",
"."
] | def CreateControls(self, propgrid, property, pos, sz):
""" Create the actual wxPython controls here for editing the
property value.
You must use propgrid.GetPanel() as parent for created controls.
Return value is either single editor control or tuple of two
edit... | [
"def",
"CreateControls",
"(",
"self",
",",
"propgrid",
",",
"property",
",",
"pos",
",",
"sz",
")",
":",
"try",
":",
"x",
",",
"y",
"=",
"pos",
"w",
",",
"h",
"=",
"sz",
"h",
"=",
"64",
"+",
"6",
"# Make room for button",
"bw",
"=",
"propgrid",
"... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/demo/PropertyGrid.py#L399-L429 | ||
MrMC/mrmc | 5a8e460b2aec44f03eb9604cbd7681d4277dbb81 | tools/EventClients/lib/python/xbmcclient.py | python | Packet.get_udp_message | (self, packetnum=1) | return header + payload | Construct the UDP message for the specified packetnum and return
as string
Keyword arguments:
packetnum -- the packet no. for which to construct the message
(default 1) | Construct the UDP message for the specified packetnum and return
as string | [
"Construct",
"the",
"UDP",
"message",
"for",
"the",
"specified",
"packetnum",
"and",
"return",
"as",
"string"
] | def get_udp_message(self, packetnum=1):
"""Construct the UDP message for the specified packetnum and return
as string
Keyword arguments:
packetnum -- the packet no. for which to construct the message
(default 1)
"""
if packetnum > self.num_packets() ... | [
"def",
"get_udp_message",
"(",
"self",
",",
"packetnum",
"=",
"1",
")",
":",
"if",
"packetnum",
">",
"self",
".",
"num_packets",
"(",
")",
"or",
"packetnum",
"<",
"1",
":",
"return",
"\"\"",
"header",
"=",
"\"\"",
"if",
"packetnum",
"==",
"1",
":",
"... | https://github.com/MrMC/mrmc/blob/5a8e460b2aec44f03eb9604cbd7681d4277dbb81/tools/EventClients/lib/python/xbmcclient.py#L219-L240 | |
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/contrib/graph_editor/subgraph.py | python | SubGraphView.remap_outputs | (self, new_output_indices) | return res | Remap the output of the subgraph.
If the output of the original subgraph are [t0, t1, t2], remapping to
[1,1,0] will create a new instance whose outputs is [t1, t1, t0].
Note that this is only modifying the view: the underlying tf.Graph is not
affected.
Args:
new_output_indices: an iterable... | Remap the output of the subgraph. | [
"Remap",
"the",
"output",
"of",
"the",
"subgraph",
"."
] | def remap_outputs(self, new_output_indices):
"""Remap the output of the subgraph.
If the output of the original subgraph are [t0, t1, t2], remapping to
[1,1,0] will create a new instance whose outputs is [t1, t1, t0].
Note that this is only modifying the view: the underlying tf.Graph is not
affect... | [
"def",
"remap_outputs",
"(",
"self",
",",
"new_output_indices",
")",
":",
"res",
"=",
"copy",
".",
"copy",
"(",
"self",
")",
"res",
".",
"_remap_outputs",
"(",
"new_output_indices",
")",
"# pylint: disable=protected-access",
"return",
"res"
] | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/contrib/graph_editor/subgraph.py#L352-L371 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/ops/rnn.py | python | dynamic_rnn | (cell, inputs, sequence_length=None, initial_state=None,
dtype=None, parallel_iterations=None, swap_memory=False,
time_major=False, scope=None) | Creates a recurrent neural network specified by RNNCell `cell`.
Performs fully dynamic unrolling of `inputs`.
`Inputs` may be a single `Tensor` where the maximum time is either the first
or second dimension (see the parameter
`time_major`). Alternatively, it may be a (possibly nested) tuple of
Tensors, eac... | Creates a recurrent neural network specified by RNNCell `cell`. | [
"Creates",
"a",
"recurrent",
"neural",
"network",
"specified",
"by",
"RNNCell",
"cell",
"."
] | def dynamic_rnn(cell, inputs, sequence_length=None, initial_state=None,
dtype=None, parallel_iterations=None, swap_memory=False,
time_major=False, scope=None):
"""Creates a recurrent neural network specified by RNNCell `cell`.
Performs fully dynamic unrolling of `inputs`.
`Inputs... | [
"def",
"dynamic_rnn",
"(",
"cell",
",",
"inputs",
",",
"sequence_length",
"=",
"None",
",",
"initial_state",
"=",
"None",
",",
"dtype",
"=",
"None",
",",
"parallel_iterations",
"=",
"None",
",",
"swap_memory",
"=",
"False",
",",
"time_major",
"=",
"False",
... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/ops/rnn.py#L443-L607 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/keras/engine/network.py | python | Network._insert_layers | (self, layers, relevant_nodes=None) | Inserts Layers into the Network after Network creation.
This is only valid for Keras Graph Networks. Layers added via this function
will be included in the `call` computation and `get_config` of this Network.
They will not be added to the Network's outputs.
Arguments:
layers: Arbitrary nested ... | Inserts Layers into the Network after Network creation. | [
"Inserts",
"Layers",
"into",
"the",
"Network",
"after",
"Network",
"creation",
"."
] | def _insert_layers(self, layers, relevant_nodes=None):
"""Inserts Layers into the Network after Network creation.
This is only valid for Keras Graph Networks. Layers added via this function
will be included in the `call` computation and `get_config` of this Network.
They will not be added to the Netwo... | [
"def",
"_insert_layers",
"(",
"self",
",",
"layers",
",",
"relevant_nodes",
"=",
"None",
")",
":",
"layers",
"=",
"nest",
".",
"flatten",
"(",
"layers",
")",
"tf_utils",
".",
"assert_no_legacy_layers",
"(",
"layers",
")",
"node_to_depth",
"=",
"{",
"}",
"f... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/keras/engine/network.py#L1519-L1593 | ||
vtraag/louvain-igraph | 124ea1be49ee74eec2eaca8006599d7fc5560db6 | src/louvain/VertexPartition.py | python | MutableVertexPartition.__init__ | (self, graph, initial_membership=None) | Parameters
----------
graph
The `ig.Graph` on which this partition is defined.
membership
The membership vector of this partition. Membership[i] = c implies that
node i is in community c. If None, it is initialised with a singleton
partition community, i.e. membership[i] = i. | Parameters
----------
graph
The `ig.Graph` on which this partition is defined. | [
"Parameters",
"----------",
"graph",
"The",
"ig",
".",
"Graph",
"on",
"which",
"this",
"partition",
"is",
"defined",
"."
] | def __init__(self, graph, initial_membership=None):
"""
Parameters
----------
graph
The `ig.Graph` on which this partition is defined.
membership
The membership vector of this partition. Membership[i] = c implies that
node i is in community c. If None, it is initialised with a sin... | [
"def",
"__init__",
"(",
"self",
",",
"graph",
",",
"initial_membership",
"=",
"None",
")",
":",
"if",
"initial_membership",
"is",
"not",
"None",
":",
"initial_membership",
"=",
"list",
"(",
"initial_membership",
")",
"super",
"(",
"MutableVertexPartition",
",",
... | https://github.com/vtraag/louvain-igraph/blob/124ea1be49ee74eec2eaca8006599d7fc5560db6/src/louvain/VertexPartition.py#L37-L52 | ||
panda3d/panda3d | 833ad89ebad58395d0af0b7ec08538e5e4308265 | direct/src/showbase/ShowBase.py | python | ShowBase.setSceneGraphAnalyzerMeter | (self, flag) | Turns on or off (according to flag) a standard frame rate
meter in the upper-right corner of the main window. | Turns on or off (according to flag) a standard frame rate
meter in the upper-right corner of the main window. | [
"Turns",
"on",
"or",
"off",
"(",
"according",
"to",
"flag",
")",
"a",
"standard",
"frame",
"rate",
"meter",
"in",
"the",
"upper",
"-",
"right",
"corner",
"of",
"the",
"main",
"window",
"."
] | def setSceneGraphAnalyzerMeter(self, flag):
"""
Turns on or off (according to flag) a standard frame rate
meter in the upper-right corner of the main window.
"""
if flag:
if not self.sceneGraphAnalyzerMeter:
self.sceneGraphAnalyzerMeter = SceneGraphAna... | [
"def",
"setSceneGraphAnalyzerMeter",
"(",
"self",
",",
"flag",
")",
":",
"if",
"flag",
":",
"if",
"not",
"self",
".",
"sceneGraphAnalyzerMeter",
":",
"self",
".",
"sceneGraphAnalyzerMeter",
"=",
"SceneGraphAnalyzerMeter",
"(",
"'sceneGraphAnalyzerMeter'",
",",
"self... | https://github.com/panda3d/panda3d/blob/833ad89ebad58395d0af0b7ec08538e5e4308265/direct/src/showbase/ShowBase.py#L1126-L1138 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/multiprocessing/connection.py | python | SocketClient | (address) | return conn | Return a connection object connected to the socket given by `address` | Return a connection object connected to the socket given by `address` | [
"Return",
"a",
"connection",
"object",
"connected",
"to",
"the",
"socket",
"given",
"by",
"address"
] | def SocketClient(address):
'''
Return a connection object connected to the socket given by `address`
'''
family = address_type(address)
s = socket.socket( getattr(socket, family) )
s.setblocking(True)
t = _init_timeout()
while 1:
try:
s.connect(address)
excep... | [
"def",
"SocketClient",
"(",
"address",
")",
":",
"family",
"=",
"address_type",
"(",
"address",
")",
"s",
"=",
"socket",
".",
"socket",
"(",
"getattr",
"(",
"socket",
",",
"family",
")",
")",
"s",
".",
"setblocking",
"(",
"True",
")",
"t",
"=",
"_ini... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/multiprocessing/connection.py#L286-L311 | |
mamedev/mame | 02cd26d37ee11191f3e311e19e805d872cb1e3a4 | 3rdparty/portmidi/pm_python/pyportmidi/midi.py | python | Input.close | (self) | closes a midi stream, flushing any pending buffers.
Input.close(): return None
PortMidi attempts to close open streams when the application
exits -- this is particularly difficult under Windows. | closes a midi stream, flushing any pending buffers.
Input.close(): return None | [
"closes",
"a",
"midi",
"stream",
"flushing",
"any",
"pending",
"buffers",
".",
"Input",
".",
"close",
"()",
":",
"return",
"None"
] | def close(self):
""" closes a midi stream, flushing any pending buffers.
Input.close(): return None
PortMidi attempts to close open streams when the application
exits -- this is particularly difficult under Windows.
"""
_check_init()
if not (self._input is None):... | [
"def",
"close",
"(",
"self",
")",
":",
"_check_init",
"(",
")",
"if",
"not",
"(",
"self",
".",
"_input",
"is",
"None",
")",
":",
"self",
".",
"_input",
".",
"Close",
"(",
")",
"self",
".",
"_input",
"=",
"None"
] | https://github.com/mamedev/mame/blob/02cd26d37ee11191f3e311e19e805d872cb1e3a4/3rdparty/portmidi/pm_python/pyportmidi/midi.py#L257-L267 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/protobuf/py3/google/protobuf/descriptor.py | python | Descriptor.EnumValueName | (self, enum, value) | return self.enum_types_by_name[enum].values_by_number[value].name | Returns the string name of an enum value.
This is just a small helper method to simplify a common operation.
Args:
enum: string name of the Enum.
value: int, value of the enum.
Returns:
string name of the enum value.
Raises:
KeyError if either the Enum doesn't exist or the va... | Returns the string name of an enum value. | [
"Returns",
"the",
"string",
"name",
"of",
"an",
"enum",
"value",
"."
] | def EnumValueName(self, enum, value):
"""Returns the string name of an enum value.
This is just a small helper method to simplify a common operation.
Args:
enum: string name of the Enum.
value: int, value of the enum.
Returns:
string name of the enum value.
Raises:
KeyErr... | [
"def",
"EnumValueName",
"(",
"self",
",",
"enum",
",",
"value",
")",
":",
"return",
"self",
".",
"enum_types_by_name",
"[",
"enum",
"]",
".",
"values_by_number",
"[",
"value",
"]",
".",
"name"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/protobuf/py3/google/protobuf/descriptor.py#L382-L398 | |
sdhash/sdhash | b9eff63e4e5867e910f41fd69032bbb1c94a2a5e | external/tools/build/v2/tools/common.py | python | reset | () | Clear the module state. This is mainly for testing purposes.
Note that this must be called _after_ resetting the module 'feature'. | Clear the module state. This is mainly for testing purposes.
Note that this must be called _after_ resetting the module 'feature'. | [
"Clear",
"the",
"module",
"state",
".",
"This",
"is",
"mainly",
"for",
"testing",
"purposes",
".",
"Note",
"that",
"this",
"must",
"be",
"called",
"_after_",
"resetting",
"the",
"module",
"feature",
"."
] | def reset ():
""" Clear the module state. This is mainly for testing purposes.
Note that this must be called _after_ resetting the module 'feature'.
"""
global __had_unspecified_value, __had_value, __declared_subfeature
global __init_loc
global __all_signatures, __debug_configuration, __... | [
"def",
"reset",
"(",
")",
":",
"global",
"__had_unspecified_value",
",",
"__had_value",
",",
"__declared_subfeature",
"global",
"__init_loc",
"global",
"__all_signatures",
",",
"__debug_configuration",
",",
"__show_configuration",
"# Stores toolsets without specified initializa... | https://github.com/sdhash/sdhash/blob/b9eff63e4e5867e910f41fd69032bbb1c94a2a5e/external/tools/build/v2/tools/common.py#L25-L68 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/summary/writer/writer.py | python | SummaryToEventTransformer.add_summary | (self, summary, global_step=None) | Adds a `Summary` protocol buffer to the event file.
This method wraps the provided summary in an `Event` protocol buffer
and adds it to the event file.
You can pass the result of evaluating any summary op, using
@{tf.Session.run} or
@{tf.Tensor.eval}, to this
function. Alternatively, you can p... | Adds a `Summary` protocol buffer to the event file. | [
"Adds",
"a",
"Summary",
"protocol",
"buffer",
"to",
"the",
"event",
"file",
"."
] | def add_summary(self, summary, global_step=None):
"""Adds a `Summary` protocol buffer to the event file.
This method wraps the provided summary in an `Event` protocol buffer
and adds it to the event file.
You can pass the result of evaluating any summary op, using
@{tf.Session.run} or
@{tf.Ten... | [
"def",
"add_summary",
"(",
"self",
",",
"summary",
",",
"global_step",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"summary",
",",
"bytes",
")",
":",
"summ",
"=",
"summary_pb2",
".",
"Summary",
"(",
")",
"summ",
".",
"ParseFromString",
"(",
"summary"... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/summary/writer/writer.py#L97-L138 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/distlib/_backport/tarfile.py | python | _Stream.tell | (self) | return self.pos | Return the stream's file pointer position. | Return the stream's file pointer position. | [
"Return",
"the",
"stream",
"s",
"file",
"pointer",
"position",
"."
] | def tell(self):
"""Return the stream's file pointer position.
"""
return self.pos | [
"def",
"tell",
"(",
"self",
")",
":",
"return",
"self",
".",
"pos"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/distlib/_backport/tarfile.py#L547-L550 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/array_ops.py | python | expand_dims | (input, axis=None, name=None, dim=None) | return expand_dims_v2(input, axis, name) | Inserts a dimension of 1 into a tensor's shape.
Given a tensor `input`, this operation inserts a dimension of 1 at the
dimension index `axis` of `input`'s shape. The dimension index `axis` starts
at zero; if you specify a negative number for `axis` it is counted backward
from the end.
This operation is usef... | Inserts a dimension of 1 into a tensor's shape. | [
"Inserts",
"a",
"dimension",
"of",
"1",
"into",
"a",
"tensor",
"s",
"shape",
"."
] | def expand_dims(input, axis=None, name=None, dim=None):
"""Inserts a dimension of 1 into a tensor's shape.
Given a tensor `input`, this operation inserts a dimension of 1 at the
dimension index `axis` of `input`'s shape. The dimension index `axis` starts
at zero; if you specify a negative number for `axis` it ... | [
"def",
"expand_dims",
"(",
"input",
",",
"axis",
"=",
"None",
",",
"name",
"=",
"None",
",",
"dim",
"=",
"None",
")",
":",
"axis",
"=",
"deprecation",
".",
"deprecated_argument_lookup",
"(",
"\"axis\"",
",",
"axis",
",",
"\"dim\"",
",",
"dim",
")",
"if... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/array_ops.py#L214-L265 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/linalg/linear_operator_circulant.py | python | _BaseLinearOperatorCirculant.block_depth | (self) | return self._block_depth | Depth of recursively defined circulant blocks defining this `Operator`.
With `A` the dense representation of this `Operator`,
`block_depth = 1` means `A` is symmetric circulant. For example,
```
A = |w z y x|
|x w z y|
|y x w z|
|z y x w|
```
`block_depth = 2` means ... | Depth of recursively defined circulant blocks defining this `Operator`. | [
"Depth",
"of",
"recursively",
"defined",
"circulant",
"blocks",
"defining",
"this",
"Operator",
"."
] | def block_depth(self):
"""Depth of recursively defined circulant blocks defining this `Operator`.
With `A` the dense representation of this `Operator`,
`block_depth = 1` means `A` is symmetric circulant. For example,
```
A = |w z y x|
|x w z y|
|y x w z|
|z y x w|
```... | [
"def",
"block_depth",
"(",
"self",
")",
":",
"return",
"self",
".",
"_block_depth"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/linalg/linear_operator_circulant.py#L145-L175 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/build/waf-1.7.13/waflib/Tools/gnu_dirs.py | python | configure | (conf) | Read the command-line options to set lots of variables in *conf.env*. The variables
BINDIR and LIBDIR will be overwritten. | Read the command-line options to set lots of variables in *conf.env*. The variables
BINDIR and LIBDIR will be overwritten. | [
"Read",
"the",
"command",
"-",
"line",
"options",
"to",
"set",
"lots",
"of",
"variables",
"in",
"*",
"conf",
".",
"env",
"*",
".",
"The",
"variables",
"BINDIR",
"and",
"LIBDIR",
"will",
"be",
"overwritten",
"."
] | def configure(conf):
"""
Read the command-line options to set lots of variables in *conf.env*. The variables
BINDIR and LIBDIR will be overwritten.
"""
def get_param(varname, default):
return getattr(Options.options, varname, '') or default
env = conf.env
env.LIBDIR = env.BINDIR = []
env.EXEC_PREFIX = get_pa... | [
"def",
"configure",
"(",
"conf",
")",
":",
"def",
"get_param",
"(",
"varname",
",",
"default",
")",
":",
"return",
"getattr",
"(",
"Options",
".",
"options",
",",
"varname",
",",
"''",
")",
"or",
"default",
"env",
"=",
"conf",
".",
"env",
"env",
".",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/build/waf-1.7.13/waflib/Tools/gnu_dirs.py#L70-L98 | ||
apple/swift-clang | d7403439fc6641751840b723e7165fb02f52db95 | bindings/python/clang/cindex.py | python | Cursor.semantic_parent | (self) | return self._semantic_parent | Return the semantic parent for this cursor. | Return the semantic parent for this cursor. | [
"Return",
"the",
"semantic",
"parent",
"for",
"this",
"cursor",
"."
] | def semantic_parent(self):
"""Return the semantic parent for this cursor."""
if not hasattr(self, '_semantic_parent'):
self._semantic_parent = conf.lib.clang_getCursorSemanticParent(self)
return self._semantic_parent | [
"def",
"semantic_parent",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'_semantic_parent'",
")",
":",
"self",
".",
"_semantic_parent",
"=",
"conf",
".",
"lib",
".",
"clang_getCursorSemanticParent",
"(",
"self",
")",
"return",
"self",
"."... | https://github.com/apple/swift-clang/blob/d7403439fc6641751840b723e7165fb02f52db95/bindings/python/clang/cindex.py#L1757-L1762 | |
google/llvm-propeller | 45c226984fe8377ebfb2ad7713c680d652ba678d | llvm/examples/Kaleidoscope/MCJIT/cached/genk-timing.py | python | generateKScript | (filename, numFuncs, elementsPerFunc, funcsBetweenExec, callWeighting, timingScript) | Generate a random Kaleidoscope script based on the given parameters | Generate a random Kaleidoscope script based on the given parameters | [
"Generate",
"a",
"random",
"Kaleidoscope",
"script",
"based",
"on",
"the",
"given",
"parameters"
] | def generateKScript(filename, numFuncs, elementsPerFunc, funcsBetweenExec, callWeighting, timingScript):
""" Generate a random Kaleidoscope script based on the given parameters """
print("Generating " + filename)
print(" %d functions, %d elements per function, %d functions between execution" %
(n... | [
"def",
"generateKScript",
"(",
"filename",
",",
"numFuncs",
",",
"elementsPerFunc",
",",
"funcsBetweenExec",
",",
"callWeighting",
",",
"timingScript",
")",
":",
"print",
"(",
"\"Generating \"",
"+",
"filename",
")",
"print",
"(",
"\" %d functions, %d elements per fu... | https://github.com/google/llvm-propeller/blob/45c226984fe8377ebfb2ad7713c680d652ba678d/llvm/examples/Kaleidoscope/MCJIT/cached/genk-timing.py#L176-L206 | ||
apple/swift-lldb | d74be846ef3e62de946df343e8c234bde93a8912 | scripts/Python/static-binding/lldb.py | python | SBProcess.GetInterruptedFromEvent | (event) | return _lldb.SBProcess_GetInterruptedFromEvent(event) | GetInterruptedFromEvent(SBEvent event) -> bool | GetInterruptedFromEvent(SBEvent event) -> bool | [
"GetInterruptedFromEvent",
"(",
"SBEvent",
"event",
")",
"-",
">",
"bool"
] | def GetInterruptedFromEvent(event):
"""GetInterruptedFromEvent(SBEvent event) -> bool"""
return _lldb.SBProcess_GetInterruptedFromEvent(event) | [
"def",
"GetInterruptedFromEvent",
"(",
"event",
")",
":",
"return",
"_lldb",
".",
"SBProcess_GetInterruptedFromEvent",
"(",
"event",
")"
] | https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/scripts/Python/static-binding/lldb.py#L8677-L8679 | |
clementine-player/Clementine | 111379dfd027802b59125829fcf87e3e1d0ad73b | dist/cpplint.py | python | NestingState.CheckCompletedBlocks | (self, filename, error) | Checks that all classes and namespaces have been completely parsed.
Call this when all lines in a file have been processed.
Args:
filename: The name of the current file.
error: The function to call with any errors found. | Checks that all classes and namespaces have been completely parsed. | [
"Checks",
"that",
"all",
"classes",
"and",
"namespaces",
"have",
"been",
"completely",
"parsed",
"."
] | def CheckCompletedBlocks(self, filename, error):
"""Checks that all classes and namespaces have been completely parsed.
Call this when all lines in a file have been processed.
Args:
filename: The name of the current file.
error: The function to call with any errors found.
"""
# Note: Th... | [
"def",
"CheckCompletedBlocks",
"(",
"self",
",",
"filename",
",",
"error",
")",
":",
"# Note: This test can result in false positives if #ifdef constructs",
"# get in the way of brace matching. See the testBuildClass test in",
"# cpplint_unittest.py for an example of this.",
"for",
"obj"... | https://github.com/clementine-player/Clementine/blob/111379dfd027802b59125829fcf87e3e1d0ad73b/dist/cpplint.py#L2486-L2505 | ||
MVIG-SJTU/RMPE | 5188c230ec800c12be7369c3619615bc9b020aa4 | python/caffe/io.py | python | arraylist_to_blobprotovector_str | (arraylist) | return vec.SerializeToString() | Converts a list of arrays to a serialized blobprotovec, which could be
then passed to a network for processing. | Converts a list of arrays to a serialized blobprotovec, which could be
then passed to a network for processing. | [
"Converts",
"a",
"list",
"of",
"arrays",
"to",
"a",
"serialized",
"blobprotovec",
"which",
"could",
"be",
"then",
"passed",
"to",
"a",
"network",
"for",
"processing",
"."
] | def arraylist_to_blobprotovector_str(arraylist):
"""Converts a list of arrays to a serialized blobprotovec, which could be
then passed to a network for processing.
"""
vec = caffe_pb2.BlobProtoVector()
vec.blobs.extend([array_to_blobproto(arr) for arr in arraylist])
return vec.SerializeToString(... | [
"def",
"arraylist_to_blobprotovector_str",
"(",
"arraylist",
")",
":",
"vec",
"=",
"caffe_pb2",
".",
"BlobProtoVector",
"(",
")",
"vec",
".",
"blobs",
".",
"extend",
"(",
"[",
"array_to_blobproto",
"(",
"arr",
")",
"for",
"arr",
"in",
"arraylist",
"]",
")",
... | https://github.com/MVIG-SJTU/RMPE/blob/5188c230ec800c12be7369c3619615bc9b020aa4/python/caffe/io.py#L49-L55 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_misc.py | python | Log.ClearTraceMasks | (*args, **kwargs) | return _misc_.Log_ClearTraceMasks(*args, **kwargs) | ClearTraceMasks() | ClearTraceMasks() | [
"ClearTraceMasks",
"()"
] | def ClearTraceMasks(*args, **kwargs):
"""ClearTraceMasks()"""
return _misc_.Log_ClearTraceMasks(*args, **kwargs) | [
"def",
"ClearTraceMasks",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"Log_ClearTraceMasks",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_misc.py#L1570-L1572 | |
intel/llvm | e6d0547e9d99b5a56430c4749f6c7e328bf221ab | lldb/examples/python/mach_o.py | python | TerminalColors.magenta | (self, fg=True) | return '' | Set the foreground or background color to magenta.
The foreground color will be set if "fg" tests True. The background color will be set if "fg" tests False. | Set the foreground or background color to magenta.
The foreground color will be set if "fg" tests True. The background color will be set if "fg" tests False. | [
"Set",
"the",
"foreground",
"or",
"background",
"color",
"to",
"magenta",
".",
"The",
"foreground",
"color",
"will",
"be",
"set",
"if",
"fg",
"tests",
"True",
".",
"The",
"background",
"color",
"will",
"be",
"set",
"if",
"fg",
"tests",
"False",
"."
] | def magenta(self, fg=True):
'''Set the foreground or background color to magenta.
The foreground color will be set if "fg" tests True. The background color will be set if "fg" tests False.'''
if self.enabled:
if fg:
return "\x1b[35m"
else:
... | [
"def",
"magenta",
"(",
"self",
",",
"fg",
"=",
"True",
")",
":",
"if",
"self",
".",
"enabled",
":",
"if",
"fg",
":",
"return",
"\"\\x1b[35m\"",
"else",
":",
"return",
"\"\\x1b[45m\"",
"return",
"''"
] | https://github.com/intel/llvm/blob/e6d0547e9d99b5a56430c4749f6c7e328bf221ab/lldb/examples/python/mach_o.py#L321-L329 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/tkinter/font.py | python | families | (root=None, displayof=None) | return root.tk.splitlist(root.tk.call("font", "families", *args)) | Get font families (as a tuple) | Get font families (as a tuple) | [
"Get",
"font",
"families",
"(",
"as",
"a",
"tuple",
")"
] | def families(root=None, displayof=None):
"Get font families (as a tuple)"
if not root:
root = tkinter._default_root
args = ()
if displayof:
args = ('-displayof', displayof)
return root.tk.splitlist(root.tk.call("font", "families", *args)) | [
"def",
"families",
"(",
"root",
"=",
"None",
",",
"displayof",
"=",
"None",
")",
":",
"if",
"not",
"root",
":",
"root",
"=",
"tkinter",
".",
"_default_root",
"args",
"=",
"(",
")",
"if",
"displayof",
":",
"args",
"=",
"(",
"'-displayof'",
",",
"displ... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/tkinter/font.py#L177-L184 | |
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Draft/draftviewproviders/view_dimension.py | python | ViewProviderAngularDimension.attach | (self, vobj) | Set up the scene sub-graph of the viewprovider. | Set up the scene sub-graph of the viewprovider. | [
"Set",
"up",
"the",
"scene",
"sub",
"-",
"graph",
"of",
"the",
"viewprovider",
"."
] | def attach(self, vobj):
"""Set up the scene sub-graph of the viewprovider."""
self.Object = vobj.Object
self.color = coin.SoBaseColor()
if hasattr(vobj, "LineColor"):
self.color.rgb.setValue(vobj.LineColor[0],
vobj.LineColor[1],
... | [
"def",
"attach",
"(",
"self",
",",
"vobj",
")",
":",
"self",
".",
"Object",
"=",
"vobj",
".",
"Object",
"self",
".",
"color",
"=",
"coin",
".",
"SoBaseColor",
"(",
")",
"if",
"hasattr",
"(",
"vobj",
",",
"\"LineColor\"",
")",
":",
"self",
".",
"col... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Draft/draftviewproviders/view_dimension.py#L919-L985 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/telemetry/third_party/pyserial/serial/rfc2217.py | python | PortManager.escape | (self, data) | \
this generator function is for the user. all outgoing data has to be
properly escaped, so that no IAC character in the data stream messes up
the Telnet state machine in the server.
socket.sendall(escape(data)) | \
this generator function is for the user. all outgoing data has to be
properly escaped, so that no IAC character in the data stream messes up
the Telnet state machine in the server. | [
"\\",
"this",
"generator",
"function",
"is",
"for",
"the",
"user",
".",
"all",
"outgoing",
"data",
"has",
"to",
"be",
"properly",
"escaped",
"so",
"that",
"no",
"IAC",
"character",
"in",
"the",
"data",
"stream",
"messes",
"up",
"the",
"Telnet",
"state",
... | def escape(self, data):
"""\
this generator function is for the user. all outgoing data has to be
properly escaped, so that no IAC character in the data stream messes up
the Telnet state machine in the server.
socket.sendall(escape(data))
"""
for byte in data:
... | [
"def",
"escape",
"(",
"self",
",",
"data",
")",
":",
"for",
"byte",
"in",
"data",
":",
"if",
"byte",
"==",
"IAC",
":",
"yield",
"IAC",
"yield",
"IAC",
"else",
":",
"yield",
"byte"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/third_party/pyserial/serial/rfc2217.py#L1010-L1023 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/ipaddress.py | python | IPv4Address.is_unspecified | (self) | return self == self._constants._unspecified_address | Test if the address is unspecified.
Returns:
A boolean, True if this is the unspecified address as defined in
RFC 5735 3. | Test if the address is unspecified. | [
"Test",
"if",
"the",
"address",
"is",
"unspecified",
"."
] | def is_unspecified(self):
"""Test if the address is unspecified.
Returns:
A boolean, True if this is the unspecified address as defined in
RFC 5735 3.
"""
return self == self._constants._unspecified_address | [
"def",
"is_unspecified",
"(",
"self",
")",
":",
"return",
"self",
"==",
"self",
".",
"_constants",
".",
"_unspecified_address"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/ipaddress.py#L1374-L1382 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/keras/utils/tf_utils.py | python | assert_no_legacy_layers | (layers) | Prevent tf.layers.Layers from being used with Keras.
Certain legacy layers inherit from their keras analogs; however they are
not supported with keras and can lead to subtle and hard to diagnose bugs.
Args:
layers: A list of layers to check
Raises:
TypeError: If any elements of layers are tf.layers.L... | Prevent tf.layers.Layers from being used with Keras. | [
"Prevent",
"tf",
".",
"layers",
".",
"Layers",
"from",
"being",
"used",
"with",
"Keras",
"."
] | def assert_no_legacy_layers(layers):
"""Prevent tf.layers.Layers from being used with Keras.
Certain legacy layers inherit from their keras analogs; however they are
not supported with keras and can lead to subtle and hard to diagnose bugs.
Args:
layers: A list of layers to check
Raises:
TypeError:... | [
"def",
"assert_no_legacy_layers",
"(",
"layers",
")",
":",
"# isinstance check for tf.layers.Layer introduces a circular dependency.",
"legacy_layers",
"=",
"[",
"l",
"for",
"l",
"in",
"layers",
"if",
"getattr",
"(",
"l",
",",
"'_is_legacy_layer'",
",",
"None",
")",
"... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/keras/utils/tf_utils.py#L404-L426 | ||
google/fhir | d77f57706c1a168529b0b87ca7ccb1c0113e83c2 | py/google/fhir/fhir_errors.py | python | ListErrorReporter.report_validation_warning | (self, element_path: str, msg: str) | Logs to the `warning` context and stores `msg` in `warnings`. | Logs to the `warning` context and stores `msg` in `warnings`. | [
"Logs",
"to",
"the",
"warning",
"context",
"and",
"stores",
"msg",
"in",
"warnings",
"."
] | def report_validation_warning(self, element_path: str, msg: str) -> None:
"""Logs to the `warning` context and stores `msg` in `warnings`."""
logging.warning('%s; %s', element_path, msg)
self.warnings.append(msg) | [
"def",
"report_validation_warning",
"(",
"self",
",",
"element_path",
":",
"str",
",",
"msg",
":",
"str",
")",
"->",
"None",
":",
"logging",
".",
"warning",
"(",
"'%s; %s'",
",",
"element_path",
",",
"msg",
")",
"self",
".",
"warnings",
".",
"append",
"(... | https://github.com/google/fhir/blob/d77f57706c1a168529b0b87ca7ccb1c0113e83c2/py/google/fhir/fhir_errors.py#L132-L135 | ||
Z3Prover/z3 | d745d03afdfdf638d66093e2bfbacaf87187f35b | src/api/python/z3/z3.py | python | Solver.consequences | (self, assumptions, variables) | return CheckSatResult(r), consequences | Determine fixed values for the variables based on the solver state and assumptions.
>>> s = Solver()
>>> a, b, c, d = Bools('a b c d')
>>> s.add(Implies(a,b), Implies(b, c))
>>> s.consequences([a],[b,c,d])
(sat, [Implies(a, b), Implies(a, c)])
>>> s.consequences([Not(c),d... | Determine fixed values for the variables based on the solver state and assumptions.
>>> s = Solver()
>>> a, b, c, d = Bools('a b c d')
>>> s.add(Implies(a,b), Implies(b, c))
>>> s.consequences([a],[b,c,d])
(sat, [Implies(a, b), Implies(a, c)])
>>> s.consequences([Not(c),d... | [
"Determine",
"fixed",
"values",
"for",
"the",
"variables",
"based",
"on",
"the",
"solver",
"state",
"and",
"assumptions",
".",
">>>",
"s",
"=",
"Solver",
"()",
">>>",
"a",
"b",
"c",
"d",
"=",
"Bools",
"(",
"a",
"b",
"c",
"d",
")",
">>>",
"s",
".",
... | def consequences(self, assumptions, variables):
"""Determine fixed values for the variables based on the solver state and assumptions.
>>> s = Solver()
>>> a, b, c, d = Bools('a b c d')
>>> s.add(Implies(a,b), Implies(b, c))
>>> s.consequences([a],[b,c,d])
(sat, [Implies(... | [
"def",
"consequences",
"(",
"self",
",",
"assumptions",
",",
"variables",
")",
":",
"if",
"isinstance",
"(",
"assumptions",
",",
"list",
")",
":",
"_asms",
"=",
"AstVector",
"(",
"None",
",",
"self",
".",
"ctx",
")",
"for",
"a",
"in",
"assumptions",
":... | https://github.com/Z3Prover/z3/blob/d745d03afdfdf638d66093e2bfbacaf87187f35b/src/api/python/z3/z3.py#L7109-L7136 | |
google/iree | 1224bbdbe65b0d1fdf40e7324f60f68beeaf7c76 | integrations/tensorflow/python_projects/iree_tf/iree/tf/support/tf_utils.py | python | save_input_values | (inputs: Sequence[np.ndarray],
artifacts_dir: str = None) | return result | Saves input values with IREE tools format if 'artifacts_dir' is set. | Saves input values with IREE tools format if 'artifacts_dir' is set. | [
"Saves",
"input",
"values",
"with",
"IREE",
"tools",
"format",
"if",
"artifacts_dir",
"is",
"set",
"."
] | def save_input_values(inputs: Sequence[np.ndarray],
artifacts_dir: str = None) -> str:
"""Saves input values with IREE tools format if 'artifacts_dir' is set."""
result = []
for array in inputs:
shape_dtype = get_shape_and_dtype(array)
values = " ".join([str(x) for x in array.flatten... | [
"def",
"save_input_values",
"(",
"inputs",
":",
"Sequence",
"[",
"np",
".",
"ndarray",
"]",
",",
"artifacts_dir",
":",
"str",
"=",
"None",
")",
"->",
"str",
":",
"result",
"=",
"[",
"]",
"for",
"array",
"in",
"inputs",
":",
"shape_dtype",
"=",
"get_sha... | https://github.com/google/iree/blob/1224bbdbe65b0d1fdf40e7324f60f68beeaf7c76/integrations/tensorflow/python_projects/iree_tf/iree/tf/support/tf_utils.py#L114-L129 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | scripts/LargeScaleStructures/data_stitching.py | python | DataSet.is_loaded | (self) | return mtd.doesExist(self._ws_name) | Return True is this data set has been loaded | Return True is this data set has been loaded | [
"Return",
"True",
"is",
"this",
"data",
"set",
"has",
"been",
"loaded"
] | def is_loaded(self):
"""
Return True is this data set has been loaded
"""
return mtd.doesExist(self._ws_name) | [
"def",
"is_loaded",
"(",
"self",
")",
":",
"return",
"mtd",
".",
"doesExist",
"(",
"self",
".",
"_ws_name",
")"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/LargeScaleStructures/data_stitching.py#L235-L239 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/docview.py | python | Document.NotifyClosing | (self) | Notifies the views that the document is going to close. | Notifies the views that the document is going to close. | [
"Notifies",
"the",
"views",
"that",
"the",
"document",
"is",
"going",
"to",
"close",
"."
] | def NotifyClosing(self):
"""
Notifies the views that the document is going to close.
"""
for view in self._documentViews:
view.OnClosingDocument() | [
"def",
"NotifyClosing",
"(",
"self",
")",
":",
"for",
"view",
"in",
"self",
".",
"_documentViews",
":",
"view",
".",
"OnClosingDocument",
"(",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/docview.py#L727-L732 | ||
kismetwireless/kismet | a7c0dc270c960fb1f58bd9cec4601c201885fd4e | capture_proxy_adsb/KismetCaptureProxyAdsb/__init__.py | python | KismetProxyAdsb.adsb_len_by_type | (self, type) | return 56 | Get expected length of message in bits based on the type | Get expected length of message in bits based on the type | [
"Get",
"expected",
"length",
"of",
"message",
"in",
"bits",
"based",
"on",
"the",
"type"
] | def adsb_len_by_type(self, type):
"""
Get expected length of message in bits based on the type
"""
if type == 16 or type == 17 or type == 19 or type == 20 or type == 21:
return 112
return 56 | [
"def",
"adsb_len_by_type",
"(",
"self",
",",
"type",
")",
":",
"if",
"type",
"==",
"16",
"or",
"type",
"==",
"17",
"or",
"type",
"==",
"19",
"or",
"type",
"==",
"20",
"or",
"type",
"==",
"21",
":",
"return",
"112",
"return",
"56"
] | https://github.com/kismetwireless/kismet/blob/a7c0dc270c960fb1f58bd9cec4601c201885fd4e/capture_proxy_adsb/KismetCaptureProxyAdsb/__init__.py#L420-L428 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/ops/spectral_ops.py | python | _irfft_wrapper | (ifft_fn, fft_rank, default_name) | return _irfft | Wrapper around gen_spectral_ops.irfft* that infers fft_length argument. | Wrapper around gen_spectral_ops.irfft* that infers fft_length argument. | [
"Wrapper",
"around",
"gen_spectral_ops",
".",
"irfft",
"*",
"that",
"infers",
"fft_length",
"argument",
"."
] | def _irfft_wrapper(ifft_fn, fft_rank, default_name):
"""Wrapper around gen_spectral_ops.irfft* that infers fft_length argument."""
def _irfft(input_tensor, fft_length=None, name=None):
with _ops.name_scope(name, default_name,
[input_tensor, fft_length]) as name:
input_tensor = _o... | [
"def",
"_irfft_wrapper",
"(",
"ifft_fn",
",",
"fft_rank",
",",
"default_name",
")",
":",
"def",
"_irfft",
"(",
"input_tensor",
",",
"fft_length",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"with",
"_ops",
".",
"name_scope",
"(",
"name",
",",
"defau... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/ops/spectral_ops.py#L138-L154 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/mailbox.py | python | MH.get_sequences | (self) | return results | Return a name-to-key-list dictionary to define each sequence. | Return a name-to-key-list dictionary to define each sequence. | [
"Return",
"a",
"name",
"-",
"to",
"-",
"key",
"-",
"list",
"dictionary",
"to",
"define",
"each",
"sequence",
"."
] | def get_sequences(self):
"""Return a name-to-key-list dictionary to define each sequence."""
results = {}
f = open(os.path.join(self._path, '.mh_sequences'), 'r')
try:
all_keys = set(self.keys())
for line in f:
try:
name, conten... | [
"def",
"get_sequences",
"(",
"self",
")",
":",
"results",
"=",
"{",
"}",
"f",
"=",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"_path",
",",
"'.mh_sequences'",
")",
",",
"'r'",
")",
"try",
":",
"all_keys",
"=",
"set",
"(",
"sel... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/mailbox.py#L1122-L1147 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/stc.py | python | StyledTextCtrl.CallTipPosAtStart | (*args, **kwargs) | return _stc.StyledTextCtrl_CallTipPosAtStart(*args, **kwargs) | CallTipPosAtStart(self) -> int
Retrieve the position where the caret was before displaying the call tip. | CallTipPosAtStart(self) -> int | [
"CallTipPosAtStart",
"(",
"self",
")",
"-",
">",
"int"
] | def CallTipPosAtStart(*args, **kwargs):
"""
CallTipPosAtStart(self) -> int
Retrieve the position where the caret was before displaying the call tip.
"""
return _stc.StyledTextCtrl_CallTipPosAtStart(*args, **kwargs) | [
"def",
"CallTipPosAtStart",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_stc",
".",
"StyledTextCtrl_CallTipPosAtStart",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/stc.py#L3820-L3826 | |
goldeneye-source/ges-code | 2630cd8ef3d015af53c72ec2e19fc1f7e7fe8d9d | thirdparty/protobuf-2.3.0/python/google/protobuf/internal/decoder.py | python | _SkipVarint | (buffer, pos, end) | return pos | Skip a varint value. Returns the new position. | Skip a varint value. Returns the new position. | [
"Skip",
"a",
"varint",
"value",
".",
"Returns",
"the",
"new",
"position",
"."
] | def _SkipVarint(buffer, pos, end):
"""Skip a varint value. Returns the new position."""
while ord(buffer[pos]) & 0x80:
pos += 1
pos += 1
if pos > end:
raise _DecodeError('Truncated message.')
return pos | [
"def",
"_SkipVarint",
"(",
"buffer",
",",
"pos",
",",
"end",
")",
":",
"while",
"ord",
"(",
"buffer",
"[",
"pos",
"]",
")",
"&",
"0x80",
":",
"pos",
"+=",
"1",
"pos",
"+=",
"1",
"if",
"pos",
">",
"end",
":",
"raise",
"_DecodeError",
"(",
"'Trunca... | https://github.com/goldeneye-source/ges-code/blob/2630cd8ef3d015af53c72ec2e19fc1f7e7fe8d9d/thirdparty/protobuf-2.3.0/python/google/protobuf/internal/decoder.py#L553-L561 | |
NVIDIA/DALI | bf16cc86ba8f091b145f91962f21fe1b6aff243d | third_party/cpplint.py | python | NestingState.SeenOpenBrace | (self) | return (not self.stack) or self.stack[-1].seen_open_brace | Check if we have seen the opening brace for the innermost block.
Returns:
True if we have seen the opening brace, False if the innermost
block is still expecting an opening brace. | Check if we have seen the opening brace for the innermost block. | [
"Check",
"if",
"we",
"have",
"seen",
"the",
"opening",
"brace",
"for",
"the",
"innermost",
"block",
"."
] | def SeenOpenBrace(self):
"""Check if we have seen the opening brace for the innermost block.
Returns:
True if we have seen the opening brace, False if the innermost
block is still expecting an opening brace.
"""
return (not self.stack) or self.stack[-1].seen_open_brace | [
"def",
"SeenOpenBrace",
"(",
"self",
")",
":",
"return",
"(",
"not",
"self",
".",
"stack",
")",
"or",
"self",
".",
"stack",
"[",
"-",
"1",
"]",
".",
"seen_open_brace"
] | https://github.com/NVIDIA/DALI/blob/bf16cc86ba8f091b145f91962f21fe1b6aff243d/third_party/cpplint.py#L2429-L2436 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | samples/ide/activegrid/tool/FindInDirService.py | python | FindInDirService.SaveFindInDirConfig | (self, dirString, searchSubfolders) | Save search dir patterns and flags to registry.
dirString = search directory
searchSubfolders = Search subfolders | Save search dir patterns and flags to registry. | [
"Save",
"search",
"dir",
"patterns",
"and",
"flags",
"to",
"registry",
"."
] | def SaveFindInDirConfig(self, dirString, searchSubfolders):
""" Save search dir patterns and flags to registry.
dirString = search directory
searchSubfolders = Search subfolders
"""
config = wx.ConfigBase_Get()
config.Write(FIND_MATCHDIR, dirString)
confi... | [
"def",
"SaveFindInDirConfig",
"(",
"self",
",",
"dirString",
",",
"searchSubfolders",
")",
":",
"config",
"=",
"wx",
".",
"ConfigBase_Get",
"(",
")",
"config",
".",
"Write",
"(",
"FIND_MATCHDIR",
",",
"dirString",
")",
"config",
".",
"WriteInt",
"(",
"FIND_M... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/samples/ide/activegrid/tool/FindInDirService.py#L302-L310 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/scipy/signal/signaltools.py | python | fftconvolve | (in1, in2, mode="full") | Convolve two N-dimensional arrays using FFT.
Convolve `in1` and `in2` using the fast Fourier transform method, with
the output size determined by the `mode` argument.
This is generally much faster than `convolve` for large arrays (n > ~500),
but can be slower when only a few output values are needed, ... | Convolve two N-dimensional arrays using FFT. | [
"Convolve",
"two",
"N",
"-",
"dimensional",
"arrays",
"using",
"FFT",
"."
] | def fftconvolve(in1, in2, mode="full"):
"""Convolve two N-dimensional arrays using FFT.
Convolve `in1` and `in2` using the fast Fourier transform method, with
the output size determined by the `mode` argument.
This is generally much faster than `convolve` for large arrays (n > ~500),
but can be sl... | [
"def",
"fftconvolve",
"(",
"in1",
",",
"in2",
",",
"mode",
"=",
"\"full\"",
")",
":",
"in1",
"=",
"asarray",
"(",
"in1",
")",
"in2",
"=",
"asarray",
"(",
"in2",
")",
"if",
"in1",
".",
"ndim",
"==",
"in2",
".",
"ndim",
"==",
"0",
":",
"# scalar in... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/scipy/signal/signaltools.py#L271-L405 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/keras/utils/kernelized_utils.py | python | _to_matrix | (u) | return u | If input tensor is a vector (i.e., has rank 1), converts it to matrix. | If input tensor is a vector (i.e., has rank 1), converts it to matrix. | [
"If",
"input",
"tensor",
"is",
"a",
"vector",
"(",
"i",
".",
"e",
".",
"has",
"rank",
"1",
")",
"converts",
"it",
"to",
"matrix",
"."
] | def _to_matrix(u):
"""If input tensor is a vector (i.e., has rank 1), converts it to matrix."""
u_rank = len(u.shape)
if u_rank not in [1, 2]:
raise ValueError('The input tensor should have rank 1 or 2. Given rank: {}'
.format(u_rank))
if u_rank == 1:
return array_ops.expand_dims(u,... | [
"def",
"_to_matrix",
"(",
"u",
")",
":",
"u_rank",
"=",
"len",
"(",
"u",
".",
"shape",
")",
"if",
"u_rank",
"not",
"in",
"[",
"1",
",",
"2",
"]",
":",
"raise",
"ValueError",
"(",
"'The input tensor should have rank 1 or 2. Given rank: {}'",
".",
"format",
... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/keras/utils/kernelized_utils.py#L21-L29 | |
idaholab/moose | 9eeebc65e098b4c30f8205fb41591fd5b61eb6ff | python/peacock/Input/BlockInfo.py | python | BlockInfo.paramValue | (self, param) | Gets the value of a parameter.
Input:
param[str]: Name of the parameter
Return:
str: Value of the parameter or None | Gets the value of a parameter.
Input:
param[str]: Name of the parameter
Return:
str: Value of the parameter or None | [
"Gets",
"the",
"value",
"of",
"a",
"parameter",
".",
"Input",
":",
"param",
"[",
"str",
"]",
":",
"Name",
"of",
"the",
"parameter",
"Return",
":",
"str",
":",
"Value",
"of",
"the",
"parameter",
"or",
"None"
] | def paramValue(self, param):
"""
Gets the value of a parameter.
Input:
param[str]: Name of the parameter
Return:
str: Value of the parameter or None
"""
param_info = self.getParamInfo(param)
if param_info:
return param_info.valu... | [
"def",
"paramValue",
"(",
"self",
",",
"param",
")",
":",
"param_info",
"=",
"self",
".",
"getParamInfo",
"(",
"param",
")",
"if",
"param_info",
":",
"return",
"param_info",
".",
"value"
] | https://github.com/idaholab/moose/blob/9eeebc65e098b4c30f8205fb41591fd5b61eb6ff/python/peacock/Input/BlockInfo.py#L103-L113 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/grid.py | python | Grid.EnableEditing | (*args, **kwargs) | return _grid.Grid_EnableEditing(*args, **kwargs) | EnableEditing(self, bool edit) | EnableEditing(self, bool edit) | [
"EnableEditing",
"(",
"self",
"bool",
"edit",
")"
] | def EnableEditing(*args, **kwargs):
"""EnableEditing(self, bool edit)"""
return _grid.Grid_EnableEditing(*args, **kwargs) | [
"def",
"EnableEditing",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_grid",
".",
"Grid_EnableEditing",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/grid.py#L1342-L1344 | |
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/python/training/rmsprop.py | python | RMSPropOptimizer.__init__ | (self,
learning_rate,
decay=0.9,
momentum=0.0,
epsilon=1e-10,
use_locking=False,
centered=False,
name="RMSProp") | Construct a new RMSProp optimizer.
Note that in dense implement of this algorithm, m_t and v_t will
update even if g is zero, but in sparse implement, m_t and v_t
will not update in iterations g is zero.
Args:
learning_rate: A Tensor or a floating point value. The learning rate.
decay: Di... | Construct a new RMSProp optimizer. | [
"Construct",
"a",
"new",
"RMSProp",
"optimizer",
"."
] | def __init__(self,
learning_rate,
decay=0.9,
momentum=0.0,
epsilon=1e-10,
use_locking=False,
centered=False,
name="RMSProp"):
"""Construct a new RMSProp optimizer.
Note that in dense implement of this algor... | [
"def",
"__init__",
"(",
"self",
",",
"learning_rate",
",",
"decay",
"=",
"0.9",
",",
"momentum",
"=",
"0.0",
",",
"epsilon",
"=",
"1e-10",
",",
"use_locking",
"=",
"False",
",",
"centered",
"=",
"False",
",",
"name",
"=",
"\"RMSProp\"",
")",
":",
"supe... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/training/rmsprop.py#L59-L97 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/frame.py | python | DataFrame.__len__ | (self) | return len(self.index) | Returns length of info axis, but here we use the index. | Returns length of info axis, but here we use the index. | [
"Returns",
"length",
"of",
"info",
"axis",
"but",
"here",
"we",
"use",
"the",
"index",
"."
] | def __len__(self) -> int:
"""
Returns length of info axis, but here we use the index.
"""
return len(self.index) | [
"def",
"__len__",
"(",
"self",
")",
"->",
"int",
":",
"return",
"len",
"(",
"self",
".",
"index",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/frame.py#L1037-L1041 | |
microsoft/checkedc-clang | a173fefde5d7877b7750e7ce96dd08cf18baebf2 | llvm/utils/lit/lit/util.py | python | listdir_files | (dirname, suffixes=None, exclude_filenames=None) | Yields files in a directory.
Filenames that are not excluded by rules below are yielded one at a time, as
basenames (i.e., without dirname).
Files starting with '.' are always skipped.
If 'suffixes' is not None, then only filenames ending with one of its
members will be yielded. These can be exte... | Yields files in a directory. | [
"Yields",
"files",
"in",
"a",
"directory",
"."
] | def listdir_files(dirname, suffixes=None, exclude_filenames=None):
"""Yields files in a directory.
Filenames that are not excluded by rules below are yielded one at a time, as
basenames (i.e., without dirname).
Files starting with '.' are always skipped.
If 'suffixes' is not None, then only filen... | [
"def",
"listdir_files",
"(",
"dirname",
",",
"suffixes",
"=",
"None",
",",
"exclude_filenames",
"=",
"None",
")",
":",
"if",
"exclude_filenames",
"is",
"None",
":",
"exclude_filenames",
"=",
"set",
"(",
")",
"if",
"suffixes",
"is",
"None",
":",
"suffixes",
... | https://github.com/microsoft/checkedc-clang/blob/a173fefde5d7877b7750e7ce96dd08cf18baebf2/llvm/utils/lit/lit/util.py#L167-L205 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/collections/__init__.py | python | OrderedDict.__setitem__ | (self, key, value,
dict_setitem=dict.__setitem__, proxy=_proxy, Link=_Link) | od.__setitem__(i, y) <==> od[i]=y | od.__setitem__(i, y) <==> od[i]=y | [
"od",
".",
"__setitem__",
"(",
"i",
"y",
")",
"<",
"==",
">",
"od",
"[",
"i",
"]",
"=",
"y"
] | def __setitem__(self, key, value,
dict_setitem=dict.__setitem__, proxy=_proxy, Link=_Link):
'od.__setitem__(i, y) <==> od[i]=y'
# Setting a new item creates a new link at the end of the linked list,
# and the inherited dictionary is updated with the new key/value pair.
... | [
"def",
"__setitem__",
"(",
"self",
",",
"key",
",",
"value",
",",
"dict_setitem",
"=",
"dict",
".",
"__setitem__",
",",
"proxy",
"=",
"_proxy",
",",
"Link",
"=",
"_Link",
")",
":",
"# Setting a new item creates a new link at the end of the linked list,",
"# and the ... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/collections/__init__.py#L115-L127 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/prompt-toolkit/py2/prompt_toolkit/terminal/win32_output.py | python | ColorLookupTable.lookup_bg_color | (self, bg_color) | Return the color for use in the
`windll.kernel32.SetConsoleTextAttribute` API call.
:param bg_color: Background as text. E.g. 'ffffff' or 'red' | Return the color for use in the
`windll.kernel32.SetConsoleTextAttribute` API call. | [
"Return",
"the",
"color",
"for",
"use",
"in",
"the",
"windll",
".",
"kernel32",
".",
"SetConsoleTextAttribute",
"API",
"call",
"."
] | def lookup_bg_color(self, bg_color):
"""
Return the color for use in the
`windll.kernel32.SetConsoleTextAttribute` API call.
:param bg_color: Background as text. E.g. 'ffffff' or 'red'
"""
# Background.
if bg_color in BG_ANSI_COLORS:
return BG_ANSI_CO... | [
"def",
"lookup_bg_color",
"(",
"self",
",",
"bg_color",
")",
":",
"# Background.",
"if",
"bg_color",
"in",
"BG_ANSI_COLORS",
":",
"return",
"BG_ANSI_COLORS",
"[",
"bg_color",
"]",
"else",
":",
"return",
"self",
".",
"_color_indexes",
"(",
"bg_color",
")",
"[",... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/prompt-toolkit/py2/prompt_toolkit/terminal/win32_output.py#L545-L556 | ||
vgteam/vg | cf4d516a5e9ee5163c783e4437ddf16b18a4b561 | scripts/giraffe-facts.py | python | Table.compute_merges | (self, merges=None) | return widths | Given a list of cell counts to merge horizontally, compute new widths from self.widths.
If merges is None, use self.widths. | Given a list of cell counts to merge horizontally, compute new widths from self.widths.
If merges is None, use self.widths. | [
"Given",
"a",
"list",
"of",
"cell",
"counts",
"to",
"merge",
"horizontally",
"compute",
"new",
"widths",
"from",
"self",
".",
"widths",
".",
"If",
"merges",
"is",
"None",
"use",
"self",
".",
"widths",
"."
] | def compute_merges(self, merges=None):
"""
Given a list of cell counts to merge horizontally, compute new widths from self.widths.
If merges is None, use self.widths.
"""
widths = self.widths
if merges is not None:
new_widths = []
... | [
"def",
"compute_merges",
"(",
"self",
",",
"merges",
"=",
"None",
")",
":",
"widths",
"=",
"self",
".",
"widths",
"if",
"merges",
"is",
"not",
"None",
":",
"new_widths",
"=",
"[",
"]",
"width_cursor",
"=",
"0",
"for",
"merge",
"in",
"merges",
":",
"#... | https://github.com/vgteam/vg/blob/cf4d516a5e9ee5163c783e4437ddf16b18a4b561/scripts/giraffe-facts.py#L504-L532 | |
google/flatbuffers | b3006913369e0a7550795e477011ac5bebb93497 | python/flatbuffers/table.py | python | Table.Indirect | (self, off) | return off + encode.Get(N.UOffsetTFlags.packer_type, self.Bytes, off) | Indirect retrieves the relative offset stored at `offset`. | Indirect retrieves the relative offset stored at `offset`. | [
"Indirect",
"retrieves",
"the",
"relative",
"offset",
"stored",
"at",
"offset",
"."
] | def Indirect(self, off):
"""Indirect retrieves the relative offset stored at `offset`."""
N.enforce_number(off, N.UOffsetTFlags)
return off + encode.Get(N.UOffsetTFlags.packer_type, self.Bytes, off) | [
"def",
"Indirect",
"(",
"self",
",",
"off",
")",
":",
"N",
".",
"enforce_number",
"(",
"off",
",",
"N",
".",
"UOffsetTFlags",
")",
"return",
"off",
"+",
"encode",
".",
"Get",
"(",
"N",
".",
"UOffsetTFlags",
".",
"packer_type",
",",
"self",
".",
"Byte... | https://github.com/google/flatbuffers/blob/b3006913369e0a7550795e477011ac5bebb93497/python/flatbuffers/table.py#L43-L46 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/protobuf/python/google/protobuf/text_format.py | python | _Parser.ParseLines | (self, lines, message) | return message | Parses an text representation of a protocol message into a message. | Parses an text representation of a protocol message into a message. | [
"Parses",
"an",
"text",
"representation",
"of",
"a",
"protocol",
"message",
"into",
"a",
"message",
"."
] | def ParseLines(self, lines, message):
"""Parses an text representation of a protocol message into a message."""
self._allow_multiple_scalars = False
self._ParseOrMerge(lines, message)
return message | [
"def",
"ParseLines",
"(",
"self",
",",
"lines",
",",
"message",
")",
":",
"self",
".",
"_allow_multiple_scalars",
"=",
"False",
"self",
".",
"_ParseOrMerge",
"(",
"lines",
",",
"message",
")",
"return",
"message"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/protobuf/python/google/protobuf/text_format.py#L427-L431 | |
ricardoquesada/Spidermonkey | 4a75ea2543408bd1b2c515aa95901523eeef7858 | dom/bindings/parser/WebIDL.py | python | Parser.p_Inheritance | (self, p) | Inheritance : COLON ScopedName | Inheritance : COLON ScopedName | [
"Inheritance",
":",
"COLON",
"ScopedName"
] | def p_Inheritance(self, p):
"""
Inheritance : COLON ScopedName
"""
p[0] = IDLIdentifierPlaceholder(self.getLocation(p, 2), p[2]) | [
"def",
"p_Inheritance",
"(",
"self",
",",
"p",
")",
":",
"p",
"[",
"0",
"]",
"=",
"IDLIdentifierPlaceholder",
"(",
"self",
".",
"getLocation",
"(",
"p",
",",
"2",
")",
",",
"p",
"[",
"2",
"]",
")"
] | https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/dom/bindings/parser/WebIDL.py#L4372-L4376 | ||
gnuradio/gnuradio | 09c3c4fa4bfb1a02caac74cb5334dfe065391e3b | docs/doxygen/other/doxypy.py | python | Doxypy.makeCommentBlock | (self) | return l | Indents the current comment block with respect to the current
indentation level.
@returns a list of indented comment lines | Indents the current comment block with respect to the current
indentation level. | [
"Indents",
"the",
"current",
"comment",
"block",
"with",
"respect",
"to",
"the",
"current",
"indentation",
"level",
"."
] | def makeCommentBlock(self):
"""Indents the current comment block with respect to the current
indentation level.
@returns a list of indented comment lines
"""
doxyStart = "##"
commentLines = self.comment
commentLines = ["%s# %s" % (self.indent, x) for x in commen... | [
"def",
"makeCommentBlock",
"(",
"self",
")",
":",
"doxyStart",
"=",
"\"##\"",
"commentLines",
"=",
"self",
".",
"comment",
"commentLines",
"=",
"[",
"\"%s# %s\"",
"%",
"(",
"self",
".",
"indent",
",",
"x",
")",
"for",
"x",
"in",
"commentLines",
"]",
"l",... | https://github.com/gnuradio/gnuradio/blob/09c3c4fa4bfb1a02caac74cb5334dfe065391e3b/docs/doxygen/other/doxypy.py#L359-L372 | |
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/models/embedding/word2vec_optimized.py | python | Word2Vec.train | (self) | Train the model. | Train the model. | [
"Train",
"the",
"model",
"."
] | def train(self):
"""Train the model."""
opts = self._options
initial_epoch, initial_words = self._session.run([self._epoch, self._words])
workers = []
for _ in xrange(opts.concurrent_steps):
t = threading.Thread(target=self._train_thread_body)
t.start()
workers.append(t)
las... | [
"def",
"train",
"(",
"self",
")",
":",
"opts",
"=",
"self",
".",
"_options",
"initial_epoch",
",",
"initial_words",
"=",
"self",
".",
"_session",
".",
"run",
"(",
"[",
"self",
".",
"_epoch",
",",
"self",
".",
"_words",
"]",
")",
"workers",
"=",
"[",
... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/models/embedding/word2vec_optimized.py#L310-L338 | ||
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/idlelib/configHandler.py | python | IdleUserConfParser.RemoveFile | (self) | Removes the user config file from disk if it exists. | Removes the user config file from disk if it exists. | [
"Removes",
"the",
"user",
"config",
"file",
"from",
"disk",
"if",
"it",
"exists",
"."
] | def RemoveFile(self):
"""
Removes the user config file from disk if it exists.
"""
if os.path.exists(self.file):
os.remove(self.file) | [
"def",
"RemoveFile",
"(",
"self",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"self",
".",
"file",
")",
":",
"os",
".",
"remove",
"(",
"self",
".",
"file",
")"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/idlelib/configHandler.py#L127-L132 | ||
SequoiaDB/SequoiaDB | 2894ed7e5bd6fe57330afc900cf76d0ff0df9f64 | tools/server/php_linux/libxml2/lib/python2.4/site-packages/libxml2.py | python | xmlNs.xpathNodeSetFreeNs | (self) | Namespace nodes in libxml don't match the XPath semantic.
In a node set the namespace nodes are duplicated and the
next pointer is set to the parent node in the XPath
semantic. Check if such a node needs to be freed | Namespace nodes in libxml don't match the XPath semantic.
In a node set the namespace nodes are duplicated and the
next pointer is set to the parent node in the XPath
semantic. Check if such a node needs to be freed | [
"Namespace",
"nodes",
"in",
"libxml",
"don",
"t",
"match",
"the",
"XPath",
"semantic",
".",
"In",
"a",
"node",
"set",
"the",
"namespace",
"nodes",
"are",
"duplicated",
"and",
"the",
"next",
"pointer",
"is",
"set",
"to",
"the",
"parent",
"node",
"in",
"th... | def xpathNodeSetFreeNs(self):
"""Namespace nodes in libxml don't match the XPath semantic.
In a node set the namespace nodes are duplicated and the
next pointer is set to the parent node in the XPath
semantic. Check if such a node needs to be freed """
libxml2mod.xmlXPathN... | [
"def",
"xpathNodeSetFreeNs",
"(",
"self",
")",
":",
"libxml2mod",
".",
"xmlXPathNodeSetFreeNs",
"(",
"self",
".",
"_o",
")"
] | https://github.com/SequoiaDB/SequoiaDB/blob/2894ed7e5bd6fe57330afc900cf76d0ff0df9f64/tools/server/php_linux/libxml2/lib/python2.4/site-packages/libxml2.py#L5969-L5974 | ||
rsummers11/CADLab | 976ed959a0b5208bb4173127a7ef732ac73a9b6f | lesion_detector_3DCE/rcnn/pycocotools/coco.py | python | COCO.loadCats | (self, ids=[]) | Load cats with the specified ids.
:param ids (int array) : integer ids specifying cats
:return: cats (object array) : loaded cat objects | Load cats with the specified ids.
:param ids (int array) : integer ids specifying cats
:return: cats (object array) : loaded cat objects | [
"Load",
"cats",
"with",
"the",
"specified",
"ids",
".",
":",
"param",
"ids",
"(",
"int",
"array",
")",
":",
"integer",
"ids",
"specifying",
"cats",
":",
"return",
":",
"cats",
"(",
"object",
"array",
")",
":",
"loaded",
"cat",
"objects"
] | def loadCats(self, ids=[]):
"""
Load cats with the specified ids.
:param ids (int array) : integer ids specifying cats
:return: cats (object array) : loaded cat objects
"""
if type(ids) == list:
return [self.cats[id] for id in ids]
elif type(ids)... | [
"def",
"loadCats",
"(",
"self",
",",
"ids",
"=",
"[",
"]",
")",
":",
"if",
"type",
"(",
"ids",
")",
"==",
"list",
":",
"return",
"[",
"self",
".",
"cats",
"[",
"id",
"]",
"for",
"id",
"in",
"ids",
"]",
"elif",
"type",
"(",
"ids",
")",
"==",
... | https://github.com/rsummers11/CADLab/blob/976ed959a0b5208bb4173127a7ef732ac73a9b6f/lesion_detector_3DCE/rcnn/pycocotools/coco.py#L206-L215 | ||
facebook/openr | ed38bdfd6bf290084bfab4821b59f83e7b59315d | build/fbcode_builder/getdeps/subcmd.py | python | cmd | (name, help=None, cmd_table=CmdTable) | return wrapper | @cmd() is a decorator that can be used to help define Subcmd instances
Example usage:
@subcmd('list', 'Show the result list')
class ListCmd(Subcmd):
def run(self, args):
# Perform the command actions here...
pass | @cmd() is a decorator that can be used to help define Subcmd instances | [
"@cmd",
"()",
"is",
"a",
"decorator",
"that",
"can",
"be",
"used",
"to",
"help",
"define",
"Subcmd",
"instances"
] | def cmd(name, help=None, cmd_table=CmdTable):
"""
@cmd() is a decorator that can be used to help define Subcmd instances
Example usage:
@subcmd('list', 'Show the result list')
class ListCmd(Subcmd):
def run(self, args):
# Perform the command actions here...
... | [
"def",
"cmd",
"(",
"name",
",",
"help",
"=",
"None",
",",
"cmd_table",
"=",
"CmdTable",
")",
":",
"def",
"wrapper",
"(",
"cls",
")",
":",
"class",
"SubclassedCmd",
"(",
"cls",
")",
":",
"NAME",
"=",
"name",
"HELP",
"=",
"help",
"cmd_table",
".",
"a... | https://github.com/facebook/openr/blob/ed38bdfd6bf290084bfab4821b59f83e7b59315d/build/fbcode_builder/getdeps/subcmd.py#L35-L56 | |
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/walking-robot-simulation-ii.py | python | Robot2.getPos | (self) | return self.__getPosDir()[0] | :rtype: List[int] | :rtype: List[int] | [
":",
"rtype",
":",
"List",
"[",
"int",
"]"
] | def getPos(self):
"""
:rtype: List[int]
"""
return self.__getPosDir()[0] | [
"def",
"getPos",
"(",
"self",
")",
":",
"return",
"self",
".",
"__getPosDir",
"(",
")",
"[",
"0",
"]"
] | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/walking-robot-simulation-ii.py#L75-L79 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/prompt-toolkit/py3/prompt_toolkit/shortcuts/progress_bar/formatters.py | python | _hue_to_rgb | (hue: float) | return [
(255, t, 0),
(q, 255, 0),
(0, 255, t),
(0, q, 255),
(t, 0, 255),
(255, 0, q),
][i] | Take hue between 0 and 1, return (r, g, b). | Take hue between 0 and 1, return (r, g, b). | [
"Take",
"hue",
"between",
"0",
"and",
"1",
"return",
"(",
"r",
"g",
"b",
")",
"."
] | def _hue_to_rgb(hue: float) -> Tuple[int, int, int]:
"""
Take hue between 0 and 1, return (r, g, b).
"""
i = int(hue * 6.0)
f = (hue * 6.0) - i
q = int(255 * (1.0 - f))
t = int(255 * (1.0 - (1.0 - f)))
i %= 6
return [
(255, t, 0),
(q, 255, 0),
(0, 255, t),
... | [
"def",
"_hue_to_rgb",
"(",
"hue",
":",
"float",
")",
"->",
"Tuple",
"[",
"int",
",",
"int",
",",
"int",
"]",
":",
"i",
"=",
"int",
"(",
"hue",
"*",
"6.0",
")",
"f",
"=",
"(",
"hue",
"*",
"6.0",
")",
"-",
"i",
"q",
"=",
"int",
"(",
"255",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/prompt-toolkit/py3/prompt_toolkit/shortcuts/progress_bar/formatters.py#L361-L380 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/setuptools/py3/setuptools/_vendor/more_itertools/recipes.py | python | random_permutation | (iterable, r=None) | return tuple(sample(pool, r)) | Return a random *r* length permutation of the elements in *iterable*.
If *r* is not specified or is ``None``, then *r* defaults to the length of
*iterable*.
>>> random_permutation(range(5)) # doctest:+SKIP
(3, 4, 0, 1, 2)
This equivalent to taking a random selection from
``itertools.... | Return a random *r* length permutation of the elements in *iterable*. | [
"Return",
"a",
"random",
"*",
"r",
"*",
"length",
"permutation",
"of",
"the",
"elements",
"in",
"*",
"iterable",
"*",
"."
] | def random_permutation(iterable, r=None):
"""Return a random *r* length permutation of the elements in *iterable*.
If *r* is not specified or is ``None``, then *r* defaults to the length of
*iterable*.
>>> random_permutation(range(5)) # doctest:+SKIP
(3, 4, 0, 1, 2)
This equivalent t... | [
"def",
"random_permutation",
"(",
"iterable",
",",
"r",
"=",
"None",
")",
":",
"pool",
"=",
"tuple",
"(",
"iterable",
")",
"r",
"=",
"len",
"(",
"pool",
")",
"if",
"r",
"is",
"None",
"else",
"r",
"return",
"tuple",
"(",
"sample",
"(",
"pool",
",",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/setuptools/py3/setuptools/_vendor/more_itertools/recipes.py#L495-L510 | |
llvm-mirror/lldb | d01083a850f577b85501a0902b52fd0930de72c7 | utils/vim-lldb/python-vim-lldb/vim_panes.py | python | VimPane.get_highlights | (self) | return {} | Subclasses implement this to provide pane highlights.
This function is expected to return a map of:
{ highlight_name ==> [line_number, ...], ... } | Subclasses implement this to provide pane highlights.
This function is expected to return a map of:
{ highlight_name ==> [line_number, ...], ... } | [
"Subclasses",
"implement",
"this",
"to",
"provide",
"pane",
"highlights",
".",
"This",
"function",
"is",
"expected",
"to",
"return",
"a",
"map",
"of",
":",
"{",
"highlight_name",
"==",
">",
"[",
"line_number",
"...",
"]",
"...",
"}"
] | def get_highlights(self):
""" Subclasses implement this to provide pane highlights.
This function is expected to return a map of:
{ highlight_name ==> [line_number, ...], ... }
"""
return {} | [
"def",
"get_highlights",
"(",
"self",
")",
":",
"return",
"{",
"}"
] | https://github.com/llvm-mirror/lldb/blob/d01083a850f577b85501a0902b52fd0930de72c7/utils/vim-lldb/python-vim-lldb/vim_panes.py#L393-L398 | |
intel/llvm | e6d0547e9d99b5a56430c4749f6c7e328bf221ab | lldb/utils/lui/lldbutil.py | python | get_parent_frame | (frame) | return None | Returns the parent frame of the input frame object; None if not available. | Returns the parent frame of the input frame object; None if not available. | [
"Returns",
"the",
"parent",
"frame",
"of",
"the",
"input",
"frame",
"object",
";",
"None",
"if",
"not",
"available",
"."
] | def get_parent_frame(frame):
"""
Returns the parent frame of the input frame object; None if not available.
"""
thread = frame.GetThread()
parent_found = False
for f in thread:
if parent_found:
return f
if f.GetFrameID() == frame.GetFrameID():
parent_found... | [
"def",
"get_parent_frame",
"(",
"frame",
")",
":",
"thread",
"=",
"frame",
".",
"GetThread",
"(",
")",
"parent_found",
"=",
"False",
"for",
"f",
"in",
"thread",
":",
"if",
"parent_found",
":",
"return",
"f",
"if",
"f",
".",
"GetFrameID",
"(",
")",
"=="... | https://github.com/intel/llvm/blob/e6d0547e9d99b5a56430c4749f6c7e328bf221ab/lldb/utils/lui/lldbutil.py#L837-L850 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_controls.py | python | Notebook.SendPageChangedEvent | (*args, **kwargs) | return _controls_.Notebook_SendPageChangedEvent(*args, **kwargs) | SendPageChangedEvent(self, int nPageOld, int nPageNew=-1) | SendPageChangedEvent(self, int nPageOld, int nPageNew=-1) | [
"SendPageChangedEvent",
"(",
"self",
"int",
"nPageOld",
"int",
"nPageNew",
"=",
"-",
"1",
")"
] | def SendPageChangedEvent(*args, **kwargs):
"""SendPageChangedEvent(self, int nPageOld, int nPageNew=-1)"""
return _controls_.Notebook_SendPageChangedEvent(*args, **kwargs) | [
"def",
"SendPageChangedEvent",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"Notebook_SendPageChangedEvent",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_controls.py#L3138-L3140 | |
mapnik/mapnik | f3da900c355e1d15059c4a91b00203dcc9d9f0ef | scons/scons-local-4.1.0/SCons/Node/FS.py | python | File.Dir | (self, name, create=True) | return self.dir.Dir(name, create=create) | Create a directory node named 'name' relative to
the directory of this file. | Create a directory node named 'name' relative to
the directory of this file. | [
"Create",
"a",
"directory",
"node",
"named",
"name",
"relative",
"to",
"the",
"directory",
"of",
"this",
"file",
"."
] | def Dir(self, name, create=True):
"""Create a directory node named 'name' relative to
the directory of this file."""
return self.dir.Dir(name, create=create) | [
"def",
"Dir",
"(",
"self",
",",
"name",
",",
"create",
"=",
"True",
")",
":",
"return",
"self",
".",
"dir",
".",
"Dir",
"(",
"name",
",",
"create",
"=",
"create",
")"
] | https://github.com/mapnik/mapnik/blob/f3da900c355e1d15059c4a91b00203dcc9d9f0ef/scons/scons-local-4.1.0/SCons/Node/FS.py#L2649-L2652 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_controls.py | python | PreStaticText | (*args, **kwargs) | return val | PreStaticText() -> StaticText | PreStaticText() -> StaticText | [
"PreStaticText",
"()",
"-",
">",
"StaticText"
] | def PreStaticText(*args, **kwargs):
"""PreStaticText() -> StaticText"""
val = _controls_.new_PreStaticText(*args, **kwargs)
return val | [
"def",
"PreStaticText",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"val",
"=",
"_controls_",
".",
"new_PreStaticText",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"val"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_controls.py#L1043-L1046 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/math_ops.py | python | reduce_std | (input_tensor, axis=None, keepdims=False, name=None) | Computes the standard deviation of elements across dimensions of a tensor.
Reduces `input_tensor` along the dimensions given in `axis`.
Unless `keepdims` is true, the rank of the tensor is reduced by 1 for each
entry in `axis`. If `keepdims` is true, the reduced dimensions
are retained with length 1.
If `ax... | Computes the standard deviation of elements across dimensions of a tensor. | [
"Computes",
"the",
"standard",
"deviation",
"of",
"elements",
"across",
"dimensions",
"of",
"a",
"tensor",
"."
] | def reduce_std(input_tensor, axis=None, keepdims=False, name=None):
"""Computes the standard deviation of elements across dimensions of a tensor.
Reduces `input_tensor` along the dimensions given in `axis`.
Unless `keepdims` is true, the rank of the tensor is reduced by 1 for each
entry in `axis`. If `keepdims... | [
"def",
"reduce_std",
"(",
"input_tensor",
",",
"axis",
"=",
"None",
",",
"keepdims",
"=",
"False",
",",
"name",
"=",
"None",
")",
":",
"name",
"=",
"name",
"if",
"name",
"else",
"\"reduce_std\"",
"with",
"ops",
".",
"name_scope",
"(",
"name",
")",
":",... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/math_ops.py#L1922-L1964 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py3/numpy/ma/core.py | python | _check_fill_value | (fill_value, ndtype) | return np.array(fill_value) | Private function validating the given `fill_value` for the given dtype.
If fill_value is None, it is set to the default corresponding to the dtype.
If fill_value is not None, its value is forced to the given dtype.
The result is always a 0d array. | Private function validating the given `fill_value` for the given dtype. | [
"Private",
"function",
"validating",
"the",
"given",
"fill_value",
"for",
"the",
"given",
"dtype",
"."
] | def _check_fill_value(fill_value, ndtype):
"""
Private function validating the given `fill_value` for the given dtype.
If fill_value is None, it is set to the default corresponding to the dtype.
If fill_value is not None, its value is forced to the given dtype.
The result is always a 0d array.
... | [
"def",
"_check_fill_value",
"(",
"fill_value",
",",
"ndtype",
")",
":",
"ndtype",
"=",
"np",
".",
"dtype",
"(",
"ndtype",
")",
"if",
"fill_value",
"is",
"None",
":",
"fill_value",
"=",
"default_fill_value",
"(",
"ndtype",
")",
"elif",
"ndtype",
".",
"names... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py3/numpy/ma/core.py#L428-L469 | |
OpenVR-Advanced-Settings/OpenVR-AdvancedSettings | 522ba46ac6bcff8e82907715f7f0af7abbbe1e7b | build_scripts/win/build.py | python | build | () | Runs:
'vcvarsall.bat', a Visual Studio file to set up the environment for QMAKE.
QMAKE, creates the makefiles.
jom/nmake, builds the makefiles. | Runs:
'vcvarsall.bat', a Visual Studio file to set up the environment for QMAKE.
QMAKE, creates the makefiles.
jom/nmake, builds the makefiles. | [
"Runs",
":",
"vcvarsall",
".",
"bat",
"a",
"Visual",
"Studio",
"file",
"to",
"set",
"up",
"the",
"environment",
"for",
"QMAKE",
".",
"QMAKE",
"creates",
"the",
"makefiles",
".",
"jom",
"/",
"nmake",
"builds",
"the",
"makefiles",
"."
] | def build():
"""
Runs:
'vcvarsall.bat', a Visual Studio file to set up the environment for QMAKE.
QMAKE, creates the makefiles.
jom/nmake, builds the makefiles.
"""
set_current_activity("BUILD")
set_dirs()
COMPILE_MODE = ""
COMPILER = ""
say("Attempting to build... | [
"def",
"build",
"(",
")",
":",
"set_current_activity",
"(",
"\"BUILD\"",
")",
"set_dirs",
"(",
")",
"COMPILE_MODE",
"=",
"\"\"",
"COMPILER",
"=",
"\"\"",
"say",
"(",
"\"Attempting to build version: \"",
"+",
"VERSION_STRING",
")",
"say",
"(",
"\"Testing if all req... | https://github.com/OpenVR-Advanced-Settings/OpenVR-AdvancedSettings/blob/522ba46ac6bcff8e82907715f7f0af7abbbe1e7b/build_scripts/win/build.py#L84-L174 | ||
BVLC/caffe | 9b891540183ddc834a02b2bd81b31afae71b2153 | python/caffe/draw.py | python | draw_net_to_file | (caffe_net, filename, rankdir='LR', phase=None, display_lrm=False) | Draws a caffe net, and saves it to file using the format given as the
file extension. Use '.raw' to output raw text that you can manually feed
to graphviz to draw graphs.
Parameters
----------
caffe_net : a caffe.proto.caffe_pb2.NetParameter protocol buffer.
filename : string
The path t... | Draws a caffe net, and saves it to file using the format given as the
file extension. Use '.raw' to output raw text that you can manually feed
to graphviz to draw graphs. | [
"Draws",
"a",
"caffe",
"net",
"and",
"saves",
"it",
"to",
"file",
"using",
"the",
"format",
"given",
"as",
"the",
"file",
"extension",
".",
"Use",
".",
"raw",
"to",
"output",
"raw",
"text",
"that",
"you",
"can",
"manually",
"feed",
"to",
"graphviz",
"t... | def draw_net_to_file(caffe_net, filename, rankdir='LR', phase=None, display_lrm=False):
"""Draws a caffe net, and saves it to file using the format given as the
file extension. Use '.raw' to output raw text that you can manually feed
to graphviz to draw graphs.
Parameters
----------
caffe_net :... | [
"def",
"draw_net_to_file",
"(",
"caffe_net",
",",
"filename",
",",
"rankdir",
"=",
"'LR'",
",",
"phase",
"=",
"None",
",",
"display_lrm",
"=",
"False",
")",
":",
"ext",
"=",
"filename",
"[",
"filename",
".",
"rfind",
"(",
"'.'",
")",
"+",
"1",
":",
"... | https://github.com/BVLC/caffe/blob/9b891540183ddc834a02b2bd81b31afae71b2153/python/caffe/draw.py#L293-L314 | ||
TheLegendAli/DeepLab-Context | fb04e9e2fc2682490ad9f60533b9d6c4c0e0479c | scripts/cpp_lint.py | python | _CppLintState.PrintErrorCounts | (self) | Print a summary of errors by category, and the total. | Print a summary of errors by category, and the total. | [
"Print",
"a",
"summary",
"of",
"errors",
"by",
"category",
"and",
"the",
"total",
"."
] | def PrintErrorCounts(self):
"""Print a summary of errors by category, and the total."""
for category, count in self.errors_by_category.iteritems():
sys.stderr.write('Category \'%s\' errors found: %d\n' %
(category, count))
sys.stderr.write('Total errors found: %d\n' % self.error... | [
"def",
"PrintErrorCounts",
"(",
"self",
")",
":",
"for",
"category",
",",
"count",
"in",
"self",
".",
"errors_by_category",
".",
"iteritems",
"(",
")",
":",
"sys",
".",
"stderr",
".",
"write",
"(",
"'Category \\'%s\\' errors found: %d\\n'",
"%",
"(",
"category... | https://github.com/TheLegendAli/DeepLab-Context/blob/fb04e9e2fc2682490ad9f60533b9d6c4c0e0479c/scripts/cpp_lint.py#L757-L762 | ||
cvxpy/cvxpy | 5165b4fb750dfd237de8659383ef24b4b2e33aaf | cvxpy/reductions/complex2real/atom_canonicalizers/matrix_canon.py | python | hermitian_canon | (expr, real_args, imag_args, real2imag) | return expr.copy([matrix]), None | Canonicalize functions that take a Hermitian matrix. | Canonicalize functions that take a Hermitian matrix. | [
"Canonicalize",
"functions",
"that",
"take",
"a",
"Hermitian",
"matrix",
"."
] | def hermitian_canon(expr, real_args, imag_args, real2imag):
"""Canonicalize functions that take a Hermitian matrix.
"""
if imag_args[0] is None:
matrix = real_args[0]
else:
if real_args[0] is None:
real_args[0] = np.zeros(imag_args[0].shape)
matrix = bmat([[real_args[... | [
"def",
"hermitian_canon",
"(",
"expr",
",",
"real_args",
",",
"imag_args",
",",
"real2imag",
")",
":",
"if",
"imag_args",
"[",
"0",
"]",
"is",
"None",
":",
"matrix",
"=",
"real_args",
"[",
"0",
"]",
"else",
":",
"if",
"real_args",
"[",
"0",
"]",
"is"... | https://github.com/cvxpy/cvxpy/blob/5165b4fb750dfd237de8659383ef24b4b2e33aaf/cvxpy/reductions/complex2real/atom_canonicalizers/matrix_canon.py#L29-L39 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/ops/mask_ops.py | python | kleene_or | (
left: Union[bool, np.ndarray],
right: Union[bool, np.ndarray],
left_mask: Optional[np.ndarray],
right_mask: Optional[np.ndarray],
) | return result, mask | Boolean ``or`` using Kleene logic.
Values are NA where we have ``NA | NA`` or ``NA | False``.
``NA | True`` is considered True.
Parameters
----------
left, right : ndarray, NA, or bool
The values of the array.
left_mask, right_mask : ndarray, optional
The masks. Only one of the... | Boolean ``or`` using Kleene logic. | [
"Boolean",
"or",
"using",
"Kleene",
"logic",
"."
] | def kleene_or(
left: Union[bool, np.ndarray],
right: Union[bool, np.ndarray],
left_mask: Optional[np.ndarray],
right_mask: Optional[np.ndarray],
):
"""
Boolean ``or`` using Kleene logic.
Values are NA where we have ``NA | NA`` or ``NA | False``.
``NA | True`` is considered True.
Pa... | [
"def",
"kleene_or",
"(",
"left",
":",
"Union",
"[",
"bool",
",",
"np",
".",
"ndarray",
"]",
",",
"right",
":",
"Union",
"[",
"bool",
",",
"np",
".",
"ndarray",
"]",
",",
"left_mask",
":",
"Optional",
"[",
"np",
".",
"ndarray",
"]",
",",
"right_mask... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/ops/mask_ops.py#L11-L69 | |
msitt/blpapi-python | bebcf43668c9e5f5467b1f685f9baebbfc45bc87 | src/blpapi/versionhelper.py | python | _swig_add_metaclass | (metaclass) | return wrapper | Class decorator for adding a metaclass to a SWIG wrapped class - a slimmed down version of six.add_metaclass | Class decorator for adding a metaclass to a SWIG wrapped class - a slimmed down version of six.add_metaclass | [
"Class",
"decorator",
"for",
"adding",
"a",
"metaclass",
"to",
"a",
"SWIG",
"wrapped",
"class",
"-",
"a",
"slimmed",
"down",
"version",
"of",
"six",
".",
"add_metaclass"
] | def _swig_add_metaclass(metaclass):
"""Class decorator for adding a metaclass to a SWIG wrapped class - a slimmed down version of six.add_metaclass"""
def wrapper(cls):
return metaclass(cls.__name__, cls.__bases__, cls.__dict__.copy())
return wrapper | [
"def",
"_swig_add_metaclass",
"(",
"metaclass",
")",
":",
"def",
"wrapper",
"(",
"cls",
")",
":",
"return",
"metaclass",
"(",
"cls",
".",
"__name__",
",",
"cls",
".",
"__bases__",
",",
"cls",
".",
"__dict__",
".",
"copy",
"(",
")",
")",
"return",
"wrap... | https://github.com/msitt/blpapi-python/blob/bebcf43668c9e5f5467b1f685f9baebbfc45bc87/src/blpapi/versionhelper.py#L54-L58 | |
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/contrib/rnn/python/ops/lstm_ops.py | python | _FusedLSTMGradShape | (op) | return [x_shape] * max_len + [cs_prev_shape, h_prev_shape, w_shape, wci_shape,
wco_shape, wcf_shape, b_shape] | Shape for FusedLSTM. | Shape for FusedLSTM. | [
"Shape",
"for",
"FusedLSTM",
"."
] | def _FusedLSTMGradShape(op):
"""Shape for FusedLSTM."""
max_len = op.get_attr("max_len")
x = op.inputs[1]
cs_prev = op.inputs[1 + max_len]
h_prev = op.inputs[2 + max_len]
w = op.inputs[3 + max_len]
wci = op.inputs[4 + max_len]
wco = op.inputs[5 + max_len]
wcf = op.inputs[6 + max_len]
b = op.inputs[... | [
"def",
"_FusedLSTMGradShape",
"(",
"op",
")",
":",
"max_len",
"=",
"op",
".",
"get_attr",
"(",
"\"max_len\"",
")",
"x",
"=",
"op",
".",
"inputs",
"[",
"1",
"]",
"cs_prev",
"=",
"op",
".",
"inputs",
"[",
"1",
"+",
"max_len",
"]",
"h_prev",
"=",
"op"... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/contrib/rnn/python/ops/lstm_ops.py#L369-L392 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/array_ops.py | python | _TileGradShape | (op) | Shape function for the TileGrad op. | Shape function for the TileGrad op. | [
"Shape",
"function",
"for",
"the",
"TileGrad",
"op",
"."
] | def _TileGradShape(op):
"""Shape function for the TileGrad op."""
multiples_shape = op.inputs[1].get_shape().with_rank(1)
input_shape = op.inputs[0].get_shape().with_rank(multiples_shape[0])
# NOTE(mrry): Represent `multiples` as a `TensorShape` because (i)
# it is a vector of non-negative integers, and (ii) ... | [
"def",
"_TileGradShape",
"(",
"op",
")",
":",
"multiples_shape",
"=",
"op",
".",
"inputs",
"[",
"1",
"]",
".",
"get_shape",
"(",
")",
".",
"with_rank",
"(",
"1",
")",
"input_shape",
"=",
"op",
".",
"inputs",
"[",
"0",
"]",
".",
"get_shape",
"(",
")... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/array_ops.py#L2993-L3008 | ||
BitMEX/api-connectors | 37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812 | auto-generated/python/swagger_client/models/affiliate.py | python | Affiliate.total_comm | (self) | return self._total_comm | Gets the total_comm of this Affiliate. # noqa: E501
:return: The total_comm of this Affiliate. # noqa: E501
:rtype: float | Gets the total_comm of this Affiliate. # noqa: E501 | [
"Gets",
"the",
"total_comm",
"of",
"this",
"Affiliate",
".",
"#",
"noqa",
":",
"E501"
] | def total_comm(self):
"""Gets the total_comm of this Affiliate. # noqa: E501
:return: The total_comm of this Affiliate. # noqa: E501
:rtype: float
"""
return self._total_comm | [
"def",
"total_comm",
"(",
"self",
")",
":",
"return",
"self",
".",
"_total_comm"
] | https://github.com/BitMEX/api-connectors/blob/37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812/auto-generated/python/swagger_client/models/affiliate.py#L343-L350 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_windows.py | python | PyScrolledWindow.DoGetBestSize | (*args, **kwargs) | return _windows_.PyScrolledWindow_DoGetBestSize(*args, **kwargs) | DoGetBestSize(self) -> Size | DoGetBestSize(self) -> Size | [
"DoGetBestSize",
"(",
"self",
")",
"-",
">",
"Size"
] | def DoGetBestSize(*args, **kwargs):
"""DoGetBestSize(self) -> Size"""
return _windows_.PyScrolledWindow_DoGetBestSize(*args, **kwargs) | [
"def",
"DoGetBestSize",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"PyScrolledWindow_DoGetBestSize",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_windows.py#L4544-L4546 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py2/sklearn/multiclass.py | python | OneVsOneClassifier.predict | (self, X) | return self.classes_[Y.argmax(axis=1)] | Estimate the best class label for each sample in X.
This is implemented as ``argmax(decision_function(X), axis=1)`` which
will return the label of the class with most votes by estimators
predicting the outcome of a decision for each possible class pair.
Parameters
----------
... | Estimate the best class label for each sample in X. | [
"Estimate",
"the",
"best",
"class",
"label",
"for",
"each",
"sample",
"in",
"X",
"."
] | def predict(self, X):
"""Estimate the best class label for each sample in X.
This is implemented as ``argmax(decision_function(X), axis=1)`` which
will return the label of the class with most votes by estimators
predicting the outcome of a decision for each possible class pair.
... | [
"def",
"predict",
"(",
"self",
",",
"X",
")",
":",
"Y",
"=",
"self",
".",
"decision_function",
"(",
"X",
")",
"return",
"self",
".",
"classes_",
"[",
"Y",
".",
"argmax",
"(",
"axis",
"=",
"1",
")",
"]"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py2/sklearn/multiclass.py#L551-L569 | |
infinit/memo | 3a8394d0f647efe03ccb8bfe885a7279cb8be8a6 | elle/drake/src/drake/__init__.py | python | Dictionary.hash | (self) | return hashlib.sha1(str(items).encode('utf-8')).hexdigest() | Hash value. | Hash value. | [
"Hash",
"value",
"."
] | def hash(self):
"""Hash value."""
# FIXME: sha1 of the string repr ain't optimal
items = list(self)
items.sort()
return hashlib.sha1(str(items).encode('utf-8')).hexdigest() | [
"def",
"hash",
"(",
"self",
")",
":",
"# FIXME: sha1 of the string repr ain't optimal",
"items",
"=",
"list",
"(",
"self",
")",
"items",
".",
"sort",
"(",
")",
"return",
"hashlib",
".",
"sha1",
"(",
"str",
"(",
"items",
")",
".",
"encode",
"(",
"'utf-8'",
... | https://github.com/infinit/memo/blob/3a8394d0f647efe03ccb8bfe885a7279cb8be8a6/elle/drake/src/drake/__init__.py#L2550-L2555 | |
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/strobogrammatic-number-ii.py | python | Solution.findStrobogrammatic | (self, n) | return result | :type n: int
:rtype: List[str] | :type n: int
:rtype: List[str] | [
":",
"type",
"n",
":",
"int",
":",
"rtype",
":",
"List",
"[",
"str",
"]"
] | def findStrobogrammatic(self, n):
"""
:type n: int
:rtype: List[str]
"""
lookup = {'0':'0', '1':'1', '6':'9', '8':'8', '9':'6'}
result = ['0', '1', '8'] if n%2 else ['']
for i in xrange(n%2, n, 2):
result = [a + num + b for a, b in lookup.iteritems() i... | [
"def",
"findStrobogrammatic",
"(",
"self",
",",
"n",
")",
":",
"lookup",
"=",
"{",
"'0'",
":",
"'0'",
",",
"'1'",
":",
"'1'",
",",
"'6'",
":",
"'9'",
",",
"'8'",
":",
"'8'",
",",
"'9'",
":",
"'6'",
"}",
"result",
"=",
"[",
"'0'",
",",
"'1'",
... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/strobogrammatic-number-ii.py#L5-L14 | |
clasp-developers/clasp | 5287e5eb9bbd5e8da1e3a629a03d78bd71d01969 | debugger-tools/extend_lldb/print_function.py | python | get_line_numbers | (thread) | return map(GetLineNumber, range(thread.GetNumFrames())) | Returns a sequence of line numbers from the stack frames of this thread. | Returns a sequence of line numbers from the stack frames of this thread. | [
"Returns",
"a",
"sequence",
"of",
"line",
"numbers",
"from",
"the",
"stack",
"frames",
"of",
"this",
"thread",
"."
] | def get_line_numbers(thread):
"""
Returns a sequence of line numbers from the stack frames of this thread.
"""
def GetLineNumber(i):
return thread.GetFrameAtIndex(i).GetLineEntry().GetLine()
return map(GetLineNumber, range(thread.GetNumFrames())) | [
"def",
"get_line_numbers",
"(",
"thread",
")",
":",
"def",
"GetLineNumber",
"(",
"i",
")",
":",
"return",
"thread",
".",
"GetFrameAtIndex",
"(",
"i",
")",
".",
"GetLineEntry",
"(",
")",
".",
"GetLine",
"(",
")",
"return",
"map",
"(",
"GetLineNumber",
","... | https://github.com/clasp-developers/clasp/blob/5287e5eb9bbd5e8da1e3a629a03d78bd71d01969/debugger-tools/extend_lldb/print_function.py#L250-L257 | |
lmb-freiburg/ogn | 974f72ef4bf840d6f6693d22d1843a79223e77ce | scripts/cpp_lint.py | python | _NestingState.Update | (self, filename, clean_lines, linenum, error) | Update nesting state with current line.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call with any errors found. | Update nesting state with current line. | [
"Update",
"nesting",
"state",
"with",
"current",
"line",
"."
] | def Update(self, filename, clean_lines, linenum, error):
"""Update nesting state with current line.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call with any err... | [
"def",
"Update",
"(",
"self",
",",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"# Update pp_stack first",
"self",
".",
"UpdatePreprocessor",
"(",
"line",
")",
"# Coun... | https://github.com/lmb-freiburg/ogn/blob/974f72ef4bf840d6f6693d22d1843a79223e77ce/scripts/cpp_lint.py#L2004-L2158 | ||
klzgrad/naiveproxy | ed2c513637c77b18721fe428d7ed395b4d284c83 | src/build/android/gyp/util/resource_utils.py | python | _ParseTextSymbolsFile | (path, fix_package_ids=False) | return ret | Given an R.txt file, returns a list of _TextSymbolEntry.
Args:
path: Input file path.
fix_package_ids: if True, 0x00 and 0x02 package IDs read from the file
will be fixed to 0x7f.
Returns:
A list of _TextSymbolEntry instances.
Raises:
Exception: An unexpected line was detected in the input. | Given an R.txt file, returns a list of _TextSymbolEntry. | [
"Given",
"an",
"R",
".",
"txt",
"file",
"returns",
"a",
"list",
"of",
"_TextSymbolEntry",
"."
] | def _ParseTextSymbolsFile(path, fix_package_ids=False):
"""Given an R.txt file, returns a list of _TextSymbolEntry.
Args:
path: Input file path.
fix_package_ids: if True, 0x00 and 0x02 package IDs read from the file
will be fixed to 0x7f.
Returns:
A list of _TextSymbolEntry instances.
Raises:... | [
"def",
"_ParseTextSymbolsFile",
"(",
"path",
",",
"fix_package_ids",
"=",
"False",
")",
":",
"ret",
"=",
"[",
"]",
"with",
"open",
"(",
"path",
")",
"as",
"f",
":",
"for",
"line",
"in",
"f",
":",
"m",
"=",
"re",
".",
"match",
"(",
"r'(int(?:\\[\\])?)... | https://github.com/klzgrad/naiveproxy/blob/ed2c513637c77b18721fe428d7ed395b4d284c83/src/build/android/gyp/util/resource_utils.py#L314-L336 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/ops/array_ops.py | python | _FakeQuantWithMinMaxArgsGradient | (op, grad) | return fake_quant_with_min_max_args_gradient(
grad,
op.inputs[0],
min=op.get_attr("min"),
max=op.get_attr("max"),
num_bits=op.get_attr("num_bits"),
narrow_range=op.get_attr("narrow_range")) | Gradient for FakeQuantWithMinMaxArgs op. | Gradient for FakeQuantWithMinMaxArgs op. | [
"Gradient",
"for",
"FakeQuantWithMinMaxArgs",
"op",
"."
] | def _FakeQuantWithMinMaxArgsGradient(op, grad):
"""Gradient for FakeQuantWithMinMaxArgs op."""
return fake_quant_with_min_max_args_gradient(
grad,
op.inputs[0],
min=op.get_attr("min"),
max=op.get_attr("max"),
num_bits=op.get_attr("num_bits"),
narrow_range=op.get_attr("narrow_rang... | [
"def",
"_FakeQuantWithMinMaxArgsGradient",
"(",
"op",
",",
"grad",
")",
":",
"return",
"fake_quant_with_min_max_args_gradient",
"(",
"grad",
",",
"op",
".",
"inputs",
"[",
"0",
"]",
",",
"min",
"=",
"op",
".",
"get_attr",
"(",
"\"min\"",
")",
",",
"max",
"... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/ops/array_ops.py#L2004-L2012 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.