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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/mindrecord/shardheader.py | python | ShardHeader.add_schema | (self, schema) | return schema_id | Add object of ShardSchema.
Args:
schema (ShardSchema): Object of ShardSchema.
Returns:
int, schema id.
Raises:
MRMAddSchemaError: If failed to add schema. | Add object of ShardSchema. | [
"Add",
"object",
"of",
"ShardSchema",
"."
] | def add_schema(self, schema):
"""
Add object of ShardSchema.
Args:
schema (ShardSchema): Object of ShardSchema.
Returns:
int, schema id.
Raises:
MRMAddSchemaError: If failed to add schema.
"""
schema_id = self._header.add_schema... | [
"def",
"add_schema",
"(",
"self",
",",
"schema",
")",
":",
"schema_id",
"=",
"self",
".",
"_header",
".",
"add_schema",
"(",
"schema",
")",
"if",
"schema_id",
"==",
"-",
"1",
":",
"logger",
".",
"critical",
"(",
"\"Failed to add schema.\"",
")",
"raise",
... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/mindrecord/shardheader.py#L37-L54 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_vendor/requests/cookies.py | python | RequestsCookieJar._find_no_duplicates | (self, name, domain=None, path=None) | Both ``__get_item__`` and ``get`` call this function: it's never
used elsewhere in Requests.
:param name: a string containing name of cookie
:param domain: (optional) string containing domain of cookie
:param path: (optional) string containing path of cookie
:raises KeyErr... | Both ``__get_item__`` and ``get`` call this function: it's never | [
"Both",
"__get_item__",
"and",
"get",
"call",
"this",
"function",
":",
"it",
"s",
"never"
] | def _find_no_duplicates(self, name, domain=None, path=None):
"""Both ``__get_item__`` and ``get`` call this function: it's never
used elsewhere in Requests.
:param name: a string containing name of cookie
:param domain: (optional) string containing domain of cookie
:param ... | [
"def",
"_find_no_duplicates",
"(",
"self",
",",
"name",
",",
"domain",
"=",
"None",
",",
"path",
"=",
"None",
")",
":",
"toReturn",
"=",
"None",
"for",
"cookie",
"in",
"iter",
"(",
"self",
")",
":",
"if",
"cookie",
".",
"name",
"==",
"name",
":",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_vendor/requests/cookies.py#L751-L797 | ||
Ewenwan/MVision | 97b394dfa48cb21c82cd003b1a952745e413a17f | CNN/SqueezeNet/SqueezeNet-SSD-OD/ssd_detect.py | python | main | (args) | main | main | [
"main"
] | def main(args):
'''main '''
# 定义一个检测器类
detection = CaffeDetection(args.gpu_id,
args.model_def, args.model_weights,
args.image_resize, args.labelmap_file)
# 检测并获取结果
result = detection.detect(args.image_file)
# 打印结果
print result
... | [
"def",
"main",
"(",
"args",
")",
":",
"# 定义一个检测器类",
"detection",
"=",
"CaffeDetection",
"(",
"args",
".",
"gpu_id",
",",
"args",
".",
"model_def",
",",
"args",
".",
"model_weights",
",",
"args",
".",
"image_resize",
",",
"args",
".",
"labelmap_file",
")",
... | https://github.com/Ewenwan/MVision/blob/97b394dfa48cb21c82cd003b1a952745e413a17f/CNN/SqueezeNet/SqueezeNet-SSD-OD/ssd_detect.py#L122-L149 | ||
cms-sw/cmssw | fd9de012d503d3405420bcbeec0ec879baa57cf2 | Alignment/OfflineValidation/python/TkAlAllInOneTool/zMuMuValidation.py | python | ZMuMuValidation.appendToPlots | (self) | return replaceByMap(' filenames.push_back("root://eoscms//eos/cms/store/group/alca_trackeralign/AlignmentValidation/.oO[eosdir]Oo./BiasCheck.root"); titles.push_back(".oO[title]Oo."); colors.push_back(.oO[color]Oo.); linestyles.push_back(.oO[style]Oo.);\n', repMap) | if no argument or "" is passed a string with an instantiation is
returned, else the validation is appended to the list | if no argument or "" is passed a string with an instantiation is
returned, else the validation is appended to the list | [
"if",
"no",
"argument",
"or",
"is",
"passed",
"a",
"string",
"with",
"an",
"instantiation",
"is",
"returned",
"else",
"the",
"validation",
"is",
"appended",
"to",
"the",
"list"
] | def appendToPlots(self):
"""
if no argument or "" is passed a string with an instantiation is
returned, else the validation is appended to the list
"""
repMap = self.getRepMap()
return replaceByMap(' filenames.push_back("root://eoscms//eos/cms/store/group/alca_trackera... | [
"def",
"appendToPlots",
"(",
"self",
")",
":",
"repMap",
"=",
"self",
".",
"getRepMap",
"(",
")",
"return",
"replaceByMap",
"(",
"' filenames.push_back(\"root://eoscms//eos/cms/store/group/alca_trackeralign/AlignmentValidation/.oO[eosdir]Oo./BiasCheck.root\"); titles.push_back(\"... | https://github.com/cms-sw/cmssw/blob/fd9de012d503d3405420bcbeec0ec879baa57cf2/Alignment/OfflineValidation/python/TkAlAllInOneTool/zMuMuValidation.py#L114-L120 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/seq2seq/python/ops/attention_wrapper.py | python | LuongAttention.__init__ | (self,
num_units,
memory,
memory_sequence_length=None,
scale=False,
probability_fn=None,
score_mask_value=None,
dtype=None,
custom_key_value_fn=None,
name="LuongAttention") | Construct the AttentionMechanism mechanism.
Args:
num_units: The depth of the attention mechanism.
memory: The memory to query; usually the output of an RNN encoder. This
tensor should be shaped `[batch_size, max_time, ...]`.
memory_sequence_length: (optional) Sequence lengths for the ba... | Construct the AttentionMechanism mechanism. | [
"Construct",
"the",
"AttentionMechanism",
"mechanism",
"."
] | def __init__(self,
num_units,
memory,
memory_sequence_length=None,
scale=False,
probability_fn=None,
score_mask_value=None,
dtype=None,
custom_key_value_fn=None,
name="LuongAttention"):... | [
"def",
"__init__",
"(",
"self",
",",
"num_units",
",",
"memory",
",",
"memory_sequence_length",
"=",
"None",
",",
"scale",
"=",
"False",
",",
"probability_fn",
"=",
"None",
",",
"score_mask_value",
"=",
"None",
",",
"dtype",
"=",
"None",
",",
"custom_key_val... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/seq2seq/python/ops/attention_wrapper.py#L672-L723 | ||
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | caffe2/python/checkpoint.py | python | MultiNodeCheckpointManager.report_checkpoint_stats | (self, action_name) | Report the checkpoint stats for all the nodes, we need to aggregate all
the node's stats together so that we know which node's checkpoint
operation dominates.
Args:
action_name: A string of the name of checkpoint operation. | Report the checkpoint stats for all the nodes, we need to aggregate all
the node's stats together so that we know which node's checkpoint
operation dominates. | [
"Report",
"the",
"checkpoint",
"stats",
"for",
"all",
"the",
"nodes",
"we",
"need",
"to",
"aggregate",
"all",
"the",
"node",
"s",
"stats",
"together",
"so",
"that",
"we",
"know",
"which",
"node",
"s",
"checkpoint",
"operation",
"dominates",
"."
] | def report_checkpoint_stats(self, action_name):
"""
Report the checkpoint stats for all the nodes, we need to aggregate all
the node's stats together so that we know which node's checkpoint
operation dominates.
Args:
action_name: A string of the name of checkpoint op... | [
"def",
"report_checkpoint_stats",
"(",
"self",
",",
"action_name",
")",
":",
"all_stats",
"=",
"{",
"}",
"for",
"_",
",",
"manager",
"in",
"self",
".",
"_node_managers",
":",
"manager",
".",
"collect_checkpoint_stats",
"(",
"all_stats",
")",
"logger",
".",
"... | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/caffe2/python/checkpoint.py#L549-L563 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/rsa/rsa/_compat.py | python | byte | (num) | return pack("B", num) | Converts a number between 0 and 255 (both inclusive) to a base-256 (byte)
representation.
Use it as a replacement for ``chr`` where you are expecting a byte
because this will work on all current versions of Python::
:param num:
An unsigned integer between 0 and 255 (both inclusive).
:retur... | Converts a number between 0 and 255 (both inclusive) to a base-256 (byte)
representation. | [
"Converts",
"a",
"number",
"between",
"0",
"and",
"255",
"(",
"both",
"inclusive",
")",
"to",
"a",
"base",
"-",
"256",
"(",
"byte",
")",
"representation",
"."
] | def byte(num):
"""
Converts a number between 0 and 255 (both inclusive) to a base-256 (byte)
representation.
Use it as a replacement for ``chr`` where you are expecting a byte
because this will work on all current versions of Python::
:param num:
An unsigned integer between 0 and 255 (... | [
"def",
"byte",
"(",
"num",
")",
":",
"return",
"pack",
"(",
"\"B\"",
",",
"num",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/rsa/rsa/_compat.py#L108-L121 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/multiprocessing/connection.py | python | _ConnectionBase.closed | (self) | return self._handle is None | True if the connection is closed | True if the connection is closed | [
"True",
"if",
"the",
"connection",
"is",
"closed"
] | def closed(self):
"""True if the connection is closed"""
return self._handle is None | [
"def",
"closed",
"(",
"self",
")",
":",
"return",
"self",
".",
"_handle",
"is",
"None"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/multiprocessing/connection.py#L154-L156 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/tty.py | python | setcbreak | (fd, when=TCSAFLUSH) | Put terminal into a cbreak mode. | Put terminal into a cbreak mode. | [
"Put",
"terminal",
"into",
"a",
"cbreak",
"mode",
"."
] | def setcbreak(fd, when=TCSAFLUSH):
"""Put terminal into a cbreak mode."""
mode = tcgetattr(fd)
mode[LFLAG] = mode[LFLAG] & ~(ECHO | ICANON)
mode[CC][VMIN] = 1
mode[CC][VTIME] = 0
tcsetattr(fd, when, mode) | [
"def",
"setcbreak",
"(",
"fd",
",",
"when",
"=",
"TCSAFLUSH",
")",
":",
"mode",
"=",
"tcgetattr",
"(",
"fd",
")",
"mode",
"[",
"LFLAG",
"]",
"=",
"mode",
"[",
"LFLAG",
"]",
"&",
"~",
"(",
"ECHO",
"|",
"ICANON",
")",
"mode",
"[",
"CC",
"]",
"[",... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/tty.py#L30-L36 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqt/mantidqt/widgets/superplot/ads_observer.py | python | SuperplotAdsObserver.replacedHandle | (self, ws_name, ws) | Triggered when a workspace is replaces.
Args:
ws_name (str): name of the workspace
ws (workspace): reference to the workspace | Triggered when a workspace is replaces. | [
"Triggered",
"when",
"a",
"workspace",
"is",
"replaces",
"."
] | def replacedHandle(self, ws_name, ws):
"""
Triggered when a workspace is replaces.
Args:
ws_name (str): name of the workspace
ws (workspace): reference to the workspace
"""
self.signals.sig_ws_replaced.emit(ws_name) | [
"def",
"replacedHandle",
"(",
"self",
",",
"ws_name",
",",
"ws",
")",
":",
"self",
".",
"signals",
".",
"sig_ws_replaced",
".",
"emit",
"(",
"ws_name",
")"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqt/mantidqt/widgets/superplot/ads_observer.py#L74-L82 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/PIL/Image.py | python | Image.seek | (self, frame) | Seeks to the given frame in this sequence file. If you seek
beyond the end of the sequence, the method raises an
**EOFError** exception. When a sequence file is opened, the
library automatically seeks to frame 0.
See :py:meth:`~PIL.Image.Image.tell`.
:param frame: Frame number,... | Seeks to the given frame in this sequence file. If you seek
beyond the end of the sequence, the method raises an
**EOFError** exception. When a sequence file is opened, the
library automatically seeks to frame 0. | [
"Seeks",
"to",
"the",
"given",
"frame",
"in",
"this",
"sequence",
"file",
".",
"If",
"you",
"seek",
"beyond",
"the",
"end",
"of",
"the",
"sequence",
"the",
"method",
"raises",
"an",
"**",
"EOFError",
"**",
"exception",
".",
"When",
"a",
"sequence",
"file... | def seek(self, frame):
"""
Seeks to the given frame in this sequence file. If you seek
beyond the end of the sequence, the method raises an
**EOFError** exception. When a sequence file is opened, the
library automatically seeks to frame 0.
See :py:meth:`~PIL.Image.Image.... | [
"def",
"seek",
"(",
"self",
",",
"frame",
")",
":",
"# overridden by file handlers",
"if",
"frame",
"!=",
"0",
":",
"raise",
"EOFError"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/PIL/Image.py#L2140-L2156 | ||
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_aarch64/python2.7/dist-packages/geographic_msgs/msg/_RoutePath.py | python | RoutePath.serialize_numpy | (self, buff, numpy) | serialize message with numpy array types into buffer
:param buff: buffer, ``StringIO``
:param numpy: numpy python module | serialize message with numpy array types into buffer
:param buff: buffer, ``StringIO``
:param numpy: numpy python module | [
"serialize",
"message",
"with",
"numpy",
"array",
"types",
"into",
"buffer",
":",
"param",
"buff",
":",
"buffer",
"StringIO",
":",
"param",
"numpy",
":",
"numpy",
"python",
"module"
] | def serialize_numpy(self, buff, numpy):
"""
serialize message with numpy array types into buffer
:param buff: buffer, ``StringIO``
:param numpy: numpy python module
"""
try:
_x = self
buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
_x = s... | [
"def",
"serialize_numpy",
"(",
"self",
",",
"buff",
",",
"numpy",
")",
":",
"try",
":",
"_x",
"=",
"self",
"buff",
".",
"write",
"(",
"_struct_3I",
".",
"pack",
"(",
"_x",
".",
"header",
".",
"seq",
",",
"_x",
".",
"header",
".",
"stamp",
".",
"s... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_aarch64/python2.7/dist-packages/geographic_msgs/msg/_RoutePath.py#L233-L288 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py3/pandas/core/arrays/categorical.py | python | Categorical.map | (self, mapper) | Map categories using input correspondence (dict, Series, or function).
Maps the categories to new categories. If the mapping correspondence is
one-to-one the result is a :class:`~pandas.Categorical` which has the
same order property as the original, otherwise a :class:`~pandas.Index`
is... | Map categories using input correspondence (dict, Series, or function). | [
"Map",
"categories",
"using",
"input",
"correspondence",
"(",
"dict",
"Series",
"or",
"function",
")",
"."
] | def map(self, mapper):
"""
Map categories using input correspondence (dict, Series, or function).
Maps the categories to new categories. If the mapping correspondence is
one-to-one the result is a :class:`~pandas.Categorical` which has the
same order property as the original, ot... | [
"def",
"map",
"(",
"self",
",",
"mapper",
")",
":",
"new_categories",
"=",
"self",
".",
"categories",
".",
"map",
"(",
"mapper",
")",
"try",
":",
"return",
"self",
".",
"from_codes",
"(",
"self",
".",
"_codes",
".",
"copy",
"(",
")",
",",
"categories... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/core/arrays/categorical.py#L1306-L1385 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/debug/cli/curses_ui.py | python | CursesUI._screen_terminate | (self) | Terminate the curses screen. | Terminate the curses screen. | [
"Terminate",
"the",
"curses",
"screen",
"."
] | def _screen_terminate(self):
"""Terminate the curses screen."""
self._stdscr.keypad(0)
curses.nocbreak()
curses.echo()
curses.endwin()
try:
# Remove SIGINT handler.
signal.signal(signal.SIGINT, signal.SIG_DFL)
except ValueError:
# Can't catch signals unless you're the main... | [
"def",
"_screen_terminate",
"(",
"self",
")",
":",
"self",
".",
"_stdscr",
".",
"keypad",
"(",
"0",
")",
"curses",
".",
"nocbreak",
"(",
")",
"curses",
".",
"echo",
"(",
")",
"curses",
".",
"endwin",
"(",
")",
"try",
":",
"# Remove SIGINT handler.",
"s... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/debug/cli/curses_ui.py#L470-L483 | ||
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | python/mxnet/kvstore.py | python | KVStore._send_command_to_servers | (self, head, body) | Sends a command to all server nodes.
Sending command to a server node will cause that server node to invoke
``KVStoreServer.controller`` to execute the command.
This function returns after the command has been executed on all server
nodes.
Parameters
----------
... | Sends a command to all server nodes. | [
"Sends",
"a",
"command",
"to",
"all",
"server",
"nodes",
"."
] | def _send_command_to_servers(self, head, body):
"""Sends a command to all server nodes.
Sending command to a server node will cause that server node to invoke
``KVStoreServer.controller`` to execute the command.
This function returns after the command has been executed on all server
... | [
"def",
"_send_command_to_servers",
"(",
"self",
",",
"head",
",",
"body",
")",
":",
"check_call",
"(",
"_LIB",
".",
"MXKVStoreSendCommmandToServers",
"(",
"self",
".",
"handle",
",",
"mx_uint",
"(",
"head",
")",
",",
"c_str",
"(",
"body",
")",
")",
")"
] | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/python/mxnet/kvstore.py#L616-L633 | ||
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/python/turicreate/toolkits/style_transfer/_tf_model_architecture.py | python | define_resnet | (tf_input, tf_index, weights, prefix="transformer_") | return decode_3_relu_1 | This function defines the resnet network using the tensorflow nn api.
Parameters
----------
tf_input: tensorflow.Tensor
The input tensor to the network. The image is expected to be in RGB
format.
tf_index: tensorflow.Tensor
The index tensor to the network.
weights: dictionar... | This function defines the resnet network using the tensorflow nn api. | [
"This",
"function",
"defines",
"the",
"resnet",
"network",
"using",
"the",
"tensorflow",
"nn",
"api",
"."
] | def define_resnet(tf_input, tf_index, weights, prefix="transformer_"):
"""
This function defines the resnet network using the tensorflow nn api.
Parameters
----------
tf_input: tensorflow.Tensor
The input tensor to the network. The image is expected to be in RGB
format.
tf_index... | [
"def",
"define_resnet",
"(",
"tf_input",
",",
"tf_index",
",",
"weights",
",",
"prefix",
"=",
"\"transformer_\"",
")",
":",
"_tf",
"=",
"_lazy_import_tensorflow",
"(",
")",
"# encoding 1",
"conv_1_paddings",
"=",
"_tf",
".",
"constant",
"(",
"[",
"[",
"0",
"... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/python/turicreate/toolkits/style_transfer/_tf_model_architecture.py#L161-L307 | |
google/sandboxed-api | 7004d59150c9fbfaa3e5fd1872affffd1ab14fe8 | oss-internship-2020/libuv/generator/wrapper_generator.py | python | get_signatures | (text: str) | return zip(method_types, names, arguments_lists) | Gets the signatures of all the methods in the header.
Note: This method only works on a certain version of LibUV's header.
Args:
text: The contents of the header file
Returns:
The extracted method signatures. | Gets the signatures of all the methods in the header. | [
"Gets",
"the",
"signatures",
"of",
"all",
"the",
"methods",
"in",
"the",
"header",
"."
] | def get_signatures(text: str) -> str:
"""Gets the signatures of all the methods in the header.
Note: This method only works on a certain version of LibUV's header.
Args:
text: The contents of the header file
Returns:
The extracted method signatures.
"""
signatures = [x.split(";")[0].strip() for ... | [
"def",
"get_signatures",
"(",
"text",
":",
"str",
")",
"->",
"str",
":",
"signatures",
"=",
"[",
"x",
".",
"split",
"(",
"\";\"",
")",
"[",
"0",
"]",
".",
"strip",
"(",
")",
"for",
"x",
"in",
"text",
".",
"split",
"(",
"\"UV_EXTERN\"",
")",
"[",
... | https://github.com/google/sandboxed-api/blob/7004d59150c9fbfaa3e5fd1872affffd1ab14fe8/oss-internship-2020/libuv/generator/wrapper_generator.py#L184-L203 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/labeled_tensor/python/ops/ops.py | python | pad | (labeled_tensor, paddings, mode='CONSTANT', name=None) | Pads a tensor.
See tf.pad.
Args:
labeled_tensor: The input tensor.
paddings: A mapping where the keys are axis names and the values are
tuples where the first element is the padding to insert at the beginning
of the axis and the second is the padding to insert at the end of the
axis.
... | Pads a tensor. | [
"Pads",
"a",
"tensor",
"."
] | def pad(labeled_tensor, paddings, mode='CONSTANT', name=None):
"""Pads a tensor.
See tf.pad.
Args:
labeled_tensor: The input tensor.
paddings: A mapping where the keys are axis names and the values are
tuples where the first element is the padding to insert at the beginning
of the axis and t... | [
"def",
"pad",
"(",
"labeled_tensor",
",",
"paddings",
",",
"mode",
"=",
"'CONSTANT'",
",",
"name",
"=",
"None",
")",
":",
"with",
"ops",
".",
"name_scope",
"(",
"name",
",",
"'lt_pad'",
",",
"[",
"labeled_tensor",
"]",
")",
"as",
"scope",
":",
"labeled... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/labeled_tensor/python/ops/ops.py#L1031-L1078 | ||
NREL/EnergyPlus | fadc5973b85c70e8cc923efb69c144e808a26078 | scripts/dev/licensetext.py | python | pythonize | (text, line_limit=79, toolname='unspecified',
message=report_error) | return '#' + '\n#'.join(lines) + '\n' | Convert the C++ comment text into Python comments | Convert the C++ comment text into Python comments | [
"Convert",
"the",
"C",
"++",
"comment",
"text",
"into",
"Python",
"comments"
] | def pythonize(text, line_limit=79, toolname='unspecified',
message=report_error):
'''Convert the C++ comment text into Python comments'''
paragraphs = [el for el in merge_paragraphs(text).splitlines() if el != '']
if len(paragraphs) != 8 or line_limit < 7:
message({'tool': toolname,
... | [
"def",
"pythonize",
"(",
"text",
",",
"line_limit",
"=",
"79",
",",
"toolname",
"=",
"'unspecified'",
",",
"message",
"=",
"report_error",
")",
":",
"paragraphs",
"=",
"[",
"el",
"for",
"el",
"in",
"merge_paragraphs",
"(",
"text",
")",
".",
"splitlines",
... | https://github.com/NREL/EnergyPlus/blob/fadc5973b85c70e8cc923efb69c144e808a26078/scripts/dev/licensetext.py#L166-L196 | |
cms-sw/cmssw | fd9de012d503d3405420bcbeec0ec879baa57cf2 | Alignment/MuonAlignment/python/svgfig.py | python | make_symbol | (id, shape="dot", **attr) | return output | Creates a new instance of an SVG symbol to avoid cross-linking objects.
id required a new identifier (string/Unicode)
shape default="dot" the shape name from _symbol_templates
attribute=value list keyword list modify the SVG attributes of the new symbol | Creates a new instance of an SVG symbol to avoid cross-linking objects. | [
"Creates",
"a",
"new",
"instance",
"of",
"an",
"SVG",
"symbol",
"to",
"avoid",
"cross",
"-",
"linking",
"objects",
"."
] | def make_symbol(id, shape="dot", **attr):
"""Creates a new instance of an SVG symbol to avoid cross-linking objects.
id required a new identifier (string/Unicode)
shape default="dot" the shape name from _symbol_templates
attribute=value list keyword list modify ... | [
"def",
"make_symbol",
"(",
"id",
",",
"shape",
"=",
"\"dot\"",
",",
"*",
"*",
"attr",
")",
":",
"output",
"=",
"copy",
".",
"deepcopy",
"(",
"_symbol_templates",
"[",
"shape",
"]",
")",
"for",
"i",
"in",
"output",
".",
"sub",
":",
"i",
".",
"attr",... | https://github.com/cms-sw/cmssw/blob/fd9de012d503d3405420bcbeec0ec879baa57cf2/Alignment/MuonAlignment/python/svgfig.py#L1894-L1904 | |
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | base/android/jni_generator/jni_generator.py | python | JavaDataTypeToC | (java_type) | Returns a C datatype for the given java type. | Returns a C datatype for the given java type. | [
"Returns",
"a",
"C",
"datatype",
"for",
"the",
"given",
"java",
"type",
"."
] | def JavaDataTypeToC(java_type):
"""Returns a C datatype for the given java type."""
java_pod_type_map = {
'int': 'jint',
'byte': 'jbyte',
'boolean': 'jboolean',
'long': 'jlong',
'double': 'jdouble',
'float': 'jfloat',
}
java_type_map = {
'void': 'void',
'String': ... | [
"def",
"JavaDataTypeToC",
"(",
"java_type",
")",
":",
"java_pod_type_map",
"=",
"{",
"'int'",
":",
"'jint'",
",",
"'byte'",
":",
"'jbyte'",
",",
"'boolean'",
":",
"'jboolean'",
",",
"'long'",
":",
"'jlong'",
",",
"'double'",
":",
"'jdouble'",
",",
"'float'",... | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/base/android/jni_generator/jni_generator.py#L91-L114 | ||
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/ops/composite/multitype_ops/_compile_utils.py | python | _tensor_getitem | (self, index) | Handle tensor getitem | Handle tensor getitem | [
"Handle",
"tensor",
"getitem"
] | def _tensor_getitem(self, index):
"""Handle tensor getitem"""
if isinstance(index, Tensor):
return tensor_index_by_tensor(self, index)
if isinstance(index, list):
return tensor_index_by_list(self, index)
if isinstance(index, tuple):
return tensor_index_by_tuple(self, index)
i... | [
"def",
"_tensor_getitem",
"(",
"self",
",",
"index",
")",
":",
"if",
"isinstance",
"(",
"index",
",",
"Tensor",
")",
":",
"return",
"tensor_index_by_tensor",
"(",
"self",
",",
"index",
")",
"if",
"isinstance",
"(",
"index",
",",
"list",
")",
":",
"return... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/ops/composite/multitype_ops/_compile_utils.py#L32-L51 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py3/pandas/core/arrays/datetimes.py | python | objects_to_datetime64ns | (
data: np.ndarray,
dayfirst,
yearfirst,
utc=False,
errors="raise",
require_iso8601: bool = False,
allow_object: bool = False,
allow_mixed: bool = False,
) | Convert data to array of timestamps.
Parameters
----------
data : np.ndarray[object]
dayfirst : bool
yearfirst : bool
utc : bool, default False
Whether to convert timezone-aware timestamps to UTC.
errors : {'raise', 'ignore', 'coerce'}
require_iso8601 : bool, default False
a... | Convert data to array of timestamps. | [
"Convert",
"data",
"to",
"array",
"of",
"timestamps",
"."
] | def objects_to_datetime64ns(
data: np.ndarray,
dayfirst,
yearfirst,
utc=False,
errors="raise",
require_iso8601: bool = False,
allow_object: bool = False,
allow_mixed: bool = False,
):
"""
Convert data to array of timestamps.
Parameters
----------
data : np.ndarray[ob... | [
"def",
"objects_to_datetime64ns",
"(",
"data",
":",
"np",
".",
"ndarray",
",",
"dayfirst",
",",
"yearfirst",
",",
"utc",
"=",
"False",
",",
"errors",
"=",
"\"raise\"",
",",
"require_iso8601",
":",
"bool",
"=",
"False",
",",
"allow_object",
":",
"bool",
"="... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/core/arrays/datetimes.py#L2132-L2221 | ||
tomahawk-player/tomahawk-resolvers | 7f827bbe410ccfdb0446f7d6a91acc2199c9cc8d | archive/spotify/breakpad/third_party/protobuf/protobuf/python/google/protobuf/internal/decoder.py | python | _SkipFixed32 | (buffer, pos, end) | return pos | Skip a fixed32 value. Returns the new position. | Skip a fixed32 value. Returns the new position. | [
"Skip",
"a",
"fixed32",
"value",
".",
"Returns",
"the",
"new",
"position",
"."
] | def _SkipFixed32(buffer, pos, end):
"""Skip a fixed32 value. Returns the new position."""
pos += 4
if pos > end:
raise _DecodeError('Truncated message.')
return pos | [
"def",
"_SkipFixed32",
"(",
"buffer",
",",
"pos",
",",
"end",
")",
":",
"pos",
"+=",
"4",
"if",
"pos",
">",
"end",
":",
"raise",
"_DecodeError",
"(",
"'Truncated message.'",
")",
"return",
"pos"
] | https://github.com/tomahawk-player/tomahawk-resolvers/blob/7f827bbe410ccfdb0446f7d6a91acc2199c9cc8d/archive/spotify/breakpad/third_party/protobuf/protobuf/python/google/protobuf/internal/decoder.py#L668-L674 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/parso/py2/parso/utils.py | python | parse_version_string | (version=None) | return _parse_version(version) | Checks for a valid version number (e.g. `3.8` or `2.7.1` or `3`) and
returns a corresponding version info that is always two characters long in
decimal. | Checks for a valid version number (e.g. `3.8` or `2.7.1` or `3`) and
returns a corresponding version info that is always two characters long in
decimal. | [
"Checks",
"for",
"a",
"valid",
"version",
"number",
"(",
"e",
".",
"g",
".",
"3",
".",
"8",
"or",
"2",
".",
"7",
".",
"1",
"or",
"3",
")",
"and",
"returns",
"a",
"corresponding",
"version",
"info",
"that",
"is",
"always",
"two",
"characters",
"long... | def parse_version_string(version=None):
"""
Checks for a valid version number (e.g. `3.8` or `2.7.1` or `3`) and
returns a corresponding version info that is always two characters long in
decimal.
"""
if version is None:
version = '%s.%s' % sys.version_info[:2]
if not isinstance(vers... | [
"def",
"parse_version_string",
"(",
"version",
"=",
"None",
")",
":",
"if",
"version",
"is",
"None",
":",
"version",
"=",
"'%s.%s'",
"%",
"sys",
".",
"version_info",
"[",
":",
"2",
"]",
"if",
"not",
"isinstance",
"(",
"version",
",",
"(",
"unicode",
",... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/parso/py2/parso/utils.py#L174-L185 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pkg_resources/__init__.py | python | yield_lines | (strs) | Yield non-empty/non-comment lines of a string or sequence | Yield non-empty/non-comment lines of a string or sequence | [
"Yield",
"non",
"-",
"empty",
"/",
"non",
"-",
"comment",
"lines",
"of",
"a",
"string",
"or",
"sequence"
] | def yield_lines(strs):
"""Yield non-empty/non-comment lines of a string or sequence"""
if isinstance(strs, six.string_types):
for s in strs.splitlines():
s = s.strip()
# skip blank lines/comments
if s and not s.startswith('#'):
yield s
else:
... | [
"def",
"yield_lines",
"(",
"strs",
")",
":",
"if",
"isinstance",
"(",
"strs",
",",
"six",
".",
"string_types",
")",
":",
"for",
"s",
"in",
"strs",
".",
"splitlines",
"(",
")",
":",
"s",
"=",
"s",
".",
"strip",
"(",
")",
"# skip blank lines/comments",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pkg_resources/__init__.py#L2397-L2408 | ||
tfwu/FaceDetection-ConvNet-3D | f9251c48eb40c5aec8fba7455115c355466555be | python/build/lib.linux-x86_64-2.7/mxnet/monitor.py | python | Monitor.toc | (self) | return res | End collecting for current batch and return results.
Call after computation of current batch.
Returns
-------
res : list of | End collecting for current batch and return results.
Call after computation of current batch. | [
"End",
"collecting",
"for",
"current",
"batch",
"and",
"return",
"results",
".",
"Call",
"after",
"computation",
"of",
"current",
"batch",
"."
] | def toc(self):
"""End collecting for current batch and return results.
Call after computation of current batch.
Returns
-------
res : list of """
if not self.activated:
return []
for exe in self.exes:
for array in exe.arg_arrays:
... | [
"def",
"toc",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"activated",
":",
"return",
"[",
"]",
"for",
"exe",
"in",
"self",
".",
"exes",
":",
"for",
"array",
"in",
"exe",
".",
"arg_arrays",
":",
"array",
".",
"wait_to_read",
"(",
")",
"for",
... | https://github.com/tfwu/FaceDetection-ConvNet-3D/blob/f9251c48eb40c5aec8fba7455115c355466555be/python/build/lib.linux-x86_64-2.7/mxnet/monitor.py#L77-L110 | |
macchina-io/macchina.io | ef24ba0e18379c3dd48fb84e6dbf991101cb8db0 | platform/JS/V8/tools/gyp/pylib/gyp/ninja_syntax.py | python | Writer._count_dollars_before_index | (self, s, i) | return dollar_count | Returns the number of '$' characters right in front of s[i]. | Returns the number of '$' characters right in front of s[i]. | [
"Returns",
"the",
"number",
"of",
"$",
"characters",
"right",
"in",
"front",
"of",
"s",
"[",
"i",
"]",
"."
] | def _count_dollars_before_index(self, s, i):
"""Returns the number of '$' characters right in front of s[i]."""
dollar_count = 0
dollar_index = i - 1
while dollar_index > 0 and s[dollar_index] == '$':
dollar_count += 1
dollar_index -= 1
return dollar_count | [
"def",
"_count_dollars_before_index",
"(",
"self",
",",
"s",
",",
"i",
")",
":",
"dollar_count",
"=",
"0",
"dollar_index",
"=",
"i",
"-",
"1",
"while",
"dollar_index",
">",
"0",
"and",
"s",
"[",
"dollar_index",
"]",
"==",
"'$'",
":",
"dollar_count",
"+="... | https://github.com/macchina-io/macchina.io/blob/ef24ba0e18379c3dd48fb84e6dbf991101cb8db0/platform/JS/V8/tools/gyp/pylib/gyp/ninja_syntax.py#L102-L109 | |
nnrg/opennero | 43e12a1bcba6e228639db3886fec1dc47ddc24cb | mods/Roomba/RLAgent.py | python | TabularRLAgent.end | (self, time, reward) | return True | receive the reward for the last observation | receive the reward for the last observation | [
"receive",
"the",
"reward",
"for",
"the",
"last",
"observation"
] | def end(self, time, reward):
"""
receive the reward for the last observation
"""
# get the reward from the last action
r = reward[0]
o = self.previous_sensors
a = self.previous_action
# get the updated epsilon, in case the slider was changed by the user
... | [
"def",
"end",
"(",
"self",
",",
"time",
",",
"reward",
")",
":",
"# get the reward from the last action",
"r",
"=",
"reward",
"[",
"0",
"]",
"o",
"=",
"self",
".",
"previous_sensors",
"a",
"=",
"self",
".",
"previous_action",
"# get the updated epsilon, in case ... | https://github.com/nnrg/opennero/blob/43e12a1bcba6e228639db3886fec1dc47ddc24cb/mods/Roomba/RLAgent.py#L172-L187 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/ipython/py2/IPython/utils/text.py | python | long_substr | (data) | return substr | Return the longest common substring in a list of strings.
Credit: http://stackoverflow.com/questions/2892931/longest-common-substring-from-more-than-two-strings-python | Return the longest common substring in a list of strings.
Credit: http://stackoverflow.com/questions/2892931/longest-common-substring-from-more-than-two-strings-python | [
"Return",
"the",
"longest",
"common",
"substring",
"in",
"a",
"list",
"of",
"strings",
".",
"Credit",
":",
"http",
":",
"//",
"stackoverflow",
".",
"com",
"/",
"questions",
"/",
"2892931",
"/",
"longest",
"-",
"common",
"-",
"substring",
"-",
"from",
"-"... | def long_substr(data):
"""Return the longest common substring in a list of strings.
Credit: http://stackoverflow.com/questions/2892931/longest-common-substring-from-more-than-two-strings-python
"""
substr = ''
if len(data) > 1 and len(data[0]) > 0:
for i in range(len(data[0])):
... | [
"def",
"long_substr",
"(",
"data",
")",
":",
"substr",
"=",
"''",
"if",
"len",
"(",
"data",
")",
">",
"1",
"and",
"len",
"(",
"data",
"[",
"0",
"]",
")",
">",
"0",
":",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"data",
"[",
"0",
"]",
")",... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py2/IPython/utils/text.py#L416-L429 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/cgi.py | python | test | (environ=os.environ) | Robust test CGI script, usable as main program.
Write minimal HTTP headers and dump all information provided to
the script in HTML form. | Robust test CGI script, usable as main program. | [
"Robust",
"test",
"CGI",
"script",
"usable",
"as",
"main",
"program",
"."
] | def test(environ=os.environ):
"""Robust test CGI script, usable as main program.
Write minimal HTTP headers and dump all information provided to
the script in HTML form.
"""
print "Content-type: text/html"
print
sys.stderr = sys.stdout
try:
form = FieldStorage() # Replace wit... | [
"def",
"test",
"(",
"environ",
"=",
"os",
".",
"environ",
")",
":",
"print",
"\"Content-type: text/html\"",
"print",
"sys",
".",
"stderr",
"=",
"sys",
".",
"stdout",
"try",
":",
"form",
"=",
"FieldStorage",
"(",
")",
"# Replace with other classes to test those",... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/cgi.py#L882-L919 | ||
vslavik/poedit | f7a9daa0a10037e090aa0a86f5ce0f24ececdf6a | deps/boost/tools/build/src/build/virtual_target.py | python | VirtualTarget.actualize_location | (self, target) | Sets up variables on 'target' which specify its location. | Sets up variables on 'target' which specify its location. | [
"Sets",
"up",
"variables",
"on",
"target",
"which",
"specify",
"its",
"location",
"."
] | def actualize_location (self, target):
""" Sets up variables on 'target' which specify its location.
"""
raise BaseException ("method should be defined in derived classes") | [
"def",
"actualize_location",
"(",
"self",
",",
"target",
")",
":",
"raise",
"BaseException",
"(",
"\"method should be defined in derived classes\"",
")"
] | https://github.com/vslavik/poedit/blob/f7a9daa0a10037e090aa0a86f5ce0f24ececdf6a/deps/boost/tools/build/src/build/virtual_target.py#L359-L362 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/telemetry/telemetry/core/cros_interface.py | python | CrOSInterface._GetSessionManagerPid | (self, procs) | return None | Returns the pid of the session_manager process, given the list of
processes. | Returns the pid of the session_manager process, given the list of
processes. | [
"Returns",
"the",
"pid",
"of",
"the",
"session_manager",
"process",
"given",
"the",
"list",
"of",
"processes",
"."
] | def _GetSessionManagerPid(self, procs):
"""Returns the pid of the session_manager process, given the list of
processes."""
for pid, process, _, _ in procs:
argv = process.split()
if argv and os.path.basename(argv[0]) == 'session_manager':
return pid
return None | [
"def",
"_GetSessionManagerPid",
"(",
"self",
",",
"procs",
")",
":",
"for",
"pid",
",",
"process",
",",
"_",
",",
"_",
"in",
"procs",
":",
"argv",
"=",
"process",
".",
"split",
"(",
")",
"if",
"argv",
"and",
"os",
".",
"path",
".",
"basename",
"(",... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/telemetry/core/cros_interface.py#L357-L364 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/python2_version/klampt/src/motionplanning.py | python | PlannerInterface.addMilestone | (self, milestone) | return _motionplanning.PlannerInterface_addMilestone(self, milestone) | addMilestone(PlannerInterface self, PyObject * milestone) -> int | addMilestone(PlannerInterface self, PyObject * milestone) -> int | [
"addMilestone",
"(",
"PlannerInterface",
"self",
"PyObject",
"*",
"milestone",
")",
"-",
">",
"int"
] | def addMilestone(self, milestone):
"""
addMilestone(PlannerInterface self, PyObject * milestone) -> int
"""
return _motionplanning.PlannerInterface_addMilestone(self, milestone) | [
"def",
"addMilestone",
"(",
"self",
",",
"milestone",
")",
":",
"return",
"_motionplanning",
".",
"PlannerInterface_addMilestone",
"(",
"self",
",",
"milestone",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/python2_version/klampt/src/motionplanning.py#L854-L861 | |
PaddlePaddle/PaddleOCR | b756bf5f8c90142e0d89d3db0163965c686b6ffe | ppocr/utils/e2e_utils/extract_textpoint_slow.py | python | get_keep_pos_idxs | (labels, remove_blank=None) | return keep_char_idx_list, keep_pos_idx_list | Remove duplicate and get pos idxs of keep items.
The value of keep_blank should be [None, 95]. | Remove duplicate and get pos idxs of keep items.
The value of keep_blank should be [None, 95]. | [
"Remove",
"duplicate",
"and",
"get",
"pos",
"idxs",
"of",
"keep",
"items",
".",
"The",
"value",
"of",
"keep_blank",
"should",
"be",
"[",
"None",
"95",
"]",
"."
] | def get_keep_pos_idxs(labels, remove_blank=None):
"""
Remove duplicate and get pos idxs of keep items.
The value of keep_blank should be [None, 95].
"""
duplicate_len_list = []
keep_pos_idx_list = []
keep_char_idx_list = []
for k, v_ in groupby(labels):
current_len = len(list(v_)... | [
"def",
"get_keep_pos_idxs",
"(",
"labels",
",",
"remove_blank",
"=",
"None",
")",
":",
"duplicate_len_list",
"=",
"[",
"]",
"keep_pos_idx_list",
"=",
"[",
"]",
"keep_char_idx_list",
"=",
"[",
"]",
"for",
"k",
",",
"v_",
"in",
"groupby",
"(",
"labels",
")",... | https://github.com/PaddlePaddle/PaddleOCR/blob/b756bf5f8c90142e0d89d3db0163965c686b6ffe/ppocr/utils/e2e_utils/extract_textpoint_slow.py#L107-L122 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | build/android/emma_coverage_stats.py | python | _EmmaCoverageStats._GetSourceFileToEmmaFileDict | (self, files) | return source_to_emma | Gets a dict used to correlate Java source files with EMMA HTML files.
This method gathers the information needed to correlate EMMA HTML
files with Java source files. EMMA XML and plain text reports do not provide
line by line coverage data, so HTML reports must be used instead.
Unfortunately, the HTML ... | Gets a dict used to correlate Java source files with EMMA HTML files. | [
"Gets",
"a",
"dict",
"used",
"to",
"correlate",
"Java",
"source",
"files",
"with",
"EMMA",
"HTML",
"files",
"."
] | def _GetSourceFileToEmmaFileDict(self, files):
"""Gets a dict used to correlate Java source files with EMMA HTML files.
This method gathers the information needed to correlate EMMA HTML
files with Java source files. EMMA XML and plain text reports do not provide
line by line coverage data, so HTML repo... | [
"def",
"_GetSourceFileToEmmaFileDict",
"(",
"self",
",",
"files",
")",
":",
"# Maps Java source file paths to package names.",
"# Example: /usr/code/file.java -> org.chromium.file.java.",
"source_to_package",
"=",
"{",
"}",
"for",
"file_path",
"in",
"files",
":",
"package",
"... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/build/android/emma_coverage_stats.py#L352-L387 | |
snap-stanford/snap-python | d53c51b0a26aa7e3e7400b014cdf728948fde80a | setup/snap.py | python | TSIn.PeekCh | (self) | return _snap.TSIn_PeekCh(self) | PeekCh(TSIn self) -> char
Parameters:
self: TSIn * | PeekCh(TSIn self) -> char | [
"PeekCh",
"(",
"TSIn",
"self",
")",
"-",
">",
"char"
] | def PeekCh(self):
"""
PeekCh(TSIn self) -> char
Parameters:
self: TSIn *
"""
return _snap.TSIn_PeekCh(self) | [
"def",
"PeekCh",
"(",
"self",
")",
":",
"return",
"_snap",
".",
"TSIn_PeekCh",
"(",
"self",
")"
] | https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/setup/snap.py#L1818-L1826 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/ultimatelistctrl.py | python | UltimateListCtrl.HasHeader | (self) | return self._mainWin.HasHeader() | Returns ``True`` if :class:`UltimateListCtrl` has a header window. | Returns ``True`` if :class:`UltimateListCtrl` has a header window. | [
"Returns",
"True",
"if",
":",
"class",
":",
"UltimateListCtrl",
"has",
"a",
"header",
"window",
"."
] | def HasHeader(self):
""" Returns ``True`` if :class:`UltimateListCtrl` has a header window. """
return self._mainWin.HasHeader() | [
"def",
"HasHeader",
"(",
"self",
")",
":",
"return",
"self",
".",
"_mainWin",
".",
"HasHeader",
"(",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/ultimatelistctrl.py#L11028-L11031 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/math_ops.py | python | scalar_mul | (scalar, x, name=None) | Multiplies a scalar times a `Tensor` or `IndexedSlices` object.
Intended for use in gradient code which might deal with `IndexedSlices`
objects, which are easy to multiply by a scalar but more expensive to
multiply with arbitrary tensors.
Args:
scalar: A 0-D scalar `Tensor`. Must have known shape.
x: ... | Multiplies a scalar times a `Tensor` or `IndexedSlices` object. | [
"Multiplies",
"a",
"scalar",
"times",
"a",
"Tensor",
"or",
"IndexedSlices",
"object",
"."
] | def scalar_mul(scalar, x, name=None):
"""Multiplies a scalar times a `Tensor` or `IndexedSlices` object.
Intended for use in gradient code which might deal with `IndexedSlices`
objects, which are easy to multiply by a scalar but more expensive to
multiply with arbitrary tensors.
Args:
scalar: A 0-D scal... | [
"def",
"scalar_mul",
"(",
"scalar",
",",
"x",
",",
"name",
"=",
"None",
")",
":",
"scalar",
"=",
"ops",
".",
"convert_to_tensor",
"(",
"scalar",
",",
"dtype",
"=",
"x",
".",
"dtype",
".",
"base_dtype",
",",
"name",
"=",
"\"scalar\"",
")",
"shape",
"=... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/math_ops.py#L396-L424 | ||
9miao/CrossApp | 1f5375e061bf69841eb19728598f5ae3f508d620 | tools/bindings-generator/backup/clang-llvm-3.3-pybinding/cindex.py | python | Type.get_array_size | (self) | return conf.lib.clang_getArraySize(self) | Retrieve the size of the constant array. | Retrieve the size of the constant array. | [
"Retrieve",
"the",
"size",
"of",
"the",
"constant",
"array",
"."
] | def get_array_size(self):
"""
Retrieve the size of the constant array.
"""
return conf.lib.clang_getArraySize(self) | [
"def",
"get_array_size",
"(",
"self",
")",
":",
"return",
"conf",
".",
"lib",
".",
"clang_getArraySize",
"(",
"self",
")"
] | https://github.com/9miao/CrossApp/blob/1f5375e061bf69841eb19728598f5ae3f508d620/tools/bindings-generator/backup/clang-llvm-3.3-pybinding/cindex.py#L1622-L1626 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/lite/python/convert.py | python | convert_graphdef_with_arrays | (input_data, input_arrays_with_shape,
output_arrays, control_output_arrays,
**kwargs) | return data | Convert a frozen GraphDef that can't be loaded in TF.
Conversion can be customized by providing arguments that are forwarded to
`build_model_flags` and `build_conversion_flags` (see documentation).
Args:
input_data: Input data (i.e. often `sess.graph_def`),
input_arrays_with_shape: Tuple of strings repr... | Convert a frozen GraphDef that can't be loaded in TF. | [
"Convert",
"a",
"frozen",
"GraphDef",
"that",
"can",
"t",
"be",
"loaded",
"in",
"TF",
"."
] | def convert_graphdef_with_arrays(input_data, input_arrays_with_shape,
output_arrays, control_output_arrays,
**kwargs):
""""Convert a frozen GraphDef that can't be loaded in TF.
Conversion can be customized by providing arguments that are forwarded t... | [
"def",
"convert_graphdef_with_arrays",
"(",
"input_data",
",",
"input_arrays_with_shape",
",",
"output_arrays",
",",
"control_output_arrays",
",",
"*",
"*",
"kwargs",
")",
":",
"model_flags",
"=",
"build_model_flags",
"(",
"*",
"*",
"kwargs",
")",
"conversion_flags",
... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/lite/python/convert.py#L635-L697 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/index/package_finder.py | python | CandidateEvaluator.__init__ | (
self,
project_name, # type: str
supported_tags, # type: List[Tag]
specifier, # type: specifiers.BaseSpecifier
prefer_binary=False, # type: bool
allow_all_prereleases=False, # type: bool
hashes=None, # type: Optional[Ha... | :param supported_tags: The PEP 425 tags supported by the target
Python in order of preference (most preferred first). | :param supported_tags: The PEP 425 tags supported by the target
Python in order of preference (most preferred first). | [
":",
"param",
"supported_tags",
":",
"The",
"PEP",
"425",
"tags",
"supported",
"by",
"the",
"target",
"Python",
"in",
"order",
"of",
"preference",
"(",
"most",
"preferred",
"first",
")",
"."
] | def __init__(
self,
project_name, # type: str
supported_tags, # type: List[Tag]
specifier, # type: specifiers.BaseSpecifier
prefer_binary=False, # type: bool
allow_all_prereleases=False, # type: bool
hashes=None, # type:... | [
"def",
"__init__",
"(",
"self",
",",
"project_name",
",",
"# type: str",
"supported_tags",
",",
"# type: List[Tag]",
"specifier",
",",
"# type: specifiers.BaseSpecifier",
"prefer_binary",
"=",
"False",
",",
"# type: bool",
"allow_all_prereleases",
"=",
"False",
",",
"# ... | 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/_internal/index/package_finder.py#L423-L442 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/propgrid.py | python | PropertyGridPage.GetStatePtr | (*args) | return _propgrid.PropertyGridPage_GetStatePtr(*args) | GetStatePtr(self)
GetStatePtr(self) | GetStatePtr(self)
GetStatePtr(self) | [
"GetStatePtr",
"(",
"self",
")",
"GetStatePtr",
"(",
"self",
")"
] | def GetStatePtr(*args):
"""
GetStatePtr(self)
GetStatePtr(self)
"""
return _propgrid.PropertyGridPage_GetStatePtr(*args) | [
"def",
"GetStatePtr",
"(",
"*",
"args",
")",
":",
"return",
"_propgrid",
".",
"PropertyGridPage_GetStatePtr",
"(",
"*",
"args",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/propgrid.py#L3372-L3377 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/telemetry/telemetry/internal/platform/android_device.py | python | FindAllAvailableDevices | (options) | return devices | Returns a list of available devices. | Returns a list of available devices. | [
"Returns",
"a",
"list",
"of",
"available",
"devices",
"."
] | def FindAllAvailableDevices(options):
"""Returns a list of available devices.
"""
# Disable Android device discovery when remote testing a CrOS device
if options.cros_remote:
return []
android_platform_options = options.remote_platform_options
devices = []
try:
if CanDiscoverDevices():
blac... | [
"def",
"FindAllAvailableDevices",
"(",
"options",
")",
":",
"# Disable Android device discovery when remote testing a CrOS device",
"if",
"options",
".",
"cros_remote",
":",
"return",
"[",
"]",
"android_platform_options",
"=",
"options",
".",
"remote_platform_options",
"devic... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/telemetry/internal/platform/android_device.py#L164-L188 | |
baidu/AnyQ | d94d450d2aaa5f7ed73424b10aa4539835b97527 | tools/simnet/train/paddle/layers/paddle_layers.py | python | ReduceMeanLayer.__init__ | (self) | initialize | initialize | [
"initialize"
] | def __init__(self):
"""
initialize
"""
pass | [
"def",
"__init__",
"(",
"self",
")",
":",
"pass"
] | https://github.com/baidu/AnyQ/blob/d94d450d2aaa5f7ed73424b10aa4539835b97527/tools/simnet/train/paddle/layers/paddle_layers.py#L216-L220 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py2/sklearn/decomposition/incremental_pca.py | python | IncrementalPCA.fit | (self, X, y=None) | return self | Fit the model with X, using minibatches of size batch_size.
Parameters
----------
X: array-like, shape (n_samples, n_features)
Training data, where n_samples is the number of samples and
n_features is the number of features.
y: Passthrough for ``Pipeline`` compa... | Fit the model with X, using minibatches of size batch_size. | [
"Fit",
"the",
"model",
"with",
"X",
"using",
"minibatches",
"of",
"size",
"batch_size",
"."
] | def fit(self, X, y=None):
"""Fit the model with X, using minibatches of size batch_size.
Parameters
----------
X: array-like, shape (n_samples, n_features)
Training data, where n_samples is the number of samples and
n_features is the number of features.
... | [
"def",
"fit",
"(",
"self",
",",
"X",
",",
"y",
"=",
"None",
")",
":",
"self",
".",
"components_",
"=",
"None",
"self",
".",
"n_samples_seen_",
"=",
"0",
"self",
".",
"mean_",
"=",
".0",
"self",
".",
"var_",
"=",
".0",
"self",
".",
"singular_values_... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py2/sklearn/decomposition/incremental_pca.py#L146-L182 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/io/matlab/mio.py | python | savemat | (file_name, mdict,
appendmat=True,
format='5',
long_field_names=False,
do_compression=False,
oned_as='row') | Save a dictionary of names and arrays into a MATLAB-style .mat file.
This saves the array objects in the given dictionary to a MATLAB-
style .mat file.
Parameters
----------
file_name : str or file-like object
Name of the .mat file (.mat extension not needed if ``appendmat ==
True`... | Save a dictionary of names and arrays into a MATLAB-style .mat file. | [
"Save",
"a",
"dictionary",
"of",
"names",
"and",
"arrays",
"into",
"a",
"MATLAB",
"-",
"style",
".",
"mat",
"file",
"."
] | def savemat(file_name, mdict,
appendmat=True,
format='5',
long_field_names=False,
do_compression=False,
oned_as='row'):
"""
Save a dictionary of names and arrays into a MATLAB-style .mat file.
This saves the array objects in the given dictionary t... | [
"def",
"savemat",
"(",
"file_name",
",",
"mdict",
",",
"appendmat",
"=",
"True",
",",
"format",
"=",
"'5'",
",",
"long_field_names",
"=",
"False",
",",
"do_compression",
"=",
"False",
",",
"oned_as",
"=",
"'row'",
")",
":",
"file_opened",
"=",
"False",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/io/matlab/mio.py#L219-L287 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/idlelib/configdialog.py | python | ConfigDialog.create_action_buttons | (self) | return outer | Return frame of action buttons for dialog.
Methods:
ok
apply
cancel
help
Widget Structure:
outer: Frame
buttons: Frame
(no assignment): Button (ok)
(no assignment): Button (apply)
... | Return frame of action buttons for dialog. | [
"Return",
"frame",
"of",
"action",
"buttons",
"for",
"dialog",
"."
] | def create_action_buttons(self):
"""Return frame of action buttons for dialog.
Methods:
ok
apply
cancel
help
Widget Structure:
outer: Frame
buttons: Frame
(no assignment): Button (ok)
... | [
"def",
"create_action_buttons",
"(",
"self",
")",
":",
"if",
"macosx",
".",
"isAquaTk",
"(",
")",
":",
"# Changing the default padding on OSX results in unreadable",
"# text in the buttons.",
"padding_args",
"=",
"{",
"}",
"else",
":",
"padding_args",
"=",
"{",
"'padd... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/idlelib/configdialog.py#L127-L165 | |
google/earthenterprise | 0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9 | earth_enterprise/src/fusion/portableglobe/servers/search_services/ge_base_search.py | python | GEBaseSearch.JsonStart | (self, handler, cb, datastoreName, search_term) | Writes initial header for json results. | Writes initial header for json results. | [
"Writes",
"initial",
"header",
"for",
"json",
"results",
"."
] | def JsonStart(self, handler, cb, datastoreName, search_term):
"""Writes initial header for json results."""
handler.write(self.json_start_template_ % (cb, datastoreName, search_term)) | [
"def",
"JsonStart",
"(",
"self",
",",
"handler",
",",
"cb",
",",
"datastoreName",
",",
"search_term",
")",
":",
"handler",
".",
"write",
"(",
"self",
".",
"json_start_template_",
"%",
"(",
"cb",
",",
"datastoreName",
",",
"search_term",
")",
")"
] | https://github.com/google/earthenterprise/blob/0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9/earth_enterprise/src/fusion/portableglobe/servers/search_services/ge_base_search.py#L131-L133 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/turtle.py | python | RawTurtle._undo | (self, action, data) | Does the main part of the work for undo() | Does the main part of the work for undo() | [
"Does",
"the",
"main",
"part",
"of",
"the",
"work",
"for",
"undo",
"()"
] | def _undo(self, action, data):
"""Does the main part of the work for undo()
"""
if self.undobuffer is None:
return
if action == "rot":
angle, degPAU = data
self._rotate(-angle*degPAU/self._degreesPerAU)
dummy = self.undobuffer.pop()
... | [
"def",
"_undo",
"(",
"self",
",",
"action",
",",
"data",
")",
":",
"if",
"self",
".",
"undobuffer",
"is",
"None",
":",
"return",
"if",
"action",
"==",
"\"rot\"",
":",
"angle",
",",
"degPAU",
"=",
"data",
"self",
".",
"_rotate",
"(",
"-",
"angle",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/turtle.py#L3592-L3622 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/fitting_widgets/general_fitting/general_fitting_view.py | python | GeneralFittingView.switch_to_simultaneous | (self) | Switches the view to simultaneous fit mode. | Switches the view to simultaneous fit mode. | [
"Switches",
"the",
"view",
"to",
"simultaneous",
"fit",
"mode",
"."
] | def switch_to_simultaneous(self) -> None:
"""Switches the view to simultaneous fit mode."""
super().switch_to_simultaneous()
self.set_workspace_combo_box_label(SIMULTANEOUS_FIT_LABEL)
self.general_fitting_options.enable_simultaneous_fit_options() | [
"def",
"switch_to_simultaneous",
"(",
"self",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"switch_to_simultaneous",
"(",
")",
"self",
".",
"set_workspace_combo_box_label",
"(",
"SIMULTANEOUS_FIT_LABEL",
")",
"self",
".",
"general_fitting_options",
".",
"enable_s... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/fitting_widgets/general_fitting/general_fitting_view.py#L70-L74 | ||
openvinotoolkit/openvino | dedcbeafa8b84cccdc55ca64b8da516682b381c7 | tools/mo/openvino/tools/mo/ops/loop.py | python | Loop.updated_loop_output_ports_shape_and_value | (loop_node: Node) | Update shape and values for Loop output ports. If the number of iterations is dynamic then the corresponding
dimension for the scan outputs (having "axis" attribute) are set to 1 because MO cannot generate IR with
undefined dimensions.
:param loop_node: The Loop node
:return: None | Update shape and values for Loop output ports. If the number of iterations is dynamic then the corresponding
dimension for the scan outputs (having "axis" attribute) are set to 1 because MO cannot generate IR with
undefined dimensions. | [
"Update",
"shape",
"and",
"values",
"for",
"Loop",
"output",
"ports",
".",
"If",
"the",
"number",
"of",
"iterations",
"is",
"dynamic",
"then",
"the",
"corresponding",
"dimension",
"for",
"the",
"scan",
"outputs",
"(",
"having",
"axis",
"attribute",
")",
"are... | def updated_loop_output_ports_shape_and_value(loop_node: Node):
"""
Update shape and values for Loop output ports. If the number of iterations is dynamic then the corresponding
dimension for the scan outputs (having "axis" attribute) are set to 1 because MO cannot generate IR with
undefi... | [
"def",
"updated_loop_output_ports_shape_and_value",
"(",
"loop_node",
":",
"Node",
")",
":",
"loop_name",
"=",
"loop_node",
".",
"soft_get",
"(",
"'name'",
",",
"loop_node",
".",
"id",
")",
"for",
"record",
"in",
"loop_node",
".",
"output_port_map",
":",
"body_n... | https://github.com/openvinotoolkit/openvino/blob/dedcbeafa8b84cccdc55ca64b8da516682b381c7/tools/mo/openvino/tools/mo/ops/loop.py#L114-L143 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | Framework/PythonInterface/plugins/algorithms/LRPeakSelection.py | python | PeakFinderDerivation.initArrays | (self) | Initialize internal data members | Initialize internal data members | [
"Initialize",
"internal",
"data",
"members"
] | def initArrays(self):
"""
Initialize internal data members
"""
self.xdata_firstderi = []
self.ydata_firstderi = []
self.peak = [-1, -1]
self.low_res = [-1, -1]
self.five_highest_ydata = []
self.five_highest_xdata = []
self.sum_five_high... | [
"def",
"initArrays",
"(",
"self",
")",
":",
"self",
".",
"xdata_firstderi",
"=",
"[",
"]",
"self",
".",
"ydata_firstderi",
"=",
"[",
"]",
"self",
".",
"peak",
"=",
"[",
"-",
"1",
",",
"-",
"1",
"]",
"self",
".",
"low_res",
"=",
"[",
"-",
"1",
"... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/Framework/PythonInterface/plugins/algorithms/LRPeakSelection.py#L57-L76 | ||
forkineye/ESPixelStick | 22926f1c0d1131f1369fc7cad405689a095ae3cb | dist/bin/pyserial/serial/serialutil.py | python | SerialBase.write_timeout | (self, timeout) | Change timeout setting. | Change timeout setting. | [
"Change",
"timeout",
"setting",
"."
] | def write_timeout(self, timeout):
"""Change timeout setting."""
if timeout is not None:
if timeout < 0:
raise ValueError("Not a valid timeout: {!r}".format(timeout))
try:
timeout + 1 # test if it's a number, will throw a TypeError if not...
... | [
"def",
"write_timeout",
"(",
"self",
",",
"timeout",
")",
":",
"if",
"timeout",
"is",
"not",
"None",
":",
"if",
"timeout",
"<",
"0",
":",
"raise",
"ValueError",
"(",
"\"Not a valid timeout: {!r}\"",
".",
"format",
"(",
"timeout",
")",
")",
"try",
":",
"t... | https://github.com/forkineye/ESPixelStick/blob/22926f1c0d1131f1369fc7cad405689a095ae3cb/dist/bin/pyserial/serial/serialutil.py#L376-L388 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/special/basic.py | python | yvp | (v, z, n=1) | Compute nth derivative of Bessel function Yv(z) with respect to `z`.
Parameters
----------
v : float
Order of Bessel function
z : complex
Argument at which to evaluate the derivative
n : int, default 1
Order of derivative
Notes
-----
The derivative is computed u... | Compute nth derivative of Bessel function Yv(z) with respect to `z`. | [
"Compute",
"nth",
"derivative",
"of",
"Bessel",
"function",
"Yv",
"(",
"z",
")",
"with",
"respect",
"to",
"z",
"."
] | def yvp(v, z, n=1):
"""Compute nth derivative of Bessel function Yv(z) with respect to `z`.
Parameters
----------
v : float
Order of Bessel function
z : complex
Argument at which to evaluate the derivative
n : int, default 1
Order of derivative
Notes
-----
T... | [
"def",
"yvp",
"(",
"v",
",",
"z",
",",
"n",
"=",
"1",
")",
":",
"n",
"=",
"_nonneg_int_or_fail",
"(",
"n",
",",
"'n'",
")",
"if",
"n",
"==",
"0",
":",
"return",
"yv",
"(",
"v",
",",
"z",
")",
"else",
":",
"return",
"_bessel_diff_formula",
"(",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/special/basic.py#L468-L497 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py3/scipy/stats/stats.py | python | _square_of_sums | (a, axis=0) | Sum elements of the input array, and return the square(s) of that sum.
Parameters
----------
a : array_like
Input array.
axis : int or None, optional
Axis along which to calculate. Default is 0. If None, compute over
the whole array `a`.
Returns
-------
square_of_su... | Sum elements of the input array, and return the square(s) of that sum. | [
"Sum",
"elements",
"of",
"the",
"input",
"array",
"and",
"return",
"the",
"square",
"(",
"s",
")",
"of",
"that",
"sum",
"."
] | def _square_of_sums(a, axis=0):
"""
Sum elements of the input array, and return the square(s) of that sum.
Parameters
----------
a : array_like
Input array.
axis : int or None, optional
Axis along which to calculate. Default is 0. If None, compute over
the whole array `a... | [
"def",
"_square_of_sums",
"(",
"a",
",",
"axis",
"=",
"0",
")",
":",
"a",
",",
"axis",
"=",
"_chk_asarray",
"(",
"a",
",",
"axis",
")",
"s",
"=",
"np",
".",
"sum",
"(",
"a",
",",
"axis",
")",
"if",
"not",
"np",
".",
"isscalar",
"(",
"s",
")",... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py3/scipy/stats/stats.py#L5873-L5899 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/pkg_resources/_vendor/pyparsing.py | python | ParserElement.__mul__ | (self,other) | return ret | Implementation of * operator, allows use of C{expr * 3} in place of
C{expr + expr + expr}. Expressions may also me multiplied by a 2-integer
tuple, similar to C{{min,max}} multipliers in regular expressions. Tuples
may also include C{None} as in:
- C{expr*(n,None)} or C{expr*(n,)} is ... | Implementation of * operator, allows use of C{expr * 3} in place of
C{expr + expr + expr}. Expressions may also me multiplied by a 2-integer
tuple, similar to C{{min,max}} multipliers in regular expressions. Tuples
may also include C{None} as in:
- C{expr*(n,None)} or C{expr*(n,)} is ... | [
"Implementation",
"of",
"*",
"operator",
"allows",
"use",
"of",
"C",
"{",
"expr",
"*",
"3",
"}",
"in",
"place",
"of",
"C",
"{",
"expr",
"+",
"expr",
"+",
"expr",
"}",
".",
"Expressions",
"may",
"also",
"me",
"multiplied",
"by",
"a",
"2",
"-",
"inte... | def __mul__(self,other):
"""
Implementation of * operator, allows use of C{expr * 3} in place of
C{expr + expr + expr}. Expressions may also me multiplied by a 2-integer
tuple, similar to C{{min,max}} multipliers in regular expressions. Tuples
may also include C{None} as in:
... | [
"def",
"__mul__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"int",
")",
":",
"minElements",
",",
"optElements",
"=",
"other",
",",
"0",
"elif",
"isinstance",
"(",
"other",
",",
"tuple",
")",
":",
"other",
"=",
"(",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/pkg_resources/_vendor/pyparsing.py#L1836-L1902 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/indexes/range.py | python | RangeIndex._extended_gcd | (self, a, b) | return old_r, old_s, old_t | Extended Euclidean algorithms to solve Bezout's identity:
a*x + b*y = gcd(x, y)
Finds one particular solution for x, y: s, t
Returns: gcd, s, t | Extended Euclidean algorithms to solve Bezout's identity:
a*x + b*y = gcd(x, y)
Finds one particular solution for x, y: s, t
Returns: gcd, s, t | [
"Extended",
"Euclidean",
"algorithms",
"to",
"solve",
"Bezout",
"s",
"identity",
":",
"a",
"*",
"x",
"+",
"b",
"*",
"y",
"=",
"gcd",
"(",
"x",
"y",
")",
"Finds",
"one",
"particular",
"solution",
"for",
"x",
"y",
":",
"s",
"t",
"Returns",
":",
"gcd"... | def _extended_gcd(self, a, b):
"""
Extended Euclidean algorithms to solve Bezout's identity:
a*x + b*y = gcd(x, y)
Finds one particular solution for x, y: s, t
Returns: gcd, s, t
"""
s, old_s = 0, 1
t, old_t = 1, 0
r, old_r = b, a
while ... | [
"def",
"_extended_gcd",
"(",
"self",
",",
"a",
",",
"b",
")",
":",
"s",
",",
"old_s",
"=",
"0",
",",
"1",
"t",
",",
"old_t",
"=",
"1",
",",
"0",
"r",
",",
"old_r",
"=",
"b",
",",
"a",
"while",
"r",
":",
"quotient",
"=",
"old_r",
"//",
"r",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/indexes/range.py#L532-L547 | |
klzgrad/naiveproxy | ed2c513637c77b18721fe428d7ed395b4d284c83 | src/tools/grit/grit/util.py | python | EncodeCdata | (cdata) | Returns the provided cdata in either escaped format or <![CDATA[xxx]]>
format, depending on which is more appropriate for easy editing. The data
is escaped for inclusion in an XML element's body.
Args:
cdata: 'If x < y and y < z then x < z'
Return:
'<![CDATA[If x < y and y < z then x < z]]>' | Returns the provided cdata in either escaped format or <![CDATA[xxx]]>
format, depending on which is more appropriate for easy editing. The data
is escaped for inclusion in an XML element's body. | [
"Returns",
"the",
"provided",
"cdata",
"in",
"either",
"escaped",
"format",
"or",
"<!",
"[",
"CDATA",
"[",
"xxx",
"]]",
">",
"format",
"depending",
"on",
"which",
"is",
"more",
"appropriate",
"for",
"easy",
"editing",
".",
"The",
"data",
"is",
"escaped",
... | def EncodeCdata(cdata):
'''Returns the provided cdata in either escaped format or <![CDATA[xxx]]>
format, depending on which is more appropriate for easy editing. The data
is escaped for inclusion in an XML element's body.
Args:
cdata: 'If x < y and y < z then x < z'
Return:
'<![CDATA[If x < y and ... | [
"def",
"EncodeCdata",
"(",
"cdata",
")",
":",
"if",
"cdata",
".",
"count",
"(",
"'<'",
")",
">",
"1",
"or",
"cdata",
".",
"count",
"(",
"'>'",
")",
">",
"1",
"and",
"cdata",
".",
"count",
"(",
"']]>'",
")",
"==",
"0",
":",
"return",
"'<![CDATA[%s... | https://github.com/klzgrad/naiveproxy/blob/ed2c513637c77b18721fe428d7ed395b4d284c83/src/tools/grit/grit/util.py#L290-L304 | ||
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/maximum-product-of-the-length-of-two-palindromic-subsequences.py | python | Solution.maxProduct | (self, s) | return result | :type s: str
:rtype: int | :type s: str
:rtype: int | [
":",
"type",
"s",
":",
"str",
":",
"rtype",
":",
"int"
] | def maxProduct(self, s):
"""
:type s: str
:rtype: int
"""
def palindromic_subsequence_length(s, mask):
result = 0
left, right = 0, len(s)-1
left_bit, right_bit = 1<<left, 1<<right
while left <= right:
if mask&left_bi... | [
"def",
"maxProduct",
"(",
"self",
",",
"s",
")",
":",
"def",
"palindromic_subsequence_length",
"(",
"s",
",",
"mask",
")",
":",
"result",
"=",
"0",
"left",
",",
"right",
"=",
"0",
",",
"len",
"(",
"s",
")",
"-",
"1",
"left_bit",
",",
"right_bit",
"... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/maximum-product-of-the-length-of-two-palindromic-subsequences.py#L5-L39 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/unused-symbols-report.py | python | Parse | (input, skip_paths=None, only_paths=None) | Parse the --print-gc-sections build output.
Args:
input: iterable over the lines of the build output
Yields:
(target name, path to .o file, demangled symbol) | Parse the --print-gc-sections build output. | [
"Parse",
"the",
"--",
"print",
"-",
"gc",
"-",
"sections",
"build",
"output",
"."
] | def Parse(input, skip_paths=None, only_paths=None):
"""Parse the --print-gc-sections build output.
Args:
input: iterable over the lines of the build output
Yields:
(target name, path to .o file, demangled symbol)
"""
symbol_re = re.compile(r"'\.text\.(\S+)' in file '(\S+)'$")
path_re = re.compile(... | [
"def",
"Parse",
"(",
"input",
",",
"skip_paths",
"=",
"None",
",",
"only_paths",
"=",
"None",
")",
":",
"symbol_re",
"=",
"re",
".",
"compile",
"(",
"r\"'\\.text\\.(\\S+)' in file '(\\S+)'$\"",
")",
"path_re",
"=",
"re",
".",
"compile",
"(",
"r\"^out/[^/]+/[^/... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/unused-symbols-report.py#L51-L78 | ||
alibaba/weex_js_engine | 2bdf4b6f020c1fc99c63f649718f6faf7e27fdde | jni/v8core/v8/build/gyp/pylib/gyp/input.py | python | ValidateTargetType | (target, target_dict) | Ensures the 'type' field on the target is one of the known types.
Arguments:
target: string, name of target.
target_dict: dict, target spec.
Raises an exception on error. | Ensures the 'type' field on the target is one of the known types. | [
"Ensures",
"the",
"type",
"field",
"on",
"the",
"target",
"is",
"one",
"of",
"the",
"known",
"types",
"."
] | def ValidateTargetType(target, target_dict):
"""Ensures the 'type' field on the target is one of the known types.
Arguments:
target: string, name of target.
target_dict: dict, target spec.
Raises an exception on error.
"""
VALID_TARGET_TYPES = ('executable', 'loadable_module',
... | [
"def",
"ValidateTargetType",
"(",
"target",
",",
"target_dict",
")",
":",
"VALID_TARGET_TYPES",
"=",
"(",
"'executable'",
",",
"'loadable_module'",
",",
"'static_library'",
",",
"'shared_library'",
",",
"'none'",
")",
"target_type",
"=",
"target_dict",
".",
"get",
... | https://github.com/alibaba/weex_js_engine/blob/2bdf4b6f020c1fc99c63f649718f6faf7e27fdde/jni/v8core/v8/build/gyp/pylib/gyp/input.py#L2127-L2143 | ||
arx/ArxLibertatis | 0313c51625f3f55016cdad43d2c7f7296d27949c | scripts/cpplint.py | python | RemoveMultiLineCommentsFromRange | (lines, begin, end) | Clears a range of lines for multi-line comments. | Clears a range of lines for multi-line comments. | [
"Clears",
"a",
"range",
"of",
"lines",
"for",
"multi",
"-",
"line",
"comments",
"."
] | def RemoveMultiLineCommentsFromRange(lines, begin, end):
"""Clears a range of lines for multi-line comments."""
# Having // dummy comments makes the lines non-empty, so we will not get
# unnecessary blank line warnings later in the code.
for i in range(begin, end):
lines[i] = re.search('^\t*', lines[i]).gro... | [
"def",
"RemoveMultiLineCommentsFromRange",
"(",
"lines",
",",
"begin",
",",
"end",
")",
":",
"# Having // dummy comments makes the lines non-empty, so we will not get",
"# unnecessary blank line warnings later in the code.",
"for",
"i",
"in",
"range",
"(",
"begin",
",",
"end",
... | https://github.com/arx/ArxLibertatis/blob/0313c51625f3f55016cdad43d2c7f7296d27949c/scripts/cpplint.py#L925-L930 | ||
nileshkulkarni/csm | 0e6e0e7d4f725fd36f2414c0be4b9d83197aa1fc | csm/utils/transformations.py | python | angle_between_vectors | (v0, v1, directed=True, axis=0) | return numpy.arccos(dot if directed else numpy.fabs(dot)) | Return angle between vectors.
If directed is False, the input vectors are interpreted as undirected axes,
i.e. the maximum angle is pi/2.
>>> a = angle_between_vectors([1, -2, 3], [-1, 2, -3])
>>> numpy.allclose(a, math.pi)
True
>>> a = angle_between_vectors([1, -2, 3], [-1, 2, -3], directed=F... | Return angle between vectors. | [
"Return",
"angle",
"between",
"vectors",
"."
] | def angle_between_vectors(v0, v1, directed=True, axis=0):
"""Return angle between vectors.
If directed is False, the input vectors are interpreted as undirected axes,
i.e. the maximum angle is pi/2.
>>> a = angle_between_vectors([1, -2, 3], [-1, 2, -3])
>>> numpy.allclose(a, math.pi)
True
... | [
"def",
"angle_between_vectors",
"(",
"v0",
",",
"v1",
",",
"directed",
"=",
"True",
",",
"axis",
"=",
"0",
")",
":",
"v0",
"=",
"numpy",
".",
"array",
"(",
"v0",
",",
"dtype",
"=",
"numpy",
".",
"float64",
",",
"copy",
"=",
"False",
")",
"v1",
"=... | https://github.com/nileshkulkarni/csm/blob/0e6e0e7d4f725fd36f2414c0be4b9d83197aa1fc/csm/utils/transformations.py#L1807-L1835 | |
weolar/miniblink49 | 1c4678db0594a4abde23d3ebbcc7cd13c3170777 | third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/mod_pywebsocket/_stream_hixie75.py | python | StreamHixie75.send_message | (self, message, end=True, binary=False) | Send message.
Args:
message: unicode string to send.
binary: not used in hixie75.
Raises:
BadOperationException: when called on a server-terminated
connection. | Send message. | [
"Send",
"message",
"."
] | def send_message(self, message, end=True, binary=False):
"""Send message.
Args:
message: unicode string to send.
binary: not used in hixie75.
Raises:
BadOperationException: when called on a server-terminated
connection.
"""
i... | [
"def",
"send_message",
"(",
"self",
",",
"message",
",",
"end",
"=",
"True",
",",
"binary",
"=",
"False",
")",
":",
"if",
"not",
"end",
":",
"raise",
"BadOperationException",
"(",
"'StreamHixie75 doesn\\'t support send_message with end=False'",
")",
"if",
"binary"... | https://github.com/weolar/miniblink49/blob/1c4678db0594a4abde23d3ebbcc7cd13c3170777/third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/mod_pywebsocket/_stream_hixie75.py#L73-L97 | ||
google/shaka-packager | e1b0c7c45431327fd3ce193514a5407d07b39b22 | packager/third_party/protobuf/python/google/protobuf/internal/python_message.py | python | _VerifyExtensionHandle | (message, extension_handle) | Verify that the given extension handle is valid. | Verify that the given extension handle is valid. | [
"Verify",
"that",
"the",
"given",
"extension",
"handle",
"is",
"valid",
"."
] | def _VerifyExtensionHandle(message, extension_handle):
"""Verify that the given extension handle is valid."""
if not isinstance(extension_handle, _FieldDescriptor):
raise KeyError('HasExtension() expects an extension handle, got: %s' %
extension_handle)
if not extension_handle.is_extensio... | [
"def",
"_VerifyExtensionHandle",
"(",
"message",
",",
"extension_handle",
")",
":",
"if",
"not",
"isinstance",
"(",
"extension_handle",
",",
"_FieldDescriptor",
")",
":",
"raise",
"KeyError",
"(",
"'HasExtension() expects an extension handle, got: %s'",
"%",
"extension_ha... | https://github.com/google/shaka-packager/blob/e1b0c7c45431327fd3ce193514a5407d07b39b22/packager/third_party/protobuf/python/google/protobuf/internal/python_message.py#L213-L232 | ||
cms-sw/cmssw | fd9de012d503d3405420bcbeec0ec879baa57cf2 | Configuration/DataProcessing/python/Utils.py | python | addMonitoring | (process) | return process | _addMonitoring_
Add the monitoring services to the process provided
in order to write out performance summaries to the framework job report | _addMonitoring_
Add the monitoring services to the process provided
in order to write out performance summaries to the framework job report | [
"_addMonitoring_",
"Add",
"the",
"monitoring",
"services",
"to",
"the",
"process",
"provided",
"in",
"order",
"to",
"write",
"out",
"performance",
"summaries",
"to",
"the",
"framework",
"job",
"report"
] | def addMonitoring(process):
"""
_addMonitoring_
Add the monitoring services to the process provided
in order to write out performance summaries to the framework job report
"""
import FWCore.ParameterSet.Config as cms
process.SimpleMemoryCheck = cms.Service("SimpleMemoryCheck",
... | [
"def",
"addMonitoring",
"(",
"process",
")",
":",
"import",
"FWCore",
".",
"ParameterSet",
".",
"Config",
"as",
"cms",
"process",
".",
"SimpleMemoryCheck",
"=",
"cms",
".",
"Service",
"(",
"\"SimpleMemoryCheck\"",
",",
"jobReportOutputOnly",
"=",
"cms",
".",
"... | https://github.com/cms-sw/cmssw/blob/fd9de012d503d3405420bcbeec0ec879baa57cf2/Configuration/DataProcessing/python/Utils.py#L38-L54 | |
InsightSoftwareConsortium/ITK | 87acfce9a93d928311c38bc371b666b515b9f19d | Modules/ThirdParty/pygccxml/src/pygccxml/declarations/type_traits.py | python | is_void_pointer | (type_) | return is_same(type_, cpptypes.pointer_t(cpptypes.void_t())) | returns True, if type represents `void*`, False otherwise | returns True, if type represents `void*`, False otherwise | [
"returns",
"True",
"if",
"type",
"represents",
"void",
"*",
"False",
"otherwise"
] | def is_void_pointer(type_):
"""returns True, if type represents `void*`, False otherwise"""
return is_same(type_, cpptypes.pointer_t(cpptypes.void_t())) | [
"def",
"is_void_pointer",
"(",
"type_",
")",
":",
"return",
"is_same",
"(",
"type_",
",",
"cpptypes",
".",
"pointer_t",
"(",
"cpptypes",
".",
"void_t",
"(",
")",
")",
")"
] | https://github.com/InsightSoftwareConsortium/ITK/blob/87acfce9a93d928311c38bc371b666b515b9f19d/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/type_traits.py#L198-L200 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/linalg/linear_operator_circulant.py | python | _BaseLinearOperatorCirculant.block_shape_tensor | (self) | return self._block_shape_tensor() | Shape of the block dimensions of `self.spectrum`. | Shape of the block dimensions of `self.spectrum`. | [
"Shape",
"of",
"the",
"block",
"dimensions",
"of",
"self",
".",
"spectrum",
"."
] | def block_shape_tensor(self):
"""Shape of the block dimensions of `self.spectrum`."""
# If spectrum.shape = [s0, s1, s2], and block_depth = 2,
# block_shape = [s1, s2]
return self._block_shape_tensor() | [
"def",
"block_shape_tensor",
"(",
"self",
")",
":",
"# If spectrum.shape = [s0, s1, s2], and block_depth = 2,",
"# block_shape = [s1, s2]",
"return",
"self",
".",
"_block_shape_tensor",
"(",
")"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/linalg/linear_operator_circulant.py#L177-L181 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/distribute/one_device_strategy.py | python | OneDeviceExtended._in_multi_worker_mode | (self) | return False | Whether this strategy indicates working in multi-worker settings. | Whether this strategy indicates working in multi-worker settings. | [
"Whether",
"this",
"strategy",
"indicates",
"working",
"in",
"multi",
"-",
"worker",
"settings",
"."
] | def _in_multi_worker_mode(self):
"""Whether this strategy indicates working in multi-worker settings."""
return False | [
"def",
"_in_multi_worker_mode",
"(",
"self",
")",
":",
"return",
"False"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/distribute/one_device_strategy.py#L428-L430 | |
thalium/icebox | 99d147d5b9269222225443ce171b4fd46d8985d4 | third_party/virtualbox/src/VBox/GuestHost/OpenGL/glapi_parser/apiutil.py | python | CanCompile | (funcName) | Return 1 if the function can be compiled into display lists, else 0. | Return 1 if the function can be compiled into display lists, else 0. | [
"Return",
"1",
"if",
"the",
"function",
"can",
"be",
"compiled",
"into",
"display",
"lists",
"else",
"0",
"."
] | def CanCompile(funcName):
"""Return 1 if the function can be compiled into display lists, else 0."""
props = Properties(funcName)
if ("nolist" in props or
"get" in props or
"setclient" in props):
return 0
else:
return 1 | [
"def",
"CanCompile",
"(",
"funcName",
")",
":",
"props",
"=",
"Properties",
"(",
"funcName",
")",
"if",
"(",
"\"nolist\"",
"in",
"props",
"or",
"\"get\"",
"in",
"props",
"or",
"\"setclient\"",
"in",
"props",
")",
":",
"return",
"0",
"else",
":",
"return"... | https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/VBox/GuestHost/OpenGL/glapi_parser/apiutil.py#L399-L407 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/tracing/tracing/metrics/discover.py | python | DiscoverMetrics | (modules_to_load) | Returns a list of registered metrics.
Args:
modules_to_load: a list of modules (string) to be loaded before discovering
the registered metrics. | Returns a list of registered metrics. | [
"Returns",
"a",
"list",
"of",
"registered",
"metrics",
"."
] | def DiscoverMetrics(modules_to_load):
""" Returns a list of registered metrics.
Args:
modules_to_load: a list of modules (string) to be loaded before discovering
the registered metrics.
"""
assert isinstance(modules_to_load, list)
project = tracing_project.TracingProject()
all_source_paths = list... | [
"def",
"DiscoverMetrics",
"(",
"modules_to_load",
")",
":",
"assert",
"isinstance",
"(",
"modules_to_load",
",",
"list",
")",
"project",
"=",
"tracing_project",
".",
"TracingProject",
"(",
")",
"all_source_paths",
"=",
"list",
"(",
"project",
".",
"source_paths",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/tracing/tracing/metrics/discover.py#L16-L34 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/urllib3/contrib/_securetransport/low_level.py | python | _cert_array_from_pem | (pem_bundle) | return cert_array | Given a bundle of certs in PEM format, turns them into a CFArray of certs
that can be used to validate a cert chain. | Given a bundle of certs in PEM format, turns them into a CFArray of certs
that can be used to validate a cert chain. | [
"Given",
"a",
"bundle",
"of",
"certs",
"in",
"PEM",
"format",
"turns",
"them",
"into",
"a",
"CFArray",
"of",
"certs",
"that",
"can",
"be",
"used",
"to",
"validate",
"a",
"cert",
"chain",
"."
] | def _cert_array_from_pem(pem_bundle):
"""
Given a bundle of certs in PEM format, turns them into a CFArray of certs
that can be used to validate a cert chain.
"""
der_certs = [
base64.b64decode(match.group(1))
for match in _PEM_CERTS_RE.finditer(pem_bundle)
]
if not der_certs... | [
"def",
"_cert_array_from_pem",
"(",
"pem_bundle",
")",
":",
"der_certs",
"=",
"[",
"base64",
".",
"b64decode",
"(",
"match",
".",
"group",
"(",
"1",
")",
")",
"for",
"match",
"in",
"_PEM_CERTS_RE",
".",
"finditer",
"(",
"pem_bundle",
")",
"]",
"if",
"not... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/urllib3/contrib/_securetransport/low_level.py#L109-L149 | |
glinscott/leela-chess | 481f1de6c0d2ad7f4e27df551ac5fc754e684f69 | training/tf/chunkparser.py | python | ChunkParser.batch_gen | (self, gen) | Pack multiple records into a single batch | Pack multiple records into a single batch | [
"Pack",
"multiple",
"records",
"into",
"a",
"single",
"batch"
] | def batch_gen(self, gen):
"""
Pack multiple records into a single batch
"""
# Get N records. We flatten the returned generator to
# a list because we need to reuse it.
while True:
s = list(itertools.islice(gen, self.batch_size))
if not len(s):
... | [
"def",
"batch_gen",
"(",
"self",
",",
"gen",
")",
":",
"# Get N records. We flatten the returned generator to",
"# a list because we need to reuse it.",
"while",
"True",
":",
"s",
"=",
"list",
"(",
"itertools",
".",
"islice",
"(",
"gen",
",",
"self",
".",
"batch_siz... | https://github.com/glinscott/leela-chess/blob/481f1de6c0d2ad7f4e27df551ac5fc754e684f69/training/tf/chunkparser.py#L251-L263 | ||
qgis/QGIS | 15a77662d4bb712184f6aa60d0bd663010a76a75 | python/plugins/db_manager/db_plugins/postgis/connector.py | python | PostGisDBConnector.setTableColumnType | (self, table, column, data_type) | return self.updateTableColumn(table, column, None, data_type) | Changes column type | Changes column type | [
"Changes",
"column",
"type"
] | def setTableColumnType(self, table, column, data_type):
"""Changes column type """
return self.updateTableColumn(table, column, None, data_type) | [
"def",
"setTableColumnType",
"(",
"self",
",",
"table",
",",
"column",
",",
"data_type",
")",
":",
"return",
"self",
".",
"updateTableColumn",
"(",
"table",
",",
"column",
",",
"None",
",",
"data_type",
")"
] | https://github.com/qgis/QGIS/blob/15a77662d4bb712184f6aa60d0bd663010a76a75/python/plugins/db_manager/db_plugins/postgis/connector.py#L1132-L1134 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/wsgiref/handlers.py | python | BaseHandler.run | (self, application) | Invoke the application | Invoke the application | [
"Invoke",
"the",
"application"
] | def run(self, application):
"""Invoke the application"""
# Note to self: don't move the close()! Asynchronous servers shouldn't
# call close() from finish_response(), so if you close() anywhere but
# the double-error branch here, you'll break asynchronous servers by
# prematurel... | [
"def",
"run",
"(",
"self",
",",
"application",
")",
":",
"# Note to self: don't move the close()! Asynchronous servers shouldn't",
"# call close() from finish_response(), so if you close() anywhere but",
"# the double-error branch here, you'll break asynchronous servers by",
"# prematurely cl... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/wsgiref/handlers.py#L76-L93 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/valgrind/gdb_helper.py | python | AddressTable.Add | (self, binary, address) | Register a lookup request. | Register a lookup request. | [
"Register",
"a",
"lookup",
"request",
"."
] | def Add(self, binary, address):
''' Register a lookup request. '''
if binary == '':
logging.warn('adding address %s in empty binary?' % address)
if binary in self._binaries:
self._binaries[binary].append(address)
else:
self._binaries[binary] = [address]
self._all_resolved = False | [
"def",
"Add",
"(",
"self",
",",
"binary",
",",
"address",
")",
":",
"if",
"binary",
"==",
"''",
":",
"logging",
".",
"warn",
"(",
"'adding address %s in empty binary?'",
"%",
"address",
")",
"if",
"binary",
"in",
"self",
".",
"_binaries",
":",
"self",
".... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/valgrind/gdb_helper.py#L58-L66 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/frame.py | python | DataFrame._get_agg_axis | (self, axis_num) | Let's be explicit about this. | Let's be explicit about this. | [
"Let",
"s",
"be",
"explicit",
"about",
"this",
"."
] | def _get_agg_axis(self, axis_num):
"""
Let's be explicit about this.
"""
if axis_num == 0:
return self.columns
elif axis_num == 1:
return self.index
else:
raise ValueError(f"Axis must be 0 or 1 (got {repr(axis_num)})") | [
"def",
"_get_agg_axis",
"(",
"self",
",",
"axis_num",
")",
":",
"if",
"axis_num",
"==",
"0",
":",
"return",
"self",
".",
"columns",
"elif",
"axis_num",
"==",
"1",
":",
"return",
"self",
".",
"index",
"else",
":",
"raise",
"ValueError",
"(",
"f\"Axis must... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/frame.py#L8084-L8093 | ||
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/urllib.py | python | localhost | () | return _localhost | Return the IP address of the magic hostname 'localhost'. | Return the IP address of the magic hostname 'localhost'. | [
"Return",
"the",
"IP",
"address",
"of",
"the",
"magic",
"hostname",
"localhost",
"."
] | def localhost():
"""Return the IP address of the magic hostname 'localhost'."""
global _localhost
if _localhost is None:
_localhost = socket.gethostbyname('localhost')
return _localhost | [
"def",
"localhost",
"(",
")",
":",
"global",
"_localhost",
"if",
"_localhost",
"is",
"None",
":",
"_localhost",
"=",
"socket",
".",
"gethostbyname",
"(",
"'localhost'",
")",
"return",
"_localhost"
] | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/urllib.py#L802-L807 | |
devpack/android-python27 | d42dd67565e104cf7b0b50eb473f615db3e69901 | python-build-with-qt/PyQt-x11-gpl-4.8/pyqtconfig.py | python | phononModuleMakefile.__init__ | (self, *args, **kw) | Initialise an instance of a module Makefile. | Initialise an instance of a module Makefile. | [
"Initialise",
"an",
"instance",
"of",
"a",
"module",
"Makefile",
"."
] | def __init__(self, *args, **kw):
"""Initialise an instance of a module Makefile.
"""
if "qt" not in kw:
kw["qt"] = ["QtCore", "QtGui", "phonon"]
QtGuiModuleMakefile.__init__(self, *args, **kw) | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kw",
")",
":",
"if",
"\"qt\"",
"not",
"in",
"kw",
":",
"kw",
"[",
"\"qt\"",
"]",
"=",
"[",
"\"QtCore\"",
",",
"\"QtGui\"",
",",
"\"phonon\"",
"]",
"QtGuiModuleMakefile",
".",
"__init__... | https://github.com/devpack/android-python27/blob/d42dd67565e104cf7b0b50eb473f615db3e69901/python-build-with-qt/PyQt-x11-gpl-4.8/pyqtconfig.py#L367-L373 | ||
LiquidPlayer/LiquidCore | 9405979363f2353ac9a71ad8ab59685dd7f919c9 | deps/node-10.15.3/deps/v8/src/PRESUBMIT.py | python | PostUploadHook | (cl, change, output_api) | return output_api.EnsureCQIncludeTrybotsAreAdded(
cl,
[
'luci.chromium.try:linux_chromium_rel_ng'
],
'Automatically added layout test trybots to run tests on CQ.') | git cl upload will call this hook after the issue is created/modified.
This hook adds extra try bots to the CL description in order to run layout
tests in addition to CQ try bots. | git cl upload will call this hook after the issue is created/modified. | [
"git",
"cl",
"upload",
"will",
"call",
"this",
"hook",
"after",
"the",
"issue",
"is",
"created",
"/",
"modified",
"."
] | def PostUploadHook(cl, change, output_api):
"""git cl upload will call this hook after the issue is created/modified.
This hook adds extra try bots to the CL description in order to run layout
tests in addition to CQ try bots.
"""
def is_api_cc(f):
return 'api.cc' == os.path.split(f.LocalPath())[1]
if ... | [
"def",
"PostUploadHook",
"(",
"cl",
",",
"change",
",",
"output_api",
")",
":",
"def",
"is_api_cc",
"(",
"f",
")",
":",
"return",
"'api.cc'",
"==",
"os",
".",
"path",
".",
"split",
"(",
"f",
".",
"LocalPath",
"(",
")",
")",
"[",
"1",
"]",
"if",
"... | https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/node-10.15.3/deps/v8/src/PRESUBMIT.py#L14-L29 | |
panda3d/panda3d | 833ad89ebad58395d0af0b7ec08538e5e4308265 | direct/src/directtools/DirectGeometry.py | python | LineNodePath.drawArrow | (self, sv, ev, arrowAngle, arrowLength) | Do the work of moving the cursor around to draw an arrow from
sv to ev. Hack: the arrows take the z value of the end point | Do the work of moving the cursor around to draw an arrow from
sv to ev. Hack: the arrows take the z value of the end point | [
"Do",
"the",
"work",
"of",
"moving",
"the",
"cursor",
"around",
"to",
"draw",
"an",
"arrow",
"from",
"sv",
"to",
"ev",
".",
"Hack",
":",
"the",
"arrows",
"take",
"the",
"z",
"value",
"of",
"the",
"end",
"point"
] | def drawArrow(self, sv, ev, arrowAngle, arrowLength):
"""
Do the work of moving the cursor around to draw an arrow from
sv to ev. Hack: the arrows take the z value of the end point
"""
self.moveTo(sv)
self.drawTo(ev)
v = sv - ev
# Find the angle of the lin... | [
"def",
"drawArrow",
"(",
"self",
",",
"sv",
",",
"ev",
",",
"arrowAngle",
",",
"arrowLength",
")",
":",
"self",
".",
"moveTo",
"(",
"sv",
")",
"self",
".",
"drawTo",
"(",
"ev",
")",
"v",
"=",
"sv",
"-",
"ev",
"# Find the angle of the line",
"angle",
... | https://github.com/panda3d/panda3d/blob/833ad89ebad58395d0af0b7ec08538e5e4308265/direct/src/directtools/DirectGeometry.py#L70-L92 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/framework/random_seed.py | python | get_seed | (op_seed) | return seeds | Returns the local seeds an operation should use given an op-specific seed.
Given operation-specific seed, `op_seed`, this helper function returns two
seeds derived from graph-level and op-level seeds. Many random operations
internally use the two seeds to allow user to change the seed globally for a
graph, or ... | Returns the local seeds an operation should use given an op-specific seed. | [
"Returns",
"the",
"local",
"seeds",
"an",
"operation",
"should",
"use",
"given",
"an",
"op",
"-",
"specific",
"seed",
"."
] | def get_seed(op_seed):
"""Returns the local seeds an operation should use given an op-specific seed.
Given operation-specific seed, `op_seed`, this helper function returns two
seeds derived from graph-level and op-level seeds. Many random operations
internally use the two seeds to allow user to change the seed... | [
"def",
"get_seed",
"(",
"op_seed",
")",
":",
"is_graph_mode",
"=",
"context",
".",
"in_graph_mode",
"(",
")",
"if",
"is_graph_mode",
":",
"global_seed",
"=",
"ops",
".",
"get_default_graph",
"(",
")",
".",
"seed",
"else",
":",
"global_seed",
"=",
"context",
... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/framework/random_seed.py#L35-L78 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/setuptools/command/bdist_egg.py | python | bdist_egg.call_command | (self, cmdname, **kw) | return cmd | Invoke reinitialized command `cmdname` with keyword args | Invoke reinitialized command `cmdname` with keyword args | [
"Invoke",
"reinitialized",
"command",
"cmdname",
"with",
"keyword",
"args"
] | def call_command(self, cmdname, **kw):
"""Invoke reinitialized command `cmdname` with keyword args"""
for dirname in INSTALL_DIRECTORY_ATTRS:
kw.setdefault(dirname, self.bdist_dir)
kw.setdefault('skip_build', self.skip_build)
kw.setdefault('dry_run', self.dry_run)
cmd... | [
"def",
"call_command",
"(",
"self",
",",
"cmdname",
",",
"*",
"*",
"kw",
")",
":",
"for",
"dirname",
"in",
"INSTALL_DIRECTORY_ATTRS",
":",
"kw",
".",
"setdefault",
"(",
"dirname",
",",
"self",
".",
"bdist_dir",
")",
"kw",
".",
"setdefault",
"(",
"'skip_b... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/setuptools/command/bdist_egg.py#L152-L160 | |
CRYTEK/CRYENGINE | 232227c59a220cbbd311576f0fbeba7bb53b2a8c | Editor/Python/windows/Lib/site-packages/pip/req/req_set.py | python | RequirementSet.__init__ | (self, build_dir, src_dir, download_dir, upgrade=False,
ignore_installed=False, as_egg=False, target_dir=None,
ignore_dependencies=False, force_reinstall=False,
use_user_site=False, session=None, pycompile=True,
isolated=False, wheel_download_dir=None,... | Create a RequirementSet.
:param wheel_download_dir: Where still-packed .whl files should be
written to. If None they are written to the download_dir parameter.
Separate to download_dir to permit only keeping wheel archives for
pip wheel.
:param download_dir: Where st... | Create a RequirementSet. | [
"Create",
"a",
"RequirementSet",
"."
] | def __init__(self, build_dir, src_dir, download_dir, upgrade=False,
ignore_installed=False, as_egg=False, target_dir=None,
ignore_dependencies=False, force_reinstall=False,
use_user_site=False, session=None, pycompile=True,
isolated=False, wheel_downlo... | [
"def",
"__init__",
"(",
"self",
",",
"build_dir",
",",
"src_dir",
",",
"download_dir",
",",
"upgrade",
"=",
"False",
",",
"ignore_installed",
"=",
"False",
",",
"as_egg",
"=",
"False",
",",
"target_dir",
"=",
"None",
",",
"ignore_dependencies",
"=",
"False",... | https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Editor/Python/windows/Lib/site-packages/pip/req/req_set.py#L138-L190 | ||
continental/ecal | 204dab80a24fe01abca62541133b311bf0c09608 | lang/python/core/ecal/core/publisher.py | python | MessagePublisher.set_qos | (self, qos) | return self.c_publisher.set_qos(qos) | set publisher quality of service
:param qos: 0 = default, 1 = best effort, 2 = reliable
:type qos: int | set publisher quality of service | [
"set",
"publisher",
"quality",
"of",
"service"
] | def set_qos(self, qos):
""" set publisher quality of service
:param qos: 0 = default, 1 = best effort, 2 = reliable
:type qos: int
"""
return self.c_publisher.set_qos(qos) | [
"def",
"set_qos",
"(",
"self",
",",
"qos",
")",
":",
"return",
"self",
".",
"c_publisher",
".",
"set_qos",
"(",
"qos",
")"
] | https://github.com/continental/ecal/blob/204dab80a24fe01abca62541133b311bf0c09608/lang/python/core/ecal/core/publisher.py#L52-L59 | |
fasiondog/hikyuu | 842751aa25283f9fdafc6f560ea262f79e67a307 | hikyuu/shell/hkucmd.py | python | HKUShell.do_record | (self, arg) | Save future commands to filename: RECORD rose.cmd | Save future commands to filename: RECORD rose.cmd | [
"Save",
"future",
"commands",
"to",
"filename",
":",
"RECORD",
"rose",
".",
"cmd"
] | def do_record(self, arg):
'Save future commands to filename: RECORD rose.cmd'
self.file = open(arg, 'w') | [
"def",
"do_record",
"(",
"self",
",",
"arg",
")",
":",
"self",
".",
"file",
"=",
"open",
"(",
"arg",
",",
"'w'",
")"
] | https://github.com/fasiondog/hikyuu/blob/842751aa25283f9fdafc6f560ea262f79e67a307/hikyuu/shell/hkucmd.py#L91-L93 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/multiprocessing/process.py | python | Process.start | (self) | Start child process | Start child process | [
"Start",
"child",
"process"
] | def start(self):
'''
Start child process
'''
assert self._popen is None, 'cannot start a process twice'
assert self._parent_pid == os.getpid(), \
'can only start a process object created by current process'
assert not _current_process._daemonic, \
... | [
"def",
"start",
"(",
"self",
")",
":",
"assert",
"self",
".",
"_popen",
"is",
"None",
",",
"'cannot start a process twice'",
"assert",
"self",
".",
"_parent_pid",
"==",
"os",
".",
"getpid",
"(",
")",
",",
"'can only start a process object created by current process'... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/multiprocessing/process.py#L116-L131 | ||
intel/llvm | e6d0547e9d99b5a56430c4749f6c7e328bf221ab | lldb/third_party/Python/module/pexpect-4.6/pexpect/screen.py | python | screen.clear_tab | (self) | Clears tab at the current position. | Clears tab at the current position. | [
"Clears",
"tab",
"at",
"the",
"current",
"position",
"."
] | def clear_tab (self): # <ESC>[g
'''Clears tab at the current position.'''
pass | [
"def",
"clear_tab",
"(",
"self",
")",
":",
"# <ESC>[g",
"pass"
] | https://github.com/intel/llvm/blob/e6d0547e9d99b5a56430c4749f6c7e328bf221ab/lldb/third_party/Python/module/pexpect-4.6/pexpect/screen.py#L417-L420 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/cython/Cython/Distutils/old_build_ext.py | python | old_build_ext.cython_sources | (self, sources, extension) | return new_sources | Walk the list of source files in 'sources', looking for Cython
source files (.pyx and .py). Run Cython on all that are
found, and return a modified 'sources' list with Cython source
files replaced by the generated C (or C++) files. | Walk the list of source files in 'sources', looking for Cython
source files (.pyx and .py). Run Cython on all that are
found, and return a modified 'sources' list with Cython source
files replaced by the generated C (or C++) files. | [
"Walk",
"the",
"list",
"of",
"source",
"files",
"in",
"sources",
"looking",
"for",
"Cython",
"source",
"files",
"(",
".",
"pyx",
"and",
".",
"py",
")",
".",
"Run",
"Cython",
"on",
"all",
"that",
"are",
"found",
"and",
"return",
"a",
"modified",
"source... | def cython_sources(self, sources, extension):
"""
Walk the list of source files in 'sources', looking for Cython
source files (.pyx and .py). Run Cython on all that are
found, and return a modified 'sources' list with Cython source
files replaced by the generated C (or C++) file... | [
"def",
"cython_sources",
"(",
"self",
",",
"sources",
",",
"extension",
")",
":",
"try",
":",
"from",
"Cython",
".",
"Compiler",
".",
"Main",
"import",
"CompilationOptions",
",",
"default_options",
"as",
"cython_default_options",
",",
"compile",
"as",
"cython_co... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/cython/Cython/Distutils/old_build_ext.py#L197-L351 | |
apache/mesos | 97d9a4063332aae3825d78de71611657e05cf5e2 | src/python/interface/src/mesos/interface/__init__.py | python | Scheduler.offerRescinded | (self, driver, offerId) | Invoked when an offer is no longer valid (e.g., the slave was lost or
another framework used resources in the offer.) If for whatever reason
an offer is never rescinded (e.g., dropped message, failing over
framework, etc.), a framework that attempts to launch tasks using an
invalid offer will re... | Invoked when an offer is no longer valid (e.g., the slave was lost or
another framework used resources in the offer.) If for whatever reason
an offer is never rescinded (e.g., dropped message, failing over
framework, etc.), a framework that attempts to launch tasks using an
invalid offer will re... | [
"Invoked",
"when",
"an",
"offer",
"is",
"no",
"longer",
"valid",
"(",
"e",
".",
"g",
".",
"the",
"slave",
"was",
"lost",
"or",
"another",
"framework",
"used",
"resources",
"in",
"the",
"offer",
".",
")",
"If",
"for",
"whatever",
"reason",
"an",
"offer"... | def offerRescinded(self, driver, offerId):
"""
Invoked when an offer is no longer valid (e.g., the slave was lost or
another framework used resources in the offer.) If for whatever reason
an offer is never rescinded (e.g., dropped message, failing over
framework, etc.), a framework that atte... | [
"def",
"offerRescinded",
"(",
"self",
",",
"driver",
",",
"offerId",
")",
":"
] | https://github.com/apache/mesos/blob/97d9a4063332aae3825d78de71611657e05cf5e2/src/python/interface/src/mesos/interface/__init__.py#L78-L86 | ||
root-project/root | fcd3583bb14852bf2e8cd2415717cbaac0e75896 | main/python/cmdLineUtils.py | python | write | (string,indent=0,end="") | Use sys.stdout.write to write the string with an indentation
equal to indent and specifying the end character | Use sys.stdout.write to write the string with an indentation
equal to indent and specifying the end character | [
"Use",
"sys",
".",
"stdout",
".",
"write",
"to",
"write",
"the",
"string",
"with",
"an",
"indentation",
"equal",
"to",
"indent",
"and",
"specifying",
"the",
"end",
"character"
] | def write(string,indent=0,end=""):
"""Use sys.stdout.write to write the string with an indentation
equal to indent and specifying the end character"""
sys.stdout.write(" "*indent+string+end) | [
"def",
"write",
"(",
"string",
",",
"indent",
"=",
"0",
",",
"end",
"=",
"\"\"",
")",
":",
"sys",
".",
"stdout",
".",
"write",
"(",
"\" \"",
"*",
"indent",
"+",
"string",
"+",
"end",
")"
] | https://github.com/root-project/root/blob/fcd3583bb14852bf2e8cd2415717cbaac0e75896/main/python/cmdLineUtils.py#L908-L911 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/logging/config.py | python | BaseConfigurator.cfg_convert | (self, value) | return d | Default converter for the cfg:// protocol. | Default converter for the cfg:// protocol. | [
"Default",
"converter",
"for",
"the",
"cfg",
":",
"//",
"protocol",
"."
] | def cfg_convert(self, value):
"""Default converter for the cfg:// protocol."""
rest = value
m = self.WORD_PATTERN.match(rest)
if m is None:
raise ValueError("Unable to convert %r" % value)
else:
rest = rest[m.end():]
d = self.config[m.groups()[... | [
"def",
"cfg_convert",
"(",
"self",
",",
"value",
")",
":",
"rest",
"=",
"value",
"m",
"=",
"self",
".",
"WORD_PATTERN",
".",
"match",
"(",
"rest",
")",
"if",
"m",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"Unable to convert %r\"",
"%",
"value",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/logging/config.py#L407-L439 | |
widelands/widelands | e9f047d46a23d81312237d52eabf7d74e8de52d6 | utils/glossary_checks.py | python | load_glossary | (glossary_file, locale) | return result | Build a glossary from the given Transifex glossary csv file for the
given locale. | Build a glossary from the given Transifex glossary csv file for the
given locale. | [
"Build",
"a",
"glossary",
"from",
"the",
"given",
"Transifex",
"glossary",
"csv",
"file",
"for",
"the",
"given",
"locale",
"."
] | def load_glossary(glossary_file, locale):
"""Build a glossary from the given Transifex glossary csv file for the
given locale."""
result = []
counter = 0
term_index = 0
term_comment_index = 0
wordclass_index = 0
translation_index = 0
comment_index = 0
for row in read_csv_file(glo... | [
"def",
"load_glossary",
"(",
"glossary_file",
",",
"locale",
")",
":",
"result",
"=",
"[",
"]",
"counter",
"=",
"0",
"term_index",
"=",
"0",
"term_comment_index",
"=",
"0",
"wordclass_index",
"=",
"0",
"translation_index",
"=",
"0",
"comment_index",
"=",
"0"... | https://github.com/widelands/widelands/blob/e9f047d46a23d81312237d52eabf7d74e8de52d6/utils/glossary_checks.py#L208-L268 | |
KratosMultiphysics/Kratos | 0000833054ed0503424eb28205d6508d9ca6cbbc | applications/CoSimulationApplication/python_scripts/base_classes/co_simulation_io.py | python | CoSimulationIO.ImportCouplingInterface | (self, interface_config) | Imports coupling interface from an external solver
External solver sends, CoSimulation receives
@param interface_config <python dictionary> : configuration of the interface to be imported | Imports coupling interface from an external solver
External solver sends, CoSimulation receives | [
"Imports",
"coupling",
"interface",
"from",
"an",
"external",
"solver",
"External",
"solver",
"sends",
"CoSimulation",
"receives"
] | def ImportCouplingInterface(self, interface_config):
"""Imports coupling interface from an external solver
External solver sends, CoSimulation receives
@param interface_config <python dictionary> : configuration of the interface to be imported
"""
raise NotImplementedError("This... | [
"def",
"ImportCouplingInterface",
"(",
"self",
",",
"interface_config",
")",
":",
"raise",
"NotImplementedError",
"(",
"\"This function has to be implemented in the derived class!\"",
")"
] | https://github.com/KratosMultiphysics/Kratos/blob/0000833054ed0503424eb28205d6508d9ca6cbbc/applications/CoSimulationApplication/python_scripts/base_classes/co_simulation_io.py#L26-L32 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/urllib/request.py | python | localhost | () | return _localhost | Return the IP address of the magic hostname 'localhost'. | Return the IP address of the magic hostname 'localhost'. | [
"Return",
"the",
"IP",
"address",
"of",
"the",
"magic",
"hostname",
"localhost",
"."
] | def localhost():
"""Return the IP address of the magic hostname 'localhost'."""
global _localhost
if _localhost is None:
_localhost = socket.gethostbyname('localhost')
return _localhost | [
"def",
"localhost",
"(",
")",
":",
"global",
"_localhost",
"if",
"_localhost",
"is",
"None",
":",
"_localhost",
"=",
"socket",
".",
"gethostbyname",
"(",
"'localhost'",
")",
"return",
"_localhost"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/urllib/request.py#L2353-L2358 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/linalg/sparse/sparse_csr_matrix_ops.py | python | matmul | (a,
b,
transpose_a=False,
transpose_b=False,
adjoint_a=False,
adjoint_b=False,
name=None) | Perform a sparse matrix matmul between `a` and `b`.
Performs a contraction between `a` and `b` along the two innermost dimensions.
If both `a` and `b` are instances of `SparseMatrix`, returns a new instance
of `SparseMatrix` (same type as `a`). If one is not an instance of
`SparseMatrix`, returns a dense `Ten... | Perform a sparse matrix matmul between `a` and `b`. | [
"Perform",
"a",
"sparse",
"matrix",
"matmul",
"between",
"a",
"and",
"b",
"."
] | def matmul(a,
b,
transpose_a=False,
transpose_b=False,
adjoint_a=False,
adjoint_b=False,
name=None):
"""Perform a sparse matrix matmul between `a` and `b`.
Performs a contraction between `a` and `b` along the two innermost dimensions.
If both `a` ... | [
"def",
"matmul",
"(",
"a",
",",
"b",
",",
"transpose_a",
"=",
"False",
",",
"transpose_b",
"=",
"False",
",",
"adjoint_a",
"=",
"False",
",",
"adjoint_b",
"=",
"False",
",",
"name",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"a",
",",
"... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/linalg/sparse/sparse_csr_matrix_ops.py#L141-L239 | ||
msitt/blpapi-python | bebcf43668c9e5f5467b1f685f9baebbfc45bc87 | src/blpapi/exception.py | python | _ExceptionUtil.raiseOnError | (errorCode, description=None) | Throw the appropriate exception for the specified 'errorCode' if the
'errorCode != 0'. | Throw the appropriate exception for the specified 'errorCode' if the
'errorCode != 0'. | [
"Throw",
"the",
"appropriate",
"exception",
"for",
"the",
"specified",
"errorCode",
"if",
"the",
"errorCode",
"!",
"=",
"0",
"."
] | def raiseOnError(errorCode, description=None):
"""Throw the appropriate exception for the specified 'errorCode' if the
'errorCode != 0'.
"""
if errorCode:
_ExceptionUtil.raiseException(errorCode, description) | [
"def",
"raiseOnError",
"(",
"errorCode",
",",
"description",
"=",
"None",
")",
":",
"if",
"errorCode",
":",
"_ExceptionUtil",
".",
"raiseException",
"(",
"errorCode",
",",
"description",
")"
] | https://github.com/msitt/blpapi-python/blob/bebcf43668c9e5f5467b1f685f9baebbfc45bc87/src/blpapi/exception.py#L141-L146 | ||
gimli-org/gimli | 17aa2160de9b15ababd9ef99e89b1bc3277bbb23 | pygimli/physics/sNMR/mrs.py | python | MRS.loadMRSD | (self, filename, usereal=False, mint=0., maxt=2.0) | Load mrsd (MRS data) file: not really used as in MRSD. | Load mrsd (MRS data) file: not really used as in MRSD. | [
"Load",
"mrsd",
"(",
"MRS",
"data",
")",
"file",
":",
"not",
"really",
"used",
"as",
"in",
"MRSD",
"."
] | def loadMRSD(self, filename, usereal=False, mint=0., maxt=2.0):
"""Load mrsd (MRS data) file: not really used as in MRSD."""
from scipy.io import loadmat # loading Matlab mat files
print("Currently not using mint/maxt & usereal:", mint, maxt, usereal)
pl = loadmat(filename, struct_as_r... | [
"def",
"loadMRSD",
"(",
"self",
",",
"filename",
",",
"usereal",
"=",
"False",
",",
"mint",
"=",
"0.",
",",
"maxt",
"=",
"2.0",
")",
":",
"from",
"scipy",
".",
"io",
"import",
"loadmat",
"# loading Matlab mat files",
"print",
"(",
"\"Currently not using mint... | https://github.com/gimli-org/gimli/blob/17aa2160de9b15ababd9ef99e89b1bc3277bbb23/pygimli/physics/sNMR/mrs.py#L241-L255 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/tornado/tornado-6/tornado/template.py | python | Template.__init__ | (
self,
template_string: Union[str, bytes],
name: str = "<string>",
loader: Optional["BaseLoader"] = None,
compress_whitespace: Union[bool, _UnsetMarker] = _UNSET,
autoescape: Optional[Union[str, _UnsetMarker]] = _UNSET,
whitespace: Optional[str] = None,
) | Construct a Template.
:arg str template_string: the contents of the template file.
:arg str name: the filename from which the template was loaded
(used for error message).
:arg tornado.template.BaseLoader loader: the `~tornado.template.BaseLoader` responsible
for this te... | Construct a Template. | [
"Construct",
"a",
"Template",
"."
] | def __init__(
self,
template_string: Union[str, bytes],
name: str = "<string>",
loader: Optional["BaseLoader"] = None,
compress_whitespace: Union[bool, _UnsetMarker] = _UNSET,
autoescape: Optional[Union[str, _UnsetMarker]] = _UNSET,
whitespace: Optional[str] = Non... | [
"def",
"__init__",
"(",
"self",
",",
"template_string",
":",
"Union",
"[",
"str",
",",
"bytes",
"]",
",",
"name",
":",
"str",
"=",
"\"<string>\"",
",",
"loader",
":",
"Optional",
"[",
"\"BaseLoader\"",
"]",
"=",
"None",
",",
"compress_whitespace",
":",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/tornado/tornado-6/tornado/template.py#L262-L335 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.