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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
dicecco1/fpga_caffe | 7a191704efd7873071cfef35772d7e7bf3e3cfd6 | scripts/cpp_lint.py | python | CheckCaffeRandom | (filename, clean_lines, linenum, error) | Checks for calls to C random functions (rand, rand_r, random, ...).
Caffe code should (almost) always use the caffe_rng_* functions rather
than these, as the internal state of these C functions is independent of the
native Caffe RNG system which should produce deterministic results for a
fixed Caffe seed set u... | Checks for calls to C random functions (rand, rand_r, random, ...). | [
"Checks",
"for",
"calls",
"to",
"C",
"random",
"functions",
"(",
"rand",
"rand_r",
"random",
"...",
")",
"."
] | def CheckCaffeRandom(filename, clean_lines, linenum, error):
"""Checks for calls to C random functions (rand, rand_r, random, ...).
Caffe code should (almost) always use the caffe_rng_* functions rather
than these, as the internal state of these C functions is independent of the
native Caffe RNG system which s... | [
"def",
"CheckCaffeRandom",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"for",
"function",
"in",
"c_random_function_list",
":",
"ix",
"=",
"line",
".",
"find",
... | https://github.com/dicecco1/fpga_caffe/blob/7a191704efd7873071cfef35772d7e7bf3e3cfd6/scripts/cpp_lint.py#L1644-L1667 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/protobuf/py3/google/protobuf/text_format.py | python | _Parser._MergeScalarField | (self, tokenizer, message, field) | Merges a single scalar field into a message.
Args:
tokenizer: A tokenizer to parse the field value.
message: A protocol message to record the data.
field: The descriptor of the field to be merged.
Raises:
ParseError: In case of text parsing problems.
RuntimeError: On runtime erro... | Merges a single scalar field into a message. | [
"Merges",
"a",
"single",
"scalar",
"field",
"into",
"a",
"message",
"."
] | def _MergeScalarField(self, tokenizer, message, field):
"""Merges a single scalar field into a message.
Args:
tokenizer: A tokenizer to parse the field value.
message: A protocol message to record the data.
field: The descriptor of the field to be merged.
Raises:
ParseError: In cas... | [
"def",
"_MergeScalarField",
"(",
"self",
",",
"tokenizer",
",",
"message",
",",
"field",
")",
":",
"_",
"=",
"self",
".",
"allow_unknown_extension",
"value",
"=",
"None",
"if",
"field",
".",
"type",
"in",
"(",
"descriptor",
".",
"FieldDescriptor",
".",
"TY... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/protobuf/py3/google/protobuf/text_format.py#L1071-L1144 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py3/scipy/ndimage/measurements.py | python | histogram | (input, min, max, bins, labels=None, index=None) | return labeled_comprehension(input, labels, index, _hist, object, None,
pass_positions=False) | Calculate the histogram of the values of an array, optionally at labels.
Histogram calculates the frequency of values in an array within bins
determined by `min`, `max`, and `bins`. The `labels` and `index`
keywords can limit the scope of the histogram to specified sub-regions
within the array.
Pa... | Calculate the histogram of the values of an array, optionally at labels. | [
"Calculate",
"the",
"histogram",
"of",
"the",
"values",
"of",
"an",
"array",
"optionally",
"at",
"labels",
"."
] | def histogram(input, min, max, bins, labels=None, index=None):
"""
Calculate the histogram of the values of an array, optionally at labels.
Histogram calculates the frequency of values in an array within bins
determined by `min`, `max`, and `bins`. The `labels` and `index`
keywords can limit the sc... | [
"def",
"histogram",
"(",
"input",
",",
"min",
",",
"max",
",",
"bins",
",",
"labels",
"=",
"None",
",",
"index",
"=",
"None",
")",
":",
"_bins",
"=",
"numpy",
".",
"linspace",
"(",
"min",
",",
"max",
",",
"bins",
"+",
"1",
")",
"def",
"_hist",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py3/scipy/ndimage/measurements.py#L1336-L1394 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | models/AI-Model-Zoo/caffe-xilinx/tools/extra/parse_log.py | python | fix_initial_nan_learning_rate | (dict_list) | Correct initial value of learning rate
Learning rate is normally not printed until after the initial test and
training step, which means the initial testing and training rows have
LearningRate = NaN. Fix this by copying over the LearningRate from the
second row, if it exists. | Correct initial value of learning rate | [
"Correct",
"initial",
"value",
"of",
"learning",
"rate"
] | def fix_initial_nan_learning_rate(dict_list):
"""Correct initial value of learning rate
Learning rate is normally not printed until after the initial test and
training step, which means the initial testing and training rows have
LearningRate = NaN. Fix this by copying over the LearningRate from the
... | [
"def",
"fix_initial_nan_learning_rate",
"(",
"dict_list",
")",
":",
"if",
"len",
"(",
"dict_list",
")",
">",
"1",
":",
"dict_list",
"[",
"0",
"]",
"[",
"'LearningRate'",
"]",
"=",
"dict_list",
"[",
"1",
"]",
"[",
"'LearningRate'",
"]"
] | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/models/AI-Model-Zoo/caffe-xilinx/tools/extra/parse_log.py#L119-L129 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/series.py | python | Series.dot | (self, other) | Compute the dot product between the Series and the columns of other.
This method computes the dot product between the Series and another
one, or the Series and each columns of a DataFrame, or the Series and
each columns of an array.
It can also be called using `self @ other` in Python ... | Compute the dot product between the Series and the columns of other. | [
"Compute",
"the",
"dot",
"product",
"between",
"the",
"Series",
"and",
"the",
"columns",
"of",
"other",
"."
] | def dot(self, other):
"""
Compute the dot product between the Series and the columns of other.
This method computes the dot product between the Series and another
one, or the Series and each columns of a DataFrame, or the Series and
each columns of an array.
It can also... | [
"def",
"dot",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"(",
"Series",
",",
"ABCDataFrame",
")",
")",
":",
"common",
"=",
"self",
".",
"index",
".",
"union",
"(",
"other",
".",
"index",
")",
"if",
"len",
"(",
"co... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/series.py#L2406-L2482 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/symtable.py | python | Symbol.get_namespace | (self) | return self.__namespaces[0] | Returns the single namespace bound to this name.
Raises ValueError if the name is bound to multiple namespaces. | Returns the single namespace bound to this name. | [
"Returns",
"the",
"single",
"namespace",
"bound",
"to",
"this",
"name",
"."
] | def get_namespace(self):
"""Returns the single namespace bound to this name.
Raises ValueError if the name is bound to multiple namespaces.
"""
if len(self.__namespaces) != 1:
raise ValueError("name is bound to multiple namespaces")
return self.__namespaces[0] | [
"def",
"get_namespace",
"(",
"self",
")",
":",
"if",
"len",
"(",
"self",
".",
"__namespaces",
")",
"!=",
"1",
":",
"raise",
"ValueError",
"(",
"\"name is bound to multiple namespaces\"",
")",
"return",
"self",
".",
"__namespaces",
"[",
"0",
"]"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/symtable.py#L222-L229 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/graph_editor/transform.py | python | keep_t_if_possible_handler | (info, t) | Transform a tensor into itself (identity) if possible.
This handler transform a tensor into itself if the source and destination
graph are the same. Otherwise it will create a placeholder.
This handler is typically used to transform a hidden input tensors.
Args:
info: Transform._TmpInfo instance.
t: t... | Transform a tensor into itself (identity) if possible. | [
"Transform",
"a",
"tensor",
"into",
"itself",
"(",
"identity",
")",
"if",
"possible",
"."
] | def keep_t_if_possible_handler(info, t):
"""Transform a tensor into itself (identity) if possible.
This handler transform a tensor into itself if the source and destination
graph are the same. Otherwise it will create a placeholder.
This handler is typically used to transform a hidden input tensors.
Args:
... | [
"def",
"keep_t_if_possible_handler",
"(",
"info",
",",
"t",
")",
":",
"if",
"info",
".",
"graph",
"is",
"info",
".",
"graph_",
":",
"return",
"t",
"else",
":",
"return",
"replace_t_with_placeholder_handler",
"(",
"info",
",",
"t",
")"
] | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/graph_editor/transform.py#L66-L82 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/contrib/timeseries/examples/lstm.py | python | _LSTMModel._prediction_step | (self, current_times, state) | return new_state_tuple, {"mean": self._scale_back_data(next_prediction)} | Advance the RNN state using a previous observation or prediction. | Advance the RNN state using a previous observation or prediction. | [
"Advance",
"the",
"RNN",
"state",
"using",
"a",
"previous",
"observation",
"or",
"prediction",
"."
] | def _prediction_step(self, current_times, state):
"""Advance the RNN state using a previous observation or prediction."""
_, previous_observation_or_prediction, lstm_state = state
lstm_output, new_lstm_state = self._lstm_cell_run(
inputs=previous_observation_or_prediction, state=lstm_state)
next... | [
"def",
"_prediction_step",
"(",
"self",
",",
"current_times",
",",
"state",
")",
":",
"_",
",",
"previous_observation_or_prediction",
",",
"lstm_state",
"=",
"state",
"lstm_output",
",",
"new_lstm_state",
"=",
"self",
".",
"_lstm_cell_run",
"(",
"inputs",
"=",
"... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/timeseries/examples/lstm.py#L145-L152 | |
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Tool/FortranCommon.py | python | add_f03_to_env | (env) | Add Builders and construction variables for f03 to an Environment. | Add Builders and construction variables for f03 to an Environment. | [
"Add",
"Builders",
"and",
"construction",
"variables",
"for",
"f03",
"to",
"an",
"Environment",
"."
] | def add_f03_to_env(env):
"""Add Builders and construction variables for f03 to an Environment."""
try:
F03Suffixes = env['F03FILESUFFIXES']
except KeyError:
F03Suffixes = ['.f03']
#print("Adding %s to f95 suffixes" % F95Suffixes)
try:
F03PPSuffixes = env['F03PPFILESUFFIXES']... | [
"def",
"add_f03_to_env",
"(",
"env",
")",
":",
"try",
":",
"F03Suffixes",
"=",
"env",
"[",
"'F03FILESUFFIXES'",
"]",
"except",
"KeyError",
":",
"F03Suffixes",
"=",
"[",
"'.f03'",
"]",
"#print(\"Adding %s to f95 suffixes\" % F95Suffixes)",
"try",
":",
"F03PPSuffixes"... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Tool/FortranCommon.py#L236-L250 | ||
Slicer/SlicerGitSVNArchive | 65e92bb16c2b32ea47a1a66bee71f238891ee1ca | Modules/Scripted/EditorLib/Effect.py | python | EffectLogic.getScopedLabelInput | (self) | return( self.getScopedLayer(layerLogic) ) | return a vtkImageData corresponding to the scope | return a vtkImageData corresponding to the scope | [
"return",
"a",
"vtkImageData",
"corresponding",
"to",
"the",
"scope"
] | def getScopedLabelInput(self):
"""return a vtkImageData corresponding to the scope"""
layerLogic = self.sliceLogic.GetLabelLayer()
return( self.getScopedLayer(layerLogic) ) | [
"def",
"getScopedLabelInput",
"(",
"self",
")",
":",
"layerLogic",
"=",
"self",
".",
"sliceLogic",
".",
"GetLabelLayer",
"(",
")",
"return",
"(",
"self",
".",
"getScopedLayer",
"(",
"layerLogic",
")",
")"
] | https://github.com/Slicer/SlicerGitSVNArchive/blob/65e92bb16c2b32ea47a1a66bee71f238891ee1ca/Modules/Scripted/EditorLib/Effect.py#L386-L389 | |
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | lts/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/common.py | python | WriteOnDiff | (filename) | return Writer() | Write to a file only if the new contents differ.
Arguments:
filename: name of the file to potentially write to.
Returns:
A file like object which will write to temporary file and only overwrite
the target if it differs (on close). | Write to a file only if the new contents differ. | [
"Write",
"to",
"a",
"file",
"only",
"if",
"the",
"new",
"contents",
"differ",
"."
] | def WriteOnDiff(filename):
"""Write to a file only if the new contents differ.
Arguments:
filename: name of the file to potentially write to.
Returns:
A file like object which will write to temporary file and only overwrite
the target if it differs (on close).
"""
class Writer(object):
"""Wr... | [
"def",
"WriteOnDiff",
"(",
"filename",
")",
":",
"class",
"Writer",
"(",
"object",
")",
":",
"\"\"\"Wrapper around file which only covers the target if it differs.\"\"\"",
"def",
"__init__",
"(",
"self",
")",
":",
"# On Cygwin remove the \"dir\" argument because `C:` prefixed p... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/common.py#L334-L412 | |
thalium/icebox | 99d147d5b9269222225443ce171b4fd46d8985d4 | third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2.py | python | xmlDoc.htmlSaveFileEnc | (self, filename, encoding) | return ret | Dump an HTML document to a file using a given encoding and
formatting returns/spaces are added. | Dump an HTML document to a file using a given encoding and
formatting returns/spaces are added. | [
"Dump",
"an",
"HTML",
"document",
"to",
"a",
"file",
"using",
"a",
"given",
"encoding",
"and",
"formatting",
"returns",
"/",
"spaces",
"are",
"added",
"."
] | def htmlSaveFileEnc(self, filename, encoding):
"""Dump an HTML document to a file using a given encoding and
formatting returns/spaces are added. """
ret = libxml2mod.htmlSaveFileEnc(filename, self._o, encoding)
return ret | [
"def",
"htmlSaveFileEnc",
"(",
"self",
",",
"filename",
",",
"encoding",
")",
":",
"ret",
"=",
"libxml2mod",
".",
"htmlSaveFileEnc",
"(",
"filename",
",",
"self",
".",
"_o",
",",
"encoding",
")",
"return",
"ret"
] | https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2.py#L4057-L4061 | |
pristineio/webrtc-mirror | 7a5bcdffaab90a05bc1146b2b1ea71c004e54d71 | PRESUBMIT.py | python | _CheckChangeHasBugField | (input_api, output_api) | Requires that the changelist have a BUG= field.
This check is stricter than the one in depot_tools/presubmit_canned_checks.py
since it fails the presubmit if the BUG= field is missing or doesn't contain
a bug reference. | Requires that the changelist have a BUG= field. | [
"Requires",
"that",
"the",
"changelist",
"have",
"a",
"BUG",
"=",
"field",
"."
] | def _CheckChangeHasBugField(input_api, output_api):
"""Requires that the changelist have a BUG= field.
This check is stricter than the one in depot_tools/presubmit_canned_checks.py
since it fails the presubmit if the BUG= field is missing or doesn't contain
a bug reference.
"""
if input_api.change.BUG:
... | [
"def",
"_CheckChangeHasBugField",
"(",
"input_api",
",",
"output_api",
")",
":",
"if",
"input_api",
".",
"change",
".",
"BUG",
":",
"return",
"[",
"]",
"else",
":",
"return",
"[",
"output_api",
".",
"PresubmitError",
"(",
"'The BUG=[bug number] field is mandatory.... | https://github.com/pristineio/webrtc-mirror/blob/7a5bcdffaab90a05bc1146b2b1ea71c004e54d71/PRESUBMIT.py#L425-L439 | ||
microsoft/TSS.MSR | 0f2516fca2cd9929c31d5450e39301c9bde43688 | TSS.Py/src/TpmTypes.py | python | TPM2_CertifyX509_REQUEST.initFromTpm | (self, buf) | TpmMarshaller method | TpmMarshaller method | [
"TpmMarshaller",
"method"
] | def initFromTpm(self, buf):
""" TpmMarshaller method """
self.reserved = buf.readSizedByteBuf()
inSchemeScheme = buf.readShort()
self.inScheme = UnionFactory.create('TPMU_SIG_SCHEME', inSchemeScheme)
self.inScheme.initFromTpm(buf)
self.partialCertificate = buf.readSizedBy... | [
"def",
"initFromTpm",
"(",
"self",
",",
"buf",
")",
":",
"self",
".",
"reserved",
"=",
"buf",
".",
"readSizedByteBuf",
"(",
")",
"inSchemeScheme",
"=",
"buf",
".",
"readShort",
"(",
")",
"self",
".",
"inScheme",
"=",
"UnionFactory",
".",
"create",
"(",
... | https://github.com/microsoft/TSS.MSR/blob/0f2516fca2cd9929c31d5450e39301c9bde43688/TSS.Py/src/TpmTypes.py#L13156-L13162 | ||
cztomczak/cefpython | 5679f28cec18a57a56e298da2927aac8d8f83ad6 | tools/build.py | python | generate_cefpython_module_variables | () | return ret | Global variables that will be appended to cefpython.pyx sources. | Global variables that will be appended to cefpython.pyx sources. | [
"Global",
"variables",
"that",
"will",
"be",
"appended",
"to",
"cefpython",
".",
"pyx",
"sources",
"."
] | def generate_cefpython_module_variables():
"""Global variables that will be appended to cefpython.pyx sources."""
ret = ('__version__ = "{0}"\n'.format(VERSION))
version = get_cefpython_version()
chrome_version = "{0}.{1}.{2}.{3}".format(
version["CHROME_VERSION_MAJOR"], version["CHROME_VERS... | [
"def",
"generate_cefpython_module_variables",
"(",
")",
":",
"ret",
"=",
"(",
"'__version__ = \"{0}\"\\n'",
".",
"format",
"(",
"VERSION",
")",
")",
"version",
"=",
"get_cefpython_version",
"(",
")",
"chrome_version",
"=",
"\"{0}.{1}.{2}.{3}\"",
".",
"format",
"(",
... | https://github.com/cztomczak/cefpython/blob/5679f28cec18a57a56e298da2927aac8d8f83ad6/tools/build.py#L706-L723 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_misc.py | python | DropTarget.OnDrop | (*args, **kwargs) | return _misc_.DropTarget_OnDrop(*args, **kwargs) | OnDrop(self, int x, int y) -> bool | OnDrop(self, int x, int y) -> bool | [
"OnDrop",
"(",
"self",
"int",
"x",
"int",
"y",
")",
"-",
">",
"bool"
] | def OnDrop(*args, **kwargs):
"""OnDrop(self, int x, int y) -> bool"""
return _misc_.DropTarget_OnDrop(*args, **kwargs) | [
"def",
"OnDrop",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"DropTarget_OnDrop",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_misc.py#L5579-L5581 | |
google/llvm-propeller | 45c226984fe8377ebfb2ad7713c680d652ba678d | clang/bindings/python/clang/cindex.py | python | CompileCommand.arguments | (self) | Get an iterable object providing each argument in the
command line for the compiler invocation as a _CXString.
Invariant : the first argument is the compiler executable | Get an iterable object providing each argument in the
command line for the compiler invocation as a _CXString. | [
"Get",
"an",
"iterable",
"object",
"providing",
"each",
"argument",
"in",
"the",
"command",
"line",
"for",
"the",
"compiler",
"invocation",
"as",
"a",
"_CXString",
"."
] | def arguments(self):
"""
Get an iterable object providing each argument in the
command line for the compiler invocation as a _CXString.
Invariant : the first argument is the compiler executable
"""
length = conf.lib.clang_CompileCommand_getNumArgs(self.cmd)
for i... | [
"def",
"arguments",
"(",
"self",
")",
":",
"length",
"=",
"conf",
".",
"lib",
".",
"clang_CompileCommand_getNumArgs",
"(",
"self",
".",
"cmd",
")",
"for",
"i",
"in",
"range",
"(",
"length",
")",
":",
"yield",
"conf",
".",
"lib",
".",
"clang_CompileComman... | https://github.com/google/llvm-propeller/blob/45c226984fe8377ebfb2ad7713c680d652ba678d/clang/bindings/python/clang/cindex.py#L3189-L3198 | ||
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/numpy/array_ops.py | python | flipud | (m) | return flip(m, 0) | Flips the entries in each column in the up/down direction.
Rows are preserved, but appear in a different order than before.
Args:
m (Tensor): Input array.
Returns:
Tensor.
Raises:
TypeError: If the input is not a tensor.
Supported Platforms:
``GPU`` ``CPU``
E... | Flips the entries in each column in the up/down direction.
Rows are preserved, but appear in a different order than before. | [
"Flips",
"the",
"entries",
"in",
"each",
"column",
"in",
"the",
"up",
"/",
"down",
"direction",
".",
"Rows",
"are",
"preserved",
"but",
"appear",
"in",
"a",
"different",
"order",
"than",
"before",
"."
] | def flipud(m):
"""
Flips the entries in each column in the up/down direction.
Rows are preserved, but appear in a different order than before.
Args:
m (Tensor): Input array.
Returns:
Tensor.
Raises:
TypeError: If the input is not a tensor.
Supported Platforms:
... | [
"def",
"flipud",
"(",
"m",
")",
":",
"return",
"flip",
"(",
"m",
",",
"0",
")"
] | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/numpy/array_ops.py#L1684-L1711 | |
danxuhk/ContinuousCRF-CNN | 2b6dcaf179620f118b225ed12c890414ca828e21 | python/caffe/MultilabelDataLayer.py | python | Multilabel_Data_Layer.backward | (self, top, propagate_down, bottom) | These layers does not back propagate | These layers does not back propagate | [
"These",
"layers",
"does",
"not",
"back",
"propagate"
] | def backward(self, top, propagate_down, bottom):
"""
These layers does not back propagate
"""
pass | [
"def",
"backward",
"(",
"self",
",",
"top",
",",
"propagate_down",
",",
"bottom",
")",
":",
"pass"
] | https://github.com/danxuhk/ContinuousCRF-CNN/blob/2b6dcaf179620f118b225ed12c890414ca828e21/python/caffe/MultilabelDataLayer.py#L106-L110 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_misc.py | python | Display.GetName | (*args, **kwargs) | return _misc_.Display_GetName(*args, **kwargs) | GetName(self) -> String
Returns the display's name. A name is not available on all platforms. | GetName(self) -> String | [
"GetName",
"(",
"self",
")",
"-",
">",
"String"
] | def GetName(*args, **kwargs):
"""
GetName(self) -> String
Returns the display's name. A name is not available on all platforms.
"""
return _misc_.Display_GetName(*args, **kwargs) | [
"def",
"GetName",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"Display_GetName",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_misc.py#L6148-L6154 | |
msracver/Deep-Image-Analogy | 632b9287b42552e32dad64922967c8c9ec7fc4d3 | tools/extra/parse_log.py | python | parse_log | (path_to_log) | return train_dict_list, test_dict_list | Parse log file
Returns (train_dict_list, test_dict_list)
train_dict_list and test_dict_list are lists of dicts that define the table
rows | Parse log file
Returns (train_dict_list, test_dict_list) | [
"Parse",
"log",
"file",
"Returns",
"(",
"train_dict_list",
"test_dict_list",
")"
] | def parse_log(path_to_log):
"""Parse log file
Returns (train_dict_list, test_dict_list)
train_dict_list and test_dict_list are lists of dicts that define the table
rows
"""
regex_iteration = re.compile('Iteration (\d+)')
regex_train_output = re.compile('Train net output #(\d+): (\S+) = ([\... | [
"def",
"parse_log",
"(",
"path_to_log",
")",
":",
"regex_iteration",
"=",
"re",
".",
"compile",
"(",
"'Iteration (\\d+)'",
")",
"regex_train_output",
"=",
"re",
".",
"compile",
"(",
"'Train net output #(\\d+): (\\S+) = ([\\.\\deE+-]+)'",
")",
"regex_test_output",
"=",
... | https://github.com/msracver/Deep-Image-Analogy/blob/632b9287b42552e32dad64922967c8c9ec7fc4d3/tools/extra/parse_log.py#L17-L71 | |
martinmoene/span-lite | 8f7935ff4e502ee023990d356d6578b8293eda74 | script/create-cov-rpt.py | python | executable_name | ( f ) | return os.path.basename( f ) | Folder where the executable is | Folder where the executable is | [
"Folder",
"where",
"the",
"executable",
"is"
] | def executable_name( f ):
"""Folder where the executable is"""
return os.path.basename( f ) | [
"def",
"executable_name",
"(",
"f",
")",
":",
"return",
"os",
".",
"path",
".",
"basename",
"(",
"f",
")"
] | https://github.com/martinmoene/span-lite/blob/8f7935ff4e502ee023990d356d6578b8293eda74/script/create-cov-rpt.py#L37-L39 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/pkg_resources/_vendor/packaging/markers.py | python | Marker.evaluate | (self, environment=None) | return _evaluate_markers(self._markers, current_environment) | Evaluate a marker.
Return the boolean from evaluating the given marker against the
environment. environment is an optional argument to override all or
part of the determined environment.
The environment is determined from the current Python process. | Evaluate a marker. | [
"Evaluate",
"a",
"marker",
"."
] | def evaluate(self, environment=None):
"""Evaluate a marker.
Return the boolean from evaluating the given marker against the
environment. environment is an optional argument to override all or
part of the determined environment.
The environment is determined from the current Pyt... | [
"def",
"evaluate",
"(",
"self",
",",
"environment",
"=",
"None",
")",
":",
"current_environment",
"=",
"default_environment",
"(",
")",
"if",
"environment",
"is",
"not",
"None",
":",
"current_environment",
".",
"update",
"(",
"environment",
")",
"return",
"_ev... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pkg_resources/_vendor/packaging/markers.py#L288-L301 | |
Slicer/Slicer | ba9fadf332cb0303515b68d8d06a344c82e3e3e5 | Base/Python/slicer/util.py | python | arrayFromModelCellDataModified | (modelNode, arrayName) | Indicate that modification of a numpy array returned by :py:meth:`arrayFromModelCellData` has been completed. | Indicate that modification of a numpy array returned by :py:meth:`arrayFromModelCellData` has been completed. | [
"Indicate",
"that",
"modification",
"of",
"a",
"numpy",
"array",
"returned",
"by",
":",
"py",
":",
"meth",
":",
"arrayFromModelCellData",
"has",
"been",
"completed",
"."
] | def arrayFromModelCellDataModified(modelNode, arrayName):
"""Indicate that modification of a numpy array returned by :py:meth:`arrayFromModelCellData` has been completed."""
arrayVtk = _vtkArrayFromModelData(modelNode, arrayName, 'cell')
arrayVtk.Modified() | [
"def",
"arrayFromModelCellDataModified",
"(",
"modelNode",
",",
"arrayName",
")",
":",
"arrayVtk",
"=",
"_vtkArrayFromModelData",
"(",
"modelNode",
",",
"arrayName",
",",
"'cell'",
")",
"arrayVtk",
".",
"Modified",
"(",
")"
] | https://github.com/Slicer/Slicer/blob/ba9fadf332cb0303515b68d8d06a344c82e3e3e5/Base/Python/slicer/util.py#L1570-L1573 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_core.py | python | App.SetOutputWindowAttributes | (self, title=None, pos=None, size=None) | Set the title, position and/or size of the output window if
the stdio has been redirected. This should be called before
any output would cause the output window to be created. | Set the title, position and/or size of the output window if
the stdio has been redirected. This should be called before
any output would cause the output window to be created. | [
"Set",
"the",
"title",
"position",
"and",
"/",
"or",
"size",
"of",
"the",
"output",
"window",
"if",
"the",
"stdio",
"has",
"been",
"redirected",
".",
"This",
"should",
"be",
"called",
"before",
"any",
"output",
"would",
"cause",
"the",
"output",
"window",
... | def SetOutputWindowAttributes(self, title=None, pos=None, size=None):
"""
Set the title, position and/or size of the output window if
the stdio has been redirected. This should be called before
any output would cause the output window to be created.
"""
if self.stdioWin:... | [
"def",
"SetOutputWindowAttributes",
"(",
"self",
",",
"title",
"=",
"None",
",",
"pos",
"=",
"None",
",",
"size",
"=",
"None",
")",
":",
"if",
"self",
".",
"stdioWin",
":",
"if",
"title",
"is",
"not",
"None",
":",
"self",
".",
"stdioWin",
".",
"title... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_core.py#L8677-L8689 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/profiler/pprof_profiler.py | python | profile | (graph, run_metadata, output_dir=None) | return profile_files | Generate profiles in pprof format.
See https://github.com/google/pprof/blob/master/proto/profile.proto
for pprof proto format.
Args:
graph: A `Graph` object.
run_metadata: A `RunMetadata` proto.
output_dir: (string) Directory to output pprof profile to.
Profile files for each device will be st... | Generate profiles in pprof format. | [
"Generate",
"profiles",
"in",
"pprof",
"format",
"."
] | def profile(graph, run_metadata, output_dir=None):
"""Generate profiles in pprof format.
See https://github.com/google/pprof/blob/master/proto/profile.proto
for pprof proto format.
Args:
graph: A `Graph` object.
run_metadata: A `RunMetadata` proto.
output_dir: (string) Directory to output pprof pr... | [
"def",
"profile",
"(",
"graph",
",",
"run_metadata",
",",
"output_dir",
"=",
"None",
")",
":",
"profiles",
"=",
"get_profiles",
"(",
"graph",
",",
"run_metadata",
")",
"output_file_template",
"=",
"None",
"if",
"output_dir",
":",
"if",
"not",
"os",
".",
"p... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/profiler/pprof_profiler.py#L405-L445 | |
facebook/proxygen | a9ca025af207787815cb01eee1971cd572c7a81e | build/fbcode_builder/getdeps/cargo.py | python | CargoBuilder._resolve_crate_to_path | (crate, git_conf) | Tries to find <crate> in git_conf["inst_dir"] by searching a [package]
keyword followed by name = "<crate>". | Tries to find <crate> in git_conf["inst_dir"] by searching a [package]
keyword followed by name = "<crate>". | [
"Tries",
"to",
"find",
"<crate",
">",
"in",
"git_conf",
"[",
"inst_dir",
"]",
"by",
"searching",
"a",
"[",
"package",
"]",
"keyword",
"followed",
"by",
"name",
"=",
"<crate",
">",
"."
] | def _resolve_crate_to_path(crate, git_conf):
"""
Tries to find <crate> in git_conf["inst_dir"] by searching a [package]
keyword followed by name = "<crate>".
"""
source_dir = git_conf["source_dir"]
search_pattern = '[package]\nname = "{}"'.format(crate)
for root,... | [
"def",
"_resolve_crate_to_path",
"(",
"crate",
",",
"git_conf",
")",
":",
"source_dir",
"=",
"git_conf",
"[",
"\"source_dir\"",
"]",
"search_pattern",
"=",
"'[package]\\nname = \"{}\"'",
".",
"format",
"(",
"crate",
")",
"for",
"root",
",",
"_",
",",
"files",
... | https://github.com/facebook/proxygen/blob/a9ca025af207787815cb01eee1971cd572c7a81e/build/fbcode_builder/getdeps/cargo.py#L300-L315 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/_lib/decorator.py | python | append | (a, vancestors) | Append ``a`` to the list of the virtual ancestors, unless it is already
included. | Append ``a`` to the list of the virtual ancestors, unless it is already
included. | [
"Append",
"a",
"to",
"the",
"list",
"of",
"the",
"virtual",
"ancestors",
"unless",
"it",
"is",
"already",
"included",
"."
] | def append(a, vancestors):
"""
Append ``a`` to the list of the virtual ancestors, unless it is already
included.
"""
add = True
for j, va in enumerate(vancestors):
if issubclass(va, a):
add = False
break
if issubclass(a, va):
vancestors[j] = a
... | [
"def",
"append",
"(",
"a",
",",
"vancestors",
")",
":",
"add",
"=",
"True",
"for",
"j",
",",
"va",
"in",
"enumerate",
"(",
"vancestors",
")",
":",
"if",
"issubclass",
"(",
"va",
",",
"a",
")",
":",
"add",
"=",
"False",
"break",
"if",
"issubclass",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/_lib/decorator.py#L305-L319 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/scipy/io/netcdf.py | python | netcdf_variable._apply_missing_value | (data, missing_value) | return newdata | Applies the given missing value to the data array.
Returns a numpy.ma array, with any value equal to missing_value masked
out (unless missing_value is None, in which case the original array is
returned). | Applies the given missing value to the data array. | [
"Applies",
"the",
"given",
"missing",
"value",
"to",
"the",
"data",
"array",
"."
] | def _apply_missing_value(data, missing_value):
"""
Applies the given missing value to the data array.
Returns a numpy.ma array, with any value equal to missing_value masked
out (unless missing_value is None, in which case the original array is
returned).
"""
if ... | [
"def",
"_apply_missing_value",
"(",
"data",
",",
"missing_value",
")",
":",
"if",
"missing_value",
"is",
"None",
":",
"newdata",
"=",
"data",
"else",
":",
"try",
":",
"missing_value_isnan",
"=",
"np",
".",
"isnan",
"(",
"missing_value",
")",
"except",
"(",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/scipy/io/netcdf.py#L1007-L1032 | |
limbo018/DREAMPlace | 146c3b9fd003d1acd52c96d9fd02e3f0a05154e4 | dreamplace/ops/draw_place/PlaceDrawer.py | python | PlaceDrawer.forward | (pos,
node_size_x,
node_size_y,
pin_offset_x,
pin_offset_y,
pin2node_map,
xl,
yl,
xh,
yh,
site_width,
row_height,
bin_size_x,
... | return 1 | @brief python implementation of placement drawer.
@param pos locations of cells
@param node_size_x array of cell width
@param node_size_y array of cell height
@param pin_offset_x pin offset to cell origin
@param pin_offset_y pin offset to cell origin
@param pin2nod... | [] | def forward(pos,
node_size_x,
node_size_y,
pin_offset_x,
pin_offset_y,
pin2node_map,
xl,
yl,
xh,
yh,
site_width,
row_height,
bin... | [
"def",
"forward",
"(",
"pos",
",",
"node_size_x",
",",
"node_size_y",
",",
"pin_offset_x",
",",
"pin_offset_y",
",",
"pin2node_map",
",",
"xl",
",",
"yl",
",",
"xh",
",",
"yh",
",",
"site_width",
",",
"row_height",
",",
"bin_size_x",
",",
"bin_size_y",
","... | https://github.com/limbo018/DREAMPlace/blob/146c3b9fd003d1acd52c96d9fd02e3f0a05154e4/dreamplace/ops/draw_place/PlaceDrawer.py#L21-L258 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_core.py | python | FlexGridSizer.RemoveGrowableCol | (*args, **kwargs) | return _core_.FlexGridSizer_RemoveGrowableCol(*args, **kwargs) | RemoveGrowableCol(self, size_t idx)
Specifies that column *idx* is no longer growable. | RemoveGrowableCol(self, size_t idx) | [
"RemoveGrowableCol",
"(",
"self",
"size_t",
"idx",
")"
] | def RemoveGrowableCol(*args, **kwargs):
"""
RemoveGrowableCol(self, size_t idx)
Specifies that column *idx* is no longer growable.
"""
return _core_.FlexGridSizer_RemoveGrowableCol(*args, **kwargs) | [
"def",
"RemoveGrowableCol",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"FlexGridSizer_RemoveGrowableCol",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_core.py#L15374-L15380 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/distutils/dist.py | python | Distribution.get_command_obj | (self, command, create=1) | return cmd_obj | Return the command object for 'command'. Normally this object
is cached on a previous call to 'get_command_obj()'; if no command
object for 'command' is in the cache, then we either create and
return it (if 'create' is true) or return None. | Return the command object for 'command'. Normally this object
is cached on a previous call to 'get_command_obj()'; if no command
object for 'command' is in the cache, then we either create and
return it (if 'create' is true) or return None. | [
"Return",
"the",
"command",
"object",
"for",
"command",
".",
"Normally",
"this",
"object",
"is",
"cached",
"on",
"a",
"previous",
"call",
"to",
"get_command_obj",
"()",
";",
"if",
"no",
"command",
"object",
"for",
"command",
"is",
"in",
"the",
"cache",
"th... | def get_command_obj(self, command, create=1):
"""Return the command object for 'command'. Normally this object
is cached on a previous call to 'get_command_obj()'; if no command
object for 'command' is in the cache, then we either create and
return it (if 'create' is true) or return Non... | [
"def",
"get_command_obj",
"(",
"self",
",",
"command",
",",
"create",
"=",
"1",
")",
":",
"cmd_obj",
"=",
"self",
".",
"command_obj",
".",
"get",
"(",
"command",
")",
"if",
"not",
"cmd_obj",
"and",
"create",
":",
"if",
"DEBUG",
":",
"self",
".",
"ann... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/distutils/dist.py#L833-L858 | |
openvinotoolkit/openvino | dedcbeafa8b84cccdc55ca64b8da516682b381c7 | tools/mo/openvino/tools/mo/back/remove_last_softmax_pattern.py | python | RemoveLastSoftMaxPattern.replace_pattern | (graph: Graph, match: dict) | Removes output SoftMax layer
:param graph: graph to operate on
:param match: dictionary with matched nodes | Removes output SoftMax layer
:param graph: graph to operate on
:param match: dictionary with matched nodes | [
"Removes",
"output",
"SoftMax",
"layer",
":",
"param",
"graph",
":",
"graph",
"to",
"operate",
"on",
":",
"param",
"match",
":",
"dictionary",
"with",
"matched",
"nodes"
] | def replace_pattern(graph: Graph, match: dict):
"""
Removes output SoftMax layer
:param graph: graph to operate on
:param match: dictionary with matched nodes
"""
if len(match['softmax_data'].out_nodes()) == 1:
remove_op_node_with_data_node(graph, match['softm... | [
"def",
"replace_pattern",
"(",
"graph",
":",
"Graph",
",",
"match",
":",
"dict",
")",
":",
"if",
"len",
"(",
"match",
"[",
"'softmax_data'",
"]",
".",
"out_nodes",
"(",
")",
")",
"==",
"1",
":",
"remove_op_node_with_data_node",
"(",
"graph",
",",
"match"... | https://github.com/openvinotoolkit/openvino/blob/dedcbeafa8b84cccdc55ca64b8da516682b381c7/tools/mo/openvino/tools/mo/back/remove_last_softmax_pattern.py#L31-L40 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/boto/boto/fps/connection.py | python | FPSConnection.refund | (self, action, response, **kw) | return self.get_object(action, kw, response) | Refunds a previously completed transaction. | Refunds a previously completed transaction. | [
"Refunds",
"a",
"previously",
"completed",
"transaction",
"."
] | def refund(self, action, response, **kw):
"""
Refunds a previously completed transaction.
"""
return self.get_object(action, kw, response) | [
"def",
"refund",
"(",
"self",
",",
"action",
",",
"response",
",",
"*",
"*",
"kw",
")",
":",
"return",
"self",
".",
"get_object",
"(",
"action",
",",
"kw",
",",
"response",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/boto/boto/fps/connection.py#L273-L277 | |
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/contrib/graph_editor/transform.py | python | transform_tensor_into_placeholder_handler | (info, t) | return t_ | Transform a tensor into a placeholder tensor.
This handler is typically used to transform a subgraph input tensor into a
placeholder.
Args:
info: Transform._Info instance.
t: tensor whose input must be transformed into a place holder.
Returns:
The tensor generated by the newly created place holder... | Transform a tensor into a placeholder tensor. | [
"Transform",
"a",
"tensor",
"into",
"a",
"placeholder",
"tensor",
"."
] | def transform_tensor_into_placeholder_handler(info, t):
"""Transform a tensor into a placeholder tensor.
This handler is typically used to transform a subgraph input tensor into a
placeholder.
Args:
info: Transform._Info instance.
t: tensor whose input must be transformed into a place holder.
Return... | [
"def",
"transform_tensor_into_placeholder_handler",
"(",
"info",
",",
"t",
")",
":",
"with",
"info",
".",
"graph_",
".",
"as_default",
"(",
")",
":",
"t_",
"=",
"util",
".",
"make_placeholder_from_tensor",
"(",
"t",
",",
"scope",
"=",
"info",
".",
"scope_",
... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/contrib/graph_editor/transform.py#L34-L48 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib-tk/Tkinter.py | python | Canvas.find_above | (self, tagOrId) | return self.find('above', tagOrId) | Return items above TAGORID. | Return items above TAGORID. | [
"Return",
"items",
"above",
"TAGORID",
"."
] | def find_above(self, tagOrId):
"""Return items above TAGORID."""
return self.find('above', tagOrId) | [
"def",
"find_above",
"(",
"self",
",",
"tagOrId",
")",
":",
"return",
"self",
".",
"find",
"(",
"'above'",
",",
"tagOrId",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib-tk/Tkinter.py#L2294-L2296 | |
openvinotoolkit/openvino | dedcbeafa8b84cccdc55ca64b8da516682b381c7 | src/bindings/python/src/compatibility/ngraph/opset1/ops.py | python | relu | (node: NodeInput, name: Optional[str] = None) | return _get_node_factory_opset1().create("Relu", [node]) | Perform rectified linear unit operation on input node element-wise.
:param node: One of: input node, array or scalar.
:param name: The optional output node name.
:return: The new node performing relu operation on its input element-wise. | Perform rectified linear unit operation on input node element-wise. | [
"Perform",
"rectified",
"linear",
"unit",
"operation",
"on",
"input",
"node",
"element",
"-",
"wise",
"."
] | def relu(node: NodeInput, name: Optional[str] = None) -> Node:
"""Perform rectified linear unit operation on input node element-wise.
:param node: One of: input node, array or scalar.
:param name: The optional output node name.
:return: The new node performing relu operation on its input element-wise.
... | [
"def",
"relu",
"(",
"node",
":",
"NodeInput",
",",
"name",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
")",
"->",
"Node",
":",
"return",
"_get_node_factory_opset1",
"(",
")",
".",
"create",
"(",
"\"Relu\"",
",",
"[",
"node",
"]",
")"
] | https://github.com/openvinotoolkit/openvino/blob/dedcbeafa8b84cccdc55ca64b8da516682b381c7/src/bindings/python/src/compatibility/ngraph/opset1/ops.py#L2247-L2254 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/difflib.py | python | SequenceMatcher.set_seq2 | (self, b) | Set the second sequence to be compared.
The first sequence to be compared is not changed.
>>> s = SequenceMatcher(None, "abcd", "bcde")
>>> s.ratio()
0.75
>>> s.set_seq2("abcd")
>>> s.ratio()
1.0
>>>
SequenceMatcher computes and caches detailed ... | Set the second sequence to be compared. | [
"Set",
"the",
"second",
"sequence",
"to",
"be",
"compared",
"."
] | def set_seq2(self, b):
"""Set the second sequence to be compared.
The first sequence to be compared is not changed.
>>> s = SequenceMatcher(None, "abcd", "bcde")
>>> s.ratio()
0.75
>>> s.set_seq2("abcd")
>>> s.ratio()
1.0
>>>
SequenceMat... | [
"def",
"set_seq2",
"(",
"self",
",",
"b",
")",
":",
"if",
"b",
"is",
"self",
".",
"b",
":",
"return",
"self",
".",
"b",
"=",
"b",
"self",
".",
"matching_blocks",
"=",
"self",
".",
"opcodes",
"=",
"None",
"self",
".",
"fullbcount",
"=",
"None",
"s... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/difflib.py#L253-L279 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/richtext.py | python | RichTextCtrl.MoveHome | (*args, **kwargs) | return _richtext.RichTextCtrl_MoveHome(*args, **kwargs) | MoveHome(self, int flags=0) -> bool
Move to the start of the buffer | MoveHome(self, int flags=0) -> bool | [
"MoveHome",
"(",
"self",
"int",
"flags",
"=",
"0",
")",
"-",
">",
"bool"
] | def MoveHome(*args, **kwargs):
"""
MoveHome(self, int flags=0) -> bool
Move to the start of the buffer
"""
return _richtext.RichTextCtrl_MoveHome(*args, **kwargs) | [
"def",
"MoveHome",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"RichTextCtrl_MoveHome",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/richtext.py#L3784-L3790 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | scripts/SANS/sans/algorithm_detail/calculate_sans_transmission.py | python | _get_corrected_wavelength_workspace | (workspace, wav_range, detector_ids, calculate_transmission_state, data_type) | return group_ws.getItem(0) | Performs a prompt peak correction, a background correction, converts to wavelength and rebins.
:param workspace: the workspace which is being corrected.
:param wav_range: the wavelength corresponding to this run
:param detector_ids: a list of relevant detector ids
:param calculate_transmission_state: a... | Performs a prompt peak correction, a background correction, converts to wavelength and rebins. | [
"Performs",
"a",
"prompt",
"peak",
"correction",
"a",
"background",
"correction",
"converts",
"to",
"wavelength",
"and",
"rebins",
"."
] | def _get_corrected_wavelength_workspace(workspace, wav_range, detector_ids, calculate_transmission_state, data_type):
"""
Performs a prompt peak correction, a background correction, converts to wavelength and rebins.
:param workspace: the workspace which is being corrected.
:param wav_range: the wavele... | [
"def",
"_get_corrected_wavelength_workspace",
"(",
"workspace",
",",
"wav_range",
",",
"detector_ids",
",",
"calculate_transmission_state",
",",
"data_type",
")",
":",
"# Extract the relevant spectra. These include",
"# 1. The incident monitor spectrum",
"# 2. The transmission spectr... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/SANS/sans/algorithm_detail/calculate_sans_transmission.py#L179-L273 | |
neoml-lib/neoml | a0d370fba05269a1b2258cef126f77bbd2054a3e | NeoML/Python/neoml/Dnn/Ctc.py | python | CtcLoss.skip | (self, value) | Specifies if blank labels may be skipped when aligning. | Specifies if blank labels may be skipped when aligning. | [
"Specifies",
"if",
"blank",
"labels",
"may",
"be",
"skipped",
"when",
"aligning",
"."
] | def skip(self, value):
"""Specifies if blank labels may be skipped when aligning.
"""
self._internal.set_skip(bool(value)) | [
"def",
"skip",
"(",
"self",
",",
"value",
")",
":",
"self",
".",
"_internal",
".",
"set_skip",
"(",
"bool",
"(",
"value",
")",
")"
] | https://github.com/neoml-lib/neoml/blob/a0d370fba05269a1b2258cef126f77bbd2054a3e/NeoML/Python/neoml/Dnn/Ctc.py#L146-L149 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/wsgiref/headers.py | python | Headers.__delitem__ | (self,name) | Delete all occurrences of a header, if present.
Does *not* raise an exception if the header is missing. | Delete all occurrences of a header, if present. | [
"Delete",
"all",
"occurrences",
"of",
"a",
"header",
"if",
"present",
"."
] | def __delitem__(self,name):
"""Delete all occurrences of a header, if present.
Does *not* raise an exception if the header is missing.
"""
name = name.lower()
self._headers[:] = [kv for kv in self._headers if kv[0].lower() != name] | [
"def",
"__delitem__",
"(",
"self",
",",
"name",
")",
":",
"name",
"=",
"name",
".",
"lower",
"(",
")",
"self",
".",
"_headers",
"[",
":",
"]",
"=",
"[",
"kv",
"for",
"kv",
"in",
"self",
".",
"_headers",
"if",
"kv",
"[",
"0",
"]",
".",
"lower",
... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/wsgiref/headers.py#L48-L54 | ||
llvm-dcpu16/llvm-dcpu16 | ae6b01fecd03219677e391d4421df5d966d80dcf | bindings/python/llvm/object.py | python | Symbol.expire | (self) | Mark the object as expired to prevent future API accesses.
This is called internally by this module and it is unlikely that
external callers have a legitimate reason for using it. | Mark the object as expired to prevent future API accesses. | [
"Mark",
"the",
"object",
"as",
"expired",
"to",
"prevent",
"future",
"API",
"accesses",
"."
] | def expire(self):
"""Mark the object as expired to prevent future API accesses.
This is called internally by this module and it is unlikely that
external callers have a legitimate reason for using it.
"""
self.expired = True | [
"def",
"expire",
"(",
"self",
")",
":",
"self",
".",
"expired",
"=",
"True"
] | https://github.com/llvm-dcpu16/llvm-dcpu16/blob/ae6b01fecd03219677e391d4421df5d966d80dcf/bindings/python/llvm/object.py#L351-L357 | ||
bulletphysics/bullet3 | f0f2a952e146f016096db6f85cf0c44ed75b0b9a | examples/pybullet/gym/pybullet_envs/minitaur/envs/minitaur.py | python | Minitaur._GetDelayedObservation | (self, latency) | return observation | Get observation that is delayed by the amount specified in latency.
Args:
latency: The latency (in seconds) of the delayed observation.
Returns:
observation: The observation which was actually latency seconds ago. | Get observation that is delayed by the amount specified in latency. | [
"Get",
"observation",
"that",
"is",
"delayed",
"by",
"the",
"amount",
"specified",
"in",
"latency",
"."
] | def _GetDelayedObservation(self, latency):
"""Get observation that is delayed by the amount specified in latency.
Args:
latency: The latency (in seconds) of the delayed observation.
Returns:
observation: The observation which was actually latency seconds ago.
"""
if latency <= 0 or len(... | [
"def",
"_GetDelayedObservation",
"(",
"self",
",",
"latency",
")",
":",
"if",
"latency",
"<=",
"0",
"or",
"len",
"(",
"self",
".",
"_observation_history",
")",
"==",
"1",
":",
"observation",
"=",
"self",
".",
"_observation_history",
"[",
"0",
"]",
"else",
... | https://github.com/bulletphysics/bullet3/blob/f0f2a952e146f016096db6f85cf0c44ed75b0b9a/examples/pybullet/gym/pybullet_envs/minitaur/envs/minitaur.py#L848-L866 | |
InsightSoftwareConsortium/ITK | 87acfce9a93d928311c38bc371b666b515b9f19d | Wrapping/Generators/Python/itk/support/extras.py | python | templated_class.__getitem__ | (self, template_parameters) | return templated_class.__templated_class_and_parameters__(
self, template_parameters
) | Return a pair class-template parameters ready to be instantiated.
The template parameters may be validated if the custom class provide
the static method check_template_parameters(parameters). | Return a pair class-template parameters ready to be instantiated. | [
"Return",
"a",
"pair",
"class",
"-",
"template",
"parameters",
"ready",
"to",
"be",
"instantiated",
"."
] | def __getitem__(self, template_parameters):
"""Return a pair class-template parameters ready to be instantiated.
The template parameters may be validated if the custom class provide
the static method check_template_parameters(parameters).
"""
if not isinstance(template_parameter... | [
"def",
"__getitem__",
"(",
"self",
",",
"template_parameters",
")",
":",
"if",
"not",
"isinstance",
"(",
"template_parameters",
",",
"tuple",
")",
":",
"template_parameters",
"=",
"(",
"template_parameters",
",",
")",
"return",
"templated_class",
".",
"__templated... | https://github.com/InsightSoftwareConsortium/ITK/blob/87acfce9a93d928311c38bc371b666b515b9f19d/Wrapping/Generators/Python/itk/support/extras.py#L1354-L1364 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/idlelib/PyShell.py | python | ModifiedInterpreter.open_remote_stack_viewer | (self) | return | Initiate the remote stack viewer from a separate thread.
This method is called from the subprocess, and by returning from this
method we allow the subprocess to unblock. After a bit the shell
requests the subprocess to open the remote stack viewer which returns a
static object looking ... | Initiate the remote stack viewer from a separate thread. | [
"Initiate",
"the",
"remote",
"stack",
"viewer",
"from",
"a",
"separate",
"thread",
"."
] | def open_remote_stack_viewer(self):
"""Initiate the remote stack viewer from a separate thread.
This method is called from the subprocess, and by returning from this
method we allow the subprocess to unblock. After a bit the shell
requests the subprocess to open the remote stack viewer... | [
"def",
"open_remote_stack_viewer",
"(",
"self",
")",
":",
"self",
".",
"tkconsole",
".",
"text",
".",
"after",
"(",
"300",
",",
"self",
".",
"remote_stack_viewer",
")",
"return"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/idlelib/PyShell.py#L612-L623 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/tempfile.py | python | gettempprefixb | () | return _os.fsencode(gettempprefix()) | The default prefix for temporary directories as bytes. | The default prefix for temporary directories as bytes. | [
"The",
"default",
"prefix",
"for",
"temporary",
"directories",
"as",
"bytes",
"."
] | def gettempprefixb():
"""The default prefix for temporary directories as bytes."""
return _os.fsencode(gettempprefix()) | [
"def",
"gettempprefixb",
"(",
")",
":",
"return",
"_os",
".",
"fsencode",
"(",
"gettempprefix",
"(",
")",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/tempfile.py#L278-L280 | |
weolar/miniblink49 | 1c4678db0594a4abde23d3ebbcc7cd13c3170777 | third_party/skia/bench/gen_bench_expectations.py | python | main | () | Reads bench data points, then calculate and export expectations. | Reads bench data points, then calculate and export expectations. | [
"Reads",
"bench",
"data",
"points",
"then",
"calculate",
"and",
"export",
"expectations",
"."
] | def main():
"""Reads bench data points, then calculate and export expectations.
"""
parser = argparse.ArgumentParser()
parser.add_argument(
'-a', '--representation_alg', default='25th',
help='bench representation algorithm to use, see bench_util.py.')
parser.add_argument(
'-b... | [
"def",
"main",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
")",
"parser",
".",
"add_argument",
"(",
"'-a'",
",",
"'--representation_alg'",
",",
"default",
"=",
"'25th'",
",",
"help",
"=",
"'bench representation algorithm to use, see bench... | https://github.com/weolar/miniblink49/blob/1c4678db0594a4abde23d3ebbcc7cd13c3170777/third_party/skia/bench/gen_bench_expectations.py#L144-L219 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/tkinter/__init__.py | python | Toplevel.__init__ | (self, master=None, cnf={}, **kw) | Construct a toplevel widget with the parent MASTER.
Valid resource names: background, bd, bg, borderwidth, class,
colormap, container, cursor, height, highlightbackground,
highlightcolor, highlightthickness, menu, relief, screen, takefocus,
use, visual, width. | Construct a toplevel widget with the parent MASTER. | [
"Construct",
"a",
"toplevel",
"widget",
"with",
"the",
"parent",
"MASTER",
"."
] | def __init__(self, master=None, cnf={}, **kw):
"""Construct a toplevel widget with the parent MASTER.
Valid resource names: background, bd, bg, borderwidth, class,
colormap, container, cursor, height, highlightbackground,
highlightcolor, highlightthickness, menu, relief, screen, takefoc... | [
"def",
"__init__",
"(",
"self",
",",
"master",
"=",
"None",
",",
"cnf",
"=",
"{",
"}",
",",
"*",
"*",
"kw",
")",
":",
"if",
"kw",
":",
"cnf",
"=",
"_cnfmerge",
"(",
"(",
"cnf",
",",
"kw",
")",
")",
"extra",
"=",
"(",
")",
"for",
"wmkey",
"i... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/tkinter/__init__.py#L2322-L2346 | ||
google/clif | cab24d6a105609a65c95a36a1712ae3c20c7b5df | clif/pybind11/cindex/extractor.py | python | Function.from_cindex | (cls, cursor: Cursor, namespace: Text) | return cls(fq_name, is_pure_virtual, arguments, return_type) | Create a Type object from cindex cursor. | Create a Type object from cindex cursor. | [
"Create",
"a",
"Type",
"object",
"from",
"cindex",
"cursor",
"."
] | def from_cindex(cls, cursor: Cursor, namespace: Text):
"""Create a Type object from cindex cursor."""
fq_name = '::'.join([namespace, cursor.spelling])
is_pure_virtual = cursor.is_pure_virtual_method()
arguments = [
Type.from_cindex(x) for x in cursor.type.argument_types()
]
if cursor.ty... | [
"def",
"from_cindex",
"(",
"cls",
",",
"cursor",
":",
"Cursor",
",",
"namespace",
":",
"Text",
")",
":",
"fq_name",
"=",
"'::'",
".",
"join",
"(",
"[",
"namespace",
",",
"cursor",
".",
"spelling",
"]",
")",
"is_pure_virtual",
"=",
"cursor",
".",
"is_pu... | https://github.com/google/clif/blob/cab24d6a105609a65c95a36a1712ae3c20c7b5df/clif/pybind11/cindex/extractor.py#L142-L155 | |
deepmodeling/deepmd-kit | 159e45d248b0429844fb6a8cb3b3a201987c8d79 | deepmd/entrypoints/config.py | python | suggest_batch_size | (all_type: List[np.ndarray], min_atom: int) | return bs | Get suggestion for batch size.
Parameters
----------
all_type : List[np.ndarray]
list with arrays specifying elements of structures
min_atom : int
minimal number of atoms in batch
Returns
-------
List[int]
suggested batch sizes for each system | Get suggestion for batch size. | [
"Get",
"suggestion",
"for",
"batch",
"size",
"."
] | def suggest_batch_size(all_type: List[np.ndarray], min_atom: int) -> List[int]:
"""Get suggestion for batch size.
Parameters
----------
all_type : List[np.ndarray]
list with arrays specifying elements of structures
min_atom : int
minimal number of atoms in batch
Returns
---... | [
"def",
"suggest_batch_size",
"(",
"all_type",
":",
"List",
"[",
"np",
".",
"ndarray",
"]",
",",
"min_atom",
":",
"int",
")",
"->",
"List",
"[",
"int",
"]",
":",
"bs",
"=",
"[",
"]",
"for",
"ii",
"in",
"all_type",
":",
"natoms",
"=",
"len",
"(",
"... | https://github.com/deepmodeling/deepmd-kit/blob/159e45d248b0429844fb6a8cb3b3a201987c8d79/deepmd/entrypoints/config.py#L268-L290 | |
InsightSoftwareConsortium/ITK | 87acfce9a93d928311c38bc371b666b515b9f19d | Modules/ThirdParty/pygccxml/src/pygccxml/utils/utils.py | python | get_tr1 | (name) | return tr1 | In libstd++ the tr1 namespace needs special care.
Return either an empty string or tr1::, useful for
appending to search patterns.
Args:
name (str): the name of the declaration
Returns:
str: an empty string or "tr1::" | In libstd++ the tr1 namespace needs special care. | [
"In",
"libstd",
"++",
"the",
"tr1",
"namespace",
"needs",
"special",
"care",
"."
] | def get_tr1(name):
"""In libstd++ the tr1 namespace needs special care.
Return either an empty string or tr1::, useful for
appending to search patterns.
Args:
name (str): the name of the declaration
Returns:
str: an empty string or "tr1::"
"""
tr1 = ""
if "tr1" in name... | [
"def",
"get_tr1",
"(",
"name",
")",
":",
"tr1",
"=",
"\"\"",
"if",
"\"tr1\"",
"in",
"name",
":",
"tr1",
"=",
"\"tr1::\"",
"return",
"tr1"
] | https://github.com/InsightSoftwareConsortium/ITK/blob/87acfce9a93d928311c38bc371b666b515b9f19d/Modules/ThirdParty/pygccxml/src/pygccxml/utils/utils.py#L259-L274 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/ftplib.py | python | parse229 | (resp, peer) | return host, port | Parse the '229' response for an EPSV request.
Raises error_proto if it does not contain '(|||port|)'
Return ('host.addr.as.numbers', port#) tuple. | Parse the '229' response for an EPSV request.
Raises error_proto if it does not contain '(|||port|)'
Return ('host.addr.as.numbers', port#) tuple. | [
"Parse",
"the",
"229",
"response",
"for",
"an",
"EPSV",
"request",
".",
"Raises",
"error_proto",
"if",
"it",
"does",
"not",
"contain",
"(",
"|||port|",
")",
"Return",
"(",
"host",
".",
"addr",
".",
"as",
".",
"numbers",
"port#",
")",
"tuple",
"."
] | def parse229(resp, peer):
'''Parse the '229' response for an EPSV request.
Raises error_proto if it does not contain '(|||port|)'
Return ('host.addr.as.numbers', port#) tuple.'''
if resp[:3] != '229':
raise error_reply, resp
left = resp.find('(')
if left < 0: raise error_proto, resp
... | [
"def",
"parse229",
"(",
"resp",
",",
"peer",
")",
":",
"if",
"resp",
"[",
":",
"3",
"]",
"!=",
"'229'",
":",
"raise",
"error_reply",
",",
"resp",
"left",
"=",
"resp",
".",
"find",
"(",
"'('",
")",
"if",
"left",
"<",
"0",
":",
"raise",
"error_prot... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/ftplib.py#L856-L875 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/applications/workbench/workbench/plotting/propertiesdialog.py | python | PropertiesEditorBase.error_occurred | (self, exc) | Indicates a redraw error occurred. Derived classes should override this
and revert the state of the canvas and display the error | Indicates a redraw error occurred. Derived classes should override this
and revert the state of the canvas and display the error | [
"Indicates",
"a",
"redraw",
"error",
"occurred",
".",
"Derived",
"classes",
"should",
"override",
"this",
"and",
"revert",
"the",
"state",
"of",
"the",
"canvas",
"and",
"display",
"the",
"error"
] | def error_occurred(self, exc):
"""Indicates a redraw error occurred. Derived classes should override this
and revert the state of the canvas and display the error
"""
raise NotImplementedError("Derived classes should override error_occurred") | [
"def",
"error_occurred",
"(",
"self",
",",
"exc",
")",
":",
"raise",
"NotImplementedError",
"(",
"\"Derived classes should override error_occurred\"",
")"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/applications/workbench/workbench/plotting/propertiesdialog.py#L56-L60 | ||
ceph/ceph | 959663007321a369c83218414a29bd9dbc8bda3a | src/ceph-volume/ceph_volume/devices/raw/prepare.py | python | Prepare.safe_prepare | (self, args=None) | An intermediate step between `main()` and `prepare()` so that we can
capture the `self.osd_id` in case we need to rollback
:param args: Injected args, usually from `raw create` which compounds
both `prepare` and `create` | An intermediate step between `main()` and `prepare()` so that we can
capture the `self.osd_id` in case we need to rollback | [
"An",
"intermediate",
"step",
"between",
"main",
"()",
"and",
"prepare",
"()",
"so",
"that",
"we",
"can",
"capture",
"the",
"self",
".",
"osd_id",
"in",
"case",
"we",
"need",
"to",
"rollback"
] | def safe_prepare(self, args=None):
"""
An intermediate step between `main()` and `prepare()` so that we can
capture the `self.osd_id` in case we need to rollback
:param args: Injected args, usually from `raw create` which compounds
both `prepare` and `create`
... | [
"def",
"safe_prepare",
"(",
"self",
",",
"args",
"=",
"None",
")",
":",
"if",
"args",
"is",
"not",
"None",
":",
"self",
".",
"args",
"=",
"args",
"try",
":",
"self",
".",
"prepare",
"(",
")",
"except",
"Exception",
":",
"logger",
".",
"exception",
... | https://github.com/ceph/ceph/blob/959663007321a369c83218414a29bd9dbc8bda3a/src/ceph-volume/ceph_volume/devices/raw/prepare.py#L80-L98 | ||
papyrussolution/OpenPapyrus | bbfb5ec2ea2109b8e2f125edd838e12eaf7b8b91 | Src/OSF/protobuf-3.19.1/python/google/protobuf/internal/extension_dict.py | python | _ExtensionDict._FindExtensionByNumber | (self, number) | return self._extended_message._extensions_by_number.get(number, None) | Tries to find a known extension with the field number.
Args:
number: Extension field number.
Returns:
Extension field descriptor. | Tries to find a known extension with the field number. | [
"Tries",
"to",
"find",
"a",
"known",
"extension",
"with",
"the",
"field",
"number",
"."
] | def _FindExtensionByNumber(self, number):
"""Tries to find a known extension with the field number.
Args:
number: Extension field number.
Returns:
Extension field descriptor.
"""
return self._extended_message._extensions_by_number.get(number, None) | [
"def",
"_FindExtensionByNumber",
"(",
"self",
",",
"number",
")",
":",
"return",
"self",
".",
"_extended_message",
".",
"_extensions_by_number",
".",
"get",
"(",
"number",
",",
"None",
")"
] | https://github.com/papyrussolution/OpenPapyrus/blob/bbfb5ec2ea2109b8e2f125edd838e12eaf7b8b91/Src/OSF/protobuf-3.19.1/python/google/protobuf/internal/extension_dict.py#L183-L192 | |
facebook/bistro | db9eff7e92f5cedcc917a440d5c88064c7980e40 | build/fbcode_builder/shell_quoting.py | python | shell_join | (delim, it) | return ShellQuoted(delim.join(raw_shell(s) for s in it)) | Joins an iterable of ShellQuoted with a delimiter between each two | Joins an iterable of ShellQuoted with a delimiter between each two | [
"Joins",
"an",
"iterable",
"of",
"ShellQuoted",
"with",
"a",
"delimiter",
"between",
"each",
"two"
] | def shell_join(delim, it):
"Joins an iterable of ShellQuoted with a delimiter between each two"
return ShellQuoted(delim.join(raw_shell(s) for s in it)) | [
"def",
"shell_join",
"(",
"delim",
",",
"it",
")",
":",
"return",
"ShellQuoted",
"(",
"delim",
".",
"join",
"(",
"raw_shell",
"(",
"s",
")",
"for",
"s",
"in",
"it",
")",
")"
] | https://github.com/facebook/bistro/blob/db9eff7e92f5cedcc917a440d5c88064c7980e40/build/fbcode_builder/shell_quoting.py#L84-L86 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/typing/context.py | python | BaseContext.can_convert | (self, fromty, toty) | Check whether conversion is possible from *fromty* to *toty*.
If successful, return a numba.typeconv.Conversion instance;
otherwise None is returned. | Check whether conversion is possible from *fromty* to *toty*.
If successful, return a numba.typeconv.Conversion instance;
otherwise None is returned. | [
"Check",
"whether",
"conversion",
"is",
"possible",
"from",
"*",
"fromty",
"*",
"to",
"*",
"toty",
"*",
".",
"If",
"successful",
"return",
"a",
"numba",
".",
"typeconv",
".",
"Conversion",
"instance",
";",
"otherwise",
"None",
"is",
"returned",
"."
] | def can_convert(self, fromty, toty):
"""
Check whether conversion is possible from *fromty* to *toty*.
If successful, return a numba.typeconv.Conversion instance;
otherwise None is returned.
"""
if fromty == toty:
return Conversion.exact
else:
... | [
"def",
"can_convert",
"(",
"self",
",",
"fromty",
",",
"toty",
")",
":",
"if",
"fromty",
"==",
"toty",
":",
"return",
"Conversion",
".",
"exact",
"else",
":",
"# First check with the type manager (some rules are registered",
"# at startup there, see numba.typeconv.rules)"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/typing/context.py#L499-L522 | ||
root-project/root | fcd3583bb14852bf2e8cd2415717cbaac0e75896 | interpreter/llvm/src/bindings/python/llvm/object.py | python | Relocation.type_name | (self) | return lib.LLVMGetRelocationTypeName(self) | The relocation type's name, as a str. | The relocation type's name, as a str. | [
"The",
"relocation",
"type",
"s",
"name",
"as",
"a",
"str",
"."
] | def type_name(self):
"""The relocation type's name, as a str."""
if self.expired:
raise Exception('Relocation instance has expired.')
return lib.LLVMGetRelocationTypeName(self) | [
"def",
"type_name",
"(",
"self",
")",
":",
"if",
"self",
".",
"expired",
":",
"raise",
"Exception",
"(",
"'Relocation instance has expired.'",
")",
"return",
"lib",
".",
"LLVMGetRelocationTypeName",
"(",
"self",
")"
] | https://github.com/root-project/root/blob/fcd3583bb14852bf2e8cd2415717cbaac0e75896/interpreter/llvm/src/bindings/python/llvm/object.py#L399-L404 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/extern/aui/tabart.py | python | AuiSimpleTabArt.GetNormalFont | (self) | return self._normal_font | Returns the normal font for drawing tab labels. | Returns the normal font for drawing tab labels. | [
"Returns",
"the",
"normal",
"font",
"for",
"drawing",
"tab",
"labels",
"."
] | def GetNormalFont(self):
""" Returns the normal font for drawing tab labels. """
return self._normal_font | [
"def",
"GetNormalFont",
"(",
"self",
")",
":",
"return",
"self",
".",
"_normal_font"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/extern/aui/tabart.py#L1576-L1579 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/pydoc.py | python | HTMLDoc.namelink | (self, name, *dicts) | return name | Make a link for an identifier, given name-to-URL mappings. | Make a link for an identifier, given name-to-URL mappings. | [
"Make",
"a",
"link",
"for",
"an",
"identifier",
"given",
"name",
"-",
"to",
"-",
"URL",
"mappings",
"."
] | def namelink(self, name, *dicts):
"""Make a link for an identifier, given name-to-URL mappings."""
for dict in dicts:
if name in dict:
return '<a href="%s">%s</a>' % (dict[name], name)
return name | [
"def",
"namelink",
"(",
"self",
",",
"name",
",",
"*",
"dicts",
")",
":",
"for",
"dict",
"in",
"dicts",
":",
"if",
"name",
"in",
"dict",
":",
"return",
"'<a href=\"%s\">%s</a>'",
"%",
"(",
"dict",
"[",
"name",
"]",
",",
"name",
")",
"return",
"name"
... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/pydoc.py#L492-L497 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/ctypes/_aix.py | python | find_shared | (paths, name) | return (None, None) | paths is a list of directories to search for an archive.
name is the abbreviated name given to find_library().
Process: search "paths" for archive, and if an archive is found
return the result of get_member().
If an archive is not found then return None | paths is a list of directories to search for an archive.
name is the abbreviated name given to find_library().
Process: search "paths" for archive, and if an archive is found
return the result of get_member().
If an archive is not found then return None | [
"paths",
"is",
"a",
"list",
"of",
"directories",
"to",
"search",
"for",
"an",
"archive",
".",
"name",
"is",
"the",
"abbreviated",
"name",
"given",
"to",
"find_library",
"()",
".",
"Process",
":",
"search",
"paths",
"for",
"archive",
"and",
"if",
"an",
"a... | def find_shared(paths, name):
"""
paths is a list of directories to search for an archive.
name is the abbreviated name given to find_library().
Process: search "paths" for archive, and if an archive is found
return the result of get_member().
If an archive is not found then return None
"""
... | [
"def",
"find_shared",
"(",
"paths",
",",
"name",
")",
":",
"for",
"dir",
"in",
"paths",
":",
"# /lib is a symbolic link to /usr/lib, skip it",
"if",
"dir",
"==",
"\"/lib\"",
":",
"continue",
"# \"lib\" is prefixed to emulate compiler name resolution,",
"# e.g., -lc to libc"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/ctypes/_aix.py#L266-L289 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/email/message.py | python | Message.__bytes__ | (self) | return self.as_bytes() | Return the entire formatted message as a bytes object. | Return the entire formatted message as a bytes object. | [
"Return",
"the",
"entire",
"formatted",
"message",
"as",
"a",
"bytes",
"object",
"."
] | def __bytes__(self):
"""Return the entire formatted message as a bytes object.
"""
return self.as_bytes() | [
"def",
"__bytes__",
"(",
"self",
")",
":",
"return",
"self",
".",
"as_bytes",
"(",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/email/message.py#L161-L164 | |
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/python/turicreate/data_structures/sgraph.py | python | SGraph.get_fields | (self) | return self.get_vertex_fields() + self.get_edge_fields() | Return a list of vertex and edge attribute fields in the SGraph. If a
field is common to both vertex and edge attributes, it will show up
twice in the returned list.
Returns
-------
out : list
Names of fields contained in the vertex or edge data.
See Also
... | Return a list of vertex and edge attribute fields in the SGraph. If a
field is common to both vertex and edge attributes, it will show up
twice in the returned list. | [
"Return",
"a",
"list",
"of",
"vertex",
"and",
"edge",
"attribute",
"fields",
"in",
"the",
"SGraph",
".",
"If",
"a",
"field",
"is",
"common",
"to",
"both",
"vertex",
"and",
"edge",
"attributes",
"it",
"will",
"show",
"up",
"twice",
"in",
"the",
"returned"... | def get_fields(self):
"""
Return a list of vertex and edge attribute fields in the SGraph. If a
field is common to both vertex and edge attributes, it will show up
twice in the returned list.
Returns
-------
out : list
Names of fields contained in the... | [
"def",
"get_fields",
"(",
"self",
")",
":",
"return",
"self",
".",
"get_vertex_fields",
"(",
")",
"+",
"self",
".",
"get_edge_fields",
"(",
")"
] | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/python/turicreate/data_structures/sgraph.py#L758-L785 | |
apache/arrow | af33dd1157eb8d7d9bfac25ebf61445b793b7943 | dev/archery/archery/benchmark/runner.py | python | CppBenchmarkRunner.suites_binaries | (self) | return {os.path.basename(b): b for b in glob.glob(glob_expr)} | Returns a list of benchmark binaries for this build. | Returns a list of benchmark binaries for this build. | [
"Returns",
"a",
"list",
"of",
"benchmark",
"binaries",
"for",
"this",
"build",
"."
] | def suites_binaries(self):
""" Returns a list of benchmark binaries for this build. """
# Ensure build is up-to-date to run benchmarks
self.build()
# Not the best method, but works for now
glob_expr = os.path.join(self.build.binaries_dir, "*-benchmark")
return {os.path.ba... | [
"def",
"suites_binaries",
"(",
"self",
")",
":",
"# Ensure build is up-to-date to run benchmarks",
"self",
".",
"build",
"(",
")",
"# Not the best method, but works for now",
"glob_expr",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"build",
".",
"binaries... | https://github.com/apache/arrow/blob/af33dd1157eb8d7d9bfac25ebf61445b793b7943/dev/archery/archery/benchmark/runner.py#L135-L141 | |
generalized-intelligence/GAAS | 29ab17d3e8a4ba18edef3a57c36d8db6329fac73 | deprecated/algorithms/sfm/OpenSfM/opensfm/large/metadataset.py | python | MetaDataSet._submodel_path | (self, i) | return os.path.join(self.data_path, template % i) | Path to submodel i folder. | Path to submodel i folder. | [
"Path",
"to",
"submodel",
"i",
"folder",
"."
] | def _submodel_path(self, i):
"""Path to submodel i folder."""
template = self.config['submodel_relpath_template']
return os.path.join(self.data_path, template % i) | [
"def",
"_submodel_path",
"(",
"self",
",",
"i",
")",
":",
"template",
"=",
"self",
".",
"config",
"[",
"'submodel_relpath_template'",
"]",
"return",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"data_path",
",",
"template",
"%",
"i",
")"
] | https://github.com/generalized-intelligence/GAAS/blob/29ab17d3e8a4ba18edef3a57c36d8db6329fac73/deprecated/algorithms/sfm/OpenSfM/opensfm/large/metadataset.py#L34-L37 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Source/ThirdParty/CEF3/cef_source/tools/cef_parser.py | python | obj_analysis.is_result_vector | (self) | return (self.result_type == 'vector') | Returns true if this is a vector type. | Returns true if this is a vector type. | [
"Returns",
"true",
"if",
"this",
"is",
"a",
"vector",
"type",
"."
] | def is_result_vector(self):
""" Returns true if this is a vector type. """
return (self.result_type == 'vector') | [
"def",
"is_result_vector",
"(",
"self",
")",
":",
"return",
"(",
"self",
".",
"result_type",
"==",
"'vector'",
")"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Source/ThirdParty/CEF3/cef_source/tools/cef_parser.py#L1877-L1879 | |
dmlc/xgboost | 2775c2a1abd4b5b759ff517617434c8b9aeb4cc0 | python-package/xgboost/training.py | python | CVPack.__init__ | (self, dtrain, dtest, param) | Initialize the CVPack | Initialize the CVPack | [
"Initialize",
"the",
"CVPack"
] | def __init__(self, dtrain, dtest, param):
""""Initialize the CVPack"""
self.dtrain = dtrain
self.dtest = dtest
self.watchlist = [(dtrain, 'train'), (dtest, 'test')]
self.bst = Booster(param, [dtrain, dtest]) | [
"def",
"__init__",
"(",
"self",
",",
"dtrain",
",",
"dtest",
",",
"param",
")",
":",
"self",
".",
"dtrain",
"=",
"dtrain",
"self",
".",
"dtest",
"=",
"dtest",
"self",
".",
"watchlist",
"=",
"[",
"(",
"dtrain",
",",
"'train'",
")",
",",
"(",
"dtest"... | https://github.com/dmlc/xgboost/blob/2775c2a1abd4b5b759ff517617434c8b9aeb4cc0/python-package/xgboost/training.py#L189-L194 | ||
thalium/icebox | 99d147d5b9269222225443ce171b4fd46d8985d4 | third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2.py | python | isBlank | (ch) | return ret | This function is DEPRECATED. Use xmlIsBlank_ch or
xmlIsBlankQ instead | This function is DEPRECATED. Use xmlIsBlank_ch or
xmlIsBlankQ instead | [
"This",
"function",
"is",
"DEPRECATED",
".",
"Use",
"xmlIsBlank_ch",
"or",
"xmlIsBlankQ",
"instead"
] | def isBlank(ch):
"""This function is DEPRECATED. Use xmlIsBlank_ch or
xmlIsBlankQ instead """
ret = libxml2mod.xmlIsBlank(ch)
return ret | [
"def",
"isBlank",
"(",
"ch",
")",
":",
"ret",
"=",
"libxml2mod",
".",
"xmlIsBlank",
"(",
"ch",
")",
"return",
"ret"
] | https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2.py#L1033-L1037 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/grit/grit/format/policy_templates/writers/reg_writer.py | python | RegWriter.GetPolicySortingKey | (self, policy) | return (is_list, policy['name']) | Extracts a sorting key from a policy. These keys can be used for
list.sort() methods to sort policies.
See TemplateWriter.SortPoliciesGroupsFirst for usage. | Extracts a sorting key from a policy. These keys can be used for
list.sort() methods to sort policies.
See TemplateWriter.SortPoliciesGroupsFirst for usage. | [
"Extracts",
"a",
"sorting",
"key",
"from",
"a",
"policy",
".",
"These",
"keys",
"can",
"be",
"used",
"for",
"list",
".",
"sort",
"()",
"methods",
"to",
"sort",
"policies",
".",
"See",
"TemplateWriter",
".",
"SortPoliciesGroupsFirst",
"for",
"usage",
"."
] | def GetPolicySortingKey(self, policy):
'''Extracts a sorting key from a policy. These keys can be used for
list.sort() methods to sort policies.
See TemplateWriter.SortPoliciesGroupsFirst for usage.
'''
is_list = policy['type'] in ('list', 'string-enum-list')
# Lists come after regular policies.... | [
"def",
"GetPolicySortingKey",
"(",
"self",
",",
"policy",
")",
":",
"is_list",
"=",
"policy",
"[",
"'type'",
"]",
"in",
"(",
"'list'",
",",
"'string-enum-list'",
")",
"# Lists come after regular policies.",
"return",
"(",
"is_list",
",",
"policy",
"[",
"'name'",... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/grit/grit/format/policy_templates/writers/reg_writer.py#L45-L52 | |
nyuwireless-unipd/ns3-mmwave | 4ff9e87e8079764e04cbeccd8e85bff15ae16fb3 | bindings/python/rad_util.py | python | round_grid | (value, grid, mode=0) | return result | Round off the given value to the given grid size.
Arguments:
value -- value to be roudne
grid -- result must be a multiple of this
mode -- 0 nearest, 1 up, -1 down
Examples:
>>> round_grid(7.5, 5)
10
>>> round_grid(7.5, 5, mode=-1)
5
>>> round_grid(7.3, 5, mode=1)
10... | Round off the given value to the given grid size. | [
"Round",
"off",
"the",
"given",
"value",
"to",
"the",
"given",
"grid",
"size",
"."
] | def round_grid(value, grid, mode=0):
"""Round off the given value to the given grid size.
Arguments:
value -- value to be roudne
grid -- result must be a multiple of this
mode -- 0 nearest, 1 up, -1 down
Examples:
>>> round_grid(7.5, 5)
10
>>> round_grid(7.5, 5, mode=-1)
... | [
"def",
"round_grid",
"(",
"value",
",",
"grid",
",",
"mode",
"=",
"0",
")",
":",
"off_grid",
"=",
"value",
"%",
"grid",
"if",
"mode",
"==",
"0",
":",
"add_one",
"=",
"int",
"(",
"off_grid",
">=",
"(",
"grid",
"/",
"2.0",
")",
")",
"elif",
"mode",... | https://github.com/nyuwireless-unipd/ns3-mmwave/blob/4ff9e87e8079764e04cbeccd8e85bff15ae16fb3/bindings/python/rad_util.py#L842-L873 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/idlelib/config.py | python | IdleConf.GetExtnNameForEvent | (self, virtualEvent) | return extName | Return the name of the extension binding virtualEvent, or None.
virtualEvent - string, name of the virtual event to test for,
without the enclosing '<< >>' | Return the name of the extension binding virtualEvent, or None. | [
"Return",
"the",
"name",
"of",
"the",
"extension",
"binding",
"virtualEvent",
"or",
"None",
"."
] | def GetExtnNameForEvent(self, virtualEvent):
"""Return the name of the extension binding virtualEvent, or None.
virtualEvent - string, name of the virtual event to test for,
without the enclosing '<< >>'
"""
extName = None
vEvent = '<<' + virtualEvent + '>... | [
"def",
"GetExtnNameForEvent",
"(",
"self",
",",
"virtualEvent",
")",
":",
"extName",
"=",
"None",
"vEvent",
"=",
"'<<'",
"+",
"virtualEvent",
"+",
"'>>'",
"for",
"extn",
"in",
"self",
".",
"GetExtensions",
"(",
"active_only",
"=",
"0",
")",
":",
"for",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/idlelib/config.py#L457-L469 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/logging/config.py | python | DictConfigurator.configure_filter | (self, config) | return result | Configure a filter from a dictionary. | Configure a filter from a dictionary. | [
"Configure",
"a",
"filter",
"from",
"a",
"dictionary",
"."
] | def configure_filter(self, config):
"""Configure a filter from a dictionary."""
if '()' in config:
result = self.configure_custom(config)
else:
name = config.get('name', '')
result = logging.Filter(name)
return result | [
"def",
"configure_filter",
"(",
"self",
",",
"config",
")",
":",
"if",
"'()'",
"in",
"config",
":",
"result",
"=",
"self",
".",
"configure_custom",
"(",
"config",
")",
"else",
":",
"name",
"=",
"config",
".",
"get",
"(",
"'name'",
",",
"''",
")",
"re... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/logging/config.py#L677-L684 | |
isc-projects/kea | c5836c791b63f42173bb604dd5f05d7110f3e716 | hammer.py | python | _install_gtest_sources | () | Install gtest sources. | Install gtest sources. | [
"Install",
"gtest",
"sources",
"."
] | def _install_gtest_sources():
"""Install gtest sources."""
# download gtest sources only if it is not present as native package
if not os.path.exists('/usr/src/googletest-release-1.10.0/googletest'):
cmd = 'wget --no-verbose -O /tmp/gtest.tar.gz '
cmd += 'https://github.com/google/googletest... | [
"def",
"_install_gtest_sources",
"(",
")",
":",
"# download gtest sources only if it is not present as native package",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"'/usr/src/googletest-release-1.10.0/googletest'",
")",
":",
"cmd",
"=",
"'wget --no-verbose -O /tmp/gtest... | https://github.com/isc-projects/kea/blob/c5836c791b63f42173bb604dd5f05d7110f3e716/hammer.py#L1020-L1030 | ||
psnonis/FinBERT | c0c555d833a14e2316a3701e59c0b5156f804b4e | bert-gpu/utils/create_glue_data.py | python | XnliProcessor.get_labels | (self) | return ["contradiction", "entailment", "neutral"] | See base class. | See base class. | [
"See",
"base",
"class",
"."
] | def get_labels(self):
"""See base class."""
return ["contradiction", "entailment", "neutral"] | [
"def",
"get_labels",
"(",
"self",
")",
":",
"return",
"[",
"\"contradiction\"",
",",
"\"entailment\"",
",",
"\"neutral\"",
"]"
] | https://github.com/psnonis/FinBERT/blob/c0c555d833a14e2316a3701e59c0b5156f804b4e/bert-gpu/utils/create_glue_data.py#L176-L178 | |
apache/impala | 8ddac48f3428c86f2cbd037ced89cfb903298b12 | shell/ext-py/sqlparse-0.3.1/sqlparse/formatter.py | python | validate_options | (options) | return options | Validates options. | Validates options. | [
"Validates",
"options",
"."
] | def validate_options(options):
"""Validates options."""
kwcase = options.get('keyword_case')
if kwcase not in [None, 'upper', 'lower', 'capitalize']:
raise SQLParseError('Invalid value for keyword_case: '
'{0!r}'.format(kwcase))
idcase = options.get('identifier_case'... | [
"def",
"validate_options",
"(",
"options",
")",
":",
"kwcase",
"=",
"options",
".",
"get",
"(",
"'keyword_case'",
")",
"if",
"kwcase",
"not",
"in",
"[",
"None",
",",
"'upper'",
",",
"'lower'",
",",
"'capitalize'",
"]",
":",
"raise",
"SQLParseError",
"(",
... | https://github.com/apache/impala/blob/8ddac48f3428c86f2cbd037ced89cfb903298b12/shell/ext-py/sqlparse-0.3.1/sqlparse/formatter.py#L15-L130 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/dataset/vision/py_transforms_util.py | python | adjust_saturation | (img, saturation_factor) | return img | Adjust saturation of an image.
Args:
img (PIL image): PIL image to be adjusted.
saturation_factor (float): A non negative number indicated the factor by which
the saturation is adjusted. 0 will give a black and white image, 1 will
give the original.
Returns:
im... | Adjust saturation of an image. | [
"Adjust",
"saturation",
"of",
"an",
"image",
"."
] | def adjust_saturation(img, saturation_factor):
"""
Adjust saturation of an image.
Args:
img (PIL image): PIL image to be adjusted.
saturation_factor (float): A non negative number indicated the factor by which
the saturation is adjusted. 0 will give a black and white image, 1 w... | [
"def",
"adjust_saturation",
"(",
"img",
",",
"saturation_factor",
")",
":",
"if",
"not",
"is_pil",
"(",
"img",
")",
":",
"raise",
"TypeError",
"(",
"augment_error_message",
".",
"format",
"(",
"type",
"(",
"img",
")",
")",
")",
"enhancer",
"=",
"ImageEnhan... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/dataset/vision/py_transforms_util.py#L508-L526 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/jedi/jedi/evaluate/sys_path.py | python | dotted_path_in_sys_path | (sys_path, module_path) | return None | Returns the dotted path inside a sys.path as a list of names. | Returns the dotted path inside a sys.path as a list of names. | [
"Returns",
"the",
"dotted",
"path",
"inside",
"a",
"sys",
".",
"path",
"as",
"a",
"list",
"of",
"names",
"."
] | def dotted_path_in_sys_path(sys_path, module_path):
"""
Returns the dotted path inside a sys.path as a list of names.
"""
# First remove the suffix.
for suffix in all_suffixes():
if module_path.endswith(suffix):
module_path = module_path[:-len(suffix)]
break
else:
... | [
"def",
"dotted_path_in_sys_path",
"(",
"sys_path",
",",
"module_path",
")",
":",
"# First remove the suffix.",
"for",
"suffix",
"in",
"all_suffixes",
"(",
")",
":",
"if",
"module_path",
".",
"endswith",
"(",
"suffix",
")",
":",
"module_path",
"=",
"module_path",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/jedi/jedi/evaluate/sys_path.py#L199-L226 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/mapreduce/mapreduce/input_readers.py | python | _OldAbstractDatastoreInputReader.__init__ | (self,
entity_kind,
key_ranges=None,
ns_range=None,
batch_size=_BATCH_SIZE,
current_key_range=None,
filters=None) | Create new AbstractDatastoreInputReader object.
This is internal constructor. Use split_query in a concrete class instead.
Args:
entity_kind: entity kind as string.
key_ranges: a sequence of key_range.KeyRange instances to process. Only
one of key_ranges or ns_range can be non-None.
... | Create new AbstractDatastoreInputReader object. | [
"Create",
"new",
"AbstractDatastoreInputReader",
"object",
"."
] | def __init__(self,
entity_kind,
key_ranges=None,
ns_range=None,
batch_size=_BATCH_SIZE,
current_key_range=None,
filters=None):
"""Create new AbstractDatastoreInputReader object.
This is internal constructor. Use split_que... | [
"def",
"__init__",
"(",
"self",
",",
"entity_kind",
",",
"key_ranges",
"=",
"None",
",",
"ns_range",
"=",
"None",
",",
"batch_size",
"=",
"_BATCH_SIZE",
",",
"current_key_range",
"=",
"None",
",",
"filters",
"=",
"None",
")",
":",
"assert",
"key_ranges",
"... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/mapreduce/mapreduce/input_readers.py#L833-L869 | ||
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/python/ops/variables.py | python | Variable.dtype | (self) | return self._variable.dtype | The `DType` of this variable. | The `DType` of this variable. | [
"The",
"DType",
"of",
"this",
"variable",
"."
] | def dtype(self):
"""The `DType` of this variable."""
return self._variable.dtype | [
"def",
"dtype",
"(",
"self",
")",
":",
"return",
"self",
".",
"_variable",
".",
"dtype"
] | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/ops/variables.py#L677-L679 | |
quantOS-org/DataCore | e2ef9bd2c22ee9e2845675b6435a14fa607f3551 | mdlink/deps/windows/protobuf-2.5.0/python/google/protobuf/internal/decoder.py | python | _VarintDecoder | (mask) | return DecodeVarint | Return an encoder for a basic varint value (does not include tag).
Decoded values will be bitwise-anded with the given mask before being
returned, e.g. to limit them to 32 bits. The returned decoder does not
take the usual "end" parameter -- the caller is expected to do bounds checking
after the fact (often t... | Return an encoder for a basic varint value (does not include tag). | [
"Return",
"an",
"encoder",
"for",
"a",
"basic",
"varint",
"value",
"(",
"does",
"not",
"include",
"tag",
")",
"."
] | def _VarintDecoder(mask):
"""Return an encoder for a basic varint value (does not include tag).
Decoded values will be bitwise-anded with the given mask before being
returned, e.g. to limit them to 32 bits. The returned decoder does not
take the usual "end" parameter -- the caller is expected to do bounds che... | [
"def",
"_VarintDecoder",
"(",
"mask",
")",
":",
"local_ord",
"=",
"ord",
"def",
"DecodeVarint",
"(",
"buffer",
",",
"pos",
")",
":",
"result",
"=",
"0",
"shift",
"=",
"0",
"while",
"1",
":",
"b",
"=",
"local_ord",
"(",
"buffer",
"[",
"pos",
"]",
")... | https://github.com/quantOS-org/DataCore/blob/e2ef9bd2c22ee9e2845675b6435a14fa607f3551/mdlink/deps/windows/protobuf-2.5.0/python/google/protobuf/internal/decoder.py#L101-L125 | |
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/tools/inspector_protocol/jinja2/environment.py | python | load_extensions | (environment, extensions) | return result | Load the extensions from the list and bind it to the environment.
Returns a dict of instantiated environments. | Load the extensions from the list and bind it to the environment.
Returns a dict of instantiated environments. | [
"Load",
"the",
"extensions",
"from",
"the",
"list",
"and",
"bind",
"it",
"to",
"the",
"environment",
".",
"Returns",
"a",
"dict",
"of",
"instantiated",
"environments",
"."
] | def load_extensions(environment, extensions):
"""Load the extensions from the list and bind it to the environment.
Returns a dict of instantiated environments.
"""
result = {}
for extension in extensions:
if isinstance(extension, string_types):
extension = import_string(extension... | [
"def",
"load_extensions",
"(",
"environment",
",",
"extensions",
")",
":",
"result",
"=",
"{",
"}",
"for",
"extension",
"in",
"extensions",
":",
"if",
"isinstance",
"(",
"extension",
",",
"string_types",
")",
":",
"extension",
"=",
"import_string",
"(",
"ext... | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/tools/inspector_protocol/jinja2/environment.py#L78-L87 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | tools/cr/cr/actions/builder.py | python | Builder.GuessTargets | (self, context, target_name) | return difflib.get_close_matches(target_name, self.GetTargets(context)) | Returns a list of closest matching targets for a named target. | Returns a list of closest matching targets for a named target. | [
"Returns",
"a",
"list",
"of",
"closest",
"matching",
"targets",
"for",
"a",
"named",
"target",
"."
] | def GuessTargets(self, context, target_name):
"""Returns a list of closest matching targets for a named target."""
return difflib.get_close_matches(target_name, self.GetTargets(context)) | [
"def",
"GuessTargets",
"(",
"self",
",",
"context",
",",
"target_name",
")",
":",
"return",
"difflib",
".",
"get_close_matches",
"(",
"target_name",
",",
"self",
".",
"GetTargets",
"(",
"context",
")",
")"
] | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/tools/cr/cr/actions/builder.py#L62-L64 | |
luliyucoordinate/Leetcode | 96afcdc54807d1d184e881a075d1dbf3371e31fb | src/0230-Kth-Smallest-Element-in-a-BST/0230.py | python | Solution.kthSmallest | (self, root, k) | return result[k-1] | :type root: TreeNode
:type k: int
:rtype: int | :type root: TreeNode
:type k: int
:rtype: int | [
":",
"type",
"root",
":",
"TreeNode",
":",
"type",
"k",
":",
"int",
":",
"rtype",
":",
"int"
] | def kthSmallest(self, root, k):
"""
:type root: TreeNode
:type k: int
:rtype: int
"""
result = list()
stack = list()
while stack or root:
if root:
stack.append(root)
root = root.left
else:
... | [
"def",
"kthSmallest",
"(",
"self",
",",
"root",
",",
"k",
")",
":",
"result",
"=",
"list",
"(",
")",
"stack",
"=",
"list",
"(",
")",
"while",
"stack",
"or",
"root",
":",
"if",
"root",
":",
"stack",
".",
"append",
"(",
"root",
")",
"root",
"=",
... | https://github.com/luliyucoordinate/Leetcode/blob/96afcdc54807d1d184e881a075d1dbf3371e31fb/src/0230-Kth-Smallest-Element-in-a-BST/0230.py#L8-L27 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_core.py | python | Rect.IsEmpty | (*args, **kwargs) | return _core_.Rect_IsEmpty(*args, **kwargs) | IsEmpty(self) -> bool | IsEmpty(self) -> bool | [
"IsEmpty",
"(",
"self",
")",
"-",
">",
"bool"
] | def IsEmpty(*args, **kwargs):
"""IsEmpty(self) -> bool"""
return _core_.Rect_IsEmpty(*args, **kwargs) | [
"def",
"IsEmpty",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"Rect_IsEmpty",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_core.py#L1317-L1319 | |
jackaudio/jack2 | 21b293dbc37d42446141a08922cdec0d2550c6a0 | waflib/Node.py | python | Node.exists | (self) | return os.path.exists(self.abspath()) | Returns whether the Node is present on the filesystem
:rtype: bool | Returns whether the Node is present on the filesystem | [
"Returns",
"whether",
"the",
"Node",
"is",
"present",
"on",
"the",
"filesystem"
] | def exists(self):
"""
Returns whether the Node is present on the filesystem
:rtype: bool
"""
return os.path.exists(self.abspath()) | [
"def",
"exists",
"(",
"self",
")",
":",
"return",
"os",
".",
"path",
".",
"exists",
"(",
"self",
".",
"abspath",
"(",
")",
")"
] | https://github.com/jackaudio/jack2/blob/21b293dbc37d42446141a08922cdec0d2550c6a0/waflib/Node.py#L266-L272 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/richtext.py | python | RichTextParagraphLayoutBox.GetFloatCollector | (*args, **kwargs) | return _richtext.RichTextParagraphLayoutBox_GetFloatCollector(*args, **kwargs) | GetFloatCollector(self) -> wxRichTextFloatCollector | GetFloatCollector(self) -> wxRichTextFloatCollector | [
"GetFloatCollector",
"(",
"self",
")",
"-",
">",
"wxRichTextFloatCollector"
] | def GetFloatCollector(*args, **kwargs):
"""GetFloatCollector(self) -> wxRichTextFloatCollector"""
return _richtext.RichTextParagraphLayoutBox_GetFloatCollector(*args, **kwargs) | [
"def",
"GetFloatCollector",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"RichTextParagraphLayoutBox_GetFloatCollector",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/richtext.py#L1862-L1864 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/tpu/feature_column.py | python | _is_running_on_cpu | () | return tpu_function.get_tpu_context().number_of_shards is None | Returns True if the current context is CPU model. | Returns True if the current context is CPU model. | [
"Returns",
"True",
"if",
"the",
"current",
"context",
"is",
"CPU",
"model",
"."
] | def _is_running_on_cpu():
"""Returns True if the current context is CPU model."""
return tpu_function.get_tpu_context().number_of_shards is None | [
"def",
"_is_running_on_cpu",
"(",
")",
":",
"return",
"tpu_function",
".",
"get_tpu_context",
"(",
")",
".",
"number_of_shards",
"is",
"None"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/tpu/feature_column.py#L670-L672 | |
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/contrib/learn/python/learn/dataframe/transforms/densify.py | python | Densify._apply_transform | (self, input_tensors, **kwargs) | return self.return_type(sparse_ops.sparse_to_dense(
s.indices, s.shape, s.values, default_value=self.default_value)) | Applies the transformation to the `transform_input`.
Args:
input_tensors: a list of Tensors representing the input to
the Transform.
**kwargs: Additional keyword arguments, unused here.
Returns:
A namedtuple of Tensors representing the transformed output. | Applies the transformation to the `transform_input`. | [
"Applies",
"the",
"transformation",
"to",
"the",
"transform_input",
"."
] | def _apply_transform(self, input_tensors, **kwargs):
"""Applies the transformation to the `transform_input`.
Args:
input_tensors: a list of Tensors representing the input to
the Transform.
**kwargs: Additional keyword arguments, unused here.
Returns:
A namedtuple of Tensors rep... | [
"def",
"_apply_transform",
"(",
"self",
",",
"input_tensors",
",",
"*",
"*",
"kwargs",
")",
":",
"s",
"=",
"input_tensors",
"[",
"0",
"]",
"# pylint: disable=not-callable",
"return",
"self",
".",
"return_type",
"(",
"sparse_ops",
".",
"sparse_to_dense",
"(",
"... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/contrib/learn/python/learn/dataframe/transforms/densify.py#L50-L65 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_windows.py | python | PrintData.SetFilename | (*args, **kwargs) | return _windows_.PrintData_SetFilename(*args, **kwargs) | SetFilename(self, String filename) | SetFilename(self, String filename) | [
"SetFilename",
"(",
"self",
"String",
"filename",
")"
] | def SetFilename(*args, **kwargs):
"""SetFilename(self, String filename)"""
return _windows_.PrintData_SetFilename(*args, **kwargs) | [
"def",
"SetFilename",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"PrintData_SetFilename",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_windows.py#L4823-L4825 | |
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | caffe2/python/predictor/predictor_exporter.py | python | get_predictor_exporter_helper | (submodelNetName) | return pred_meta | constracting stub for the PredictorExportMeta
Only used to construct names to subfields,
such as calling to predict_net_name
Args:
submodelNetName - name of the model | constracting stub for the PredictorExportMeta
Only used to construct names to subfields,
such as calling to predict_net_name
Args:
submodelNetName - name of the model | [
"constracting",
"stub",
"for",
"the",
"PredictorExportMeta",
"Only",
"used",
"to",
"construct",
"names",
"to",
"subfields",
"such",
"as",
"calling",
"to",
"predict_net_name",
"Args",
":",
"submodelNetName",
"-",
"name",
"of",
"the",
"model"
] | def get_predictor_exporter_helper(submodelNetName):
""" constracting stub for the PredictorExportMeta
Only used to construct names to subfields,
such as calling to predict_net_name
Args:
submodelNetName - name of the model
"""
stub_net = core.Net(submodelNetName)
pred... | [
"def",
"get_predictor_exporter_helper",
"(",
"submodelNetName",
")",
":",
"stub_net",
"=",
"core",
".",
"Net",
"(",
"submodelNetName",
")",
"pred_meta",
"=",
"PredictorExportMeta",
"(",
"predict_net",
"=",
"stub_net",
",",
"parameters",
"=",
"[",
"]",
",",
"inpu... | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/caffe2/python/predictor/predictor_exporter.py#L18-L33 | |
rrwick/Unicycler | 96ffea71e3a78d63ade19d6124946773e65cf129 | unicycler/assembly_graph.py | python | AssemblyGraph.get_component_link_count | (self, component_segs) | return len(links) | Returns the total number of forward links in the component, not counting rev comp
duplicates. This function assumes the given segments make up a connected component - it
doesn't check. | Returns the total number of forward links in the component, not counting rev comp
duplicates. This function assumes the given segments make up a connected component - it
doesn't check. | [
"Returns",
"the",
"total",
"number",
"of",
"forward",
"links",
"in",
"the",
"component",
"not",
"counting",
"rev",
"comp",
"duplicates",
".",
"This",
"function",
"assumes",
"the",
"given",
"segments",
"make",
"up",
"a",
"connected",
"component",
"-",
"it",
"... | def get_component_link_count(self, component_segs):
"""
Returns the total number of forward links in the component, not counting rev comp
duplicates. This function assumes the given segments make up a connected component - it
doesn't check.
"""
links = set()
compo... | [
"def",
"get_component_link_count",
"(",
"self",
",",
"component_segs",
")",
":",
"links",
"=",
"set",
"(",
")",
"component_segs",
"=",
"set",
"(",
"component_segs",
")",
"# positive segment numbers",
"for",
"start",
",",
"ends",
"in",
"self",
".",
"forward_links... | https://github.com/rrwick/Unicycler/blob/96ffea71e3a78d63ade19d6124946773e65cf129/unicycler/assembly_graph.py#L1725-L1738 | |
libornovax/master_thesis_code | 6eca474ed3cae673afde010caef338cf7349f839 | scripts/data/mitss2bbtxt.py | python | translate_file | (path_file, path_images, outfile, label) | Translates a single XML file with MIT Street Scenes labels and appends its output to the given
BBTXT file.
Input:
path_file: Path to the XML file to be translated
path_images: Path to the "Original" folder, which contains the images
outfile: File handle of the open output BBTXT file
label: Which ... | Translates a single XML file with MIT Street Scenes labels and appends its output to the given
BBTXT file. | [
"Translates",
"a",
"single",
"XML",
"file",
"with",
"MIT",
"Street",
"Scenes",
"labels",
"and",
"appends",
"its",
"output",
"to",
"the",
"given",
"BBTXT",
"file",
"."
] | def translate_file(path_file, path_images, outfile, label):
"""
Translates a single XML file with MIT Street Scenes labels and appends its output to the given
BBTXT file.
Input:
path_file: Path to the XML file to be translated
path_images: Path to the "Original" folder, which contains the images
outfile: ... | [
"def",
"translate_file",
"(",
"path_file",
",",
"path_images",
",",
"outfile",
",",
"label",
")",
":",
"e",
"=",
"xml",
".",
"etree",
".",
"ElementTree",
".",
"parse",
"(",
"path_file",
")",
".",
"getroot",
"(",
")",
"path_image",
"=",
"os",
".",
"path... | https://github.com/libornovax/master_thesis_code/blob/6eca474ed3cae673afde010caef338cf7349f839/scripts/data/mitss2bbtxt.py#L54-L98 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/richtext.py | python | RichTextRenderer.EnumerateStandardBulletNames | (*args, **kwargs) | return _richtext.RichTextRenderer_EnumerateStandardBulletNames(*args, **kwargs) | EnumerateStandardBulletNames(self, wxArrayString bulletNames) -> bool | EnumerateStandardBulletNames(self, wxArrayString bulletNames) -> bool | [
"EnumerateStandardBulletNames",
"(",
"self",
"wxArrayString",
"bulletNames",
")",
"-",
">",
"bool"
] | def EnumerateStandardBulletNames(*args, **kwargs):
"""EnumerateStandardBulletNames(self, wxArrayString bulletNames) -> bool"""
return _richtext.RichTextRenderer_EnumerateStandardBulletNames(*args, **kwargs) | [
"def",
"EnumerateStandardBulletNames",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"RichTextRenderer_EnumerateStandardBulletNames",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/richtext.py#L2876-L2878 | |
okex/V3-Open-API-SDK | c5abb0db7e2287718e0055e17e57672ce0ec7fd9 | okex-python-sdk-api/venv/Lib/site-packages/pip-19.0.3-py3.8.egg/pip/_vendor/chardet/enums.py | python | SequenceLikelihood.get_num_categories | (cls) | return 4 | :returns: The number of likelihood categories in the enum. | :returns: The number of likelihood categories in the enum. | [
":",
"returns",
":",
"The",
"number",
"of",
"likelihood",
"categories",
"in",
"the",
"enum",
"."
] | def get_num_categories(cls):
""":returns: The number of likelihood categories in the enum."""
return 4 | [
"def",
"get_num_categories",
"(",
"cls",
")",
":",
"return",
"4"
] | https://github.com/okex/V3-Open-API-SDK/blob/c5abb0db7e2287718e0055e17e57672ce0ec7fd9/okex-python-sdk-api/venv/Lib/site-packages/pip-19.0.3-py3.8.egg/pip/_vendor/chardet/enums.py#L60-L62 | |
klzgrad/naiveproxy | ed2c513637c77b18721fe428d7ed395b4d284c83 | src/build/android/gyp/util/zipalign.py | python | _SetAlignment | (zip_obj, zip_info, alignment) | Sets a ZipInfo's extra field such that the file will be aligned.
Args:
zip_obj: The ZipFile object that is being written.
zip_info: The ZipInfo object about to be written.
alignment: The amount of alignment (e.g. 4, or 4*1024). | Sets a ZipInfo's extra field such that the file will be aligned. | [
"Sets",
"a",
"ZipInfo",
"s",
"extra",
"field",
"such",
"that",
"the",
"file",
"will",
"be",
"aligned",
"."
] | def _SetAlignment(zip_obj, zip_info, alignment):
"""Sets a ZipInfo's extra field such that the file will be aligned.
Args:
zip_obj: The ZipFile object that is being written.
zip_info: The ZipInfo object about to be written.
alignment: The amount of alignment (e.g. 4, or 4*1024).
"""
cur_offset = zi... | [
"def",
"_SetAlignment",
"(",
"zip_obj",
",",
"zip_info",
",",
"alignment",
")",
":",
"cur_offset",
"=",
"zip_obj",
".",
"fp",
".",
"tell",
"(",
")",
"header_size",
"=",
"_FIXED_ZIP_HEADER_LEN",
"+",
"len",
"(",
"zip_info",
".",
"filename",
")",
"padding_need... | https://github.com/klzgrad/naiveproxy/blob/ed2c513637c77b18721fe428d7ed395b4d284c83/src/build/android/gyp/util/zipalign.py#L62-L79 | ||
bulletphysics/bullet3 | f0f2a952e146f016096db6f85cf0c44ed75b0b9a | examples/pybullet/gym/pybullet_envs/minitaur/robots/safety/python/moving_window_filter.py | python | MovingWindowFilter._neumaier_sum | (self, value: float) | Update the moving window sum using Neumaier's algorithm.
For more details please refer to:
https://en.wikipedia.org/wiki/Kahan_summation_algorithm#Further_enhancements
Args:
value: The new value to be added to the window. | Update the moving window sum using Neumaier's algorithm. | [
"Update",
"the",
"moving",
"window",
"sum",
"using",
"Neumaier",
"s",
"algorithm",
"."
] | def _neumaier_sum(self, value: float):
"""Update the moving window sum using Neumaier's algorithm.
For more details please refer to:
https://en.wikipedia.org/wiki/Kahan_summation_algorithm#Further_enhancements
Args:
value: The new value to be added to the window.
"""
new_sum = self._sum... | [
"def",
"_neumaier_sum",
"(",
"self",
",",
"value",
":",
"float",
")",
":",
"new_sum",
"=",
"self",
".",
"_sum",
"+",
"value",
"if",
"abs",
"(",
"self",
".",
"_sum",
")",
">=",
"abs",
"(",
"value",
")",
":",
"# If self._sum is bigger, low-order digits of va... | https://github.com/bulletphysics/bullet3/blob/f0f2a952e146f016096db6f85cf0c44ed75b0b9a/examples/pybullet/gym/pybullet_envs/minitaur/robots/safety/python/moving_window_filter.py#L28-L46 | ||
apache/kudu | 90895ce76590f10730ad7aac3613b69d89ff5422 | build-support/iwyu/fix_includes.py | python | _NormalizeNamespaceForwardDeclareLines | (lines) | return retval[:-1] | Normalize' namespace lines in a list of output lines and return new list.
When suggesting new forward-declares to insert, iwyu uses the following
format, putting each class on its own line with all namespaces:
namespace foo { namespace bar { class A; } }
namespace foo { namespace bar { class B; } }
... | Normalize' namespace lines in a list of output lines and return new list. | [
"Normalize",
"namespace",
"lines",
"in",
"a",
"list",
"of",
"output",
"lines",
"and",
"return",
"new",
"list",
"."
] | def _NormalizeNamespaceForwardDeclareLines(lines):
"""'Normalize' namespace lines in a list of output lines and return new list.
When suggesting new forward-declares to insert, iwyu uses the following
format, putting each class on its own line with all namespaces:
namespace foo { namespace bar { class A; } ... | [
"def",
"_NormalizeNamespaceForwardDeclareLines",
"(",
"lines",
")",
":",
"# iwyu input is very regular, which is nice.",
"iwyu_namespace_re",
"=",
"re",
".",
"compile",
"(",
"r'namespace ([^{]*) { '",
")",
"iwyu_classname_re",
"=",
"re",
".",
"compile",
"(",
"r'{ ([^{}]*) }... | https://github.com/apache/kudu/blob/90895ce76590f10730ad7aac3613b69d89ff5422/build-support/iwyu/fix_includes.py#L1988-L2044 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py3/numpy/lib/scimath.py | python | arccos | (x) | return nx.arccos(x) | Compute the inverse cosine of x.
Return the "principal value" (for a description of this, see
`numpy.arccos`) of the inverse cosine of `x`. For real `x` such that
`abs(x) <= 1`, this is a real number in the closed interval
:math:`[0, \\pi]`. Otherwise, the complex principle value is returned.
Par... | Compute the inverse cosine of x. | [
"Compute",
"the",
"inverse",
"cosine",
"of",
"x",
"."
] | def arccos(x):
"""
Compute the inverse cosine of x.
Return the "principal value" (for a description of this, see
`numpy.arccos`) of the inverse cosine of `x`. For real `x` such that
`abs(x) <= 1`, this is a real number in the closed interval
:math:`[0, \\pi]`. Otherwise, the complex principle ... | [
"def",
"arccos",
"(",
"x",
")",
":",
"x",
"=",
"_fix_real_abs_gt_1",
"(",
"x",
")",
"return",
"nx",
".",
"arccos",
"(",
"x",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py3/numpy/lib/scimath.py#L479-L520 | |
Tencent/CMONGO | c40380caa14e05509f46993aa8b8da966b09b0b5 | src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Node/FS.py | python | Dir.walk | (self, func, arg) | Walk this directory tree by calling the specified function
for each directory in the tree.
This behaves like the os.path.walk() function, but for in-memory
Node.FS.Dir objects. The function takes the same arguments as
the functions passed to os.path.walk():
func(arg, d... | Walk this directory tree by calling the specified function
for each directory in the tree. | [
"Walk",
"this",
"directory",
"tree",
"by",
"calling",
"the",
"specified",
"function",
"for",
"each",
"directory",
"in",
"the",
"tree",
"."
] | def walk(self, func, arg):
"""
Walk this directory tree by calling the specified function
for each directory in the tree.
This behaves like the os.path.walk() function, but for in-memory
Node.FS.Dir objects. The function takes the same arguments as
the functions passed ... | [
"def",
"walk",
"(",
"self",
",",
"func",
",",
"arg",
")",
":",
"entries",
"=",
"self",
".",
"entries",
"names",
"=",
"list",
"(",
"entries",
".",
"keys",
"(",
")",
")",
"names",
".",
"remove",
"(",
"'.'",
")",
"names",
".",
"remove",
"(",
"'..'",... | https://github.com/Tencent/CMONGO/blob/c40380caa14e05509f46993aa8b8da966b09b0b5/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Node/FS.py#L2107-L2131 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.