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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/cython/Cython/Compiler/Optimize.py | python | OptimizeBuiltinCalls._handle_simple_function_len | (self, node, function, pos_args) | return new_node | Replace len(char*) by the equivalent call to strlen(),
len(Py_UNICODE) by the equivalent Py_UNICODE_strlen() and
len(known_builtin_type) by an equivalent C-API call. | Replace len(char*) by the equivalent call to strlen(),
len(Py_UNICODE) by the equivalent Py_UNICODE_strlen() and
len(known_builtin_type) by an equivalent C-API call. | [
"Replace",
"len",
"(",
"char",
"*",
")",
"by",
"the",
"equivalent",
"call",
"to",
"strlen",
"()",
"len",
"(",
"Py_UNICODE",
")",
"by",
"the",
"equivalent",
"Py_UNICODE_strlen",
"()",
"and",
"len",
"(",
"known_builtin_type",
")",
"by",
"an",
"equivalent",
"... | def _handle_simple_function_len(self, node, function, pos_args):
"""Replace len(char*) by the equivalent call to strlen(),
len(Py_UNICODE) by the equivalent Py_UNICODE_strlen() and
len(known_builtin_type) by an equivalent C-API call.
"""
if len(pos_args) != 1:
self._e... | [
"def",
"_handle_simple_function_len",
"(",
"self",
",",
"node",
",",
"function",
",",
"pos_args",
")",
":",
"if",
"len",
"(",
"pos_args",
")",
"!=",
"1",
":",
"self",
".",
"_error_wrong_arg_count",
"(",
"'len'",
",",
"node",
",",
"pos_args",
",",
"1",
")... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/cython/Cython/Compiler/Optimize.py#L2590-L2641 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_windows.py | python | Dialog.__init__ | (self, *args, **kwargs) | __init__(self, Window parent, int id=-1, String title=EmptyString,
Point pos=DefaultPosition, Size size=DefaultSize,
long style=DEFAULT_DIALOG_STYLE, String name=DialogNameStr) -> Dialog | __init__(self, Window parent, int id=-1, String title=EmptyString,
Point pos=DefaultPosition, Size size=DefaultSize,
long style=DEFAULT_DIALOG_STYLE, String name=DialogNameStr) -> Dialog | [
"__init__",
"(",
"self",
"Window",
"parent",
"int",
"id",
"=",
"-",
"1",
"String",
"title",
"=",
"EmptyString",
"Point",
"pos",
"=",
"DefaultPosition",
"Size",
"size",
"=",
"DefaultSize",
"long",
"style",
"=",
"DEFAULT_DIALOG_STYLE",
"String",
"name",
"=",
"... | def __init__(self, *args, **kwargs):
"""
__init__(self, Window parent, int id=-1, String title=EmptyString,
Point pos=DefaultPosition, Size size=DefaultSize,
long style=DEFAULT_DIALOG_STYLE, String name=DialogNameStr) -> Dialog
"""
_windows_.Dialog_swiginit(sel... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_windows_",
".",
"Dialog_swiginit",
"(",
"self",
",",
"_windows_",
".",
"new_Dialog",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")",
"self",
".",
"_setOORInfo... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_windows.py#L728-L735 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/sparse/dia.py | python | isspmatrix_dia | (x) | return isinstance(x, dia_matrix) | Is x of dia_matrix type?
Parameters
----------
x
object to check for being a dia matrix
Returns
-------
bool
True if x is a dia matrix, False otherwise
Examples
--------
>>> from scipy.sparse import dia_matrix, isspmatrix_dia
>>> isspmatrix_dia(dia_matrix([[5]]... | Is x of dia_matrix type? | [
"Is",
"x",
"of",
"dia_matrix",
"type?"
] | def isspmatrix_dia(x):
"""Is x of dia_matrix type?
Parameters
----------
x
object to check for being a dia matrix
Returns
-------
bool
True if x is a dia matrix, False otherwise
Examples
--------
>>> from scipy.sparse import dia_matrix, isspmatrix_dia
>>> i... | [
"def",
"isspmatrix_dia",
"(",
"x",
")",
":",
"return",
"isinstance",
"(",
"x",
",",
"dia_matrix",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/sparse/dia.py#L397-L420 | |
unicode-org/icu | 2f8749a026f3ddc8cf54d4622480b7c543bb7fc0 | tools/unicode/py/preparseucd.py | python | CopyAndStripAndMerge | (s, t) | return CopyAndStripWithOptionalMerge(s, t, True) | Copies and strips a file and merges lines.
Copies a file, removes comments, and
merges lines with adjacent code point ranges and identical per-code point
data lines into one line with range syntax. | Copies and strips a file and merges lines. | [
"Copies",
"and",
"strips",
"a",
"file",
"and",
"merges",
"lines",
"."
] | def CopyAndStripAndMerge(s, t):
"""Copies and strips a file and merges lines.
Copies a file, removes comments, and
merges lines with adjacent code point ranges and identical per-code point
data lines into one line with range syntax.
"""
return CopyAndStripWithOptionalMerge(s, t, True) | [
"def",
"CopyAndStripAndMerge",
"(",
"s",
",",
"t",
")",
":",
"return",
"CopyAndStripWithOptionalMerge",
"(",
"s",
",",
"t",
",",
"True",
")"
] | https://github.com/unicode-org/icu/blob/2f8749a026f3ddc8cf54d4622480b7c543bb7fc0/tools/unicode/py/preparseucd.py#L1587-L1594 | |
Kitware/ParaView | f760af9124ff4634b23ebbeab95a4f56e0261955 | Wrapping/Python/paraview/servermanager.py | python | Property.__init__ | (self, proxy, smproperty) | Default constructor. Stores a reference to the proxy. | Default constructor. Stores a reference to the proxy. | [
"Default",
"constructor",
".",
"Stores",
"a",
"reference",
"to",
"the",
"proxy",
"."
] | def __init__(self, proxy, smproperty):
"""Default constructor. Stores a reference to the proxy."""
import weakref
self.SMProperty = smproperty
self.Proxy = proxy | [
"def",
"__init__",
"(",
"self",
",",
"proxy",
",",
"smproperty",
")",
":",
"import",
"weakref",
"self",
".",
"SMProperty",
"=",
"smproperty",
"self",
".",
"Proxy",
"=",
"proxy"
] | https://github.com/Kitware/ParaView/blob/f760af9124ff4634b23ebbeab95a4f56e0261955/Wrapping/Python/paraview/servermanager.py#L706-L710 | ||
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/tools/gyp/pylib/gyp/MSVSSettings.py | python | _ValidateSettings | (validators, settings, stderr) | Validates that the settings are valid for MSBuild or MSVS.
We currently only validate the names of the settings, not their values.
Args:
validators: A dictionary of tools and their validators.
settings: A dictionary. The key is the tool name. The values are
themselves dictionaries of setti... | Validates that the settings are valid for MSBuild or MSVS. | [
"Validates",
"that",
"the",
"settings",
"are",
"valid",
"for",
"MSBuild",
"or",
"MSVS",
"."
] | def _ValidateSettings(validators, settings, stderr):
"""Validates that the settings are valid for MSBuild or MSVS.
We currently only validate the names of the settings, not their values.
Args:
validators: A dictionary of tools and their validators.
settings: A dictionary. The key is the tool name... | [
"def",
"_ValidateSettings",
"(",
"validators",
",",
"settings",
",",
"stderr",
")",
":",
"for",
"tool_name",
"in",
"settings",
":",
"if",
"tool_name",
"in",
"validators",
":",
"tool_validators",
"=",
"validators",
"[",
"tool_name",
"]",
"for",
"setting",
",",
... | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/tools/gyp/pylib/gyp/MSVSSettings.py#L515-L547 | ||
imistyrain/MTCNN | 1a28eb3b93d73d496d411977ea5520810609d376 | pytorch/utils/util.py | python | correct_bboxes | (bboxes, width, height) | return return_list | Crop boxes that are too big and get coordinates
with respect to cutouts.
Arguments:
bboxes: a float numpy array of shape [n, 5],
where each row is (xmin, ymin, xmax, ymax, score).
width: a float number.
height: a float number.
Returns:
dy, dx, edy, edx: a int nu... | Crop boxes that are too big and get coordinates
with respect to cutouts. | [
"Crop",
"boxes",
"that",
"are",
"too",
"big",
"and",
"get",
"coordinates",
"with",
"respect",
"to",
"cutouts",
"."
] | def correct_bboxes(bboxes, width, height):
"""Crop boxes that are too big and get coordinates
with respect to cutouts.
Arguments:
bboxes: a float numpy array of shape [n, 5],
where each row is (xmin, ymin, xmax, ymax, score).
width: a float number.
height: a float number... | [
"def",
"correct_bboxes",
"(",
"bboxes",
",",
"width",
",",
"height",
")",
":",
"x1",
",",
"y1",
",",
"x2",
",",
"y2",
"=",
"[",
"bboxes",
"[",
":",
",",
"i",
"]",
"for",
"i",
"in",
"range",
"(",
"4",
")",
"]",
"x2",
",",
"y2",
"=",
"np",
".... | https://github.com/imistyrain/MTCNN/blob/1a28eb3b93d73d496d411977ea5520810609d376/pytorch/utils/util.py#L138-L200 | |
google/earthenterprise | 0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9 | earth_enterprise/src/scons/khEnvironment.py | python | khEnvironment.MultiCommandFunc | (self, cmd) | return self.Execute('set -x && %s' % cmd.replace('\n', ' && ')) | Runs multiple commands in a single shell.
Args:
cmd: The bash commands (may be multiple lines)
Returns:
The return status of executing the command. | Runs multiple commands in a single shell. | [
"Runs",
"multiple",
"commands",
"in",
"a",
"single",
"shell",
"."
] | def MultiCommandFunc(self, cmd):
"""Runs multiple commands in a single shell.
Args:
cmd: The bash commands (may be multiple lines)
Returns:
The return status of executing the command.
"""
return self.Execute('set -x && %s' % cmd.replace('\n', ' && ')) | [
"def",
"MultiCommandFunc",
"(",
"self",
",",
"cmd",
")",
":",
"return",
"self",
".",
"Execute",
"(",
"'set -x && %s'",
"%",
"cmd",
".",
"replace",
"(",
"'\\n'",
",",
"' && '",
")",
")"
] | https://github.com/google/earthenterprise/blob/0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9/earth_enterprise/src/scons/khEnvironment.py#L394-L402 | |
falkTX/Carla | 74a1ae82c90db85f20550ddcdc8a927b8fb7e414 | source/modules/lilv/lilv-0.24.0/bindings/python/lilv.py | python | ScalePoint.get_value | (self) | return Node.wrap(scale_point_get_value(self.point)) | Get the value of this scale point (enumeration value). | Get the value of this scale point (enumeration value). | [
"Get",
"the",
"value",
"of",
"this",
"scale",
"point",
"(",
"enumeration",
"value",
")",
"."
] | def get_value(self):
"""Get the value of this scale point (enumeration value)."""
return Node.wrap(scale_point_get_value(self.point)) | [
"def",
"get_value",
"(",
"self",
")",
":",
"return",
"Node",
".",
"wrap",
"(",
"scale_point_get_value",
"(",
"self",
".",
"point",
")",
")"
] | https://github.com/falkTX/Carla/blob/74a1ae82c90db85f20550ddcdc8a927b8fb7e414/source/modules/lilv/lilv-0.24.0/bindings/python/lilv.py#L667-L669 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/auto_bisect/bisect_utils.py | python | OutputAnnotationStepLink | (label, url) | Outputs appropriate annotation to print a link.
Args:
label: The name to print.
url: The URL to print. | Outputs appropriate annotation to print a link. | [
"Outputs",
"appropriate",
"annotation",
"to",
"print",
"a",
"link",
"."
] | def OutputAnnotationStepLink(label, url):
"""Outputs appropriate annotation to print a link.
Args:
label: The name to print.
url: The URL to print.
"""
print
print '@@@STEP_LINK@%s@%s@@@' % (label, url)
print
sys.stdout.flush() | [
"def",
"OutputAnnotationStepLink",
"(",
"label",
",",
"url",
")",
":",
"print",
"print",
"'@@@STEP_LINK@%s@%s@@@'",
"%",
"(",
"label",
",",
"url",
")",
"print",
"sys",
".",
"stdout",
".",
"flush",
"(",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/auto_bisect/bisect_utils.py#L198-L208 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/telemetry/third_party/png/png.py | python | topngbytes | (name, rows, x, y, **k) | return f.getvalue() | Convenience function for creating a PNG file "in memory" as a
string. Creates a :class:`Writer` instance using the keyword arguments,
then passes `rows` to its :meth:`Writer.write` method. The resulting
PNG file is returned as a string. `name` is used to identify the file for
debugging. | Convenience function for creating a PNG file "in memory" as a
string. Creates a :class:`Writer` instance using the keyword arguments,
then passes `rows` to its :meth:`Writer.write` method. The resulting
PNG file is returned as a string. `name` is used to identify the file for
debugging. | [
"Convenience",
"function",
"for",
"creating",
"a",
"PNG",
"file",
"in",
"memory",
"as",
"a",
"string",
".",
"Creates",
"a",
":",
"class",
":",
"Writer",
"instance",
"using",
"the",
"keyword",
"arguments",
"then",
"passes",
"rows",
"to",
"its",
":",
"meth",... | def topngbytes(name, rows, x, y, **k):
"""Convenience function for creating a PNG file "in memory" as a
string. Creates a :class:`Writer` instance using the keyword arguments,
then passes `rows` to its :meth:`Writer.write` method. The resulting
PNG file is returned as a string. `name` is used to iden... | [
"def",
"topngbytes",
"(",
"name",
",",
"rows",
",",
"x",
",",
"y",
",",
"*",
"*",
"k",
")",
":",
"import",
"os",
"print",
"name",
"f",
"=",
"BytesIO",
"(",
")",
"w",
"=",
"Writer",
"(",
"x",
",",
"y",
",",
"*",
"*",
"k",
")",
"w",
".",
"w... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/third_party/png/png.py#L2437-L2455 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/mhlib.py | python | Folder.movemessage | (self, n, tofolder, ton) | Move one message over a specific destination message,
which may or may not already exist. | Move one message over a specific destination message,
which may or may not already exist. | [
"Move",
"one",
"message",
"over",
"a",
"specific",
"destination",
"message",
"which",
"may",
"or",
"may",
"not",
"already",
"exist",
"."
] | def movemessage(self, n, tofolder, ton):
"""Move one message over a specific destination message,
which may or may not already exist."""
path = self.getmessagefilename(n)
# Open it to check that it exists
f = open(path)
f.close()
del f
topath = tofolder.ge... | [
"def",
"movemessage",
"(",
"self",
",",
"n",
",",
"tofolder",
",",
"ton",
")",
":",
"path",
"=",
"self",
".",
"getmessagefilename",
"(",
"n",
")",
"# Open it to check that it exists",
"f",
"=",
"open",
"(",
"path",
")",
"f",
".",
"close",
"(",
")",
"de... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/mhlib.py#L546-L576 | ||
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/numpy/array_creations.py | python | ones | (shape, dtype=mstype.float32) | return output | Returns a new tensor of given shape and type, filled with ones.
Args:
shape (Union[int, tuple, list]): the shape of the new tensor.
dtype (Union[:class:`mindspore.dtype`, str], optional): Designated tensor dtype.
Default is :class:`mstype.float32`.
Returns:
Tensor, with the... | Returns a new tensor of given shape and type, filled with ones. | [
"Returns",
"a",
"new",
"tensor",
"of",
"given",
"shape",
"and",
"type",
"filled",
"with",
"ones",
"."
] | def ones(shape, dtype=mstype.float32):
"""
Returns a new tensor of given shape and type, filled with ones.
Args:
shape (Union[int, tuple, list]): the shape of the new tensor.
dtype (Union[:class:`mindspore.dtype`, str], optional): Designated tensor dtype.
Default is :class:`msty... | [
"def",
"ones",
"(",
"shape",
",",
"dtype",
"=",
"mstype",
".",
"float32",
")",
":",
"shape",
"=",
"_check_shape",
"(",
"shape",
")",
"dtype",
"=",
"_check_dtype",
"(",
"dtype",
")",
"if",
"_is_shape_empty",
"(",
"shape",
")",
":",
"return",
"full",
"("... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/numpy/array_creations.py#L265-L295 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/share/gdb/python/gdb/command/pretty_printers.py | python | do_enable_pretty_printer_1 | (pretty_printers, name_re, subname_re, flag) | return total | Worker for enabling/disabling pretty-printers.
Arguments:
pretty_printers: list of pretty-printers
name_re: regular-expression object to select printers
subname_re: regular expression object to select subprinters or None
if all are affected
flag: True for Enable,... | Worker for enabling/disabling pretty-printers. | [
"Worker",
"for",
"enabling",
"/",
"disabling",
"pretty",
"-",
"printers",
"."
] | def do_enable_pretty_printer_1 (pretty_printers, name_re, subname_re, flag):
"""Worker for enabling/disabling pretty-printers.
Arguments:
pretty_printers: list of pretty-printers
name_re: regular-expression object to select printers
subname_re: regular expression object to select subpri... | [
"def",
"do_enable_pretty_printer_1",
"(",
"pretty_printers",
",",
"name_re",
",",
"subname_re",
",",
"flag",
")",
":",
"total",
"=",
"0",
"for",
"printer",
"in",
"pretty_printers",
":",
"if",
"(",
"hasattr",
"(",
"printer",
",",
"\"name\"",
")",
"and",
"name... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/share/gdb/python/gdb/command/pretty_printers.py#L221-L276 | |
COVESA/ramses | 86cac72b86dab4082c4d404d884db7e4ba0ed7b8 | scripts/code_style_checker/check_deprecated.py | python | check_deprecated | (filename, file_contents, clean_file_contents, file_lines, clean_file_lines) | Check for usage of deprecated constructs | Check for usage of deprecated constructs | [
"Check",
"for",
"usage",
"of",
"deprecated",
"constructs"
] | def check_deprecated(filename, file_contents, clean_file_contents, file_lines, clean_file_lines):
""" Check for usage of deprecated constructs """
# check for old mock syntax
for line_number, line in enumerate(clean_file_lines):
if g_re_deprecated_mock_syntax.search(line):
common.log_wa... | [
"def",
"check_deprecated",
"(",
"filename",
",",
"file_contents",
",",
"clean_file_contents",
",",
"file_lines",
",",
"clean_file_lines",
")",
":",
"# check for old mock syntax",
"for",
"line_number",
",",
"line",
"in",
"enumerate",
"(",
"clean_file_lines",
")",
":",
... | https://github.com/COVESA/ramses/blob/86cac72b86dab4082c4d404d884db7e4ba0ed7b8/scripts/code_style_checker/check_deprecated.py#L25-L58 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/six/six.py | python | _import_module | (name) | return sys.modules[name] | Import module, returning the module after the last dot. | Import module, returning the module after the last dot. | [
"Import",
"module",
"returning",
"the",
"module",
"after",
"the",
"last",
"dot",
"."
] | def _import_module(name):
"""Import module, returning the module after the last dot."""
__import__(name)
return sys.modules[name] | [
"def",
"_import_module",
"(",
"name",
")",
":",
"__import__",
"(",
"name",
")",
"return",
"sys",
".",
"modules",
"[",
"name",
"]"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/six/six.py#L85-L88 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/factorization/python/ops/clustering_ops.py | python | KMeans._compute_euclidean_distance | (cls, inputs, clusters) | return output | Computes Euclidean distance between each input and each cluster center.
Args:
inputs: list of input Tensors.
clusters: cluster Tensor.
Returns:
list of Tensors, where each element corresponds to each element in inputs.
The value is the distance of each row to all the cluster centers. | Computes Euclidean distance between each input and each cluster center. | [
"Computes",
"Euclidean",
"distance",
"between",
"each",
"input",
"and",
"each",
"cluster",
"center",
"."
] | def _compute_euclidean_distance(cls, inputs, clusters):
"""Computes Euclidean distance between each input and each cluster center.
Args:
inputs: list of input Tensors.
clusters: cluster Tensor.
Returns:
list of Tensors, where each element corresponds to each element in inputs.
The ... | [
"def",
"_compute_euclidean_distance",
"(",
"cls",
",",
"inputs",
",",
"clusters",
")",
":",
"output",
"=",
"[",
"]",
"for",
"inp",
"in",
"inputs",
":",
"with",
"ops",
".",
"colocate_with",
"(",
"inp",
")",
":",
"# Computes Euclidean distance. Note the first and ... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/factorization/python/ops/clustering_ops.py#L166-L190 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/AWSPythonSDK/1.5.8/docutils/parsers/rst/directives/__init__.py | python | nonnegative_int | (argument) | return value | Check for a nonnegative integer argument; raise ``ValueError`` if not.
(Directive option conversion function.) | Check for a nonnegative integer argument; raise ``ValueError`` if not.
(Directive option conversion function.) | [
"Check",
"for",
"a",
"nonnegative",
"integer",
"argument",
";",
"raise",
"ValueError",
"if",
"not",
".",
"(",
"Directive",
"option",
"conversion",
"function",
".",
")"
] | def nonnegative_int(argument):
"""
Check for a nonnegative integer argument; raise ``ValueError`` if not.
(Directive option conversion function.)
"""
value = int(argument)
if value < 0:
raise ValueError('negative value; must be positive or zero')
return value | [
"def",
"nonnegative_int",
"(",
"argument",
")",
":",
"value",
"=",
"int",
"(",
"argument",
")",
"if",
"value",
"<",
"0",
":",
"raise",
"ValueError",
"(",
"'negative value; must be positive or zero'",
")",
"return",
"value"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/docutils/parsers/rst/directives/__init__.py#L205-L213 | |
bairdzhang/smallhardface | 76fa1d87a9602d9b13d7a7fe693fc7aec91cab80 | external/marcopede-face-eval-f2870fd85d48/database.py | python | imageData.getBBox | (self, i) | return [] | retrun a list of ground truth bboxs from the ith image | retrun a list of ground truth bboxs from the ith image | [
"retrun",
"a",
"list",
"of",
"ground",
"truth",
"bboxs",
"from",
"the",
"ith",
"image"
] | def getBBox(self, i):
"""
retrun a list of ground truth bboxs from the ith image
"""
# print "Not implemented"
return [] | [
"def",
"getBBox",
"(",
"self",
",",
"i",
")",
":",
"# print \"Not implemented\"",
"return",
"[",
"]"
] | https://github.com/bairdzhang/smallhardface/blob/76fa1d87a9602d9b13d7a7fe693fc7aec91cab80/external/marcopede-face-eval-f2870fd85d48/database.py#L107-L112 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_internal/utils/misc.py | python | normalize_version_info | (py_version_info) | return cast('VersionInfo', py_version_info) | Convert a tuple of ints representing a Python version to one of length
three.
:param py_version_info: a tuple of ints representing a Python version,
or None to specify no version. The tuple can have any length.
:return: a tuple of length three if `py_version_info` is non-None.
Otherwise, r... | Convert a tuple of ints representing a Python version to one of length
three. | [
"Convert",
"a",
"tuple",
"of",
"ints",
"representing",
"a",
"Python",
"version",
"to",
"one",
"of",
"length",
"three",
"."
] | def normalize_version_info(py_version_info):
# type: (Tuple[int, ...]) -> Tuple[int, int, int]
"""
Convert a tuple of ints representing a Python version to one of length
three.
:param py_version_info: a tuple of ints representing a Python version,
or None to specify no version. The tuple ca... | [
"def",
"normalize_version_info",
"(",
"py_version_info",
")",
":",
"# type: (Tuple[int, ...]) -> Tuple[int, int, int]",
"if",
"len",
"(",
"py_version_info",
")",
"<",
"3",
":",
"py_version_info",
"+=",
"(",
"3",
"-",
"len",
"(",
"py_version_info",
")",
")",
"*",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_internal/utils/misc.py#L81-L98 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/propgrid.py | python | PropertyGrid.ShowPropertyError | (*args, **kwargs) | return _propgrid.PropertyGrid_ShowPropertyError(*args, **kwargs) | ShowPropertyError(self, PGPropArg id, String msg) | ShowPropertyError(self, PGPropArg id, String msg) | [
"ShowPropertyError",
"(",
"self",
"PGPropArg",
"id",
"String",
"msg",
")"
] | def ShowPropertyError(*args, **kwargs):
"""ShowPropertyError(self, PGPropArg id, String msg)"""
return _propgrid.PropertyGrid_ShowPropertyError(*args, **kwargs) | [
"def",
"ShowPropertyError",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_propgrid",
".",
"PropertyGrid_ShowPropertyError",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/propgrid.py#L2312-L2314 | |
openvinotoolkit/openvino | dedcbeafa8b84cccdc55ca64b8da516682b381c7 | tools/mo/openvino/tools/mo/front/common/layout.py | python | get_dim_from_layout | (node: Node, dim: str) | Gets index of dimension from layout specified for node.
:param node: node to get dim for.
:param dim: name of dimension to get index for.
:return: tuple with index of the dimension and bool flag if the node has layout specified or no. | Gets index of dimension from layout specified for node.
:param node: node to get dim for.
:param dim: name of dimension to get index for.
:return: tuple with index of the dimension and bool flag if the node has layout specified or no. | [
"Gets",
"index",
"of",
"dimension",
"from",
"layout",
"specified",
"for",
"node",
".",
":",
"param",
"node",
":",
"node",
"to",
"get",
"dim",
"for",
".",
":",
"param",
"dim",
":",
"name",
"of",
"dimension",
"to",
"get",
"index",
"for",
".",
":",
"ret... | def get_dim_from_layout(node: Node, dim: str):
"""
Gets index of dimension from layout specified for node.
:param node: node to get dim for.
:param dim: name of dimension to get index for.
:return: tuple with index of the dimension and bool flag if the node has layout specified or no.
"""
la... | [
"def",
"get_dim_from_layout",
"(",
"node",
":",
"Node",
",",
"dim",
":",
"str",
")",
":",
"layout",
"=",
"None",
"graph",
"=",
"node",
".",
"graph",
"if",
"'layout_values'",
"in",
"graph",
".",
"graph",
"[",
"'cmd_params'",
"]",
"and",
"graph",
".",
"g... | https://github.com/openvinotoolkit/openvino/blob/dedcbeafa8b84cccdc55ca64b8da516682b381c7/tools/mo/openvino/tools/mo/front/common/layout.py#L118-L153 | ||
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | buildscripts/packager.py | python | setupdir | (distro, build_os, arch, spec) | return "dst/%s/%s/%s/%s%s-%s/" % (arch, distro.name(), build_os, distro.pkgbase(),
spec.suffix(), spec.pversion(distro)) | Return the setup directory name. | Return the setup directory name. | [
"Return",
"the",
"setup",
"directory",
"name",
"."
] | def setupdir(distro, build_os, arch, spec):
"""Return the setup directory name."""
# The setupdir will be a directory containing all inputs to the
# distro's packaging tools (e.g., package metadata files, init
# scripts, etc), along with the already-built binaries). In case
# the following format s... | [
"def",
"setupdir",
"(",
"distro",
",",
"build_os",
",",
"arch",
",",
"spec",
")",
":",
"# The setupdir will be a directory containing all inputs to the",
"# distro's packaging tools (e.g., package metadata files, init",
"# scripts, etc), along with the already-built binaries). In case",... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/packager.py#L480-L489 | |
google/pindrop | 6e92a7f5f4ea73084f2133fb22acd3db9998d656 | scripts/build_assets.py | python | processed_json_path | (path, target_directory) | return path.replace(RAW_ASSETS_PATH, target_directory).replace(
'.json', '.bin') | Take the path to a raw json asset and convert it to target bin path.
Args:
target_directory: Path to the target assets directory. | Take the path to a raw json asset and convert it to target bin path. | [
"Take",
"the",
"path",
"to",
"a",
"raw",
"json",
"asset",
"and",
"convert",
"it",
"to",
"target",
"bin",
"path",
"."
] | def processed_json_path(path, target_directory):
"""Take the path to a raw json asset and convert it to target bin path.
Args:
target_directory: Path to the target assets directory.
"""
return path.replace(RAW_ASSETS_PATH, target_directory).replace(
'.json', '.bin') | [
"def",
"processed_json_path",
"(",
"path",
",",
"target_directory",
")",
":",
"return",
"path",
".",
"replace",
"(",
"RAW_ASSETS_PATH",
",",
"target_directory",
")",
".",
"replace",
"(",
"'.json'",
",",
"'.bin'",
")"
] | https://github.com/google/pindrop/blob/6e92a7f5f4ea73084f2133fb22acd3db9998d656/scripts/build_assets.py#L166-L173 | |
llvm/llvm-project | ffa6262cb4e2a335d26416fad39a581b4f98c5f4 | lldb/third_party/Python/module/ptyprocess-0.6.0/ptyprocess/ptyprocess.py | python | PtyProcess.close | (self, force=True) | This closes the connection with the child application. Note that
calling close() more than once is valid. This emulates standard Python
behavior with files. Set force to True if you want to make sure that
the child is terminated (SIGKILL is sent if the child ignores SIGHUP
and SIGINT). | This closes the connection with the child application. Note that
calling close() more than once is valid. This emulates standard Python
behavior with files. Set force to True if you want to make sure that
the child is terminated (SIGKILL is sent if the child ignores SIGHUP
and SIGINT). | [
"This",
"closes",
"the",
"connection",
"with",
"the",
"child",
"application",
".",
"Note",
"that",
"calling",
"close",
"()",
"more",
"than",
"once",
"is",
"valid",
".",
"This",
"emulates",
"standard",
"Python",
"behavior",
"with",
"files",
".",
"Set",
"force... | def close(self, force=True):
'''This closes the connection with the child application. Note that
calling close() more than once is valid. This emulates standard Python
behavior with files. Set force to True if you want to make sure that
the child is terminated (SIGKILL is sent if the chi... | [
"def",
"close",
"(",
"self",
",",
"force",
"=",
"True",
")",
":",
"if",
"not",
"self",
".",
"closed",
":",
"self",
".",
"flush",
"(",
")",
"self",
".",
"fileobj",
".",
"close",
"(",
")",
"# Closes the file descriptor",
"# Give kernel time to update process s... | https://github.com/llvm/llvm-project/blob/ffa6262cb4e2a335d26416fad39a581b4f98c5f4/lldb/third_party/Python/module/ptyprocess-0.6.0/ptyprocess/ptyprocess.py#L387-L402 | ||
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/dataset/core/validator_helpers.py | python | check_uint64 | (value, arg_name="") | Validates the value of a variable is within the range of uint64.
:param value: the value of the variable
:param arg_name: name of the variable to be validated
:return: Exception: when the validation fails, nothing otherwise. | Validates the value of a variable is within the range of uint64. | [
"Validates",
"the",
"value",
"of",
"a",
"variable",
"is",
"within",
"the",
"range",
"of",
"uint64",
"."
] | def check_uint64(value, arg_name=""):
"""
Validates the value of a variable is within the range of uint64.
:param value: the value of the variable
:param arg_name: name of the variable to be validated
:return: Exception: when the validation fails, nothing otherwise.
"""
type_check(value, (i... | [
"def",
"check_uint64",
"(",
"value",
",",
"arg_name",
"=",
"\"\"",
")",
":",
"type_check",
"(",
"value",
",",
"(",
"int",
",",
")",
",",
"arg_name",
")",
"check_value",
"(",
"value",
",",
"[",
"UINT64_MIN",
",",
"UINT64_MAX",
"]",
")"
] | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/dataset/core/validator_helpers.py#L263-L272 | ||
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/fluid/layers/nn.py | python | PyFuncRegistry.__init__ | (self, func) | Why record self here?
1. For debug usage. Users can call
:code:`py_func.registered_func(idx)` method
to find the registered function corresponding
to :code:`idx`.
2. For increasing reference count of self.
It seems that to release Python object
wh... | Why record self here? | [
"Why",
"record",
"self",
"here?"
] | def __init__(self, func):
if func is None or not callable(func):
raise TypeError('func must be a Python function')
self._func = func
# find named args using reflection
args = inspect.getargspec(self._func)
if len(args[0]) == 0 and args[1] is None and args[2] is None:... | [
"def",
"__init__",
"(",
"self",
",",
"func",
")",
":",
"if",
"func",
"is",
"None",
"or",
"not",
"callable",
"(",
"func",
")",
":",
"raise",
"TypeError",
"(",
"'func must be a Python function'",
")",
"self",
".",
"_func",
"=",
"func",
"# find named args using... | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/fluid/layers/nn.py#L13656-L13683 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/idlelib/replace.py | python | replace | (text) | Create or reuse a singleton ReplaceDialog instance.
The singleton dialog saves user entries and preferences
across instances.
Args:
text: Text widget containing the text to be searched. | Create or reuse a singleton ReplaceDialog instance. | [
"Create",
"or",
"reuse",
"a",
"singleton",
"ReplaceDialog",
"instance",
"."
] | def replace(text):
"""Create or reuse a singleton ReplaceDialog instance.
The singleton dialog saves user entries and preferences
across instances.
Args:
text: Text widget containing the text to be searched.
"""
root = text._root()
engine = searchengine.get(root)
if not hasattr... | [
"def",
"replace",
"(",
"text",
")",
":",
"root",
"=",
"text",
".",
"_root",
"(",
")",
"engine",
"=",
"searchengine",
".",
"get",
"(",
"root",
")",
"if",
"not",
"hasattr",
"(",
"engine",
",",
"\"_replacedialog\"",
")",
":",
"engine",
".",
"_replacedialo... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/idlelib/replace.py#L14-L28 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/tkinter/messagebox.py | python | askyesnocancel | (title=None, message=None, **options) | return s == YES | Ask a question; return true if the answer is yes, None if cancelled. | Ask a question; return true if the answer is yes, None if cancelled. | [
"Ask",
"a",
"question",
";",
"return",
"true",
"if",
"the",
"answer",
"is",
"yes",
"None",
"if",
"cancelled",
"."
] | def askyesnocancel(title=None, message=None, **options):
"Ask a question; return true if the answer is yes, None if cancelled."
s = _show(title, message, QUESTION, YESNOCANCEL, **options)
# s might be a Tcl index object, so convert it to a string
s = str(s)
if s == CANCEL:
return None
re... | [
"def",
"askyesnocancel",
"(",
"title",
"=",
"None",
",",
"message",
"=",
"None",
",",
"*",
"*",
"options",
")",
":",
"s",
"=",
"_show",
"(",
"title",
",",
"message",
",",
"QUESTION",
",",
"YESNOCANCEL",
",",
"*",
"*",
"options",
")",
"# s might be a Tc... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/tkinter/messagebox.py#L107-L114 | |
isl-org/Open3D | 79aec3ddde6a571ce2f28e4096477e52ec465244 | python/open3d/visualization/tensorboard_plugin/util.py | python | ReadWriteLock.release_write | (self) | Release a write lock. | Release a write lock. | [
"Release",
"a",
"write",
"lock",
"."
] | def release_write(self):
"""Release a write lock."""
self._read_ready.release() | [
"def",
"release_write",
"(",
"self",
")",
":",
"self",
".",
"_read_ready",
".",
"release",
"(",
")"
] | https://github.com/isl-org/Open3D/blob/79aec3ddde6a571ce2f28e4096477e52ec465244/python/open3d/visualization/tensorboard_plugin/util.py#L105-L107 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_core.py | python | OutputStream.SeekO | (*args, **kwargs) | return _core_.OutputStream_SeekO(*args, **kwargs) | SeekO(self, unsigned long pos, int mode=FromStart) -> unsigned long | SeekO(self, unsigned long pos, int mode=FromStart) -> unsigned long | [
"SeekO",
"(",
"self",
"unsigned",
"long",
"pos",
"int",
"mode",
"=",
"FromStart",
")",
"-",
">",
"unsigned",
"long"
] | def SeekO(*args, **kwargs):
"""SeekO(self, unsigned long pos, int mode=FromStart) -> unsigned long"""
return _core_.OutputStream_SeekO(*args, **kwargs) | [
"def",
"SeekO",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"OutputStream_SeekO",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_core.py#L2267-L2269 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/profiler/pprof_profiler.py | python | Functions.__init__ | (self, string_table) | Constructor.
Args:
string_table: A `StringTable` object. | Constructor. | [
"Constructor",
"."
] | def __init__(self, string_table):
"""Constructor.
Args:
string_table: A `StringTable` object.
"""
self._string_table = string_table
# Maps tuples in the form (file_path, function_name, start_line_number)
# to `Function` protos.
self._function_key_to_function = {} | [
"def",
"__init__",
"(",
"self",
",",
"string_table",
")",
":",
"self",
".",
"_string_table",
"=",
"string_table",
"# Maps tuples in the form (file_path, function_name, start_line_number)",
"# to `Function` protos.",
"self",
".",
"_function_key_to_function",
"=",
"{",
"}"
] | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/profiler/pprof_profiler.py#L107-L116 | ||
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | buildscripts/resmokelib/undodb/fetch.py | python | Fetch.execute | (self) | Work your magic.
:return: None | Work your magic. | [
"Work",
"your",
"magic",
"."
] | def execute(self) -> None:
"""
Work your magic.
:return: None
"""
if self._ticket:
raise NotImplementedError("Fetching recordings from JIRA tickets not yet implemented")
assert self._task_id
evg = RetryingEvergreenApi.get_api(use_config_file=True)
... | [
"def",
"execute",
"(",
"self",
")",
"->",
"None",
":",
"if",
"self",
".",
"_ticket",
":",
"raise",
"NotImplementedError",
"(",
"\"Fetching recordings from JIRA tickets not yet implemented\"",
")",
"assert",
"self",
".",
"_task_id",
"evg",
"=",
"RetryingEvergreenApi",
... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/resmokelib/undodb/fetch.py#L32-L58 | ||
pytorch/glow | 15baf2376f7ebff7d4e75ccb094624a9c1e9a089 | utils/log_parser.py | python | DottyPrinter.get_unique_vertex_name | (self, node: Node) | return f"v{self.uniqueVertexMap_[node]}" | Get the unique vertex name given a Node object. | Get the unique vertex name given a Node object. | [
"Get",
"the",
"unique",
"vertex",
"name",
"given",
"a",
"Node",
"object",
"."
] | def get_unique_vertex_name(self, node: Node) -> str:
"""Get the unique vertex name given a Node object."""
if node not in self.uniqueVertexMap_:
self.uniqueVertexMap_[node] = self.uniqueVertexNo_
self.uniqueVertexNo_ += 1
return f"v{self.uniqueVertexMap_[node]}" | [
"def",
"get_unique_vertex_name",
"(",
"self",
",",
"node",
":",
"Node",
")",
"->",
"str",
":",
"if",
"node",
"not",
"in",
"self",
".",
"uniqueVertexMap_",
":",
"self",
".",
"uniqueVertexMap_",
"[",
"node",
"]",
"=",
"self",
".",
"uniqueVertexNo_",
"self",
... | https://github.com/pytorch/glow/blob/15baf2376f7ebff7d4e75ccb094624a9c1e9a089/utils/log_parser.py#L177-L184 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/parsing_ops.py | python | _assert_scalar | (value, name) | Asserts that `value` is scalar, and returns `value`. | Asserts that `value` is scalar, and returns `value`. | [
"Asserts",
"that",
"value",
"is",
"scalar",
"and",
"returns",
"value",
"."
] | def _assert_scalar(value, name):
"""Asserts that `value` is scalar, and returns `value`."""
value_rank = value.shape.rank
if value_rank is None:
check = control_flow_ops.Assert(
math_ops.equal(array_ops.rank(value), 0),
["Input %s must be a scalar" % name],
name="%sIsScalar" % name.cap... | [
"def",
"_assert_scalar",
"(",
"value",
",",
"name",
")",
":",
"value_rank",
"=",
"value",
".",
"shape",
".",
"rank",
"if",
"value_rank",
"is",
"None",
":",
"check",
"=",
"control_flow_ops",
".",
"Assert",
"(",
"math_ops",
".",
"equal",
"(",
"array_ops",
... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/parsing_ops.py#L1132-L1148 | ||
assimp/assimp | 97c7e084c2f7f8c9355ea42f73605890481bddc5 | port/PyAssimp/scripts/transformations.py | python | concatenate_matrices | (*matrices) | return M | Return concatenation of series of transformation matrices.
>>> M = numpy.random.rand(16).reshape((4, 4)) - 0.5
>>> numpy.allclose(M, concatenate_matrices(M))
True
>>> numpy.allclose(numpy.dot(M, M.T), concatenate_matrices(M, M.T))
True | Return concatenation of series of transformation matrices. | [
"Return",
"concatenation",
"of",
"series",
"of",
"transformation",
"matrices",
"."
] | def concatenate_matrices(*matrices):
"""Return concatenation of series of transformation matrices.
>>> M = numpy.random.rand(16).reshape((4, 4)) - 0.5
>>> numpy.allclose(M, concatenate_matrices(M))
True
>>> numpy.allclose(numpy.dot(M, M.T), concatenate_matrices(M, M.T))
True
"""
M = nu... | [
"def",
"concatenate_matrices",
"(",
"*",
"matrices",
")",
":",
"M",
"=",
"numpy",
".",
"identity",
"(",
"4",
")",
"for",
"i",
"in",
"matrices",
":",
"M",
"=",
"numpy",
".",
"dot",
"(",
"M",
",",
"i",
")",
"return",
"M"
] | https://github.com/assimp/assimp/blob/97c7e084c2f7f8c9355ea42f73605890481bddc5/port/PyAssimp/scripts/transformations.py#L1649-L1662 | |
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | deps/src/libxml2-2.9.1/python/libxml2class.py | python | xpathContext.xpathRegisterNs | (self, prefix, ns_uri) | return ret | Register a new namespace. If @ns_uri is None it unregisters
the namespace | Register a new namespace. If | [
"Register",
"a",
"new",
"namespace",
".",
"If"
] | def xpathRegisterNs(self, prefix, ns_uri):
"""Register a new namespace. If @ns_uri is None it unregisters
the namespace """
ret = libxml2mod.xmlXPathRegisterNs(self._o, prefix, ns_uri)
return ret | [
"def",
"xpathRegisterNs",
"(",
"self",
",",
"prefix",
",",
"ns_uri",
")",
":",
"ret",
"=",
"libxml2mod",
".",
"xmlXPathRegisterNs",
"(",
"self",
".",
"_o",
",",
"prefix",
",",
"ns_uri",
")",
"return",
"ret"
] | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/deps/src/libxml2-2.9.1/python/libxml2class.py#L6584-L6588 | |
floooh/oryol | eb08cffe1b1cb6b05ed14ec692bca9372cef064e | fips-files/generators/util/png.py | python | Test.testLtrns0 | (self) | return self.helperLtrns(0) | Create greyscale image with tRNS chunk. | Create greyscale image with tRNS chunk. | [
"Create",
"greyscale",
"image",
"with",
"tRNS",
"chunk",
"."
] | def testLtrns0(self):
"""Create greyscale image with tRNS chunk."""
return self.helperLtrns(0) | [
"def",
"testLtrns0",
"(",
"self",
")",
":",
"return",
"self",
".",
"helperLtrns",
"(",
"0",
")"
] | https://github.com/floooh/oryol/blob/eb08cffe1b1cb6b05ed14ec692bca9372cef064e/fips-files/generators/util/png.py#L2593-L2595 | |
raymondlu/super-animation-samples | 04234269112ff0dc32447f27a761dbbb00b8ba17 | samples/cocos2d-x-3.1/CocosLuaGame2/frameworks/cocos2d-x/build/android-build.py | python | caculate_built_samples | (args) | return list(targets) | Compute the sampels to be built
'cpp' for short of all cpp tests
'lua' for short of all lua tests | Compute the sampels to be built
'cpp' for short of all cpp tests
'lua' for short of all lua tests | [
"Compute",
"the",
"sampels",
"to",
"be",
"built",
"cpp",
"for",
"short",
"of",
"all",
"cpp",
"tests",
"lua",
"for",
"short",
"of",
"all",
"lua",
"tests"
] | def caculate_built_samples(args):
''' Compute the sampels to be built
'cpp' for short of all cpp tests
'lua' for short of all lua tests
'''
if 'all' in args:
return ALL_SAMPLES
targets = []
if 'cpp' in args:
targets += CPP_SAMPLES
args.remove('cpp')
if 'lua' in ... | [
"def",
"caculate_built_samples",
"(",
"args",
")",
":",
"if",
"'all'",
"in",
"args",
":",
"return",
"ALL_SAMPLES",
"targets",
"=",
"[",
"]",
"if",
"'cpp'",
"in",
"args",
":",
"targets",
"+=",
"CPP_SAMPLES",
"args",
".",
"remove",
"(",
"'cpp'",
")",
"if",... | https://github.com/raymondlu/super-animation-samples/blob/04234269112ff0dc32447f27a761dbbb00b8ba17/samples/cocos2d-x-3.1/CocosLuaGame2/frameworks/cocos2d-x/build/android-build.py#L74-L96 | |
google/earthenterprise | 0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9 | earth_enterprise/src/google/protobuf-py/mox.py | python | MockAnything.__nonzero__ | (self) | return 1 | Return 1 for nonzero so the mock can be used as a conditional. | Return 1 for nonzero so the mock can be used as a conditional. | [
"Return",
"1",
"for",
"nonzero",
"so",
"the",
"mock",
"can",
"be",
"used",
"as",
"a",
"conditional",
"."
] | def __nonzero__(self):
"""Return 1 for nonzero so the mock can be used as a conditional."""
return 1 | [
"def",
"__nonzero__",
"(",
"self",
")",
":",
"return",
"1"
] | https://github.com/google/earthenterprise/blob/0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9/earth_enterprise/src/google/protobuf-py/mox.py#L309-L312 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_misc.py | python | Display.__init__ | (self, *args, **kwargs) | __init__(self, unsigned int index=0) -> Display
Set up a Display instance with the specified display. The displays
are numbered from 0 to GetCount() - 1, 0 is always the primary display
and the only one which is always supported | __init__(self, unsigned int index=0) -> Display | [
"__init__",
"(",
"self",
"unsigned",
"int",
"index",
"=",
"0",
")",
"-",
">",
"Display"
] | def __init__(self, *args, **kwargs):
"""
__init__(self, unsigned int index=0) -> Display
Set up a Display instance with the specified display. The displays
are numbered from 0 to GetCount() - 1, 0 is always the primary display
and the only one which is always supported
... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_misc_",
".",
"Display_swiginit",
"(",
"self",
",",
"_misc_",
".",
"new_Display",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_misc.py#L6081-L6089 | ||
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/python2_version/klampt/src/robotsim.py | python | Simulator.setState | (self, str) | return _robotsim.Simulator_setState(self, str) | setState(Simulator self, std::string const & str)
Sets the current simulation state from a Base64 string returned by a prior
getState call. | setState(Simulator self, std::string const & str) | [
"setState",
"(",
"Simulator",
"self",
"std",
"::",
"string",
"const",
"&",
"str",
")"
] | def setState(self, str):
"""
setState(Simulator self, std::string const & str)
Sets the current simulation state from a Base64 string returned by a prior
getState call.
"""
return _robotsim.Simulator_setState(self, str) | [
"def",
"setState",
"(",
"self",
",",
"str",
")",
":",
"return",
"_robotsim",
".",
"Simulator_setState",
"(",
"self",
",",
"str",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/python2_version/klampt/src/robotsim.py#L8238-L8248 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/pkg_resources/_vendor/pyparsing.py | python | ParserElement.addParseAction | ( self, *fns, **kwargs ) | return self | Add parse action to expression's list of parse actions. See L{I{setParseAction}<setParseAction>}.
See examples in L{I{copy}<copy>}. | Add parse action to expression's list of parse actions. See L{I{setParseAction}<setParseAction>}.
See examples in L{I{copy}<copy>}. | [
"Add",
"parse",
"action",
"to",
"expression",
"s",
"list",
"of",
"parse",
"actions",
".",
"See",
"L",
"{",
"I",
"{",
"setParseAction",
"}",
"<setParseAction",
">",
"}",
".",
"See",
"examples",
"in",
"L",
"{",
"I",
"{",
"copy",
"}",
"<copy",
">",
"}",... | def addParseAction( self, *fns, **kwargs ):
"""
Add parse action to expression's list of parse actions. See L{I{setParseAction}<setParseAction>}.
See examples in L{I{copy}<copy>}.
"""
self.parseAction += list(map(_trim_arity, list(fns)))
self.callDuringTry = self... | [
"def",
"addParseAction",
"(",
"self",
",",
"*",
"fns",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"parseAction",
"+=",
"list",
"(",
"map",
"(",
"_trim_arity",
",",
"list",
"(",
"fns",
")",
")",
")",
"self",
".",
"callDuringTry",
"=",
"self",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/pkg_resources/_vendor/pyparsing.py#L1265-L1273 | |
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | buildscripts/idl/idl_compatibility_errors.py | python | IDLCompatibilityContext.add_new_action_types_not_subset_error | (self, command_name: str, file: str) | Add an error about the new access_check action types not being a subset of the old ones. | Add an error about the new access_check action types not being a subset of the old ones. | [
"Add",
"an",
"error",
"about",
"the",
"new",
"access_check",
"action",
"types",
"not",
"being",
"a",
"subset",
"of",
"the",
"old",
"ones",
"."
] | def add_new_action_types_not_subset_error(self, command_name: str, file: str) -> None:
"""Add an error about the new access_check action types not being a subset of the old ones."""
self._add_error(ERROR_ID_NEW_ACTION_TYPES_NOT_SUBSET, command_name,
("'%s' has new action types th... | [
"def",
"add_new_action_types_not_subset_error",
"(",
"self",
",",
"command_name",
":",
"str",
",",
"file",
":",
"str",
")",
"->",
"None",
":",
"self",
".",
"_add_error",
"(",
"ERROR_ID_NEW_ACTION_TYPES_NOT_SUBSET",
",",
"command_name",
",",
"(",
"\"'%s' has new acti... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/idl/idl_compatibility_errors.py#L950-L954 | ||
panda3d/panda3d | 833ad89ebad58395d0af0b7ec08538e5e4308265 | direct/src/stdpy/threading2.py | python | main_thread | () | return _main_thread | Return the main thread object.
In normal conditions, the main thread is the thread from which the
Python interpreter was started. | Return the main thread object.
In normal conditions, the main thread is the thread from which the
Python interpreter was started. | [
"Return",
"the",
"main",
"thread",
"object",
".",
"In",
"normal",
"conditions",
"the",
"main",
"thread",
"is",
"the",
"thread",
"from",
"which",
"the",
"Python",
"interpreter",
"was",
"started",
"."
] | def main_thread():
"""Return the main thread object.
In normal conditions, the main thread is the thread from which the
Python interpreter was started.
"""
return _main_thread | [
"def",
"main_thread",
"(",
")",
":",
"return",
"_main_thread"
] | https://github.com/panda3d/panda3d/blob/833ad89ebad58395d0af0b7ec08538e5e4308265/direct/src/stdpy/threading2.py#L751-L756 | |
Kitware/ParaView | f760af9124ff4634b23ebbeab95a4f56e0261955 | Wrapping/Python/paraview/simple.py | python | _initializeSession | (connection) | Internal method used to initialize a session. Users don't need to
call this directly. Whenever a new session is created this method is called
by API in this module. | Internal method used to initialize a session. Users don't need to
call this directly. Whenever a new session is created this method is called
by API in this module. | [
"Internal",
"method",
"used",
"to",
"initialize",
"a",
"session",
".",
"Users",
"don",
"t",
"need",
"to",
"call",
"this",
"directly",
".",
"Whenever",
"a",
"new",
"session",
"is",
"created",
"this",
"method",
"is",
"called",
"by",
"API",
"in",
"this",
"m... | def _initializeSession(connection):
"""Internal method used to initialize a session. Users don't need to
call this directly. Whenever a new session is created this method is called
by API in this module."""
if not connection:
raise RuntimeError ("'connection' cannot be empty.")
controller = se... | [
"def",
"_initializeSession",
"(",
"connection",
")",
":",
"if",
"not",
"connection",
":",
"raise",
"RuntimeError",
"(",
"\"'connection' cannot be empty.\"",
")",
"controller",
"=",
"servermanager",
".",
"ParaViewPipelineController",
"(",
")",
"controller",
".",
"Initi... | https://github.com/Kitware/ParaView/blob/f760af9124ff4634b23ebbeab95a4f56e0261955/Wrapping/Python/paraview/simple.py#L2628-L2635 | ||
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | tools/coverity/coverity.py | python | _ReleaseLock | (lock_file, lock_filename) | Removes the lockfile. Function-ized so we can bail from anywhere | Removes the lockfile. Function-ized so we can bail from anywhere | [
"Removes",
"the",
"lockfile",
".",
"Function",
"-",
"ized",
"so",
"we",
"can",
"bail",
"from",
"anywhere"
] | def _ReleaseLock(lock_file, lock_filename):
"""Removes the lockfile. Function-ized so we can bail from anywhere"""
os.close(lock_file)
os.remove(lock_filename) | [
"def",
"_ReleaseLock",
"(",
"lock_file",
",",
"lock_filename",
")",
":",
"os",
".",
"close",
"(",
"lock_file",
")",
"os",
".",
"remove",
"(",
"lock_filename",
")"
] | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/tools/coverity/coverity.py#L99-L102 | ||
naver/sling | 5671cd445a2caae0b4dd0332299e4cfede05062c | webkit/Tools/Scripts/webkitpy/thirdparty/mod_pywebsocket/mux.py | python | _MuxHandler.notify_write_data_done | (self, channel_id) | Called by the writer thread when a write operation has done.
Args:
channel_id: objective channel id. | Called by the writer thread when a write operation has done. | [
"Called",
"by",
"the",
"writer",
"thread",
"when",
"a",
"write",
"operation",
"has",
"done",
"."
] | def notify_write_data_done(self, channel_id):
"""Called by the writer thread when a write operation has done.
Args:
channel_id: objective channel id.
"""
try:
self._logical_channels_condition.acquire()
if channel_id in self._logical_channels:
... | [
"def",
"notify_write_data_done",
"(",
"self",
",",
"channel_id",
")",
":",
"try",
":",
"self",
".",
"_logical_channels_condition",
".",
"acquire",
"(",
")",
"if",
"channel_id",
"in",
"self",
".",
"_logical_channels",
":",
"channel_data",
"=",
"self",
".",
"_lo... | https://github.com/naver/sling/blob/5671cd445a2caae0b4dd0332299e4cfede05062c/webkit/Tools/Scripts/webkitpy/thirdparty/mod_pywebsocket/mux.py#L1529-L1545 | ||
chromiumembedded/cef | 80caf947f3fe2210e5344713c5281d8af9bdc295 | tools/yapf/yapf/yapflib/file_resources.py | python | IsPythonFile | (filename) | return re.match(r'^#!.*\bpython[23]?\b', first_line) | Return True if filename is a Python file. | Return True if filename is a Python file. | [
"Return",
"True",
"if",
"filename",
"is",
"a",
"Python",
"file",
"."
] | def IsPythonFile(filename):
"""Return True if filename is a Python file."""
if os.path.splitext(filename)[1] == '.py':
return True
try:
with open(filename, 'rb') as fd:
encoding = tokenize.detect_encoding(fd.readline)[0]
# Check for correctness of encoding.
with py3compat.open_with_encodin... | [
"def",
"IsPythonFile",
"(",
"filename",
")",
":",
"if",
"os",
".",
"path",
".",
"splitext",
"(",
"filename",
")",
"[",
"1",
"]",
"==",
"'.py'",
":",
"return",
"True",
"try",
":",
"with",
"open",
"(",
"filename",
",",
"'rb'",
")",
"as",
"fd",
":",
... | https://github.com/chromiumembedded/cef/blob/80caf947f3fe2210e5344713c5281d8af9bdc295/tools/yapf/yapf/yapflib/file_resources.py#L141-L169 | |
SoarGroup/Soar | a1c5e249499137a27da60533c72969eef3b8ab6b | scons/scons-local-4.1.0/SCons/Memoize.py | python | CountValue.count | (self, *args, **kw) | Counts whether the memoized value has already been
set (a hit) or not (a miss). | Counts whether the memoized value has already been
set (a hit) or not (a miss). | [
"Counts",
"whether",
"the",
"memoized",
"value",
"has",
"already",
"been",
"set",
"(",
"a",
"hit",
")",
"or",
"not",
"(",
"a",
"miss",
")",
"."
] | def count(self, *args, **kw):
""" Counts whether the memoized value has already been
set (a hit) or not (a miss).
"""
obj = args[0]
if self.method_name in obj._memo:
self.hit = self.hit + 1
else:
self.miss = self.miss + 1 | [
"def",
"count",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kw",
")",
":",
"obj",
"=",
"args",
"[",
"0",
"]",
"if",
"self",
".",
"method_name",
"in",
"obj",
".",
"_memo",
":",
"self",
".",
"hit",
"=",
"self",
".",
"hit",
"+",
"1",
"else",
... | https://github.com/SoarGroup/Soar/blob/a1c5e249499137a27da60533c72969eef3b8ab6b/scons/scons-local-4.1.0/SCons/Memoize.py#L139-L147 | ||
gem5/gem5 | 141cc37c2d4b93959d4c249b8f7e6a8b2ef75338 | src/mem/slicc/parser.py | python | SLICC.p_type_enums__list | (self, p) | type_enums : type_enum type_enums | type_enums : type_enum type_enums | [
"type_enums",
":",
"type_enum",
"type_enums"
] | def p_type_enums__list(self, p):
"type_enums : type_enum type_enums"
p[0] = [ p[1] ] + p[2] | [
"def",
"p_type_enums__list",
"(",
"self",
",",
"p",
")",
":",
"p",
"[",
"0",
"]",
"=",
"[",
"p",
"[",
"1",
"]",
"]",
"+",
"p",
"[",
"2",
"]"
] | https://github.com/gem5/gem5/blob/141cc37c2d4b93959d4c249b8f7e6a8b2ef75338/src/mem/slicc/parser.py#L408-L410 | ||
devsisters/libquic | 8954789a056d8e7d5fcb6452fd1572ca57eb5c4e | src/third_party/protobuf/python/mox.py | python | MockObject.__eq__ | (self, rhs) | return (isinstance(rhs, MockObject) and
self._class_to_mock == rhs._class_to_mock and
self._replay_mode == rhs._replay_mode and
self._expected_calls_queue == rhs._expected_calls_queue) | Provide custom logic to compare objects. | Provide custom logic to compare objects. | [
"Provide",
"custom",
"logic",
"to",
"compare",
"objects",
"."
] | def __eq__(self, rhs):
"""Provide custom logic to compare objects."""
return (isinstance(rhs, MockObject) and
self._class_to_mock == rhs._class_to_mock and
self._replay_mode == rhs._replay_mode and
self._expected_calls_queue == rhs._expected_calls_queue) | [
"def",
"__eq__",
"(",
"self",
",",
"rhs",
")",
":",
"return",
"(",
"isinstance",
"(",
"rhs",
",",
"MockObject",
")",
"and",
"self",
".",
"_class_to_mock",
"==",
"rhs",
".",
"_class_to_mock",
"and",
"self",
".",
"_replay_mode",
"==",
"rhs",
".",
"_replay_... | https://github.com/devsisters/libquic/blob/8954789a056d8e7d5fcb6452fd1572ca57eb5c4e/src/third_party/protobuf/python/mox.py#L419-L425 | |
qt/qt | 0a2f2382541424726168804be2c90b91381608c6 | src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/xcodeproj_file.py | python | PBXProject.AddOrGetFileInRootGroup | (self, path) | return group.AddOrGetFileByPath(path, hierarchical) | Returns a PBXFileReference corresponding to path in the correct group
according to RootGroupForPath's heuristics.
If an existing PBXFileReference for path exists, it will be returned.
Otherwise, one will be created and returned. | Returns a PBXFileReference corresponding to path in the correct group
according to RootGroupForPath's heuristics. | [
"Returns",
"a",
"PBXFileReference",
"corresponding",
"to",
"path",
"in",
"the",
"correct",
"group",
"according",
"to",
"RootGroupForPath",
"s",
"heuristics",
"."
] | def AddOrGetFileInRootGroup(self, path):
"""Returns a PBXFileReference corresponding to path in the correct group
according to RootGroupForPath's heuristics.
If an existing PBXFileReference for path exists, it will be returned.
Otherwise, one will be created and returned.
"""
(group, hierarchi... | [
"def",
"AddOrGetFileInRootGroup",
"(",
"self",
",",
"path",
")",
":",
"(",
"group",
",",
"hierarchical",
")",
"=",
"self",
".",
"RootGroupForPath",
"(",
"path",
")",
"return",
"group",
".",
"AddOrGetFileByPath",
"(",
"path",
",",
"hierarchical",
")"
] | https://github.com/qt/qt/blob/0a2f2382541424726168804be2c90b91381608c6/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/xcodeproj_file.py#L2562-L2571 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/idlelib/CallTips.py | python | CallTips.fetch_tip | (self, expression) | Return the argument list and docstring of a function or class
If there is a Python subprocess, get the calltip there. Otherwise,
either fetch_tip() is running in the subprocess itself or it was called
in an IDLE EditorWindow before any script had been run.
The subprocess environment i... | Return the argument list and docstring of a function or class | [
"Return",
"the",
"argument",
"list",
"and",
"docstring",
"of",
"a",
"function",
"or",
"class"
] | def fetch_tip(self, expression):
"""Return the argument list and docstring of a function or class
If there is a Python subprocess, get the calltip there. Otherwise,
either fetch_tip() is running in the subprocess itself or it was called
in an IDLE EditorWindow before any script had bee... | [
"def",
"fetch_tip",
"(",
"self",
",",
"expression",
")",
":",
"try",
":",
"rpcclt",
"=",
"self",
".",
"editwin",
".",
"flist",
".",
"pyshell",
".",
"interp",
".",
"rpcclt",
"except",
"AttributeError",
":",
"rpcclt",
"=",
"None",
"if",
"rpcclt",
":",
"r... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/idlelib/CallTips.py#L83-L106 | ||
apache/arrow | af33dd1157eb8d7d9bfac25ebf61445b793b7943 | python/pyarrow/types.py | python | is_large_string | (t) | return t.id == lib.Type_LARGE_STRING | Return True if value is an instance of large string (utf8 unicode) type.
Parameters
----------
t : DataType | Return True if value is an instance of large string (utf8 unicode) type. | [
"Return",
"True",
"if",
"value",
"is",
"an",
"instance",
"of",
"large",
"string",
"(",
"utf8",
"unicode",
")",
"type",
"."
] | def is_large_string(t):
"""
Return True if value is an instance of large string (utf8 unicode) type.
Parameters
----------
t : DataType
"""
return t.id == lib.Type_LARGE_STRING | [
"def",
"is_large_string",
"(",
"t",
")",
":",
"return",
"t",
".",
"id",
"==",
"lib",
".",
"Type_LARGE_STRING"
] | https://github.com/apache/arrow/blob/af33dd1157eb8d7d9bfac25ebf61445b793b7943/python/pyarrow/types.py#L421-L429 | |
CRYTEK/CRYENGINE | 232227c59a220cbbd311576f0fbeba7bb53b2a8c | Code/Tools/waf-1.7.13/waflib/extras/boo.py | python | configure | (self) | Check that booc is available | Check that booc is available | [
"Check",
"that",
"booc",
"is",
"available"
] | def configure(self):
"""Check that booc is available """
self.check_booc() | [
"def",
"configure",
"(",
"self",
")",
":",
"self",
".",
"check_booc",
"(",
")"
] | https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Code/Tools/waf-1.7.13/waflib/extras/boo.py#L78-L80 | ||
snap-stanford/snap-python | d53c51b0a26aa7e3e7400b014cdf728948fde80a | setup/snap.py | python | TMIn.GetBfAddr | (self) | return _snap.TMIn_GetBfAddr(self) | GetBfAddr(TMIn self) -> char *
Parameters:
self: TMIn * | GetBfAddr(TMIn self) -> char * | [
"GetBfAddr",
"(",
"TMIn",
"self",
")",
"-",
">",
"char",
"*"
] | def GetBfAddr(self):
"""
GetBfAddr(TMIn self) -> char *
Parameters:
self: TMIn *
"""
return _snap.TMIn_GetBfAddr(self) | [
"def",
"GetBfAddr",
"(",
"self",
")",
":",
"return",
"_snap",
".",
"TMIn_GetBfAddr",
"(",
"self",
")"
] | https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/setup/snap.py#L2927-L2935 | |
Tokutek/mongo | 0653eabe2c5b9d12b4814617cb7fb2d799937a0f | buildscripts/packager.py | python | Distro.repodir | (self, arch) | Return the directory where we'll place the package files for
(distro, distro_version) in that distro's preferred repository
layout (as distinct from where that distro's packaging building
tools place the package files). | Return the directory where we'll place the package files for
(distro, distro_version) in that distro's preferred repository
layout (as distinct from where that distro's packaging building
tools place the package files). | [
"Return",
"the",
"directory",
"where",
"we",
"ll",
"place",
"the",
"package",
"files",
"for",
"(",
"distro",
"distro_version",
")",
"in",
"that",
"distro",
"s",
"preferred",
"repository",
"layout",
"(",
"as",
"distinct",
"from",
"where",
"that",
"distro",
"s... | def repodir(self, arch):
"""Return the directory where we'll place the package files for
(distro, distro_version) in that distro's preferred repository
layout (as distinct from where that distro's packaging building
tools place the package files)."""
if re.search("^(debian|ubuntu... | [
"def",
"repodir",
"(",
"self",
",",
"arch",
")",
":",
"if",
"re",
".",
"search",
"(",
"\"^(debian|ubuntu)\"",
",",
"self",
".",
"n",
")",
":",
"return",
"\"repo/%s/dists/dist/10gen/binary-%s/\"",
"%",
"(",
"self",
".",
"n",
",",
"self",
".",
"archname",
... | https://github.com/Tokutek/mongo/blob/0653eabe2c5b9d12b4814617cb7fb2d799937a0f/buildscripts/packager.py#L129-L139 | ||
apple/swift | 469f72fdae2ea828b3b6c0d7d62d7e4cf98c4893 | utils/swift_build_support/swift_build_support/products/product.py | python | Product.test | (self, host_target) | test() -> void
Run the tests, for a non-build-script-impl product. | test() -> void | [
"test",
"()",
"-",
">",
"void"
] | def test(self, host_target):
"""test() -> void
Run the tests, for a non-build-script-impl product.
"""
raise NotImplementedError | [
"def",
"test",
"(",
"self",
",",
"host_target",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/apple/swift/blob/469f72fdae2ea828b3b6c0d7d62d7e4cf98c4893/utils/swift_build_support/swift_build_support/products/product.py#L143-L148 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/combo.py | python | BitmapComboBox.GetItemBitmap | (*args, **kwargs) | return _combo.BitmapComboBox_GetItemBitmap(*args, **kwargs) | GetItemBitmap(self, int n) -> Bitmap
Returns the image of the item with the given index. | GetItemBitmap(self, int n) -> Bitmap | [
"GetItemBitmap",
"(",
"self",
"int",
"n",
")",
"-",
">",
"Bitmap"
] | def GetItemBitmap(*args, **kwargs):
"""
GetItemBitmap(self, int n) -> Bitmap
Returns the image of the item with the given index.
"""
return _combo.BitmapComboBox_GetItemBitmap(*args, **kwargs) | [
"def",
"GetItemBitmap",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_combo",
".",
"BitmapComboBox_GetItemBitmap",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/combo.py#L981-L987 | |
quantOS-org/DataCore | e2ef9bd2c22ee9e2845675b6435a14fa607f3551 | mdlink/deps/windows/protobuf-2.5.0/python/google/protobuf/internal/cpp_message.py | python | RepeatedCompositeContainer.extend | (self, elem_seq) | Extends by appending the given sequence of elements of the same type
as this one, copying each individual message. | Extends by appending the given sequence of elements of the same type
as this one, copying each individual message. | [
"Extends",
"by",
"appending",
"the",
"given",
"sequence",
"of",
"elements",
"of",
"the",
"same",
"type",
"as",
"this",
"one",
"copying",
"each",
"individual",
"message",
"."
] | def extend(self, elem_seq):
"""Extends by appending the given sequence of elements of the same type
as this one, copying each individual message.
"""
for message in elem_seq:
self.add().MergeFrom(message) | [
"def",
"extend",
"(",
"self",
",",
"elem_seq",
")",
":",
"for",
"message",
"in",
"elem_seq",
":",
"self",
".",
"add",
"(",
")",
".",
"MergeFrom",
"(",
"message",
")"
] | https://github.com/quantOS-org/DataCore/blob/e2ef9bd2c22ee9e2845675b6435a14fa607f3551/mdlink/deps/windows/protobuf-2.5.0/python/google/protobuf/internal/cpp_message.py#L202-L207 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/multiprocessing/pool.py | python | Pool.map | (self, func, iterable, chunksize=None) | return self._map_async(func, iterable, mapstar, chunksize).get() | Apply `func` to each element in `iterable`, collecting the results
in a list that is returned. | Apply `func` to each element in `iterable`, collecting the results
in a list that is returned. | [
"Apply",
"func",
"to",
"each",
"element",
"in",
"iterable",
"collecting",
"the",
"results",
"in",
"a",
"list",
"that",
"is",
"returned",
"."
] | def map(self, func, iterable, chunksize=None):
'''
Apply `func` to each element in `iterable`, collecting the results
in a list that is returned.
'''
return self._map_async(func, iterable, mapstar, chunksize).get() | [
"def",
"map",
"(",
"self",
",",
"func",
",",
"iterable",
",",
"chunksize",
"=",
"None",
")",
":",
"return",
"self",
".",
"_map_async",
"(",
"func",
",",
"iterable",
",",
"mapstar",
",",
"chunksize",
")",
".",
"get",
"(",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/multiprocessing/pool.py#L263-L268 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/ntpath.py | python | splitdrive | (p) | return p[:0], p | Split a pathname into drive/UNC sharepoint and relative path specifiers.
Returns a 2-tuple (drive_or_unc, path); either part may be empty.
If you assign
result = splitdrive(p)
It is always true that:
result[0] + result[1] == p
If the path contained a drive letter, drive_or_unc will con... | Split a pathname into drive/UNC sharepoint and relative path specifiers.
Returns a 2-tuple (drive_or_unc, path); either part may be empty. | [
"Split",
"a",
"pathname",
"into",
"drive",
"/",
"UNC",
"sharepoint",
"and",
"relative",
"path",
"specifiers",
".",
"Returns",
"a",
"2",
"-",
"tuple",
"(",
"drive_or_unc",
"path",
")",
";",
"either",
"part",
"may",
"be",
"empty",
"."
] | def splitdrive(p):
"""Split a pathname into drive/UNC sharepoint and relative path specifiers.
Returns a 2-tuple (drive_or_unc, path); either part may be empty.
If you assign
result = splitdrive(p)
It is always true that:
result[0] + result[1] == p
If the path contained a drive let... | [
"def",
"splitdrive",
"(",
"p",
")",
":",
"p",
"=",
"os",
".",
"fspath",
"(",
"p",
")",
"if",
"len",
"(",
"p",
")",
">=",
"2",
":",
"if",
"isinstance",
"(",
"p",
",",
"bytes",
")",
":",
"sep",
"=",
"b'\\\\'",
"altsep",
"=",
"b'/'",
"colon",
"=... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/ntpath.py#L122-L170 | |
fengbingchun/NN_Test | d6305825d5273e4569ccd1eda9ffa2a9c72e18d2 | src/tiny-dnn/third_party/cpplint.py | python | _CppLintState.SetVerboseLevel | (self, level) | return last_verbose_level | Sets the module's verbosity, and returns the previous setting. | Sets the module's verbosity, and returns the previous setting. | [
"Sets",
"the",
"module",
"s",
"verbosity",
"and",
"returns",
"the",
"previous",
"setting",
"."
] | def SetVerboseLevel(self, level):
"""Sets the module's verbosity, and returns the previous setting."""
last_verbose_level = self.verbose_level
self.verbose_level = level
return last_verbose_level | [
"def",
"SetVerboseLevel",
"(",
"self",
",",
"level",
")",
":",
"last_verbose_level",
"=",
"self",
".",
"verbose_level",
"self",
".",
"verbose_level",
"=",
"level",
"return",
"last_verbose_level"
] | https://github.com/fengbingchun/NN_Test/blob/d6305825d5273e4569ccd1eda9ffa2a9c72e18d2/src/tiny-dnn/third_party/cpplint.py#L993-L997 | |
lmb-freiburg/ogn | 974f72ef4bf840d6f6693d22d1843a79223e77ce | scripts/download_model_binary.py | python | reporthook | (count, block_size, total_size) | From http://blog.moleculea.com/2012/10/04/urlretrieve-progres-indicator/ | From http://blog.moleculea.com/2012/10/04/urlretrieve-progres-indicator/ | [
"From",
"http",
":",
"//",
"blog",
".",
"moleculea",
".",
"com",
"/",
"2012",
"/",
"10",
"/",
"04",
"/",
"urlretrieve",
"-",
"progres",
"-",
"indicator",
"/"
] | def reporthook(count, block_size, total_size):
"""
From http://blog.moleculea.com/2012/10/04/urlretrieve-progres-indicator/
"""
global start_time
if count == 0:
start_time = time.time()
return
duration = (time.time() - start_time) or 0.01
progress_size = int(count * block_siz... | [
"def",
"reporthook",
"(",
"count",
",",
"block_size",
",",
"total_size",
")",
":",
"global",
"start_time",
"if",
"count",
"==",
"0",
":",
"start_time",
"=",
"time",
".",
"time",
"(",
")",
"return",
"duration",
"=",
"(",
"time",
".",
"time",
"(",
")",
... | https://github.com/lmb-freiburg/ogn/blob/974f72ef4bf840d6f6693d22d1843a79223e77ce/scripts/download_model_binary.py#L14-L28 | ||
esa/pykep | b410363653623730b577de257c04b0e0289f2014 | pykep/phasing/_dbscan.py | python | dbscan.plot | (self, ax=None, clusters=None, orbits=False, only_core=False) | return axis | Plots the clusters. | Plots the clusters. | [
"Plots",
"the",
"clusters",
"."
] | def plot(self, ax=None, clusters=None, orbits=False, only_core=False):
"""Plots the clusters."""
if self.n_clusters < 1:
return
import matplotlib.pylab as plt
from mpl_toolkits.mplot3d import Axes3D
if ax is None:
fig = plt.figure()
axis = fi... | [
"def",
"plot",
"(",
"self",
",",
"ax",
"=",
"None",
",",
"clusters",
"=",
"None",
",",
"orbits",
"=",
"False",
",",
"only_core",
"=",
"False",
")",
":",
"if",
"self",
".",
"n_clusters",
"<",
"1",
":",
"return",
"import",
"matplotlib",
".",
"pylab",
... | https://github.com/esa/pykep/blob/b410363653623730b577de257c04b0e0289f2014/pykep/phasing/_dbscan.py#L106-L140 | |
infinit/elle | a8154593c42743f45b9df09daf62b44630c24a02 | drake/src/drake/__init__.py | python | TextExpander.content | (self) | return self.__text | The text. | The text. | [
"The",
"text",
"."
] | def content(self):
"""The text."""
return self.__text; | [
"def",
"content",
"(",
"self",
")",
":",
"return",
"self",
".",
"__text"
] | https://github.com/infinit/elle/blob/a8154593c42743f45b9df09daf62b44630c24a02/drake/src/drake/__init__.py#L2867-L2869 | |
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | python/mxnet/module/base_module.py | python | BaseModule.get_outputs | (self, merge_multi_context=True) | Gets outputs of the previous forward computation.
If `merge_multi_context` is ``True``, it is like ``[out1, out2]``. Otherwise,
it returns out put of form ``[[out1_dev1, out1_dev2], [out2_dev1, out2_dev2]]``.
All the output elements have type `NDArray`. When `merge_multi_context` is ``False``,
... | Gets outputs of the previous forward computation. | [
"Gets",
"outputs",
"of",
"the",
"previous",
"forward",
"computation",
"."
] | def get_outputs(self, merge_multi_context=True):
"""Gets outputs of the previous forward computation.
If `merge_multi_context` is ``True``, it is like ``[out1, out2]``. Otherwise,
it returns out put of form ``[[out1_dev1, out1_dev2], [out2_dev1, out2_dev2]]``.
All the output elements ha... | [
"def",
"get_outputs",
"(",
"self",
",",
"merge_multi_context",
"=",
"True",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/python/mxnet/module/base_module.py#L879-L907 | ||
swift/swift | 12d031cf8177fdec0137f9aa7e2912fa23c4416b | 3rdParty/SCons/scons-3.0.1/engine/SCons/Tool/javac.py | python | Java | (env, target, source, *args, **kw) | return result | A pseudo-Builder wrapper around the separate JavaClass{File,Dir}
Builders. | A pseudo-Builder wrapper around the separate JavaClass{File,Dir}
Builders. | [
"A",
"pseudo",
"-",
"Builder",
"wrapper",
"around",
"the",
"separate",
"JavaClass",
"{",
"File",
"Dir",
"}",
"Builders",
"."
] | def Java(env, target, source, *args, **kw):
"""
A pseudo-Builder wrapper around the separate JavaClass{File,Dir}
Builders.
"""
if not SCons.Util.is_List(target):
target = [target]
if not SCons.Util.is_List(source):
source = [source]
# Pad the target list with repetitions of ... | [
"def",
"Java",
"(",
"env",
",",
"target",
",",
"source",
",",
"*",
"args",
",",
"*",
"*",
"kw",
")",
":",
"if",
"not",
"SCons",
".",
"Util",
".",
"is_List",
"(",
"target",
")",
":",
"target",
"=",
"[",
"target",
"]",
"if",
"not",
"SCons",
".",
... | https://github.com/swift/swift/blob/12d031cf8177fdec0137f9aa7e2912fa23c4416b/3rdParty/SCons/scons-3.0.1/engine/SCons/Tool/javac.py#L163-L197 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/stc.py | python | StyledTextCtrl.UpperCase | (*args, **kwargs) | return _stc.StyledTextCtrl_UpperCase(*args, **kwargs) | UpperCase(self)
Transform the selection to upper case. | UpperCase(self) | [
"UpperCase",
"(",
"self",
")"
] | def UpperCase(*args, **kwargs):
"""
UpperCase(self)
Transform the selection to upper case.
"""
return _stc.StyledTextCtrl_UpperCase(*args, **kwargs) | [
"def",
"UpperCase",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_stc",
".",
"StyledTextCtrl_UpperCase",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/stc.py#L4676-L4682 | |
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Arch/InitGui.py | python | ArchWorkbench.Deactivated | (self) | When leaving the workbench. | When leaving the workbench. | [
"When",
"leaving",
"the",
"workbench",
"."
] | def Deactivated(self):
"""When leaving the workbench."""
if hasattr(FreeCADGui, "draftToolBar"):
FreeCADGui.draftToolBar.Deactivated()
if hasattr(FreeCADGui, "Snapper"):
FreeCADGui.Snapper.hide()
FreeCAD.Console.PrintLog("Arch workbench deactivated.\n") | [
"def",
"Deactivated",
"(",
"self",
")",
":",
"if",
"hasattr",
"(",
"FreeCADGui",
",",
"\"draftToolBar\"",
")",
":",
"FreeCADGui",
".",
"draftToolBar",
".",
"Deactivated",
"(",
")",
"if",
"hasattr",
"(",
"FreeCADGui",
",",
"\"Snapper\"",
")",
":",
"FreeCADGui... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Arch/InitGui.py#L222-L228 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/contrib/distributions/python/ops/shape.py | python | _DistributionShape.make_batch_of_event_sample_matrices | (
self, x, expand_batch_dim=True,
name="make_batch_of_event_sample_matrices") | Reshapes/transposes `Distribution` `Tensor` from S+B+E to B_+E_+S_.
Where:
- `B_ = B if B or not expand_batch_dim else [1]`,
- `E_ = E if E else [1]`,
- `S_ = [tf.reduce_prod(S)]`.
Args:
x: `Tensor`.
expand_batch_dim: Python `bool`. If `True` the batch dims will be expanded
... | Reshapes/transposes `Distribution` `Tensor` from S+B+E to B_+E_+S_. | [
"Reshapes",
"/",
"transposes",
"Distribution",
"Tensor",
"from",
"S",
"+",
"B",
"+",
"E",
"to",
"B_",
"+",
"E_",
"+",
"S_",
"."
] | def make_batch_of_event_sample_matrices(
self, x, expand_batch_dim=True,
name="make_batch_of_event_sample_matrices"):
"""Reshapes/transposes `Distribution` `Tensor` from S+B+E to B_+E_+S_.
Where:
- `B_ = B if B or not expand_batch_dim else [1]`,
- `E_ = E if E else [1]`,
- `S_ = [... | [
"def",
"make_batch_of_event_sample_matrices",
"(",
"self",
",",
"x",
",",
"expand_batch_dim",
"=",
"True",
",",
"name",
"=",
"\"make_batch_of_event_sample_matrices\"",
")",
":",
"with",
"self",
".",
"_name_scope",
"(",
"name",
",",
"values",
"=",
"[",
"x",
"]",
... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/distributions/python/ops/shape.py#L361-L395 | ||
tfwu/FaceDetection-ConvNet-3D | f9251c48eb40c5aec8fba7455115c355466555be | python/mxnet/kvstore.py | python | KVStore.push | (self, key, value, priority=0) | Push a single or a sequence of key-value pairs into the store.
Data consistency:
1. this function returns after adding an operator to the engine.
2. push is always called after all previous push and pull on the same
key are finished
3. there is no synchronization between work... | Push a single or a sequence of key-value pairs into the store. | [
"Push",
"a",
"single",
"or",
"a",
"sequence",
"of",
"key",
"-",
"value",
"pairs",
"into",
"the",
"store",
"."
] | def push(self, key, value, priority=0):
""" Push a single or a sequence of key-value pairs into the store.
Data consistency:
1. this function returns after adding an operator to the engine.
2. push is always called after all previous push and pull on the same
key are finished
... | [
"def",
"push",
"(",
"self",
",",
"key",
",",
"value",
",",
"priority",
"=",
"0",
")",
":",
"ckeys",
",",
"cvals",
"=",
"_ctype_key_value",
"(",
"key",
",",
"value",
")",
"check_call",
"(",
"_LIB",
".",
"MXKVStorePush",
"(",
"self",
".",
"handle",
","... | https://github.com/tfwu/FaceDetection-ConvNet-3D/blob/f9251c48eb40c5aec8fba7455115c355466555be/python/mxnet/kvstore.py#L102-L166 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/seq2seq/python/ops/attention_wrapper.py | python | BahdanauAttention.__init__ | (self,
num_units,
memory,
memory_sequence_length=None,
normalize=False,
probability_fn=None,
score_mask_value=float("-inf"),
name="BahdanauAttention") | Construct the Attention mechanism.
Args:
num_units: The depth of the query mechanism.
memory: The memory to query; usually the output of an RNN encoder. This
tensor should be shaped `[batch_size, max_time, ...]`.
memory_sequence_length (optional): Sequence lengths for the batch entries
... | Construct the Attention mechanism. | [
"Construct",
"the",
"Attention",
"mechanism",
"."
] | def __init__(self,
num_units,
memory,
memory_sequence_length=None,
normalize=False,
probability_fn=None,
score_mask_value=float("-inf"),
name="BahdanauAttention"):
"""Construct the Attention mechanism.
Args... | [
"def",
"__init__",
"(",
"self",
",",
"num_units",
",",
"memory",
",",
"memory_sequence_length",
"=",
"None",
",",
"normalize",
"=",
"False",
",",
"probability_fn",
"=",
"None",
",",
"score_mask_value",
"=",
"float",
"(",
"\"-inf\"",
")",
",",
"name",
"=",
... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/seq2seq/python/ops/attention_wrapper.py#L472-L514 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/pyparsing.py | python | ParseResults.extend | (self, itemseq) | Add sequence of elements to end of ParseResults list of elements.
Example::
patt = OneOrMore(Word(alphas))
# use a parse action to append the reverse of the matched strings, to make a palindrome
def make_palindrome(tokens):
tokens.extend(reversed([t[::-1] f... | Add sequence of elements to end of ParseResults list of elements. | [
"Add",
"sequence",
"of",
"elements",
"to",
"end",
"of",
"ParseResults",
"list",
"of",
"elements",
"."
] | def extend(self, itemseq):
"""
Add sequence of elements to end of ParseResults list of elements.
Example::
patt = OneOrMore(Word(alphas))
# use a parse action to append the reverse of the matched strings, to make a palindrome
def make_palindrome(tokens):
... | [
"def",
"extend",
"(",
"self",
",",
"itemseq",
")",
":",
"if",
"isinstance",
"(",
"itemseq",
",",
"ParseResults",
")",
":",
"self",
".",
"__iadd__",
"(",
"itemseq",
")",
"else",
":",
"self",
".",
"__toklist",
".",
"extend",
"(",
"itemseq",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/pyparsing.py#L815-L832 | ||
rdkit/rdkit | ede860ae316d12d8568daf5ee800921c3389c84e | rdkit/sping/PDF/pidPDF.py | python | PDFCanvas._escape | (self, s) | return s | PDF escapes are like Python ones, but brackets need slashes before them too.
Use Python's repr function and chop off the quotes first | PDF escapes are like Python ones, but brackets need slashes before them too.
Use Python's repr function and chop off the quotes first | [
"PDF",
"escapes",
"are",
"like",
"Python",
"ones",
"but",
"brackets",
"need",
"slashes",
"before",
"them",
"too",
".",
"Use",
"Python",
"s",
"repr",
"function",
"and",
"chop",
"off",
"the",
"quotes",
"first"
] | def _escape(self, s):
"""PDF escapes are like Python ones, but brackets need slashes before them too.
Use Python's repr function and chop off the quotes first"""
s = repr(s)[1:-1]
s = s.replace('(', r'\(')
s = s.replace(')', r'\)')
return s | [
"def",
"_escape",
"(",
"self",
",",
"s",
")",
":",
"s",
"=",
"repr",
"(",
"s",
")",
"[",
"1",
":",
"-",
"1",
"]",
"s",
"=",
"s",
".",
"replace",
"(",
"'('",
",",
"r'\\('",
")",
"s",
"=",
"s",
".",
"replace",
"(",
"')'",
",",
"r'\\)'",
")"... | https://github.com/rdkit/rdkit/blob/ede860ae316d12d8568daf5ee800921c3389c84e/rdkit/sping/PDF/pidPDF.py#L229-L235 | |
KratosMultiphysics/Kratos | 0000833054ed0503424eb28205d6508d9ca6cbbc | applications/CompressiblePotentialFlowApplication/python_scripts/level_set_remeshing_process.py | python | LevelSetRemeshingProcess._CopyAndDeleteDefaultDistance | (self) | This function copies the distance field to an auxiliary distance variable and sets
to zero the default one. | This function copies the distance field to an auxiliary distance variable and sets
to zero the default one. | [
"This",
"function",
"copies",
"the",
"distance",
"field",
"to",
"an",
"auxiliary",
"distance",
"variable",
"and",
"sets",
"to",
"zero",
"the",
"default",
"one",
"."
] | def _CopyAndDeleteDefaultDistance(self):
''' This function copies the distance field to an auxiliary distance variable and sets
to zero the default one.
'''
KratosMultiphysics.VariableUtils().CopyScalarVar(KratosMultiphysics.DISTANCE,CompressiblePotentialFlow.GEOMETRY_DISTANCE, self.main... | [
"def",
"_CopyAndDeleteDefaultDistance",
"(",
"self",
")",
":",
"KratosMultiphysics",
".",
"VariableUtils",
"(",
")",
".",
"CopyScalarVar",
"(",
"KratosMultiphysics",
".",
"DISTANCE",
",",
"CompressiblePotentialFlow",
".",
"GEOMETRY_DISTANCE",
",",
"self",
".",
"main_m... | https://github.com/KratosMultiphysics/Kratos/blob/0000833054ed0503424eb28205d6508d9ca6cbbc/applications/CompressiblePotentialFlowApplication/python_scripts/level_set_remeshing_process.py#L192-L197 | ||
aantron/better-enums | 1e8f499ddff8eec43129ac974eebdfb745920643 | doc/mistune.py | python | Renderer.double_emphasis | (self, text) | return '<strong>%s</strong>' % text | Rendering **strong** text.
:param text: text content for emphasis. | Rendering **strong** text. | [
"Rendering",
"**",
"strong",
"**",
"text",
"."
] | def double_emphasis(self, text):
"""Rendering **strong** text.
:param text: text content for emphasis.
"""
return '<strong>%s</strong>' % text | [
"def",
"double_emphasis",
"(",
"self",
",",
"text",
")",
":",
"return",
"'<strong>%s</strong>'",
"%",
"text"
] | https://github.com/aantron/better-enums/blob/1e8f499ddff8eec43129ac974eebdfb745920643/doc/mistune.py#L752-L757 | |
klzgrad/naiveproxy | ed2c513637c77b18721fe428d7ed395b4d284c83 | src/build/android/gyp/util/parallel.py | python | ForkAndCall | (func, args) | return _WrappedResult(result, pool=pool) | Runs |func| in a fork'ed process.
Returns:
A Result object (call .get() to get the return value) | Runs |func| in a fork'ed process. | [
"Runs",
"|func|",
"in",
"a",
"fork",
"ed",
"process",
"."
] | def ForkAndCall(func, args):
"""Runs |func| in a fork'ed process.
Returns:
A Result object (call .get() to get the return value)
"""
if DISABLE_ASYNC:
pool = None
result = _ImmediateResult(func(*args))
else:
pool = _MakeProcessPool([args]) # Omit |kwargs|.
result = pool.apply_async(_Func... | [
"def",
"ForkAndCall",
"(",
"func",
",",
"args",
")",
":",
"if",
"DISABLE_ASYNC",
":",
"pool",
"=",
"None",
"result",
"=",
"_ImmediateResult",
"(",
"func",
"(",
"*",
"args",
")",
")",
"else",
":",
"pool",
"=",
"_MakeProcessPool",
"(",
"[",
"args",
"]",
... | https://github.com/klzgrad/naiveproxy/blob/ed2c513637c77b18721fe428d7ed395b4d284c83/src/build/android/gyp/util/parallel.py#L175-L188 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/tools/compatibility/ipynb.py | python | skip_magic | (code_line, magic_list) | return False | Checks if the cell has magic, that is not Python-based.
Args:
code_line: A line of Python code
magic_list: A list of jupyter "magic" exceptions
Returns:
If the line jupyter "magic" line, not Python line
>>> skip_magic('!ls -laF', ['%', '!', '?'])
True | Checks if the cell has magic, that is not Python-based. | [
"Checks",
"if",
"the",
"cell",
"has",
"magic",
"that",
"is",
"not",
"Python",
"-",
"based",
"."
] | def skip_magic(code_line, magic_list):
"""Checks if the cell has magic, that is not Python-based.
Args:
code_line: A line of Python code
magic_list: A list of jupyter "magic" exceptions
Returns:
If the line jupyter "magic" line, not Python line
>>> skip_magic('!ls -laF', ['%', '!', '?'])
T... | [
"def",
"skip_magic",
"(",
"code_line",
",",
"magic_list",
")",
":",
"for",
"magic",
"in",
"magic_list",
":",
"if",
"six",
".",
"ensure_str",
"(",
"code_line",
")",
".",
"startswith",
"(",
"magic",
")",
":",
"return",
"True",
"return",
"False"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/tools/compatibility/ipynb.py#L67-L85 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/fsspec/mapping.py | python | FSMap._str_to_key | (self, s) | return s[len(self.root) :].lstrip("/") | Strip path of to leave key name | Strip path of to leave key name | [
"Strip",
"path",
"of",
"to",
"leave",
"key",
"name"
] | def _str_to_key(self, s):
"""Strip path of to leave key name"""
return s[len(self.root) :].lstrip("/") | [
"def",
"_str_to_key",
"(",
"self",
",",
"s",
")",
":",
"return",
"s",
"[",
"len",
"(",
"self",
".",
"root",
")",
":",
"]",
".",
"lstrip",
"(",
"\"/\"",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/fsspec/mapping.py#L68-L70 | |
apple/swift | 469f72fdae2ea828b3b6c0d7d62d7e4cf98c4893 | utils/build_swift/build_swift/constants.py | python | _is_swift_checkout | (swift_path) | return True | Returns true if the given swift_path is a valid Swift checkout, false otherwise.
NOTE: This is a very naive validation, checking only for the existence of a few
known files. | Returns true if the given swift_path is a valid Swift checkout, false otherwise. | [
"Returns",
"true",
"if",
"the",
"given",
"swift_path",
"is",
"a",
"valid",
"Swift",
"checkout",
"false",
"otherwise",
"."
] | def _is_swift_checkout(swift_path):
"""Returns true if the given swift_path is a valid Swift checkout, false otherwise.
NOTE: This is a very naive validation, checking only for the existence of a few
known files.
"""
if not os.path.exists(os.path.join(swift_path, "utils")):
return False
... | [
"def",
"_is_swift_checkout",
"(",
"swift_path",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"os",
".",
"path",
".",
"join",
"(",
"swift_path",
",",
"\"utils\"",
")",
")",
":",
"return",
"False",
"if",
"not",
"os",
".",
"path",
".",
... | https://github.com/apple/swift/blob/469f72fdae2ea828b3b6c0d7d62d7e4cf98c4893/utils/build_swift/build_swift/constants.py#L84-L97 | |
cmu-db/bustub | fe1b9e984bd2967997b52df872c873d80f71cf7d | build_support/cpplint.py | python | _IncludeState.CheckNextIncludeOrder | (self, header_type) | return '' | Returns a non-empty error message if the next header is out of order.
This function also updates the internal state to be ready to check
the next include.
Args:
header_type: One of the _XXX_HEADER constants defined above.
Returns:
The empty string if the header is in the right order, or a... | Returns a non-empty error message if the next header is out of order. | [
"Returns",
"a",
"non",
"-",
"empty",
"error",
"message",
"if",
"the",
"next",
"header",
"is",
"out",
"of",
"order",
"."
] | def CheckNextIncludeOrder(self, header_type):
"""Returns a non-empty error message if the next header is out of order.
This function also updates the internal state to be ready to check
the next include.
Args:
header_type: One of the _XXX_HEADER constants defined above.
Returns:
The e... | [
"def",
"CheckNextIncludeOrder",
"(",
"self",
",",
"header_type",
")",
":",
"error_message",
"=",
"(",
"'Found %s after %s'",
"%",
"(",
"self",
".",
"_TYPE_NAMES",
"[",
"header_type",
"]",
",",
"self",
".",
"_SECTION_NAMES",
"[",
"self",
".",
"_section",
"]",
... | https://github.com/cmu-db/bustub/blob/fe1b9e984bd2967997b52df872c873d80f71cf7d/build_support/cpplint.py#L950-L1001 | |
google/VoltAir | 88bc3c8e09420d600d0b3d6d6c6eea75ebe0c5f2 | build/build_android.py | python | RunAndroidDeployQt | (qt_root, voltair_root, build_dir, ant, ndk_platform,
jdk) | Run the 'androiddeployqt' command.
Args:
qt_root: Qt framework location
voltair_root: VoltAir project location.
build_dir: Directory in which app was built. Need to run command here.
ant: And location
ndk_platform: Android platform (e.g. android-18)
jdk: Java Development Kit location | Run the 'androiddeployqt' command. | [
"Run",
"the",
"androiddeployqt",
"command",
"."
] | def RunAndroidDeployQt(qt_root, voltair_root, build_dir, ant, ndk_platform,
jdk):
"""Run the 'androiddeployqt' command.
Args:
qt_root: Qt framework location
voltair_root: VoltAir project location.
build_dir: Directory in which app was built. Need to run command here.
ant: And... | [
"def",
"RunAndroidDeployQt",
"(",
"qt_root",
",",
"voltair_root",
",",
"build_dir",
",",
"ant",
",",
"ndk_platform",
",",
"jdk",
")",
":",
"androiddeployqt",
"=",
"[",
"qt_root",
"+",
"\"/android_armv7/bin/androiddeployqt\"",
",",
"\"--input\"",
",",
"os",
".",
... | https://github.com/google/VoltAir/blob/88bc3c8e09420d600d0b3d6d6c6eea75ebe0c5f2/build/build_android.py#L146-L180 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py2/pandas/core/arrays/categorical.py | python | Categorical.__iter__ | (self) | return iter(self.get_values().tolist()) | Returns an Iterator over the values of this Categorical. | Returns an Iterator over the values of this Categorical. | [
"Returns",
"an",
"Iterator",
"over",
"the",
"values",
"of",
"this",
"Categorical",
"."
] | def __iter__(self):
"""
Returns an Iterator over the values of this Categorical.
"""
return iter(self.get_values().tolist()) | [
"def",
"__iter__",
"(",
"self",
")",
":",
"return",
"iter",
"(",
"self",
".",
"get_values",
"(",
")",
".",
"tolist",
"(",
")",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/core/arrays/categorical.py#L1926-L1930 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/ultimatelistctrl.py | python | UltimateListCtrl.GetScrolledWin | (self) | return self._headerWin.GetOwner() | Returns the header window owner. | Returns the header window owner. | [
"Returns",
"the",
"header",
"window",
"owner",
"."
] | def GetScrolledWin(self):
""" Returns the header window owner. """
return self._headerWin.GetOwner() | [
"def",
"GetScrolledWin",
"(",
"self",
")",
":",
"return",
"self",
".",
"_headerWin",
".",
"GetOwner",
"(",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/ultimatelistctrl.py#L12448-L12451 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/s3transfer/bandwidth.py | python | ConsumptionScheduler.is_scheduled | (self, token) | return token in self._tokens_to_scheduled_consumption | Indicates if a consumption request has been scheduled
:type token: RequestToken
:param token: The token associated to the consumption
request that is used to identify the request. | Indicates if a consumption request has been scheduled | [
"Indicates",
"if",
"a",
"consumption",
"request",
"has",
"been",
"scheduled"
] | def is_scheduled(self, token):
"""Indicates if a consumption request has been scheduled
:type token: RequestToken
:param token: The token associated to the consumption
request that is used to identify the request.
"""
return token in self._tokens_to_scheduled_consump... | [
"def",
"is_scheduled",
"(",
"self",
",",
"token",
")",
":",
"return",
"token",
"in",
"self",
".",
"_tokens_to_scheduled_consumption"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/s3transfer/bandwidth.py#L294-L301 | |
kushview/Element | 1cc16380caa2ab79461246ba758b9de1f46db2a5 | waflib/Logs.py | python | debug | (*k, **kw) | Wraps logging.debug and discards messages if the verbosity level :py:attr:`waflib.Logs.verbose` ≤ 0 | Wraps logging.debug and discards messages if the verbosity level :py:attr:`waflib.Logs.verbose` ≤ 0 | [
"Wraps",
"logging",
".",
"debug",
"and",
"discards",
"messages",
"if",
"the",
"verbosity",
"level",
":",
"py",
":",
"attr",
":",
"waflib",
".",
"Logs",
".",
"verbose",
"≤",
"0"
] | def debug(*k, **kw):
"""
Wraps logging.debug and discards messages if the verbosity level :py:attr:`waflib.Logs.verbose` ≤ 0
"""
if verbose:
k = list(k)
k[0] = k[0].replace('\n', ' ')
log.debug(*k, **kw) | [
"def",
"debug",
"(",
"*",
"k",
",",
"*",
"*",
"kw",
")",
":",
"if",
"verbose",
":",
"k",
"=",
"list",
"(",
"k",
")",
"k",
"[",
"0",
"]",
"=",
"k",
"[",
"0",
"]",
".",
"replace",
"(",
"'\\n'",
",",
"' '",
")",
"log",
".",
"debug",
"(",
"... | https://github.com/kushview/Element/blob/1cc16380caa2ab79461246ba758b9de1f46db2a5/waflib/Logs.py#L254-L261 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/extern/aui/dockart.py | python | AuiDefaultDockArt.__init__ | (self) | Default class constructor. | Default class constructor. | [
"Default",
"class",
"constructor",
"."
] | def __init__(self):
""" Default class constructor. """
self.Init()
isMac = wx.Platform == "__WXMAC__"
if isMac:
self._caption_font = wx.SMALL_FONT
else:
self._caption_font = wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, False)
self.SetDefaultPan... | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"Init",
"(",
")",
"isMac",
"=",
"wx",
".",
"Platform",
"==",
"\"__WXMAC__\"",
"if",
"isMac",
":",
"self",
".",
"_caption_font",
"=",
"wx",
".",
"SMALL_FONT",
"else",
":",
"self",
".",
"_caption_fon... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/extern/aui/dockart.py#L139-L181 | ||
JoseExposito/touchegg | 1f3fda214358d071c05da4bf17c070c33d67b5eb | cmake/cpplint.py | python | _IncludeState.IsInAlphabeticalOrder | (self, clean_lines, linenum, header_path) | return True | Check if a header is in alphabetical order with the previous header.
Args:
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
header_path: Canonicalized header to be checked.
Returns:
Returns true if the header is in alphabetical order. | Check if a header is in alphabetical order with the previous header. | [
"Check",
"if",
"a",
"header",
"is",
"in",
"alphabetical",
"order",
"with",
"the",
"previous",
"header",
"."
] | def IsInAlphabeticalOrder(self, clean_lines, linenum, header_path):
"""Check if a header is in alphabetical order with the previous header.
Args:
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
header_path: Canonicalized header to be checke... | [
"def",
"IsInAlphabeticalOrder",
"(",
"self",
",",
"clean_lines",
",",
"linenum",
",",
"header_path",
")",
":",
"# If previous section is different from current section, _last_header will",
"# be reset to empty string, so it's always less than current header.",
"#",
"# If previous line ... | https://github.com/JoseExposito/touchegg/blob/1f3fda214358d071c05da4bf17c070c33d67b5eb/cmake/cpplint.py#L787-L806 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py2/numpy/polynomial/hermite_e.py | python | herme2poly | (c) | Convert a Hermite series to a polynomial.
Convert an array representing the coefficients of a Hermite series,
ordered from lowest degree to highest, to an array of the coefficients
of the equivalent polynomial (relative to the "standard" basis) ordered
from lowest to highest degree.
Parameters
... | Convert a Hermite series to a polynomial. | [
"Convert",
"a",
"Hermite",
"series",
"to",
"a",
"polynomial",
"."
] | def herme2poly(c):
"""
Convert a Hermite series to a polynomial.
Convert an array representing the coefficients of a Hermite series,
ordered from lowest degree to highest, to an array of the coefficients
of the equivalent polynomial (relative to the "standard" basis) ordered
from lowest to high... | [
"def",
"herme2poly",
"(",
"c",
")",
":",
"from",
".",
"polynomial",
"import",
"polyadd",
",",
"polysub",
",",
"polymulx",
"[",
"c",
"]",
"=",
"pu",
".",
"as_series",
"(",
"[",
"c",
"]",
")",
"n",
"=",
"len",
"(",
"c",
")",
"if",
"n",
"==",
"1",... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py2/numpy/polynomial/hermite_e.py#L129-L183 | ||
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/math/autodiff/math_ad.py | python | quadratric | (A,x) | return _ADQuadratic(A)(x) | Autodiff'ed function comparable to np.dot(x,np.dot(A,x)). A must be a
constant, 2D np.array. x may be an expression. | Autodiff'ed function comparable to np.dot(x,np.dot(A,x)). A must be a
constant, 2D np.array. x may be an expression. | [
"Autodiff",
"ed",
"function",
"comparable",
"to",
"np",
".",
"dot",
"(",
"x",
"np",
".",
"dot",
"(",
"A",
"x",
"))",
".",
"A",
"must",
"be",
"a",
"constant",
"2D",
"np",
".",
"array",
".",
"x",
"may",
"be",
"an",
"expression",
"."
] | def quadratric(A,x):
"""Autodiff'ed function comparable to np.dot(x,np.dot(A,x)). A must be a
constant, 2D np.array. x may be an expression."""
return _ADQuadratic(A)(x) | [
"def",
"quadratric",
"(",
"A",
",",
"x",
")",
":",
"return",
"_ADQuadratic",
"(",
"A",
")",
"(",
"x",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/math/autodiff/math_ad.py#L444-L447 | |
nnrg/opennero | 43e12a1bcba6e228639db3886fec1dc47ddc24cb | mods/TowerofHanoi/client.py | python | speedup_adjusted | (ui) | return closure | generate a closure that will be called whenever the speedup slider is adjusted | generate a closure that will be called whenever the speedup slider is adjusted | [
"generate",
"a",
"closure",
"that",
"will",
"be",
"called",
"whenever",
"the",
"speedup",
"slider",
"is",
"adjusted"
] | def speedup_adjusted(ui):
"""generate a closure that will be called whenever the speedup slider is adjusted"""
ui.speedupValue.text = str(ui.speedupScroll.getPos())
getMod().set_speedup(float(ui.speedupScroll.getPos())/100)
def closure():
"""called whenever the speedup slider is adjusted"""
... | [
"def",
"speedup_adjusted",
"(",
"ui",
")",
":",
"ui",
".",
"speedupValue",
".",
"text",
"=",
"str",
"(",
"ui",
".",
"speedupScroll",
".",
"getPos",
"(",
")",
")",
"getMod",
"(",
")",
".",
"set_speedup",
"(",
"float",
"(",
"ui",
".",
"speedupScroll",
... | https://github.com/nnrg/opennero/blob/43e12a1bcba6e228639db3886fec1dc47ddc24cb/mods/TowerofHanoi/client.py#L79-L87 | |
xbmc/xbmc | 091211a754589fc40a2a1f239b0ce9f4ee138268 | addons/metadata.tvshows.themoviedb.org.python/libs/actions.py | python | get_details | (show_id) | Get details about a specific show | Get details about a specific show | [
"Get",
"details",
"about",
"a",
"specific",
"show"
] | def get_details(show_id):
# type: (Text) -> None
"""Get details about a specific show"""
logger.debug('Getting details for show id {}'.format(show_id))
show_info = tmdb.load_show_info(show_id)
if show_info is not None:
list_item = xbmcgui.ListItem(show_info['name'], offscreen=True)
l... | [
"def",
"get_details",
"(",
"show_id",
")",
":",
"# type: (Text) -> None",
"logger",
".",
"debug",
"(",
"'Getting details for show id {}'",
".",
"format",
"(",
"show_id",
")",
")",
"show_info",
"=",
"tmdb",
".",
"load_show_info",
"(",
"show_id",
")",
"if",
"show_... | https://github.com/xbmc/xbmc/blob/091211a754589fc40a2a1f239b0ce9f4ee138268/addons/metadata.tvshows.themoviedb.org.python/libs/actions.py#L92-L102 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/_pydecimal.py | python | Context.is_zero | (self, a) | return a.is_zero() | Return True if the operand is a zero; otherwise return False.
>>> ExtendedContext.is_zero(Decimal('0'))
True
>>> ExtendedContext.is_zero(Decimal('2.50'))
False
>>> ExtendedContext.is_zero(Decimal('-0E+2'))
True
>>> ExtendedContext.is_zero(1)
False
... | Return True if the operand is a zero; otherwise return False. | [
"Return",
"True",
"if",
"the",
"operand",
"is",
"a",
"zero",
";",
"otherwise",
"return",
"False",
"."
] | def is_zero(self, a):
"""Return True if the operand is a zero; otherwise return False.
>>> ExtendedContext.is_zero(Decimal('0'))
True
>>> ExtendedContext.is_zero(Decimal('2.50'))
False
>>> ExtendedContext.is_zero(Decimal('-0E+2'))
True
>>> ExtendedContext... | [
"def",
"is_zero",
"(",
"self",
",",
"a",
")",
":",
"a",
"=",
"_convert_other",
"(",
"a",
",",
"raiseit",
"=",
"True",
")",
"return",
"a",
".",
"is_zero",
"(",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/_pydecimal.py#L4645-L4660 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/collections.py | python | OrderedDict.items | (self) | return [(key, self[key]) for key in self] | od.items() -> list of (key, value) pairs in od | od.items() -> list of (key, value) pairs in od | [
"od",
".",
"items",
"()",
"-",
">",
"list",
"of",
"(",
"key",
"value",
")",
"pairs",
"in",
"od"
] | def items(self):
'od.items() -> list of (key, value) pairs in od'
return [(key, self[key]) for key in self] | [
"def",
"items",
"(",
"self",
")",
":",
"return",
"[",
"(",
"key",
",",
"self",
"[",
"key",
"]",
")",
"for",
"key",
"in",
"self",
"]"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/collections.py#L125-L127 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/check_ops.py | python | is_strictly_increasing | (x, name=None) | Returns `True` if `x` is strictly increasing.
Elements of `x` are compared in row-major order. The tensor `[x[0],...]`
is strictly increasing if for every adjacent pair we have `x[i] < x[i+1]`.
If `x` has less than two elements, it is trivially strictly increasing.
See also: `is_non_decreasing`
Args:
... | Returns `True` if `x` is strictly increasing. | [
"Returns",
"True",
"if",
"x",
"is",
"strictly",
"increasing",
"."
] | def is_strictly_increasing(x, name=None):
"""Returns `True` if `x` is strictly increasing.
Elements of `x` are compared in row-major order. The tensor `[x[0],...]`
is strictly increasing if for every adjacent pair we have `x[i] < x[i+1]`.
If `x` has less than two elements, it is trivially strictly increasing.... | [
"def",
"is_strictly_increasing",
"(",
"x",
",",
"name",
"=",
"None",
")",
":",
"with",
"ops",
".",
"name_scope",
"(",
"name",
",",
"'is_strictly_increasing'",
",",
"[",
"x",
"]",
")",
":",
"diff",
"=",
"_get_diff_for_monotonic_comparison",
"(",
"x",
")",
"... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/check_ops.py#L1941-L1965 | ||
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | lts/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/mac_tool.py | python | MacTool._LoadPlistMaybeBinary | (self, plist_path) | Loads into a memory a plist possibly encoded in binary format.
This is a wrapper around plistlib.readPlist that tries to convert the
plist to the XML format if it can't be parsed (assuming that it is in
the binary format).
Args:
plist_path: string, path to a plist file, in XML or binary format
... | Loads into a memory a plist possibly encoded in binary format. | [
"Loads",
"into",
"a",
"memory",
"a",
"plist",
"possibly",
"encoded",
"in",
"binary",
"format",
"."
] | def _LoadPlistMaybeBinary(self, plist_path):
"""Loads into a memory a plist possibly encoded in binary format.
This is a wrapper around plistlib.readPlist that tries to convert the
plist to the XML format if it can't be parsed (assuming that it is in
the binary format).
Args:
plist_path: str... | [
"def",
"_LoadPlistMaybeBinary",
"(",
"self",
",",
"plist_path",
")",
":",
"try",
":",
"# First, try to read the file using plistlib that only supports XML,",
"# and if an exception is raised, convert a temporary copy to XML and",
"# load that copy.",
"return",
"plistlib",
".",
"readP... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/mac_tool.py#L505-L528 | ||
RLBot/RLBot | 34332b12cf158b3ef8dbf174ae67c53683368a9d | src/main/python/rlbot/matchconfig/match_config.py | python | get_sanitized_bot_name | (dict: Dict[str, int], name: str) | return name | Cut off at 31 characters and handle duplicates.
:param dict: Holds the list of names for duplicates
:param name: The name that is being sanitized
:return: A sanitized version of the name | Cut off at 31 characters and handle duplicates.
:param dict: Holds the list of names for duplicates
:param name: The name that is being sanitized
:return: A sanitized version of the name | [
"Cut",
"off",
"at",
"31",
"characters",
"and",
"handle",
"duplicates",
".",
":",
"param",
"dict",
":",
"Holds",
"the",
"list",
"of",
"names",
"for",
"duplicates",
":",
"param",
"name",
":",
"The",
"name",
"that",
"is",
"being",
"sanitized",
":",
"return"... | def get_sanitized_bot_name(dict: Dict[str, int], name: str) -> str:
"""
Cut off at 31 characters and handle duplicates.
:param dict: Holds the list of names for duplicates
:param name: The name that is being sanitized
:return: A sanitized version of the name
"""
# This doesn't work someimte... | [
"def",
"get_sanitized_bot_name",
"(",
"dict",
":",
"Dict",
"[",
"str",
",",
"int",
"]",
",",
"name",
":",
"str",
")",
"->",
"str",
":",
"# This doesn't work someimtes in continue_and_spawn because it doesn't understand the names already in the match",
"# which may be kept if ... | https://github.com/RLBot/RLBot/blob/34332b12cf158b3ef8dbf174ae67c53683368a9d/src/main/python/rlbot/matchconfig/match_config.py#L336-L354 | |
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Arch/importIFClegacy.py | python | insert | (filename,docname,skip=None) | return doc | called when freecad wants to import a file | called when freecad wants to import a file | [
"called",
"when",
"freecad",
"wants",
"to",
"import",
"a",
"file"
] | def insert(filename,docname,skip=None):
"called when freecad wants to import a file"
try:
doc = FreeCAD.getDocument(docname)
except NameError:
doc = FreeCAD.newDocument(docname)
FreeCAD.ActiveDocument = doc
getConfig()
read(filename,skip)
return doc | [
"def",
"insert",
"(",
"filename",
",",
"docname",
",",
"skip",
"=",
"None",
")",
":",
"try",
":",
"doc",
"=",
"FreeCAD",
".",
"getDocument",
"(",
"docname",
")",
"except",
"NameError",
":",
"doc",
"=",
"FreeCAD",
".",
"newDocument",
"(",
"docname",
")"... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Arch/importIFClegacy.py#L70-L79 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.