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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/contrib/specs/python/specs_lib.py | python | debug | (mode=True) | Turn on/off debugging mode.
Debugging mode prints more information about the construction
of a network.
Args:
mode: True if turned on, False otherwise | Turn on/off debugging mode. | [
"Turn",
"on",
"/",
"off",
"debugging",
"mode",
"."
] | def debug(mode=True):
"""Turn on/off debugging mode.
Debugging mode prints more information about the construction
of a network.
Args:
mode: True if turned on, False otherwise
"""
global debug_
debug_ = mode | [
"def",
"debug",
"(",
"mode",
"=",
"True",
")",
":",
"global",
"debug_",
"debug_",
"=",
"mode"
] | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/contrib/specs/python/specs_lib.py#L279-L289 | ||
Cisco-Talos/moflow | ed71dfb0540d9e0d7a4c72f0881b58958d573728 | BAP-0.7-moflow/libtracewrap/libtrace/protobuf/python/google/protobuf/message.py | python | Message.ByteSize | (self) | Returns the serialized size of this message.
Recursively calls ByteSize() on all contained messages. | Returns the serialized size of this message.
Recursively calls ByteSize() on all contained messages. | [
"Returns",
"the",
"serialized",
"size",
"of",
"this",
"message",
".",
"Recursively",
"calls",
"ByteSize",
"()",
"on",
"all",
"contained",
"messages",
"."
] | def ByteSize(self):
"""Returns the serialized size of this message.
Recursively calls ByteSize() on all contained messages.
"""
raise NotImplementedError | [
"def",
"ByteSize",
"(",
"self",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/Cisco-Talos/moflow/blob/ed71dfb0540d9e0d7a4c72f0881b58958d573728/BAP-0.7-moflow/libtracewrap/libtrace/protobuf/python/google/protobuf/message.py#L243-L247 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_core.py | python | Sizer.GetItemIndex | (self, item) | return idx | Returns the index of the given *item* within the sizer. Does not
search recursively. The *item* parameter can be either a window
or a sizer. An assertion is raised if the item is not found in
the sizer. | Returns the index of the given *item* within the sizer. Does not
search recursively. The *item* parameter can be either a window
or a sizer. An assertion is raised if the item is not found in
the sizer. | [
"Returns",
"the",
"index",
"of",
"the",
"given",
"*",
"item",
"*",
"within",
"the",
"sizer",
".",
"Does",
"not",
"search",
"recursively",
".",
"The",
"*",
"item",
"*",
"parameter",
"can",
"be",
"either",
"a",
"window",
"or",
"a",
"sizer",
".",
"An",
... | def GetItemIndex(self, item):
"""
Returns the index of the given *item* within the sizer. Does not
search recursively. The *item* parameter can be either a window
or a sizer. An assertion is raised if the item is not found in
the sizer.
"""
sItem = self.GetItem(... | [
"def",
"GetItemIndex",
"(",
"self",
",",
"item",
")",
":",
"sItem",
"=",
"self",
".",
"GetItem",
"(",
"item",
")",
"assert",
"sItem",
"is",
"not",
"None",
",",
"\"Item not found in the sizer.\"",
"allItems",
"=",
"self",
".",
"Children",
"idx",
"=",
"0",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_core.py#L14549-L14564 | |
facebookincubator/BOLT | 88c70afe9d388ad430cc150cc158641701397f70 | lldb/third_party/Python/module/pexpect-4.6/pexpect/screen.py | python | screen.scroll_constrain | (self) | This keeps the scroll region within the screen region. | This keeps the scroll region within the screen region. | [
"This",
"keeps",
"the",
"scroll",
"region",
"within",
"the",
"screen",
"region",
"."
] | def scroll_constrain (self):
'''This keeps the scroll region within the screen region.'''
if self.scroll_row_start <= 0:
self.scroll_row_start = 1
if self.scroll_row_end > self.rows:
self.scroll_row_end = self.rows | [
"def",
"scroll_constrain",
"(",
"self",
")",
":",
"if",
"self",
".",
"scroll_row_start",
"<=",
"0",
":",
"self",
".",
"scroll_row_start",
"=",
"1",
"if",
"self",
".",
"scroll_row_end",
">",
"self",
".",
"rows",
":",
"self",
".",
"scroll_row_end",
"=",
"s... | https://github.com/facebookincubator/BOLT/blob/88c70afe9d388ad430cc150cc158641701397f70/lldb/third_party/Python/module/pexpect-4.6/pexpect/screen.py#L339-L345 | ||
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Import/App/SCL/Part21.py | python | Model.add_instance | (self, instance) | Adds an instance to the model | Adds an instance to the model | [
"Adds",
"an",
"instance",
"to",
"the",
"model"
] | def add_instance(self, instance):
'''
Adds an instance to the model
'''
self._number_of_instances += 1
self._instances[self._number_of_instances-1] = instance | [
"def",
"add_instance",
"(",
"self",
",",
"instance",
")",
":",
"self",
".",
"_number_of_instances",
"+=",
"1",
"self",
".",
"_instances",
"[",
"self",
".",
"_number_of_instances",
"-",
"1",
"]",
"=",
"instance"
] | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Import/App/SCL/Part21.py#L58-L63 | ||
PixarAnimationStudios/USD | faed18ce62c8736b02413635b584a2f637156bad | pxr/usdImaging/usdviewq/plugin.py | python | CommandPlugin.run | (self) | Run the command's callback function. | Run the command's callback function. | [
"Run",
"the",
"command",
"s",
"callback",
"function",
"."
] | def run(self):
"""Run the command's callback function."""
self._callback(self._usdviewApi) | [
"def",
"run",
"(",
"self",
")",
":",
"self",
".",
"_callback",
"(",
"self",
".",
"_usdviewApi",
")"
] | https://github.com/PixarAnimationStudios/USD/blob/faed18ce62c8736b02413635b584a2f637156bad/pxr/usdImaging/usdviewq/plugin.py#L180-L183 | ||
Tencent/CMONGO | c40380caa14e05509f46993aa8b8da966b09b0b5 | src/third_party/mozjs-38/extract/js/src/builtin/make_intl_data.py | python | writeMappingsVar | (intlData, dict, name, description, fileDate, url) | Writes a variable definition with a mapping table to file intlData.
Writes the contents of dictionary dict to file intlData with the given
variable name and a comment with description, fileDate, and URL. | Writes a variable definition with a mapping table to file intlData. | [
"Writes",
"a",
"variable",
"definition",
"with",
"a",
"mapping",
"table",
"to",
"file",
"intlData",
"."
] | def writeMappingsVar(intlData, dict, name, description, fileDate, url):
""" Writes a variable definition with a mapping table to file intlData.
Writes the contents of dictionary dict to file intlData with the given
variable name and a comment with description, fileDate, and URL.
"""
intlDat... | [
"def",
"writeMappingsVar",
"(",
"intlData",
",",
"dict",
",",
"name",
",",
"description",
",",
"fileDate",
",",
"url",
")",
":",
"intlData",
".",
"write",
"(",
"\"\\n\"",
")",
"intlData",
".",
"write",
"(",
"\"// {0}.\\n\"",
".",
"format",
"(",
"descriptio... | https://github.com/Tencent/CMONGO/blob/c40380caa14e05509f46993aa8b8da966b09b0b5/src/third_party/mozjs-38/extract/js/src/builtin/make_intl_data.py#L136-L156 | ||
gem5/gem5 | 141cc37c2d4b93959d4c249b8f7e6a8b2ef75338 | ext/ply/example/ansic/cparse.py | python | p_multiplicative_expression_3 | (t) | multiplicative_expression : multiplicative_expression DIVIDE cast_expression | multiplicative_expression : multiplicative_expression DIVIDE cast_expression | [
"multiplicative_expression",
":",
"multiplicative_expression",
"DIVIDE",
"cast_expression"
] | def p_multiplicative_expression_3(t):
'multiplicative_expression : multiplicative_expression DIVIDE cast_expression'
pass | [
"def",
"p_multiplicative_expression_3",
"(",
"t",
")",
":",
"pass"
] | https://github.com/gem5/gem5/blob/141cc37c2d4b93959d4c249b8f7e6a8b2ef75338/ext/ply/example/ansic/cparse.py#L739-L741 | ||
LiquidPlayer/LiquidCore | 9405979363f2353ac9a71ad8ab59685dd7f919c9 | deps/boost_1_66_0/libs/python/config/tools/sphinx4scons.py | python | SourceInfo._get_statics | (self, confignode, config) | return statics | Returns static files, filtered through exclude_patterns. | Returns static files, filtered through exclude_patterns. | [
"Returns",
"static",
"files",
"filtered",
"through",
"exclude_patterns",
"."
] | def _get_statics(self, confignode, config):
"""Returns static files, filtered through exclude_patterns."""
statics = []
matchers = compile_matchers(config.get('exclude_patterns', []))
for path in config.get('html_static_path', []):
# Check _get_templates() why we use this co... | [
"def",
"_get_statics",
"(",
"self",
",",
"confignode",
",",
"config",
")",
":",
"statics",
"=",
"[",
"]",
"matchers",
"=",
"compile_matchers",
"(",
"config",
".",
"get",
"(",
"'exclude_patterns'",
",",
"[",
"]",
")",
")",
"for",
"path",
"in",
"config",
... | https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/boost_1_66_0/libs/python/config/tools/sphinx4scons.py#L274-L297 | |
perilouswithadollarsign/cstrike15_src | f82112a2388b841d72cb62ca48ab1846dfcc11c8 | thirdparty/protobuf-2.5.0/python/google/protobuf/service_reflection.py | python | _ServiceBuilder.__init__ | (self, service_descriptor) | Initializes an instance of the service class builder.
Args:
service_descriptor: ServiceDescriptor to use when constructing the
service class. | Initializes an instance of the service class builder. | [
"Initializes",
"an",
"instance",
"of",
"the",
"service",
"class",
"builder",
"."
] | def __init__(self, service_descriptor):
"""Initializes an instance of the service class builder.
Args:
service_descriptor: ServiceDescriptor to use when constructing the
service class.
"""
self.descriptor = service_descriptor | [
"def",
"__init__",
"(",
"self",
",",
"service_descriptor",
")",
":",
"self",
".",
"descriptor",
"=",
"service_descriptor"
] | https://github.com/perilouswithadollarsign/cstrike15_src/blob/f82112a2388b841d72cb62ca48ab1846dfcc11c8/thirdparty/protobuf-2.5.0/python/google/protobuf/service_reflection.py#L124-L131 | ||
ucbrise/clipper | 9f25e3fc7f8edc891615e81c5b80d3d8aed72608 | clipper_admin/clipper_admin/docker/logging/fluentd.py | python | FluentdConfig.build | (self, fluentd_port) | return self._file_path | Build a fluentd configuration file and return the path of it.
fluentd_default_conf_path will be stored in clipper_admin/docker folder
and used to write the initial conf file.
Build should be called only once to build an initial conf file.
Developers can customize conf file written in th... | Build a fluentd configuration file and return the path of it.
fluentd_default_conf_path will be stored in clipper_admin/docker folder
and used to write the initial conf file. | [
"Build",
"a",
"fluentd",
"configuration",
"file",
"and",
"return",
"the",
"path",
"of",
"it",
".",
"fluentd_default_conf_path",
"will",
"be",
"stored",
"in",
"clipper_admin",
"/",
"docker",
"folder",
"and",
"used",
"to",
"write",
"the",
"initial",
"conf",
"fil... | def build(self, fluentd_port):
"""
Build a fluentd configuration file and return the path of it.
fluentd_default_conf_path will be stored in clipper_admin/docker folder
and used to write the initial conf file.
Build should be called only once to build an initial conf file.
... | [
"def",
"build",
"(",
"self",
",",
"fluentd_port",
")",
":",
"if",
"self",
".",
"_file_path",
"is",
"None",
"or",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"self",
".",
"_file_path",
")",
":",
"self",
".",
"_file_path",
"=",
"self",
".",
"build_te... | https://github.com/ucbrise/clipper/blob/9f25e3fc7f8edc891615e81c5b80d3d8aed72608/clipper_admin/clipper_admin/docker/logging/fluentd.py#L118-L145 | |
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/cmd.py | python | Cmd.complete | (self, text, state) | Return the next possible completion for 'text'.
If a command has not been entered, then complete against command list.
Otherwise try to call complete_<command> to get list of completions. | Return the next possible completion for 'text'. | [
"Return",
"the",
"next",
"possible",
"completion",
"for",
"text",
"."
] | def complete(self, text, state):
"""Return the next possible completion for 'text'.
If a command has not been entered, then complete against command list.
Otherwise try to call complete_<command> to get list of completions.
"""
if state == 0:
import readline
... | [
"def",
"complete",
"(",
"self",
",",
"text",
",",
"state",
")",
":",
"if",
"state",
"==",
"0",
":",
"import",
"readline",
"origline",
"=",
"readline",
".",
"get_line_buffer",
"(",
")",
"line",
"=",
"origline",
".",
"lstrip",
"(",
")",
"stripped",
"=",
... | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/cmd.py#L253-L281 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/distutils/versionpredicate.py | python | VersionPredicate.satisfied_by | (self, version) | return True | True if version is compatible with all the predicates in self.
The parameter version must be acceptable to the StrictVersion
constructor. It may be either a string or StrictVersion. | True if version is compatible with all the predicates in self.
The parameter version must be acceptable to the StrictVersion
constructor. It may be either a string or StrictVersion. | [
"True",
"if",
"version",
"is",
"compatible",
"with",
"all",
"the",
"predicates",
"in",
"self",
".",
"The",
"parameter",
"version",
"must",
"be",
"acceptable",
"to",
"the",
"StrictVersion",
"constructor",
".",
"It",
"may",
"be",
"either",
"a",
"string",
"or",... | def satisfied_by(self, version):
"""True if version is compatible with all the predicates in self.
The parameter version must be acceptable to the StrictVersion
constructor. It may be either a string or StrictVersion.
"""
for cond, ver in self.pred:
if not compmap[co... | [
"def",
"satisfied_by",
"(",
"self",
",",
"version",
")",
":",
"for",
"cond",
",",
"ver",
"in",
"self",
".",
"pred",
":",
"if",
"not",
"compmap",
"[",
"cond",
"]",
"(",
"version",
",",
"ver",
")",
":",
"return",
"False",
"return",
"True"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/distutils/versionpredicate.py#L130-L138 | |
citizenfx/fivem | 88276d40cc7baf8285d02754cc5ae42ec7a8563f | vendor/chromium/base/android/jni_generator/jni_generator.py | python | _GetParamsInDeclaration | (native) | return [
_JavaDataTypeToCForDeclaration(param.datatype) + ' ' + param.name
for param in native.params
] | Returns the params for the forward declaration.
Args:
native: the native dictionary describing the method.
Returns:
A string containing the params. | Returns the params for the forward declaration. | [
"Returns",
"the",
"params",
"for",
"the",
"forward",
"declaration",
"."
] | def _GetParamsInDeclaration(native):
"""Returns the params for the forward declaration.
Args:
native: the native dictionary describing the method.
Returns:
A string containing the params.
"""
if not native.static:
return _GetJNIFirstParam(native, True) + [
_JavaDataTypeToCForDeclaration(... | [
"def",
"_GetParamsInDeclaration",
"(",
"native",
")",
":",
"if",
"not",
"native",
".",
"static",
":",
"return",
"_GetJNIFirstParam",
"(",
"native",
",",
"True",
")",
"+",
"[",
"_JavaDataTypeToCForDeclaration",
"(",
"param",
".",
"datatype",
")",
"+",
"' '",
... | https://github.com/citizenfx/fivem/blob/88276d40cc7baf8285d02754cc5ae42ec7a8563f/vendor/chromium/base/android/jni_generator/jni_generator.py#L262-L279 | |
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Draft/draftfunctions/mirror.py | python | mirror | (objlist, p1, p2) | return result | Create a mirror object from the provided list and line.
It creates a `Part::Mirroring` object from the given `objlist` using
a plane that is defined by the two given points `p1` and `p2`,
and either
- the Draft working plane normal, or
- the negative normal provided by the camera direction
i... | Create a mirror object from the provided list and line. | [
"Create",
"a",
"mirror",
"object",
"from",
"the",
"provided",
"list",
"and",
"line",
"."
] | def mirror(objlist, p1, p2):
"""Create a mirror object from the provided list and line.
It creates a `Part::Mirroring` object from the given `objlist` using
a plane that is defined by the two given points `p1` and `p2`,
and either
- the Draft working plane normal, or
- the negative normal prov... | [
"def",
"mirror",
"(",
"objlist",
",",
"p1",
",",
"p2",
")",
":",
"utils",
".",
"print_header",
"(",
"'mirror'",
",",
"\"Create mirror\"",
")",
"if",
"not",
"objlist",
":",
"_err",
"(",
"translate",
"(",
"\"draft\"",
",",
"\"No object given\"",
")",
")",
... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Draft/draftfunctions/mirror.py#L46-L124 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/ragged/ragged_math_ops.py | python | softmax | (logits: ragged_tensor.Ragged, axis=None, name=None) | Computes softmax activations.
Used for multi-class predictions. The sum of all outputs generated by softmax
is 1.
This function performs the equivalent of
softmax = tf.exp(logits) / tf.reduce_sum(tf.exp(logits), axis)
Example usage:
>>> softmax = tf.nn.softmax([-1, 0., 1.])
>>> softmax
<tf.Tens... | Computes softmax activations. | [
"Computes",
"softmax",
"activations",
"."
] | def softmax(logits: ragged_tensor.Ragged, axis=None, name=None):
"""Computes softmax activations.
Used for multi-class predictions. The sum of all outputs generated by softmax
is 1.
This function performs the equivalent of
softmax = tf.exp(logits) / tf.reduce_sum(tf.exp(logits), axis)
Example usage:... | [
"def",
"softmax",
"(",
"logits",
":",
"ragged_tensor",
".",
"Ragged",
",",
"axis",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"if",
"axis",
"is",
"None",
":",
"axis",
"=",
"-",
"1",
"with",
"ops",
".",
"name_scope",
"(",
"name",
",",
"'Ragged... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/ragged/ragged_math_ops.py#L1015-L1054 | ||
lammps/lammps | b75c3065430a75b1b5543a10e10f46d9b4c91913 | tools/i-pi/ipi/engine/outputs.py | python | CheckpointOutput.write | (self, store=True) | Writes out the required trajectories.
Used for both the checkpoint files and the soft-exit restart file.
We have slightly different behavior for these two different types of
checkpoint file, as the soft-exit files have their store() function
called automatically, and we do not want this to be u... | Writes out the required trajectories. | [
"Writes",
"out",
"the",
"required",
"trajectories",
"."
] | def write(self, store=True):
"""Writes out the required trajectories.
Used for both the checkpoint files and the soft-exit restart file.
We have slightly different behavior for these two different types of
checkpoint file, as the soft-exit files have their store() function
called automati... | [
"def",
"write",
"(",
"self",
",",
"store",
"=",
"True",
")",
":",
"if",
"not",
"(",
"self",
".",
"simul",
".",
"step",
"+",
"1",
")",
"%",
"self",
".",
"stride",
"==",
"0",
":",
"return",
"if",
"self",
".",
"overwrite",
":",
"filename",
"=",
"s... | https://github.com/lammps/lammps/blob/b75c3065430a75b1b5543a10e10f46d9b4c91913/tools/i-pi/ipi/engine/outputs.py#L348-L378 | ||
arangodb/arangodb | 0d658689c7d1b721b314fa3ca27d38303e1570c8 | 3rdParty/V8/gyp/buildtime_helpers/win_tool.py | python | WinTool._GetEnv | (self, arch) | return dict(kvs) | Gets the saved environment from a file for a given architecture. | Gets the saved environment from a file for a given architecture. | [
"Gets",
"the",
"saved",
"environment",
"from",
"a",
"file",
"for",
"a",
"given",
"architecture",
"."
] | def _GetEnv(self, arch):
"""Gets the saved environment from a file for a given architecture."""
# The environment is saved as an "environment block" (see CreateProcess
# and msvs_emulation for details). We convert to a dict here.
# Drop last 2 NULs, one for list terminator, one for trailing vs. separato... | [
"def",
"_GetEnv",
"(",
"self",
",",
"arch",
")",
":",
"# The environment is saved as an \"environment block\" (see CreateProcess",
"# and msvs_emulation for details). We convert to a dict here.",
"# Drop last 2 NULs, one for list terminator, one for trailing vs. separator.",
"pairs",
"=",
... | https://github.com/arangodb/arangodb/blob/0d658689c7d1b721b314fa3ca27d38303e1570c8/3rdParty/V8/gyp/buildtime_helpers/win_tool.py#L77-L84 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/tkinter/filedialog.py | python | askopenfiles | (mode = "r", **options) | return files | Ask for multiple filenames and return the open file
objects
returns a list of open file objects or an empty list if
cancel selected | Ask for multiple filenames and return the open file
objects | [
"Ask",
"for",
"multiple",
"filenames",
"and",
"return",
"the",
"open",
"file",
"objects"
] | def askopenfiles(mode = "r", **options):
"""Ask for multiple filenames and return the open file
objects
returns a list of open file objects or an empty list if
cancel selected
"""
files = askopenfilenames(**options)
if files:
ofiles=[]
for filename in files:
ofi... | [
"def",
"askopenfiles",
"(",
"mode",
"=",
"\"r\"",
",",
"*",
"*",
"options",
")",
":",
"files",
"=",
"askopenfilenames",
"(",
"*",
"*",
"options",
")",
"if",
"files",
":",
"ofiles",
"=",
"[",
"]",
"for",
"filename",
"in",
"files",
":",
"ofiles",
".",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/tkinter/filedialog.py#L401-L415 | |
apiaryio/drafter | 4634ebd07f6c6f257cc656598ccd535492fdfb55 | tools/gyp/pylib/gyp/easy_xml.py | python | XmlToString | (content, encoding='utf-8', pretty=False) | return ''.join(xml_parts) | Writes the XML content to disk, touching the file only if it has changed.
Visual Studio files have a lot of pre-defined structures. This function makes
it easy to represent these structures as Python data structures, instead of
having to create a lot of function calls.
Each XML element of the content is repr... | Writes the XML content to disk, touching the file only if it has changed. | [
"Writes",
"the",
"XML",
"content",
"to",
"disk",
"touching",
"the",
"file",
"only",
"if",
"it",
"has",
"changed",
"."
] | def XmlToString(content, encoding='utf-8', pretty=False):
""" Writes the XML content to disk, touching the file only if it has changed.
Visual Studio files have a lot of pre-defined structures. This function makes
it easy to represent these structures as Python data structures, instead of
having to create a l... | [
"def",
"XmlToString",
"(",
"content",
",",
"encoding",
"=",
"'utf-8'",
",",
"pretty",
"=",
"False",
")",
":",
"# We create a huge list of all the elements of the file.",
"xml_parts",
"=",
"[",
"'<?xml version=\"1.0\" encoding=\"%s\"?>'",
"%",
"encoding",
"]",
"if",
"pre... | https://github.com/apiaryio/drafter/blob/4634ebd07f6c6f257cc656598ccd535492fdfb55/tools/gyp/pylib/gyp/easy_xml.py#L9-L54 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/devil/devil/utils/timeout_retry.py | python | CurrentTimeoutThreadGroup | () | return None | Returns the thread group that owns or is blocked on the active thread.
Returns:
Returns None if no TimeoutRetryThreadGroup is tracking the current thread. | Returns the thread group that owns or is blocked on the active thread. | [
"Returns",
"the",
"thread",
"group",
"that",
"owns",
"or",
"is",
"blocked",
"on",
"the",
"active",
"thread",
"."
] | def CurrentTimeoutThreadGroup():
"""Returns the thread group that owns or is blocked on the active thread.
Returns:
Returns None if no TimeoutRetryThreadGroup is tracking the current thread.
"""
thread_group = reraiser_thread.CurrentThreadGroup()
while thread_group:
if isinstance(thread_group, Timeou... | [
"def",
"CurrentTimeoutThreadGroup",
"(",
")",
":",
"thread_group",
"=",
"reraiser_thread",
".",
"CurrentThreadGroup",
"(",
")",
"while",
"thread_group",
":",
"if",
"isinstance",
"(",
"thread_group",
",",
"TimeoutRetryThreadGroup",
")",
":",
"return",
"thread_group",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/devil/devil/utils/timeout_retry.py#L58-L69 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/slim/python/slim/nets/inception_v2.py | python | inception_v2_arg_scope | (weight_decay=0.00004,
batch_norm_var_collection='moving_vars') | Defines the default InceptionV2 arg scope.
Args:
weight_decay: The weight decay to use for regularizing the model.
batch_norm_var_collection: The name of the collection for the batch norm
variables.
Returns:
An `arg_scope` to use for the inception v3 model. | Defines the default InceptionV2 arg scope. | [
"Defines",
"the",
"default",
"InceptionV2",
"arg",
"scope",
"."
] | def inception_v2_arg_scope(weight_decay=0.00004,
batch_norm_var_collection='moving_vars'):
"""Defines the default InceptionV2 arg scope.
Args:
weight_decay: The weight decay to use for regularizing the model.
batch_norm_var_collection: The name of the collection for the batch nor... | [
"def",
"inception_v2_arg_scope",
"(",
"weight_decay",
"=",
"0.00004",
",",
"batch_norm_var_collection",
"=",
"'moving_vars'",
")",
":",
"batch_norm_params",
"=",
"{",
"# Decay for the moving averages.",
"'decay'",
":",
"0.9997",
",",
"# epsilon to prevent 0s in variance.",
... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/slim/python/slim/nets/inception_v2.py#L605-L643 | ||
eric612/Caffe-YOLOv3-Windows | 6736ca6e16781789b828cc64218ff77cc3454e5d | scripts/cpp_lint.py | python | FindPreviousMatchingAngleBracket | (clean_lines, linenum, init_prefix) | return False | Find the corresponding < that started a template.
Args:
clean_lines: A CleansedLines instance containing the file.
linenum: Current line number.
init_prefix: Part of the current line before the initial >.
Returns:
True if a matching bracket exists. | Find the corresponding < that started a template. | [
"Find",
"the",
"corresponding",
"<",
"that",
"started",
"a",
"template",
"."
] | def FindPreviousMatchingAngleBracket(clean_lines, linenum, init_prefix):
"""Find the corresponding < that started a template.
Args:
clean_lines: A CleansedLines instance containing the file.
linenum: Current line number.
init_prefix: Part of the current line before the initial >.
Returns:
True i... | [
"def",
"FindPreviousMatchingAngleBracket",
"(",
"clean_lines",
",",
"linenum",
",",
"init_prefix",
")",
":",
"line",
"=",
"init_prefix",
"nesting_stack",
"=",
"[",
"'>'",
"]",
"while",
"True",
":",
"# Find the previous operator",
"match",
"=",
"Search",
"(",
"r'^(... | https://github.com/eric612/Caffe-YOLOv3-Windows/blob/6736ca6e16781789b828cc64218ff77cc3454e5d/scripts/cpp_lint.py#L2590-L2644 | |
geemaple/leetcode | 68bc5032e1ee52c22ef2f2e608053484c487af54 | leetcode/207.course-schedule.py | python | Solution.canFinish | (self, numCourses, prerequisites) | return take == numCourses | :type numCourses: int
:type prerequisites: List[List[int]]
:rtype: bool | :type numCourses: int
:type prerequisites: List[List[int]]
:rtype: bool | [
":",
"type",
"numCourses",
":",
"int",
":",
"type",
"prerequisites",
":",
"List",
"[",
"List",
"[",
"int",
"]]",
":",
"rtype",
":",
"bool"
] | def canFinish(self, numCourses, prerequisites):
"""
:type numCourses: int
:type prerequisites: List[List[int]]
:rtype: bool
"""
indegree = {i:0 for i in range(numCourses)}
graph = {i:[] for i in range(numCourses)}
take = 0
for pair in prer... | [
"def",
"canFinish",
"(",
"self",
",",
"numCourses",
",",
"prerequisites",
")",
":",
"indegree",
"=",
"{",
"i",
":",
"0",
"for",
"i",
"in",
"range",
"(",
"numCourses",
")",
"}",
"graph",
"=",
"{",
"i",
":",
"[",
"]",
"for",
"i",
"in",
"range",
"("... | https://github.com/geemaple/leetcode/blob/68bc5032e1ee52c22ef2f2e608053484c487af54/leetcode/207.course-schedule.py#L2-L32 | |
ricardoquesada/Spidermonkey | 4a75ea2543408bd1b2c515aa95901523eeef7858 | python/mozbuild/mozpack/mozjar.py | python | JarWriter.__exit__ | (self, type, value, tb) | Context manager __exit__ method for JarWriter. | Context manager __exit__ method for JarWriter. | [
"Context",
"manager",
"__exit__",
"method",
"for",
"JarWriter",
"."
] | def __exit__(self, type, value, tb):
'''
Context manager __exit__ method for JarWriter.
'''
self.finish() | [
"def",
"__exit__",
"(",
"self",
",",
"type",
",",
"value",
",",
"tb",
")",
":",
"self",
".",
"finish",
"(",
")"
] | https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/python/mozbuild/mozpack/mozjar.py#L482-L486 | ||
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | deps/src/libxml2-2.9.1/python/libxml2.py | python | xmlNs.xpathNodeSetFreeNs | (self) | Namespace nodes in libxml don't match the XPath semantic.
In a node set the namespace nodes are duplicated and the
next pointer is set to the parent node in the XPath
semantic. Check if such a node needs to be freed | Namespace nodes in libxml don't match the XPath semantic.
In a node set the namespace nodes are duplicated and the
next pointer is set to the parent node in the XPath
semantic. Check if such a node needs to be freed | [
"Namespace",
"nodes",
"in",
"libxml",
"don",
"t",
"match",
"the",
"XPath",
"semantic",
".",
"In",
"a",
"node",
"set",
"the",
"namespace",
"nodes",
"are",
"duplicated",
"and",
"the",
"next",
"pointer",
"is",
"set",
"to",
"the",
"parent",
"node",
"in",
"th... | def xpathNodeSetFreeNs(self):
"""Namespace nodes in libxml don't match the XPath semantic.
In a node set the namespace nodes are duplicated and the
next pointer is set to the parent node in the XPath
semantic. Check if such a node needs to be freed """
libxml2mod.xmlXPathN... | [
"def",
"xpathNodeSetFreeNs",
"(",
"self",
")",
":",
"libxml2mod",
".",
"xmlXPathNodeSetFreeNs",
"(",
"self",
".",
"_o",
")"
] | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/deps/src/libxml2-2.9.1/python/libxml2.py#L6019-L6024 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py2/pandas/core/arrays/base.py | python | ExtensionArray.ndim | (self) | return 1 | Extension Arrays are only allowed to be 1-dimensional. | Extension Arrays are only allowed to be 1-dimensional. | [
"Extension",
"Arrays",
"are",
"only",
"allowed",
"to",
"be",
"1",
"-",
"dimensional",
"."
] | def ndim(self):
# type: () -> int
"""
Extension Arrays are only allowed to be 1-dimensional.
"""
return 1 | [
"def",
"ndim",
"(",
"self",
")",
":",
"# type: () -> int",
"return",
"1"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/core/arrays/base.py#L304-L309 | |
yuxng/PoseCNN | 9f3dd7b7bce21dcafc05e8f18ccc90da3caabd04 | lib/datasets/lov_single.py | python | lov_single.label_path_from_index | (self, index) | return label_path | Construct an metadata path from the image's "index" identifier. | Construct an metadata path from the image's "index" identifier. | [
"Construct",
"an",
"metadata",
"path",
"from",
"the",
"image",
"s",
"index",
"identifier",
"."
] | def label_path_from_index(self, index):
"""
Construct an metadata path from the image's "index" identifier.
"""
label_path = os.path.join(self._data_path, index + '-label' + self._image_ext)
assert os.path.exists(label_path), \
'Path does not exist: {}'.format(lab... | [
"def",
"label_path_from_index",
"(",
"self",
",",
"index",
")",
":",
"label_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"_data_path",
",",
"index",
"+",
"'-label'",
"+",
"self",
".",
"_image_ext",
")",
"assert",
"os",
".",
"path",
"."... | https://github.com/yuxng/PoseCNN/blob/9f3dd7b7bce21dcafc05e8f18ccc90da3caabd04/lib/datasets/lov_single.py#L112-L119 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemWebCommunicator/AWS/common-code/lib/AWSIoTPythonSDK/core/protocol/paho/client.py | python | Client.unsubscribe | (self, topic) | return self._send_unsubscribe(False, topic_list) | Unsubscribe the client from one or more topics.
topic: A single string, or list of strings that are the subscription
topics to unsubscribe from.
Returns a tuple (result, mid), where result is MQTT_ERR_SUCCESS
to indicate success or (MQTT_ERR_NO_CONN, None) if the client is not
... | Unsubscribe the client from one or more topics. | [
"Unsubscribe",
"the",
"client",
"from",
"one",
"or",
"more",
"topics",
"."
] | def unsubscribe(self, topic):
"""Unsubscribe the client from one or more topics.
topic: A single string, or list of strings that are the subscription
topics to unsubscribe from.
Returns a tuple (result, mid), where result is MQTT_ERR_SUCCESS
to indicate success or (MQTT_... | [
"def",
"unsubscribe",
"(",
"self",
",",
"topic",
")",
":",
"topic_list",
"=",
"None",
"if",
"topic",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"'Invalid topic.'",
")",
"if",
"isinstance",
"(",
"topic",
",",
"str",
")",
":",
"if",
"len",
"(",
"topi... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemWebCommunicator/AWS/common-code/lib/AWSIoTPythonSDK/core/protocol/paho/client.py#L1114-L1150 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/grit/grit/format/html_inline.py | python | InlineToString | (input_filename, grd_node, preprocess_only = False,
allow_external_script=False, strip_whitespace=False,
rewrite_function=None, filename_expansion_function=None) | Inlines the resources in a specified file and returns it as a string.
Args:
input_filename: name of file to read in
grd_node: html node from the grd file for this include tag
Returns:
the inlined data as a string | Inlines the resources in a specified file and returns it as a string. | [
"Inlines",
"the",
"resources",
"in",
"a",
"specified",
"file",
"and",
"returns",
"it",
"as",
"a",
"string",
"."
] | def InlineToString(input_filename, grd_node, preprocess_only = False,
allow_external_script=False, strip_whitespace=False,
rewrite_function=None, filename_expansion_function=None):
"""Inlines the resources in a specified file and returns it as a string.
Args:
input_filenam... | [
"def",
"InlineToString",
"(",
"input_filename",
",",
"grd_node",
",",
"preprocess_only",
"=",
"False",
",",
"allow_external_script",
"=",
"False",
",",
"strip_whitespace",
"=",
"False",
",",
"rewrite_function",
"=",
"None",
",",
"filename_expansion_function",
"=",
"... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/grit/grit/format/html_inline.py#L370-L392 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py2/pandas/compat/numpy/function.py | python | validate_argmin_with_skipna | (skipna, args, kwargs) | return skipna | If 'Series.argmin' is called via the 'numpy' library,
the third parameter in its signature is 'out', which
takes either an ndarray or 'None', so check if the
'skipna' parameter is either an instance of ndarray or
is None, since 'skipna' itself should be a boolean | If 'Series.argmin' is called via the 'numpy' library,
the third parameter in its signature is 'out', which
takes either an ndarray or 'None', so check if the
'skipna' parameter is either an instance of ndarray or
is None, since 'skipna' itself should be a boolean | [
"If",
"Series",
".",
"argmin",
"is",
"called",
"via",
"the",
"numpy",
"library",
"the",
"third",
"parameter",
"in",
"its",
"signature",
"is",
"out",
"which",
"takes",
"either",
"an",
"ndarray",
"or",
"None",
"so",
"check",
"if",
"the",
"skipna",
"parameter... | def validate_argmin_with_skipna(skipna, args, kwargs):
"""
If 'Series.argmin' is called via the 'numpy' library,
the third parameter in its signature is 'out', which
takes either an ndarray or 'None', so check if the
'skipna' parameter is either an instance of ndarray or
is None, since 'skipna' ... | [
"def",
"validate_argmin_with_skipna",
"(",
"skipna",
",",
"args",
",",
"kwargs",
")",
":",
"skipna",
",",
"args",
"=",
"process_skipna",
"(",
"skipna",
",",
"args",
")",
"validate_argmin",
"(",
"args",
",",
"kwargs",
")",
"return",
"skipna"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/compat/numpy/function.py#L77-L88 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/plan/kinetrajopt/kinetrajopt.py | python | KineTrajOpt.add_direction_constraint | (self, index, linkid, lcl_dir, world_dir) | Add constraint such that one link's local direction aligns with some world direction | Add constraint such that one link's local direction aligns with some world direction | [
"Add",
"constraint",
"such",
"that",
"one",
"link",
"s",
"local",
"direction",
"aligns",
"with",
"some",
"world",
"direction"
] | def add_direction_constraint(self, index, linkid, lcl_dir, world_dir):
"""Add constraint such that one link's local direction aligns with some world direction"""
self.constrs.add_eq(index, DirectionConstraint(self.robot, linkid, lcl_dir, world_dir)) | [
"def",
"add_direction_constraint",
"(",
"self",
",",
"index",
",",
"linkid",
",",
"lcl_dir",
",",
"world_dir",
")",
":",
"self",
".",
"constrs",
".",
"add_eq",
"(",
"index",
",",
"DirectionConstraint",
"(",
"self",
".",
"robot",
",",
"linkid",
",",
"lcl_di... | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/plan/kinetrajopt/kinetrajopt.py#L182-L184 | ||
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | tools/win/split_link/split_link.py | python | ExtractSubObjsTargetedAtAll | (
inputs,
num_parts,
description_parts,
description_all,
description_all_from_libs) | return by_parts | For (lib, obj) tuples in the all_from_libs section, extract the obj out of
the lib and added it to inputs. Returns a list of lists for which part the
extracted obj belongs in (which is whichever the .lib isn't in). | For (lib, obj) tuples in the all_from_libs section, extract the obj out of
the lib and added it to inputs. Returns a list of lists for which part the
extracted obj belongs in (which is whichever the .lib isn't in). | [
"For",
"(",
"lib",
"obj",
")",
"tuples",
"in",
"the",
"all_from_libs",
"section",
"extract",
"the",
"obj",
"out",
"of",
"the",
"lib",
"and",
"added",
"it",
"to",
"inputs",
".",
"Returns",
"a",
"list",
"of",
"lists",
"for",
"which",
"part",
"the",
"extr... | def ExtractSubObjsTargetedAtAll(
inputs,
num_parts,
description_parts,
description_all,
description_all_from_libs):
"""For (lib, obj) tuples in the all_from_libs section, extract the obj out of
the lib and added it to inputs. Returns a list of lists for which part the
extracted obj belongs in ... | [
"def",
"ExtractSubObjsTargetedAtAll",
"(",
"inputs",
",",
"num_parts",
",",
"description_parts",
",",
"description_all",
",",
"description_all_from_libs",
")",
":",
"by_parts",
"=",
"[",
"[",
"]",
"for",
"_",
"in",
"range",
"(",
"num_parts",
")",
"]",
"for",
"... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/tools/win/split_link/split_link.py#L306-L337 | |
vnpy/vnpy | f50f2535ed39dd33272e0985ed40c7078e4c19f6 | vnpy/rpc/__init__.py | python | RpcClient.on_disconnected | (self) | Callback when heartbeat is lost. | Callback when heartbeat is lost. | [
"Callback",
"when",
"heartbeat",
"is",
"lost",
"."
] | def on_disconnected(self):
"""
Callback when heartbeat is lost.
"""
print("RpcServer has no response over {tolerance} seconds, please check you connection."
.format(tolerance=KEEP_ALIVE_TOLERANCE.total_seconds())) | [
"def",
"on_disconnected",
"(",
"self",
")",
":",
"print",
"(",
"\"RpcServer has no response over {tolerance} seconds, please check you connection.\"",
".",
"format",
"(",
"tolerance",
"=",
"KEEP_ALIVE_TOLERANCE",
".",
"total_seconds",
"(",
")",
")",
")"
] | https://github.com/vnpy/vnpy/blob/f50f2535ed39dd33272e0985ed40c7078e4c19f6/vnpy/rpc/__init__.py#L377-L382 | ||
nasa/fprime | 595cf3682d8365943d86c1a6fe7c78f0a116acf0 | Autocoders/Python/src/fprime_ac/generators/StartEvent.py | python | StartEvent.accept | (self, visitor) | The operation in Visitor design pattern that takes a visitor as an argument
and calls the visitor's method that corresponds to this element.
@raise Exception: if the given visitor is not a subclass of AbstractVisitor | The operation in Visitor design pattern that takes a visitor as an argument
and calls the visitor's method that corresponds to this element. | [
"The",
"operation",
"in",
"Visitor",
"design",
"pattern",
"that",
"takes",
"a",
"visitor",
"as",
"an",
"argument",
"and",
"calls",
"the",
"visitor",
"s",
"method",
"that",
"corresponds",
"to",
"this",
"element",
"."
] | def accept(self, visitor):
"""
The operation in Visitor design pattern that takes a visitor as an argument
and calls the visitor's method that corresponds to this element.
@raise Exception: if the given visitor is not a subclass of AbstractVisitor
"""
# visitor should be ... | [
"def",
"accept",
"(",
"self",
",",
"visitor",
")",
":",
"# visitor should be extended from the AbstractVisitor class",
"if",
"issubclass",
"(",
"visitor",
".",
"__class__",
",",
"AbstractVisitor",
".",
"AbstractVisitor",
")",
":",
"visitor",
".",
"startEventVisit",
"(... | https://github.com/nasa/fprime/blob/595cf3682d8365943d86c1a6fe7c78f0a116acf0/Autocoders/Python/src/fprime_ac/generators/StartEvent.py#L69-L84 | ||
glotzerlab/hoomd-blue | f7f97abfa3fcc2522fa8d458d65d0aeca7ba781a | hoomd/md/compute.py | python | ThermodynamicQuantities.kinetic_temperature | (self) | return self._cpp_obj.kinetic_temperature | :math:`kT_k`, instantaneous thermal energy of the group \
:math:`[\\mathrm{energy}]`.
Calculated as:
.. math::
kT_k = 2 \\cdot \\frac{K}{N_{\\mathrm{dof}}} | :math:`kT_k`, instantaneous thermal energy of the group \
:math:`[\\mathrm{energy}]`. | [
":",
"math",
":",
"kT_k",
"instantaneous",
"thermal",
"energy",
"of",
"the",
"group",
"\\",
":",
"math",
":",
"[",
"\\\\",
"mathrm",
"{",
"energy",
"}",
"]",
"."
] | def kinetic_temperature(self):
""":math:`kT_k`, instantaneous thermal energy of the group \
:math:`[\\mathrm{energy}]`.
Calculated as:
.. math::
kT_k = 2 \\cdot \\frac{K}{N_{\\mathrm{dof}}}
"""
self._cpp_obj.compute(self._simulation.timestep)
retu... | [
"def",
"kinetic_temperature",
"(",
"self",
")",
":",
"self",
".",
"_cpp_obj",
".",
"compute",
"(",
"self",
".",
"_simulation",
".",
"timestep",
")",
"return",
"self",
".",
"_cpp_obj",
".",
"kinetic_temperature"
] | https://github.com/glotzerlab/hoomd-blue/blob/f7f97abfa3fcc2522fa8d458d65d0aeca7ba781a/hoomd/md/compute.py#L53-L64 | |
stellar-deprecated/stellard | 67eabb2217bdfa9a6ea317f62338fb6bca458c90 | src/protobuf/python/google/protobuf/internal/python_message.py | python | _DefaultValueConstructorForField | (field) | return MakeScalarDefault | Returns a function which returns a default value for a field.
Args:
field: FieldDescriptor object for this field.
The returned function has one argument:
message: Message instance containing this field, or a weakref proxy
of same.
That function in turn returns a default value for this field. The... | Returns a function which returns a default value for a field. | [
"Returns",
"a",
"function",
"which",
"returns",
"a",
"default",
"value",
"for",
"a",
"field",
"."
] | def _DefaultValueConstructorForField(field):
"""Returns a function which returns a default value for a field.
Args:
field: FieldDescriptor object for this field.
The returned function has one argument:
message: Message instance containing this field, or a weakref proxy
of same.
That function in... | [
"def",
"_DefaultValueConstructorForField",
"(",
"field",
")",
":",
"if",
"field",
".",
"label",
"==",
"_FieldDescriptor",
".",
"LABEL_REPEATED",
":",
"if",
"field",
".",
"has_default_value",
"and",
"field",
".",
"default_value",
"!=",
"[",
"]",
":",
"raise",
"... | https://github.com/stellar-deprecated/stellard/blob/67eabb2217bdfa9a6ea317f62338fb6bca458c90/src/protobuf/python/google/protobuf/internal/python_message.py#L248-L294 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | scripts/abins/abinsalgorithm.py | python | AbinsAlgorithm._check_folder_names | (message_end=None) | Checks folders names.
:param message_end: closing part of the error message. | Checks folders names.
:param message_end: closing part of the error message. | [
"Checks",
"folders",
"names",
".",
":",
"param",
"message_end",
":",
"closing",
"part",
"of",
"the",
"error",
"message",
"."
] | def _check_folder_names(message_end=None):
"""
Checks folders names.
:param message_end: closing part of the error message.
"""
folder_names = []
ab_initio_group = abins.parameters.hdf_groups['ab_initio_data']
if not isinstance(ab_initio_group, str) or ab_initio_g... | [
"def",
"_check_folder_names",
"(",
"message_end",
"=",
"None",
")",
":",
"folder_names",
"=",
"[",
"]",
"ab_initio_group",
"=",
"abins",
".",
"parameters",
".",
"hdf_groups",
"[",
"'ab_initio_data'",
"]",
"if",
"not",
"isinstance",
"(",
"ab_initio_group",
",",
... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/abins/abinsalgorithm.py#L808-L836 | ||
htcondor/htcondor | 4829724575176d1d6c936e4693dfd78a728569b0 | src/condor_contrib/condor_pigeon/src/condor_pigeon_client/skype_linux_tools/Skype4Py/skype.py | python | ISkype.ApiSecurityContextEnabled | (self, Context) | Queries if an API security context for Internet Explorer is enabled.
@param Context: API security context to check.
@type Context: unicode
@return: True if the API security for the given context is enabled, False elsewhere.
@rtype: bool
@warning: This functionality isn't suppor... | Queries if an API security context for Internet Explorer is enabled. | [
"Queries",
"if",
"an",
"API",
"security",
"context",
"for",
"Internet",
"Explorer",
"is",
"enabled",
"."
] | def ApiSecurityContextEnabled(self, Context):
'''Queries if an API security context for Internet Explorer is enabled.
@param Context: API security context to check.
@type Context: unicode
@return: True if the API security for the given context is enabled, False elsewhere.
@rtype... | [
"def",
"ApiSecurityContextEnabled",
"(",
"self",
",",
"Context",
")",
":",
"self",
".",
"_API",
".",
"ApiSecurityContextEnabled",
"(",
"Context",
")"
] | https://github.com/htcondor/htcondor/blob/4829724575176d1d6c936e4693dfd78a728569b0/src/condor_contrib/condor_pigeon/src/condor_pigeon_client/skype_linux_tools/Skype4Py/skype.py#L423-L433 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/webapp2/webapp2.py | python | Response._set_status | (self, value) | The status string, including code and message. | The status string, including code and message. | [
"The",
"status",
"string",
"including",
"code",
"and",
"message",
"."
] | def _set_status(self, value):
"""The status string, including code and message."""
message = None
# Accept long because urlfetch in App Engine returns codes as longs.
if isinstance(value, (int, long)):
code = int(value)
else:
if isinstance(value, unicode):... | [
"def",
"_set_status",
"(",
"self",
",",
"value",
")",
":",
"message",
"=",
"None",
"# Accept long because urlfetch in App Engine returns codes as longs.",
"if",
"isinstance",
"(",
"value",
",",
"(",
"int",
",",
"long",
")",
")",
":",
"code",
"=",
"int",
"(",
"... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/webapp2/webapp2.py#L384-L406 | ||
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Node/__init__.py | python | Walker.get_next | (self) | return None | Return the next node for this walk of the tree.
This function is intentionally iterative, not recursive,
to sidestep any issues of stack size limitations. | Return the next node for this walk of the tree. | [
"Return",
"the",
"next",
"node",
"for",
"this",
"walk",
"of",
"the",
"tree",
"."
] | def get_next(self):
"""Return the next node for this walk of the tree.
This function is intentionally iterative, not recursive,
to sidestep any issues of stack size limitations.
"""
while self.stack:
if self.stack[-1].wkids:
node = self.stack[-1].wki... | [
"def",
"get_next",
"(",
"self",
")",
":",
"while",
"self",
".",
"stack",
":",
"if",
"self",
".",
"stack",
"[",
"-",
"1",
"]",
".",
"wkids",
":",
"node",
"=",
"self",
".",
"stack",
"[",
"-",
"1",
"]",
".",
"wkids",
".",
"pop",
"(",
"0",
")",
... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Node/__init__.py#L1740-L1768 | |
google/iree | 1224bbdbe65b0d1fdf40e7324f60f68beeaf7c76 | build_tools/benchmarks/common/benchmark_definition.py | python | get_android_device_model | (verbose: bool = False) | return model | Returns the Android device model. | Returns the Android device model. | [
"Returns",
"the",
"Android",
"device",
"model",
"."
] | def get_android_device_model(verbose: bool = False) -> str:
"""Returns the Android device model."""
model = execute_cmd_and_get_output(
["adb", "shell", "getprop", "ro.product.model"], verbose=verbose)
model = re.sub(r"\W+", "-", model)
return model | [
"def",
"get_android_device_model",
"(",
"verbose",
":",
"bool",
"=",
"False",
")",
"->",
"str",
":",
"model",
"=",
"execute_cmd_and_get_output",
"(",
"[",
"\"adb\"",
",",
"\"shell\"",
",",
"\"getprop\"",
",",
"\"ro.product.model\"",
"]",
",",
"verbose",
"=",
"... | https://github.com/google/iree/blob/1224bbdbe65b0d1fdf40e7324f60f68beeaf7c76/build_tools/benchmarks/common/benchmark_definition.py#L69-L74 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/build/waf-1.7.13/waflib/Tools/fc_config.py | python | getoutput | (conf, cmd, stdin=False) | return (out, err) | TODO a bit redundant, can be removed anytime | TODO a bit redundant, can be removed anytime | [
"TODO",
"a",
"bit",
"redundant",
"can",
"be",
"removed",
"anytime"
] | def getoutput(conf, cmd, stdin=False):
"""
TODO a bit redundant, can be removed anytime
"""
if stdin:
stdin = Utils.subprocess.PIPE
else:
stdin = None
env = conf.env.env or None
try:
p = Utils.subprocess.Popen(cmd, stdin=stdin, stdout=Utils.subprocess.PIPE, stderr=Utils.subprocess.PIPE, env=env)
if stdin... | [
"def",
"getoutput",
"(",
"conf",
",",
"cmd",
",",
"stdin",
"=",
"False",
")",
":",
"if",
"stdin",
":",
"stdin",
"=",
"Utils",
".",
"subprocess",
".",
"PIPE",
"else",
":",
"stdin",
"=",
"None",
"env",
"=",
"conf",
".",
"env",
".",
"env",
"or",
"No... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/build/waf-1.7.13/waflib/Tools/fc_config.py#L333-L353 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/python_gflags/gflags.py | python | FlagValues.ModuleHelp | (self, module) | return '\n'.join(helplist) | Describe the key flags of a module.
Args:
module: A module object or a module name (a string).
Returns:
string describing the key flags of a module. | Describe the key flags of a module. | [
"Describe",
"the",
"key",
"flags",
"of",
"a",
"module",
"."
] | def ModuleHelp(self, module):
"""Describe the key flags of a module.
Args:
module: A module object or a module name (a string).
Returns:
string describing the key flags of a module.
"""
helplist = []
self.__RenderOurModuleKeyFlags(module, helplist)
return '\n'.join(helplist) | [
"def",
"ModuleHelp",
"(",
"self",
",",
"module",
")",
":",
"helplist",
"=",
"[",
"]",
"self",
".",
"__RenderOurModuleKeyFlags",
"(",
"module",
",",
"helplist",
")",
"return",
"'\\n'",
".",
"join",
"(",
"helplist",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/python_gflags/gflags.py#L1415-L1426 | |
stratum/stratum | b44ac444a64b6585e90ba8e9e19fce1fc75852dd | stratum/hal/bin/np4intel/docker/scripts/build_pipeline_configs.py | python | build_device_config | (filename) | return dev_config | Builds P4 Device Config data | Builds P4 Device Config data | [
"Builds",
"P4",
"Device",
"Config",
"data"
] | def build_device_config(filename):
"""Builds P4 Device Config data"""
dev_config = p4_device_config_pb2.P4DeviceConfig()
with open(filename, "r") as f:
file_content = f.read()
text_format.Parse(file_content, dev_config)
return dev_config | [
"def",
"build_device_config",
"(",
"filename",
")",
":",
"dev_config",
"=",
"p4_device_config_pb2",
".",
"P4DeviceConfig",
"(",
")",
"with",
"open",
"(",
"filename",
",",
"\"r\"",
")",
"as",
"f",
":",
"file_content",
"=",
"f",
".",
"read",
"(",
")",
"text_... | https://github.com/stratum/stratum/blob/b44ac444a64b6585e90ba8e9e19fce1fc75852dd/stratum/hal/bin/np4intel/docker/scripts/build_pipeline_configs.py#L37-L44 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/ros/roslib/src/roslib/network.py | python | encode_ros_handshake_header | (header) | Encode ROS handshake header as a byte string. Each header
field is a string key value pair. The encoded header is
prefixed by a length field, as is each field key/value pair.
key/value pairs a separated by a '=' equals sign.
FORMAT: (4-byte length + [4-byte field length + field=value ]*)
@param he... | Encode ROS handshake header as a byte string. Each header
field is a string key value pair. The encoded header is
prefixed by a length field, as is each field key/value pair.
key/value pairs a separated by a '=' equals sign. | [
"Encode",
"ROS",
"handshake",
"header",
"as",
"a",
"byte",
"string",
".",
"Each",
"header",
"field",
"is",
"a",
"string",
"key",
"value",
"pair",
".",
"The",
"encoded",
"header",
"is",
"prefixed",
"by",
"a",
"length",
"field",
"as",
"is",
"each",
"field"... | def encode_ros_handshake_header(header):
"""
Encode ROS handshake header as a byte string. Each header
field is a string key value pair. The encoded header is
prefixed by a length field, as is each field key/value pair.
key/value pairs a separated by a '=' equals sign.
FORMAT: (4-byte length + ... | [
"def",
"encode_ros_handshake_header",
"(",
"header",
")",
":",
"fields",
"=",
"[",
"\"%s=%s\"",
"%",
"(",
"k",
",",
"v",
")",
"for",
"k",
",",
"v",
"in",
"header",
".",
"items",
"(",
")",
"]",
"# in the usual configuration, the error 'TypeError: can't concat byt... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/ros/roslib/src/roslib/network.py#L358-L382 | ||
metashell/metashell | f4177e4854ea00c8dbc722cadab26ef413d798ea | tools/list/dependencies.py | python | reachable_in_two_steps | (graph, src) | return list(sorted(result)) | Returns the list of nodes reachable from src in at most two steps | Returns the list of nodes reachable from src in at most two steps | [
"Returns",
"the",
"list",
"of",
"nodes",
"reachable",
"from",
"src",
"in",
"at",
"most",
"two",
"steps"
] | def reachable_in_two_steps(graph, src):
"""Returns the list of nodes reachable from src in at most two steps"""
dsts = graph.get(src, [])
result = set(dsts)
for dst in dsts:
result.update(graph.get(dst, []))
return list(sorted(result)) | [
"def",
"reachable_in_two_steps",
"(",
"graph",
",",
"src",
")",
":",
"dsts",
"=",
"graph",
".",
"get",
"(",
"src",
",",
"[",
"]",
")",
"result",
"=",
"set",
"(",
"dsts",
")",
"for",
"dst",
"in",
"dsts",
":",
"result",
".",
"update",
"(",
"graph",
... | https://github.com/metashell/metashell/blob/f4177e4854ea00c8dbc722cadab26ef413d798ea/tools/list/dependencies.py#L230-L236 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/asyncio/sslproto.py | python | _SSLProtocolTransport.set_write_buffer_limits | (self, high=None, low=None) | Set the high- and low-water limits for write flow control.
These two values control when to call the protocol's
pause_writing() and resume_writing() methods. If specified,
the low-water limit must be less than or equal to the
high-water limit. Neither value can be negative.
T... | Set the high- and low-water limits for write flow control. | [
"Set",
"the",
"high",
"-",
"and",
"low",
"-",
"water",
"limits",
"for",
"write",
"flow",
"control",
"."
] | def set_write_buffer_limits(self, high=None, low=None):
"""Set the high- and low-water limits for write flow control.
These two values control when to call the protocol's
pause_writing() and resume_writing() methods. If specified,
the low-water limit must be less than or equal to the
... | [
"def",
"set_write_buffer_limits",
"(",
"self",
",",
"high",
"=",
"None",
",",
"low",
"=",
"None",
")",
":",
"self",
".",
"_ssl_protocol",
".",
"_transport",
".",
"set_write_buffer_limits",
"(",
"high",
",",
"low",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/asyncio/sslproto.py#L345-L364 | ||
generalized-intelligence/GAAS | 29ab17d3e8a4ba18edef3a57c36d8db6329fac73 | algorithms/src/LocalizationAndMapping/icp_lidar_localization/fast_gicp/thirdparty/pybind11/pybind11/setup_helpers.py | python | Pybind11Extension.cxx_std | (self) | return self._cxx_level | The CXX standard level. If set, will add the required flags. If left
at 0, it will trigger an automatic search when pybind11's build_ext
is used. If None, will have no effect. Besides just the flags, this
may add a register warning/error fix for Python 2 or macos-min 10.9
or 10.14. | The CXX standard level. If set, will add the required flags. If left
at 0, it will trigger an automatic search when pybind11's build_ext
is used. If None, will have no effect. Besides just the flags, this
may add a register warning/error fix for Python 2 or macos-min 10.9
or 10.14. | [
"The",
"CXX",
"standard",
"level",
".",
"If",
"set",
"will",
"add",
"the",
"required",
"flags",
".",
"If",
"left",
"at",
"0",
"it",
"will",
"trigger",
"an",
"automatic",
"search",
"when",
"pybind11",
"s",
"build_ext",
"is",
"used",
".",
"If",
"None",
"... | def cxx_std(self):
"""
The CXX standard level. If set, will add the required flags. If left
at 0, it will trigger an automatic search when pybind11's build_ext
is used. If None, will have no effect. Besides just the flags, this
may add a register warning/error fix for Python 2 o... | [
"def",
"cxx_std",
"(",
"self",
")",
":",
"return",
"self",
".",
"_cxx_level"
] | https://github.com/generalized-intelligence/GAAS/blob/29ab17d3e8a4ba18edef3a57c36d8db6329fac73/algorithms/src/LocalizationAndMapping/icp_lidar_localization/fast_gicp/thirdparty/pybind11/pybind11/setup_helpers.py#L154-L162 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/cmake/tools/create_def_file.py | python | main | () | return 0 | main. | main. | [
"main",
"."
] | def main():
"""main."""
args = get_args()
# Pipe dumpbin to extract all linkable symbols from libs.
# Good symbols are collected in candidates and also written to
# a temp file.
candidates = []
tmpfile = tempfile.NamedTemporaryFile(mode="w", delete=False)
for lib_path in args.input:
proc = subproce... | [
"def",
"main",
"(",
")",
":",
"args",
"=",
"get_args",
"(",
")",
"# Pipe dumpbin to extract all linkable symbols from libs.",
"# Good symbols are collected in candidates and also written to",
"# a temp file.",
"candidates",
"=",
"[",
"]",
"tmpfile",
"=",
"tempfile",
".",
"N... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/cmake/tools/create_def_file.py#L92-L165 | |
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | python/mxnet/gluon/block.py | python | Block.params | (self) | return self._params | Returns this :py:class:`Block`'s parameter dictionary (does not include its
children's parameters). | Returns this :py:class:`Block`'s parameter dictionary (does not include its
children's parameters). | [
"Returns",
"this",
":",
"py",
":",
"class",
":",
"Block",
"s",
"parameter",
"dictionary",
"(",
"does",
"not",
"include",
"its",
"children",
"s",
"parameters",
")",
"."
] | def params(self):
"""Returns this :py:class:`Block`'s parameter dictionary (does not include its
children's parameters)."""
return self._params | [
"def",
"params",
"(",
"self",
")",
":",
"return",
"self",
".",
"_params"
] | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/python/mxnet/gluon/block.py#L268-L271 | |
Kitware/VTK | 5b4df4d90a4f31194d97d3c639dd38ea8f81e8b8 | Wrapping/Python/vtkmodules/numpy_interface/dataset_adapter.py | python | CompositeDataSet.GetAttributes | (self, type) | return CompositeDataSetAttributes(self, type) | Returns the attributes specified by the type as a
CompositeDataSetAttributes instance. | Returns the attributes specified by the type as a
CompositeDataSetAttributes instance. | [
"Returns",
"the",
"attributes",
"specified",
"by",
"the",
"type",
"as",
"a",
"CompositeDataSetAttributes",
"instance",
"."
] | def GetAttributes(self, type):
"""Returns the attributes specified by the type as a
CompositeDataSetAttributes instance."""
return CompositeDataSetAttributes(self, type) | [
"def",
"GetAttributes",
"(",
"self",
",",
"type",
")",
":",
"return",
"CompositeDataSetAttributes",
"(",
"self",
",",
"type",
")"
] | https://github.com/Kitware/VTK/blob/5b4df4d90a4f31194d97d3c639dd38ea8f81e8b8/Wrapping/Python/vtkmodules/numpy_interface/dataset_adapter.py#L963-L966 | |
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Arch/ArchSite.py | python | makeSite | (objectslist=None,baseobj=None,name="Site") | return obj | makeBuilding(objectslist): creates a site including the
objects from the given list. | makeBuilding(objectslist): creates a site including the
objects from the given list. | [
"makeBuilding",
"(",
"objectslist",
")",
":",
"creates",
"a",
"site",
"including",
"the",
"objects",
"from",
"the",
"given",
"list",
"."
] | def makeSite(objectslist=None,baseobj=None,name="Site"):
'''makeBuilding(objectslist): creates a site including the
objects from the given list.'''
if not FreeCAD.ActiveDocument:
FreeCAD.Console.PrintError("No active document. Aborting\n")
return
import Part
obj = FreeCAD.ActiveDoc... | [
"def",
"makeSite",
"(",
"objectslist",
"=",
"None",
",",
"baseobj",
"=",
"None",
",",
"name",
"=",
"\"Site\"",
")",
":",
"if",
"not",
"FreeCAD",
".",
"ActiveDocument",
":",
"FreeCAD",
".",
"Console",
".",
"PrintError",
"(",
"\"No active document. Aborting\\n\"... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Arch/ArchSite.py#L53-L75 | |
Polidea/SiriusObfuscator | b0e590d8130e97856afe578869b83a209e2b19be | SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py | python | SBTypeSummaryOptions.GetLanguage | (self) | return _lldb.SBTypeSummaryOptions_GetLanguage(self) | GetLanguage(self) -> LanguageType | GetLanguage(self) -> LanguageType | [
"GetLanguage",
"(",
"self",
")",
"-",
">",
"LanguageType"
] | def GetLanguage(self):
"""GetLanguage(self) -> LanguageType"""
return _lldb.SBTypeSummaryOptions_GetLanguage(self) | [
"def",
"GetLanguage",
"(",
"self",
")",
":",
"return",
"_lldb",
".",
"SBTypeSummaryOptions_GetLanguage",
"(",
"self",
")"
] | https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py#L11364-L11366 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/ops/_op_impl/aicpu/meshgrid.py | python | _meshgrid_aicpu | () | return | Meshgrid AiCPU register | Meshgrid AiCPU register | [
"Meshgrid",
"AiCPU",
"register"
] | def _meshgrid_aicpu():
"""Meshgrid AiCPU register"""
return | [
"def",
"_meshgrid_aicpu",
"(",
")",
":",
"return"
] | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/ops/_op_impl/aicpu/meshgrid.py#L39-L41 | |
coinapi/coinapi-sdk | 854f21e7f69ea8599ae35c5403565cf299d8b795 | oeml-sdk/python/openapi_client/model/balances.py | python | Balances.__init__ | (self, *args, **kwargs) | Balances - a model defined in OpenAPI
Note that value can be passed either in args or in kwargs, but not in both.
Args:
args[0] ([Balance]): Collection of the balances.. # noqa: E501
Keyword Args:
value ([Balance]): Collection of the balances.. # noqa: E501
... | Balances - a model defined in OpenAPI | [
"Balances",
"-",
"a",
"model",
"defined",
"in",
"OpenAPI"
] | def __init__(self, *args, **kwargs):
"""Balances - a model defined in OpenAPI
Note that value can be passed either in args or in kwargs, but not in both.
Args:
args[0] ([Balance]): Collection of the balances.. # noqa: E501
Keyword Args:
value ([Balance]): Coll... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# required up here when default value is not given",
"_path_to_item",
"=",
"kwargs",
".",
"pop",
"(",
"'_path_to_item'",
",",
"(",
")",
")",
"if",
"'value'",
"in",
"kwargs",
... | https://github.com/coinapi/coinapi-sdk/blob/854f21e7f69ea8599ae35c5403565cf299d8b795/oeml-sdk/python/openapi_client/model/balances.py#L104-L190 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/asyncio/base_events.py | python | BaseEventLoop.create_server | (
self, protocol_factory, host=None, port=None,
*,
family=socket.AF_UNSPEC,
flags=socket.AI_PASSIVE,
sock=None,
backlog=100,
ssl=None,
reuse_address=None,
reuse_port=None,
ssl_handshake_timeout=None,
... | return server | Create a TCP server.
The host parameter can be a string, in that case the TCP server is
bound to host and port.
The host parameter can also be a sequence of strings and in that case
the TCP server is bound to all hosts of the sequence. If a host
appears multiple times (possibly... | Create a TCP server. | [
"Create",
"a",
"TCP",
"server",
"."
] | async def create_server(
self, protocol_factory, host=None, port=None,
*,
family=socket.AF_UNSPEC,
flags=socket.AI_PASSIVE,
sock=None,
backlog=100,
ssl=None,
reuse_address=None,
reuse_port=None,
ssl_h... | [
"async",
"def",
"create_server",
"(",
"self",
",",
"protocol_factory",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"*",
",",
"family",
"=",
"socket",
".",
"AF_UNSPEC",
",",
"flags",
"=",
"socket",
".",
"AI_PASSIVE",
",",
"sock",
"=",
"None... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/asyncio/base_events.py#L1300-L1415 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/training/session_manager.py | python | SessionManager.prepare_session | (self,
master,
init_op=None,
saver=None,
checkpoint_dir=None,
checkpoint_filename_with_path=None,
wait_for_checkpoint=False,
max_wait_secs=7200,
... | return sess | Creates a `Session`. Makes sure the model is ready to be used.
Creates a `Session` on 'master'. If a `saver` object is passed in, and
`checkpoint_dir` points to a directory containing valid checkpoint
files, then it will try to recover the model from checkpoint. If
no checkpoint files are available, an... | Creates a `Session`. Makes sure the model is ready to be used. | [
"Creates",
"a",
"Session",
".",
"Makes",
"sure",
"the",
"model",
"is",
"ready",
"to",
"be",
"used",
"."
] | def prepare_session(self,
master,
init_op=None,
saver=None,
checkpoint_dir=None,
checkpoint_filename_with_path=None,
wait_for_checkpoint=False,
max_wait_secs=7200,
... | [
"def",
"prepare_session",
"(",
"self",
",",
"master",
",",
"init_op",
"=",
"None",
",",
"saver",
"=",
"None",
",",
"checkpoint_dir",
"=",
"None",
",",
"checkpoint_filename_with_path",
"=",
"None",
",",
"wait_for_checkpoint",
"=",
"False",
",",
"max_wait_secs",
... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/training/session_manager.py#L209-L297 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/_config/config.py | python | _select_options | (pat) | return [k for k in keys if re.search(pat, k, re.I)] | returns a list of keys matching `pat`
if pat=="all", returns all registered options | returns a list of keys matching `pat` | [
"returns",
"a",
"list",
"of",
"keys",
"matching",
"pat"
] | def _select_options(pat):
"""returns a list of keys matching `pat`
if pat=="all", returns all registered options
"""
# short-circuit for exact key
if pat in _registered_options:
return [pat]
# else look through all of them
keys = sorted(_registered_options.keys())
if pat == "a... | [
"def",
"_select_options",
"(",
"pat",
")",
":",
"# short-circuit for exact key",
"if",
"pat",
"in",
"_registered_options",
":",
"return",
"[",
"pat",
"]",
"# else look through all of them",
"keys",
"=",
"sorted",
"(",
"_registered_options",
".",
"keys",
"(",
")",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/_config/config.py#L533-L548 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/asyncio/futures.py | python | Future.__schedule_callbacks | (self) | Internal: Ask the event loop to call all callbacks.
The callbacks are scheduled to be called as soon as possible. Also
clears the callback list. | Internal: Ask the event loop to call all callbacks. | [
"Internal",
":",
"Ask",
"the",
"event",
"loop",
"to",
"call",
"all",
"callbacks",
"."
] | def __schedule_callbacks(self):
"""Internal: Ask the event loop to call all callbacks.
The callbacks are scheduled to be called as soon as possible. Also
clears the callback list.
"""
callbacks = self._callbacks[:]
if not callbacks:
return
self._call... | [
"def",
"__schedule_callbacks",
"(",
"self",
")",
":",
"callbacks",
"=",
"self",
".",
"_callbacks",
"[",
":",
"]",
"if",
"not",
"callbacks",
":",
"return",
"self",
".",
"_callbacks",
"[",
":",
"]",
"=",
"[",
"]",
"for",
"callback",
",",
"ctx",
"in",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/asyncio/futures.py#L159-L171 | ||
epam/Indigo | 30e40b4b1eb9bae0207435a26cfcb81ddcc42be1 | api/python/indigo/__init__.py | python | IndigoObject.check3DStereo | (self) | return self.dispatcher._checkResult(
Indigo._lib.indigoCheck3DStereo(self.id)
) | Molecule method verifies if the structure contains 3d stereo
Returns:
int: 1 if structure contains 3d stereo, 0 otherwise | Molecule method verifies if the structure contains 3d stereo | [
"Molecule",
"method",
"verifies",
"if",
"the",
"structure",
"contains",
"3d",
"stereo"
] | def check3DStereo(self):
"""Molecule method verifies if the structure contains 3d stereo
Returns:
int: 1 if structure contains 3d stereo, 0 otherwise
"""
self.dispatcher._setSessionId()
return self.dispatcher._checkResult(
Indigo._lib.indigoCheck3DStereo(... | [
"def",
"check3DStereo",
"(",
"self",
")",
":",
"self",
".",
"dispatcher",
".",
"_setSessionId",
"(",
")",
"return",
"self",
".",
"dispatcher",
".",
"_checkResult",
"(",
"Indigo",
".",
"_lib",
".",
"indigoCheck3DStereo",
"(",
"self",
".",
"id",
")",
")"
] | https://github.com/epam/Indigo/blob/30e40b4b1eb9bae0207435a26cfcb81ddcc42be1/api/python/indigo/__init__.py#L1225-L1234 | |
baidu/AnyQ | d94d450d2aaa5f7ed73424b10aa4539835b97527 | tools/simnet/train/paddle/losses/softmax_cross_entropy_loss.py | python | SoftmaxCrossEntropyLoss.compute | (self, input, label) | return avg_cost | compute loss | compute loss | [
"compute",
"loss"
] | def compute(self, input, label):
"""
compute loss
"""
reduce_mean = layers.ReduceMeanLayer()
cost = fluid.layers.cross_entropy(input=input, label=label)
avg_cost = reduce_mean.ops(cost)
return avg_cost | [
"def",
"compute",
"(",
"self",
",",
"input",
",",
"label",
")",
":",
"reduce_mean",
"=",
"layers",
".",
"ReduceMeanLayer",
"(",
")",
"cost",
"=",
"fluid",
".",
"layers",
".",
"cross_entropy",
"(",
"input",
"=",
"input",
",",
"label",
"=",
"label",
")",... | https://github.com/baidu/AnyQ/blob/d94d450d2aaa5f7ed73424b10aa4539835b97527/tools/simnet/train/paddle/losses/softmax_cross_entropy_loss.py#L31-L38 | |
gem5/gem5 | 141cc37c2d4b93959d4c249b8f7e6a8b2ef75338 | ext/ply/example/ansic/cparse.py | python | p_direct_abstract_declarator_4 | (t) | direct_abstract_declarator : direct_abstract_declarator LPAREN parameter_type_list_opt RPAREN | direct_abstract_declarator : direct_abstract_declarator LPAREN parameter_type_list_opt RPAREN | [
"direct_abstract_declarator",
":",
"direct_abstract_declarator",
"LPAREN",
"parameter_type_list_opt",
"RPAREN"
] | def p_direct_abstract_declarator_4(t):
'direct_abstract_declarator : direct_abstract_declarator LPAREN parameter_type_list_opt RPAREN'
pass | [
"def",
"p_direct_abstract_declarator_4",
"(",
"t",
")",
":",
"pass"
] | https://github.com/gem5/gem5/blob/141cc37c2d4b93959d4c249b8f7e6a8b2ef75338/ext/ply/example/ansic/cparse.py#L425-L427 | ||
dicecco1/fpga_caffe | 7a191704efd7873071cfef35772d7e7bf3e3cfd6 | scripts/cpp_lint.py | python | _CppLintState.SetOutputFormat | (self, output_format) | Sets the output format for errors. | Sets the output format for errors. | [
"Sets",
"the",
"output",
"format",
"for",
"errors",
"."
] | def SetOutputFormat(self, output_format):
"""Sets the output format for errors."""
self.output_format = output_format | [
"def",
"SetOutputFormat",
"(",
"self",
",",
"output_format",
")",
":",
"self",
".",
"output_format",
"=",
"output_format"
] | https://github.com/dicecco1/fpga_caffe/blob/7a191704efd7873071cfef35772d7e7bf3e3cfd6/scripts/cpp_lint.py#L707-L709 | ||
GeometryCollective/boundary-first-flattening | 8250e5a0e85980ec50b5e8aa8f49dd6519f915cd | deps/nanogui/ext/pybind11/tools/clang/cindex.py | python | TranslationUnit.__init__ | (self, ptr, index) | Create a TranslationUnit instance.
TranslationUnits should be created using one of the from_* @classmethod
functions above. __init__ is only called internally. | Create a TranslationUnit instance. | [
"Create",
"a",
"TranslationUnit",
"instance",
"."
] | def __init__(self, ptr, index):
"""Create a TranslationUnit instance.
TranslationUnits should be created using one of the from_* @classmethod
functions above. __init__ is only called internally.
"""
assert isinstance(index, Index)
self.index = index
ClangObject._... | [
"def",
"__init__",
"(",
"self",
",",
"ptr",
",",
"index",
")",
":",
"assert",
"isinstance",
"(",
"index",
",",
"Index",
")",
"self",
".",
"index",
"=",
"index",
"ClangObject",
".",
"__init__",
"(",
"self",
",",
"ptr",
")"
] | https://github.com/GeometryCollective/boundary-first-flattening/blob/8250e5a0e85980ec50b5e8aa8f49dd6519f915cd/deps/nanogui/ext/pybind11/tools/clang/cindex.py#L2437-L2445 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/urllib3/fields.py | python | RequestField._render_parts | (self, header_parts) | return u"; ".join(parts) | Helper function to format and quote a single header.
Useful for single headers that are composed of multiple items. E.g.,
'Content-Disposition' fields.
:param header_parts:
A sequence of (k, v) tuples or a :class:`dict` of (k, v) to format
as `k1="v1"; k2="v2"; ...`. | Helper function to format and quote a single header. | [
"Helper",
"function",
"to",
"format",
"and",
"quote",
"a",
"single",
"header",
"."
] | def _render_parts(self, header_parts):
"""
Helper function to format and quote a single header.
Useful for single headers that are composed of multiple items. E.g.,
'Content-Disposition' fields.
:param header_parts:
A sequence of (k, v) tuples or a :class:`dict` of ... | [
"def",
"_render_parts",
"(",
"self",
",",
"header_parts",
")",
":",
"parts",
"=",
"[",
"]",
"iterable",
"=",
"header_parts",
"if",
"isinstance",
"(",
"header_parts",
",",
"dict",
")",
":",
"iterable",
"=",
"header_parts",
".",
"items",
"(",
")",
"for",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/urllib3/fields.py#L208-L228 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/numbers.py | python | Real.__trunc__ | (self) | trunc(self): Truncates self to an Integral.
Returns an Integral i such that:
* i>0 iff self>0;
* abs(i) <= abs(self);
* for any Integral j satisfying the first two conditions,
abs(i) >= abs(j) [i.e. i has "maximal" abs among those].
i.e. "truncate towards 0". | trunc(self): Truncates self to an Integral. | [
"trunc",
"(",
"self",
")",
":",
"Truncates",
"self",
"to",
"an",
"Integral",
"."
] | def __trunc__(self):
"""trunc(self): Truncates self to an Integral.
Returns an Integral i such that:
* i>0 iff self>0;
* abs(i) <= abs(self);
* for any Integral j satisfying the first two conditions,
abs(i) >= abs(j) [i.e. i has "maximal" abs among those].
... | [
"def",
"__trunc__",
"(",
"self",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/numbers.py#L188-L198 | ||
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/python/training/saver.py | python | Saver.last_checkpoints | (self) | return list(self._CheckpointFilename(p) for p in self._last_checkpoints) | List of not-yet-deleted checkpoint filenames.
You can pass any of the returned values to `restore()`.
Returns:
A list of checkpoint filenames, sorted from oldest to newest. | List of not-yet-deleted checkpoint filenames. | [
"List",
"of",
"not",
"-",
"yet",
"-",
"deleted",
"checkpoint",
"filenames",
"."
] | def last_checkpoints(self):
"""List of not-yet-deleted checkpoint filenames.
You can pass any of the returned values to `restore()`.
Returns:
A list of checkpoint filenames, sorted from oldest to newest.
"""
return list(self._CheckpointFilename(p) for p in self._last_checkpoints) | [
"def",
"last_checkpoints",
"(",
"self",
")",
":",
"return",
"list",
"(",
"self",
".",
"_CheckpointFilename",
"(",
"p",
")",
"for",
"p",
"in",
"self",
".",
"_last_checkpoints",
")"
] | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/python/training/saver.py#L973-L981 | |
SequoiaDB/SequoiaDB | 2894ed7e5bd6fe57330afc900cf76d0ff0df9f64 | driver/python/pysequoiadb/client.py | python | client.eval_procedure | (self, name) | return result | Eval a func.
Parameters:
Name Type Info:
name str The name of store procedure.
Return values:
cursor object of current eval.
Exceptions:
pysequoiadb.error.SDBBaseError | Eval a func. | [
"Eval",
"a",
"func",
"."
] | def eval_procedure(self, name):
"""Eval a func.
Parameters:
Name Type Info:
name str The name of store procedure.
Return values:
cursor object of current eval.
Exceptions:
pysequoiadb.error.SDBBaseError
"""
... | [
"def",
"eval_procedure",
"(",
"self",
",",
"name",
")",
":",
"if",
"not",
"isinstance",
"(",
"name",
",",
"str_type",
")",
":",
"raise",
"SDBTypeError",
"(",
"\"code must be an instance of str_type\"",
")",
"result",
"=",
"cursor",
"(",
")",
"try",
":",
"rc"... | https://github.com/SequoiaDB/SequoiaDB/blob/2894ed7e5bd6fe57330afc900cf76d0ff0df9f64/driver/python/pysequoiadb/client.py#L1138-L1163 | |
hfinkel/llvm-project-cxxjit | 91084ef018240bbb8e24235ff5cd8c355a9c1a1e | compiler-rt/lib/sanitizer_common/scripts/cpplint.py | python | IsCppString | (line) | return ((line.count('"') - line.count(r'\"') - line.count("'\"'")) & 1) == 1 | Does line terminate so, that the next symbol is in string constant.
This function does not consider single-line nor multi-line comments.
Args:
line: is a partial line of code starting from the 0..n.
Returns:
True, if next character appended to 'line' is inside a
string constant. | Does line terminate so, that the next symbol is in string constant. | [
"Does",
"line",
"terminate",
"so",
"that",
"the",
"next",
"symbol",
"is",
"in",
"string",
"constant",
"."
] | def IsCppString(line):
"""Does line terminate so, that the next symbol is in string constant.
This function does not consider single-line nor multi-line comments.
Args:
line: is a partial line of code starting from the 0..n.
Returns:
True, if next character appended to 'line' is inside a
string c... | [
"def",
"IsCppString",
"(",
"line",
")",
":",
"line",
"=",
"line",
".",
"replace",
"(",
"r'\\\\'",
",",
"'XX'",
")",
"# after this, \\\\\" does not match to \\\"",
"return",
"(",
"(",
"line",
".",
"count",
"(",
"'\"'",
")",
"-",
"line",
".",
"count",
"(",
... | https://github.com/hfinkel/llvm-project-cxxjit/blob/91084ef018240bbb8e24235ff5cd8c355a9c1a1e/compiler-rt/lib/sanitizer_common/scripts/cpplint.py#L909-L923 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/nn/loss/loss.py | python | SmoothL1Loss.__init__ | (self, beta=1.0) | Initialize SmoothL1Loss. | Initialize SmoothL1Loss. | [
"Initialize",
"SmoothL1Loss",
"."
] | def __init__(self, beta=1.0):
"""Initialize SmoothL1Loss."""
super(SmoothL1Loss, self).__init__()
self.beta = beta
self.smooth_l1_loss = P.SmoothL1Loss(self.beta) | [
"def",
"__init__",
"(",
"self",
",",
"beta",
"=",
"1.0",
")",
":",
"super",
"(",
"SmoothL1Loss",
",",
"self",
")",
".",
"__init__",
"(",
")",
"self",
".",
"beta",
"=",
"beta",
"self",
".",
"smooth_l1_loss",
"=",
"P",
".",
"SmoothL1Loss",
"(",
"self",... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/nn/loss/loss.py#L486-L490 | ||
idaholab/moose | 9eeebc65e098b4c30f8205fb41591fd5b61eb6ff | python/moosesqa/LogHelper.py | python | LogHelper.setLevel | (self, key, level) | Add/set the desired log level for a given key | Add/set the desired log level for a given key | [
"Add",
"/",
"set",
"the",
"desired",
"log",
"level",
"for",
"a",
"given",
"key"
] | def setLevel(self, key, level):
"""Add/set the desired log level for a given key"""
self.__modes[key] = level | [
"def",
"setLevel",
"(",
"self",
",",
"key",
",",
"level",
")",
":",
"self",
".",
"__modes",
"[",
"key",
"]",
"=",
"level"
] | https://github.com/idaholab/moose/blob/9eeebc65e098b4c30f8205fb41591fd5b61eb6ff/python/moosesqa/LogHelper.py#L32-L34 | ||
CRYTEK/CRYENGINE | 232227c59a220cbbd311576f0fbeba7bb53b2a8c | Editor/Python/windows/Lib/site-packages/pkg_resources/_vendor/pyparsing.py | python | ParserElement.copy | ( self ) | return cpy | Make a copy of this C{ParserElement}. Useful for defining different parse actions
for the same parsing pattern, using copies of the original parse element.
Example::
integer = Word(nums).setParseAction(lambda toks: int(toks[0]))
integerK = integer.copy().addParseAction(... | Make a copy of this C{ParserElement}. Useful for defining different parse actions
for the same parsing pattern, using copies of the original parse element.
Example::
integer = Word(nums).setParseAction(lambda toks: int(toks[0]))
integerK = integer.copy().addParseAction(... | [
"Make",
"a",
"copy",
"of",
"this",
"C",
"{",
"ParserElement",
"}",
".",
"Useful",
"for",
"defining",
"different",
"parse",
"actions",
"for",
"the",
"same",
"parsing",
"pattern",
"using",
"copies",
"of",
"the",
"original",
"parse",
"element",
".",
"Example",
... | def copy( self ):
"""
Make a copy of this C{ParserElement}. Useful for defining different parse actions
for the same parsing pattern, using copies of the original parse element.
Example::
integer = Word(nums).setParseAction(lambda toks: int(toks[0]))
int... | [
"def",
"copy",
"(",
"self",
")",
":",
"cpy",
"=",
"copy",
".",
"copy",
"(",
"self",
")",
"cpy",
".",
"parseAction",
"=",
"self",
".",
"parseAction",
"[",
":",
"]",
"cpy",
".",
"ignoreExprs",
"=",
"self",
".",
"ignoreExprs",
"[",
":",
"]",
"if",
"... | https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Editor/Python/windows/Lib/site-packages/pkg_resources/_vendor/pyparsing.py#L1167-L1188 | |
eclipse/sumo | 7132a9b8b6eea734bdec38479026b4d8c4336d03 | tools/simpla/_pvehicle.py | python | PVehicle.splitCountDown | (self, dt) | return self._timeUntilSplit | splitCountDown(double)
Decreases the time until the vehicle is split from its platoon | splitCountDown(double) | [
"splitCountDown",
"(",
"double",
")"
] | def splitCountDown(self, dt):
'''splitCountDown(double)
Decreases the time until the vehicle is split from its platoon
'''
self._timeUntilSplit -= dt
if rp.VERBOSITY >= 4:
report("Time until split from platoon for veh '%s': %s" % (self._ID, self._timeUntilSplit))
... | [
"def",
"splitCountDown",
"(",
"self",
",",
"dt",
")",
":",
"self",
".",
"_timeUntilSplit",
"-=",
"dt",
"if",
"rp",
".",
"VERBOSITY",
">=",
"4",
":",
"report",
"(",
"\"Time until split from platoon for veh '%s': %s\"",
"%",
"(",
"self",
".",
"_ID",
",",
"self... | https://github.com/eclipse/sumo/blob/7132a9b8b6eea734bdec38479026b4d8c4336d03/tools/simpla/_pvehicle.py#L277-L285 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/fitting_widgets/tf_asymmetry_fitting/tf_asymmetry_fitting_model.py | python | TFAsymmetryFittingModel._update_tf_fit_function_parameters_for_single_fit | (self, names: list, parameter_values: list) | Updates the tf asymmetry function parameters for the given dataset names if in single fit mode. | Updates the tf asymmetry function parameters for the given dataset names if in single fit mode. | [
"Updates",
"the",
"tf",
"asymmetry",
"function",
"parameters",
"for",
"the",
"given",
"dataset",
"names",
"if",
"in",
"single",
"fit",
"mode",
"."
] | def _update_tf_fit_function_parameters_for_single_fit(self, names: list, parameter_values: list):
"""Updates the tf asymmetry function parameters for the given dataset names if in single fit mode."""
dataset_names = self.fitting_context.dataset_names
for name in names:
if name in dat... | [
"def",
"_update_tf_fit_function_parameters_for_single_fit",
"(",
"self",
",",
"names",
":",
"list",
",",
"parameter_values",
":",
"list",
")",
":",
"dataset_names",
"=",
"self",
".",
"fitting_context",
".",
"dataset_names",
"for",
"name",
"in",
"names",
":",
"if",... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/fitting_widgets/tf_asymmetry_fitting/tf_asymmetry_fitting_model.py#L773-L780 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/mapreduce/mapreduce/input_readers.py | python | BlobstoreZipLineInputReader.__init__ | (self, blob_key, start_file_index, end_file_index, offset,
_reader=blobstore.BlobReader) | Initializes this instance with the given blob key and file range.
This BlobstoreZipLineInputReader will read from the file with index
start_file_index up to but not including the file with index end_file_index.
It will return lines starting at offset within file[start_file_index]
Args:
blob_key:... | Initializes this instance with the given blob key and file range. | [
"Initializes",
"this",
"instance",
"with",
"the",
"given",
"blob",
"key",
"and",
"file",
"range",
"."
] | def __init__(self, blob_key, start_file_index, end_file_index, offset,
_reader=blobstore.BlobReader):
"""Initializes this instance with the given blob key and file range.
This BlobstoreZipLineInputReader will read from the file with index
start_file_index up to but not including the file wit... | [
"def",
"__init__",
"(",
"self",
",",
"blob_key",
",",
"start_file_index",
",",
"end_file_index",
",",
"offset",
",",
"_reader",
"=",
"blobstore",
".",
"BlobReader",
")",
":",
"self",
".",
"_blob_key",
"=",
"blob_key",
"self",
".",
"_start_file_index",
"=",
"... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/mapreduce/mapreduce/input_readers.py#L1630-L1654 | ||
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/binhex.py | python | binhex | (inp, out) | (infilename, outfilename) - Create binhex-encoded copy of a file | (infilename, outfilename) - Create binhex-encoded copy of a file | [
"(",
"infilename",
"outfilename",
")",
"-",
"Create",
"binhex",
"-",
"encoded",
"copy",
"of",
"a",
"file"
] | def binhex(inp, out):
"""(infilename, outfilename) - Create binhex-encoded copy of a file"""
finfo = getfileinfo(inp)
ofp = BinHex(finfo, out)
ifp = open(inp, 'rb')
# XXXX Do textfile translation on non-mac systems
while 1:
d = ifp.read(128000)
if not d: break
ofp.write(... | [
"def",
"binhex",
"(",
"inp",
",",
"out",
")",
":",
"finfo",
"=",
"getfileinfo",
"(",
"inp",
")",
"ofp",
"=",
"BinHex",
"(",
"finfo",
",",
"out",
")",
"ifp",
"=",
"open",
"(",
"inp",
",",
"'rb'",
")",
"# XXXX Do textfile translation on non-mac systems",
"... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/binhex.py#L250-L270 | ||
yushroom/FishEngine | a4b9fb9b0a6dc202f7990e75f4b7d8d5163209d9 | Script/reflect/clang/cindex.py | python | SourceRange.start | (self) | return conf.lib.clang_getRangeStart(self) | Return a SourceLocation representing the first character within a
source range. | Return a SourceLocation representing the first character within a
source range. | [
"Return",
"a",
"SourceLocation",
"representing",
"the",
"first",
"character",
"within",
"a",
"source",
"range",
"."
] | def start(self):
"""
Return a SourceLocation representing the first character within a
source range.
"""
return conf.lib.clang_getRangeStart(self) | [
"def",
"start",
"(",
"self",
")",
":",
"return",
"conf",
".",
"lib",
".",
"clang_getRangeStart",
"(",
"self",
")"
] | https://github.com/yushroom/FishEngine/blob/a4b9fb9b0a6dc202f7990e75f4b7d8d5163209d9/Script/reflect/clang/cindex.py#L248-L253 | |
apple/swift-lldb | d74be846ef3e62de946df343e8c234bde93a8912 | third_party/Python/module/pexpect-4.6/pexpect/screen.py | python | screen.dump | (self) | return u''.join ([ u''.join(c) for c in self.w ]) | This returns a copy of the screen as a unicode string. This is similar to
__str__/__unicode__ except that lines are not terminated with line
feeds. | This returns a copy of the screen as a unicode string. This is similar to
__str__/__unicode__ except that lines are not terminated with line
feeds. | [
"This",
"returns",
"a",
"copy",
"of",
"the",
"screen",
"as",
"a",
"unicode",
"string",
".",
"This",
"is",
"similar",
"to",
"__str__",
"/",
"__unicode__",
"except",
"that",
"lines",
"are",
"not",
"terminated",
"with",
"line",
"feeds",
"."
] | def dump (self):
'''This returns a copy of the screen as a unicode string. This is similar to
__str__/__unicode__ except that lines are not terminated with line
feeds.'''
return u''.join ([ u''.join(c) for c in self.w ]) | [
"def",
"dump",
"(",
"self",
")",
":",
"return",
"u''",
".",
"join",
"(",
"[",
"u''",
".",
"join",
"(",
"c",
")",
"for",
"c",
"in",
"self",
".",
"w",
"]",
")"
] | https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/third_party/Python/module/pexpect-4.6/pexpect/screen.py#L131-L136 | |
epiqc/ScaffCC | 66a79944ee4cd116b27bc1a69137276885461db8 | clang/tools/scan-build-py/libscanbuild/report.py | python | read_crashes | (output_dir) | return (parse_crash(filename)
for filename in glob.iglob(os.path.join(output_dir, 'failures',
'*.info.txt'))) | Generate a unique sequence of crashes from given output directory. | Generate a unique sequence of crashes from given output directory. | [
"Generate",
"a",
"unique",
"sequence",
"of",
"crashes",
"from",
"given",
"output",
"directory",
"."
] | def read_crashes(output_dir):
""" Generate a unique sequence of crashes from given output directory. """
return (parse_crash(filename)
for filename in glob.iglob(os.path.join(output_dir, 'failures',
'*.info.txt'))) | [
"def",
"read_crashes",
"(",
"output_dir",
")",
":",
"return",
"(",
"parse_crash",
"(",
"filename",
")",
"for",
"filename",
"in",
"glob",
".",
"iglob",
"(",
"os",
".",
"path",
".",
"join",
"(",
"output_dir",
",",
"'failures'",
",",
"'*.info.txt'",
")",
")... | https://github.com/epiqc/ScaffCC/blob/66a79944ee4cd116b27bc1a69137276885461db8/clang/tools/scan-build-py/libscanbuild/report.py#L247-L252 | |
giuspen/cherrytree | 84712f206478fcf9acf30174009ad28c648c6344 | pygtk2/modules/machines.py | python | StateMachine.load_embedded_image_element | (self, text_buffer, element) | Load an Image from the Embedded Vector into the Buffer | Load an Image from the Embedded Vector into the Buffer | [
"Load",
"an",
"Image",
"from",
"the",
"Embedded",
"Vector",
"into",
"the",
"Buffer"
] | def load_embedded_image_element(self, text_buffer, element):
"""Load an Image from the Embedded Vector into the Buffer"""
iter_insert = text_buffer.get_iter_at_offset(element[0])
self.dad.image_insert(iter_insert, element[1], element[2], text_buffer=text_buffer) | [
"def",
"load_embedded_image_element",
"(",
"self",
",",
"text_buffer",
",",
"element",
")",
":",
"iter_insert",
"=",
"text_buffer",
".",
"get_iter_at_offset",
"(",
"element",
"[",
"0",
"]",
")",
"self",
".",
"dad",
".",
"image_insert",
"(",
"iter_insert",
",",... | https://github.com/giuspen/cherrytree/blob/84712f206478fcf9acf30174009ad28c648c6344/pygtk2/modules/machines.py#L788-L791 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/ultimatelistctrl.py | python | UltimateListMainWindow.IsItemEnabled | (self, item) | return item.IsEnabled() | Returns whether an item is enabled or not.
:param `item`: an instance of :class:`UltimateListItem`. | Returns whether an item is enabled or not. | [
"Returns",
"whether",
"an",
"item",
"is",
"enabled",
"or",
"not",
"."
] | def IsItemEnabled(self, item):
"""
Returns whether an item is enabled or not.
:param `item`: an instance of :class:`UltimateListItem`.
"""
item = self.GetItem(item, item._col)
return item.IsEnabled() | [
"def",
"IsItemEnabled",
"(",
"self",
",",
"item",
")",
":",
"item",
"=",
"self",
".",
"GetItem",
"(",
"item",
",",
"item",
".",
"_col",
")",
"return",
"item",
".",
"IsEnabled",
"(",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/ultimatelistctrl.py#L9114-L9122 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/framework/config.py | python | get_intra_op_parallelism_threads | () | return context.context().intra_op_parallelism_threads | Get number of threads used within an individual op for parallelism.
Certain operations like matrix multiplication and reductions can utilize
parallel threads for speed ups. A value of 0 means the system picks an
appropriate number.
Returns:
Number of parallel threads | Get number of threads used within an individual op for parallelism. | [
"Get",
"number",
"of",
"threads",
"used",
"within",
"an",
"individual",
"op",
"for",
"parallelism",
"."
] | def get_intra_op_parallelism_threads():
"""Get number of threads used within an individual op for parallelism.
Certain operations like matrix multiplication and reductions can utilize
parallel threads for speed ups. A value of 0 means the system picks an
appropriate number.
Returns:
Number of parallel t... | [
"def",
"get_intra_op_parallelism_threads",
"(",
")",
":",
"return",
"context",
".",
"context",
"(",
")",
".",
"intra_op_parallelism_threads"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/framework/config.py#L94-L104 | |
panda3d/panda3d | 833ad89ebad58395d0af0b7ec08538e5e4308265 | direct/src/actor/Actor.py | python | Actor.getSubpartsComplete | (self) | return self.__subpartsComplete | See setSubpartsComplete(). | See setSubpartsComplete(). | [
"See",
"setSubpartsComplete",
"()",
"."
] | def getSubpartsComplete(self):
"""See setSubpartsComplete()."""
return self.__subpartsComplete | [
"def",
"getSubpartsComplete",
"(",
"self",
")",
":",
"return",
"self",
".",
"__subpartsComplete"
] | https://github.com/panda3d/panda3d/blob/833ad89ebad58395d0af0b7ec08538e5e4308265/direct/src/actor/Actor.py#L2093-L2096 | |
v8/v8 | fee3bf095260bf657a3eea4d3d41f90c42c6c857 | tools/run-clang-tidy.py | python | rm_prefix | (string, prefix) | return string | Removes prefix from a string until the new string
no longer starts with the prefix. | Removes prefix from a string until the new string
no longer starts with the prefix. | [
"Removes",
"prefix",
"from",
"a",
"string",
"until",
"the",
"new",
"string",
"no",
"longer",
"starts",
"with",
"the",
"prefix",
"."
] | def rm_prefix(string, prefix):
"""
Removes prefix from a string until the new string
no longer starts with the prefix.
"""
while string.startswith(prefix):
string = string[len(prefix):]
return string | [
"def",
"rm_prefix",
"(",
"string",
",",
"prefix",
")",
":",
"while",
"string",
".",
"startswith",
"(",
"prefix",
")",
":",
"string",
"=",
"string",
"[",
"len",
"(",
"prefix",
")",
":",
"]",
"return",
"string"
] | https://github.com/v8/v8/blob/fee3bf095260bf657a3eea4d3d41f90c42c6c857/tools/run-clang-tidy.py#L211-L218 | |
PyMesh/PyMesh | 384ba882b7558ba6e8653ed263c419226c22bddf | python/pymesh/misc/quaternion.py | python | Quaternion.rotate | (self, v) | return r[1:4] * m | Rotate 3D vector v by this quaternion
Args:
``v`` (``numpy.ndarray``): Must be 1D vector.
Returns:
The rotated vector. | Rotate 3D vector v by this quaternion | [
"Rotate",
"3D",
"vector",
"v",
"by",
"this",
"quaternion"
] | def rotate(self, v):
""" Rotate 3D vector v by this quaternion
Args:
``v`` (``numpy.ndarray``): Must be 1D vector.
Returns:
The rotated vector.
"""
m = norm(v)
v = Quaternion([0, v[0], v[1], v[2]])
r = self * v * self.conjugate()
... | [
"def",
"rotate",
"(",
"self",
",",
"v",
")",
":",
"m",
"=",
"norm",
"(",
"v",
")",
"v",
"=",
"Quaternion",
"(",
"[",
"0",
",",
"v",
"[",
"0",
"]",
",",
"v",
"[",
"1",
"]",
",",
"v",
"[",
"2",
"]",
"]",
")",
"r",
"=",
"self",
"*",
"v",... | https://github.com/PyMesh/PyMesh/blob/384ba882b7558ba6e8653ed263c419226c22bddf/python/pymesh/misc/quaternion.py#L160-L172 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/control_flow_ops.py | python | WhileContext.AddBackpropIndexedSlicesAccumulator | (self, op, grad) | return indexed_slices.IndexedSlices(
indices=exit_acc[0],
values=exit_acc[1],
dense_shape=exit_acc[2] if shape_acc is not None else None) | This is used for accumulating gradients that are IndexedSlices.
This is essentially the equivalent of AddBackpropAccumulator but optimized
for things like updating embeddings from within a while loop.
Args:
op: The Enter op for a loop invariant.
grad: The partial gradients represented as an In... | This is used for accumulating gradients that are IndexedSlices. | [
"This",
"is",
"used",
"for",
"accumulating",
"gradients",
"that",
"are",
"IndexedSlices",
"."
] | def AddBackpropIndexedSlicesAccumulator(self, op, grad):
"""This is used for accumulating gradients that are IndexedSlices.
This is essentially the equivalent of AddBackpropAccumulator but optimized
for things like updating embeddings from within a while loop.
Args:
op: The Enter op for a loop i... | [
"def",
"AddBackpropIndexedSlicesAccumulator",
"(",
"self",
",",
"op",
",",
"grad",
")",
":",
"values",
"=",
"grad",
".",
"values",
"indices",
"=",
"grad",
".",
"indices",
"dense_shape",
"=",
"grad",
".",
"dense_shape",
"self",
".",
"Exit",
"(",
")",
"if",
... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/control_flow_ops.py#L2049-L2150 | |
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Tool/MSCommon/sdk.py | python | SDKDefinition.find_sdk_dir | (self) | return sdk_dir | Try to find the MS SDK from the registry.
Return None if failed or the directory does not exist. | Try to find the MS SDK from the registry. | [
"Try",
"to",
"find",
"the",
"MS",
"SDK",
"from",
"the",
"registry",
"."
] | def find_sdk_dir(self):
"""Try to find the MS SDK from the registry.
Return None if failed or the directory does not exist.
"""
if not SCons.Util.can_read_reg:
debug('find_sdk_dir(): can not read registry')
return None
hkey = self.HKEY_FMT % self.hkey_da... | [
"def",
"find_sdk_dir",
"(",
"self",
")",
":",
"if",
"not",
"SCons",
".",
"Util",
".",
"can_read_reg",
":",
"debug",
"(",
"'find_sdk_dir(): can not read registry'",
")",
"return",
"None",
"hkey",
"=",
"self",
".",
"HKEY_FMT",
"%",
"self",
".",
"hkey_data",
"d... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Tool/MSCommon/sdk.py#L69-L98 | |
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/models/image/cifar10/cifar10.py | python | train | (total_loss, global_step) | return train_op | Train CIFAR-10 model.
Create an optimizer and apply to all trainable variables. Add moving
average for all trainable variables.
Args:
total_loss: Total loss from loss().
global_step: Integer Variable counting the number of training steps
processed.
Returns:
train_op: op for training. | Train CIFAR-10 model. | [
"Train",
"CIFAR",
"-",
"10",
"model",
"."
] | def train(total_loss, global_step):
"""Train CIFAR-10 model.
Create an optimizer and apply to all trainable variables. Add moving
average for all trainable variables.
Args:
total_loss: Total loss from loss().
global_step: Integer Variable counting the number of training steps
processed.
Return... | [
"def",
"train",
"(",
"total_loss",
",",
"global_step",
")",
":",
"# Variables that affect learning rate.",
"num_batches_per_epoch",
"=",
"NUM_EXAMPLES_PER_EPOCH_FOR_TRAIN",
"/",
"FLAGS",
".",
"batch_size",
"decay_steps",
"=",
"int",
"(",
"num_batches_per_epoch",
"*",
"NUM... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/models/image/cifar10/cifar10.py#L322-L375 | |
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | ppapi/generators/idl_parser.py | python | IDLParser.p_describe_block | (self, p) | describe_block : modifiers DESCRIBE '{' describe_list '}' '; | describe_block : modifiers DESCRIBE '{' describe_list '}' '; | [
"describe_block",
":",
"modifiers",
"DESCRIBE",
"{",
"describe_list",
"}",
";"
] | def p_describe_block(self, p):
"""describe_block : modifiers DESCRIBE '{' describe_list '}' ';'"""
children = ListFromConcat(p[1], p[4])
p[0] = self.BuildProduction('Describe', p, 2, children)
if self.parse_debug: DumpReduction('describe_block', p) | [
"def",
"p_describe_block",
"(",
"self",
",",
"p",
")",
":",
"children",
"=",
"ListFromConcat",
"(",
"p",
"[",
"1",
"]",
",",
"p",
"[",
"4",
"]",
")",
"p",
"[",
"0",
"]",
"=",
"self",
".",
"BuildProduction",
"(",
"'Describe'",
",",
"p",
",",
"2",
... | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/ppapi/generators/idl_parser.py#L408-L412 | ||
goldeneye-source/ges-code | 2630cd8ef3d015af53c72ec2e19fc1f7e7fe8d9d | thirdparty/protobuf-2.3.0/python/google/protobuf/reflection.py | python | _IsPresent | (item) | Given a (FieldDescriptor, value) tuple from _fields, return true if the
value should be included in the list returned by ListFields(). | Given a (FieldDescriptor, value) tuple from _fields, return true if the
value should be included in the list returned by ListFields(). | [
"Given",
"a",
"(",
"FieldDescriptor",
"value",
")",
"tuple",
"from",
"_fields",
"return",
"true",
"if",
"the",
"value",
"should",
"be",
"included",
"in",
"the",
"list",
"returned",
"by",
"ListFields",
"()",
"."
] | def _IsPresent(item):
"""Given a (FieldDescriptor, value) tuple from _fields, return true if the
value should be included in the list returned by ListFields()."""
if item[0].label == _FieldDescriptor.LABEL_REPEATED:
return bool(item[1])
elif item[0].cpp_type == _FieldDescriptor.CPPTYPE_MESSAGE:
return ... | [
"def",
"_IsPresent",
"(",
"item",
")",
":",
"if",
"item",
"[",
"0",
"]",
".",
"label",
"==",
"_FieldDescriptor",
".",
"LABEL_REPEATED",
":",
"return",
"bool",
"(",
"item",
"[",
"1",
"]",
")",
"elif",
"item",
"[",
"0",
"]",
".",
"cpp_type",
"==",
"_... | https://github.com/goldeneye-source/ges-code/blob/2630cd8ef3d015af53c72ec2e19fc1f7e7fe8d9d/thirdparty/protobuf-2.3.0/python/google/protobuf/reflection.py#L612-L621 | ||
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/distributed/fleet/utils/hybrid_parallel_inference.py | python | HybridParallelInferenceHelper.gen_infer_program | (self,
sync_in_while_lastpp2firstpp_var_names=None,
sync_in_while_var_names=None,
debug=False) | Generate inference program.
Params:
sync_in_while_lastpp2firstpp_var_names (list(str)): the vars in the last pipeline
that need to send var to first pipeline and exclude bool dtype var
sync_in_while_var_names (list(str)): the vars sync among all pipeline in while block
... | Generate inference program.
Params:
sync_in_while_lastpp2firstpp_var_names (list(str)): the vars in the last pipeline
that need to send var to first pipeline and exclude bool dtype var
sync_in_while_var_names (list(str)): the vars sync among all pipeline in while block
... | [
"Generate",
"inference",
"program",
".",
"Params",
":",
"sync_in_while_lastpp2firstpp_var_names",
"(",
"list",
"(",
"str",
"))",
":",
"the",
"vars",
"in",
"the",
"last",
"pipeline",
"that",
"need",
"to",
"send",
"var",
"to",
"first",
"pipeline",
"and",
"exclud... | def gen_infer_program(self,
sync_in_while_lastpp2firstpp_var_names=None,
sync_in_while_var_names=None,
debug=False):
"""
Generate inference program.
Params:
sync_in_while_lastpp2firstpp_var_names (list(str)... | [
"def",
"gen_infer_program",
"(",
"self",
",",
"sync_in_while_lastpp2firstpp_var_names",
"=",
"None",
",",
"sync_in_while_var_names",
"=",
"None",
",",
"debug",
"=",
"False",
")",
":",
"main_block",
"=",
"self",
".",
"_main_program",
".",
"global_block",
"(",
")",
... | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/distributed/fleet/utils/hybrid_parallel_inference.py#L715-L776 | ||
nasa/fprime | 595cf3682d8365943d86c1a6fe7c78f0a116acf0 | Autocoders/Python/src/fprime_ac/parsers/XmlTopologyParser.py | python | XmlTopologyParser.get_base_id | (self) | return self.__base_id | Return base id of topology | Return base id of topology | [
"Return",
"base",
"id",
"of",
"topology"
] | def get_base_id(self):
"""
Return base id of topology
"""
return self.__base_id | [
"def",
"get_base_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"__base_id"
] | https://github.com/nasa/fprime/blob/595cf3682d8365943d86c1a6fe7c78f0a116acf0/Autocoders/Python/src/fprime_ac/parsers/XmlTopologyParser.py#L352-L356 | |
yuxng/PoseCNN | 9f3dd7b7bce21dcafc05e8f18ccc90da3caabd04 | lib/rpn_layer/anchor_target_layer.py | python | _unmap | (data, count, inds, fill=0) | return ret | Unmap a subset of item (data) back to the original set of items (of
size count) | Unmap a subset of item (data) back to the original set of items (of
size count) | [
"Unmap",
"a",
"subset",
"of",
"item",
"(",
"data",
")",
"back",
"to",
"the",
"original",
"set",
"of",
"items",
"(",
"of",
"size",
"count",
")"
] | def _unmap(data, count, inds, fill=0):
""" Unmap a subset of item (data) back to the original set of items (of
size count) """
if len(data.shape) == 1:
ret = np.empty((count,), dtype=np.float32)
ret.fill(fill)
ret[inds] = data
else:
ret = np.empty((count,) + data.shape[1:], dtype=np.float32)
... | [
"def",
"_unmap",
"(",
"data",
",",
"count",
",",
"inds",
",",
"fill",
"=",
"0",
")",
":",
"if",
"len",
"(",
"data",
".",
"shape",
")",
"==",
"1",
":",
"ret",
"=",
"np",
".",
"empty",
"(",
"(",
"count",
",",
")",
",",
"dtype",
"=",
"np",
"."... | https://github.com/yuxng/PoseCNN/blob/9f3dd7b7bce21dcafc05e8f18ccc90da3caabd04/lib/rpn_layer/anchor_target_layer.py#L141-L152 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/stc.py | python | StyledTextCtrl.InsertText | (*args, **kwargs) | return _stc.StyledTextCtrl_InsertText(*args, **kwargs) | InsertText(self, int pos, String text)
Insert string at a position. | InsertText(self, int pos, String text) | [
"InsertText",
"(",
"self",
"int",
"pos",
"String",
"text",
")"
] | def InsertText(*args, **kwargs):
"""
InsertText(self, int pos, String text)
Insert string at a position.
"""
return _stc.StyledTextCtrl_InsertText(*args, **kwargs) | [
"def",
"InsertText",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_stc",
".",
"StyledTextCtrl_InsertText",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/stc.py#L2051-L2057 | |
emscripten-core/emscripten | 0d413d3c5af8b28349682496edc14656f5700c2f | emrun.py | python | unquote_u | (source) | return result | Unquotes a unicode string.
(translates ascii-encoded utf string back to utf) | Unquotes a unicode string.
(translates ascii-encoded utf string back to utf) | [
"Unquotes",
"a",
"unicode",
"string",
".",
"(",
"translates",
"ascii",
"-",
"encoded",
"utf",
"string",
"back",
"to",
"utf",
")"
] | def unquote_u(source):
"""Unquotes a unicode string.
(translates ascii-encoded utf string back to utf)
"""
result = unquote(source)
if '%u' in result:
result = result.replace('%u', '\\u').decode('unicode_escape')
return result | [
"def",
"unquote_u",
"(",
"source",
")",
":",
"result",
"=",
"unquote",
"(",
"source",
")",
"if",
"'%u'",
"in",
"result",
":",
"result",
"=",
"result",
".",
"replace",
"(",
"'%u'",
",",
"'\\\\u'",
")",
".",
"decode",
"(",
"'unicode_escape'",
")",
"retur... | https://github.com/emscripten-core/emscripten/blob/0d413d3c5af8b28349682496edc14656f5700c2f/emrun.py#L221-L228 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py3/numpy/lib/npyio.py | python | save | (file, arr, allow_pickle=True, fix_imports=True) | Save an array to a binary file in NumPy ``.npy`` format.
Parameters
----------
file : file, str, or pathlib.Path
File or filename to which the data is saved. If file is a file-object,
then the filename is unchanged. If file is a string or Path, a ``.npy``
extension will be appende... | Save an array to a binary file in NumPy ``.npy`` format. | [
"Save",
"an",
"array",
"to",
"a",
"binary",
"file",
"in",
"NumPy",
".",
"npy",
"format",
"."
] | def save(file, arr, allow_pickle=True, fix_imports=True):
"""
Save an array to a binary file in NumPy ``.npy`` format.
Parameters
----------
file : file, str, or pathlib.Path
File or filename to which the data is saved. If file is a file-object,
then the filename is unchanged. If ... | [
"def",
"save",
"(",
"file",
",",
"arr",
",",
"allow_pickle",
"=",
"True",
",",
"fix_imports",
"=",
"True",
")",
":",
"if",
"hasattr",
"(",
"file",
",",
"'write'",
")",
":",
"file_ctx",
"=",
"contextlib",
".",
"nullcontext",
"(",
"file",
")",
"else",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py3/numpy/lib/npyio.py#L459-L530 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/protobuf/py2/google/protobuf/descriptor.py | python | DescriptorBase.__init__ | (self, options, serialized_options, options_class_name) | Initialize the descriptor given its options message and the name of the
class of the options message. The name of the class is required in case
the options message is None and has to be created. | Initialize the descriptor given its options message and the name of the
class of the options message. The name of the class is required in case
the options message is None and has to be created. | [
"Initialize",
"the",
"descriptor",
"given",
"its",
"options",
"message",
"and",
"the",
"name",
"of",
"the",
"class",
"of",
"the",
"options",
"message",
".",
"The",
"name",
"of",
"the",
"class",
"is",
"required",
"in",
"case",
"the",
"options",
"message",
"... | def __init__(self, options, serialized_options, options_class_name):
"""Initialize the descriptor given its options message and the name of the
class of the options message. The name of the class is required in case
the options message is None and has to be created.
"""
self._options = options
s... | [
"def",
"__init__",
"(",
"self",
",",
"options",
",",
"serialized_options",
",",
"options_class_name",
")",
":",
"self",
".",
"_options",
"=",
"options",
"self",
".",
"_options_class_name",
"=",
"options_class_name",
"self",
".",
"_serialized_options",
"=",
"serial... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/protobuf/py2/google/protobuf/descriptor.py#L134-L144 | ||
hfinkel/llvm-project-cxxjit | 91084ef018240bbb8e24235ff5cd8c355a9c1a1e | lldb/third_party/Python/module/pexpect-2.4/pexpect.py | python | spawn.setmaxread | (self, maxread) | This method is no longer supported or allowed. I don't like getters
and setters without a good reason. | This method is no longer supported or allowed. I don't like getters
and setters without a good reason. | [
"This",
"method",
"is",
"no",
"longer",
"supported",
"or",
"allowed",
".",
"I",
"don",
"t",
"like",
"getters",
"and",
"setters",
"without",
"a",
"good",
"reason",
"."
] | def setmaxread(self, maxread):
"""This method is no longer supported or allowed. I don't like getters
and setters without a good reason. """
raise ExceptionPexpect(
'This method is no longer supported or allowed. Just assign a value to the maxread member variable.') | [
"def",
"setmaxread",
"(",
"self",
",",
"maxread",
")",
":",
"raise",
"ExceptionPexpect",
"(",
"'This method is no longer supported or allowed. Just assign a value to the maxread member variable.'",
")"
] | https://github.com/hfinkel/llvm-project-cxxjit/blob/91084ef018240bbb8e24235ff5cd8c355a9c1a1e/lldb/third_party/Python/module/pexpect-2.4/pexpect.py#L1609-L1614 | ||
domino-team/openwrt-cc | 8b181297c34d14d3ca521cc9f31430d561dbc688 | package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/tools/gyp/pylib/gyp/xcodeproj_file.py | python | PBXGroup.AddOrGetVariantGroupByNameAndPath | (self, name, path) | return variant_group_ref | Returns an existing or new PBXVariantGroup for name and path.
If a PBXVariantGroup identified by the name and path arguments is already
present as a child of this object, it is returned. Otherwise, a new
PBXVariantGroup with the correct properties is created, added as a child,
and returned.
This ... | Returns an existing or new PBXVariantGroup for name and path. | [
"Returns",
"an",
"existing",
"or",
"new",
"PBXVariantGroup",
"for",
"name",
"and",
"path",
"."
] | def AddOrGetVariantGroupByNameAndPath(self, name, path):
"""Returns an existing or new PBXVariantGroup for name and path.
If a PBXVariantGroup identified by the name and path arguments is already
present as a child of this object, it is returned. Otherwise, a new
PBXVariantGroup with the correct prope... | [
"def",
"AddOrGetVariantGroupByNameAndPath",
"(",
"self",
",",
"name",
",",
"path",
")",
":",
"key",
"=",
"(",
"name",
",",
"path",
")",
"if",
"key",
"in",
"self",
".",
"_variant_children_by_name_and_path",
":",
"variant_group_ref",
"=",
"self",
".",
"_variant_... | https://github.com/domino-team/openwrt-cc/blob/8b181297c34d14d3ca521cc9f31430d561dbc688/package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/tools/gyp/pylib/gyp/xcodeproj_file.py#L1306-L1331 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.