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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
apiaryio/snowcrash | b5b39faa85f88ee17459edf39fdc6fe4fc70d2e3 | tools/gyp/pylib/gyp/mac_tool.py | python | MacTool._LoadPlistMaybeBinary | (self, plist_path) | Loads into a memory a plist possibly encoded in binary format.
This is a wrapper around plistlib.readPlist that tries to convert the
plist to the XML format if it can't be parsed (assuming that it is in
the binary format).
Args:
plist_path: string, path to a plist file, in XML or binary format
... | Loads into a memory a plist possibly encoded in binary format. | [
"Loads",
"into",
"a",
"memory",
"a",
"plist",
"possibly",
"encoded",
"in",
"binary",
"format",
"."
] | def _LoadPlistMaybeBinary(self, plist_path):
"""Loads into a memory a plist possibly encoded in binary format.
This is a wrapper around plistlib.readPlist that tries to convert the
plist to the XML format if it can't be parsed (assuming that it is in
the binary format).
Args:
plist_path: str... | [
"def",
"_LoadPlistMaybeBinary",
"(",
"self",
",",
"plist_path",
")",
":",
"try",
":",
"# First, try to read the file using plistlib that only supports XML,",
"# and if an exception is raised, convert a temporary copy to XML and",
"# load that copy.",
"return",
"plistlib",
".",
"readP... | https://github.com/apiaryio/snowcrash/blob/b5b39faa85f88ee17459edf39fdc6fe4fc70d2e3/tools/gyp/pylib/gyp/mac_tool.py#L496-L519 | ||
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | native_client_sdk/src/tools/decode_dump.py | python | CoreDecoder.StackTrace | (self, info) | return trace | Convert a decoded core.json dump to a simple stack trace.
Args:
info: core.json info with decoded code addresses.
Returns:
A list of dicts with filename, lineno, function (deepest first). | Convert a decoded core.json dump to a simple stack trace. | [
"Convert",
"a",
"decoded",
"core",
".",
"json",
"dump",
"to",
"a",
"simple",
"stack",
"trace",
"."
] | def StackTrace(self, info):
"""Convert a decoded core.json dump to a simple stack trace.
Args:
info: core.json info with decoded code addresses.
Returns:
A list of dicts with filename, lineno, function (deepest first).
"""
trace = []
for frame in info['frames']:
for scope in f... | [
"def",
"StackTrace",
"(",
"self",
",",
"info",
")",
":",
"trace",
"=",
"[",
"]",
"for",
"frame",
"in",
"info",
"[",
"'frames'",
"]",
":",
"for",
"scope",
"in",
"frame",
"[",
"'scopes'",
"]",
":",
"trace",
".",
"append",
"(",
"scope",
")",
"return",... | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/native_client_sdk/src/tools/decode_dump.py#L151-L163 | |
xhzdeng/crpn | a5aef0f80dbe486103123f740c634fb01e6cc9a1 | tools/eval_recall.py | python | parse_args | () | return args | Parse input arguments | Parse input arguments | [
"Parse",
"input",
"arguments"
] | def parse_args():
"""
Parse input arguments
"""
parser = argparse.ArgumentParser(description='Test a Fast R-CNN network')
parser.add_argument('--imdb', dest='imdb_name',
help='dataset to test',
default='voc_2007_test', type=str)
parser.add_argument... | [
"def",
"parse_args",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"'Test a Fast R-CNN network'",
")",
"parser",
".",
"add_argument",
"(",
"'--imdb'",
",",
"dest",
"=",
"'imdb_name'",
",",
"help",
"=",
"'dataset to tes... | https://github.com/xhzdeng/crpn/blob/a5aef0f80dbe486103123f740c634fb01e6cc9a1/tools/eval_recall.py#L10-L29 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/debug/cli/debugger_cli_common.py | python | RichTextLines.write_to_file | (self, file_path) | Write the object itself to file, in a plain format.
The font_attr_segs and annotations are ignored.
Args:
file_path: (str) path of the file to write to. | Write the object itself to file, in a plain format. | [
"Write",
"the",
"object",
"itself",
"to",
"file",
"in",
"a",
"plain",
"format",
"."
] | def write_to_file(self, file_path):
"""Write the object itself to file, in a plain format.
The font_attr_segs and annotations are ignored.
Args:
file_path: (str) path of the file to write to.
"""
with gfile.Open(file_path, "w") as f:
for line in self._lines:
f.write(line + "\n... | [
"def",
"write_to_file",
"(",
"self",
",",
"file_path",
")",
":",
"with",
"gfile",
".",
"Open",
"(",
"file_path",
",",
"\"w\"",
")",
"as",
"f",
":",
"for",
"line",
"in",
"self",
".",
"_lines",
":",
"f",
".",
"write",
"(",
"line",
"+",
"\"\\n\"",
")"... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/debug/cli/debugger_cli_common.py#L344-L355 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/html5lib/treebuilders/base.py | python | TreeBuilder.insertElementTable | (self, token) | return element | Create an element and insert it into the tree | Create an element and insert it into the tree | [
"Create",
"an",
"element",
"and",
"insert",
"it",
"into",
"the",
"tree"
] | def insertElementTable(self, token):
"""Create an element and insert it into the tree"""
element = self.createElement(token)
if self.openElements[-1].name not in tableInsertModeElements:
return self.insertElementNormal(token)
else:
# We should be in the InTable mo... | [
"def",
"insertElementTable",
"(",
"self",
",",
"token",
")",
":",
"element",
"=",
"self",
".",
"createElement",
"(",
"token",
")",
"if",
"self",
".",
"openElements",
"[",
"-",
"1",
"]",
".",
"name",
"not",
"in",
"tableInsertModeElements",
":",
"return",
... | 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/html5lib/treebuilders/base.py#L333-L347 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/tornado/tornado-6/tornado/locale.py | python | Locale.get_closest | (cls, *locale_codes: str) | return cls.get(_default_locale) | Returns the closest match for the given locale code. | Returns the closest match for the given locale code. | [
"Returns",
"the",
"closest",
"match",
"for",
"the",
"given",
"locale",
"code",
"."
] | def get_closest(cls, *locale_codes: str) -> "Locale":
"""Returns the closest match for the given locale code."""
for code in locale_codes:
if not code:
continue
code = code.replace("-", "_")
parts = code.split("_")
if len(parts) > 2:
... | [
"def",
"get_closest",
"(",
"cls",
",",
"*",
"locale_codes",
":",
"str",
")",
"->",
"\"Locale\"",
":",
"for",
"code",
"in",
"locale_codes",
":",
"if",
"not",
"code",
":",
"continue",
"code",
"=",
"code",
".",
"replace",
"(",
"\"-\"",
",",
"\"_\"",
")",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/tornado/tornado-6/tornado/locale.py#L234-L249 | |
ablab/spades | 3a754192b88540524ce6fb69eef5ea9273a38465 | assembler/ext/src/python_libs/joblib3/memory.py | python | Memory.eval | (self, func, *args, **kwargs) | return self.cache(func)(*args, **kwargs) | Eval function func with arguments `*args` and `**kwargs`,
in the context of the memory.
This method works similarly to the builtin `apply`, except
that the function is called only if the cache is not
up to date. | Eval function func with arguments `*args` and `**kwargs`,
in the context of the memory. | [
"Eval",
"function",
"func",
"with",
"arguments",
"*",
"args",
"and",
"**",
"kwargs",
"in",
"the",
"context",
"of",
"the",
"memory",
"."
] | def eval(self, func, *args, **kwargs):
""" Eval function func with arguments `*args` and `**kwargs`,
in the context of the memory.
This method works similarly to the builtin `apply`, except
that the function is called only if the cache is not
up to date.
... | [
"def",
"eval",
"(",
"self",
",",
"func",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"cachedir",
"is",
"None",
":",
"return",
"func",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"self",
".",
"cache",
"(... | https://github.com/ablab/spades/blob/3a754192b88540524ce6fb69eef5ea9273a38465/assembler/ext/src/python_libs/joblib3/memory.py#L890-L901 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/autograph/core/naming.py | python | Namer.function_name | (self, original_fqn) | return new_name | Returns the name of a converted function. | Returns the name of a converted function. | [
"Returns",
"the",
"name",
"of",
"a",
"converted",
"function",
"."
] | def function_name(self, original_fqn):
"""Returns the name of a converted function."""
canonical_name = self._as_symbol_name(
original_fqn, style=_NamingStyle.SNAKE)
new_name_root = 'tf__%s' % canonical_name
new_name = new_name_root
n = 0
while new_name in self.global_namespace:
n ... | [
"def",
"function_name",
"(",
"self",
",",
"original_fqn",
")",
":",
"canonical_name",
"=",
"self",
".",
"_as_symbol_name",
"(",
"original_fqn",
",",
"style",
"=",
"_NamingStyle",
".",
"SNAKE",
")",
"new_name_root",
"=",
"'tf__%s'",
"%",
"canonical_name",
"new_na... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/autograph/core/naming.py#L90-L101 | |
cms-sw/cmssw | fd9de012d503d3405420bcbeec0ec879baa57cf2 | DQMServices/Components/python/HTTP.py | python | RequestManager.__init__ | (self, num_connections = 10, ssl_opts = None,
user_agent = None, request_headers = None,
request_init = None, request_respond = None,
request_error = None, handle_init = None) | Initialise the request manager. The arguments are:
:arg num_connections: maximum number of simultaneous connections.
:arg ssl_opts: optional SSLOptions (Monitoring.Core.X509) for SSL
X509 parametre values, e.g. for X509 client authentication.
:arg user_agent: sets user agent identification string if defined.
:arg requ... | Initialise the request manager. The arguments are: | [
"Initialise",
"the",
"request",
"manager",
".",
"The",
"arguments",
"are",
":"
] | def __init__(self, num_connections = 10, ssl_opts = None,
user_agent = None, request_headers = None,
request_init = None, request_respond = None,
request_error = None, handle_init = None):
"""Initialise the request manager. The arguments are:
:arg num_connections: maxim... | [
"def",
"__init__",
"(",
"self",
",",
"num_connections",
"=",
"10",
",",
"ssl_opts",
"=",
"None",
",",
"user_agent",
"=",
"None",
",",
"request_headers",
"=",
"None",
",",
"request_init",
"=",
"None",
",",
"request_respond",
"=",
"None",
",",
"request_error",... | https://github.com/cms-sw/cmssw/blob/fd9de012d503d3405420bcbeec0ec879baa57cf2/DQMServices/Components/python/HTTP.py#L24-L72 | ||
swift/swift | 12d031cf8177fdec0137f9aa7e2912fa23c4416b | 3rdParty/SCons/scons-3.0.1/engine/SCons/Environment.py | python | OverrideEnvironment.get | (self, key, default=None) | Emulates the get() method of dictionaries. | Emulates the get() method of dictionaries. | [
"Emulates",
"the",
"get",
"()",
"method",
"of",
"dictionaries",
"."
] | def get(self, key, default=None):
"""Emulates the get() method of dictionaries."""
try:
return self.__dict__['overrides'][key]
except KeyError:
return self.__dict__['__subject'].get(key, default) | [
"def",
"get",
"(",
"self",
",",
"key",
",",
"default",
"=",
"None",
")",
":",
"try",
":",
"return",
"self",
".",
"__dict__",
"[",
"'overrides'",
"]",
"[",
"key",
"]",
"except",
"KeyError",
":",
"return",
"self",
".",
"__dict__",
"[",
"'__subject'",
"... | https://github.com/swift/swift/blob/12d031cf8177fdec0137f9aa7e2912fa23c4416b/3rdParty/SCons/scons-3.0.1/engine/SCons/Environment.py#L2330-L2335 | ||
snap-stanford/snap-python | d53c51b0a26aa7e3e7400b014cdf728948fde80a | setup/snap.py | python | TDbStr.GetSecHashCd | (self) | return _snap.TDbStr_GetSecHashCd(self) | GetSecHashCd(TDbStr self) -> int
Parameters:
self: TDbStr const * | GetSecHashCd(TDbStr self) -> int | [
"GetSecHashCd",
"(",
"TDbStr",
"self",
")",
"-",
">",
"int"
] | def GetSecHashCd(self):
"""
GetSecHashCd(TDbStr self) -> int
Parameters:
self: TDbStr const *
"""
return _snap.TDbStr_GetSecHashCd(self) | [
"def",
"GetSecHashCd",
"(",
"self",
")",
":",
"return",
"_snap",
".",
"TDbStr_GetSecHashCd",
"(",
"self",
")"
] | https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/setup/snap.py#L11475-L11483 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/array_ops.py | python | _slice_helper | (tensor, slice_spec, var=None) | Overload for Tensor.__getitem__.
This operation extracts the specified region from the tensor.
The notation is similar to NumPy with the restriction that
currently only support basic indexing. That means that
using a non-scalar tensor as input is not currently allowed.
Some useful examples:
```python
#... | Overload for Tensor.__getitem__. | [
"Overload",
"for",
"Tensor",
".",
"__getitem__",
"."
] | def _slice_helper(tensor, slice_spec, var=None):
"""Overload for Tensor.__getitem__.
This operation extracts the specified region from the tensor.
The notation is similar to NumPy with the restriction that
currently only support basic indexing. That means that
using a non-scalar tensor as input is not curren... | [
"def",
"_slice_helper",
"(",
"tensor",
",",
"slice_spec",
",",
"var",
"=",
"None",
")",
":",
"tensor",
"=",
"ops",
".",
"convert_to_tensor",
"(",
"tensor",
")",
"# TODO(wangpeng): Consider supporting var",
"if",
"var",
"is",
"None",
"and",
"ops",
".",
"_numpy_... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/array_ops.py#L916-L1108 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py3/sklearn/utils/validation.py | python | _num_samples | (x) | Return number of samples in array-like x. | Return number of samples in array-like x. | [
"Return",
"number",
"of",
"samples",
"in",
"array",
"-",
"like",
"x",
"."
] | def _num_samples(x):
"""Return number of samples in array-like x."""
message = 'Expected sequence or array-like, got %s' % type(x)
if hasattr(x, 'fit') and callable(x.fit):
# Don't get num_samples from an ensembles length!
raise TypeError(message)
if not hasattr(x, '__len__') and not ha... | [
"def",
"_num_samples",
"(",
"x",
")",
":",
"message",
"=",
"'Expected sequence or array-like, got %s'",
"%",
"type",
"(",
"x",
")",
"if",
"hasattr",
"(",
"x",
",",
"'fit'",
")",
"and",
"callable",
"(",
"x",
".",
"fit",
")",
":",
"# Don't get num_samples from... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py3/sklearn/utils/validation.py#L136-L161 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/nntplib.py | python | _NNTPBase.description | (self, group) | return self._getdescriptions(group, False) | Get a description for a single group. If more than one
group matches ('group' is a pattern), return the first. If no
group matches, return an empty string.
This elides the response code from the server, since it can
only be '215' or '285' (for xgtitle) anyway. If the response
... | Get a description for a single group. If more than one
group matches ('group' is a pattern), return the first. If no
group matches, return an empty string. | [
"Get",
"a",
"description",
"for",
"a",
"single",
"group",
".",
"If",
"more",
"than",
"one",
"group",
"matches",
"(",
"group",
"is",
"a",
"pattern",
")",
"return",
"the",
"first",
".",
"If",
"no",
"group",
"matches",
"return",
"an",
"empty",
"string",
"... | def description(self, group):
"""Get a description for a single group. If more than one
group matches ('group' is a pattern), return the first. If no
group matches, return an empty string.
This elides the response code from the server, since it can
only be '215' or '285' (for ... | [
"def",
"description",
"(",
"self",
",",
"group",
")",
":",
"return",
"self",
".",
"_getdescriptions",
"(",
"group",
",",
"False",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/nntplib.py#L634-L645 | |
apache/qpid-proton | 6bcdfebb55ea3554bc29b1901422532db331a591 | python/proton/_endpoints.py | python | Receiver.recv | (self, limit: int) | Receive message data for the current delivery on this receiver.
.. note:: The link API can be used to stream large messages across
the network, so just because there is no data to read does not
imply the message is complete. To ensure the entirety of the
message data has bee... | Receive message data for the current delivery on this receiver. | [
"Receive",
"message",
"data",
"for",
"the",
"current",
"delivery",
"on",
"this",
"receiver",
"."
] | def recv(self, limit: int) -> Optional[bytes]:
"""
Receive message data for the current delivery on this receiver.
.. note:: The link API can be used to stream large messages across
the network, so just because there is no data to read does not
imply the message is compl... | [
"def",
"recv",
"(",
"self",
",",
"limit",
":",
"int",
")",
"->",
"Optional",
"[",
"bytes",
"]",
":",
"n",
",",
"binary",
"=",
"pn_link_recv",
"(",
"self",
".",
"_impl",
",",
"limit",
")",
"if",
"n",
"==",
"PN_EOS",
":",
"return",
"None",
"else",
... | https://github.com/apache/qpid-proton/blob/6bcdfebb55ea3554bc29b1901422532db331a591/python/proton/_endpoints.py#L1230-L1252 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/protorpc/protorpc/protourlencode.py | python | URLEncodedRequestBuilder.add_parameter | (self, parameter, values) | return True | Add a single parameter.
Adds a single parameter and its value to the request message.
Args:
parameter: Query string parameter to map to request.
values: List of values to assign to request message.
Returns:
True if parameter was valid and added to the message, else False.
Raises:
... | Add a single parameter. | [
"Add",
"a",
"single",
"parameter",
"."
] | def add_parameter(self, parameter, values):
"""Add a single parameter.
Adds a single parameter and its value to the request message.
Args:
parameter: Query string parameter to map to request.
values: List of values to assign to request message.
Returns:
True if parameter was valid a... | [
"def",
"add_parameter",
"(",
"self",
",",
"parameter",
",",
"values",
")",
":",
"path",
"=",
"self",
".",
"make_path",
"(",
"parameter",
")",
"if",
"not",
"path",
":",
"return",
"False",
"# Must check that all indexes of all items in the path are correct before",
"#... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/protorpc/protorpc/protourlencode.py#L355-L460 | |
sigmaai/self-driving-golf-cart | 8d891600af3d851add27a10ae45cf3c2108bb87c | ros/src/ros_carla_bridge/carla_ros_bridge/src/carla_ros_bridge/lidar.py | python | Lidar.__init__ | (self, carla_actor, parent, communication, synchronous_mode) | Constructor
:param carla_actor: carla actor object
:type carla_actor: carla.Actor
:param parent: the parent of this
:type parent: carla_ros_bridge.Parent
:param communication: communication-handle
:type communication: carla_ros_bridge.communication | Constructor | [
"Constructor"
] | def __init__(self, carla_actor, parent, communication, synchronous_mode):
"""
Constructor
:param carla_actor: carla actor object
:type carla_actor: carla.Actor
:param parent: the parent of this
:type parent: carla_ros_bridge.Parent
:param communication: communica... | [
"def",
"__init__",
"(",
"self",
",",
"carla_actor",
",",
"parent",
",",
"communication",
",",
"synchronous_mode",
")",
":",
"super",
"(",
"Lidar",
",",
"self",
")",
".",
"__init__",
"(",
"carla_actor",
"=",
"carla_actor",
",",
"parent",
"=",
"parent",
",",... | https://github.com/sigmaai/self-driving-golf-cart/blob/8d891600af3d851add27a10ae45cf3c2108bb87c/ros/src/ros_carla_bridge/carla_ros_bridge/src/carla_ros_bridge/lidar.py#L29-L44 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/contrib/kfac/examples/mlp.py | python | fc_layer | (layer_id, inputs, output_size) | return preactivations, activations, tuple(layer.weights) | Builds a fully connected layer.
Args:
layer_id: int. Integer ID for this layer's variables.
inputs: Tensor of shape [num_examples, input_size]. Each row corresponds
to a single example.
output_size: int. Number of output dimensions after fully connected layer.
Returns:
preactivations: Tensor... | Builds a fully connected layer. | [
"Builds",
"a",
"fully",
"connected",
"layer",
"."
] | def fc_layer(layer_id, inputs, output_size):
"""Builds a fully connected layer.
Args:
layer_id: int. Integer ID for this layer's variables.
inputs: Tensor of shape [num_examples, input_size]. Each row corresponds
to a single example.
output_size: int. Number of output dimensions after fully conne... | [
"def",
"fc_layer",
"(",
"layer_id",
",",
"inputs",
",",
"output_size",
")",
":",
"# TODO(b/67004004): Delete this function and rely on tf.layers exclusively.",
"layer",
"=",
"tf",
".",
"layers",
".",
"Dense",
"(",
"output_size",
",",
"kernel_initializer",
"=",
"tf",
"... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/kfac/examples/mlp.py#L38-L63 | |
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/find-array-given-subset-sums.py | python | Solution3.recoverArray | (self, n, sums) | return result | :type n: int
:type sums: List[int]
:rtype: List[int] | :type n: int
:type sums: List[int]
:rtype: List[int] | [
":",
"type",
"n",
":",
"int",
":",
"type",
"sums",
":",
"List",
"[",
"int",
"]",
":",
"rtype",
":",
"List",
"[",
"int",
"]"
] | def recoverArray(self, n, sums):
"""
:type n: int
:type sums: List[int]
:rtype: List[int]
"""
dp = {k: v for k, v in collections.Counter(sums).iteritems()}
total = reduce(operator.ior, dp.itervalues(), 0)
basis = total&-total # find rightmost bit 1
... | [
"def",
"recoverArray",
"(",
"self",
",",
"n",
",",
"sums",
")",
":",
"dp",
"=",
"{",
"k",
":",
"v",
"for",
"k",
",",
"v",
"in",
"collections",
".",
"Counter",
"(",
"sums",
")",
".",
"iteritems",
"(",
")",
"}",
"total",
"=",
"reduce",
"(",
"oper... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/find-array-given-subset-sums.py#L104-L137 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py3/scipy/stats/stats.py | python | kruskal | (*args, **kwargs) | return KruskalResult(h, distributions.chi2.sf(h, df)) | Compute the Kruskal-Wallis H-test for independent samples
The Kruskal-Wallis H-test tests the null hypothesis that the population
median of all of the groups are equal. It is a non-parametric version of
ANOVA. The test works on 2 or more independent samples, which may have
different sizes. Note that... | Compute the Kruskal-Wallis H-test for independent samples | [
"Compute",
"the",
"Kruskal",
"-",
"Wallis",
"H",
"-",
"test",
"for",
"independent",
"samples"
] | def kruskal(*args, **kwargs):
"""
Compute the Kruskal-Wallis H-test for independent samples
The Kruskal-Wallis H-test tests the null hypothesis that the population
median of all of the groups are equal. It is a non-parametric version of
ANOVA. The test works on 2 or more independent samples, whic... | [
"def",
"kruskal",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"args",
"=",
"list",
"(",
"map",
"(",
"np",
".",
"asarray",
",",
"args",
")",
")",
"num_groups",
"=",
"len",
"(",
"args",
")",
"if",
"num_groups",
"<",
"2",
":",
"raise",
"V... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py3/scipy/stats/stats.py#L5107-L5221 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | third_party/python_gflags/gflags.py | python | DEFINE_boolean | (name, default, help, flag_values=FLAGS, **args) | Registers a boolean flag.
Such a boolean flag does not take an argument. If a user wants to
specify a false value explicitly, the long option beginning with 'no'
must be used: i.e. --noflag
This flag will have a value of None, True or False. None is possible
if default=None and the user does not specify t... | Registers a boolean flag. | [
"Registers",
"a",
"boolean",
"flag",
"."
] | def DEFINE_boolean(name, default, help, flag_values=FLAGS, **args):
"""Registers a boolean flag.
Such a boolean flag does not take an argument. If a user wants to
specify a false value explicitly, the long option beginning with 'no'
must be used: i.e. --noflag
This flag will have a value of None, True or F... | [
"def",
"DEFINE_boolean",
"(",
"name",
",",
"default",
",",
"help",
",",
"flag_values",
"=",
"FLAGS",
",",
"*",
"*",
"args",
")",
":",
"DEFINE_flag",
"(",
"BooleanFlag",
"(",
"name",
",",
"default",
",",
"help",
",",
"*",
"*",
"args",
")",
",",
"flag_... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/third_party/python_gflags/gflags.py#L2367-L2378 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_gdi.py | python | DC.GetSizeMMTuple | (*args, **kwargs) | return _gdi_.DC_GetSizeMMTuple(*args, **kwargs) | GetSizeMMTuple() -> (width, height)
Get the DC size in milimeters. | GetSizeMMTuple() -> (width, height) | [
"GetSizeMMTuple",
"()",
"-",
">",
"(",
"width",
"height",
")"
] | def GetSizeMMTuple(*args, **kwargs):
"""
GetSizeMMTuple() -> (width, height)
Get the DC size in milimeters.
"""
return _gdi_.DC_GetSizeMMTuple(*args, **kwargs) | [
"def",
"GetSizeMMTuple",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"DC_GetSizeMMTuple",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_gdi.py#L4207-L4213 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/Jinja2/py3/jinja2/filters.py | python | do_forceescape | (value: "t.Union[str, HasHTML]") | return escape(str(value)) | Enforce HTML escaping. This will probably double escape variables. | Enforce HTML escaping. This will probably double escape variables. | [
"Enforce",
"HTML",
"escaping",
".",
"This",
"will",
"probably",
"double",
"escape",
"variables",
"."
] | def do_forceescape(value: "t.Union[str, HasHTML]") -> Markup:
"""Enforce HTML escaping. This will probably double escape variables."""
if hasattr(value, "__html__"):
value = t.cast("HasHTML", value).__html__()
return escape(str(value)) | [
"def",
"do_forceescape",
"(",
"value",
":",
"\"t.Union[str, HasHTML]\"",
")",
"->",
"Markup",
":",
"if",
"hasattr",
"(",
"value",
",",
"\"__html__\"",
")",
":",
"value",
"=",
"t",
".",
"cast",
"(",
"\"HasHTML\"",
",",
"value",
")",
".",
"__html__",
"(",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/Jinja2/py3/jinja2/filters.py#L189-L194 | |
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/check-completeness-of-a-binary-tree.py | python | Solution.isCompleteTree | (self, root) | return True | :type root: TreeNode
:rtype: bool | :type root: TreeNode
:rtype: bool | [
":",
"type",
"root",
":",
"TreeNode",
":",
"rtype",
":",
"bool"
] | def isCompleteTree(self, root):
"""
:type root: TreeNode
:rtype: bool
"""
end = False
current = [root]
while current:
next_level = []
for node in current:
if not node:
end = True
conti... | [
"def",
"isCompleteTree",
"(",
"self",
",",
"root",
")",
":",
"end",
"=",
"False",
"current",
"=",
"[",
"root",
"]",
"while",
"current",
":",
"next_level",
"=",
"[",
"]",
"for",
"node",
"in",
"current",
":",
"if",
"not",
"node",
":",
"end",
"=",
"Tr... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/check-completeness-of-a-binary-tree.py#L13-L31 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | third_party/protobuf/python/google/protobuf/internal/containers.py | python | RepeatedScalarFieldContainer.__init__ | (self, message_listener, type_checker) | Args:
message_listener: A MessageListener implementation.
The RepeatedScalarFieldContainer will call this object's
Modified() method when it is modified.
type_checker: A type_checkers.ValueChecker instance to run on elements
inserted into this container. | Args:
message_listener: A MessageListener implementation.
The RepeatedScalarFieldContainer will call this object's
Modified() method when it is modified.
type_checker: A type_checkers.ValueChecker instance to run on elements
inserted into this container. | [
"Args",
":",
"message_listener",
":",
"A",
"MessageListener",
"implementation",
".",
"The",
"RepeatedScalarFieldContainer",
"will",
"call",
"this",
"object",
"s",
"Modified",
"()",
"method",
"when",
"it",
"is",
"modified",
".",
"type_checker",
":",
"A",
"type_chec... | def __init__(self, message_listener, type_checker):
"""
Args:
message_listener: A MessageListener implementation.
The RepeatedScalarFieldContainer will call this object's
Modified() method when it is modified.
type_checker: A type_checkers.ValueChecker instance to run on elements
... | [
"def",
"__init__",
"(",
"self",
",",
"message_listener",
",",
"type_checker",
")",
":",
"super",
"(",
"RepeatedScalarFieldContainer",
",",
"self",
")",
".",
"__init__",
"(",
"message_listener",
")",
"self",
".",
"_type_checker",
"=",
"type_checker"
] | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/third_party/protobuf/python/google/protobuf/internal/containers.py#L97-L107 | ||
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Node/FS.py | python | File.get_max_drift_csig | (self) | return None | Returns the content signature currently stored for this node
if it's been unmodified longer than the max_drift value, or the
max_drift value is 0. Returns None otherwise. | Returns the content signature currently stored for this node
if it's been unmodified longer than the max_drift value, or the
max_drift value is 0. Returns None otherwise. | [
"Returns",
"the",
"content",
"signature",
"currently",
"stored",
"for",
"this",
"node",
"if",
"it",
"s",
"been",
"unmodified",
"longer",
"than",
"the",
"max_drift",
"value",
"or",
"the",
"max_drift",
"value",
"is",
"0",
".",
"Returns",
"None",
"otherwise",
"... | def get_max_drift_csig(self):
"""
Returns the content signature currently stored for this node
if it's been unmodified longer than the max_drift value, or the
max_drift value is 0. Returns None otherwise.
"""
old = self.get_stored_info()
mtime = self.get_timestam... | [
"def",
"get_max_drift_csig",
"(",
"self",
")",
":",
"old",
"=",
"self",
".",
"get_stored_info",
"(",
")",
"mtime",
"=",
"self",
".",
"get_timestamp",
"(",
")",
"max_drift",
"=",
"self",
".",
"fs",
".",
"max_drift",
"if",
"max_drift",
">",
"0",
":",
"if... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Node/FS.py#L3168-L3192 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/PyChop/Instruments.py | python | FermiChopper.getTransmission | (self, Ei, freq) | return Chop.achop(Ei, freq, dslat, self.pslit / 1000., self.radius / 1000., self.rho / 1000.) / dslat | Calculates the chopper transmission | Calculates the chopper transmission | [
"Calculates",
"the",
"chopper",
"transmission"
] | def getTransmission(self, Ei, freq):
""" Calculates the chopper transmission """
dslat = (self.pslit + self.pslat) / 1000
return Chop.achop(Ei, freq, dslat, self.pslit / 1000., self.radius / 1000., self.rho / 1000.) / dslat | [
"def",
"getTransmission",
"(",
"self",
",",
"Ei",
",",
"freq",
")",
":",
"dslat",
"=",
"(",
"self",
".",
"pslit",
"+",
"self",
".",
"pslat",
")",
"/",
"1000",
"return",
"Chop",
".",
"achop",
"(",
"Ei",
",",
"freq",
",",
"dslat",
",",
"self",
".",... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/PyChop/Instruments.py#L98-L101 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/training/input.py | python | _select_which_to_enqueue | (tensor_list, keep_input) | return tensor_list | Select which examples to enqueue based on vector `keep_input`. | Select which examples to enqueue based on vector `keep_input`. | [
"Select",
"which",
"examples",
"to",
"enqueue",
"based",
"on",
"vector",
"keep_input",
"."
] | def _select_which_to_enqueue(tensor_list, keep_input):
"""Select which examples to enqueue based on vector `keep_input`."""
select_i = math_ops.cast(keep_input, dtypes.int32)
tensor_list = [
data_flow_ops.dynamic_partition(x, select_i, num_partitions=2)[1]
for x in tensor_list]
return tensor_list | [
"def",
"_select_which_to_enqueue",
"(",
"tensor_list",
",",
"keep_input",
")",
":",
"select_i",
"=",
"math_ops",
".",
"cast",
"(",
"keep_input",
",",
"dtypes",
".",
"int32",
")",
"tensor_list",
"=",
"[",
"data_flow_ops",
".",
"dynamic_partition",
"(",
"x",
","... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/training/input.py#L709-L715 | |
xenia-project/xenia | 9b1fdac98665ac091b9660a5d0fbb259ed79e578 | third_party/google-styleguide/cpplint/cpplint.py | python | CheckVlogArguments | (filename, clean_lines, linenum, error) | Checks that VLOG() is only used for defining a logging level.
For example, VLOG(2) is correct. VLOG(INFO), VLOG(WARNING), VLOG(ERROR), and
VLOG(FATAL) are not.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to ... | Checks that VLOG() is only used for defining a logging level. | [
"Checks",
"that",
"VLOG",
"()",
"is",
"only",
"used",
"for",
"defining",
"a",
"logging",
"level",
"."
] | def CheckVlogArguments(filename, clean_lines, linenum, error):
"""Checks that VLOG() is only used for defining a logging level.
For example, VLOG(2) is correct. VLOG(INFO), VLOG(WARNING), VLOG(ERROR), and
VLOG(FATAL) are not.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines i... | [
"def",
"CheckVlogArguments",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"if",
"Search",
"(",
"r'\\bVLOG\\((INFO|ERROR|WARNING|DFATAL|FATAL)\\)'",
",",
"line",
")",
... | https://github.com/xenia-project/xenia/blob/9b1fdac98665ac091b9660a5d0fbb259ed79e578/third_party/google-styleguide/cpplint/cpplint.py#L1772-L1788 | ||
infinit/elle | a8154593c42743f45b9df09daf62b44630c24a02 | drake/src/drake/__init__.py | python | BaseNode.dot | (self, marks) | return True | Print a dot representation of this node build graph. | Print a dot representation of this node build graph. | [
"Print",
"a",
"dot",
"representation",
"of",
"this",
"node",
"build",
"graph",
"."
] | def dot(self, marks):
"""Print a dot representation of this node build graph."""
if self in marks:
return True
marks[self] = None
print(' node_%s [label="%s"]' % (self.uid, self.__name))
if self.builder is not None:
if self.builder.dot(marks):
print(' builder_%s -> node_%s' % (... | [
"def",
"dot",
"(",
"self",
",",
"marks",
")",
":",
"if",
"self",
"in",
"marks",
":",
"return",
"True",
"marks",
"[",
"self",
"]",
"=",
"None",
"print",
"(",
"' node_%s [label=\"%s\"]'",
"%",
"(",
"self",
".",
"uid",
",",
"self",
".",
"__name",
")",
... | https://github.com/infinit/elle/blob/a8154593c42743f45b9df09daf62b44630c24a02/drake/src/drake/__init__.py#L1410-L1420 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/aui/auibook.py | python | TabFrame.DoSetSize | (self, x, y, width, height, flags=wx.SIZE_AUTO) | Sets the position and size of the window in pixels. The `flags`
parameter indicates the interpretation of the other params if they are
equal to -1.
:param integer `x`: the window `x` position;
:param integer `y`: the window `y` position;
:param integer `width`: the window width;... | Sets the position and size of the window in pixels. The `flags`
parameter indicates the interpretation of the other params if they are
equal to -1. | [
"Sets",
"the",
"position",
"and",
"size",
"of",
"the",
"window",
"in",
"pixels",
".",
"The",
"flags",
"parameter",
"indicates",
"the",
"interpretation",
"of",
"the",
"other",
"params",
"if",
"they",
"are",
"equal",
"to",
"-",
"1",
"."
] | def DoSetSize(self, x, y, width, height, flags=wx.SIZE_AUTO):
"""
Sets the position and size of the window in pixels. The `flags`
parameter indicates the interpretation of the other params if they are
equal to -1.
:param integer `x`: the window `x` position;
:param integ... | [
"def",
"DoSetSize",
"(",
"self",
",",
"x",
",",
"y",
",",
"width",
",",
"height",
",",
"flags",
"=",
"wx",
".",
"SIZE_AUTO",
")",
":",
"self",
".",
"_rect",
"=",
"wx",
".",
"Rect",
"(",
"x",
",",
"y",
",",
"max",
"(",
"1",
",",
"width",
")",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/aui/auibook.py#L2663-L2693 | ||
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Source/ThirdParty/CEF3/cef_source/tools/automate/automate-git.py | python | copy_directory | (source, target, allow_overwrite=False) | Copies a directory from source to target. | Copies a directory from source to target. | [
"Copies",
"a",
"directory",
"from",
"source",
"to",
"target",
"."
] | def copy_directory(source, target, allow_overwrite=False):
""" Copies a directory from source to target. """
if not options.dryrun and os.path.exists(target):
if not allow_overwrite:
raise Exception("Directory %s already exists" % (target))
remove_directory(target)
if os.path.exists(source):
msg... | [
"def",
"copy_directory",
"(",
"source",
",",
"target",
",",
"allow_overwrite",
"=",
"False",
")",
":",
"if",
"not",
"options",
".",
"dryrun",
"and",
"os",
".",
"path",
".",
"exists",
"(",
"target",
")",
":",
"if",
"not",
"allow_overwrite",
":",
"raise",
... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Source/ThirdParty/CEF3/cef_source/tools/automate/automate-git.py#L75-L84 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py2/sklearn/pipeline.py | python | Pipeline.score | (self, X, y=None) | return self.steps[-1][-1].score(Xt, y) | Apply transforms, and score with the final estimator
Parameters
----------
X : iterable
Data to predict on. Must fulfill input requirements of first step
of the pipeline.
y : iterable, default=None
Targets used for scoring. Must fulfill label require... | Apply transforms, and score with the final estimator | [
"Apply",
"transforms",
"and",
"score",
"with",
"the",
"final",
"estimator"
] | def score(self, X, y=None):
"""Apply transforms, and score with the final estimator
Parameters
----------
X : iterable
Data to predict on. Must fulfill input requirements of first step
of the pipeline.
y : iterable, default=None
Targets used ... | [
"def",
"score",
"(",
"self",
",",
"X",
",",
"y",
"=",
"None",
")",
":",
"Xt",
"=",
"X",
"for",
"name",
",",
"transform",
"in",
"self",
".",
"steps",
"[",
":",
"-",
"1",
"]",
":",
"if",
"transform",
"is",
"not",
"None",
":",
"Xt",
"=",
"transf... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py2/sklearn/pipeline.py#L484-L505 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/rnn/python/ops/rnn_cell.py | python | _random_exp_initializer | (minval,
maxval,
seed=None,
dtype=dtypes.float32) | return _initializer | Returns an exponential distribution initializer.
Args:
minval: float or a scalar float Tensor. With value > 0. Lower bound of the
range of random values to generate.
maxval: float or a scalar float Tensor. With value > minval. Upper bound of
the range of random values to generate.
seed: A... | Returns an exponential distribution initializer. | [
"Returns",
"an",
"exponential",
"distribution",
"initializer",
"."
] | def _random_exp_initializer(minval,
maxval,
seed=None,
dtype=dtypes.float32):
"""Returns an exponential distribution initializer.
Args:
minval: float or a scalar float Tensor. With value > 0. Lower bound of the
range of... | [
"def",
"_random_exp_initializer",
"(",
"minval",
",",
"maxval",
",",
"seed",
"=",
"None",
",",
"dtype",
"=",
"dtypes",
".",
"float32",
")",
":",
"def",
"_initializer",
"(",
"shape",
",",
"dtype",
"=",
"dtype",
",",
"partition_info",
"=",
"None",
")",
":"... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/rnn/python/ops/rnn_cell.py#L1751-L1779 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/python2_version/klampt/model/collide.py | python | bb_intersect | (a,b) | return not any(q < u or v < p for (p,q,u,v) in zip(amin,amax,bmin,bmax)) | Returns true if the bounding boxes (a[0]->a[1]) and (b[0]->b[1]) intersect | Returns true if the bounding boxes (a[0]->a[1]) and (b[0]->b[1]) intersect | [
"Returns",
"true",
"if",
"the",
"bounding",
"boxes",
"(",
"a",
"[",
"0",
"]",
"-",
">",
"a",
"[",
"1",
"]",
")",
"and",
"(",
"b",
"[",
"0",
"]",
"-",
">",
"b",
"[",
"1",
"]",
")",
"intersect"
] | def bb_intersect(a,b):
"""Returns true if the bounding boxes (a[0]->a[1]) and (b[0]->b[1]) intersect"""
amin,amax=a
bmin,bmax=b
return not any(q < u or v < p for (p,q,u,v) in zip(amin,amax,bmin,bmax)) | [
"def",
"bb_intersect",
"(",
"a",
",",
"b",
")",
":",
"amin",
",",
"amax",
"=",
"a",
"bmin",
",",
"bmax",
"=",
"b",
"return",
"not",
"any",
"(",
"q",
"<",
"u",
"or",
"v",
"<",
"p",
"for",
"(",
"p",
",",
"q",
",",
"u",
",",
"v",
")",
"in",
... | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/python2_version/klampt/model/collide.py#L19-L23 | |
grpc/grpc | 27bc6fe7797e43298dc931b96dc57322d0852a9f | src/python/grpcio/grpc/__init__.py | python | ServicerContext.code | (self) | Accesses the value to be used as status code upon RPC completion.
This is an EXPERIMENTAL API.
Returns:
The StatusCode value for the RPC. | Accesses the value to be used as status code upon RPC completion. | [
"Accesses",
"the",
"value",
"to",
"be",
"used",
"as",
"status",
"code",
"upon",
"RPC",
"completion",
"."
] | def code(self):
"""Accesses the value to be used as status code upon RPC completion.
This is an EXPERIMENTAL API.
Returns:
The StatusCode value for the RPC.
"""
raise NotImplementedError() | [
"def",
"code",
"(",
"self",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | https://github.com/grpc/grpc/blob/27bc6fe7797e43298dc931b96dc57322d0852a9f/src/python/grpcio/grpc/__init__.py#L1254-L1262 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/array_analysis.py | python | EquivSet.insert_equiv | (self, *objs) | return self._insert(objs) | Insert a set of equivalent objects by modifying self. This
method can be overloaded to transform object type before insertion. | Insert a set of equivalent objects by modifying self. This
method can be overloaded to transform object type before insertion. | [
"Insert",
"a",
"set",
"of",
"equivalent",
"objects",
"by",
"modifying",
"self",
".",
"This",
"method",
"can",
"be",
"overloaded",
"to",
"transform",
"object",
"type",
"before",
"insertion",
"."
] | def insert_equiv(self, *objs):
"""Insert a set of equivalent objects by modifying self. This
method can be overloaded to transform object type before insertion.
"""
return self._insert(objs) | [
"def",
"insert_equiv",
"(",
"self",
",",
"*",
"objs",
")",
":",
"return",
"self",
".",
"_insert",
"(",
"objs",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/array_analysis.py#L279-L283 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/indexes/range.py | python | RangeIndex._start | (self) | return self.start | The value of the `start` parameter (``0`` if this was not supplied).
.. deprecated:: 0.25.0
Use ``start`` instead. | The value of the `start` parameter (``0`` if this was not supplied). | [
"The",
"value",
"of",
"the",
"start",
"parameter",
"(",
"0",
"if",
"this",
"was",
"not",
"supplied",
")",
"."
] | def _start(self):
"""
The value of the `start` parameter (``0`` if this was not supplied).
.. deprecated:: 0.25.0
Use ``start`` instead.
"""
warnings.warn(
self._deprecation_message.format("_start", "start"),
FutureWarning,
stackl... | [
"def",
"_start",
"(",
"self",
")",
":",
"warnings",
".",
"warn",
"(",
"self",
".",
"_deprecation_message",
".",
"format",
"(",
"\"_start\"",
",",
"\"start\"",
")",
",",
"FutureWarning",
",",
"stacklevel",
"=",
"2",
",",
")",
"return",
"self",
".",
"start... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/indexes/range.py#L219-L231 | |
google/syzygy | 8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5 | third_party/numpy/files/numpy/lib/polynomial.py | python | poly1d.deriv | (self, m=1) | return poly1d(polyder(self.coeffs, m=m)) | Return a derivative of this polynomial.
Refer to `polyder` for full documentation.
See Also
--------
polyder : equivalent function | Return a derivative of this polynomial. | [
"Return",
"a",
"derivative",
"of",
"this",
"polynomial",
"."
] | def deriv(self, m=1):
"""
Return a derivative of this polynomial.
Refer to `polyder` for full documentation.
See Also
--------
polyder : equivalent function
"""
return poly1d(polyder(self.coeffs, m=m)) | [
"def",
"deriv",
"(",
"self",
",",
"m",
"=",
"1",
")",
":",
"return",
"poly1d",
"(",
"polyder",
"(",
"self",
".",
"coeffs",
",",
"m",
"=",
"m",
")",
")"
] | https://github.com/google/syzygy/blob/8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5/third_party/numpy/files/numpy/lib/polynomial.py#L1218-L1229 | |
cocos-creator/engine-native | 984c4c9f5838253313b44ccd429bd8fac4ec8a6a | tools/bindings-generator/clang/cindex.py | python | Cursor.is_scoped_enum | (self) | return conf.lib.clang_EnumDecl_isScoped(self) | Returns True if the cursor refers to a scoped enum declaration. | Returns True if the cursor refers to a scoped enum declaration. | [
"Returns",
"True",
"if",
"the",
"cursor",
"refers",
"to",
"a",
"scoped",
"enum",
"declaration",
"."
] | def is_scoped_enum(self):
"""Returns True if the cursor refers to a scoped enum declaration.
"""
return conf.lib.clang_EnumDecl_isScoped(self) | [
"def",
"is_scoped_enum",
"(",
"self",
")",
":",
"return",
"conf",
".",
"lib",
".",
"clang_EnumDecl_isScoped",
"(",
"self",
")"
] | https://github.com/cocos-creator/engine-native/blob/984c4c9f5838253313b44ccd429bd8fac4ec8a6a/tools/bindings-generator/clang/cindex.py#L1506-L1509 | |
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/contrib/learn/python/learn/supervised_session.py | python | Scaffold.finalize | (self) | Creates operations if needed and finalizes the graph. | Creates operations if needed and finalizes the graph. | [
"Creates",
"operations",
"if",
"needed",
"and",
"finalizes",
"the",
"graph",
"."
] | def finalize(self):
"""Creates operations if needed and finalizes the graph."""
if self._global_step_tensor is None:
self._global_step_tensor = contrib_variables.get_or_create_global_step()
if self._init_op is None:
self._init_op = Scaffold._get_or_default(
'init_op', ops.GraphKeys.INI... | [
"def",
"finalize",
"(",
"self",
")",
":",
"if",
"self",
".",
"_global_step_tensor",
"is",
"None",
":",
"self",
".",
"_global_step_tensor",
"=",
"contrib_variables",
".",
"get_or_create_global_step",
"(",
")",
"if",
"self",
".",
"_init_op",
"is",
"None",
":",
... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/contrib/learn/python/learn/supervised_session.py#L139-L167 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_core.py | python | Point2D.Set | (*args, **kwargs) | return _core_.Point2D_Set(*args, **kwargs) | Set(self, double x=0, double y=0) | Set(self, double x=0, double y=0) | [
"Set",
"(",
"self",
"double",
"x",
"=",
"0",
"double",
"y",
"=",
"0",
")"
] | def Set(*args, **kwargs):
"""Set(self, double x=0, double y=0)"""
return _core_.Point2D_Set(*args, **kwargs) | [
"def",
"Set",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"Point2D_Set",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_core.py#L1774-L1776 | |
douban/paracel | d1548dd94cff9123653689e385253bb34c3260c2 | prun.py | python | init_starter | (method, mem_limit, ppn, hostfile, group) | return starter | Assemble commands for running paracel programs | Assemble commands for running paracel programs | [
"Assemble",
"commands",
"for",
"running",
"paracel",
"programs"
] | def init_starter(method, mem_limit, ppn, hostfile, group):
'''Assemble commands for running paracel programs'''
starter = ''
if not hostfile:
hostfile = '~/.mpi/large.18'
if method == 'mesos':
if group:
starter = '%s/mrun -m %s -p %s -g %s -n ' % (PARACEL_INSTALL_PREFIX, mem_... | [
"def",
"init_starter",
"(",
"method",
",",
"mem_limit",
",",
"ppn",
",",
"hostfile",
",",
"group",
")",
":",
"starter",
"=",
"''",
"if",
"not",
"hostfile",
":",
"hostfile",
"=",
"'~/.mpi/large.18'",
"if",
"method",
"==",
"'mesos'",
":",
"if",
"group",
":... | https://github.com/douban/paracel/blob/d1548dd94cff9123653689e385253bb34c3260c2/prun.py#L66-L83 | |
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/mailbox.py | python | MH.__len__ | (self) | return len(list(self.iterkeys())) | Return a count of messages in the mailbox. | Return a count of messages in the mailbox. | [
"Return",
"a",
"count",
"of",
"messages",
"in",
"the",
"mailbox",
"."
] | def __len__(self):
"""Return a count of messages in the mailbox."""
return len(list(self.iterkeys())) | [
"def",
"__len__",
"(",
"self",
")",
":",
"return",
"len",
"(",
"list",
"(",
"self",
".",
"iterkeys",
"(",
")",
")",
")"
] | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/mailbox.py#L962-L964 | |
bulletphysics/bullet3 | f0f2a952e146f016096db6f85cf0c44ed75b0b9a | examples/pybullet/gym/pybullet_envs/bullet/minitaur_duck_gym_env.py | python | MinitaurBulletDuckEnv.get_minitaur_motor_velocities | (self) | return np.array(
self._observation[MOTOR_VELOCITY_OBSERVATION_INDEX:MOTOR_VELOCITY_OBSERVATION_INDEX +
NUM_MOTORS]) | Get the minitaur's motor velocities.
Returns:
A numpy array of motor velocities. | Get the minitaur's motor velocities. | [
"Get",
"the",
"minitaur",
"s",
"motor",
"velocities",
"."
] | def get_minitaur_motor_velocities(self):
"""Get the minitaur's motor velocities.
Returns:
A numpy array of motor velocities.
"""
return np.array(
self._observation[MOTOR_VELOCITY_OBSERVATION_INDEX:MOTOR_VELOCITY_OBSERVATION_INDEX +
NUM_MOTORS]) | [
"def",
"get_minitaur_motor_velocities",
"(",
"self",
")",
":",
"return",
"np",
".",
"array",
"(",
"self",
".",
"_observation",
"[",
"MOTOR_VELOCITY_OBSERVATION_INDEX",
":",
"MOTOR_VELOCITY_OBSERVATION_INDEX",
"+",
"NUM_MOTORS",
"]",
")"
] | https://github.com/bulletphysics/bullet3/blob/f0f2a952e146f016096db6f85cf0c44ed75b0b9a/examples/pybullet/gym/pybullet_envs/bullet/minitaur_duck_gym_env.py#L303-L311 | |
llvm/llvm-project | ffa6262cb4e2a335d26416fad39a581b4f98c5f4 | lldb/examples/customization/bin-utils/binutils.py | python | positions | (width) | return ['{0:2}'.format(i)[-2:] for i in reversed(range(width))] | Helper function returning a list describing the bit positions.
Bit positions greater than 99 are truncated to 2 digits, for example,
100 -> 00 and 127 -> 27. | Helper function returning a list describing the bit positions.
Bit positions greater than 99 are truncated to 2 digits, for example,
100 -> 00 and 127 -> 27. | [
"Helper",
"function",
"returning",
"a",
"list",
"describing",
"the",
"bit",
"positions",
".",
"Bit",
"positions",
"greater",
"than",
"99",
"are",
"truncated",
"to",
"2",
"digits",
"for",
"example",
"100",
"-",
">",
"00",
"and",
"127",
"-",
">",
"27",
"."... | def positions(width):
"""Helper function returning a list describing the bit positions.
Bit positions greater than 99 are truncated to 2 digits, for example,
100 -> 00 and 127 -> 27."""
return ['{0:2}'.format(i)[-2:] for i in reversed(range(width))] | [
"def",
"positions",
"(",
"width",
")",
":",
"return",
"[",
"'{0:2}'",
".",
"format",
"(",
"i",
")",
"[",
"-",
"2",
":",
"]",
"for",
"i",
"in",
"reversed",
"(",
"range",
"(",
"width",
")",
")",
"]"
] | https://github.com/llvm/llvm-project/blob/ffa6262cb4e2a335d26416fad39a581b4f98c5f4/lldb/examples/customization/bin-utils/binutils.py#L58-L62 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | models/AI-Model-Zoo/caffe-xilinx/scripts/cpp_lint.py | python | _NestingState.UpdatePreprocessor | (self, line) | Update preprocessor stack.
We need to handle preprocessors due to classes like this:
#ifdef SWIG
struct ResultDetailsPageElementExtensionPoint {
#else
struct ResultDetailsPageElementExtensionPoint : public Extension {
#endif
We make the following assumptions (good enough for most... | Update preprocessor stack. | [
"Update",
"preprocessor",
"stack",
"."
] | def UpdatePreprocessor(self, line):
"""Update preprocessor stack.
We need to handle preprocessors due to classes like this:
#ifdef SWIG
struct ResultDetailsPageElementExtensionPoint {
#else
struct ResultDetailsPageElementExtensionPoint : public Extension {
#endif
We make the ... | [
"def",
"UpdatePreprocessor",
"(",
"self",
",",
"line",
")",
":",
"if",
"Match",
"(",
"r'^\\s*#\\s*(if|ifdef|ifndef)\\b'",
",",
"line",
")",
":",
"# Beginning of #if block, save the nesting stack here. The saved",
"# stack will allow us to restore the parsing state in the #else cas... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/models/AI-Model-Zoo/caffe-xilinx/scripts/cpp_lint.py#L1948-L2002 | ||
cms-sw/cmssw | fd9de012d503d3405420bcbeec0ec879baa57cf2 | Validation/RecoTrack/python/plotting/plotting.py | python | PlotTextBox.__init__ | (self, xmin, ymin, xmax, ymax, lineheight=0.04, fillColor=ROOT.kWhite, transparent=True, **kwargs) | Constructor
Arguments:
xmin -- X min coordinate of the box (NDC)
ymin -- Y min coordinate of the box (NDC) (if None, deduced automatically)
xmax -- X max coordinate of the box (NDC)
ymax -- Y max coordinate of the box (NDC)
lineheight -- Line... | Constructor | [
"Constructor"
] | def __init__(self, xmin, ymin, xmax, ymax, lineheight=0.04, fillColor=ROOT.kWhite, transparent=True, **kwargs):
"""Constructor
Arguments:
xmin -- X min coordinate of the box (NDC)
ymin -- Y min coordinate of the box (NDC) (if None, deduced automatically)
xmax ... | [
"def",
"__init__",
"(",
"self",
",",
"xmin",
",",
"ymin",
",",
"xmax",
",",
"ymax",
",",
"lineheight",
"=",
"0.04",
",",
"fillColor",
"=",
"ROOT",
".",
"kWhite",
",",
"transparent",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"# ROOT.TPave Set/GetX... | https://github.com/cms-sw/cmssw/blob/fd9de012d503d3405420bcbeec0ec879baa57cf2/Validation/RecoTrack/python/plotting/plotting.py#L1585-L1611 | ||
yan99033/CNN-SVO | d5591ea88103f8d1b26e5296129bf3b3196a14f1 | rpg_vikit/vikit_py/src/vikit_py/transformations.py | python | decompose_matrix | (matrix) | return scale, shear, angles, translate, perspective | Return sequence of transformations from transformation matrix.
matrix : array_like
Non-degenerative homogeneous transformation matrix
Return tuple of:
scale : vector of 3 scaling factors
shear : list of shear factors for x-y, x-z, y-z axes
angles : list of Euler angles about st... | Return sequence of transformations from transformation matrix. | [
"Return",
"sequence",
"of",
"transformations",
"from",
"transformation",
"matrix",
"."
] | def decompose_matrix(matrix):
"""Return sequence of transformations from transformation matrix.
matrix : array_like
Non-degenerative homogeneous transformation matrix
Return tuple of:
scale : vector of 3 scaling factors
shear : list of shear factors for x-y, x-z, y-z axes
a... | [
"def",
"decompose_matrix",
"(",
"matrix",
")",
":",
"M",
"=",
"numpy",
".",
"array",
"(",
"matrix",
",",
"dtype",
"=",
"numpy",
".",
"float64",
",",
"copy",
"=",
"True",
")",
".",
"T",
"if",
"abs",
"(",
"M",
"[",
"3",
",",
"3",
"]",
")",
"<",
... | https://github.com/yan99033/CNN-SVO/blob/d5591ea88103f8d1b26e5296129bf3b3196a14f1/rpg_vikit/vikit_py/src/vikit_py/transformations.py#L704-L786 | |
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | deps/src/libxml2-2.9.1/python/libxml2.py | python | xmlNode.addChildList | (self, cur) | return __tmp | Add a list of node at the end of the child list of the
parent merging adjacent TEXT nodes (@cur may be freed) | Add a list of node at the end of the child list of the
parent merging adjacent TEXT nodes ( | [
"Add",
"a",
"list",
"of",
"node",
"at",
"the",
"end",
"of",
"the",
"child",
"list",
"of",
"the",
"parent",
"merging",
"adjacent",
"TEXT",
"nodes",
"("
] | def addChildList(self, cur):
"""Add a list of node at the end of the child list of the
parent merging adjacent TEXT nodes (@cur may be freed) """
if cur is None: cur__o = None
else: cur__o = cur._o
ret = libxml2mod.xmlAddChildList(self._o, cur__o)
if ret is None:raise ... | [
"def",
"addChildList",
"(",
"self",
",",
"cur",
")",
":",
"if",
"cur",
"is",
"None",
":",
"cur__o",
"=",
"None",
"else",
":",
"cur__o",
"=",
"cur",
".",
"_o",
"ret",
"=",
"libxml2mod",
".",
"xmlAddChildList",
"(",
"self",
".",
"_o",
",",
"cur__o",
... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/deps/src/libxml2-2.9.1/python/libxml2.py#L3088-L3096 | |
domino-team/openwrt-cc | 8b181297c34d14d3ca521cc9f31430d561dbc688 | package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/tools/gyp/pylib/gyp/generator/analyzer.py | python | _ToGypPath | (path) | return path | Converts a path to the format used by gyp. | Converts a path to the format used by gyp. | [
"Converts",
"a",
"path",
"to",
"the",
"format",
"used",
"by",
"gyp",
"."
] | def _ToGypPath(path):
"""Converts a path to the format used by gyp."""
if os.sep == '\\' and os.altsep == '/':
return path.replace('\\', '/')
return path | [
"def",
"_ToGypPath",
"(",
"path",
")",
":",
"if",
"os",
".",
"sep",
"==",
"'\\\\'",
"and",
"os",
".",
"altsep",
"==",
"'/'",
":",
"return",
"path",
".",
"replace",
"(",
"'\\\\'",
",",
"'/'",
")",
"return",
"path"
] | https://github.com/domino-team/openwrt-cc/blob/8b181297c34d14d3ca521cc9f31430d561dbc688/package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/tools/gyp/pylib/gyp/generator/analyzer.py#L76-L80 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/propgrid.py | python | PropertyGrid.GetCommonValueLabel | (*args, **kwargs) | return _propgrid.PropertyGrid_GetCommonValueLabel(*args, **kwargs) | GetCommonValueLabel(self, int i) -> String | GetCommonValueLabel(self, int i) -> String | [
"GetCommonValueLabel",
"(",
"self",
"int",
"i",
")",
"-",
">",
"String"
] | def GetCommonValueLabel(*args, **kwargs):
"""GetCommonValueLabel(self, int i) -> String"""
return _propgrid.PropertyGrid_GetCommonValueLabel(*args, **kwargs) | [
"def",
"GetCommonValueLabel",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_propgrid",
".",
"PropertyGrid_GetCommonValueLabel",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/propgrid.py#L2327-L2329 | |
ZhouWeikuan/DouDiZhu | 0d84ff6c0bc54dba6ae37955de9ae9307513dc99 | code/frameworks/cocos2d-x/tools/bindings-generator/backup/clang-llvm-3.3-pybinding/cindex.py | python | SourceLocation.file | (self) | return self._get_instantiation()[0] | Get the file represented by this source location. | Get the file represented by this source location. | [
"Get",
"the",
"file",
"represented",
"by",
"this",
"source",
"location",
"."
] | def file(self):
"""Get the file represented by this source location."""
return self._get_instantiation()[0] | [
"def",
"file",
"(",
"self",
")",
":",
"return",
"self",
".",
"_get_instantiation",
"(",
")",
"[",
"0",
"]"
] | https://github.com/ZhouWeikuan/DouDiZhu/blob/0d84ff6c0bc54dba6ae37955de9ae9307513dc99/code/frameworks/cocos2d-x/tools/bindings-generator/backup/clang-llvm-3.3-pybinding/cindex.py#L198-L200 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/debug/lib/debug_data.py | python | DebugDumpDir.node_device | (self, node_name) | return output[0] if len(output) == 1 else output | Get the names of the devices that has nodes of the specified name.
Args:
node_name: (`str`) name of the node.
Returns:
(`str` or `list` of `str`) name of the device(s) on which the node of the
given name is found. Returns a `str` if there is only one such device,
otherwise return a... | Get the names of the devices that has nodes of the specified name. | [
"Get",
"the",
"names",
"of",
"the",
"devices",
"that",
"has",
"nodes",
"of",
"the",
"specified",
"name",
"."
] | def node_device(self, node_name):
"""Get the names of the devices that has nodes of the specified name.
Args:
node_name: (`str`) name of the node.
Returns:
(`str` or `list` of `str`) name of the device(s) on which the node of the
given name is found. Returns a `str` if there is only on... | [
"def",
"node_device",
"(",
"self",
",",
"node_name",
")",
":",
"if",
"not",
"self",
".",
"_debug_graphs",
":",
"raise",
"LookupError",
"(",
"\"Node devices are not loaded from partition graphs yet.\"",
")",
"if",
"node_name",
"not",
"in",
"self",
".",
"_node_devices... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/debug/lib/debug_data.py#L1297-L1322 | |
intel/llvm | e6d0547e9d99b5a56430c4749f6c7e328bf221ab | mlir/python/mlir/dialects/linalg/opdsl/ops/core_named_ops.py | python | pooling_ndhwc_max | (
I=TensorDef(T1, S.N, S.OD * S.SD + S.KD * S.DD, S.OH * S.SH + S.KH * S.DH,
S.OW * S.SW + S.KW * S.DW, S.C),
K=TensorDef(T2, S.KD, S.KH, S.KW, index_dims=[D.kd, D.kh, D.kw]),
O=TensorDef(U, S.N, S.OD, S.OH, S.OW, S.C, output=True),
strides=IndexAttrDef(S.SD, S.SH, S.SW),
dilations=I... | Performs 3D max pooling.
Numeric casting is performed on the input operand, promoting it to the same
data type as the accumulator/output. | Performs 3D max pooling. | [
"Performs",
"3D",
"max",
"pooling",
"."
] | def pooling_ndhwc_max(
I=TensorDef(T1, S.N, S.OD * S.SD + S.KD * S.DD, S.OH * S.SH + S.KH * S.DH,
S.OW * S.SW + S.KW * S.DW, S.C),
K=TensorDef(T2, S.KD, S.KH, S.KW, index_dims=[D.kd, D.kh, D.kw]),
O=TensorDef(U, S.N, S.OD, S.OH, S.OW, S.C, output=True),
strides=IndexAttrDef(S.SD, S.SH, S... | [
"def",
"pooling_ndhwc_max",
"(",
"I",
"=",
"TensorDef",
"(",
"T1",
",",
"S",
".",
"N",
",",
"S",
".",
"OD",
"*",
"S",
".",
"SD",
"+",
"S",
".",
"KD",
"*",
"S",
".",
"DD",
",",
"S",
".",
"OH",
"*",
"S",
".",
"SH",
"+",
"S",
".",
"KH",
"*... | https://github.com/intel/llvm/blob/e6d0547e9d99b5a56430c4749f6c7e328bf221ab/mlir/python/mlir/dialects/linalg/opdsl/ops/core_named_ops.py#L589-L606 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/botocore/handlers.py | python | fix_route53_ids | (params, model, **kwargs) | Check for and split apart Route53 resource IDs, setting
only the last piece. This allows the output of one operation
(e.g. ``'foo/1234'``) to be used as input in another
operation (e.g. it expects just ``'1234'``). | Check for and split apart Route53 resource IDs, setting
only the last piece. This allows the output of one operation
(e.g. ``'foo/1234'``) to be used as input in another
operation (e.g. it expects just ``'1234'``). | [
"Check",
"for",
"and",
"split",
"apart",
"Route53",
"resource",
"IDs",
"setting",
"only",
"the",
"last",
"piece",
".",
"This",
"allows",
"the",
"output",
"of",
"one",
"operation",
"(",
"e",
".",
"g",
".",
"foo",
"/",
"1234",
")",
"to",
"be",
"used",
... | def fix_route53_ids(params, model, **kwargs):
"""
Check for and split apart Route53 resource IDs, setting
only the last piece. This allows the output of one operation
(e.g. ``'foo/1234'``) to be used as input in another
operation (e.g. it expects just ``'1234'``).
"""
input_shape = model.inp... | [
"def",
"fix_route53_ids",
"(",
"params",
",",
"model",
",",
"*",
"*",
"kwargs",
")",
":",
"input_shape",
"=",
"model",
".",
"input_shape",
"if",
"not",
"input_shape",
"or",
"not",
"hasattr",
"(",
"input_shape",
",",
"'members'",
")",
":",
"return",
"member... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/botocore/handlers.py#L549-L567 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/llvmlite/ir/builder.py | python | IRBuilder.insert_value | (self, agg, value, idx, name='') | return instr | Insert *value* into member number *idx* from aggregate. | Insert *value* into member number *idx* from aggregate. | [
"Insert",
"*",
"value",
"*",
"into",
"member",
"number",
"*",
"idx",
"*",
"from",
"aggregate",
"."
] | def insert_value(self, agg, value, idx, name=''):
"""
Insert *value* into member number *idx* from aggregate.
"""
if not isinstance(idx, (tuple, list)):
idx = [idx]
instr = instructions.InsertValue(self.block, agg, value, idx, name=name)
self._insert(instr)
... | [
"def",
"insert_value",
"(",
"self",
",",
"agg",
",",
"value",
",",
"idx",
",",
"name",
"=",
"''",
")",
":",
"if",
"not",
"isinstance",
"(",
"idx",
",",
"(",
"tuple",
",",
"list",
")",
")",
":",
"idx",
"=",
"[",
"idx",
"]",
"instr",
"=",
"instru... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/llvmlite/ir/builder.py#L931-L939 | |
klzgrad/naiveproxy | ed2c513637c77b18721fe428d7ed395b4d284c83 | src/build/util/lib/common/util.py | python | DoesUrlExist | (url) | return response.status == 200 | Determines whether a resource exists at the given URL.
Args:
url: URL to be verified.
Returns:
True if url exists, otherwise False. | Determines whether a resource exists at the given URL. | [
"Determines",
"whether",
"a",
"resource",
"exists",
"at",
"the",
"given",
"URL",
"."
] | def DoesUrlExist(url):
"""Determines whether a resource exists at the given URL.
Args:
url: URL to be verified.
Returns:
True if url exists, otherwise False.
"""
parsed = urlparse.urlparse(url)
try:
conn = httplib.HTTPConnection(parsed.netloc)
conn.request('HEAD', parsed.path)
response... | [
"def",
"DoesUrlExist",
"(",
"url",
")",
":",
"parsed",
"=",
"urlparse",
".",
"urlparse",
"(",
"url",
")",
"try",
":",
"conn",
"=",
"httplib",
".",
"HTTPConnection",
"(",
"parsed",
".",
"netloc",
")",
"conn",
".",
"request",
"(",
"'HEAD'",
",",
"parsed"... | https://github.com/klzgrad/naiveproxy/blob/ed2c513637c77b18721fe428d7ed395b4d284c83/src/build/util/lib/common/util.py#L130-L151 | |
intel/caffe | 3f494b442ee3f9d17a07b09ecbd5fa2bbda00836 | scripts/run_benchmark.py | python | CaffeBenchmark.get_local_ip_lists | (self) | get local ip lists | get local ip lists | [
"get",
"local",
"ip",
"lists"
] | def get_local_ip_lists(self):
'''get local ip lists'''
exec_command = 'ip addr'
out = self._exec_command(exec_command)
ip_pattern = re.compile(".*inet [0-9]+.*")
self.local_ips = []
for line in out.split('\n'):
if re.match(ip_pattern, line):
ip... | [
"def",
"get_local_ip_lists",
"(",
"self",
")",
":",
"exec_command",
"=",
"'ip addr'",
"out",
"=",
"self",
".",
"_exec_command",
"(",
"exec_command",
")",
"ip_pattern",
"=",
"re",
".",
"compile",
"(",
"\".*inet [0-9]+.*\"",
")",
"self",
".",
"local_ips",
"=",
... | https://github.com/intel/caffe/blob/3f494b442ee3f9d17a07b09ecbd5fa2bbda00836/scripts/run_benchmark.py#L353-L366 | ||
google/syzygy | 8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5 | third_party/numpy/files/numpy/distutils/misc_util.py | python | rel_path | (path, parent_path) | return path | Return path relative to parent_path. | Return path relative to parent_path. | [
"Return",
"path",
"relative",
"to",
"parent_path",
"."
] | def rel_path(path, parent_path):
"""Return path relative to parent_path.
"""
pd = os.path.abspath(parent_path)
apath = os.path.abspath(path)
if len(apath)<len(pd):
return path
if apath==pd:
return ''
if pd == apath[:len(pd)]:
assert apath[len(pd)] in [os.sep],repr((pa... | [
"def",
"rel_path",
"(",
"path",
",",
"parent_path",
")",
":",
"pd",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"parent_path",
")",
"apath",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"path",
")",
"if",
"len",
"(",
"apath",
")",
"<",
"len",
"(... | https://github.com/google/syzygy/blob/8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5/third_party/numpy/files/numpy/distutils/misc_util.py#L75-L87 | |
raymondlu/super-animation-samples | 04234269112ff0dc32447f27a761dbbb00b8ba17 | samples/cocos2d-x-3.1/CocosLuaGame2/frameworks/cocos2d-x/tools/bindings-generator/clang/cindex.py | python | Cursor.is_static_method | (self) | return conf.lib.clang_CXXMethod_isStatic(self) | Returns True if the cursor refers to a C++ member function or member
function template that is declared 'static'. | Returns True if the cursor refers to a C++ member function or member
function template that is declared 'static'. | [
"Returns",
"True",
"if",
"the",
"cursor",
"refers",
"to",
"a",
"C",
"++",
"member",
"function",
"or",
"member",
"function",
"template",
"that",
"is",
"declared",
"static",
"."
] | def is_static_method(self):
"""Returns True if the cursor refers to a C++ member function or member
function template that is declared 'static'.
"""
return conf.lib.clang_CXXMethod_isStatic(self) | [
"def",
"is_static_method",
"(",
"self",
")",
":",
"return",
"conf",
".",
"lib",
".",
"clang_CXXMethod_isStatic",
"(",
"self",
")"
] | https://github.com/raymondlu/super-animation-samples/blob/04234269112ff0dc32447f27a761dbbb00b8ba17/samples/cocos2d-x-3.1/CocosLuaGame2/frameworks/cocos2d-x/tools/bindings-generator/clang/cindex.py#L1218-L1222 | |
CRYTEK/CRYENGINE | 232227c59a220cbbd311576f0fbeba7bb53b2a8c | Editor/Python/windows/Lib/site-packages/pip/_vendor/colorama/ansitowin32.py | python | AnsiToWin32.write_and_convert | (self, text) | Write the given text to our wrapped stream, stripping any ANSI
sequences from the text, and optionally converting them into win32
calls. | Write the given text to our wrapped stream, stripping any ANSI
sequences from the text, and optionally converting them into win32
calls. | [
"Write",
"the",
"given",
"text",
"to",
"our",
"wrapped",
"stream",
"stripping",
"any",
"ANSI",
"sequences",
"from",
"the",
"text",
"and",
"optionally",
"converting",
"them",
"into",
"win32",
"calls",
"."
] | def write_and_convert(self, text):
'''
Write the given text to our wrapped stream, stripping any ANSI
sequences from the text, and optionally converting them into win32
calls.
'''
cursor = 0
text = self.convert_osc(text)
for match in self.ANSI_CSI_RE.findi... | [
"def",
"write_and_convert",
"(",
"self",
",",
"text",
")",
":",
"cursor",
"=",
"0",
"text",
"=",
"self",
".",
"convert_osc",
"(",
"text",
")",
"for",
"match",
"in",
"self",
".",
"ANSI_CSI_RE",
".",
"finditer",
"(",
"text",
")",
":",
"start",
",",
"en... | https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Editor/Python/windows/Lib/site-packages/pip/_vendor/colorama/ansitowin32.py#L148-L161 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/collections.py | python | OrderedDict.viewitems | (self) | return ItemsView(self) | od.viewitems() -> a set-like object providing a view on od's items | od.viewitems() -> a set-like object providing a view on od's items | [
"od",
".",
"viewitems",
"()",
"-",
">",
"a",
"set",
"-",
"like",
"object",
"providing",
"a",
"view",
"on",
"od",
"s",
"items"
] | def viewitems(self):
"od.viewitems() -> a set-like object providing a view on od's items"
return ItemsView(self) | [
"def",
"viewitems",
"(",
"self",
")",
":",
"return",
"ItemsView",
"(",
"self",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/collections.py#L225-L227 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | third_party/google_appengine_cloudstorage/cloudstorage/common.py | python | memory_usage | (method) | return wrapper | Log memory usage before and after a method. | Log memory usage before and after a method. | [
"Log",
"memory",
"usage",
"before",
"and",
"after",
"a",
"method",
"."
] | def memory_usage(method):
"""Log memory usage before and after a method."""
def wrapper(*args, **kwargs):
logging.info('Memory before method %s is %s.',
method.__name__, runtime.memory_usage().current())
result = method(*args, **kwargs)
logging.info('Memory after method %s is %s',
... | [
"def",
"memory_usage",
"(",
"method",
")",
":",
"def",
"wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"logging",
".",
"info",
"(",
"'Memory before method %s is %s.'",
",",
"method",
".",
"__name__",
",",
"runtime",
".",
"memory_usage",
"("... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/third_party/google_appengine_cloudstorage/cloudstorage/common.py#L384-L393 | |
google/syzygy | 8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5 | syzygy/build/get_syzygy_binaries.py | python | _BuildActualState | (stored, revision, output_dir) | return state | Builds the actual state using the provided |stored| state as a template.
Only examines files listed in the stored state, causing the script to ignore
files that have been added to the directories locally. |stored| must be a
valid state dictionary. | Builds the actual state using the provided |stored| state as a template.
Only examines files listed in the stored state, causing the script to ignore
files that have been added to the directories locally. |stored| must be a
valid state dictionary. | [
"Builds",
"the",
"actual",
"state",
"using",
"the",
"provided",
"|stored|",
"state",
"as",
"a",
"template",
".",
"Only",
"examines",
"files",
"listed",
"in",
"the",
"stored",
"state",
"causing",
"the",
"script",
"to",
"ignore",
"files",
"that",
"have",
"been... | def _BuildActualState(stored, revision, output_dir):
"""Builds the actual state using the provided |stored| state as a template.
Only examines files listed in the stored state, causing the script to ignore
files that have been added to the directories locally. |stored| must be a
valid state dictionary.
"""
... | [
"def",
"_BuildActualState",
"(",
"stored",
",",
"revision",
",",
"output_dir",
")",
":",
"contents",
"=",
"{",
"}",
"state",
"=",
"{",
"'revision'",
":",
"revision",
",",
"'contents'",
":",
"contents",
"}",
"for",
"relpath",
",",
"md5",
"in",
"stored",
"... | https://github.com/google/syzygy/blob/8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5/syzygy/build/get_syzygy_binaries.py#L116-L130 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/cgutils.py | python | make_anonymous_struct | (builder, values, struct_type=None) | return struct_val | Create an anonymous struct containing the given LLVM *values*. | Create an anonymous struct containing the given LLVM *values*. | [
"Create",
"an",
"anonymous",
"struct",
"containing",
"the",
"given",
"LLVM",
"*",
"values",
"*",
"."
] | def make_anonymous_struct(builder, values, struct_type=None):
"""
Create an anonymous struct containing the given LLVM *values*.
"""
if struct_type is None:
struct_type = ir.LiteralStructType([v.type for v in values])
struct_val = struct_type(ir.Undefined)
for i, v in enumerate(values):
... | [
"def",
"make_anonymous_struct",
"(",
"builder",
",",
"values",
",",
"struct_type",
"=",
"None",
")",
":",
"if",
"struct_type",
"is",
"None",
":",
"struct_type",
"=",
"ir",
".",
"LiteralStructType",
"(",
"[",
"v",
".",
"type",
"for",
"v",
"in",
"values",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/cgutils.py#L32-L41 | |
bigtreetech/BIGTREETECH-SKR-V1.3 | b238aa402753e81d551b7d34a181a262a138ae9e | BTT SKR V1.4/Firmware/Marlin-2.0.x-SKR-V1.4-Turbo/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extras/svg2cpp.py | python | Parser.process_svg_path_data_cmd | (self, id, cmd, a, b) | Converts the various types of moves into L or M commands
and dispatches to process_svg_path_L_or_M for futher processing. | Converts the various types of moves into L or M commands
and dispatches to process_svg_path_L_or_M for futher processing. | [
"Converts",
"the",
"various",
"types",
"of",
"moves",
"into",
"L",
"or",
"M",
"commands",
"and",
"dispatches",
"to",
"process_svg_path_L_or_M",
"for",
"futher",
"processing",
"."
] | def process_svg_path_data_cmd(self, id, cmd, a, b):
"""Converts the various types of moves into L or M commands
and dispatches to process_svg_path_L_or_M for futher processing."""
if cmd == "Z" or cmd == "z":
self.process_svg_path_L_or_M("L", self.initial_x, self.initial_y)
elif cmd == "H":
... | [
"def",
"process_svg_path_data_cmd",
"(",
"self",
",",
"id",
",",
"cmd",
",",
"a",
",",
"b",
")",
":",
"if",
"cmd",
"==",
"\"Z\"",
"or",
"cmd",
"==",
"\"z\"",
":",
"self",
".",
"process_svg_path_L_or_M",
"(",
"\"L\"",
",",
"self",
".",
"initial_x",
",",... | https://github.com/bigtreetech/BIGTREETECH-SKR-V1.3/blob/b238aa402753e81d551b7d34a181a262a138ae9e/BTT SKR V1.4/Firmware/Marlin-2.0.x-SKR-V1.4-Turbo/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extras/svg2cpp.py#L165-L188 | ||
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/python/framework/ops.py | python | get_stats_for_node_def | (graph, node, statistic_type) | return result | Looks up the node's statistics function in the registry and calls it.
This function takes a Graph object and a NodeDef from a GraphDef, and if
there's an associated statistics method, calls it and returns a result. If no
function has been registered for the particular node type, it returns an empty
statistics ... | Looks up the node's statistics function in the registry and calls it. | [
"Looks",
"up",
"the",
"node",
"s",
"statistics",
"function",
"in",
"the",
"registry",
"and",
"calls",
"it",
"."
] | def get_stats_for_node_def(graph, node, statistic_type):
"""Looks up the node's statistics function in the registry and calls it.
This function takes a Graph object and a NodeDef from a GraphDef, and if
there's an associated statistics method, calls it and returns a result. If no
function has been registered f... | [
"def",
"get_stats_for_node_def",
"(",
"graph",
",",
"node",
",",
"statistic_type",
")",
":",
"try",
":",
"stats_func",
"=",
"_stats_registry",
".",
"lookup",
"(",
"node",
".",
"op",
"+",
"\",\"",
"+",
"statistic_type",
")",
"result",
"=",
"stats_func",
"(",
... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/framework/ops.py#L1911-L1932 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/nntplib.py | python | NNTP.newgroups | (self, date, time, file=None) | return self.longcmd('NEWGROUPS ' + date + ' ' + time, file) | Process a NEWGROUPS command. Arguments:
- date: string 'yymmdd' indicating the date
- time: string 'hhmmss' indicating the time
Return:
- resp: server response if successful
- list: list of newsgroup names | Process a NEWGROUPS command. Arguments:
- date: string 'yymmdd' indicating the date
- time: string 'hhmmss' indicating the time
Return:
- resp: server response if successful
- list: list of newsgroup names | [
"Process",
"a",
"NEWGROUPS",
"command",
".",
"Arguments",
":",
"-",
"date",
":",
"string",
"yymmdd",
"indicating",
"the",
"date",
"-",
"time",
":",
"string",
"hhmmss",
"indicating",
"the",
"time",
"Return",
":",
"-",
"resp",
":",
"server",
"response",
"if"... | def newgroups(self, date, time, file=None):
"""Process a NEWGROUPS command. Arguments:
- date: string 'yymmdd' indicating the date
- time: string 'hhmmss' indicating the time
Return:
- resp: server response if successful
- list: list of newsgroup names"""
return... | [
"def",
"newgroups",
"(",
"self",
",",
"date",
",",
"time",
",",
"file",
"=",
"None",
")",
":",
"return",
"self",
".",
"longcmd",
"(",
"'NEWGROUPS '",
"+",
"date",
"+",
"' '",
"+",
"time",
",",
"file",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/nntplib.py#L266-L274 | |
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Draft/draftguitools/gui_patharray.py | python | PathArray.Activated | (self, name="Path array") | Execute when the command is called. | Execute when the command is called. | [
"Execute",
"when",
"the",
"command",
"is",
"called",
"."
] | def Activated(self, name="Path array"):
"""Execute when the command is called."""
super(PathArray, self).Activated(name=name)
self.name = name
# This was deactivated because it doesn't work correctly;
# the selection needs to be made on two objects, but currently
# it onl... | [
"def",
"Activated",
"(",
"self",
",",
"name",
"=",
"\"Path array\"",
")",
":",
"super",
"(",
"PathArray",
",",
"self",
")",
".",
"Activated",
"(",
"name",
"=",
"name",
")",
"self",
".",
"name",
"=",
"name",
"# This was deactivated because it doesn't work corre... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Draft/draftguitools/gui_patharray.py#L76-L96 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | scripts/SANS/centre_finder.py | python | is_workspace_which_requires_angle | (reducer) | return False | Check if the sample worksapce requires the first
coordinate to be an angle
@param reducer: the reducer object
@returns true if the workspace requires an angle otherwise false | Check if the sample worksapce requires the first
coordinate to be an angle | [
"Check",
"if",
"the",
"sample",
"worksapce",
"requires",
"the",
"first",
"coordinate",
"to",
"be",
"an",
"angle"
] | def is_workspace_which_requires_angle(reducer):
'''
Check if the sample worksapce requires the first
coordinate to be an angle
@param reducer: the reducer object
@returns true if the workspace requires an angle otherwise false
'''
instrument_name = reducer.instrument.name()
if instrument... | [
"def",
"is_workspace_which_requires_angle",
"(",
"reducer",
")",
":",
"instrument_name",
"=",
"reducer",
".",
"instrument",
".",
"name",
"(",
")",
"if",
"instrument_name",
"!=",
"LARMOR",
".",
"_NAME",
":",
"return",
"False",
"workspace_name",
"=",
"reducer",
".... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/SANS/centre_finder.py#L24-L38 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/ros_comm/rospy/src/rospy/impl/tcpros_base.py | python | get_tcpros_server_address | () | return _tcpros_server.get_address() | get the address of the tcpros server.
@raise Exception: if tcpros server has not been started or created | get the address of the tcpros server. | [
"get",
"the",
"address",
"of",
"the",
"tcpros",
"server",
"."
] | def get_tcpros_server_address():
"""
get the address of the tcpros server.
@raise Exception: if tcpros server has not been started or created
"""
return _tcpros_server.get_address() | [
"def",
"get_tcpros_server_address",
"(",
")",
":",
"return",
"_tcpros_server",
".",
"get_address",
"(",
")"
] | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/ros_comm/rospy/src/rospy/impl/tcpros_base.py#L238-L243 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/src/motionplanning.py | python | CSpaceInterface.feasibilityCost | (self, name: "char const *") | return _motionplanning.CSpaceInterface_feasibilityCost(self, name) | r"""
feasibilityCost(CSpaceInterface self, char const * name) -> double
Retrieves the empirical average cost of a given feasibility test. | r"""
feasibilityCost(CSpaceInterface self, char const * name) -> double | [
"r",
"feasibilityCost",
"(",
"CSpaceInterface",
"self",
"char",
"const",
"*",
"name",
")",
"-",
">",
"double"
] | def feasibilityCost(self, name: "char const *") -> "double":
r"""
feasibilityCost(CSpaceInterface self, char const * name) -> double
Retrieves the empirical average cost of a given feasibility test.
"""
return _motionplanning.CSpaceInterface_feasibilityCost(self, name) | [
"def",
"feasibilityCost",
"(",
"self",
",",
"name",
":",
"\"char const *\"",
")",
"->",
"\"double\"",
":",
"return",
"_motionplanning",
".",
"CSpaceInterface_feasibilityCost",
"(",
"self",
",",
"name",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/src/motionplanning.py#L755-L763 | |
NVIDIA/TensorRT | 42805f078052daad1a98bc5965974fcffaad0960 | tools/pytorch-quantization/pytorch_quantization/tensor_quant.py | python | _tensor_quant | (inputs, amax, num_bits=8, unsigned=False, narrow_range=True) | return outputs, scale | Shared function body between TensorQuantFunction and FakeTensorQuantFunction | Shared function body between TensorQuantFunction and FakeTensorQuantFunction | [
"Shared",
"function",
"body",
"between",
"TensorQuantFunction",
"and",
"FakeTensorQuantFunction"
] | def _tensor_quant(inputs, amax, num_bits=8, unsigned=False, narrow_range=True):
"""Shared function body between TensorQuantFunction and FakeTensorQuantFunction"""
# Fine scale, per channel scale will be handled by broadcasting, which could be tricky. Pop a warning.
if isinstance(amax, torch.Tensor) and ... | [
"def",
"_tensor_quant",
"(",
"inputs",
",",
"amax",
",",
"num_bits",
"=",
"8",
",",
"unsigned",
"=",
"False",
",",
"narrow_range",
"=",
"True",
")",
":",
"# Fine scale, per channel scale will be handled by broadcasting, which could be tricky. Pop a warning.",
"if",
"isins... | https://github.com/NVIDIA/TensorRT/blob/42805f078052daad1a98bc5965974fcffaad0960/tools/pytorch-quantization/pytorch_quantization/tensor_quant.py#L315-L361 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_aarch64/python2.7/dist-packages/yaml/__init__.py | python | dump_all | (documents, stream=None, Dumper=Dumper,
default_style=None, default_flow_style=None,
canonical=None, indent=None, width=None,
allow_unicode=None, line_break=None,
encoding='utf-8', explicit_start=None, explicit_end=None,
version=None, tags=None) | Serialize a sequence of Python objects into a YAML stream.
If stream is None, return the produced string instead. | Serialize a sequence of Python objects into a YAML stream.
If stream is None, return the produced string instead. | [
"Serialize",
"a",
"sequence",
"of",
"Python",
"objects",
"into",
"a",
"YAML",
"stream",
".",
"If",
"stream",
"is",
"None",
"return",
"the",
"produced",
"string",
"instead",
"."
] | def dump_all(documents, stream=None, Dumper=Dumper,
default_style=None, default_flow_style=None,
canonical=None, indent=None, width=None,
allow_unicode=None, line_break=None,
encoding='utf-8', explicit_start=None, explicit_end=None,
version=None, tags=None):
"""
Serialize... | [
"def",
"dump_all",
"(",
"documents",
",",
"stream",
"=",
"None",
",",
"Dumper",
"=",
"Dumper",
",",
"default_style",
"=",
"None",
",",
"default_flow_style",
"=",
"None",
",",
"canonical",
"=",
"None",
",",
"indent",
"=",
"None",
",",
"width",
"=",
"None"... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_aarch64/python2.7/dist-packages/yaml/__init__.py#L163-L195 | ||
openvinotoolkit/openvino | dedcbeafa8b84cccdc55ca64b8da516682b381c7 | src/bindings/python/src/openvino/runtime/opset5/ops.py | python | log_softmax | (data: NodeInput, axis: int, name: Optional[str] = None) | return _get_node_factory_opset5().create("LogSoftmax", [as_node(data)], {"axis": axis}) | Apply LogSoftmax operation on each element of input tensor.
@param data: The tensor providing input data.
@param axis: An axis along which LogSoftmax should be calculated
@return: The new node with LogSoftmax operation applied on each element. | Apply LogSoftmax operation on each element of input tensor. | [
"Apply",
"LogSoftmax",
"operation",
"on",
"each",
"element",
"of",
"input",
"tensor",
"."
] | def log_softmax(data: NodeInput, axis: int, name: Optional[str] = None) -> Node:
"""Apply LogSoftmax operation on each element of input tensor.
@param data: The tensor providing input data.
@param axis: An axis along which LogSoftmax should be calculated
@return: The new node with LogSoftmax operation ... | [
"def",
"log_softmax",
"(",
"data",
":",
"NodeInput",
",",
"axis",
":",
"int",
",",
"name",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
")",
"->",
"Node",
":",
"return",
"_get_node_factory_opset5",
"(",
")",
".",
"create",
"(",
"\"LogSoftmax\"",
",",
... | https://github.com/openvinotoolkit/openvino/blob/dedcbeafa8b84cccdc55ca64b8da516682b381c7/src/bindings/python/src/openvino/runtime/opset5/ops.py#L90-L97 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/protobuf/py2/google/protobuf/internal/type_checkers.py | python | ToShortestFloat | (original) | return rounded | Returns the shortest float that has same value in wire. | Returns the shortest float that has same value in wire. | [
"Returns",
"the",
"shortest",
"float",
"that",
"has",
"same",
"value",
"in",
"wire",
"."
] | def ToShortestFloat(original):
"""Returns the shortest float that has same value in wire."""
# All 4 byte floats have between 6 and 9 significant digits, so we
# start with 6 as the lower bound.
# It has to be iterative because use '.9g' directly can not get rid
# of the noises for most values. For example if... | [
"def",
"ToShortestFloat",
"(",
"original",
")",
":",
"# All 4 byte floats have between 6 and 9 significant digits, so we",
"# start with 6 as the lower bound.",
"# It has to be iterative because use '.9g' directly can not get rid",
"# of the noises for most values. For example if set a float_field... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/protobuf/py2/google/protobuf/internal/type_checkers.py#L75-L87 | |
deepmind/open_spiel | 4ca53bea32bb2875c7385d215424048ae92f78c8 | open_spiel/python/algorithms/adidas_utils/solvers/symmetric/ate_anneal.py | python | euc_project | (dist, y) | return dist, y | Project variables onto their feasible sets (euclidean proj for dist).
Args:
dist: 1-d np.array, current estimate of nash distribution
y: 1-d np.array (same shape as dist), current estimate of payoff gradient
Returns:
projected variables (dist, y) as tuple | Project variables onto their feasible sets (euclidean proj for dist). | [
"Project",
"variables",
"onto",
"their",
"feasible",
"sets",
"(",
"euclidean",
"proj",
"for",
"dist",
")",
"."
] | def euc_project(dist, y):
"""Project variables onto their feasible sets (euclidean proj for dist).
Args:
dist: 1-d np.array, current estimate of nash distribution
y: 1-d np.array (same shape as dist), current estimate of payoff gradient
Returns:
projected variables (dist, y) as tuple
"""
dist = s... | [
"def",
"euc_project",
"(",
"dist",
",",
"y",
")",
":",
"dist",
"=",
"simplex",
".",
"euclidean_projection_onto_simplex",
"(",
"dist",
")",
"y",
"=",
"np",
".",
"clip",
"(",
"y",
",",
"0.",
",",
"np",
".",
"inf",
")",
"return",
"dist",
",",
"y"
] | https://github.com/deepmind/open_spiel/blob/4ca53bea32bb2875c7385d215424048ae92f78c8/open_spiel/python/algorithms/adidas_utils/solvers/symmetric/ate_anneal.py#L358-L370 | |
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/python/pyyaml/examples/pygments-lexer/yaml.py | python | reset_indent | (TokenClass) | return callback | Reset the indentation levels. | Reset the indentation levels. | [
"Reset",
"the",
"indentation",
"levels",
"."
] | def reset_indent(TokenClass):
"""Reset the indentation levels."""
def callback(lexer, match, context):
text = match.group()
context.indent_stack = []
context.indent = -1
context.next_indent = 0
context.block_scalar_indent = None
yield match.start(), TokenClass, te... | [
"def",
"reset_indent",
"(",
"TokenClass",
")",
":",
"def",
"callback",
"(",
"lexer",
",",
"match",
",",
"context",
")",
":",
"text",
"=",
"match",
".",
"group",
"(",
")",
"context",
".",
"indent_stack",
"=",
"[",
"]",
"context",
".",
"indent",
"=",
"... | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/python/pyyaml/examples/pygments-lexer/yaml.py#L42-L52 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/protobuf/python/google/protobuf/internal/python_message.py | python | _AddStrMethod | (message_descriptor, cls) | Helper for _AddMessageMethods(). | Helper for _AddMessageMethods(). | [
"Helper",
"for",
"_AddMessageMethods",
"()",
"."
] | def _AddStrMethod(message_descriptor, cls):
"""Helper for _AddMessageMethods()."""
def __str__(self):
return text_format.MessageToString(self)
cls.__str__ = __str__ | [
"def",
"_AddStrMethod",
"(",
"message_descriptor",
",",
"cls",
")",
":",
"def",
"__str__",
"(",
"self",
")",
":",
"return",
"text_format",
".",
"MessageToString",
"(",
"self",
")",
"cls",
".",
"__str__",
"=",
"__str__"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/protobuf/python/google/protobuf/internal/python_message.py#L979-L983 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/plat-mac/lib-scriptpackages/StdSuites/Standard_Suite.py | python | Standard_Suite_Events.quit | (self, _no_object=None, _attributes={}, **_arguments) | quit: Quit an application
Keyword argument saving: specifies whether to save currently open documents
Keyword argument _attributes: AppleEvent attribute dictionary | quit: Quit an application
Keyword argument saving: specifies whether to save currently open documents
Keyword argument _attributes: AppleEvent attribute dictionary | [
"quit",
":",
"Quit",
"an",
"application",
"Keyword",
"argument",
"saving",
":",
"specifies",
"whether",
"to",
"save",
"currently",
"open",
"documents",
"Keyword",
"argument",
"_attributes",
":",
"AppleEvent",
"attribute",
"dictionary"
] | def quit(self, _no_object=None, _attributes={}, **_arguments):
"""quit: Quit an application
Keyword argument saving: specifies whether to save currently open documents
Keyword argument _attributes: AppleEvent attribute dictionary
"""
_code = 'aevt'
_subcode = 'quit'
... | [
"def",
"quit",
"(",
"self",
",",
"_no_object",
"=",
"None",
",",
"_attributes",
"=",
"{",
"}",
",",
"*",
"*",
"_arguments",
")",
":",
"_code",
"=",
"'aevt'",
"_subcode",
"=",
"'quit'",
"aetools",
".",
"keysubst",
"(",
"_arguments",
",",
"self",
".",
... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/plat-mac/lib-scriptpackages/StdSuites/Standard_Suite.py#L339-L358 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/typing/context.py | python | BaseContext._get_attribute_templates | (self, typ) | Get matching AttributeTemplates for the Numba type. | Get matching AttributeTemplates for the Numba type. | [
"Get",
"matching",
"AttributeTemplates",
"for",
"the",
"Numba",
"type",
"."
] | def _get_attribute_templates(self, typ):
"""
Get matching AttributeTemplates for the Numba type.
"""
if typ in self._attributes:
for attrinfo in self._attributes[typ]:
yield attrinfo
else:
for cls in type(typ).__mro__:
if cl... | [
"def",
"_get_attribute_templates",
"(",
"self",
",",
"typ",
")",
":",
"if",
"typ",
"in",
"self",
".",
"_attributes",
":",
"for",
"attrinfo",
"in",
"self",
".",
"_attributes",
"[",
"typ",
"]",
":",
"yield",
"attrinfo",
"else",
":",
"for",
"cls",
"in",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/typing/context.py#L253-L264 | ||
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/contrib/graph_editor/edit.py | python | bypass | (sgv) | return sgv, detached_inputs | Bypass the given subgraph by connecting its inputs to its outputs.
Args:
sgv: the subgraph view to be bypassed. This argument is converted to a
subgraph using the same rules than the function subgraph.make_view.
Returns:
A new subgraph view of the bypassed subgraph.
Note that sgv is also modifi... | Bypass the given subgraph by connecting its inputs to its outputs. | [
"Bypass",
"the",
"given",
"subgraph",
"by",
"connecting",
"its",
"inputs",
"to",
"its",
"outputs",
"."
] | def bypass(sgv):
"""Bypass the given subgraph by connecting its inputs to its outputs.
Args:
sgv: the subgraph view to be bypassed. This argument is converted to a
subgraph using the same rules than the function subgraph.make_view.
Returns:
A new subgraph view of the bypassed subgraph.
Note t... | [
"def",
"bypass",
"(",
"sgv",
")",
":",
"# TODO(fkp): allows to plug sgv.inputs to individual sgv.outputs consumers",
"sgv",
"=",
"subgraph",
".",
"make_view",
"(",
"sgv",
")",
"sgv_inputs",
"=",
"list",
"(",
"sgv",
".",
"inputs",
")",
"sgv",
",",
"detached_inputs",
... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/contrib/graph_editor/edit.py#L183-L201 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/lib-tk/turtle.py | python | ScrolledCanvas.reset | (self, canvwidth=None, canvheight=None, bg = None) | Adjust canvas and scrollbars according to given canvas size. | Adjust canvas and scrollbars according to given canvas size. | [
"Adjust",
"canvas",
"and",
"scrollbars",
"according",
"to",
"given",
"canvas",
"size",
"."
] | def reset(self, canvwidth=None, canvheight=None, bg = None):
"""Adjust canvas and scrollbars according to given canvas size."""
if canvwidth:
self.canvwidth = canvwidth
if canvheight:
self.canvheight = canvheight
if bg:
self.bg = bg
self._canva... | [
"def",
"reset",
"(",
"self",
",",
"canvwidth",
"=",
"None",
",",
"canvheight",
"=",
"None",
",",
"bg",
"=",
"None",
")",
":",
"if",
"canvwidth",
":",
"self",
".",
"canvwidth",
"=",
"canvwidth",
"if",
"canvheight",
":",
"self",
".",
"canvheight",
"=",
... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/lib-tk/turtle.py#L384-L399 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/integrate/python/ops/odes.py | python | _interp_fit_rk | (y0, y1, k, dt, tableau=_DORMAND_PRINCE_TABLEAU) | Fit an interpolating polynomial to the results of a Runge-Kutta step. | Fit an interpolating polynomial to the results of a Runge-Kutta step. | [
"Fit",
"an",
"interpolating",
"polynomial",
"to",
"the",
"results",
"of",
"a",
"Runge",
"-",
"Kutta",
"step",
"."
] | def _interp_fit_rk(y0, y1, k, dt, tableau=_DORMAND_PRINCE_TABLEAU):
"""Fit an interpolating polynomial to the results of a Runge-Kutta step."""
with ops.name_scope('interp_fit_rk'):
dt = math_ops.cast(dt, y0.dtype)
y_mid = y0 + _scaled_dot_product(dt, tableau.c_mid, k)
f0 = k[0]
f1 = k[-1]
retur... | [
"def",
"_interp_fit_rk",
"(",
"y0",
",",
"y1",
",",
"k",
",",
"dt",
",",
"tableau",
"=",
"_DORMAND_PRINCE_TABLEAU",
")",
":",
"with",
"ops",
".",
"name_scope",
"(",
"'interp_fit_rk'",
")",
":",
"dt",
"=",
"math_ops",
".",
"cast",
"(",
"dt",
",",
"y0",
... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/integrate/python/ops/odes.py#L174-L181 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/email/quoprimime.py | python | header_encode | (header_bytes, charset='iso-8859-1') | return '=?%s?q?%s?=' % (charset, encoded) | Encode a single header line with quoted-printable (like) encoding.
Defined in RFC 2045, this `Q' encoding is similar to quoted-printable, but
used specifically for email header fields to allow charsets with mostly 7
bit characters (and some 8 bit) to remain more or less readable in non-RFC
2045 aware m... | Encode a single header line with quoted-printable (like) encoding. | [
"Encode",
"a",
"single",
"header",
"line",
"with",
"quoted",
"-",
"printable",
"(",
"like",
")",
"encoding",
"."
] | def header_encode(header_bytes, charset='iso-8859-1'):
"""Encode a single header line with quoted-printable (like) encoding.
Defined in RFC 2045, this `Q' encoding is similar to quoted-printable, but
used specifically for email header fields to allow charsets with mostly 7
bit characters (and some 8 bi... | [
"def",
"header_encode",
"(",
"header_bytes",
",",
"charset",
"=",
"'iso-8859-1'",
")",
":",
"# Return empty headers as an empty string.",
"if",
"not",
"header_bytes",
":",
"return",
"''",
"# Iterate over every byte, encoding if necessary.",
"encoded",
"=",
"header_bytes",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/email/quoprimime.py#L127-L145 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/imputil.py | python | ImportManager.install | (self, namespace=vars(__builtin__)) | Install this ImportManager into the specified namespace. | Install this ImportManager into the specified namespace. | [
"Install",
"this",
"ImportManager",
"into",
"the",
"specified",
"namespace",
"."
] | def install(self, namespace=vars(__builtin__)):
"Install this ImportManager into the specified namespace."
if isinstance(namespace, _ModuleType):
namespace = vars(namespace)
# Note: we have no notion of "chaining"
# Record the previous import hook, then install our own.
... | [
"def",
"install",
"(",
"self",
",",
"namespace",
"=",
"vars",
"(",
"__builtin__",
")",
")",
":",
"if",
"isinstance",
"(",
"namespace",
",",
"_ModuleType",
")",
":",
"namespace",
"=",
"vars",
"(",
"namespace",
")",
"# Note: we have no notion of \"chaining\"",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/imputil.py#L33-L44 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_controls.py | python | InfoBar.GetHideEffect | (*args, **kwargs) | return _controls_.InfoBar_GetHideEffect(*args, **kwargs) | GetHideEffect(self) -> int | GetHideEffect(self) -> int | [
"GetHideEffect",
"(",
"self",
")",
"-",
">",
"int"
] | def GetHideEffect(*args, **kwargs):
"""GetHideEffect(self) -> int"""
return _controls_.InfoBar_GetHideEffect(*args, **kwargs) | [
"def",
"GetHideEffect",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"InfoBar_GetHideEffect",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_controls.py#L7785-L7787 | |
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/fluid/layers/utils.py | python | check_shape | (shape) | Check shape type and shape elements type before passing it to fill_constant | Check shape type and shape elements type before passing it to fill_constant | [
"Check",
"shape",
"type",
"and",
"shape",
"elements",
"type",
"before",
"passing",
"it",
"to",
"fill_constant"
] | def check_shape(shape):
"""
Check shape type and shape elements type before passing it to fill_constant
"""
if isinstance(shape, Variable):
check_dtype(shape.dtype, 'shape', ['int32', 'int64'], 'fill_constant')
else:
for ele in shape:
if not isinstance(ele, Variable):
... | [
"def",
"check_shape",
"(",
"shape",
")",
":",
"if",
"isinstance",
"(",
"shape",
",",
"Variable",
")",
":",
"check_dtype",
"(",
"shape",
".",
"dtype",
",",
"'shape'",
",",
"[",
"'int32'",
",",
"'int64'",
"]",
",",
"'fill_constant'",
")",
"else",
":",
"f... | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/fluid/layers/utils.py#L373-L389 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/propgrid.py | python | PGChoices.Item | (*args) | return _propgrid.PGChoices_Item(*args) | Item(self, int i)
Item(self, int i) | Item(self, int i)
Item(self, int i) | [
"Item",
"(",
"self",
"int",
"i",
")",
"Item",
"(",
"self",
"int",
"i",
")"
] | def Item(*args):
"""
Item(self, int i)
Item(self, int i)
"""
return _propgrid.PGChoices_Item(*args) | [
"def",
"Item",
"(",
"*",
"args",
")",
":",
"return",
"_propgrid",
".",
"PGChoices_Item",
"(",
"*",
"args",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/propgrid.py#L308-L313 | |
SpenceKonde/megaTinyCore | 1c4a70b18a149fe6bcb551dfa6db11ca50b8997b | megaavr/tools/libs/pyedbglib/protocols/housekeepingprotocol.py | python | Jtagice3HousekeepingProtocol.start_session | (self) | Starts a session with the debugger (sign-on) | Starts a session with the debugger (sign-on) | [
"Starts",
"a",
"session",
"with",
"the",
"debugger",
"(",
"sign",
"-",
"on",
")"
] | def start_session(self):
"""Starts a session with the debugger (sign-on)"""
self.logger.debug("Housekeeping::start_session")
response = self.jtagice3_command_response(bytearray([self.CMD_HOUSEKEEPING_START_SESSION, self.CMD_VERSION0]))
self.check_response(response) | [
"def",
"start_session",
"(",
"self",
")",
":",
"self",
".",
"logger",
".",
"debug",
"(",
"\"Housekeeping::start_session\"",
")",
"response",
"=",
"self",
".",
"jtagice3_command_response",
"(",
"bytearray",
"(",
"[",
"self",
".",
"CMD_HOUSEKEEPING_START_SESSION",
"... | https://github.com/SpenceKonde/megaTinyCore/blob/1c4a70b18a149fe6bcb551dfa6db11ca50b8997b/megaavr/tools/libs/pyedbglib/protocols/housekeepingprotocol.py#L79-L83 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/data/experimental/ops/enumerate_ops.py | python | enumerate_dataset | (start=0) | return _apply_fn | A transformation that enumerates the elements of a dataset.
It is similar to python's `enumerate`.
For example:
```python
# NOTE: The following examples use `{ ... }` to represent the
# contents of a dataset.
a = { 1, 2, 3 }
b = { (7, 8), (9, 10) }
# The nested structure of the `datasets` argument de... | A transformation that enumerates the elements of a dataset. | [
"A",
"transformation",
"that",
"enumerates",
"the",
"elements",
"of",
"a",
"dataset",
"."
] | def enumerate_dataset(start=0):
"""A transformation that enumerates the elements of a dataset.
It is similar to python's `enumerate`.
For example:
```python
# NOTE: The following examples use `{ ... }` to represent the
# contents of a dataset.
a = { 1, 2, 3 }
b = { (7, 8), (9, 10) }
# The nested st... | [
"def",
"enumerate_dataset",
"(",
"start",
"=",
"0",
")",
":",
"def",
"_apply_fn",
"(",
"dataset",
")",
":",
"return",
"dataset",
".",
"enumerate",
"(",
"start",
")",
"return",
"_apply_fn"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/data/experimental/ops/enumerate_ops.py#L22-L54 | |
thalium/icebox | 99d147d5b9269222225443ce171b4fd46d8985d4 | third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2.py | python | xpathParserContext.xpathFalseFunction | (self, nargs) | Implement the false() XPath function boolean false() | Implement the false() XPath function boolean false() | [
"Implement",
"the",
"false",
"()",
"XPath",
"function",
"boolean",
"false",
"()"
] | def xpathFalseFunction(self, nargs):
"""Implement the false() XPath function boolean false() """
libxml2mod.xmlXPathFalseFunction(self._o, nargs) | [
"def",
"xpathFalseFunction",
"(",
"self",
",",
"nargs",
")",
":",
"libxml2mod",
".",
"xmlXPathFalseFunction",
"(",
"self",
".",
"_o",
",",
"nargs",
")"
] | https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2.py#L7514-L7516 | ||
llvm-mirror/lldb | d01083a850f577b85501a0902b52fd0930de72c7 | utils/vim-lldb/python-vim-lldb/vim_panes.py | python | LocalsPane.format_variable | (self, var) | return ("(%s) %s" % (var.GetTypeName(), var.GetName()), "%s" % val) | Returns a Tuple of strings "(Type) Name", "Value" for SBValue var | Returns a Tuple of strings "(Type) Name", "Value" for SBValue var | [
"Returns",
"a",
"Tuple",
"of",
"strings",
"(",
"Type",
")",
"Name",
"Value",
"for",
"SBValue",
"var"
] | def format_variable(self, var):
""" Returns a Tuple of strings "(Type) Name", "Value" for SBValue var """
val = var.GetValue()
if val is None:
# If the value is too big, SBValue.GetValue() returns None; replace
# with ...
val = "..."
return ("(%s) %s"... | [
"def",
"format_variable",
"(",
"self",
",",
"var",
")",
":",
"val",
"=",
"var",
".",
"GetValue",
"(",
")",
"if",
"val",
"is",
"None",
":",
"# If the value is too big, SBValue.GetValue() returns None; replace",
"# with ...",
"val",
"=",
"\"...\"",
"return",
"(",
... | https://github.com/llvm-mirror/lldb/blob/d01083a850f577b85501a0902b52fd0930de72c7/utils/vim-lldb/python-vim-lldb/vim_panes.py#L486-L494 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/ndimage/measurements.py | python | find_objects | (input, max_label=0) | return _nd_image.find_objects(input, max_label) | Find objects in a labeled array.
Parameters
----------
input : ndarray of ints
Array containing objects defined by different labels. Labels with
value 0 are ignored.
max_label : int, optional
Maximum label to be searched for in `input`. If max_label is not
given, the pos... | Find objects in a labeled array. | [
"Find",
"objects",
"in",
"a",
"labeled",
"array",
"."
] | def find_objects(input, max_label=0):
"""
Find objects in a labeled array.
Parameters
----------
input : ndarray of ints
Array containing objects defined by different labels. Labels with
value 0 are ignored.
max_label : int, optional
Maximum label to be searched for in `... | [
"def",
"find_objects",
"(",
"input",
",",
"max_label",
"=",
"0",
")",
":",
"input",
"=",
"numpy",
".",
"asarray",
"(",
"input",
")",
"if",
"numpy",
".",
"iscomplexobj",
"(",
"input",
")",
":",
"raise",
"TypeError",
"(",
"'Complex type not supported'",
")",... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/ndimage/measurements.py#L206-L272 | |
eomahony/Numberjack | 53fa9e994a36f881ffd320d8d04158097190aad8 | Numberjack/XCSPOut.py | python | XCSPOutput.handle_relations | (self, expr) | Handles conflict and support relations
adds relation and constraint to XCSP document | Handles conflict and support relations
adds relation and constraint to XCSP document | [
"Handles",
"conflict",
"and",
"support",
"relations",
"adds",
"relation",
"and",
"constraint",
"to",
"XCSP",
"document"
] | def handle_relations(self, expr):
"""
Handles conflict and support relations
adds relation and constraint to XCSP document
"""
tuples = expr.parameters[0]
semantics = expr.parameters[1]
scope = expr.get_children()
if semantics == "conflict":
s... | [
"def",
"handle_relations",
"(",
"self",
",",
"expr",
")",
":",
"tuples",
"=",
"expr",
".",
"parameters",
"[",
"0",
"]",
"semantics",
"=",
"expr",
".",
"parameters",
"[",
"1",
"]",
"scope",
"=",
"expr",
".",
"get_children",
"(",
")",
"if",
"semantics",
... | https://github.com/eomahony/Numberjack/blob/53fa9e994a36f881ffd320d8d04158097190aad8/Numberjack/XCSPOut.py#L577-L611 | ||
openvinotoolkit/openvino | dedcbeafa8b84cccdc55ca64b8da516682b381c7 | cmake/developer_package/cpplint/cpplint.py | python | NestingState.InNamespaceBody | (self) | return self.stack and isinstance(self.stack[-1], _NamespaceInfo) | Check if we are currently one level inside a namespace body.
Returns:
True if top of the stack is a namespace block, False otherwise. | Check if we are currently one level inside a namespace body. | [
"Check",
"if",
"we",
"are",
"currently",
"one",
"level",
"inside",
"a",
"namespace",
"body",
"."
] | def InNamespaceBody(self):
"""Check if we are currently one level inside a namespace body.
Returns:
True if top of the stack is a namespace block, False otherwise.
"""
return self.stack and isinstance(self.stack[-1], _NamespaceInfo) | [
"def",
"InNamespaceBody",
"(",
"self",
")",
":",
"return",
"self",
".",
"stack",
"and",
"isinstance",
"(",
"self",
".",
"stack",
"[",
"-",
"1",
"]",
",",
"_NamespaceInfo",
")"
] | https://github.com/openvinotoolkit/openvino/blob/dedcbeafa8b84cccdc55ca64b8da516682b381c7/cmake/developer_package/cpplint/cpplint.py#L2673-L2679 | |
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/tools/cpplint.py | python | FlagCxx11Features | (filename, clean_lines, linenum, error) | Flag those c++11 features that we only allow in certain places.
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. | Flag those c++11 features that we only allow in certain places. | [
"Flag",
"those",
"c",
"++",
"11",
"features",
"that",
"we",
"only",
"allow",
"in",
"certain",
"places",
"."
] | def FlagCxx11Features(filename, clean_lines, linenum, error):
"""Flag those c++11 features that we only allow in certain places.
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 ... | [
"def",
"FlagCxx11Features",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"include",
"=",
"Match",
"(",
"r'\\s*#\\s*include\\s+[<\"]([^<\"]+)[\">]'",
",",
"line",
")",... | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/tools/cpplint.py#L6475-L6524 | ||
gem5/gem5 | 141cc37c2d4b93959d4c249b8f7e6a8b2ef75338 | ext/ply/example/BASIC/basparse.py | python | p_plist | (p) | plist : plist COMMA pitem
| pitem | plist : plist COMMA pitem
| pitem | [
"plist",
":",
"plist",
"COMMA",
"pitem",
"|",
"pitem"
] | def p_plist(p):
'''plist : plist COMMA pitem
| pitem'''
if len(p) > 3:
p[0] = p[1]
p[0].append(p[3])
else:
p[0] = [p[1]] | [
"def",
"p_plist",
"(",
"p",
")",
":",
"if",
"len",
"(",
"p",
")",
">",
"3",
":",
"p",
"[",
"0",
"]",
"=",
"p",
"[",
"1",
"]",
"p",
"[",
"0",
"]",
".",
"append",
"(",
"p",
"[",
"3",
"]",
")",
"else",
":",
"p",
"[",
"0",
"]",
"=",
"["... | https://github.com/gem5/gem5/blob/141cc37c2d4b93959d4c249b8f7e6a8b2ef75338/ext/ply/example/BASIC/basparse.py#L373-L380 | ||
epam/Indigo | 30e40b4b1eb9bae0207435a26cfcb81ddcc42be1 | utils/indigo-service/service/v2/indigo_api.py | python | check | () | return result, 200, {"Content-Type": "application/json"} | Check chemical structure
---
tags:
- indigo
parameters:
- name: json_request
in: body
required: true
schema:
id: IndigoCheckRequest
properties:
struct:
type: string
required: true
examples: C1=CC=CC... | Check chemical structure
---
tags:
- indigo
parameters:
- name: json_request
in: body
required: true
schema:
id: IndigoCheckRequest
properties:
struct:
type: string
required: true
examples: C1=CC=CC... | [
"Check",
"chemical",
"structure",
"---",
"tags",
":",
"-",
"indigo",
"parameters",
":",
"-",
"name",
":",
"json_request",
"in",
":",
"body",
"required",
":",
"true",
"schema",
":",
"id",
":",
"IndigoCheckRequest",
"properties",
":",
"struct",
":",
"type",
... | def check():
"""
Check chemical structure
---
tags:
- indigo
parameters:
- name: json_request
in: body
required: true
schema:
id: IndigoCheckRequest
properties:
struct:
type: string
required: true
... | [
"def",
"check",
"(",
")",
":",
"data",
"=",
"IndigoCheckSchema",
"(",
")",
".",
"load",
"(",
"get_request_data",
"(",
"request",
")",
")",
"try",
":",
"indigo",
"=",
"indigo_init",
"(",
"data",
"[",
"\"options\"",
"]",
")",
"except",
"Exception",
"as",
... | https://github.com/epam/Indigo/blob/30e40b4b1eb9bae0207435a26cfcb81ddcc42be1/utils/indigo-service/service/v2/indigo_api.py#L1091-L1152 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.